@fiado/api-invoker 5.89.0 → 5.91.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.
@@ -35,4 +35,5 @@ export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
35
35
  directoryId: string;
36
36
  side: string;
37
37
  }): Promise<any>;
38
+ getSteps(directoryId: string): Promise<any>;
38
39
  }
@@ -117,6 +117,16 @@ let OnboardingBusinessApi = class OnboardingBusinessApi {
117
117
  const url = `${this.baseUrl}private/issuance-readiness/${params.directoryId}?side=${encodeURIComponent(params.side)}`;
118
118
  return await this.httpRequest.get(`${url}`);
119
119
  }
120
+ //**
121
+ // Function: getSteps
122
+ // Description: Pasos y estado de cuentas del onboarding de un directorio (motor por scope).
123
+ // Parameters: directoryId
124
+ // Return: { steps, accounts }
125
+ // **/
126
+ async getSteps(directoryId) {
127
+ const url = `${this.baseUrl}private/steps/${directoryId}`;
128
+ return await this.httpRequest.get(`${url}`);
129
+ }
120
130
  };
121
131
  OnboardingBusinessApi = __decorate([
122
132
  injectable(),
@@ -43,4 +43,9 @@ export interface IOnboardingBusinessApi {
43
43
  directoryId: string;
44
44
  side: string;
45
45
  }): Promise<any>;
46
+ /**
47
+ * Pasos y estado de cuentas del onboarding de un directorio: `{ steps, accounts }`, el mismo
48
+ * motor que `GET /steps` de la app. `accounts[].status === "OPEN"` dice qué lado ya abrió.
49
+ */
50
+ getSteps(directoryId: string): Promise<any>;
46
51
  }
@@ -1,6 +1,6 @@
1
1
  import type { IHttpRequest } from "@fiado/http-client";
2
2
  import { StandardResponse } from "@fiado/gateway-adapter";
