@platfformx/proto-contracts 1.6.0 → 1.6.1

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.
@@ -0,0 +1,80 @@
1
+ import { Observable } from "rxjs";
2
+ import { Timestamp } from "../google/protobuf/timestamp";
3
+ export declare const protobufPackage = "promo.v1";
4
+ export declare enum TargetType {
5
+ TARGET_TYPE_UNSPECIFIED = 0,
6
+ TARGET_TYPE_CATEGORY = 1,
7
+ TARGET_TYPE_SHIPPING = 2,
8
+ TARGET_TYPE_TOTAL_ORDER = 3,
9
+ TARGET_TYPE_PRODUCT = 4,
10
+ UNRECOGNIZED = -1
11
+ }
12
+ export declare enum DiscountType {
13
+ DISCOUNT_TYPE_UNSPECIFIED = 0,
14
+ DISCOUNT_TYPE_FIXED = 1,
15
+ DISCOUNT_TYPE_PERCENTAGE = 2,
16
+ UNRECOGNIZED = -1
17
+ }
18
+ export declare enum PromocodeType {
19
+ PROMOCODE_TYPE_UNSPECIFIED = 0,
20
+ PROMOCODE_TYPE_PERMANENT = 1,
21
+ PROMOCODE_TYPE_FLASH_SALE = 2,
22
+ PROMOCODE_TYPE_TEMPORARY = 3,
23
+ PROMOCODE_TYPE_ONE_TIME = 4,
24
+ UNRECOGNIZED = -1
25
+ }
26
+ export interface CreatePromocodeRequest {
27
+ code: string;
28
+ minOrderSum: string;
29
+ target: TargetType;
30
+ targetId?: string | undefined;
31
+ discountType: DiscountType;
32
+ discountValue: string;
33
+ promocodeType: PromocodeType;
34
+ maxUses: number;
35
+ startDate: Timestamp | undefined;
36
+ endDate: Timestamp | undefined;
37
+ }
38
+ export interface CreatePromocodeResponse {
39
+ promocodeId: string;
40
+ code: string;
41
+ }
42
+ export interface ApplyPromocodeRequest {
43
+ code: string;
44
+ }
45
+ export interface ApplyPromocodeResponse {
46
+ success: boolean;
47
+ }
48
+ export interface DeactivatePromocodeRequest {
49
+ promocodeId: string;
50
+ }
51
+ export interface DeactivatePromocodeResponse {
52
+ success: boolean;
53
+ }
54
+ export interface ValidatePromocodeRequest {
55
+ code: string;
56
+ totalOrderSum: string;
57
+ targetId?: string | undefined;
58
+ }
59
+ export interface ValidatePromocodeResponse {
60
+ isValid: boolean;
61
+ discountAmount: string;
62
+ errorMessage: string;
63
+ discountType: DiscountType;
64
+ discountValue: string;
65
+ }
66
+ export declare const PROMO_V1_PACKAGE_NAME = "promo.v1";
67
+ export interface PromoServiceClient {
68
+ createPromocode(request: CreatePromocodeRequest): Observable<CreatePromocodeResponse>;
69
+ applyPromocode(request: ApplyPromocodeRequest): Observable<ApplyPromocodeResponse>;
70
+ deactivatePromocode(request: DeactivatePromocodeRequest): Observable<DeactivatePromocodeResponse>;
71
+ validatePromocode(request: ValidatePromocodeRequest): Observable<ValidatePromocodeResponse>;
72
+ }
73
+ export interface PromoServiceController {
74
+ createPromocode(request: CreatePromocodeRequest): Promise<CreatePromocodeResponse> | Observable<CreatePromocodeResponse> | CreatePromocodeResponse;
75
+ applyPromocode(request: ApplyPromocodeRequest): Promise<ApplyPromocodeResponse> | Observable<ApplyPromocodeResponse> | ApplyPromocodeResponse;
76
+ deactivatePromocode(request: DeactivatePromocodeRequest): Promise<DeactivatePromocodeResponse> | Observable<DeactivatePromocodeResponse> | DeactivatePromocodeResponse;
77
+ validatePromocode(request: ValidatePromocodeRequest): Promise<ValidatePromocodeResponse> | Observable<ValidatePromocodeResponse> | ValidatePromocodeResponse;
78
+ }
79
+ export declare function PromoServiceControllerMethods(): (constructor: Function) => void;
80
+ export declare const PROMO_SERVICE_NAME = "PromoService";
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.8
5
+ // protoc v7.34.0
6
+ // source: promo-service/promo.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PROMO_SERVICE_NAME = exports.PROMO_V1_PACKAGE_NAME = exports.PromocodeType = exports.DiscountType = exports.TargetType = exports.protobufPackage = void 0;
9
+ exports.PromoServiceControllerMethods = PromoServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "promo.v1";
13
+ var TargetType;
14
+ (function (TargetType) {
15
+ TargetType[TargetType["TARGET_TYPE_UNSPECIFIED"] = 0] = "TARGET_TYPE_UNSPECIFIED";
16
+ TargetType[TargetType["TARGET_TYPE_CATEGORY"] = 1] = "TARGET_TYPE_CATEGORY";
17
+ TargetType[TargetType["TARGET_TYPE_SHIPPING"] = 2] = "TARGET_TYPE_SHIPPING";
18
+ TargetType[TargetType["TARGET_TYPE_TOTAL_ORDER"] = 3] = "TARGET_TYPE_TOTAL_ORDER";
19
+ TargetType[TargetType["TARGET_TYPE_PRODUCT"] = 4] = "TARGET_TYPE_PRODUCT";
20
+ TargetType[TargetType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
+ })(TargetType || (exports.TargetType = TargetType = {}));
22
+ var DiscountType;
23
+ (function (DiscountType) {
24
+ DiscountType[DiscountType["DISCOUNT_TYPE_UNSPECIFIED"] = 0] = "DISCOUNT_TYPE_UNSPECIFIED";
25
+ DiscountType[DiscountType["DISCOUNT_TYPE_FIXED"] = 1] = "DISCOUNT_TYPE_FIXED";
26
+ DiscountType[DiscountType["DISCOUNT_TYPE_PERCENTAGE"] = 2] = "DISCOUNT_TYPE_PERCENTAGE";
27
+ DiscountType[DiscountType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
28
+ })(DiscountType || (exports.DiscountType = DiscountType = {}));
29
+ var PromocodeType;
30
+ (function (PromocodeType) {
31
+ PromocodeType[PromocodeType["PROMOCODE_TYPE_UNSPECIFIED"] = 0] = "PROMOCODE_TYPE_UNSPECIFIED";
32
+ PromocodeType[PromocodeType["PROMOCODE_TYPE_PERMANENT"] = 1] = "PROMOCODE_TYPE_PERMANENT";
33
+ PromocodeType[PromocodeType["PROMOCODE_TYPE_FLASH_SALE"] = 2] = "PROMOCODE_TYPE_FLASH_SALE";
34
+ PromocodeType[PromocodeType["PROMOCODE_TYPE_TEMPORARY"] = 3] = "PROMOCODE_TYPE_TEMPORARY";
35
+ PromocodeType[PromocodeType["PROMOCODE_TYPE_ONE_TIME"] = 4] = "PROMOCODE_TYPE_ONE_TIME";
36
+ PromocodeType[PromocodeType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
37
+ })(PromocodeType || (exports.PromocodeType = PromocodeType = {}));
38
+ exports.PROMO_V1_PACKAGE_NAME = "promo.v1";
39
+ function PromoServiceControllerMethods() {
40
+ return function (constructor) {
41
+ const grpcMethods = ["createPromocode", "applyPromocode", "deactivatePromocode", "validatePromocode"];
42
+ for (const method of grpcMethods) {
43
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
44
+ (0, microservices_1.GrpcMethod)("PromoService", method)(constructor.prototype[method], method, descriptor);
45
+ }
46
+ const grpcStreamMethods = [];
47
+ for (const method of grpcStreamMethods) {
48
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
49
+ (0, microservices_1.GrpcStreamMethod)("PromoService", method)(constructor.prototype[method], method, descriptor);
50
+ }
51
+ };
52
+ }
53
+ exports.PROMO_SERVICE_NAME = "PromoService";
package/dist/index.d.ts CHANGED
@@ -15,4 +15,8 @@ export * as AI from './gen/ts/ai-service/ai';
15
15
  export * as Review from './gen/ts/review-service/review';
16
16
  export * as Inventory from './gen/ts/inventory-service/inventory';
17
17
  export * as Shipping from './gen/ts/shipping-service/shipping';
18
+ export * as Promo from './gen/ts/promo-service/promo';
19
+ export { TargetType } from './gen//ts/promo-service/promo';
20
+ export { DiscountType } from './gen//ts/promo-service/promo';
21
+ export { PromocodeType } from './gen//ts/promo-service/promo';
18
22
  export { BulkStatus } from './gen/ts/products-service/bulk';
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.BulkStatus = exports.Shipping = exports.Inventory = exports.Review = exports.AI = exports.Order = exports.Refund = exports.Payment = exports.Search = exports.Category = exports.Bulk = exports.Product = exports.Account = exports.S3 = exports.Auth = exports.OAuthProvider = void 0;
39
+ exports.BulkStatus = exports.PromocodeType = exports.DiscountType = exports.TargetType = exports.Promo = exports.Shipping = exports.Inventory = exports.Review = exports.AI = exports.Order = exports.Refund = exports.Payment = exports.Search = exports.Category = exports.Bulk = exports.Product = exports.Account = exports.S3 = exports.Auth = exports.OAuthProvider = void 0;
40
40
  __exportStar(require("./paths/index"), exports);
41
41
  __exportStar(require("./paths/proto-paths"), exports);
42
42
  var auth_1 = require("./gen/ts/auth-service/auth");
@@ -55,5 +55,12 @@ exports.AI = __importStar(require("./gen/ts/ai-service/ai"));
55
55
  exports.Review = __importStar(require("./gen/ts/review-service/review"));
56
56
  exports.Inventory = __importStar(require("./gen/ts/inventory-service/inventory"));
57
57
  exports.Shipping = __importStar(require("./gen/ts/shipping-service/shipping"));
58
+ exports.Promo = __importStar(require("./gen/ts/promo-service/promo"));
59
+ var promo_1 = require("./gen//ts/promo-service/promo");
60
+ Object.defineProperty(exports, "TargetType", { enumerable: true, get: function () { return promo_1.TargetType; } });
61
+ var promo_2 = require("./gen//ts/promo-service/promo");
62
+ Object.defineProperty(exports, "DiscountType", { enumerable: true, get: function () { return promo_2.DiscountType; } });
63
+ var promo_3 = require("./gen//ts/promo-service/promo");
64
+ Object.defineProperty(exports, "PromocodeType", { enumerable: true, get: function () { return promo_3.PromocodeType; } });
58
65
  var bulk_1 = require("./gen/ts/products-service/bulk");
59
66
  Object.defineProperty(exports, "BulkStatus", { enumerable: true, get: function () { return bulk_1.BulkStatus; } });
@@ -13,4 +13,5 @@ export declare const PROTO_PATHS: {
13
13
  readonly REVIEW: string;
14
14
  readonly STOCK: string;
15
15
  readonly SHIPPING: string;
16
+ readonly PROMO: string;
16
17
  };
@@ -17,4 +17,5 @@ exports.PROTO_PATHS = {
17
17
  REVIEW: (0, path_1.join)(__dirname, '../../proto/review-service/review.proto'),
18
18
  STOCK: (0, path_1.join)(__dirname, '../../proto/inventory-service/inventory.proto'),
19
19
  SHIPPING: (0, path_1.join)(__dirname, '../../proto/shipping-service/shipping.proto'),
20
+ PROMO: (0, path_1.join)(__dirname, '../../proto/promo-service/promo.proto'),
20
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platfformx/proto-contracts",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,81 @@
1
+ syntax = "proto3";
2
+
3
+ package promo.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ service PromoService {
8
+ rpc CreatePromocode (CreatePromocodeRequest) returns (CreatePromocodeResponse);
9
+ rpc ApplyPromocode (ApplyPromocodeRequest) returns (ApplyPromocodeResponse);
10
+ rpc DeactivatePromocode (DeactivatePromocodeRequest) returns (DeactivatePromocodeResponse);
11
+ rpc ValidatePromocode (ValidatePromocodeRequest) returns (ValidatePromocodeResponse);
12
+ }
13
+
14
+ message CreatePromocodeRequest {
15
+ string code = 1;
16
+ string min_order_sum = 2;
17
+ TargetType target = 3;
18
+ optional string target_id = 4;
19
+ DiscountType discount_type = 5;
20
+ string discount_value = 6;
21
+ PromocodeType promocode_type = 7;
22
+ int32 max_uses = 8;
23
+ google.protobuf.Timestamp start_date = 9;
24
+ google.protobuf.Timestamp end_date = 10;
25
+ }
26
+
27
+
28
+ message CreatePromocodeResponse {
29
+ string promocode_id = 1;
30
+ string code = 2;
31
+ }
32
+ message ApplyPromocodeRequest {
33
+ string code = 1;
34
+
35
+ }
36
+ message ApplyPromocodeResponse {
37
+ bool success = 1;
38
+
39
+ }
40
+
41
+ message DeactivatePromocodeRequest {
42
+ string promocode_id = 1;
43
+ }
44
+ message DeactivatePromocodeResponse {
45
+ bool success = 1;
46
+ }
47
+
48
+ message ValidatePromocodeRequest {
49
+ string code = 1;
50
+ string total_order_sum = 2;
51
+ optional string target_id = 3;
52
+ }
53
+ message ValidatePromocodeResponse {
54
+ bool is_valid = 1;
55
+ string discount_amount = 2;
56
+ string error_message = 3;
57
+ DiscountType discount_type = 4;
58
+ string discount_value = 5;
59
+ }
60
+
61
+ enum TargetType {
62
+ TARGET_TYPE_UNSPECIFIED = 0;
63
+ TARGET_TYPE_CATEGORY = 1;
64
+ TARGET_TYPE_SHIPPING = 2;
65
+ TARGET_TYPE_TOTAL_ORDER = 3;
66
+ TARGET_TYPE_PRODUCT = 4;
67
+ }
68
+
69
+ enum DiscountType {
70
+ DISCOUNT_TYPE_UNSPECIFIED = 0;
71
+ DISCOUNT_TYPE_FIXED = 1;
72
+ DISCOUNT_TYPE_PERCENTAGE = 2;
73
+ }
74
+
75
+ enum PromocodeType {
76
+ PROMOCODE_TYPE_UNSPECIFIED = 0;
77
+ PROMOCODE_TYPE_PERMANENT = 1;
78
+ PROMOCODE_TYPE_FLASH_SALE = 2;
79
+ PROMOCODE_TYPE_TEMPORARY = 3;
80
+ PROMOCODE_TYPE_ONE_TIME = 4;
81
+ }