@fiado/api-invoker 5.123.0 → 5.125.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 { StandardResponse } from "@fiado/gateway-adapter";
3
- import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
3
+ import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, PreviewLoanContractRequest, LoanContractPreview, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
4
4
  import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "./dtos/CreditSummariesBatch.js";
5
5
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
6
6
  import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
@@ -25,6 +25,7 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
25
25
  originate(input: OriginateLoanCreditRequest, tenantId: string): Promise<StandardResponse<OriginateLoanCreditResponse>>;
26
26
  quote(creditId: string, input: QuoteLoanCreditRequest, tenantId: string): Promise<StandardResponse<QuoteLoanCreditResponse>>;
27
27
  sign(creditId: string, input: SignLoanCreditRequest, tenantId: string): Promise<StandardResponse<SignLoanCreditResponse>>;
28
+ previewContract(creditId: string, input: PreviewLoanContractRequest, tenantId: string): Promise<StandardResponse<LoanContractPreview>>;
28
29
  applyPayment(creditId: string, input: CreditPaymentAppliedRequest, tenantId: string): Promise<StandardResponse<CreditPaymentAppliedResponse>>;
29
30
  settle(creditId: string, input: CreditSettledRequest, tenantId: string): Promise<StandardResponse<CreditSettledResponse>>;
30
31
  activateCheck(creditId: string, input: ActivationCheckRequest, tenantId: string): Promise<StandardResponse<ActivationCheckResponse>>;