3
- import type { ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
3
+ import type { GetStoreStockCatalogResponse, ReleaseStockRequest, ReleaseStockResponse, RenewReservationsRequest, RenewReservationsResponse, ReserveStockRequest, ReserveStockResponse, ReturnStockRequest, ReturnStockResponse, SellStockRequest, SellStockResponse, SuggestPiecesQuery, SuggestPiecesResponse, SyncInventoryRequest, SyncInventoryResponse, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
4
4
  import { IRetailCatalogBusinessApi, ProductsByRetailersResponse, ReleaseReservationBody, ReserveInventoryBody, ReserveInventoryResult, SellInventoryBody, StoreCatalogItem } from "./interfaces/IRetailCatalogBusinessApi.js";
5
5
  /**
6
6
  * Publisher HTTP del lambda `retail-catalog-business` (SureKeep Fase 1, pista Retail) para sus
@@ -27,4 +27,14 @@ export default class RetailCatalogBusinessApi implements IRetailCatalogBusinessA
27
27
  sellInventory(imei: string, body: SellInventoryBody, issuer: string): Promise<StandardResponse<void>>;
28
28
  releaseInventory(imei: string, body: ReleaseReservationBody, issuer: string): Promise<StandardResponse<void>>;
29
29
  returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
30
+ /** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
31
+ private storeUrl;
32
+ reserveStock(storeId: string, body: ReserveStockRequest, tenantId: string): Promise<StandardResponse<ReserveStockResponse>>;
33
+ renewReservations(storeId: string, body: RenewReservationsRequest, tenantId: string): Promise<StandardResponse<RenewReservationsResponse>>;
34
+ suggestPieces(storeId: string, query: SuggestPiecesQuery, tenantId: string): Promise<StandardResponse<SuggestPiecesResponse>>;
35
+ sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
36
+ releaseStock(storeId: string, body: ReleaseStockRequest, tenantId: string): Promise<StandardResponse<ReleaseStockResponse>>;
37
+ returnStock(storeId: string, body: ReturnStockRequest, tenantId: string): Promise<StandardResponse<ReturnStockResponse>>;
38
+ syncInventory(retailerId: string, body: SyncInventoryRequest, tenantId: string): Promise<StandardResponse<SyncInventoryResponse>>;
39
+ getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
30
40
  }
@@ -70,6 +70,38 @@ let RetailCatalogBusinessApi = class RetailCatalogBusinessApi {
70
70
  const url = `${this.baseUrl}/private/inventory/${encodeURIComponent(imei)}/return`;
71
71
  return await this.httpRequest.put(url, undefined, this.tenantHeader(issuer));
72
72
  }
73
+ /** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
74
+ storeUrl(storeId, suffix, tenantId, extra = {}) {
75
+ const query = new URLSearchParams({ tenantId, ...extra });
76
+ return `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/${suffix}?${query.toString()}`;
77
+ }
78
+ async reserveStock(storeId, body, tenantId) {
79
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations", tenantId), body);
80
+ }
81
+ async renewReservations(storeId, body, tenantId) {
82
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations/renew", tenantId), body);
83
+ }
84
+ async suggestPieces(storeId, query, tenantId) {
85
+ const extra = { sku: query.sku, prefix: query.prefix };
86
+ return await this.httpRequest.get(this.storeUrl(storeId, "pieces", tenantId, extra));
87
+ }
88
+ async sellStock(storeId, body, tenantId) {
89
+ return await this.httpRequest.put(this.storeUrl(storeId, "sales", tenantId), body);
90
+ }
91
+ async releaseStock(storeId, body, tenantId) {
92
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations/release", tenantId), body);
93
+ }
94
+ async returnStock(storeId, body, tenantId) {
95
+ return await this.httpRequest.put(this.storeUrl(storeId, "returns", tenantId), body);
96
+ }
97
+ async syncInventory(retailerId, body, tenantId) {
98
+ const query = new URLSearchParams({ tenantId });
99
+ const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/inventory/sync?${query.toString()}`;
100
+ return await this.httpRequest.post(url, body);
101
+ }
102
+ async getStoreStockCatalog(storeId, tenantId) {
103
+ return await this.httpRequest.get(this.storeUrl(storeId, "stock-catalog", tenantId));
104
+ }
73
105
  };
74
106
  RetailCatalogBusinessApi = __decorate([
75
107
  injectable(),
@@ -1,5 +1,5 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
- import type { MdmLockModeEnum, MdmProviderEnum, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
2
+ import type { GetStoreStockCatalogResponse, MdmLockModeEnum, MdmProviderEnum, ReleaseStockRequest, ReleaseStockResponse, RenewReservationsRequest, RenewReservationsResponse, ReserveStockRequest, ReserveStockResponse, ReturnStockRequest, ReturnStockResponse, SellStockRequest, SellStockResponse, SuggestPiecesQuery, SuggestPiecesResponse, SyncInventoryRequest, SyncInventoryResponse, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
3
3
  /**
4
4
  * Contrato del publisher HTTP del lambda `retail-catalog-business` (SureKeep Fase 1, pista Retail)
5
5
  * para sus endpoints privados del ciclo de venta del IMEI, consumidos por el wizard F2.
@@ -152,4 +152,20 @@ export interface IRetailCatalogBusinessApi {
152
152
  releaseInventory(imei: string, body: ReleaseReservationBody, issuer: string): Promise<StandardResponse<void>>;
153
153
  /** PUT `/private/inventory/{imei}/return` — devuelve el IMEI vendido al stock (SOLD → AVAILABLE, sin body). */
154
154
  returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
155
+ /** PUT `/private/stores/{storeId}/reservations` — reserva una línea (kit completo) de forma idempotente. */
156
+ reserveStock(storeId: string, body: ReserveStockRequest, tenantId: string): Promise<StandardResponse<ReserveStockResponse>>;
157
+ /** PUT `/private/stores/{storeId}/reservations/renew` — extiende las reservas de las líneas. */
158
+ renewReservations(storeId: string, body: RenewReservationsRequest, tenantId: string): Promise<StandardResponse<RenewReservationsResponse>>;
159
+ /** GET `/private/stores/{storeId}/pieces` — piezas disponibles del SKU que empiezan con `prefix`. */
160
+ suggestPieces(storeId: string, query: SuggestPiecesQuery, tenantId: string): Promise<StandardResponse<SuggestPiecesResponse>>;
161
+ /** PUT `/private/stores/{storeId}/sales` — vende las líneas con sus identificadores en una transacción. */
162
+ sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
163
+ /** PUT `/private/stores/{storeId}/reservations/release` — libera las reservas de las líneas. */
164
+ releaseStock(storeId: string, body: ReleaseStockRequest, tenantId: string): Promise<StandardResponse<ReleaseStockResponse>>;
165
+ /** PUT `/private/stores/{storeId}/returns` — regresa al stock las piezas de una venta cancelada. */
166
+ returnStock(storeId: string, body: ReturnStockRequest, tenantId: string): Promise<StandardResponse<ReturnStockResponse>>;
167
+ /** POST `/private/retailers/{retailerId}/inventory/sync` — puerta de entrada de productos, precios y stock. */
168
+ syncInventory(retailerId: string, body: SyncInventoryRequest, tenantId: string): Promise<StandardResponse<SyncInventoryResponse>>;
169
+ /** GET `/private/stores/{storeId}/stock-catalog` — catálogo vendible de la tienda, una fila por SKU. */
170
+ getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
155
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "5.89.0",
3
+ "version": "5.91.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.458.0",
37
+ "@fiado/type-kit": "3.461.0",
38
38
  "dotenv": "^16.4.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -119,6 +119,17 @@ export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
119
119
  return await this.httpRequest.get(`${url}`);
120
120
  }
121
121
 
122
+ //**
123
+ // Function: getSteps
124
+ // Description: Pasos y estado de cuentas del onboarding de un directorio (motor por scope).
125
+ // Parameters: directoryId
126
+ // Return: { steps, accounts }
127
+ // **/
128
+ async getSteps(directoryId: string): Promise<any> {
129
+ const url = `${this.baseUrl}private/steps/${directoryId}`;
130
+ return await this.httpRequest.get(`${url}`);
131
+ }
132
+
122
133
  }
