@fiado/api-invoker 4.66.0 → 4.67.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.
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { ApiGatewayResponse, ResolvedPermissions, ResolveInput } from "@fiado/gateway-adapter";
3
- import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse, AuthorizeRequest, AuthorizeResponse, EffectivePermissionsResponse, InjectableUserAttributesResponse } from "@fiado/type-kit/bin/platformRbac/index.js";
3
+ import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse, AuthorizeRequest, AuthorizeResponse, EffectivePermissionsResponse, InjectableUserAttributesResponse, PermissionScope, CreateLevelEntityRequest, CreateLevelEntityResponse, CreateTenantUserRequest, CreateTenantUserResponse } from "@fiado/type-kit/bin/platformRbac/index.js";
4
4
  import { IPlatformRbacBusinessApi } from "./interfaces/IPlatformRbacBusinessApi.js";
5
5
  /**
6
6
  * Publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
@@ -26,4 +26,6 @@ export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi
26
26
  effectivePermissions(cognitoSub: string, tenantId?: string): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
27
27
  getInjectableUserAttributes(cognitoSub: string, tenantId: string): Promise<ApiGatewayResponse<InjectableUserAttributesResponse>>;
28
28
  resolvePermissions(input: ResolveInput): Promise<ApiGatewayResponse<ResolvedPermissions>>;
29
+ createLevelEntity(tenantId: string, level: PermissionScope, input: CreateLevelEntityRequest): Promise<ApiGatewayResponse<CreateLevelEntityResponse>>;
30
+ createTenantUser(tenantId: string, input: CreateTenantUserRequest): Promise<ApiGatewayResponse<CreateTenantUserResponse>>;
29
31
  }
@@ -68,6 +68,14 @@ let PlatformRbacBusinessApi = class PlatformRbacBusinessApi {
68
68
  const url = `${this.baseUrl}/internal/permissions/resolve`;
69
69
  return await this.httpRequest.post(url, input);
70
70
  }
71
+ async createLevelEntity(tenantId, level, input) {
72
+ const url = `${this.baseUrl}/internal/tenants/${encodeURIComponent(tenantId)}/levels/${encodeURIComponent(level)}/entities`;
73
+ return await this.httpRequest.post(url, input);
74
+ }
75
+ async createTenantUser(tenantId, input) {
76
+ const url = `${this.baseUrl}/internal/tenants/${encodeURIComponent(tenantId)}/users`;
77
+ return await this.httpRequest.post(url, input);
78
+ }
71
79
  };
72
80
  PlatformRbacBusinessApi = __decorate([
73
81
  injectable(),
@@ -1,5 +1,5 @@
1
1
  import { ApiGatewayResponse, ResolvedPermissions, ResolveInput } from "@fiado/gateway-adapter";
2
- import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse, AuthorizeRequest, AuthorizeResponse, EffectivePermissionsResponse, InjectableUserAttributesResponse } from "@fiado/type-kit/bin/platformRbac/index.js";
2
+ import { DefineNextChallengeRequest, DefineNextChallengeResponse, PrepareChallengeRequest, PrepareChallengeResponse, VerifyChallengeRequest, VerifyChallengeResponse, AuthorizeRequest, AuthorizeResponse, EffectivePermissionsResponse, InjectableUserAttributesResponse, PermissionScope, CreateLevelEntityRequest, CreateLevelEntityResponse, CreateTenantUserRequest, CreateTenantUserResponse } from "@fiado/type-kit/bin/platformRbac/index.js";
3
3
  /**
4
4
  * Contrato del publisher HTTP del lambda `platform-rbac-business` (componente 06 SureKeep Fase 0)
5
5
  * para los 3 endpoints internos del Custom Auth Challenge flow (MFA).
@@ -63,4 +63,16 @@ export interface IPlatformRbacBusinessApi {
63
63
  getInjectableUserAttributes(cognitoSub: string, tenantId: string): Promise<ApiGatewayResponse<InjectableUserAttributesResponse>>;
64
64
  /** POST /internal/permissions/resolve — resuelve permisos scope-bound (set completo, paginación interna) para el RBAC enforcement del gateway-adapter. DEC-RBAC-064. */
65
65
  resolvePermissions(input: ResolveInput): Promise<ApiGatewayResponse<ResolvedPermissions>>;