@@ -47,6 +47,10 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
47
47
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/sign?tenantId=${encodeURIComponent(tenantId)}`;
48
48
  return await this.httpRequest.post(url, input);
49
49
  }
50
+ async previewContract(creditId, input, tenantId) {
51
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/contract/preview?tenantId=${encodeURIComponent(tenantId)}`;
52
+ return await this.httpRequest.post(url, input);
53
+ }
50
54
  async applyPayment(creditId, input, tenantId) {
51
55
  const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/payment-applied?tenantId=${encodeURIComponent(tenantId)}`;
52
56
  return await this.httpRequest.post(url, input);
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
2
+ import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, PreviewLoanContractRequest, LoanContractPreview, SignLoanCreditResponse, UpdateLoanBorrowerSciRequest, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
3
3
  import { CreditSummariesBatchRequest, CreditSummariesBatchResponse } from "../dtos/CreditSummariesBatch.js";
4
4
  import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
5
5
  import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
@@ -40,6 +40,11 @@ export interface ILoanCreditBusinessApi {
40
40
  * `activationChecklist.contractSigned = true`).
41
41
  */
42
42
  sign(creditId: string, input: SignLoanCreditRequest, tenantId: string): Promise<StandardResponse<SignLoanCreditResponse>>;
43
+ /**
44
+ * Paso 08 — vista previa del contrato antes de enviar el código de firma: mismo contenido que el
45
+ * contrato que se firmará, sin iniciar la firma ni guardar evidencia. Devuelve un enlace temporal.
46
+ */
47
+ previewContract(creditId: string, input: PreviewLoanContractRequest, tenantId: string): Promise<StandardResponse<LoanContractPreview>>;
43
48
  /**
44
49
  * Marca condiciones del checklist de activación (M2 §5): `downPayment` (paso 07),
45
50
  * `imeiEnrolled`/`lockVerified` (paso 09, dispara el MDM vía abstracción). Con las 4 en `true`
@@ -1,6 +1,6 @@
1
1
  import type { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import type { IHttpRequest } from "@fiado/http-client";
3
- import type { GetRunResponse, PostEventRequest, PostEventResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
3
+ import type { GetRunResponse, PostEventRequest, PostEventResponse, PrivateSegmentResponse, SegmentExecutionPageResponse, SegmentExecutionRequest, SegmentExecutionResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
4
4
  import type { IRewardsEligibilityBusinessApi } from "./interfaces/IRewardsEligibilityBusinessApi.js";
5
5
  /** Contrato y semántica completos → `IRewardsEligibilityBusinessApi` (`StandardResponse` → leer `result.data`). */
6
6
  export declare class RewardsEligibilityBusinessApi implements IRewardsEligibilityBusinessApi {
@@ -9,4 +9,7 @@ export declare class RewardsEligibilityBusinessApi implements IRewardsEligibilit
9
9
  constructor(httpRequest: IHttpRequest);
10
10
  postEvent(request: PostEventRequest): Promise<StandardResponse<PostEventResponse>>;
11
11
  getRun(runId: string): Promise<StandardResponse<GetRunResponse>>;
12
+ getSegment(segmentId: string, version?: number): Promise<StandardResponse<PrivateSegmentResponse>>;
13
+ startSegmentExecution(segmentId: string, request: SegmentExecutionRequest): Promise<StandardResponse<SegmentExecutionResponse>>;
14
+ getSegmentExecutionPage(executionId: string, nextToken?: string): Promise<StandardResponse<SegmentExecutionPageResponse>>;
12
15
  }
@@ -28,6 +28,17 @@ let RewardsEligibilityBusinessApi = class RewardsEligibilityBusinessApi {
28
28
  const url = `${this.baseUrl}/runs/${encodeURIComponent(runId)}`;
29
29
  return await this.httpRequest.get(url);
30
30
  }
31
+ async getSegment(segmentId, version) {
32
+ const query = version === undefined ? "" : `?version=${version}`;
33
+ return await this.httpRequest.get(`${this.baseUrl}/segments/${encodeURIComponent(segmentId)}${query}`);
34
+ }
35
+ async startSegmentExecution(segmentId, request) {
36
+ return await this.httpRequest.post(`${this.baseUrl}/segments/${encodeURIComponent(segmentId)}/executions`, request);
37
+ }
38
+ async getSegmentExecutionPage(executionId, nextToken) {
39
+ const query = nextToken === undefined ? "" : `?nextToken=${encodeURIComponent(nextToken)}`;
40
+ return await this.httpRequest.get(`${this.baseUrl}/segments/executions/${encodeURIComponent(executionId)}${query}`);
41
+ }
31
42
  };
32
43
  RewardsEligibilityBusinessApi = __decorate([
33
44
  injectable(),
@@ -1,5 +1,5 @@
1
1
  import type { StandardResponse } from "@fiado/gateway-adapter";
2
- import type { GetRunResponse, PostEventRequest, PostEventResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
2
+ import type { GetRunResponse, PostEventRequest, PostEventResponse, PrivateSegmentResponse, SegmentExecutionPageResponse, SegmentExecutionRequest, SegmentExecutionResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
3
3
  /**
4
4
  * Cliente de la API privada de `rewards-eligibility-business` (spec 2026-10-06, §6).
5
5
  *
@@ -31,4 +31,26 @@ export interface IRewardsEligibilityBusinessApi {
31
31
  * @throws propaga el error del destino (404 `RUN_NOT_FOUND`); nunca devuelve fallback.
32
32
  */
33
33
  getRun(runId: string): Promise<StandardResponse<GetRunResponse>>;
34
+ /**
35
+ * Definición de un segmento de población (versión `ACTIVE` si no se indica `version`).
36
+ *
37
+ * @throws propaga el error del destino (404 `SEGMENT_NOT_FOUND`, 409 `SEGMENT_NOT_ACTIVE`).
38
+ */
39
+ getSegment(segmentId: string, version?: number): Promise<StandardResponse<PrivateSegmentResponse>>;
40
+ /**
41
+ * Inicia la consulta del segmento. `executionId` es el `QueryExecutionId` de Athena del workgroup
42
+ * dedicado. Reintentar con los mismos `segmentId+version+referenceAt` NO duplica la consulta
43
+ * (`ClientRequestToken` determinista).
44
+ *
45
+ * @throws propaga el error del destino (404 `SEGMENT_NOT_FOUND`, 409 `SEGMENT_NOT_ACTIVE` /
46
+ * `SEGMENT_BLOCKED_COLUMN` / `SEGMENT_SCHEMA_DRIFT`, 503 `SEGMENT_DATALAKE_UNAVAILABLE`).
47
+ */
48
+ startSegmentExecution(segmentId: string, request: SegmentExecutionRequest): Promise<StandardResponse<SegmentExecutionResponse>>;
49
+ /**
50
+ * Página de ids de una ejecución (hasta 1000 por página); `nextToken` pagina.
51
+ *
52
+ * @throws propaga el error del destino (409 `SEGMENT_BLOCKED_COLUMN` / `SEGMENT_SCHEMA_DRIFT`,
53
+ * 503 `SEGMENT_DATALAKE_UNAVAILABLE`).
54
+ */
55
+ getSegmentExecutionPage(executionId: string, nextToken?: string): Promise<StandardResponse<SegmentExecutionPageResponse>>;
34
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.123.0",
3
+ "version": "5.125.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.14.0",
35
35
  "@fiado/http-client": "^2.0.1",
36
36
  "@fiado/logger": "^1.1.3",
37
- "@fiado/type-kit": "^3.526.0",
37
+ "@fiado/type-kit": "^3.533.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -18,6 +18,8 @@ import {
18
18
  QuoteLoanCreditResponse,
19
19
  SignLoanCreditRequest,
20
20
  SignLoanCreditResponse,
21
+ PreviewLoanContractRequest,
22
+ LoanContractPreview,
21
23
  UpdateLoanBorrowerSciRequest,
22
24
  UpsertLoanBorrowerRequest,
23
25
  LoanBorrowerCreditItem,
@@ -96,6 +98,15 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
96
98
  return await this.httpRequest.post(url, input);
97
99
  }
98
100
 
101
+ async previewContract(
102
+ creditId: string,
103
+ input: PreviewLoanContractRequest,
104
+ tenantId: string,
105
+ ): Promise<StandardResponse<LoanContractPreview>> {
106
+ const url = `${this.baseUrl}/private/credits/${encodeURIComponent(creditId)}/contract/preview?tenantId=${encodeURIComponent(tenantId)}`;
107
+ return await this.httpRequest.post(url, input);
108
+ }
109
+
99
110
  async applyPayment(
100
111
  creditId: string,
101
112
  input: CreditPaymentAppliedRequest,
@@ -15,6 +15,8 @@ import {
15
15
  QuoteLoanCreditRequest,
16
16
  QuoteLoanCreditResponse,
17
17
  SignLoanCreditRequest,
18
+ PreviewLoanContractRequest,
19
+ LoanContractPreview,
18
20
  SignLoanCreditResponse,
19
21
  UpdateLoanBorrowerSciRequest,
20
22
  UpsertLoanBorrowerRequest,
@@ -92,6 +94,16 @@ export interface ILoanCreditBusinessApi {
92
94
  tenantId: string,
93
95
  ): Promise<StandardResponse<SignLoanCreditResponse>>;
94
96
 
97
+ /**
98
+ * Paso 08 — vista previa del contrato antes de enviar el código de firma: mismo contenido que el
99
+ * contrato que se firmará, sin iniciar la firma ni guardar evidencia. Devuelve un enlace temporal.
100
+ */
101
+ previewContract(
102
+ creditId: string,
103
+ input: PreviewLoanContractRequest,
104
+ tenantId: string,
105
+ ): Promise<StandardResponse<LoanContractPreview>>;
106
+
95
107
  /**
96
108
  * Marca condiciones del checklist de activación (M2 §5): `downPayment` (paso 07),
97
109
  * `imeiEnrolled`/`lockVerified` (paso 09, dispara el MDM vía abstracción). Con las 4 en `true`
@@ -1,7 +1,15 @@
1
1
  import { inject, injectable } from "inversify";
2
2
  import type { StandardResponse } from "@fiado/gateway-adapter";
3
3
  import type { IHttpRequest } from "@fiado/http-client";
4
- import type { GetRunResponse, PostEventRequest, PostEventResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
4
+ import type {
5
+ GetRunResponse,
6
+ PostEventRequest,
7
+ PostEventResponse,
8
+ PrivateSegmentResponse,
9
+ SegmentExecutionPageResponse,
10
+ SegmentExecutionRequest,
11
+ SegmentExecutionResponse,
12
+ } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
5
13
  import type { IRewardsEligibilityBusinessApi } from "./interfaces/IRewardsEligibilityBusinessApi.js";
6
14
 
7
15
  /** Contrato y semántica completos → `IRewardsEligibilityBusinessApi` (`StandardResponse` → leer `result.data`). */
@@ -23,4 +31,18 @@ export class RewardsEligibilityBusinessApi implements IRewardsEligibilityBusines
23
31
  const url = `${this.baseUrl}/runs/${encodeURIComponent(runId)}`;
24
32
  return await this.httpRequest.get<StandardResponse<GetRunResponse>>(url);
25
33
  }
34
+
35
+ async getSegment(segmentId: string, version?: number): Promise<StandardResponse<PrivateSegmentResponse>> {
36
+ const query = version === undefined ? "" : `?version=${version}`;
37
+ return await this.httpRequest.get<StandardResponse<PrivateSegmentResponse>>(`${this.baseUrl}/segments/${encodeURIComponent(segmentId)}${query}`);
38
+ }
39
+
40
+ async startSegmentExecution(segmentId: string, request: SegmentExecutionRequest): Promise<StandardResponse<SegmentExecutionResponse>> {
41
+ return await this.httpRequest.post<StandardResponse<SegmentExecutionResponse>>(`${this.baseUrl}/segments/${encodeURIComponent(segmentId)}/executions`, request);
42
+ }
43
+
44
+ async getSegmentExecutionPage(executionId: string, nextToken?: string): Promise<StandardResponse<SegmentExecutionPageResponse>> {
45
+ const query = nextToken === undefined ? "" : `?nextToken=${encodeURIComponent(nextToken)}`;
46
+ return await this.httpRequest.get<StandardResponse<SegmentExecutionPageResponse>>(`${this.baseUrl}/segments/executions/${encodeURIComponent(executionId)}${query}`);
47
+ }
26
48
  }
@@ -1,5 +1,13 @@
1
1
  import type { StandardResponse } from "@fiado/gateway-adapter";
2
- import type { GetRunResponse, PostEventRequest, PostEventResponse } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
2
+ import type {
3
+ GetRunResponse,
4
+ PostEventRequest,
5
+ PostEventResponse,
6
+ PrivateSegmentResponse,
7
+ SegmentExecutionPageResponse,
8
+ SegmentExecutionRequest,
9
+ SegmentExecutionResponse,
10
+ } from "@fiado/type-kit/bin/rewardsEligibility/index.js";
3
11
 
4
12
  /**
5
13
  * Cliente de la API privada de `rewards-eligibility-business` (spec 2026-10-06, §6).
@@ -33,4 +41,29 @@ export interface IRewardsEligibilityBusinessApi {
33
41
  * @throws propaga el error del destino (404 `RUN_NOT_FOUND`); nunca devuelve fallback.
34
42
  */
35
43
  getRun(runId: string): Promise<StandardResponse<GetRunResponse>>;
44
+
45
+ /**
46
+ * Definición de un segmento de población (versión `ACTIVE` si no se indica `version`).
47
+ *
48
+ * @throws propaga el error del destino (404 `SEGMENT_NOT_FOUND`, 409 `SEGMENT_NOT_ACTIVE`).
49
+ */
50
+ getSegment(segmentId: string, version?: number): Promise<StandardResponse<PrivateSegmentResponse>>;
51
+
52
+ /**
53
+ * Inicia la consulta del segmento. `executionId` es el `QueryExecutionId` de Athena del workgroup
54
+ * dedicado. Reintentar con los mismos `segmentId+version+referenceAt` NO duplica la consulta
55
+ * (`ClientRequestToken` determinista).
56
+ *
57
+ * @throws propaga el error del destino (404 `SEGMENT_NOT_FOUND`, 409 `SEGMENT_NOT_ACTIVE` /
58
+ * `SEGMENT_BLOCKED_COLUMN` / `SEGMENT_SCHEMA_DRIFT`, 503 `SEGMENT_DATALAKE_UNAVAILABLE`).
59
+ */
60
+ startSegmentExecution(segmentId: string, request: SegmentExecutionRequest): Promise<StandardResponse<SegmentExecutionResponse>>;
61
+
62
+ /**
63
+ * Página de ids de una ejecución (hasta 1000 por página); `nextToken` pagina.
64
+ *
65
+ * @throws propaga el error del destino (409 `SEGMENT_BLOCKED_COLUMN` / `SEGMENT_SCHEMA_DRIFT`,
66
+ * 503 `SEGMENT_DATALAKE_UNAVAILABLE`).
67
+ */
68
+ getSegmentExecutionPage(executionId: string, nextToken?: string): Promise<StandardResponse<SegmentExecutionPageResponse>>;
36
69
  }