123
134
 
124
135
 
@@ -26,4 +26,10 @@ export interface IOnboardingBusinessApi {
26
26
  * `side` es "MEX" o "USA".
27
27
  */
28
28
  issuanceReadiness(params: { directoryId: string; side: string }): Promise<any>
29
+
30
+ /**
31
+ * Pasos y estado de cuentas del onboarding de un directorio: `{ steps, accounts }`, el mismo
32
+ * motor que `GET /steps` de la app. `accounts[].status === "OPEN"` dice qué lado ya abrió.
33
+ */
34
+ getSteps(directoryId: string): Promise<any>
29
35
  }
@@ -1,7 +1,24 @@
1
1
  import { inject, injectable } from "inversify";
2
2
  import type { IHttpRequest } from "@fiado/http-client";
3
3
  import { StandardResponse } from "@fiado/gateway-adapter";
4
- import type { ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
4
+ import type {
5
+ GetStoreStockCatalogResponse,
6
+ ReleaseStockRequest,
7
+ ReleaseStockResponse,
8
+ RenewReservationsRequest,
9
+ RenewReservationsResponse,
10
+ ReserveStockRequest,
11
+ ReserveStockResponse,
12
+ ReturnStockRequest,
13
+ ReturnStockResponse,
14
+ SellStockRequest,
15
+ SellStockResponse,
16
+ SuggestPiecesQuery,
17
+ SuggestPiecesResponse,
18
+ SyncInventoryRequest,
19
+ SyncInventoryResponse,
20
+ ValidateProductResponse,
21
+ } from "@fiado/type-kit/bin/retailCatalog/index.js";
5
22
  import {
6
23
  IRetailCatalogBusinessApi,
7
24
  ProductsByRetailersBody,
@@ -97,4 +114,76 @@ export default class RetailCatalogBusinessApi implements IRetailCatalogBusinessA
97
114
  const url = `${this.baseUrl}/private/inventory/${encodeURIComponent(imei)}/return`;
98
115
  return await this.httpRequest.put(url, undefined, this.tenantHeader(issuer));
99
116
  }
117
+
118
+ /** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
119
+ private storeUrl(storeId: string, suffix: string, tenantId: string, extra: Record<string, string> = {}): string {
120
+ const query = new URLSearchParams({ tenantId, ...extra });
121
+ return `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/${suffix}?${query.toString()}`;
122
+ }
123
+
124
+ async reserveStock(
125
+ storeId: string,
126
+ body: ReserveStockRequest,
127
+ tenantId: string,
128
+ ): Promise<StandardResponse<ReserveStockResponse>> {
129
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations", tenantId), body);
130
+ }
131
+
132
+ async renewReservations(
133
+ storeId: string,
134
+ body: RenewReservationsRequest,
135
+ tenantId: string,
136
+ ): Promise<StandardResponse<RenewReservationsResponse>> {
137
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations/renew", tenantId), body);
138
+ }
139
+
140
+ async suggestPieces(
141
+ storeId: string,
142
+ query: SuggestPiecesQuery,
143
+ tenantId: string,
144
+ ): Promise<StandardResponse<SuggestPiecesResponse>> {
145
+ const extra = { sku: query.sku, prefix: query.prefix };
146
+ return await this.httpRequest.get(this.storeUrl(storeId, "pieces", tenantId, extra));
147
+ }
148
+
149
+ async sellStock(
150
+ storeId: string,
151
+ body: SellStockRequest,
152
+ tenantId: string,
153
+ ): Promise<StandardResponse<SellStockResponse>> {
154
+ return await this.httpRequest.put(this.storeUrl(storeId, "sales", tenantId), body);
155
+ }
156
+
157
+ async releaseStock(
158
+ storeId: string,
159
+ body: ReleaseStockRequest,
160
+ tenantId: string,
161
+ ): Promise<StandardResponse<ReleaseStockResponse>> {
162
+ return await this.httpRequest.put(this.storeUrl(storeId, "reservations/release", tenantId), body);
163
+ }
164
+
165
+ async returnStock(
166
+ storeId: string,
167
+ body: ReturnStockRequest,
168
+ tenantId: string,
169
+ ): Promise<StandardResponse<ReturnStockResponse>> {
170
+ return await this.httpRequest.put(this.storeUrl(storeId, "returns", tenantId), body);
171
+ }
172
+
173
+ async syncInventory(
174
+ retailerId: string,
175
+ body: SyncInventoryRequest,
176
+ tenantId: string,
177
+ ): Promise<StandardResponse<SyncInventoryResponse>> {
178
+ const query = new URLSearchParams({ tenantId });
179
+ const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/inventory/sync?${query.toString()}`;
180
+ return await this.httpRequest.post(url, body);
181
+ }
182
+
183
+ async getStoreStockCatalog(
184
+ storeId: string,
185
+ tenantId: string,
186
+ ): Promise<StandardResponse<GetStoreStockCatalogResponse>> {
187
+ return await this.httpRequest.get(this.storeUrl(storeId, "stock-catalog", tenantId));
188
+ }
100
189
  }
@@ -1,7 +1,22 @@
1
1
  import { StandardResponse } from "@fiado/gateway-adapter";
2
2
  import type {
3
+ GetStoreStockCatalogResponse,
3
4
  MdmLockModeEnum,
4
5
  MdmProviderEnum,
6
+ ReleaseStockRequest,
7
+ ReleaseStockResponse,
8
+ RenewReservationsRequest,
9
+ RenewReservationsResponse,
10
+ ReserveStockRequest,
11
+ ReserveStockResponse,
12
+ ReturnStockRequest,
13
+ ReturnStockResponse,
14
+ SellStockRequest,
15
+ SellStockResponse,
16
+ SuggestPiecesQuery,
17
+ SuggestPiecesResponse,
18
+ SyncInventoryRequest,
19
+ SyncInventoryResponse,
5
20
  ValidateProductResponse,
6
21
  } from "@fiado/type-kit/bin/retailCatalog/index.js";
7
22
 
@@ -186,4 +201,54 @@ export interface IRetailCatalogBusinessApi {
186
201
 
187
202
  /** PUT `/private/inventory/{imei}/return` — devuelve el IMEI vendido al stock (SOLD → AVAILABLE, sin body). */
188
203
  returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
204
+
205
+ // Contrato de stock por SKU: el tenant va en `?tenantId=`; errores tipados del destino se propagan.
206
+
207
+ /** PUT `/private/stores/{storeId}/reservations` — reserva una línea (kit completo) de forma idempotente. */
208
+ reserveStock(
209
+ storeId: string,
210
+ body: ReserveStockRequest,
211
+ tenantId: string,
212
+ ): Promise<StandardResponse<ReserveStockResponse>>;
213
+
214
+ /** PUT `/private/stores/{storeId}/reservations/renew` — extiende las reservas de las líneas. */
215
+ renewReservations(
216
+ storeId: string,
217
+ body: RenewReservationsRequest,
218
+ tenantId: string,
219
+ ): Promise<StandardResponse<RenewReservationsResponse>>;
220
+
221
+ /** GET `/private/stores/{storeId}/pieces` — piezas disponibles del SKU que empiezan con `prefix`. */
222
+ suggestPieces(
223
+ storeId: string,
224
+ query: SuggestPiecesQuery,
225
+ tenantId: string,
226
+ ): Promise<StandardResponse<SuggestPiecesResponse>>;
227
+
228
+ /** PUT `/private/stores/{storeId}/sales` — vende las líneas con sus identificadores en una transacción. */
229
+ sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
230
+
231
+ /** PUT `/private/stores/{storeId}/reservations/release` — libera las reservas de las líneas. */
232
+ releaseStock(
233
+ storeId: string,
234
+ body: ReleaseStockRequest,
235
+ tenantId: string,
236
+ ): Promise<StandardResponse<ReleaseStockResponse>>;
237
+
238
+ /** PUT `/private/stores/{storeId}/returns` — regresa al stock las piezas de una venta cancelada. */
239
+ returnStock(
240
+ storeId: string,
241
+ body: ReturnStockRequest,
242
+ tenantId: string,
243
+ ): Promise<StandardResponse<ReturnStockResponse>>;
244
+
245
+ /** POST `/private/retailers/{retailerId}/inventory/sync` — puerta de entrada de productos, precios y stock. */
246
+ syncInventory(
247
+ retailerId: string,
248
+ body: SyncInventoryRequest,
249
+ tenantId: string,
250
+ ): Promise<StandardResponse<SyncInventoryResponse>>;
251
+
252
+ /** GET `/private/stores/{storeId}/stock-catalog` — catálogo vendible de la tienda, una fila por SKU. */
253
+ getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
189
254
  }