saga-proto-contracts 1.0.2 → 1.0.3
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/gen/ts/inventory/v1/inventory.d.ts +41 -0
- package/dist/gen/ts/inventory/v1/inventory.js +26 -0
- package/dist/gen/ts/payment/v1/payment.d.ts +40 -0
- package/dist/gen/ts/payment/v1/payment.js +26 -0
- package/dist/paths/proto-paths.d.ts +2 -0
- package/dist/paths/proto-paths.js +2 -0
- package/package.json +1 -1
- package/proto/inventory/v1/inventory.proto +41 -0
- package/proto/payment/v1/payment.proto +41 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "inventory.v1";
|
|
3
|
+
export interface ReserveRequest {
|
|
4
|
+
items: ReserveItem[];
|
|
5
|
+
orderId: string;
|
|
6
|
+
idempotencyKey: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ReserveResponse {
|
|
9
|
+
paymentId: string;
|
|
10
|
+
status: string;
|
|
11
|
+
clientSecret: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CommitRequest {
|
|
14
|
+
reservationId: string;
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CommitResponse {
|
|
18
|
+
}
|
|
19
|
+
export interface ReleaseRequest {
|
|
20
|
+
reservationId: string;
|
|
21
|
+
idempotencyKey: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ReleaseResponse {
|
|
24
|
+
}
|
|
25
|
+
export interface ReserveItem {
|
|
26
|
+
productId: string;
|
|
27
|
+
quantity: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const INVENTORY_V1_PACKAGE_NAME = "inventory.v1";
|
|
30
|
+
export interface InventoryServiceClient {
|
|
31
|
+
reserve(request: ReserveRequest): Observable<ReserveResponse>;
|
|
32
|
+
commit(request: CommitRequest): Observable<CommitResponse>;
|
|
33
|
+
release(request: ReleaseRequest): Observable<ReleaseResponse>;
|
|
34
|
+
}
|
|
35
|
+
export interface InventoryServiceController {
|
|
36
|
+
reserve(request: ReserveRequest): Promise<ReserveResponse> | Observable<ReserveResponse> | ReserveResponse;
|
|
37
|
+
commit(request: CommitRequest): Promise<CommitResponse> | Observable<CommitResponse> | CommitResponse;
|
|
38
|
+
release(request: ReleaseRequest): Promise<ReleaseResponse> | Observable<ReleaseResponse> | ReleaseResponse;
|
|
39
|
+
}
|
|
40
|
+
export declare function InventoryServiceControllerMethods(): (constructor: Function) => void;
|
|
41
|
+
export declare const INVENTORY_SERVICE_NAME = "InventoryService";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.15.3
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: inventory/v1/inventory.proto
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
8
|
+
export const protobufPackage = "inventory.v1";
|
|
9
|
+
export const INVENTORY_V1_PACKAGE_NAME = "inventory.v1";
|
|
10
|
+
export function InventoryServiceControllerMethods() {
|
|
11
|
+
return function (constructor) {
|
|
12
|
+
const grpcMethods = ["reserve", "commit", "release"];
|
|
13
|
+
for (const method of grpcMethods) {
|
|
14
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
15
|
+
GrpcMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
|
|
16
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
17
|
+
}
|
|
18
|
+
const grpcStreamMethods = [];
|
|
19
|
+
for (const method of grpcStreamMethods) {
|
|
20
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
21
|
+
GrpcStreamMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
|
|
22
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const INVENTORY_SERVICE_NAME = "InventoryService";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "payment.v1";
|
|
3
|
+
export interface CreatePaymentRequest {
|
|
4
|
+
orderId: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
currency: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
idempotencyKey: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CreatePaymentResponse {
|
|
11
|
+
paymentId: string;
|
|
12
|
+
status: string;
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CancelPaymentRequest {
|
|
16
|
+
paymentId: string;
|
|
17
|
+
idempotencyKey: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CancelPaymentResponse {
|
|
20
|
+
}
|
|
21
|
+
export interface RefundPaymentRequest {
|
|
22
|
+
paymentId: string;
|
|
23
|
+
idempotencyKey: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CreatePaymeRefundPaymentResponse {
|
|
26
|
+
refundId: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
29
|
+
export interface PaymentServiceClient {
|
|
30
|
+
createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
31
|
+
cancelPayment(request: CancelPaymentRequest): Observable<CancelPaymentResponse>;
|
|
32
|
+
refundPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
33
|
+
}
|
|
34
|
+
export interface PaymentServiceController {
|
|
35
|
+
createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
36
|
+
cancelPayment(request: CancelPaymentRequest): Promise<CancelPaymentResponse> | Observable<CancelPaymentResponse> | CancelPaymentResponse;
|
|
37
|
+
refundPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
38
|
+
}
|
|
39
|
+
export declare function PaymentServiceControllerMethods(): (constructor: Function) => void;
|
|
40
|
+
export declare const PAYMENT_SERVICE_NAME = "PaymentService";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.15.3
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: payment/v1/payment.proto
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
8
|
+
export const protobufPackage = "payment.v1";
|
|
9
|
+
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
10
|
+
export function PaymentServiceControllerMethods() {
|
|
11
|
+
return function (constructor) {
|
|
12
|
+
const grpcMethods = ["createPayment", "cancelPayment", "refundPayment"];
|
|
13
|
+
for (const method of grpcMethods) {
|
|
14
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
15
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
16
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
17
|
+
}
|
|
18
|
+
const grpcStreamMethods = [];
|
|
19
|
+
for (const method of grpcStreamMethods) {
|
|
20
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
21
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
22
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
|
@@ -4,4 +4,6 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
4
4
|
const __dirname = dirname(__filename);
|
|
5
5
|
export const PROTO_PATHS = {
|
|
6
6
|
Order: join(__dirname, '../../proto/order/v1/order.proto'),
|
|
7
|
+
Payment: join(__dirname, '../../proto/payment/v1/payment.proto'),
|
|
8
|
+
Inventory: join(__dirname, '../../proto/inventory/v1/inventory.proto'),
|
|
7
9
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package inventory.v1;
|
|
4
|
+
|
|
5
|
+
service InventoryService {
|
|
6
|
+
rpc Reserve(ReserveRequest) returns (ReserveResponse);
|
|
7
|
+
rpc Commit(CommitRequest) returns (CommitResponse);
|
|
8
|
+
rpc Release(ReleaseRequest) returns (ReleaseResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message ReserveRequest {
|
|
12
|
+
repeated ReserveItem items = 1;
|
|
13
|
+
string order_id = 2;
|
|
14
|
+
string idempotency_key = 3;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message ReserveResponse {
|
|
18
|
+
string payment_id = 1;
|
|
19
|
+
string status = 2;
|
|
20
|
+
string client_secret = 3;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message CommitRequest {
|
|
24
|
+
string reservation_id = 1;
|
|
25
|
+
string idempotency_key = 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message CommitResponse {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message ReleaseRequest {
|
|
32
|
+
string reservation_id = 1;
|
|
33
|
+
string idempotency_key = 2;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message ReleaseResponse {}
|
|
37
|
+
|
|
38
|
+
message ReserveItem {
|
|
39
|
+
string product_id = 1;
|
|
40
|
+
int32 quantity = 2;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment.v1;
|
|
4
|
+
|
|
5
|
+
service PaymentService {
|
|
6
|
+
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
7
|
+
rpc CancelPayment(CancelPaymentRequest) returns (CancelPaymentResponse);
|
|
8
|
+
rpc RefundPayment(CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message CreatePaymentRequest {
|
|
12
|
+
string order_id = 1;
|
|
13
|
+
string user_id = 2;
|
|
14
|
+
string currency = 3;
|
|
15
|
+
int32 amount = 4;
|
|
16
|
+
string idempotency_key = 5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message CreatePaymentResponse {
|
|
20
|
+
string payment_id = 1;
|
|
21
|
+
string status = 2;
|
|
22
|
+
string client_secret = 3;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message CancelPaymentRequest {
|
|
26
|
+
string payment_id = 1;
|
|
27
|
+
string idempotency_key = 2;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message CancelPaymentResponse {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message RefundPaymentRequest {
|
|
35
|
+
string payment_id = 1;
|
|
36
|
+
string idempotency_key = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message CreatePaymeRefundPaymentResponse {
|
|
40
|
+
string refund_id = 1;
|
|
41
|
+
}
|