@fiado/api-invoker 5.123.0 → 5.124.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 { 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.124.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.530.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -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
  }