@platfformx/proto-contracts 1.2.9 → 1.2.11

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.
@@ -4,7 +4,7 @@ export interface CreateProductRequest {
4
4
  title: string;
5
5
  categoryId: string;
6
6
  description?: string | undefined;
7
- price: number;
7
+ price: string;
8
8
  quantity: number;
9
9
  images: string[];
10
10
  variants: ProductVariant[];
@@ -30,10 +30,10 @@ export interface UpdateProductRequest {
30
30
  productId: string;
31
31
  title?: string | undefined;
32
32
  price?: number | undefined;
33
- images: string[];
34
33
  description?: string | undefined;
35
34
  stock?: number | undefined;
36
35
  categoryId?: string | undefined;
36
+ images: string[];
37
37
  }
38
38
  export interface DeleteProductRequest {
39
39
  productId: string;
@@ -55,6 +55,41 @@ export interface ProductResponse {
55
55
  createdAt: string;
56
56
  updatedAt: string;
57
57
  }
58
+ /** IMAGES */
59
+ export interface AddProductImagesRequest {
60
+ productId: string;
61
+ imagesUrls: string[];
62
+ }
63
+ export interface AddProductImagesResponse {
64
+ currentImages: string[];
65
+ }
66
+ export interface ReplaceProductImagesRequest {
67
+ productId: string;
68
+ newImagesUrls: string[];
69
+ }
70
+ export interface ReplaceProductImagesResponse {
71
+ currentImages: string[];
72
+ }
73
+ export interface ReorderProductImagesRequest {
74
+ productId: string;
75
+ currentImages: string[];
76
+ }
77
+ export interface ReorderProductImagesResponse {
78
+ orderedImageUrls: string[];
79
+ }
80
+ export interface RemoveProductImagesRequest {
81
+ productId: string;
82
+ imageUrls: string[];
83
+ }
84
+ export interface RemoveProductImagesResponse {
85
+ currentImages: string[];
86
+ }
87
+ export interface DeleteProductImagesRequest {
88
+ imageUrls: string[];
89
+ }
90
+ export interface DeleteProductImagesResponse {
91
+ success: boolean;
92
+ }
58
93
  export declare const PRODUCT_V1_PACKAGE_NAME = "product.v1";
59
94
  export interface ProductServiceClient {
60
95
  createProduct(request: CreateProductRequest): Observable<ProductResponse>;
@@ -62,6 +97,12 @@ export interface ProductServiceClient {
62
97
  deleteProduct(request: DeleteProductRequest): Observable<DeleteProductResponse>;
63
98
  getProduct(request: GetProductRequest): Observable<ProductResponse>;
64
99
  getProducts(request: GetProductsRequest): Observable<GetProductsResponse>;
100
+ /** IMAGES */
101
+ addProductImages(request: AddProductImagesRequest): Observable<AddProductImagesResponse>;
102
+ replaceProductImages(request: ReplaceProductImagesRequest): Observable<ReplaceProductImagesResponse>;
103
+ reorderProductImages(request: ReorderProductImagesRequest): Observable<ReorderProductImagesResponse>;
104
+ removeProductImages(request: RemoveProductImagesRequest): Observable<RemoveProductImagesResponse>;
105
+ deleteProductImages(request: DeleteProductImagesRequest): Observable<DeleteProductImagesResponse>;
65
106
  }
66
107
  export interface ProductServiceController {
67
108
  createProduct(request: CreateProductRequest): Promise<ProductResponse> | Observable<ProductResponse> | ProductResponse;
@@ -69,6 +110,12 @@ export interface ProductServiceController {
69
110
  deleteProduct(request: DeleteProductRequest): Promise<DeleteProductResponse> | Observable<DeleteProductResponse> | DeleteProductResponse;
70
111
  getProduct(request: GetProductRequest): Promise<ProductResponse> | Observable<ProductResponse> | ProductResponse;
71
112
  getProducts(request: GetProductsRequest): Promise<GetProductsResponse> | Observable<GetProductsResponse> | GetProductsResponse;
113
+ /** IMAGES */
114
+ addProductImages(request: AddProductImagesRequest): Promise<AddProductImagesResponse> | Observable<AddProductImagesResponse> | AddProductImagesResponse;
115
+ replaceProductImages(request: ReplaceProductImagesRequest): Promise<ReplaceProductImagesResponse> | Observable<ReplaceProductImagesResponse> | ReplaceProductImagesResponse;
116
+ reorderProductImages(request: ReorderProductImagesRequest): Promise<ReorderProductImagesResponse> | Observable<ReorderProductImagesResponse> | ReorderProductImagesResponse;
117
+ removeProductImages(request: RemoveProductImagesRequest): Promise<RemoveProductImagesResponse> | Observable<RemoveProductImagesResponse> | RemoveProductImagesResponse;
118
+ deleteProductImages(request: DeleteProductImagesRequest): Promise<DeleteProductImagesResponse> | Observable<DeleteProductImagesResponse> | DeleteProductImagesResponse;
72
119
  }
73
120
  export declare function ProductServiceControllerMethods(): (constructor: Function) => void;
74
121
  export declare const PRODUCT_SERVICE_NAME = "ProductService";
@@ -13,7 +13,18 @@ exports.protobufPackage = "product.v1";
13
13
  exports.PRODUCT_V1_PACKAGE_NAME = "product.v1";
14
14
  function ProductServiceControllerMethods() {
15
15
  return function (constructor) {
16
- const grpcMethods = ["createProduct", "updateProduct", "deleteProduct", "getProduct", "getProducts"];
16
+ const grpcMethods = [
17
+ "createProduct",
18
+ "updateProduct",
19
+ "deleteProduct",
20
+ "getProduct",
21
+ "getProducts",
22
+ "addProductImages",
23
+ "replaceProductImages",
24
+ "reorderProductImages",
25
+ "removeProductImages",
26
+ "deleteProductImages",
27
+ ];
17
28
  for (const method of grpcMethods) {
18
29
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
19
30
  (0, microservices_1.GrpcMethod)("ProductService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platfformx/proto-contracts",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsc",
24
- "generate": "mkdirp src/gen/ts && globstar -- protoc -I=proto proto/**/*.proto --ts_proto_out=./src/gen/ts --ts_proto_opt=nestJs=true,esModuleInterop=true"
24
+ "generate": "mkdirp src/gen/ts && globstar -- protoc -I=proto proto/**/*.proto --ts_proto_out=./src/gen/ts --ts_proto_opt=nestJs=true,esModuleInterop=true,oneof=properties,useOptionalProperties=all"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": "",
@@ -8,13 +8,22 @@ service ProductService {
8
8
  rpc DeleteProduct (DeleteProductRequest) returns (DeleteProductResponse);
9
9
  rpc GetProduct(GetProductRequest) returns (ProductResponse);
10
10
  rpc GetProducts(GetProductsRequest) returns (GetProductsResponse);
11
+
12
+
13
+ // IMAGES
14
+ rpc AddProductImages (AddProductImagesRequest) returns (AddProductImagesResponse);
15
+ rpc ReplaceProductImages (ReplaceProductImagesRequest) returns (ReplaceProductImagesResponse);
16
+ rpc ReorderProductImages (ReorderProductImagesRequest) returns (ReorderProductImagesResponse);
17
+ rpc RemoveProductImages (RemoveProductImagesRequest) returns (RemoveProductImagesResponse);
18
+ rpc DeleteProductImages (DeleteProductImagesRequest) returns (DeleteProductImagesResponse);
19
+
11
20
  }
12
21
 
13
22
  message CreateProductRequest{
14
23
  string title = 1;
15
24
  string category_id = 2;
16
25
  optional string description = 3;
17
- double price = 4;
26
+ string price = 4;
18
27
  int32 quantity = 5;
19
28
  repeated string images = 6;
20
29
  repeated ProductVariant variants = 7;
@@ -26,8 +35,11 @@ message ProductVariant {
26
35
  string sku = 3;
27
36
  }
28
37
  message GetProductRequest {
29
- optional string product_id = 1;
30
- optional string slug = 2;
38
+ oneof identifier {
39
+ string product_id = 1;
40
+ string slug = 2;
41
+
42
+ }
31
43
  }
32
44
 
33
45
  message GetProductsRequest {
@@ -43,10 +55,11 @@ message UpdateProductRequest {
43
55
  string product_id = 1;
44
56
  optional string title = 2;
45
57
  optional double price = 3;
46
- repeated string images = 4;
47
- optional string description = 5;
48
- optional int32 stock = 6;
49
- optional string category_id = 7;
58
+ optional string description = 4;
59
+ optional int32 stock = 5;
60
+ optional string category_id = 6;
61
+
62
+ repeated string images = 7;
50
63
 
51
64
  }
52
65
 
@@ -70,4 +83,46 @@ message ProductResponse{
70
83
  int32 review_count = 10;
71
84
  string created_at = 11;
72
85
  string updated_at = 12;
86
+ }
87
+
88
+
89
+ // IMAGES
90
+ message AddProductImagesRequest {
91
+ string product_id = 1;
92
+ repeated string images_urls = 2;
93
+ }
94
+
95
+ message AddProductImagesResponse {
96
+ repeated string current_images = 1;
97
+ }
98
+
99
+ message ReplaceProductImagesRequest {
100
+ string product_id = 1;
101
+ repeated string new_images_urls = 2;
102
+ }
103
+
104
+ message ReplaceProductImagesResponse {
105
+ repeated string current_images = 1;
106
+ }
107
+ message ReorderProductImagesRequest {
108
+ string product_id = 1;
109
+ repeated string current_images = 2;
110
+ }
111
+ message ReorderProductImagesResponse {
112
+ repeated string ordered_image_urls = 1;
113
+ }
114
+
115
+ message RemoveProductImagesRequest {
116
+ string product_id = 1;
117
+ repeated string image_urls = 2;
118
+ }
119
+ message RemoveProductImagesResponse {
120
+ repeated string current_images = 1;
121
+ }
122
+
123
+ message DeleteProductImagesRequest {
124
+ repeated string image_urls = 1;
125
+ }
126
+ message DeleteProductImagesResponse {
127
+ bool success = 1;
73
128
  }