@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
|
@@ -3,13 +3,13 @@
|
|
|
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.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;
|
|
8
|
+
exports.AddressServiceClient = exports.AddressServiceService = exports.ProductServiceClient = exports.ProductServiceService = 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.protobufPackage = void 0;
|
|
9
9
|
/* eslint-disable */
|
|
10
10
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
11
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
12
|
-
exports.protobufPackage = '
|
|
12
|
+
exports.protobufPackage = 'sagebox';
|
|
13
13
|
function createBaseGetProductsByCategoryIdRequest() {
|
|
14
14
|
return { categoryId: '' };
|
|
15
15
|
}
|
|
@@ -421,6 +421,337 @@ exports.ProductResponse = {
|
|
|
421
421
|
return message;
|
|
422
422
|
},
|
|
423
423
|
};
|
|
424
|
+
function createBaseGetProvincesRequest() {
|
|
425
|
+
return {};
|
|
426
|
+
}
|
|
427
|
+
exports.GetProvincesRequest = {
|
|
428
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
429
|
+
return writer;
|
|
430
|
+
},
|
|
431
|
+
decode(input, length) {
|
|
432
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
433
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
434
|
+
const message = createBaseGetProvincesRequest();
|
|
435
|
+
while (reader.pos < end) {
|
|
436
|
+
const tag = reader.uint32();
|
|
437
|
+
switch (tag >>> 3) {
|
|
438
|
+
}
|
|
439
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
reader.skip(tag & 7);
|
|
443
|
+
}
|
|
444
|
+
return message;
|
|
445
|
+
},
|
|
446
|
+
fromJSON(_) {
|
|
447
|
+
return {};
|
|
448
|
+
},
|
|
449
|
+
toJSON(_) {
|
|
450
|
+
const obj = {};
|
|
451
|
+
return obj;
|
|
452
|
+
},
|
|
453
|
+
create(base) {
|
|
454
|
+
return exports.GetProvincesRequest.fromPartial(base ?? {});
|
|
455
|
+
},
|
|
456
|
+
fromPartial(_) {
|
|
457
|
+
const message = createBaseGetProvincesRequest();
|
|
458
|
+
return message;
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
function createBaseGetDistrictsRequest() {
|
|
462
|
+
return { provinceCode: '' };
|
|
463
|
+
}
|
|
464
|
+
exports.GetDistrictsRequest = {
|
|
465
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
466
|
+
if (message.provinceCode !== '') {
|
|
467
|
+
writer.uint32(10).string(message.provinceCode);
|
|
468
|
+
}
|
|
469
|
+
return writer;
|
|
470
|
+
},
|
|
471
|
+
decode(input, length) {
|
|
472
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
473
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
474
|
+
const message = createBaseGetDistrictsRequest();
|
|
475
|
+
while (reader.pos < end) {
|
|
476
|
+
const tag = reader.uint32();
|
|
477
|
+
switch (tag >>> 3) {
|
|
478
|
+
case 1: {
|
|
479
|
+
if (tag !== 10) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
message.provinceCode = reader.string();
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
reader.skip(tag & 7);
|
|
490
|
+
}
|
|
491
|
+
return message;
|
|
492
|
+
},
|
|
493
|
+
fromJSON(object) {
|
|
494
|
+
return {
|
|
495
|
+
provinceCode: isSet(object.provinceCode)
|
|
496
|
+
? globalThis.String(object.provinceCode)
|
|
497
|
+
: '',
|
|
498
|
+
};
|
|
499
|
+
},
|
|
500
|
+
toJSON(message) {
|
|
501
|
+
const obj = {};
|
|
502
|
+
if (message.provinceCode !== '') {
|
|
503
|
+
obj.provinceCode = message.provinceCode;
|
|
504
|
+
}
|
|
505
|
+
return obj;
|
|
506
|
+
},
|
|
507
|
+
create(base) {
|
|
508
|
+
return exports.GetDistrictsRequest.fromPartial(base ?? {});
|
|
509
|
+
},
|
|
510
|
+
fromPartial(object) {
|
|
511
|
+
const message = createBaseGetDistrictsRequest();
|
|
512
|
+
message.provinceCode = object.provinceCode ?? '';
|
|
513
|
+
return message;
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
function createBaseGetWardsRequest() {
|
|
517
|
+
return { provinceCode: '', districtCode: '' };
|
|
518
|
+
}
|
|
519
|
+
exports.GetWardsRequest = {
|
|
520
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
521
|
+
if (message.provinceCode !== '') {
|
|
522
|
+
writer.uint32(10).string(message.provinceCode);
|
|
523
|
+
}
|
|
524
|
+
if (message.districtCode !== '') {
|
|
525
|
+
writer.uint32(18).string(message.districtCode);
|
|
526
|
+
}
|
|
527
|
+
return writer;
|
|
528
|
+
},
|
|
529
|
+
decode(input, length) {
|
|
530
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
531
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
532
|
+
const message = createBaseGetWardsRequest();
|
|
533
|
+
while (reader.pos < end) {
|
|
534
|
+
const tag = reader.uint32();
|
|
535
|
+
switch (tag >>> 3) {
|
|
536
|
+
case 1: {
|
|
537
|
+
if (tag !== 10) {
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
message.provinceCode = reader.string();
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
case 2: {
|
|
544
|
+
if (tag !== 18) {
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
message.districtCode = reader.string();
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
reader.skip(tag & 7);
|
|
555
|
+
}
|
|
556
|
+
return message;
|
|
557
|
+
},
|
|
558
|
+
fromJSON(object) {
|
|
559
|
+
return {
|
|
560
|
+
provinceCode: isSet(object.provinceCode)
|
|
561
|
+
? globalThis.String(object.provinceCode)
|
|
562
|
+
: '',
|
|
563
|
+
districtCode: isSet(object.districtCode)
|
|
564
|
+
? globalThis.String(object.districtCode)
|
|
565
|
+
: '',
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
toJSON(message) {
|
|
569
|
+
const obj = {};
|
|
570
|
+
if (message.provinceCode !== '') {
|
|
571
|
+
obj.provinceCode = message.provinceCode;
|
|
572
|
+
}
|
|
573
|
+
if (message.districtCode !== '') {
|
|
574
|
+
obj.districtCode = message.districtCode;
|
|
575
|
+
}
|
|
576
|
+
return obj;
|
|
577
|
+
},
|
|
578
|
+
create(base) {
|
|
579
|
+
return exports.GetWardsRequest.fromPartial(base ?? {});
|
|
580
|
+
},
|
|
581
|
+
fromPartial(object) {
|
|
582
|
+
const message = createBaseGetWardsRequest();
|
|
583
|
+
message.provinceCode = object.provinceCode ?? '';
|
|
584
|
+
message.districtCode = object.districtCode ?? '';
|
|
585
|
+
return message;
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
function createBaseGetProvincesResponse() {
|
|
589
|
+
return { provinces: [] };
|
|
590
|
+
}
|
|
591
|
+
exports.GetProvincesResponse = {
|
|
592
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
593
|
+
for (const v of message.provinces) {
|
|
594
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
595
|
+
}
|
|
596
|
+
return writer;
|
|
597
|
+
},
|
|
598
|
+
decode(input, length) {
|
|
599
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
600
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
601
|
+
const message = createBaseGetProvincesResponse();
|
|
602
|
+
while (reader.pos < end) {
|
|
603
|
+
const tag = reader.uint32();
|
|
604
|
+
switch (tag >>> 3) {
|
|
605
|
+
case 1: {
|
|
606
|
+
if (tag !== 10) {
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
message.provinces.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
reader.skip(tag & 7);
|
|
617
|
+
}
|
|
618
|
+
return message;
|
|
619
|
+
},
|
|
620
|
+
fromJSON(object) {
|
|
621
|
+
return {
|
|
622
|
+
provinces: globalThis.Array.isArray(object?.provinces)
|
|
623
|
+
? object.provinces.map((e) => exports.AddressUnit.fromJSON(e))
|
|
624
|
+
: [],
|
|
625
|
+
};
|
|
626
|
+
},
|
|
627
|
+
toJSON(message) {
|
|
628
|
+
const obj = {};
|
|
629
|
+
if (message.provinces?.length) {
|
|
630
|
+
obj.provinces = message.provinces.map((e) => exports.AddressUnit.toJSON(e));
|
|
631
|
+
}
|
|
632
|
+
return obj;
|
|
633
|
+
},
|
|
634
|
+
create(base) {
|
|
635
|
+
return exports.GetProvincesResponse.fromPartial(base ?? {});
|
|
636
|
+
},
|
|
637
|
+
fromPartial(object) {
|
|
638
|
+
const message = createBaseGetProvincesResponse();
|
|
639
|
+
message.provinces =
|
|
640
|
+
object.provinces?.map((e) => exports.AddressUnit.fromPartial(e)) || [];
|
|
641
|
+
return message;
|
|
642
|
+
},
|
|
643
|
+
};
|
|
644
|
+
function createBaseGetDistrictsResponse() {
|
|
645
|
+
return { districts: [] };
|
|
646
|
+
}
|
|
647
|
+
exports.GetDistrictsResponse = {
|
|
648
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
649
|
+
for (const v of message.districts) {
|
|
650
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
651
|
+
}
|
|
652
|
+
return writer;
|
|
653
|
+
},
|
|
654
|
+
decode(input, length) {
|
|
655
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
656
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
657
|
+
const message = createBaseGetDistrictsResponse();
|
|
658
|
+
while (reader.pos < end) {
|
|
659
|
+
const tag = reader.uint32();
|
|
660
|
+
switch (tag >>> 3) {
|
|
661
|
+
case 1: {
|
|
662
|
+
if (tag !== 10) {
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
message.districts.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
reader.skip(tag & 7);
|
|
673
|
+
}
|
|
674
|
+
return message;
|
|
675
|
+
},
|
|
676
|
+
fromJSON(object) {
|
|
677
|
+
return {
|
|
678
|
+
districts: globalThis.Array.isArray(object?.districts)
|
|
679
|
+
? object.districts.map((e) => exports.AddressUnit.fromJSON(e))
|
|
680
|
+
: [],
|
|
681
|
+
};
|
|
682
|
+
},
|
|
683
|
+
toJSON(message) {
|
|
684
|
+
const obj = {};
|
|
685
|
+
if (message.districts?.length) {
|
|
686
|
+
obj.districts = message.districts.map((e) => exports.AddressUnit.toJSON(e));
|
|
687
|
+
}
|
|
688
|
+
return obj;
|
|
689
|
+
},
|
|
690
|
+
create(base) {
|
|
691
|
+
return exports.GetDistrictsResponse.fromPartial(base ?? {});
|
|
692
|
+
},
|
|
693
|
+
fromPartial(object) {
|
|
694
|
+
const message = createBaseGetDistrictsResponse();
|
|
695
|
+
message.districts =
|
|
696
|
+
object.districts?.map((e) => exports.AddressUnit.fromPartial(e)) || [];
|
|
697
|
+
return message;
|
|
698
|
+
},
|
|
699
|
+
};
|
|
700
|
+
function createBaseGetWardsResponse() {
|
|
701
|
+
return { wards: [] };
|
|
702
|
+
}
|
|
703
|
+
exports.GetWardsResponse = {
|
|
704
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
705
|
+
for (const v of message.wards) {
|
|
706
|
+
exports.AddressUnit.encode(v, writer.uint32(10).fork()).join();
|
|
707
|
+
}
|
|
708
|
+
return writer;
|
|
709
|
+
},
|
|
710
|
+
decode(input, length) {
|
|
711
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
712
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
713
|
+
const message = createBaseGetWardsResponse();
|
|
714
|
+
while (reader.pos < end) {
|
|
715
|
+
const tag = reader.uint32();
|
|
716
|
+
switch (tag >>> 3) {
|
|
717
|
+
case 1: {
|
|
718
|
+
if (tag !== 10) {
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
message.wards.push(exports.AddressUnit.decode(reader, reader.uint32()));
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
reader.skip(tag & 7);
|
|
729
|
+
}
|
|
730
|
+
return message;
|
|
731
|
+
},
|
|
732
|
+
fromJSON(object) {
|
|
733
|
+
return {
|
|
734
|
+
wards: globalThis.Array.isArray(object?.wards)
|
|
735
|
+
? object.wards.map((e) => exports.AddressUnit.fromJSON(e))
|
|
736
|
+
: [],
|
|
737
|
+
};
|
|
738
|
+
},
|
|
739
|
+
toJSON(message) {
|
|
740
|
+
const obj = {};
|
|
741
|
+
if (message.wards?.length) {
|
|
742
|
+
obj.wards = message.wards.map((e) => exports.AddressUnit.toJSON(e));
|
|
743
|
+
}
|
|
744
|
+
return obj;
|
|
745
|
+
},
|
|
746
|
+
create(base) {
|
|
747
|
+
return exports.GetWardsResponse.fromPartial(base ?? {});
|
|
748
|
+
},
|
|
749
|
+
fromPartial(object) {
|
|
750
|
+
const message = createBaseGetWardsResponse();
|
|
751
|
+
message.wards = object.wards?.map((e) => exports.AddressUnit.fromPartial(e)) || [];
|
|
752
|
+
return message;
|
|
753
|
+
},
|
|
754
|
+
};
|
|
424
755
|
function createBaseProduct() {
|
|
425
756
|
return {
|
|
426
757
|
id: '',
|
|
@@ -1022,9 +1353,77 @@ exports.AttributeValueInput = {
|
|
|
1022
1353
|
return message;
|
|
1023
1354
|
},
|
|
1024
1355
|
};
|
|
1356
|
+
function createBaseAddressUnit() {
|
|
1357
|
+
return { code: '', name: '' };
|
|
1358
|
+
}
|
|
1359
|
+
exports.AddressUnit = {
|
|
1360
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1361
|
+
if (message.code !== '') {
|
|
1362
|
+
writer.uint32(10).string(message.code);
|
|
1363
|
+
}
|
|
1364
|
+
if (message.name !== '') {
|
|
1365
|
+
writer.uint32(18).string(message.name);
|
|
1366
|
+
}
|
|
1367
|
+
return writer;
|
|
1368
|
+
},
|
|
1369
|
+
decode(input, length) {
|
|
1370
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1371
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1372
|
+
const message = createBaseAddressUnit();
|
|
1373
|
+
while (reader.pos < end) {
|
|
1374
|
+
const tag = reader.uint32();
|
|
1375
|
+
switch (tag >>> 3) {
|
|
1376
|
+
case 1: {
|
|
1377
|
+
if (tag !== 10) {
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
message.code = reader.string();
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
case 2: {
|
|
1384
|
+
if (tag !== 18) {
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
message.name = reader.string();
|
|
1388
|
+
continue;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1392
|
+
break;
|
|
1393
|
+
}
|
|
1394
|
+
reader.skip(tag & 7);
|
|
1395
|
+
}
|
|
1396
|
+
return message;
|
|
1397
|
+
},
|
|
1398
|
+
fromJSON(object) {
|
|
1399
|
+
return {
|
|
1400
|
+
code: isSet(object.code) ? globalThis.String(object.code) : '',
|
|
1401
|
+
name: isSet(object.name) ? globalThis.String(object.name) : '',
|
|
1402
|
+
};
|
|
1403
|
+
},
|
|
1404
|
+
toJSON(message) {
|
|
1405
|
+
const obj = {};
|
|
1406
|
+
if (message.code !== '') {
|
|
1407
|
+
obj.code = message.code;
|
|
1408
|
+
}
|
|
1409
|
+
if (message.name !== '') {
|
|
1410
|
+
obj.name = message.name;
|
|
1411
|
+
}
|
|
1412
|
+
return obj;
|
|
1413
|
+
},
|
|
1414
|
+
create(base) {
|
|
1415
|
+
return exports.AddressUnit.fromPartial(base ?? {});
|
|
1416
|
+
},
|
|
1417
|
+
fromPartial(object) {
|
|
1418
|
+
const message = createBaseAddressUnit();
|
|
1419
|
+
message.code = object.code ?? '';
|
|
1420
|
+
message.name = object.name ?? '';
|
|
1421
|
+
return message;
|
|
1422
|
+
},
|
|
1423
|
+
};
|
|
1025
1424
|
exports.ProductServiceService = {
|
|
1026
1425
|
getProductsByCategoryId: {
|
|
1027
|
-
path: '/
|
|
1426
|
+
path: '/sagebox.ProductService/GetProductsByCategoryId',
|
|
1028
1427
|
requestStream: false,
|
|
1029
1428
|
responseStream: false,
|
|
1030
1429
|
requestSerialize: (value) => Buffer.from(exports.GetProductsByCategoryIdRequest.encode(value).finish()),
|
|
@@ -1033,7 +1432,7 @@ exports.ProductServiceService = {
|
|
|
1033
1432
|
responseDeserialize: (value) => exports.GetProductsResponse.decode(value),
|
|
1034
1433
|
},
|
|
1035
1434
|
getProductById: {
|
|
1036
|
-
path: '/
|
|
1435
|
+
path: '/sagebox.ProductService/GetProductById',
|
|
1037
1436
|
requestStream: false,
|
|
1038
1437
|
responseStream: false,
|
|
1039
1438
|
requestSerialize: (value) => Buffer.from(exports.GetProductByIdRequest.encode(value).finish()),
|
|
@@ -1042,7 +1441,7 @@ exports.ProductServiceService = {
|
|
|
1042
1441
|
responseDeserialize: (value) => exports.ProductResponse.decode(value),
|
|
1043
1442
|
},
|
|
1044
1443
|
createProduct: {
|
|
1045
|
-
path: '/
|
|
1444
|
+
path: '/sagebox.ProductService/CreateProduct',
|
|
1046
1445
|
requestStream: false,
|
|
1047
1446
|
responseStream: false,
|
|
1048
1447
|
requestSerialize: (value) => Buffer.from(exports.CreateProductRequest.encode(value).finish()),
|
|
@@ -1051,7 +1450,37 @@ exports.ProductServiceService = {
|
|
|
1051
1450
|
responseDeserialize: (value) => exports.ProductResponse.decode(value),
|
|
1052
1451
|
},
|
|
1053
1452
|
};
|
|
1054
|
-
exports.ProductServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.ProductServiceService, '
|
|
1453
|
+
exports.ProductServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.ProductServiceService, 'sagebox.ProductService');
|
|
1454
|
+
exports.AddressServiceService = {
|
|
1455
|
+
getProvinces: {
|
|
1456
|
+
path: '/sagebox.AddressService/GetProvinces',
|
|
1457
|
+
requestStream: false,
|
|
1458
|
+
responseStream: false,
|
|
1459
|
+
requestSerialize: (value) => Buffer.from(exports.GetProvincesRequest.encode(value).finish()),
|
|
1460
|
+
requestDeserialize: (value) => exports.GetProvincesRequest.decode(value),
|
|
1461
|
+
responseSerialize: (value) => Buffer.from(exports.GetProvincesResponse.encode(value).finish()),
|
|
1462
|
+
responseDeserialize: (value) => exports.GetProvincesResponse.decode(value),
|
|
1463
|
+
},
|
|
1464
|
+
getDistricts: {
|
|
1465
|
+
path: '/sagebox.AddressService/GetDistricts',
|
|
1466
|
+
requestStream: false,
|
|
1467
|
+
responseStream: false,
|
|
1468
|
+
requestSerialize: (value) => Buffer.from(exports.GetDistrictsRequest.encode(value).finish()),
|
|
1469
|
+
requestDeserialize: (value) => exports.GetDistrictsRequest.decode(value),
|
|
1470
|
+
responseSerialize: (value) => Buffer.from(exports.GetDistrictsResponse.encode(value).finish()),
|
|
1471
|
+
responseDeserialize: (value) => exports.GetDistrictsResponse.decode(value),
|
|
1472
|
+
},
|
|
1473
|
+
getWards: {
|
|
1474
|
+
path: '/sagebox.AddressService/GetWards',
|
|
1475
|
+
requestStream: false,
|
|
1476
|
+
responseStream: false,
|
|
1477
|
+
requestSerialize: (value) => Buffer.from(exports.GetWardsRequest.encode(value).finish()),
|
|
1478
|
+
requestDeserialize: (value) => exports.GetWardsRequest.decode(value),
|
|
1479
|
+
responseSerialize: (value) => Buffer.from(exports.GetWardsResponse.encode(value).finish()),
|
|
1480
|
+
responseDeserialize: (value) => exports.GetWardsResponse.decode(value),
|
|
1481
|
+
},
|
|
1482
|
+
};
|
|
1483
|
+
exports.AddressServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.AddressServiceService, 'sagebox.AddressService');
|
|
1055
1484
|
function isSet(value) {
|
|
1056
1485
|
return value !== null && value !== undefined;
|
|
1057
1486
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,11 +3,4 @@
|
|
|
3
3
|
* @param protoFileName - The name of the proto file (e.g., 'product.proto')
|
|
4
4
|
* @returns The absolute path to the proto file
|
|
5
5
|
*/
|
|
6
|
-
export declare function getProtoPath(
|
|
7
|
-
/**
|
|
8
|
-
* Get all proto file paths
|
|
9
|
-
* @returns Object with proto file paths
|
|
10
|
-
*/
|
|
11
|
-
export declare function getAllProtosPaths(): {
|
|
12
|
-
product: string;
|
|
13
|
-
};
|
|
6
|
+
export declare function getProtoPath(): string;
|
package/dist/utils.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProtoPath = getProtoPath;
|
|
4
|
-
exports.getAllProtosPaths = getAllProtosPaths;
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
/**
|
|
7
6
|
* Get the absolute path to a proto file
|
|
8
7
|
* @param protoFileName - The name of the proto file (e.g., 'product.proto')
|
|
9
8
|
* @returns The absolute path to the proto file
|
|
10
9
|
*/
|
|
11
|
-
function getProtoPath(
|
|
10
|
+
function getProtoPath() {
|
|
12
11
|
// Use absolute path from workspace root to avoid dist folder issues
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get all proto file paths
|
|
18
|
-
* @returns Object with proto file paths
|
|
19
|
-
*/
|
|
20
|
-
function getAllProtosPaths() {
|
|
21
|
-
return {
|
|
22
|
-
product: getProtoPath('product.proto'),
|
|
23
|
-
};
|
|
12
|
+
const protoPath = 'node_modules/@sagebox-be/proto-contracts/proto/sagebox.proto';
|
|
13
|
+
// const protoPath = 'libs/proto-contracts/proto/sagebox.proto';
|
|
14
|
+
return (0, path_1.join)(process.cwd(), protoPath);
|
|
24
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sagebox-be/proto-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Sagebox gRPC Protocol Buffer contracts and TypeScript definitions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
14
|
-
"prepublishOnly": "npm run build"
|
|
15
|
-
"proto:copy": "cp -r ../common/src/grpc/proto ./proto",
|
|
16
|
-
"proto:generate": "../../bin/proto-generate.sh typescript"
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
17
15
|
},
|
|
18
16
|
"keywords": [
|
|
19
17
|
"grpc",
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sagebox;
|
|
4
|
+
|
|
5
|
+
// ============================================
|
|
6
|
+
// Product Service
|
|
7
|
+
// ============================================
|
|
8
|
+
service ProductService {
|
|
9
|
+
rpc GetProductsByCategoryId(GetProductsByCategoryIdRequest) returns (GetProductsResponse);
|
|
10
|
+
rpc GetProductById(GetProductByIdRequest) returns (ProductResponse);
|
|
11
|
+
rpc CreateProduct(CreateProductRequest) returns (ProductResponse);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ============================================
|
|
15
|
+
// Address Service
|
|
16
|
+
// ============================================
|
|
17
|
+
service AddressService {
|
|
18
|
+
rpc GetProvinces(GetProvincesRequest) returns (GetProvincesResponse);
|
|
19
|
+
rpc GetDistricts(GetDistrictsRequest) returns (GetDistrictsResponse);
|
|
20
|
+
rpc GetWards(GetWardsRequest) returns (GetWardsResponse);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ============================================
|
|
24
|
+
// Product Request Messages
|
|
25
|
+
// ============================================
|
|
26
|
+
message GetProductsByCategoryIdRequest {
|
|
27
|
+
string categoryId = 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message GetProductByIdRequest {
|
|
31
|
+
string id = 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message CreateProductRequest {
|
|
35
|
+
string name = 1;
|
|
36
|
+
string title = 2;
|
|
37
|
+
string description = 3;
|
|
38
|
+
string categoryId = 4;
|
|
39
|
+
string storeId = 5;
|
|
40
|
+
string status = 6;
|
|
41
|
+
repeated string mediaKeys = 7;
|
|
42
|
+
repeated ProductSkuInput skus = 8;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ============================================
|
|
46
|
+
// Product Response Messages
|
|
47
|
+
// ============================================
|
|
48
|
+
message GetProductsResponse {
|
|
49
|
+
repeated Product products = 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
message ProductResponse {
|
|
53
|
+
Product product = 1;
|
|
54
|
+
string error = 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ============================================
|
|
58
|
+
// Address Request Messages
|
|
59
|
+
// ============================================
|
|
60
|
+
message GetProvincesRequest {}
|
|
61
|
+
|
|
62
|
+
message GetDistrictsRequest {
|
|
63
|
+
string provinceCode = 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message GetWardsRequest {
|
|
67
|
+
string provinceCode = 1;
|
|
68
|
+
string districtCode = 2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================
|
|
72
|
+
// Address Response Messages
|
|
73
|
+
// ============================================
|
|
74
|
+
message GetProvincesResponse {
|
|
75
|
+
repeated AddressUnit provinces = 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message GetDistrictsResponse {
|
|
79
|
+
repeated AddressUnit districts = 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message GetWardsResponse {
|
|
83
|
+
repeated AddressUnit wards = 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ============================================
|
|
87
|
+
// Product Data Structures
|
|
88
|
+
// ============================================
|
|
89
|
+
message Product {
|
|
90
|
+
string id = 1;
|
|
91
|
+
string name = 2;
|
|
92
|
+
string title = 3;
|
|
93
|
+
string description = 4;
|
|
94
|
+
string keywords = 5;
|
|
95
|
+
string categoryId = 6;
|
|
96
|
+
string storeId = 7;
|
|
97
|
+
int32 viewedCount = 8;
|
|
98
|
+
string status = 9;
|
|
99
|
+
string url = 10;
|
|
100
|
+
repeated Media media = 11;
|
|
101
|
+
string createdAt = 12;
|
|
102
|
+
string updatedAt = 13;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
message Media {
|
|
106
|
+
string id = 1;
|
|
107
|
+
string key = 2;
|
|
108
|
+
string url = 3;
|
|
109
|
+
string type = 4;
|
|
110
|
+
string createdAt = 5;
|
|
111
|
+
string updatedAt = 6;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
message ProductSkuInput {
|
|
115
|
+
int32 price = 1;
|
|
116
|
+
int32 quantity = 2;
|
|
117
|
+
optional string brand = 3;
|
|
118
|
+
repeated string mediaKeys = 4;
|
|
119
|
+
repeated AttributeValueInput attributeValues = 5;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message AttributeValueInput {
|
|
123
|
+
string attrId = 1;
|
|
124
|
+
string value = 2;
|
|
125
|
+
string name = 3;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ============================================
|
|
129
|
+
// Address Data Structures
|
|
130
|
+
// ============================================
|
|
131
|
+
message AddressUnit {
|
|
132
|
+
string code = 1;
|
|
133
|
+
string name = 2;
|
|
134
|
+
}
|