@fiado/api-invoker 4.4.0 → 4.6.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/container.config.js +3 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/multicommServicePayment/api/MulticommServicePaymentApi.d.ts +1 -0
- package/bin/multicommServicePayment/api/MulticommServicePaymentApi.js +4 -0
- package/bin/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.d.ts +1 -0
- package/bin/platformRbac/api/PlatformRbacBusinessApi.d.ts +26 -0
- package/bin/platformRbac/api/PlatformRbacBusinessApi.js +54 -0
- package/bin/platformRbac/api/interfaces/IPlatformRbacBusinessApi.d.ts +40 -0
- package/bin/platformRbac/api/interfaces/IPlatformRbacBusinessApi.js +2 -0
- package/bin/platformRbac/index.d.ts +2 -0
- package/bin/platformRbac/index.js +23 -0
- package/bin/stpServicePayment/api/StpServicePaymentApi.d.ts +1 -0
- package/bin/stpServicePayment/api/StpServicePaymentApi.js +4 -0
- package/bin/stpServicePayment/api/interfaces/IStpServicePaymentApi.d.ts +1 -0
- package/docs/TECH_DEBT.md +16 -0
- package/package.json +1 -1
- package/src/container.config.ts +5 -0
- package/src/index.ts +1 -0
- package/src/multicommServicePayment/api/MulticommServicePaymentApi.ts +5 -0
- package/src/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.ts +4 -0
- package/src/platformRbac/api/PlatformRbacBusinessApi.ts +55 -0
- package/src/platformRbac/api/interfaces/IPlatformRbacBusinessApi.ts +56 -0
- package/src/platformRbac/index.ts +2 -0
- package/src/stpServicePayment/api/StpServicePaymentApi.ts +5 -0
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +4 -0
package/bin/container.config.js
CHANGED
|
@@ -103,6 +103,7 @@ const BenefitsMarketplaceApi_1 = __importDefault(require("./benefits-marketplace
|
|
|
103
103
|
// UniTeller remittance connector (Fase 2 remittance)
|
|
104
104
|
const uniteller_connector_1 = require("./uniteller-connector");
|
|
105
105
|
const CognitoBackofficeConnectorApi_1 = __importDefault(require("./cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi"));
|
|
106
|
+
const PlatformRbacBusinessApi_1 = __importDefault(require("./platformRbac/api/PlatformRbacBusinessApi"));
|
|
106
107
|
exports.apiInvokerBindings = new inversify_1.ContainerModule(({ bind }) => {
|
|
107
108
|
// UTILS bindings
|
|
108
109
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -210,4 +211,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule(({ bind }) => {
|
|
|
210
211
|
bind("IUnitellerConnectorApi").to(uniteller_connector_1.UnitellerConnectorApi);
|
|
211
212
|
// Cognito backoffice connector (Fase 0 SureKeep)
|
|
212
213
|
bind("ICognitoBackofficeConnectorApi").to(CognitoBackofficeConnectorApi_1.default);
|
|
214
|
+
// Platform RBAC business — Custom Auth Challenge endpoints (Fase 0 SureKeep)
|
|
215
|
+
bind("IPlatformRbacBusinessApi").to(PlatformRbacBusinessApi_1.default);
|
|
213
216
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -90,3 +90,4 @@ __exportStar(require("./ai-engine-connector"), exports);
|
|
|
90
90
|
__exportStar(require("./benefits-marketplace"), exports);
|
|
91
91
|
__exportStar(require("./milestone-business"), exports);
|
|
92
92
|
__exportStar(require("./cognitoBackofficeConnector"), exports);
|
|
93
|
+
__exportStar(require("./platformRbac"), exports);
|
|
@@ -32,4 +32,5 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
|
|
|
32
32
|
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
33
33
|
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
34
34
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
35
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
35
36
|
}
|
|
@@ -85,6 +85,10 @@ let MulticommServicePaymentApi = class MulticommServicePaymentApi {
|
|
|
85
85
|
const url = `${this.baseUrl}/internal/services/${idServicio}`;
|
|
86
86
|
return await this.httpRequest.put(url, patch);
|
|
87
87
|
}
|
|
88
|
+
async createService(payload) {
|
|
89
|
+
const url = `${this.baseUrl}/internal/services`;
|
|
90
|
+
return await this.httpRequest.post(url, payload);
|
|
91
|
+
}
|
|
88
92
|
};
|
|
89
93
|
MulticommServicePaymentApi = __decorate([
|
|
90
94
|
(0, inversify_1.injectable)(),
|
|
@@ -27,4 +27,5 @@ export interface IMulticommServicePaymentApi {
|
|
|
27
27
|
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
28
28
|
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
29
29
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
30
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
30
31
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse } from "@fiado/type-kit/bin/platformRbac";
|
|
4
|
+
import { IPlatformRbacBusinessApi } from "./interfaces/IPlatformRbacBusinessApi";
|
|
5
|
+
/**
|
|
6
|
+
* Publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
|
|
7
|
+
* para los 3 endpoints internos del Custom Auth Challenge flow.
|
|
8
|
+
*
|
|
9
|
+
* Env var requerida en el consumer: `PLATFORM_RBAC_BUSINESS_URL`.
|
|
10
|
+
* El template.yml del consumer la setea con:
|
|
11
|
+
*
|
|
12
|
+
* PLATFORM_RBAC_BUSINESS_URL: '{{resolve:ssm:platform-rbac-business}}'
|
|
13
|
+
*
|
|
14
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
15
|
+
* El rbac-business publica su URL en SSM bajo la key `platform-rbac-business`
|
|
16
|
+
* vía el `post_build` del buildspec.yml estándar Fiado.
|
|
17
|
+
*/
|
|
18
|
+
export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi {
|
|
19
|
+
private httpRequest;
|
|
20
|
+
/** URL base del lambda. Leída de env var en cold start del consumer. */
|
|
21
|
+
private readonly baseUrl;
|
|
22
|
+
constructor(httpRequest: IHttpRequest);
|
|
23
|
+
defineNextChallenge(input: DefineNextChallengeRequest): Promise<ApiGatewayResponse<DefineNextChallengeResponse>>;
|
|
24
|
+
prepareChallenge(input: PrepareChallengeRequest): Promise<ApiGatewayResponse<PrepareChallengeResponse>>;
|
|
25
|
+
verifyChallenge(input: VerifyChallengeRequest): Promise<ApiGatewayResponse<VerifyChallengeResponse>>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
|
|
18
|
+
* para los 3 endpoints internos del Custom Auth Challenge flow.
|
|
19
|
+
*
|
|
20
|
+
* Env var requerida en el consumer: `PLATFORM_RBAC_BUSINESS_URL`.
|
|
21
|
+
* El template.yml del consumer la setea con:
|
|
22
|
+
*
|
|
23
|
+
* PLATFORM_RBAC_BUSINESS_URL: '{{resolve:ssm:platform-rbac-business}}'
|
|
24
|
+
*
|
|
25
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
26
|
+
* El rbac-business publica su URL en SSM bajo la key `platform-rbac-business`
|
|
27
|
+
* vía el `post_build` del buildspec.yml estándar Fiado.
|
|
28
|
+
*/
|
|
29
|
+
let PlatformRbacBusinessApi = class PlatformRbacBusinessApi {
|
|
30
|
+
httpRequest;
|
|
31
|
+
/** URL base del lambda. Leída de env var en cold start del consumer. */
|
|
32
|
+
baseUrl = process.env.PLATFORM_RBAC_BUSINESS_URL || "";
|
|
33
|
+
constructor(httpRequest) {
|
|
34
|
+
this.httpRequest = httpRequest;
|
|
35
|
+
}
|
|
36
|
+
async defineNextChallenge(input) {
|
|
37
|
+
const url = `${this.baseUrl}/internal/auth/define-next-challenge`;
|
|
38
|
+
return await this.httpRequest.post(url, input);
|
|
39
|
+
}
|
|
40
|
+
async prepareChallenge(input) {
|
|
41
|
+
const url = `${this.baseUrl}/internal/auth/prepare-challenge`;
|
|
42
|
+
return await this.httpRequest.post(url, input);
|
|
43
|
+
}
|
|
44
|
+
async verifyChallenge(input) {
|
|
45
|
+
const url = `${this.baseUrl}/internal/auth/verify-challenge`;
|
|
46
|
+
return await this.httpRequest.post(url, input);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
PlatformRbacBusinessApi = __decorate([
|
|
50
|
+
(0, inversify_1.injectable)(),
|
|
51
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
52
|
+
__metadata("design:paramtypes", [Object])
|
|
53
|
+
], PlatformRbacBusinessApi);
|
|
54
|
+
exports.default = PlatformRbacBusinessApi;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse } from "@fiado/type-kit/bin/platformRbac";
|
|
3
|
+
/**
|
|
4
|
+
* Contrato del publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
|
|
5
|
+
* para los 3 endpoints internos del Custom Auth Challenge flow (MFA).
|
|
6
|
+
*
|
|
7
|
+
* Consumidores: `cognito-backoffice-connector` desde los Lambda Triggers
|
|
8
|
+
* `defineAuthChallenge`, `createAuthChallenge` y `verifyAuthChallengeResponse`
|
|
9
|
+
* configurados en cada User Pool aprovisionado por la saga `TenantOnboardingManager`.
|
|
10
|
+
*
|
|
11
|
+
* Patrón de retorno: `Promise<ApiGatewayResponse<T>>` sin unwrap (v4 canonical Fiado).
|
|
12
|
+
* El consumer accede `result.body.data` para llegar al payload tipado.
|
|
13
|
+
*
|
|
14
|
+
* Env var requerida en el consumer: `PLATFORM_RBAC_BUSINESS_URL`.
|
|
15
|
+
* El template.yml del consumer la setea con:
|
|
16
|
+
*
|
|
17
|
+
* PLATFORM_RBAC_BUSINESS_URL: '{{resolve:ssm:platform-rbac-business}}'
|
|
18
|
+
*
|
|
19
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
20
|
+
*/
|
|
21
|
+
export interface IPlatformRbacBusinessApi {
|
|
22
|
+
/**
|
|
23
|
+
* POST /internal/auth/define-next-challenge — decide el próximo challenge MFA
|
|
24
|
+
* según los resultados acumulados en `session`. Invocado por el trigger
|
|
25
|
+
* `defineAuthChallenge` en cada paso del Custom Auth Challenge flow.
|
|
26
|
+
*/
|
|
27
|
+
defineNextChallenge(input: DefineNextChallengeRequest): Promise<ApiGatewayResponse<DefineNextChallengeResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* POST /internal/auth/prepare-challenge — prepara el challenge (genera y envía
|
|
30
|
+
* código OTP por email/SMS, o computa el `privateChallenge` para TOTP).
|
|
31
|
+
* Invocado por el trigger `createAuthChallenge`.
|
|
32
|
+
*/
|
|
33
|
+
prepareChallenge(input: PrepareChallengeRequest): Promise<ApiGatewayResponse<PrepareChallengeResponse>>;
|
|
34
|
+
/**
|
|
35
|
+
* POST /internal/auth/verify-challenge — verifica la respuesta del usuario
|
|
36
|
+
* contra el `privateChallenge`. Invocado por el trigger
|
|
37
|
+
* `verifyAuthChallengeResponse`.
|
|
38
|
+
*/
|
|
39
|
+
verifyChallenge(input: VerifyChallengeRequest): Promise<ApiGatewayResponse<VerifyChallengeResponse>>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.PlatformRbacBusinessApi = void 0;
|
|
21
|
+
__exportStar(require("./api/interfaces/IPlatformRbacBusinessApi"), exports);
|
|
22
|
+
var PlatformRbacBusinessApi_1 = require("./api/PlatformRbacBusinessApi");
|
|
23
|
+
Object.defineProperty(exports, "PlatformRbacBusinessApi", { enumerable: true, get: function () { return __importDefault(PlatformRbacBusinessApi_1).default; } });
|
|
@@ -28,4 +28,5 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
|
|
|
28
28
|
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
29
29
|
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
30
30
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
31
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
31
32
|
}
|
|
@@ -85,6 +85,10 @@ let StpServicePaymentApi = class StpServicePaymentApi {
|
|
|
85
85
|
const url = `${this.baseUrl}/internal/services/${idServicio}`;
|
|
86
86
|
return await this.httpRequest.put(url, patch);
|
|
87
87
|
}
|
|
88
|
+
async createService(payload) {
|
|
89
|
+
const url = `${this.baseUrl}/internal/services`;
|
|
90
|
+
return await this.httpRequest.post(url, payload);
|
|
91
|
+
}
|
|
88
92
|
};
|
|
89
93
|
StpServicePaymentApi = __decorate([
|
|
90
94
|
(0, inversify_1.injectable)(),
|
|
@@ -23,4 +23,5 @@ export interface IStpServicePaymentApi {
|
|
|
23
23
|
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
24
24
|
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
25
25
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
26
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
26
27
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# TECH_DEBT — @fiado/api-invoker
|
|
2
|
+
|
|
3
|
+
Registro vivo de deudas conscientes del repo. Cada entrada con ID estable `TD-AI-NNN` y los 4 campos canónicos (contexto / asunción / condición para cerrar / bloqueante).
|
|
4
|
+
|
|
5
|
+
## TD-AI-001 — 2026-05-29 — npm link @fiado/type-kit activo
|
|
6
|
+
|
|
7
|
+
- **Contexto:** `node_modules/@fiado/type-kit` es symlink local a `C:/Users/Fiado/Documents/Repos/fiado-type-kit/` (v3.43.1) — el publicado en CodeArtifact es v3.42.0 sin el módulo `platformRbac` que el Publisher `PlatformRbacBusinessApi` nuevo (`src/platformRbac/`) importa. El link se activó para iterar localmente sin publish prematuro del type-kit (decisión del user en el plan `2026-05-29-custom-auth-challenge-mfa.md`).
|
|
8
|
+
- **Asunción / pendiente:** el `npm run build` y `tsc --noEmit` funcionan con el link, pero CI y cualquier `npm install` fresh van a resolver desde CodeArtifact (3.42.0) y fallar con `TS2307: Cannot find module '@fiado/type-kit/bin/platformRbac'` en los 2 archivos nuevos del Publisher.
|
|
9
|
+
- **Condición para cerrar:** secuencia obligatoria al final del plan de auth (después de todas las tasks):
|
|
10
|
+
1. `cd /c/Users/Fiado/Documents/Repos/fiado-type-kit && npm publish` (Andres ejecuta).
|
|
11
|
+
2. `cd /c/Users/Fiado/fiado-workspace/fiado-api-invoker && npm unlink @fiado/type-kit`.
|
|
12
|
+
3. Actualizar `package.json` del api-invoker con la version publicada del type-kit (`"@fiado/type-kit": "^3.43.1"`).
|
|
13
|
+
4. `npm install` fresh.
|
|
14
|
+
5. `npx tsc --noEmit` verde.
|
|
15
|
+
6. `npm publish` del api-invoker en su nueva version (Andres ejecuta).
|
|
16
|
+
- **Bloqueante:** SÍ — el primer deploy productivo o CI run del api-invoker (y de cualquier consumer que bumpee a la 4.6.0) rompe si el publish del type-kit NO se materializó antes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.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
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
package/src/container.config.ts
CHANGED
|
@@ -154,6 +154,8 @@ import BenefitsMarketplaceApi from "./benefits-marketplace/api/BenefitsMarketpla
|
|
|
154
154
|
import { IUnitellerConnectorApi, UnitellerConnectorApi } from "./uniteller-connector";
|
|
155
155
|
import { ICognitoBackofficeConnectorApi } from "./cognitoBackofficeConnector";
|
|
156
156
|
import CognitoBackofficeConnectorApi from "./cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi";
|
|
157
|
+
import { IPlatformRbacBusinessApi } from "./platformRbac";
|
|
158
|
+
import PlatformRbacBusinessApi from "./platformRbac/api/PlatformRbacBusinessApi";
|
|
157
159
|
|
|
158
160
|
export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
159
161
|
// UTILS bindings
|
|
@@ -273,4 +275,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
273
275
|
|
|
274
276
|
// Cognito backoffice connector (Fase 0 SureKeep)
|
|
275
277
|
bind<ICognitoBackofficeConnectorApi>("ICognitoBackofficeConnectorApi").to(CognitoBackofficeConnectorApi);
|
|
278
|
+
|
|
279
|
+
// Platform RBAC business — Custom Auth Challenge endpoints (Fase 0 SureKeep)
|
|
280
|
+
bind<IPlatformRbacBusinessApi>("IPlatformRbacBusinessApi").to(PlatformRbacBusinessApi);
|
|
276
281
|
});
|
package/src/index.ts
CHANGED
|
@@ -87,4 +87,9 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
|
|
|
87
87
|
const url = `${this.baseUrl}/internal/services/${idServicio}`;
|
|
88
88
|
return await this.httpRequest.put(url, patch);
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
async createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>> {
|
|
92
|
+
const url = `${this.baseUrl}/internal/services`;
|
|
93
|
+
return await this.httpRequest.post(url, payload);
|
|
94
|
+
}
|
|
90
95
|
}
|
|
@@ -38,4 +38,8 @@ export interface IMulticommServicePaymentApi {
|
|
|
38
38
|
// admin. Consumido por LeafAdminManager de benefits-marketplace-business para
|
|
39
39
|
// edición editorial in-place (admin-leaves v2).
|
|
40
40
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
41
|
+
|
|
42
|
+
// POST /internal/services — alta manual de un servicio nuevo (admin-leaves v2).
|
|
43
|
+
// Consumido por LeafAdminManager de benefits-marketplace-business.
|
|
44
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
41
45
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
// TD-AI-001: import de @fiado/type-kit/bin/platformRbac requiere npm link a type-kit 3.43.1 hasta publish final. Ver docs/TECH_DEBT.md.
|
|
5
|
+
import {
|
|
6
|
+
DefineNextChallengeRequest,
|
|
7
|
+
DefineNextChallengeResponse,
|
|
8
|
+
PrepareChallengeRequest,
|
|
9
|
+
PrepareChallengeResponse,
|
|
10
|
+
VerifyChallengeRequest,
|
|
11
|
+
VerifyChallengeResponse,
|
|
12
|
+
} from "@fiado/type-kit/bin/platformRbac";
|
|
13
|
+
import { IPlatformRbacBusinessApi } from "./interfaces/IPlatformRbacBusinessApi";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
|
|
17
|
+
* para los 3 endpoints internos del Custom Auth Challenge flow.
|
|
18
|
+
*
|
|
19
|
+
* Env var requerida en el consumer: `PLATFORM_RBAC_BUSINESS_URL`.
|
|
20
|
+
* El template.yml del consumer la setea con:
|
|
21
|
+
*
|
|
22
|
+
* PLATFORM_RBAC_BUSINESS_URL: '{{resolve:ssm:platform-rbac-business}}'
|
|
23
|
+
*
|
|
24
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
25
|
+
* El rbac-business publica su URL en SSM bajo la key `platform-rbac-business`
|
|
26
|
+
* vía el `post_build` del buildspec.yml estándar Fiado.
|
|
27
|
+
*/
|
|
28
|
+
@injectable()
|
|
29
|
+
export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi {
|
|
30
|
+
/** URL base del lambda. Leída de env var en cold start del consumer. */
|
|
31
|
+
private readonly baseUrl = process.env.PLATFORM_RBAC_BUSINESS_URL || "";
|
|
32
|
+
|
|
33
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
34
|
+
|
|
35
|
+
async defineNextChallenge(
|
|
36
|
+
input: DefineNextChallengeRequest,
|
|
37
|
+
): Promise<ApiGatewayResponse<DefineNextChallengeResponse>> {
|
|
38
|
+
const url = `${this.baseUrl}/internal/auth/define-next-challenge`;
|
|
39
|
+
return await this.httpRequest.post(url, input);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async prepareChallenge(
|
|
43
|
+
input: PrepareChallengeRequest,
|
|
44
|
+
): Promise<ApiGatewayResponse<PrepareChallengeResponse>> {
|
|
45
|
+
const url = `${this.baseUrl}/internal/auth/prepare-challenge`;
|
|
46
|
+
return await this.httpRequest.post(url, input);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async verifyChallenge(
|
|
50
|
+
input: VerifyChallengeRequest,
|
|
51
|
+
): Promise<ApiGatewayResponse<VerifyChallengeResponse>> {
|
|
52
|
+
const url = `${this.baseUrl}/internal/auth/verify-challenge`;
|
|
53
|
+
return await this.httpRequest.post(url, input);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import {
|
|
3
|
+
DefineNextChallengeRequest,
|
|
4
|
+
DefineNextChallengeResponse,
|
|
5
|
+
PrepareChallengeRequest,
|
|
6
|
+
PrepareChallengeResponse,
|
|
7
|
+
VerifyChallengeRequest,
|
|
8
|
+
VerifyChallengeResponse,
|
|
9
|
+
} from "@fiado/type-kit/bin/platformRbac";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Contrato del publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
|
|
13
|
+
* para los 3 endpoints internos del Custom Auth Challenge flow (MFA).
|
|
14
|
+
*
|
|
15
|
+
* Consumidores: `cognito-backoffice-connector` desde los Lambda Triggers
|
|
16
|
+
* `defineAuthChallenge`, `createAuthChallenge` y `verifyAuthChallengeResponse`
|
|
17
|
+
* configurados en cada User Pool aprovisionado por la saga `TenantOnboardingManager`.
|
|
18
|
+
*
|
|
19
|
+
* Patrón de retorno: `Promise<ApiGatewayResponse<T>>` sin unwrap (v4 canonical Fiado).
|
|
20
|
+
* El consumer accede `result.body.data` para llegar al payload tipado.
|
|
21
|
+
*
|
|
22
|
+
* Env var requerida en el consumer: `PLATFORM_RBAC_BUSINESS_URL`.
|
|
23
|
+
* El template.yml del consumer la setea con:
|
|
24
|
+
*
|
|
25
|
+
* PLATFORM_RBAC_BUSINESS_URL: '{{resolve:ssm:platform-rbac-business}}'
|
|
26
|
+
*
|
|
27
|
+
* Convención CLAUDE.md global: SSM key = nombre del lambda owner de la URL.
|
|
28
|
+
*/
|
|
29
|
+
export interface IPlatformRbacBusinessApi {
|
|
30
|
+
/**
|
|
31
|
+
* POST /internal/auth/define-next-challenge — decide el próximo challenge MFA
|
|
32
|
+
* según los resultados acumulados en `session`. Invocado por el trigger
|
|
33
|
+
* `defineAuthChallenge` en cada paso del Custom Auth Challenge flow.
|
|
34
|
+
*/
|
|
35
|
+
defineNextChallenge(
|
|
36
|
+
input: DefineNextChallengeRequest,
|
|
37
|
+
): Promise<ApiGatewayResponse<DefineNextChallengeResponse>>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* POST /internal/auth/prepare-challenge — prepara el challenge (genera y envía
|
|
41
|
+
* código OTP por email/SMS, o computa el `privateChallenge` para TOTP).
|
|
42
|
+
* Invocado por el trigger `createAuthChallenge`.
|
|
43
|
+
*/
|
|
44
|
+
prepareChallenge(
|
|
45
|
+
input: PrepareChallengeRequest,
|
|
46
|
+
): Promise<ApiGatewayResponse<PrepareChallengeResponse>>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* POST /internal/auth/verify-challenge — verifica la respuesta del usuario
|
|
50
|
+
* contra el `privateChallenge`. Invocado por el trigger
|
|
51
|
+
* `verifyAuthChallengeResponse`.
|
|
52
|
+
*/
|
|
53
|
+
verifyChallenge(
|
|
54
|
+
input: VerifyChallengeRequest,
|
|
55
|
+
): Promise<ApiGatewayResponse<VerifyChallengeResponse>>;
|
|
56
|
+
}
|
|
@@ -87,4 +87,9 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
|
|
|
87
87
|
const url = `${this.baseUrl}/internal/services/${idServicio}`;
|
|
88
88
|
return await this.httpRequest.put(url, patch);
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
async createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>> {
|
|
92
|
+
const url = `${this.baseUrl}/internal/services`;
|
|
93
|
+
return await this.httpRequest.post(url, payload);
|
|
94
|
+
}
|
|
90
95
|
}
|
|
@@ -38,4 +38,8 @@ export interface IStpServicePaymentApi {
|
|
|
38
38
|
// admin. Consumido por LeafAdminManager de benefits-marketplace-business para
|
|
39
39
|
// edición editorial in-place (admin-leaves v2).
|
|
40
40
|
updateService(idServicio: number, patch: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
41
|
+
|
|
42
|
+
// POST /internal/services — alta manual de un servicio nuevo (admin-leaves v2).
|
|
43
|
+
// Consumido por LeafAdminManager de benefits-marketplace-business.
|
|
44
|
+
createService(payload: Record<string, unknown>): Promise<ApiGatewayResponse<any>>;
|
|
41
45
|
}
|