@mamindom/contracts 1.0.122 → 1.0.124

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.
@@ -52,14 +52,26 @@ export interface ShipmentParcelItem {
52
52
  price: number;
53
53
  weightKg: number;
54
54
  }
55
+ export interface Area {
56
+ ref: string;
57
+ carrier: string;
58
+ name: string;
59
+ }
55
60
  export interface SearchCitiesRequest {
56
61
  carrier: string;
57
62
  query: string;
58
63
  limit: number;
64
+ areaRef: string;
59
65
  }
60
66
  export interface SearchCitiesResponse {
61
67
  items: City[];
62
68
  }
69
+ export interface ListAreasRequest {
70
+ carrier: string;
71
+ }
72
+ export interface ListAreasResponse {
73
+ items: Area[];
74
+ }
63
75
  export interface ListWarehousesRequest {
64
76
  carrier: string;
65
77
  cityRef: string;
@@ -145,6 +157,7 @@ export interface ShipmentResponse {
145
157
  export declare const DELIVERY_V1_PACKAGE_NAME = "delivery.v1";
146
158
  export interface DeliveryServiceClient {
147
159
  searchCities(request: SearchCitiesRequest): Observable<SearchCitiesResponse>;
160
+ listAreas(request: ListAreasRequest): Observable<ListAreasResponse>;
148
161
  listWarehouses(request: ListWarehousesRequest): Observable<ListWarehousesResponse>;
149
162
  calculateShippingCost(request: CalculateRequest): Observable<CalculateResponse>;
150
163
  createShipment(request: CreateShipmentRequest): Observable<ShipmentResponse>;
@@ -154,6 +167,7 @@ export interface DeliveryServiceClient {
154
167
  }
155
168
  export interface DeliveryServiceController {
156
169
  searchCities(request: SearchCitiesRequest): Promise<SearchCitiesResponse> | Observable<SearchCitiesResponse> | SearchCitiesResponse;
170
+ listAreas(request: ListAreasRequest): Promise<ListAreasResponse> | Observable<ListAreasResponse> | ListAreasResponse;
157
171
  listWarehouses(request: ListWarehousesRequest): Promise<ListWarehousesResponse> | Observable<ListWarehousesResponse> | ListWarehousesResponse;
158
172
  calculateShippingCost(request: CalculateRequest): Promise<CalculateResponse> | Observable<CalculateResponse> | CalculateResponse;
159
173
  createShipment(request: CreateShipmentRequest): Promise<ShipmentResponse> | Observable<ShipmentResponse> | ShipmentResponse;
@@ -15,6 +15,7 @@ function DeliveryServiceControllerMethods() {
15
15
  return function (constructor) {
16
16
  const grpcMethods = [
17
17
  "searchCities",
18
+ "listAreas",
18
19
  "listWarehouses",
19
20
  "calculateShippingCost",
20
21
  "createShipment",
@@ -868,6 +868,27 @@ export interface BulkLookupProductsRequest {
868
868
  export interface BulkLookupProductsResponse {
869
869
  results: ProductLookupResult[];
870
870
  }
871
+ export interface VariantLookupResult {
872
+ variantId: string;
873
+ productId: string;
874
+ sku: string;
875
+ found: boolean;
876
+ /** Резолвлена з урахуванням variant override. */
877
+ price: number;
878
+ oldPrice?: number | undefined;
879
+ stock: number;
880
+ hasOwnPrice: boolean;
881
+ /** Локалізована назва (uk → ru → перше) для зручності клієнта. */
882
+ nameUk: string;
883
+ mainImage: string;
884
+ colorId?: string | undefined;
885
+ }
886
+ export interface BulkLookupVariantsRequest {
887
+ variantIds: string[];
888
+ }
889
+ export interface BulkLookupVariantsResponse {
890
+ results: VariantLookupResult[];
891
+ }
871
892
  export interface ProductColorImagePayload {
872
893
  url: string;
873
894
  mediaId: string;
@@ -1004,6 +1025,7 @@ export interface ProductServiceClient {
1004
1025
  bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Observable<SuccessResponse>;
1005
1026
  bulkSetPopular(request: BulkSetPopularRequest): Observable<SuccessResponse>;
1006
1027
  bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
1028
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
1007
1029
  createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
1008
1030
  updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
1009
1031
  deleteProductGroup(request: DeleteProductGroupRequest): Observable<SuccessResponse>;
@@ -1050,6 +1072,7 @@ export interface ProductServiceController {
1050
1072
  bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
1051
1073
  bulkSetPopular(request: BulkSetPopularRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
1052
1074
  bulkLookupProducts(request: BulkLookupProductsRequest): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
1075
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
1053
1076
  createProductGroup(request: CreateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
1054
1077
  updateProductGroup(request: UpdateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
1055
1078
  deleteProductGroup(request: DeleteProductGroupRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
@@ -71,6 +71,7 @@ function ProductServiceControllerMethods() {
71
71
  "bulkUpdateSortOrder",
72
72
  "bulkSetPopular",
73
73
  "bulkLookupProducts",
74
+ "bulkLookupVariants",
74
75
  "createProductGroup",
75
76
  "updateProductGroup",
76
77
  "deleteProductGroup",
@@ -4,6 +4,7 @@ package delivery.v1;
4
4
 
5
5
  service DeliveryService {
6
6
  rpc SearchCities(SearchCitiesRequest) returns (SearchCitiesResponse);
7
+ rpc ListAreas(ListAreasRequest) returns (ListAreasResponse);
7
8
  rpc ListWarehouses(ListWarehousesRequest) returns (ListWarehousesResponse);
8
9
 
9
10
  rpc CalculateShippingCost(CalculateRequest) returns (CalculateResponse);
@@ -78,16 +79,31 @@ message ShipmentParcelItem {
78
79
 
79
80
  // ─── Requests ──────────────────────────────────────────────────
80
81
 
82
+ message Area {
83
+ string ref = 1;
84
+ string carrier = 2;
85
+ string name = 3;
86
+ }
87
+
81
88
  message SearchCitiesRequest {
82
- string carrier = 1;
83
- string query = 2;
84
- int32 limit = 3;
89
+ string carrier = 1;
90
+ string query = 2;
91
+ int32 limit = 3;
92
+ string area_ref = 4;
85
93
  }
86
94
 
87
95
  message SearchCitiesResponse {
88
96
  repeated City items = 1;
89
97
  }
90
98
 
99
+ message ListAreasRequest {
100
+ string carrier = 1;
101
+ }
102
+
103
+ message ListAreasResponse {
104
+ repeated Area items = 1;
105
+ }
106
+
91
107
  message ListWarehousesRequest {
92
108
  string carrier = 1;
93
109
  string city_ref = 2;
@@ -52,6 +52,7 @@ service ProductService {
52
52
  rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
53
53
 
54
54
  rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
55
+ rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
55
56
 
56
57
 
57
58
  rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
752
753
  repeated ProductLookupResult results = 1;
753
754
  }
754
755
 
756
+ // ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
757
+ //
758
+ // Використовується cart-service для отримання актуальної ціни саме за варіантом
759
+ // (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
760
+ // для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
761
+
762
+ message VariantLookupResult {
763
+ string variant_id = 1;
764
+ string product_id = 2;
765
+ string sku = 3;
766
+ bool found = 4;
767
+ // Резолвлена з урахуванням variant override.
768
+ double price = 5;
769
+ optional double old_price = 6;
770
+ int32 stock = 7;
771
+ bool has_own_price = 8;
772
+ // Локалізована назва (uk → ru → перше) для зручності клієнта.
773
+ string name_uk = 9;
774
+ string main_image = 10;
775
+ optional string color_id = 11;
776
+ }
777
+
778
+ message BulkLookupVariantsRequest {
779
+ repeated string variant_ids = 1;
780
+ }
781
+
782
+ message BulkLookupVariantsResponse {
783
+ repeated VariantLookupResult results = 1;
784
+ }
785
+
755
786
 
756
787
  // ─── Product colors ──────────────────────────────────────────────────────────
757
788
 
package/gen/delivery.ts CHANGED
@@ -66,16 +66,31 @@ export interface ShipmentParcelItem {
66
66
  weightKg: number;
67
67
  }
68
68
 
69
+ export interface Area {
70
+ ref: string;
71
+ carrier: string;
72
+ name: string;
73
+ }
74
+
69
75
  export interface SearchCitiesRequest {
70
76
  carrier: string;
71
77
  query: string;
72
78
  limit: number;
79
+ areaRef: string;
73
80
  }
74
81
 
75
82
  export interface SearchCitiesResponse {
76
83
  items: City[];
77
84
  }
78
85
 
86
+ export interface ListAreasRequest {
87
+ carrier: string;
88
+ }
89
+
90
+ export interface ListAreasResponse {
91
+ items: Area[];
92
+ }
93
+
79
94
  export interface ListWarehousesRequest {
80
95
  carrier: string;
81
96
  cityRef: string;
@@ -174,6 +189,8 @@ export const DELIVERY_V1_PACKAGE_NAME = "delivery.v1";
174
189
  export interface DeliveryServiceClient {
175
190
  searchCities(request: SearchCitiesRequest): Observable<SearchCitiesResponse>;
176
191
 
192
+ listAreas(request: ListAreasRequest): Observable<ListAreasResponse>;
193
+
177
194
  listWarehouses(request: ListWarehousesRequest): Observable<ListWarehousesResponse>;
178
195
 
179
196
  calculateShippingCost(request: CalculateRequest): Observable<CalculateResponse>;
@@ -192,6 +209,8 @@ export interface DeliveryServiceController {
192
209
  request: SearchCitiesRequest,
193
210
  ): Promise<SearchCitiesResponse> | Observable<SearchCitiesResponse> | SearchCitiesResponse;
194
211
 
212
+ listAreas(request: ListAreasRequest): Promise<ListAreasResponse> | Observable<ListAreasResponse> | ListAreasResponse;
213
+
195
214
  listWarehouses(
196
215
  request: ListWarehousesRequest,
197
216
  ): Promise<ListWarehousesResponse> | Observable<ListWarehousesResponse> | ListWarehousesResponse;
@@ -219,6 +238,7 @@ export function DeliveryServiceControllerMethods() {
219
238
  return function (constructor: Function) {
220
239
  const grpcMethods: string[] = [
221
240
  "searchCities",
241
+ "listAreas",
222
242
  "listWarehouses",
223
243
  "calculateShippingCost",
224
244
  "createShipment",
package/gen/product.ts CHANGED
@@ -889,6 +889,30 @@ export interface BulkLookupProductsResponse {
889
889
  results: ProductLookupResult[];
890
890
  }
891
891
 
892
+ export interface VariantLookupResult {
893
+ variantId: string;
894
+ productId: string;
895
+ sku: string;
896
+ found: boolean;
897
+ /** Резолвлена з урахуванням variant override. */
898
+ price: number;
899
+ oldPrice?: number | undefined;
900
+ stock: number;
901
+ hasOwnPrice: boolean;
902
+ /** Локалізована назва (uk → ru → перше) для зручності клієнта. */
903
+ nameUk: string;
904
+ mainImage: string;
905
+ colorId?: string | undefined;
906
+ }
907
+
908
+ export interface BulkLookupVariantsRequest {
909
+ variantIds: string[];
910
+ }
911
+
912
+ export interface BulkLookupVariantsResponse {
913
+ results: VariantLookupResult[];
914
+ }
915
+
892
916
  export interface ProductColorImagePayload {
893
917
  url: string;
894
918
  mediaId: string;
@@ -1054,6 +1078,8 @@ export interface ProductServiceClient {
1054
1078
 
1055
1079
  bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
1056
1080
 
1081
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
1082
+
1057
1083
  createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
1058
1084
 
1059
1085
  updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
@@ -1192,6 +1218,10 @@ export interface ProductServiceController {
1192
1218
  request: BulkLookupProductsRequest,
1193
1219
  ): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
1194
1220
 
1221
+ bulkLookupVariants(
1222
+ request: BulkLookupVariantsRequest,
1223
+ ): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
1224
+
1195
1225
  createProductGroup(
1196
1226
  request: CreateProductGroupRequest,
1197
1227
  ): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
@@ -1295,6 +1325,7 @@ export function ProductServiceControllerMethods() {
1295
1325
  "bulkUpdateSortOrder",
1296
1326
  "bulkSetPopular",
1297
1327
  "bulkLookupProducts",
1328
+ "bulkLookupVariants",
1298
1329
  "createProductGroup",
1299
1330
  "updateProductGroup",
1300
1331
  "deleteProductGroup",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mamindom/contracts",
3
3
  "description": "proto",
4
- "version": "1.0.122",
4
+ "version": "1.0.124",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
7
7
  "exports": {
@@ -4,6 +4,7 @@ package delivery.v1;
4
4
 
5
5
  service DeliveryService {
6
6
  rpc SearchCities(SearchCitiesRequest) returns (SearchCitiesResponse);
7
+ rpc ListAreas(ListAreasRequest) returns (ListAreasResponse);
7
8
  rpc ListWarehouses(ListWarehousesRequest) returns (ListWarehousesResponse);
8
9
 
9
10
  rpc CalculateShippingCost(CalculateRequest) returns (CalculateResponse);
@@ -78,16 +79,31 @@ message ShipmentParcelItem {
78
79
 
79
80
  // ─── Requests ──────────────────────────────────────────────────
80
81
 
82
+ message Area {
83
+ string ref = 1;
84
+ string carrier = 2;
85
+ string name = 3;
86
+ }
87
+
81
88
  message SearchCitiesRequest {
82
- string carrier = 1;
83
- string query = 2;
84
- int32 limit = 3;
89
+ string carrier = 1;
90
+ string query = 2;
91
+ int32 limit = 3;
92
+ string area_ref = 4;
85
93
  }
86
94
 
87
95
  message SearchCitiesResponse {
88
96
  repeated City items = 1;
89
97
  }
90
98
 
99
+ message ListAreasRequest {
100
+ string carrier = 1;
101
+ }
102
+
103
+ message ListAreasResponse {
104
+ repeated Area items = 1;
105
+ }
106
+
91
107
  message ListWarehousesRequest {
92
108
  string carrier = 1;
93
109
  string city_ref = 2;
@@ -52,6 +52,7 @@ service ProductService {
52
52
  rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
53
53
 
54
54
  rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
55
+ rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
55
56
 
56
57
 
57
58
  rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
752
753
  repeated ProductLookupResult results = 1;
753
754
  }
754
755
 
756
+ // ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
757
+ //
758
+ // Використовується cart-service для отримання актуальної ціни саме за варіантом
759
+ // (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
760
+ // для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
761
+
762
+ message VariantLookupResult {
763
+ string variant_id = 1;
764
+ string product_id = 2;
765
+ string sku = 3;
766
+ bool found = 4;
767
+ // Резолвлена з урахуванням variant override.
768
+ double price = 5;
769
+ optional double old_price = 6;
770
+ int32 stock = 7;
771
+ bool has_own_price = 8;
772
+ // Локалізована назва (uk → ru → перше) для зручності клієнта.
773
+ string name_uk = 9;
774
+ string main_image = 10;
775
+ optional string color_id = 11;
776
+ }
777
+
778
+ message BulkLookupVariantsRequest {
779
+ repeated string variant_ids = 1;
780
+ }
781
+
782
+ message BulkLookupVariantsResponse {
783
+ repeated VariantLookupResult results = 1;
784
+ }
785
+
755
786
 
756
787
  // ─── Product colors ──────────────────────────────────────────────────────────
757
788