@fiado/api-invoker 4.62.0 → 4.63.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.
@@ -21,6 +21,7 @@ export default class RetailOrgBusinessApi implements IRetailOrgBusinessApi {
21
21
  private readonly baseUrl;
22
22
  constructor(httpRequest: IHttpRequest);
23
23
  getRetailer(retailerId: string, tenantId: string): Promise<StandardResponse<RetailerValidationDto>>;
24
+ getRetailerByStore(storeId: string, tenantId: string): Promise<StandardResponse<RetailerValidationDto>>;
24
25
  getStore(retailerId: string, storeId: string, tenantId: string): Promise<StandardResponse<StoreValidationDto>>;
25
26
  getStoreUsers(retailerId: string, storeId: string, tenantId: string): Promise<StandardResponse<RetailUserValidationDto[]>>;
26
27
  getUserByCognitoSub(cognitoSub: string, tenantId: string): Promise<StandardResponse<RetailUserValidationDto>>;
@@ -35,6 +35,10 @@ let RetailOrgBusinessApi = class RetailOrgBusinessApi {
35
35
  const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}?tenantId=${encodeURIComponent(tenantId)}`;
36
36
  return await this.httpRequest.get(url);
37
37
  }
38
+ async getRetailerByStore(storeId, tenantId) {
39
+ const url = `${this.baseUrl}/private/retailers/by-store/${encodeURIComponent(storeId)}?tenantId=${encodeURIComponent(tenantId)}`;
40
+ return await this.httpRequest.get(url);
41
+ }
38
42
  async getStore(retailerId, storeId, tenantId) {
39
43
  const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/stores/${encodeURIComponent(storeId)}?tenantId=${encodeURIComponent(tenantId)}`;
40
44
  return await this.httpRequest.get(url);
@@ -51,6 +51,18 @@ export interface IRetailOrgBusinessApi {
51
51
  * @throws si el retailer no existe (`404 RETAILER_NOT_FOUND`).
52
52
  */
53
53
  getRetailer(retailerId: string, tenantId: string): Promise<StandardResponse<RetailerValidationDto>>;
54
+ /**
55
+ * GET /private/retailers/by-store/{storeId} — resuelve el retailer DUEÑO de una tienda teniendo
56
+ * SOLO el `storeId`, sin conocer el retailer. Es el único privado que no va anidado, porque es el
57
+ * único caso donde el caller no tiene el `retailerId` (spec comp. 04: "resolver retailerId desde
58
+ * storeId").
59
+ *
60
+ * Se apoya en el GSI `storeId-pk-index` de `RetailStore_GT`: sin él haría falta `Scan`, que el rol
61
+ * del tenant prohíbe. Si el índice no está deployado en el silo, este endpoint responde `500`.
62
+ *
63
+ * @throws si la tienda no existe (`404 STORE_NOT_FOUND`).
64
+ */
65
+ getRetailerByStore(storeId: string, tenantId: string): Promise<StandardResponse<RetailerValidationDto>>;
54
66
  /**
55
67
  * GET /private/retailers/{retailerId}/stores/{storeId} — valida que la tienda exista Y pertenezca
56
68
  * a ese retailer. El path es ANIDADO (no `/private/stores/{storeId}`): la tabla es
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "4.62.0",
3
+ "version": "4.63.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",
@@ -36,6 +36,14 @@ export default class RetailOrgBusinessApi implements IRetailOrgBusinessApi {
36
36
  return await this.httpRequest.get(url);
37
37
  }
38
38
 
39
+ async getRetailerByStore(
40
+ storeId: string,
41
+ tenantId: string,
42
+ ): Promise<StandardResponse<RetailerValidationDto>> {
43
+ const url = `${this.baseUrl}/private/retailers/by-store/${encodeURIComponent(storeId)}?tenantId=${encodeURIComponent(tenantId)}`;
44
+ return await this.httpRequest.get(url);
45
+ }
46
+
39
47
  async getStore(
40
48
  retailerId: string,
41
49
  storeId: string,
@@ -60,6 +60,22 @@ export interface IRetailOrgBusinessApi {
60
60
  tenantId: string,
61
61
  ): Promise<StandardResponse<RetailerValidationDto>>;
62
62
 
63
+ /**
64
+ * GET /private/retailers/by-store/{storeId} — resuelve el retailer DUEÑO de una tienda teniendo
65
+ * SOLO el `storeId`, sin conocer el retailer. Es el único privado que no va anidado, porque es el
66
+ * único caso donde el caller no tiene el `retailerId` (spec comp. 04: "resolver retailerId desde
67
+ * storeId").
68
+ *
69
+ * Se apoya en el GSI `storeId-pk-index` de `RetailStore_GT`: sin él haría falta `Scan`, que el rol
70
+ * del tenant prohíbe. Si el índice no está deployado en el silo, este endpoint responde `500`.
71
+ *
72
+ * @throws si la tienda no existe (`404 STORE_NOT_FOUND`).
73
+ */
74
+ getRetailerByStore(
75
+ storeId: string,
76
+ tenantId: string,
77
+ ): Promise<StandardResponse<RetailerValidationDto>>;
78
+
63
79
  /**
64
80
  * GET /private/retailers/{retailerId}/stores/{storeId} — valida que la tienda exista Y pertenezca
65
81
  * a ese retailer. El path es ANIDADO (no `/private/stores/{storeId}`): la tabla es