@sagebox-be/proto-contracts 1.0.11 → 1.0.13

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,5 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
- import type { CallContext, CallOptions } from 'nice-grpc-common';
2
+ import { type CallOptions, type ChannelCredentials, Client, type ClientOptions, type ClientUnaryCall, type handleUnaryCall, type Metadata, type ServiceError, type UntypedServiceImplementation } from '@grpc/grpc-js';
3
3
  export declare const protobufPackage = "product";
4
4
  /** Request messages */
5
5
  export interface GetProductsByCategoryIdRequest {
@@ -71,16 +71,57 @@ export declare const Product: MessageFns<Product>;
71
71
  export declare const Media: MessageFns<Media>;
72
72
  export declare const ProductSkuInput: MessageFns<ProductSkuInput>;
73
73
  export declare const AttributeValueInput: MessageFns<AttributeValueInput>;
74
- export interface ProductServiceImplementation<CallContextExt = {}> {
75
- getProductsByCategoryId(request: GetProductsByCategoryIdRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetProductsResponse>>;
76
- getProductById(request: GetProductByIdRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ProductResponse>>;
77
- createProduct(request: CreateProductRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ProductResponse>>;
74
+ export type ProductServiceService = typeof ProductServiceService;
75
+ export declare const ProductServiceService: {
76
+ readonly getProductsByCategoryId: {
77
+ readonly path: "/product.ProductService/GetProductsByCategoryId";
78
+ readonly requestStream: false;
79
+ readonly responseStream: false;
80
+ readonly requestSerialize: (value: GetProductsByCategoryIdRequest) => Buffer;
81
+ readonly requestDeserialize: (value: Buffer) => GetProductsByCategoryIdRequest;
82
+ readonly responseSerialize: (value: GetProductsResponse) => Buffer;
83
+ readonly responseDeserialize: (value: Buffer) => GetProductsResponse;
84
+ };
85
+ readonly getProductById: {
86
+ readonly path: "/product.ProductService/GetProductById";
87
+ readonly requestStream: false;
88
+ readonly responseStream: false;
89
+ readonly requestSerialize: (value: GetProductByIdRequest) => Buffer;
90
+ readonly requestDeserialize: (value: Buffer) => GetProductByIdRequest;
91
+ readonly responseSerialize: (value: ProductResponse) => Buffer;
92
+ readonly responseDeserialize: (value: Buffer) => ProductResponse;
93
+ };
94
+ readonly createProduct: {
95
+ readonly path: "/product.ProductService/CreateProduct";
96
+ readonly requestStream: false;
97
+ readonly responseStream: false;
98
+ readonly requestSerialize: (value: CreateProductRequest) => Buffer;
99
+ readonly requestDeserialize: (value: Buffer) => CreateProductRequest;
100
+ readonly responseSerialize: (value: ProductResponse) => Buffer;
101
+ readonly responseDeserialize: (value: Buffer) => ProductResponse;
102
+ };
103
+ };
104
+ export interface ProductServiceServer extends UntypedServiceImplementation {
105
+ getProductsByCategoryId: handleUnaryCall<GetProductsByCategoryIdRequest, GetProductsResponse>;
106
+ getProductById: handleUnaryCall<GetProductByIdRequest, ProductResponse>;
107
+ createProduct: handleUnaryCall<CreateProductRequest, ProductResponse>;
78
108
  }
79
- export interface ProductServiceClient<CallOptionsExt = {}> {
80
- getProductsByCategoryId(request: DeepPartial<GetProductsByCategoryIdRequest>, options?: CallOptions & CallOptionsExt): Promise<GetProductsResponse>;
81
- getProductById(request: DeepPartial<GetProductByIdRequest>, options?: CallOptions & CallOptionsExt): Promise<ProductResponse>;
82
- createProduct(request: DeepPartial<CreateProductRequest>, options?: CallOptions & CallOptionsExt): Promise<ProductResponse>;
109
+ export interface ProductServiceClient extends Client {
110
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
111
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
112
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
113
+ getProductById(request: GetProductByIdRequest, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
114
+ getProductById(request: GetProductByIdRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
115
+ getProductById(request: GetProductByIdRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
116
+ createProduct(request: CreateProductRequest, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
117
+ createProduct(request: CreateProductRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
118
+ createProduct(request: CreateProductRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
83
119
  }
120
+ export declare const ProductServiceClient: {
121
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): ProductServiceClient;
122
+ service: typeof ProductServiceService;
123
+ serviceName: string;
124
+ };
84
125
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
85
126
  export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
86
127
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -5,9 +5,10 @@
5
5
  // protoc v6.33.2
6
6
  // source: product.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AttributeValueInput = exports.ProductSkuInput = exports.Media = exports.Product = exports.ProductResponse = exports.GetProductsResponse = exports.CreateProductRequest = exports.GetProductByIdRequest = exports.GetProductsByCategoryIdRequest = exports.protobufPackage = void 0;
8
+ exports.ProductServiceClient = exports.ProductServiceService = exports.AttributeValueInput = exports.ProductSkuInput = exports.Media = exports.Product = exports.ProductResponse = exports.GetProductsResponse = exports.CreateProductRequest = exports.GetProductByIdRequest = exports.GetProductsByCategoryIdRequest = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const grpc_js_1 = require("@grpc/grpc-js");
11
12
  exports.protobufPackage = 'product';
12
13
  function createBaseGetProductsByCategoryIdRequest() {
13
14
  return { categoryId: '' };
@@ -1021,6 +1022,36 @@ exports.AttributeValueInput = {
1021
1022
  return message;
1022
1023
  },
1023
1024
  };
1025
+ exports.ProductServiceService = {
1026
+ getProductsByCategoryId: {
1027
+ path: '/product.ProductService/GetProductsByCategoryId',
1028
+ requestStream: false,
1029
+ responseStream: false,
1030
+ requestSerialize: (value) => Buffer.from(exports.GetProductsByCategoryIdRequest.encode(value).finish()),
1031
+ requestDeserialize: (value) => exports.GetProductsByCategoryIdRequest.decode(value),
1032
+ responseSerialize: (value) => Buffer.from(exports.GetProductsResponse.encode(value).finish()),
1033
+ responseDeserialize: (value) => exports.GetProductsResponse.decode(value),
1034
+ },
1035
+ getProductById: {
1036
+ path: '/product.ProductService/GetProductById',
1037
+ requestStream: false,
1038
+ responseStream: false,
1039
+ requestSerialize: (value) => Buffer.from(exports.GetProductByIdRequest.encode(value).finish()),
1040
+ requestDeserialize: (value) => exports.GetProductByIdRequest.decode(value),
1041
+ responseSerialize: (value) => Buffer.from(exports.ProductResponse.encode(value).finish()),
1042
+ responseDeserialize: (value) => exports.ProductResponse.decode(value),
1043
+ },
1044
+ createProduct: {
1045
+ path: '/product.ProductService/CreateProduct',
1046
+ requestStream: false,
1047
+ responseStream: false,
1048
+ requestSerialize: (value) => Buffer.from(exports.CreateProductRequest.encode(value).finish()),
1049
+ requestDeserialize: (value) => exports.CreateProductRequest.decode(value),
1050
+ responseSerialize: (value) => Buffer.from(exports.ProductResponse.encode(value).finish()),
1051
+ responseDeserialize: (value) => exports.ProductResponse.decode(value),
1052
+ },
1053
+ };
1054
+ exports.ProductServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.ProductServiceService, 'product.ProductService');
1024
1055
  function isSet(value) {
1025
1056
  return value !== null && value !== undefined;
1026
1057
  }
@@ -0,0 +1,260 @@
1
+ import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
+ import { type CallOptions, type ChannelCredentials, Client, type ClientOptions, type ClientUnaryCall, type handleUnaryCall, type Metadata, type ServiceError, type UntypedServiceImplementation } from '@grpc/grpc-js';
3
+ export declare const protobufPackage = "sagebox";
4
+ /**
5
+ * ============================================
6
+ * Product Request Messages
7
+ * ============================================
8
+ */
9
+ export interface GetProductsByCategoryIdRequest {
10
+ categoryId: string;
11
+ }
12
+ export interface GetProductByIdRequest {
13
+ id: string;
14
+ }
15
+ export interface CreateProductRequest {
16
+ name: string;
17
+ title: string;
18
+ description: string;
19
+ categoryId: string;
20
+ storeId: string;
21
+ status: string;
22
+ mediaKeys: string[];
23
+ skus: ProductSkuInput[];
24
+ }
25
+ /**
26
+ * ============================================
27
+ * Product Response Messages
28
+ * ============================================
29
+ */
30
+ export interface GetProductsResponse {
31
+ products: Product[];
32
+ }
33
+ export interface ProductResponse {
34
+ product: Product | undefined;
35
+ error: string;
36
+ }
37
+ /**
38
+ * ============================================
39
+ * Address Request Messages
40
+ * ============================================
41
+ */
42
+ export interface GetProvincesRequest {
43
+ }
44
+ export interface GetDistrictsRequest {
45
+ provinceCode: string;
46
+ }
47
+ export interface GetWardsRequest {
48
+ provinceCode: string;
49
+ districtCode: string;
50
+ }
51
+ /**
52
+ * ============================================
53
+ * Address Response Messages
54
+ * ============================================
55
+ */
56
+ export interface GetProvincesResponse {
57
+ provinces: AddressUnit[];
58
+ }
59
+ export interface GetDistrictsResponse {
60
+ districts: AddressUnit[];
61
+ }
62
+ export interface GetWardsResponse {
63
+ wards: AddressUnit[];
64
+ }
65
+ /**
66
+ * ============================================
67
+ * Product Data Structures
68
+ * ============================================
69
+ */
70
+ export interface Product {
71
+ id: string;
72
+ name: string;
73
+ title: string;
74
+ description: string;
75
+ keywords: string;
76
+ categoryId: string;
77
+ storeId: string;
78
+ viewedCount: number;
79
+ status: string;
80
+ url: string;
81
+ media: Media[];
82
+ createdAt: string;
83
+ updatedAt: string;
84
+ }
85
+ export interface Media {
86
+ id: string;
87
+ key: string;
88
+ url: string;
89
+ type: string;
90
+ createdAt: string;
91
+ updatedAt: string;
92
+ }
93
+ export interface ProductSkuInput {
94
+ price: number;
95
+ quantity: number;
96
+ brand?: string | undefined;
97
+ mediaKeys: string[];
98
+ attributeValues: AttributeValueInput[];
99
+ }
100
+ export interface AttributeValueInput {
101
+ attrId: string;
102
+ value: string;
103
+ name: string;
104
+ }
105
+ /**
106
+ * ============================================
107
+ * Address Data Structures
108
+ * ============================================
109
+ */
110
+ export interface AddressUnit {
111
+ code: string;
112
+ name: string;
113
+ }
114
+ export declare const GetProductsByCategoryIdRequest: MessageFns<GetProductsByCategoryIdRequest>;
115
+ export declare const GetProductByIdRequest: MessageFns<GetProductByIdRequest>;
116
+ export declare const CreateProductRequest: MessageFns<CreateProductRequest>;
117
+ export declare const GetProductsResponse: MessageFns<GetProductsResponse>;
118
+ export declare const ProductResponse: MessageFns<ProductResponse>;
119
+ export declare const GetProvincesRequest: MessageFns<GetProvincesRequest>;
120
+ export declare const GetDistrictsRequest: MessageFns<GetDistrictsRequest>;
121
+ export declare const GetWardsRequest: MessageFns<GetWardsRequest>;
122
+ export declare const GetProvincesResponse: MessageFns<GetProvincesResponse>;
123
+ export declare const GetDistrictsResponse: MessageFns<GetDistrictsResponse>;
124
+ export declare const GetWardsResponse: MessageFns<GetWardsResponse>;
125
+ export declare const Product: MessageFns<Product>;
126
+ export declare const Media: MessageFns<Media>;
127
+ export declare const ProductSkuInput: MessageFns<ProductSkuInput>;
128
+ export declare const AttributeValueInput: MessageFns<AttributeValueInput>;
129
+ export declare const AddressUnit: MessageFns<AddressUnit>;
130
+ /**
131
+ * ============================================
132
+ * Product Service
133
+ * ============================================
134
+ */
135
+ export type ProductServiceService = typeof ProductServiceService;
136
+ export declare const ProductServiceService: {
137
+ readonly getProductsByCategoryId: {
138
+ readonly path: "/sagebox.ProductService/GetProductsByCategoryId";
139
+ readonly requestStream: false;
140
+ readonly responseStream: false;
141
+ readonly requestSerialize: (value: GetProductsByCategoryIdRequest) => Buffer;
142
+ readonly requestDeserialize: (value: Buffer) => GetProductsByCategoryIdRequest;
143
+ readonly responseSerialize: (value: GetProductsResponse) => Buffer;
144
+ readonly responseDeserialize: (value: Buffer) => GetProductsResponse;
145
+ };
146
+ readonly getProductById: {
147
+ readonly path: "/sagebox.ProductService/GetProductById";
148
+ readonly requestStream: false;
149
+ readonly responseStream: false;
150
+ readonly requestSerialize: (value: GetProductByIdRequest) => Buffer;
151
+ readonly requestDeserialize: (value: Buffer) => GetProductByIdRequest;
152
+ readonly responseSerialize: (value: ProductResponse) => Buffer;
153
+ readonly responseDeserialize: (value: Buffer) => ProductResponse;
154
+ };
155
+ readonly createProduct: {
156
+ readonly path: "/sagebox.ProductService/CreateProduct";
157
+ readonly requestStream: false;
158
+ readonly responseStream: false;
159
+ readonly requestSerialize: (value: CreateProductRequest) => Buffer;
160
+ readonly requestDeserialize: (value: Buffer) => CreateProductRequest;
161
+ readonly responseSerialize: (value: ProductResponse) => Buffer;
162
+ readonly responseDeserialize: (value: Buffer) => ProductResponse;
163
+ };
164
+ };
165
+ export interface ProductServiceServer extends UntypedServiceImplementation {
166
+ getProductsByCategoryId: handleUnaryCall<GetProductsByCategoryIdRequest, GetProductsResponse>;
167
+ getProductById: handleUnaryCall<GetProductByIdRequest, ProductResponse>;
168
+ createProduct: handleUnaryCall<CreateProductRequest, ProductResponse>;
169
+ }
170
+ export interface ProductServiceClient extends Client {
171
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
172
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
173
+ getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetProductsResponse) => void): ClientUnaryCall;
174
+ getProductById(request: GetProductByIdRequest, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
175
+ getProductById(request: GetProductByIdRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
176
+ getProductById(request: GetProductByIdRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
177
+ createProduct(request: CreateProductRequest, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
178
+ createProduct(request: CreateProductRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
179
+ createProduct(request: CreateProductRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ProductResponse) => void): ClientUnaryCall;
180
+ }
181
+ export declare const ProductServiceClient: {
182
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): ProductServiceClient;
183
+ service: typeof ProductServiceService;
184
+ serviceName: string;
185
+ };
186
+ /**
187
+ * ============================================
188
+ * Address Service
189
+ * ============================================
190
+ */
191
+ export type AddressServiceService = typeof AddressServiceService;
192
+ export declare const AddressServiceService: {
193
+ readonly getProvinces: {
194
+ readonly path: "/sagebox.AddressService/GetProvinces";
195
+ readonly requestStream: false;
196
+ readonly responseStream: false;
197
+ readonly requestSerialize: (value: GetProvincesRequest) => Buffer;
198
+ readonly requestDeserialize: (value: Buffer) => GetProvincesRequest;
199
+ readonly responseSerialize: (value: GetProvincesResponse) => Buffer;
200
+ readonly responseDeserialize: (value: Buffer) => GetProvincesResponse;
201
+ };
202
+ readonly getDistricts: {
203
+ readonly path: "/sagebox.AddressService/GetDistricts";
204
+ readonly requestStream: false;
205
+ readonly responseStream: false;
206
+ readonly requestSerialize: (value: GetDistrictsRequest) => Buffer;
207
+ readonly requestDeserialize: (value: Buffer) => GetDistrictsRequest;
208
+ readonly responseSerialize: (value: GetDistrictsResponse) => Buffer;
209
+ readonly responseDeserialize: (value: Buffer) => GetDistrictsResponse;
210
+ };
211
+ readonly getWards: {
212
+ readonly path: "/sagebox.AddressService/GetWards";
213
+ readonly requestStream: false;
214
+ readonly responseStream: false;
215
+ readonly requestSerialize: (value: GetWardsRequest) => Buffer;
216
+ readonly requestDeserialize: (value: Buffer) => GetWardsRequest;
217
+ readonly responseSerialize: (value: GetWardsResponse) => Buffer;
218
+ readonly responseDeserialize: (value: Buffer) => GetWardsResponse;
219
+ };
220
+ };
221
+ export interface AddressServiceServer extends UntypedServiceImplementation {
222
+ getProvinces: handleUnaryCall<GetProvincesRequest, GetProvincesResponse>;
223
+ getDistricts: handleUnaryCall<GetDistrictsRequest, GetDistrictsResponse>;
224
+ getWards: handleUnaryCall<GetWardsRequest, GetWardsResponse>;
225
+ }
226
+ export interface AddressServiceClient extends Client {
227
+ getProvinces(request: GetProvincesRequest, callback: (error: ServiceError | null, response: GetProvincesResponse) => void): ClientUnaryCall;
228
+ getProvinces(request: GetProvincesRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetProvincesResponse) => void): ClientUnaryCall;
229
+ getProvinces(request: GetProvincesRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetProvincesResponse) => void): ClientUnaryCall;
230
+ getDistricts(request: GetDistrictsRequest, callback: (error: ServiceError | null, response: GetDistrictsResponse) => void): ClientUnaryCall;
231
+ getDistricts(request: GetDistrictsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetDistrictsResponse) => void): ClientUnaryCall;
232
+ getDistricts(request: GetDistrictsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetDistrictsResponse) => void): ClientUnaryCall;
233
+ getWards(request: GetWardsRequest, callback: (error: ServiceError | null, response: GetWardsResponse) => void): ClientUnaryCall;
234
+ getWards(request: GetWardsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetWardsResponse) => void): ClientUnaryCall;
235
+ getWards(request: GetWardsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetWardsResponse) => void): ClientUnaryCall;
236
+ }
237
+ export declare const AddressServiceClient: {
238
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): AddressServiceClient;
239
+ service: typeof AddressServiceService;
240
+ serviceName: string;
241
+ };
242
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
243
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
244
+ [K in keyof T]?: DeepPartial<T[K]>;
245
+ } : Partial<T>;
246
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
247
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
248
+ [K in keyof P]: Exact<P[K], I[K]>;
249
+ } & {
250
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
251
+ };
252
+ export interface MessageFns<T> {
253
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
254
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
255
+ fromJSON(object: any): T;
256
+ toJSON(message: T): unknown;
257
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
258
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
259
+ }
260
+ export {};