66
+ /**
67
+ * POST /internal/tenants/{tenantId}/levels/{level}/entities — crea una scope-entity genérica
68
+ * L1/L2/L3 en RBAC (endpoint privado, VPC/ANONIMUS). Espejo de jerarquía de SureKeep F1
69
+ * (retailer→L1, zona→L2, tienda→L3). BYOID + idempotente. `level` (LEVEL_1|2|3) va en el path.
70
+ */
71
+ createLevelEntity(tenantId: string, level: PermissionScope, input: CreateLevelEntityRequest): Promise<ApiGatewayResponse<CreateLevelEntityResponse>>;
72
+ /**
73
+ * POST /internal/tenants/{tenantId}/users — provisiona un usuario del tenant (Cognito + SharedUser +
74
+ * RoleAssignment) en RBAC (endpoint privado, VPC/ANONIMUS). Alta orquestada de SureKeep F1: el usuario
75
+ * queda INVITED (mitiga orphan) y retail-org guarda el `cognitoSub` retornado. Idempotente por identidad Cognito.
76
+ */
77
+ createTenantUser(tenantId: string, input: CreateTenantUserRequest): Promise<ApiGatewayResponse<CreateTenantUserResponse>>;
66
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.66.0",
3
+ "version": "4.67.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.191.0",
37
+ "@fiado/type-kit": "^3.193.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -13,6 +13,11 @@ import {
13
13
  AuthorizeResponse,
14
14
  EffectivePermissionsResponse,
15
15
  InjectableUserAttributesResponse,
16
+ PermissionScope,
17
+ CreateLevelEntityRequest,
18
+ CreateLevelEntityResponse,
19
+ CreateTenantUserRequest,
20
+ CreateTenantUserResponse,
16
21
  } from "@fiado/type-kit/bin/platformRbac/index.js";
17
22
  import { IPlatformRbacBusinessApi } from "./interfaces/IPlatformRbacBusinessApi.js";
18
23
 
@@ -95,4 +100,21 @@ export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi
95
100
  const url = `${this.baseUrl}/internal/permissions/resolve`;
96
101
  return await this.httpRequest.post(url, input);
97
102
  }
103
+
104
+ async createLevelEntity(
105
+ tenantId: string,
106
+ level: PermissionScope,
107
+ input: CreateLevelEntityRequest,
108
+ ): Promise<ApiGatewayResponse<CreateLevelEntityResponse>> {
109
+ const url = `${this.baseUrl}/internal/tenants/${encodeURIComponent(tenantId)}/levels/${encodeURIComponent(level)}/entities`;
110
+ return await this.httpRequest.post(url, input);
111
+ }
112
+
113
+ async createTenantUser(
114
+ tenantId: string,
115
+ input: CreateTenantUserRequest,
116
+ ): Promise<ApiGatewayResponse<CreateTenantUserResponse>> {
117
+ const url = `${this.baseUrl}/internal/tenants/${encodeURIComponent(tenantId)}/users`;
118
+ return await this.httpRequest.post(url, input);
119
+ }
98
120
  }
@@ -10,6 +10,11 @@ import {
10
10
  AuthorizeResponse,
11
11
  EffectivePermissionsResponse,
12
12
  InjectableUserAttributesResponse,
13
+ PermissionScope,
14
+ CreateLevelEntityRequest,
15
+ CreateLevelEntityResponse,
16
+ CreateTenantUserRequest,
17
+ CreateTenantUserResponse,
13
18
  } from "@fiado/type-kit/bin/platformRbac/index.js";
14
19
 
15
20
  /**
@@ -95,4 +100,25 @@ export interface IPlatformRbacBusinessApi {
95
100
 
96
101
  /** POST /internal/permissions/resolve — resuelve permisos scope-bound (set completo, paginación interna) para el RBAC enforcement del gateway-adapter. DEC-RBAC-064. */
97
102
  resolvePermissions(input: ResolveInput): Promise<ApiGatewayResponse<ResolvedPermissions>>;
103
+
104
+ /**
105
+ * POST /internal/tenants/{tenantId}/levels/{level}/entities — crea una scope-entity genérica
106
+ * L1/L2/L3 en RBAC (endpoint privado, VPC/ANONIMUS). Espejo de jerarquía de SureKeep F1
107
+ * (retailer→L1, zona→L2, tienda→L3). BYOID + idempotente. `level` (LEVEL_1|2|3) va en el path.
108
+ */
109
+ createLevelEntity(
110
+ tenantId: string,
111
+ level: PermissionScope,
112
+ input: CreateLevelEntityRequest,
113
+ ): Promise<ApiGatewayResponse<CreateLevelEntityResponse>>;
114
+
115
+ /**
116
+ * POST /internal/tenants/{tenantId}/users — provisiona un usuario del tenant (Cognito + SharedUser +
117
+ * RoleAssignment) en RBAC (endpoint privado, VPC/ANONIMUS). Alta orquestada de SureKeep F1: el usuario
118
+ * queda INVITED (mitiga orphan) y retail-org guarda el `cognitoSub` retornado. Idempotente por identidad Cognito.
119
+ */
120
+ createTenantUser(
121
+ tenantId: string,
122
+ input: CreateTenantUserRequest,
123
+ ): Promise<ApiGatewayResponse<CreateTenantUserResponse>>;
98
124
  }