@sagebox-be/proto-contracts 1.0.12 → 1.0.14
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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/interfaces/sagebox.d.ts +179 -0
- package/dist/interfaces/{product.js → sagebox.js} +261 -4
- package/dist/types/{product.d.ts → sagebox.d.ts} +124 -7
- package/dist/types/{product.js → sagebox.js} +436 -7
- package/dist/utils.d.ts +1 -8
- package/dist/utils.js +4 -13
- package/package.json +2 -4
- package/proto/sagebox.proto +134 -0
- package/dist/interfaces/product.d.ts +0 -91
- package/proto/product.proto +0 -79
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './types/
|
|
1
|
+
export * from './types/sagebox';
|
|
2
2
|
export { getProtoPath } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// export * from './interfaces/
|
|
2
|
+
// Export all gRPC interfaces and types
|
|
3
|
+
// export * from './interfaces/sagebox';
|
|
4
4
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
5
|
if (k2 === undefined) k2 = k;
|
|
6
6
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -17,8 +17,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.getProtoPath = void 0;
|
|
20
|
-
// Export all gRPC types for TypeScript
|
|
21
|
-
__exportStar(require("./types/
|
|
20
|
+
// // Export all gRPC types for TypeScript
|
|
21
|
+
__exportStar(require("./types/sagebox"), exports);
|
|
22
22
|
// Export proto file path helper
|
|
23
23
|
var utils_1 = require("./utils");
|
|
24
24
|
Object.defineProperty(exports, "getProtoPath", { enumerable: true, get: function () { return utils_1.getProtoPath; } });
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
|
2
|
+
import type { Metadata } from '@grpc/grpc-js';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
export declare const protobufPackage = "sagebox";
|
|
5
|
+
/**
|
|
6
|
+
* ============================================
|
|
7
|
+
* Product Request Messages
|
|
8
|
+
* ============================================
|
|
9
|
+
*/
|
|
10
|
+
export interface GetProductsByCategoryIdRequest {
|
|
11
|
+
categoryId: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GetProductByIdRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateProductRequest {
|
|
17
|
+
name: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
categoryId: string;
|
|
21
|
+
storeId: string;
|
|
22
|
+
status: string;
|
|
23
|
+
mediaKeys: string[];
|
|
24
|
+
skus: ProductSkuInput[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* ============================================
|
|
28
|
+
* Product Response Messages
|
|
29
|
+
* ============================================
|
|
30
|
+
*/
|
|
31
|
+
export interface GetProductsResponse {
|
|
32
|
+
products: Product[];
|
|
33
|
+
}
|
|
34
|
+
export interface ProductResponse {
|
|
35
|
+
product: Product | undefined;
|
|
36
|
+
error: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* ============================================
|
|
40
|
+
* Address Request Messages
|
|
41
|
+
* ============================================
|
|
42
|
+
*/
|
|
43
|
+
export interface GetProvincesRequest {
|
|
44
|
+
}
|
|
45
|
+
export interface GetDistrictsRequest {
|
|
46
|
+
provinceCode: string;
|
|
47
|
+
}
|
|
48
|
+
export interface GetWardsRequest {
|
|
49
|
+
provinceCode: string;
|
|
50
|
+
districtCode: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* ============================================
|
|
54
|
+
* Address Response Messages
|
|
55
|
+
* ============================================
|
|
56
|
+
*/
|
|
57
|
+
export interface GetProvincesResponse {
|
|
58
|
+
provinces: AddressUnit[];
|
|
59
|
+
}
|
|
60
|
+
export interface GetDistrictsResponse {
|
|
61
|
+
districts: AddressUnit[];
|
|
62
|
+
}
|
|
63
|
+
export interface GetWardsResponse {
|
|
64
|
+
wards: AddressUnit[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* ============================================
|
|
68
|
+
* Product Data Structures
|
|
69
|
+
* ============================================
|
|
70
|
+
*/
|
|
71
|
+
export interface Product {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
title: string;
|
|
75
|
+
description: string;
|
|
76
|
+
keywords: string;
|
|
77
|
+
categoryId: string;
|
|
78
|
+
storeId: string;
|
|
79
|
+
viewedCount: number;
|
|
80
|
+
status: string;
|
|
81
|
+
url: string;
|
|
82
|
+
media: Media[];
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
}
|
|
86
|
+
export interface Media {
|
|
87
|
+
id: string;
|
|
88
|
+
key: string;
|
|
89
|
+
url: string;
|
|
90
|
+
type: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
updatedAt: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ProductSkuInput {
|
|
95
|
+
price: number;
|
|
96
|
+
quantity: number;
|
|
97
|
+
brand?: string | undefined;
|
|
98
|
+
mediaKeys: string[];
|
|
99
|
+
attributeValues: AttributeValueInput[];
|
|
100
|
+
}
|
|
101
|
+
export interface AttributeValueInput {
|
|
102
|
+
attrId: string;
|
|
103
|
+
value: string;
|
|
104
|
+
name: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* ============================================
|
|
108
|
+
* Address Data Structures
|
|
109
|
+
* ============================================
|
|
110
|
+
*/
|
|
111
|
+
export interface AddressUnit {
|
|
112
|
+
code: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}
|
|
115
|
+
export declare const SAGEBOX_PACKAGE_NAME = "sagebox";
|
|
116
|
+
export declare const GetProductsByCategoryIdRequest: MessageFns<GetProductsByCategoryIdRequest>;
|
|
117
|
+
export declare const GetProductByIdRequest: MessageFns<GetProductByIdRequest>;
|
|
118
|
+
export declare const CreateProductRequest: MessageFns<CreateProductRequest>;
|
|
119
|
+
export declare const GetProductsResponse: MessageFns<GetProductsResponse>;
|
|
120
|
+
export declare const ProductResponse: MessageFns<ProductResponse>;
|
|
121
|
+
export declare const GetProvincesRequest: MessageFns<GetProvincesRequest>;
|
|
122
|
+
export declare const GetDistrictsRequest: MessageFns<GetDistrictsRequest>;
|
|
123
|
+
export declare const GetWardsRequest: MessageFns<GetWardsRequest>;
|
|
124
|
+
export declare const GetProvincesResponse: MessageFns<GetProvincesResponse>;
|
|
125
|
+
export declare const GetDistrictsResponse: MessageFns<GetDistrictsResponse>;
|
|
126
|
+
export declare const GetWardsResponse: MessageFns<GetWardsResponse>;
|
|
127
|
+
export declare const Product: MessageFns<Product>;
|
|
128
|
+
export declare const Media: MessageFns<Media>;
|
|
129
|
+
export declare const ProductSkuInput: MessageFns<ProductSkuInput>;
|
|
130
|
+
export declare const AttributeValueInput: MessageFns<AttributeValueInput>;
|
|
131
|
+
export declare const AddressUnit: MessageFns<AddressUnit>;
|
|
132
|
+
/**
|
|
133
|
+
* ============================================
|
|
134
|
+
* Product Service
|
|
135
|
+
* ============================================
|
|
136
|
+
*/
|
|
137
|
+
export interface ProductServiceClient {
|
|
138
|
+
getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata?: Metadata): Observable<GetProductsResponse>;
|
|
139
|
+
getProductById(request: GetProductByIdRequest, metadata?: Metadata): Observable<ProductResponse>;
|
|
140
|
+
createProduct(request: CreateProductRequest, metadata?: Metadata): Observable<ProductResponse>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* ============================================
|
|
144
|
+
* Product Service
|
|
145
|
+
* ============================================
|
|
146
|
+
*/
|
|
147
|
+
export interface ProductServiceController {
|
|
148
|
+
getProductsByCategoryId(request: GetProductsByCategoryIdRequest, metadata?: Metadata): Promise<GetProductsResponse> | Observable<GetProductsResponse> | GetProductsResponse;
|
|
149
|
+
getProductById(request: GetProductByIdRequest, metadata?: Metadata): Promise<ProductResponse> | Observable<ProductResponse> | ProductResponse;
|
|
150
|
+
createProduct(request: CreateProductRequest, metadata?: Metadata): Promise<ProductResponse> | Observable<ProductResponse> | ProductResponse;
|
|
151
|
+
}
|
|
152
|
+
export declare function ProductServiceControllerMethods(): (constructor: Function) => void;
|
|
153
|
+
export declare const PRODUCT_SERVICE_NAME = "ProductService";
|
|
154
|
+
/**
|
|
155
|
+
* ============================================
|
|
156
|
+
* Address Service
|
|
157
|
+
* ============================================
|
|
158
|
+
*/
|
|
159
|
+
export interface AddressServiceClient {
|
|
160
|
+
getProvinces(request: GetProvincesRequest, metadata?: Metadata): Observable<GetProvincesResponse>;
|
|
161
|
+
getDistricts(request: GetDistrictsRequest, metadata?: Metadata): Observable<GetDistrictsResponse>;
|
|
162
|
+
getWards(request: GetWardsRequest, metadata?: Metadata): Observable<GetWardsResponse>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* ============================================
|
|
166
|
+
* Address Service
|
|
167
|
+
* ============================================
|
|
168
|
+
*/
|
|
169
|
+
export interface AddressServiceController {
|
|
170
|
+
getProvinces(request: GetProvincesRequest, metadata?: Metadata): Promise<GetProvincesResponse> | Observable<GetProvincesResponse> | GetProvincesResponse;
|
|
171
|
+
getDistricts(request: GetDistrictsRequest, metadata?: Metadata): Promise<GetDistrictsResponse> | Observable<GetDistrictsResponse> | GetDistrictsResponse;
|
|
172
|
+
getWards(request: GetWardsRequest, metadata?: Metadata): Promise<GetWardsResponse> | Observable<GetWardsResponse> | GetWardsResponse;
|
|
173
|
+
}
|
|
174
|
+
export declare function AddressServiceControllerMethods(): (constructor: Function) => void;
|
|
175
|
+
export declare const ADDRESS_SERVICE_NAME = "AddressService";
|
|
176
|
+
export interface MessageFns<T> {
|
|
177
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
178
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
179
|
+
}
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
// versions:
|
|
4
4
|
// protoc-gen-ts_proto v2.8.3
|
|
5
5
|
// protoc v6.33.2
|
|
6
|
-
// source:
|
|
6
|
+
// source: sagebox.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.PRODUCT_SERVICE_NAME = exports.AttributeValueInput = exports.ProductSkuInput = exports.Media = exports.Product = exports.ProductResponse = exports.GetProductsResponse = exports.CreateProductRequest = exports.GetProductByIdRequest = exports.GetProductsByCategoryIdRequest = exports.
|
|
8
|
+
exports.ADDRESS_SERVICE_NAME = exports.PRODUCT_SERVICE_NAME = exports.AddressUnit = exports.AttributeValueInput = exports.ProductSkuInput = exports.Media = exports.Product = exports.GetWardsResponse = exports.GetDistrictsResponse = exports.GetProvincesResponse = exports.GetWardsRequest = exports.GetDistrictsRequest = exports.GetProvincesRequest = exports.ProductResponse = exports.GetProductsResponse = exports.CreateProductRequest = exports.GetProductByIdRequest = exports.GetProductsByCategoryIdRequest = exports.SAGEBOX_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
9
|
exports.ProductServiceControllerMethods = ProductServiceControllerMethods;
|
|
10
|
+
exports.AddressServiceControllerMethods = AddressServiceControllerMethods;
|
|
10
11
|
/* eslint-disable */
|
|
11
12
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
12
13
|
const microservices_1 = require("@nestjs/microservices");
|
|
13
|
-
exports.protobufPackage = '
|
|
14
|
-
exports.
|
|
14
|
+
exports.protobufPackage = 'sagebox';
|
|
15
|
+
exports.SAGEBOX_PACKAGE_NAME = 'sagebox';
|
|
15
16
|
function createBaseGetProductsByCategoryIdRequest() {
|
|
16
17
|
return { categoryId: '' };
|
|
17
18
|
}
|
|
@@ -266,6 +267,204 @@ exports.ProductResponse = {
|
|
|
266
267
|
return message;
|
|
267
268
|
},
|
|
268
269
|
};
|
|
270
|
+
function createBaseGetProvincesRequest() {
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
exports.GetProvincesRequest = {
|
|
274
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
275
|
+
return writer;
|
|
276
|
+
},
|
|
277
|
+
decode(input, length) {
|
|
278
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
279
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
280
|
+
const message = createBaseGetProvincesRequest();
|
|
281
|
+
while (reader.pos < end) {
|
|
282
|
+
const tag = reader.uint32();
|
|
283
|
+
switch (tag >>> 3) {
|
|
284
|
+
}
|
|
285
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
reader.skip(tag & 7);
|
|
289
|
+
}
|
|
290
|
+
return message;
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
function createBaseGetDistrictsRequest() {
|
|
294
|
+
return { provinceCode: '' };
|
|
295
|
+
}
|
|
296
|
+
exports.GetDistrictsRequest = {
|
|
297
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
298
|
+
if (message.provinceCode !== '') {
|
|
299
|
+
writer.uint32(10).string(message.provinceCode);
|
|
300
|
+
}
|
|
301
|
+
return writer;
|
|
302
|
+
},
|
|
303
|
+
decode(input, length) {
|
|
304
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
305
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
306
|
+
const message = createBaseGetDistrictsRequest();
|
|
307
|
+
while (reader.pos < end) {
|
|
308
|
+
const tag = reader.uint32();
|
|
309
|
+
switch (tag >>> 3) {
|
|
310
|
+
case 1: {
|
|
311
|
+
if (tag !== 10) {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
message.provinceCode = reader.string();
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
reader.skip(tag & 7);
|
|
322
|
+
}
|
|
323
|
+
return message;
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
function createBaseGetWardsRequest() {
|
|
327
|
+
return { provinceCode: '', districtCode: '' };
|
|
328
|
+
}
|
|
329
|
+
exports.GetWardsRequest = {
|
|
330
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
331
|
+
if (message.provinceCode !== '') {
|
|
332
|
+
writer.uint32(10).string(message.provinceCode);
|
|
333
|
+
}
|
|
334
|
+
if (message.districtCode !== '') {
|
|
335
|
+
writer.uint32(18).string(message.districtCode);
|
|
336
|
+
}
|
|
337
|
+
return writer;
|
|
338
|
+
},
|
|
339
|
+
decode(input, length) {
|
|
340
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
341
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
342
|
+
const message = createBaseGetWardsRequest();
|
|
343
|
+
while (reader.pos < end) {
|
|
344
|
+
const tag = reader.uint32();
|
|
345
|
+
switch (tag >>> 3) {
|
|
346
|
+
case 1: {
|
|
347
|
+
if (tag !== 10) {
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
message.provinceCode = reader.string();
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
case 2: {
|
|
354
|
+
if (tag !== 18) {
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
message.districtCode = reader.string();
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
reader.skip(tag & 7);
|
|
365
|
+
}
|
|
366
|
+
return message;
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
function createBaseGetProvincesResponse() {
|
|
370
|
+
return { provinces: [] };
|
|
371
|
+
}
|
|
372
|
+
exports.GetProvincesResponse = {
|
|
373
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
374
|
+
for (const v of message.provinces) {
|
|
375
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
376
|
+
}
|
|
377
|
+
return writer;
|
|
378
|
+
},
|
|
379
|
+
decode(input, length) {
|
|
380
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
381
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
382
|
+
const message = createBaseGetProvincesResponse();
|
|
383
|
+
while (reader.pos < end) {
|
|
384
|
+
const tag = reader.uint32();
|
|
385
|
+
switch (tag >>> 3) {
|
|
386
|
+
case 1: {
|
|
387
|
+
if (tag !== 10) {
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
message.provinces.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
reader.skip(tag & 7);
|
|
398
|
+
}
|
|
399
|
+
return message;
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
function createBaseGetDistrictsResponse() {
|
|
403
|
+
return { districts: [] };
|
|
404
|
+
}
|
|
405
|
+
exports.GetDistrictsResponse = {
|
|
406
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
407
|
+
for (const v of message.districts) {
|
|
408
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
409
|
+
}
|
|
410
|
+
return writer;
|
|
411
|
+
},
|
|
412
|
+
decode(input, length) {
|
|
413
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
414
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
415
|
+
const message = createBaseGetDistrictsResponse();
|
|
416
|
+
while (reader.pos < end) {
|
|
417
|
+
const tag = reader.uint32();
|
|
418
|
+
switch (tag >>> 3) {
|
|
419
|
+
case 1: {
|
|
420
|
+
if (tag !== 10) {
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
message.districts.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
reader.skip(tag & 7);
|
|
431
|
+
}
|
|
432
|
+
return message;
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
function createBaseGetWardsResponse() {
|
|
436
|
+
return { wards: [] };
|
|
437
|
+
}
|
|
438
|
+
exports.GetWardsResponse = {
|
|
439
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
440
|
+
for (const v of message.wards) {
|
|
441
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
442
|
+
}
|
|
443
|
+
return writer;
|
|
444
|
+
},
|
|
445
|
+
decode(input, length) {
|
|
446
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
447
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
448
|
+
const message = createBaseGetWardsResponse();
|
|
449
|
+
while (reader.pos < end) {
|
|
450
|
+
const tag = reader.uint32();
|
|
451
|
+
switch (tag >>> 3) {
|
|
452
|
+
case 1: {
|
|
453
|
+
if (tag !== 10) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
message.wards.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
reader.skip(tag & 7);
|
|
464
|
+
}
|
|
465
|
+
return message;
|
|
466
|
+
},
|
|
467
|
+
};
|
|
269
468
|
function createBaseProduct() {
|
|
270
469
|
return {
|
|
271
470
|
id: '',
|
|
@@ -642,6 +841,49 @@ exports.AttributeValueInput = {
|
|
|
642
841
|
return message;
|
|
643
842
|
},
|
|
644
843
|
};
|
|
844
|
+
function createBaseAddressUnit() {
|
|
845
|
+
return { code: '', name: '' };
|
|
846
|
+
}
|
|
847
|
+
exports.AddressUnit = {
|
|
848
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
849
|
+
if (message.code !== '') {
|
|
850
|
+
writer.uint32(10).string(message.code);
|
|
851
|
+
}
|
|
852
|
+
if (message.name !== '') {
|
|
853
|
+
writer.uint32(18).string(message.name);
|
|
854
|
+
}
|
|
855
|
+
return writer;
|
|
856
|
+
},
|
|
857
|
+
decode(input, length) {
|
|
858
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
859
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
860
|
+
const message = createBaseAddressUnit();
|
|
861
|
+
while (reader.pos < end) {
|
|
862
|
+
const tag = reader.uint32();
|
|
863
|
+
switch (tag >>> 3) {
|
|
864
|
+
case 1: {
|
|
865
|
+
if (tag !== 10) {
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
message.code = reader.string();
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
case 2: {
|
|
872
|
+
if (tag !== 18) {
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
message.name = reader.string();
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
reader.skip(tag & 7);
|
|
883
|
+
}
|
|
884
|
+
return message;
|
|
885
|
+
},
|
|
886
|
+
};
|
|
645
887
|
function ProductServiceControllerMethods() {
|
|
646
888
|
return function (constructor) {
|
|
647
889
|
const grpcMethods = [
|
|
@@ -661,3 +903,18 @@ function ProductServiceControllerMethods() {
|
|
|
661
903
|
};
|
|
662
904
|
}
|
|
663
905
|
exports.PRODUCT_SERVICE_NAME = 'ProductService';
|
|
906
|
+
function AddressServiceControllerMethods() {
|
|
907
|
+
return function (constructor) {
|
|
908
|
+
const grpcMethods = ['getProvinces', 'getDistricts', 'getWards'];
|
|
909
|
+
for (const method of grpcMethods) {
|
|
910
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
911
|
+
(0, microservices_1.GrpcMethod)('AddressService', method)(constructor.prototype[method], method, descriptor);
|
|
912
|
+
}
|
|
913
|
+
const grpcStreamMethods = [];
|
|
914
|
+
for (const method of grpcStreamMethods) {
|
|
915
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
916
|
+
(0, microservices_1.GrpcStreamMethod)('AddressService', method)(constructor.prototype[method], method, descriptor);
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
exports.ADDRESS_SERVICE_NAME = 'AddressService';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
|
2
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 = "
|
|
4
|
-
/**
|
|
3
|
+
export declare const protobufPackage = "sagebox";
|
|
4
|
+
/**
|
|
5
|
+
* ============================================
|
|
6
|
+
* Product Request Messages
|
|
7
|
+
* ============================================
|
|
8
|
+
*/
|
|
5
9
|
export interface GetProductsByCategoryIdRequest {
|
|
6
10
|
categoryId: string;
|
|
7
11
|
}
|
|
@@ -18,7 +22,11 @@ export interface CreateProductRequest {
|
|
|
18
22
|
mediaKeys: string[];
|
|
19
23
|
skus: ProductSkuInput[];
|
|
20
24
|
}
|
|
21
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* ============================================
|
|
27
|
+
* Product Response Messages
|
|
28
|
+
* ============================================
|
|
29
|
+
*/
|
|
22
30
|
export interface GetProductsResponse {
|
|
23
31
|
products: Product[];
|
|
24
32
|
}
|
|
@@ -26,7 +34,39 @@ export interface ProductResponse {
|
|
|
26
34
|
product: Product | undefined;
|
|
27
35
|
error: string;
|
|
28
36
|
}
|
|
29
|
-
/**
|
|
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
|
+
*/
|
|
30
70
|
export interface Product {
|
|
31
71
|
id: string;
|
|
32
72
|
name: string;
|
|
@@ -62,19 +102,40 @@ export interface AttributeValueInput {
|
|
|
62
102
|
value: string;
|
|
63
103
|
name: string;
|
|
64
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* ============================================
|
|
107
|
+
* Address Data Structures
|
|
108
|
+
* ============================================
|
|
109
|
+
*/
|
|
110
|
+
export interface AddressUnit {
|
|
111
|
+
code: string;
|
|
112
|
+
name: string;
|
|
113
|
+
}
|
|
65
114
|
export declare const GetProductsByCategoryIdRequest: MessageFns<GetProductsByCategoryIdRequest>;
|
|
66
115
|
export declare const GetProductByIdRequest: MessageFns<GetProductByIdRequest>;
|
|
67
116
|
export declare const CreateProductRequest: MessageFns<CreateProductRequest>;
|
|
68
117
|
export declare const GetProductsResponse: MessageFns<GetProductsResponse>;
|
|
69
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>;
|
|
70
125
|
export declare const Product: MessageFns<Product>;
|
|
71
126
|
export declare const Media: MessageFns<Media>;
|
|
72
127
|
export declare const ProductSkuInput: MessageFns<ProductSkuInput>;
|
|
73
128
|
export declare const AttributeValueInput: MessageFns<AttributeValueInput>;
|
|
129
|
+
export declare const AddressUnit: MessageFns<AddressUnit>;
|
|
130
|
+
/**
|
|
131
|
+
* ============================================
|
|
132
|
+
* Product Service
|
|
133
|
+
* ============================================
|
|
134
|
+
*/
|
|
74
135
|
export type ProductServiceService = typeof ProductServiceService;
|
|
75
136
|
export declare const ProductServiceService: {
|
|
76
137
|
readonly getProductsByCategoryId: {
|
|
77
|
-
readonly path: "/
|
|
138
|
+
readonly path: "/sagebox.ProductService/GetProductsByCategoryId";
|
|
78
139
|
readonly requestStream: false;
|
|
79
140
|
readonly responseStream: false;
|
|
80
141
|
readonly requestSerialize: (value: GetProductsByCategoryIdRequest) => Buffer;
|
|
@@ -83,7 +144,7 @@ export declare const ProductServiceService: {
|
|
|
83
144
|
readonly responseDeserialize: (value: Buffer) => GetProductsResponse;
|
|
84
145
|
};
|
|
85
146
|
readonly getProductById: {
|
|
86
|
-
readonly path: "/
|
|
147
|
+
readonly path: "/sagebox.ProductService/GetProductById";
|
|
87
148
|
readonly requestStream: false;
|
|
88
149
|
readonly responseStream: false;
|
|
89
150
|
readonly requestSerialize: (value: GetProductByIdRequest) => Buffer;
|
|
@@ -92,7 +153,7 @@ export declare const ProductServiceService: {
|
|
|
92
153
|
readonly responseDeserialize: (value: Buffer) => ProductResponse;
|
|
93
154
|
};
|
|
94
155
|
readonly createProduct: {
|
|
95
|
-
readonly path: "/
|
|
156
|
+
readonly path: "/sagebox.ProductService/CreateProduct";
|
|
96
157
|
readonly requestStream: false;
|
|
97
158
|
readonly responseStream: false;
|
|
98
159
|
readonly requestSerialize: (value: CreateProductRequest) => Buffer;
|
|
@@ -122,6 +183,62 @@ export declare const ProductServiceClient: {
|
|
|
122
183
|
service: typeof ProductServiceService;
|
|
123
184
|
serviceName: string;
|
|
124
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
|
+
};
|
|
125
242
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
126
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 {} ? {
|
|
127
244
|
[K in keyof T]?: DeepPartial<T[K]>;
|