@airticketss/contracts 1.1.7 → 1.2.0

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.
@@ -2,4 +2,6 @@ export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
4
  readonly USERS: string;
5
+ readonly FLIGHT: string;
6
+ readonly AIRLINE: string;
5
7
  };
@@ -6,4 +6,6 @@ exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, "../../proto/account.proto"),
8
8
  USERS: (0, path_1.join)(__dirname, "../../proto/users.proto"),
9
+ FLIGHT: (0, path_1.join)(__dirname, "../../proto/flight.proto"),
10
+ AIRLINE: (0, path_1.join)(__dirname, "../../proto/airline.proto"),
9
11
  };
@@ -0,0 +1,54 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.3
4
+ // protoc v3.21.12
5
+ // source: airline.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
11
+
12
+ export const protobufPackage = "airline.v1";
13
+
14
+ export interface GetAllAirlinesResponse {
15
+ airlines: Airline[];
16
+ }
17
+
18
+ export interface Airline {
19
+ id: string;
20
+ title: string;
21
+ slug: string;
22
+ logoUrl: string;
23
+ }
24
+
25
+ export const AIRLINE_V1_PACKAGE_NAME = "airline.v1";
26
+
27
+ export interface AirlineServiceClient {
28
+ getAllAirlines(request: Empty): Observable<GetAllAirlinesResponse>;
29
+ }
30
+
31
+ export interface AirlineServiceController {
32
+ getAllAirlines(
33
+ request: Empty,
34
+ ): Promise<GetAllAirlinesResponse> | Observable<GetAllAirlinesResponse> | GetAllAirlinesResponse;
35
+ }
36
+
37
+ export function AirlineServiceControllerMethods() {
38
+ return function (constructor: Function) {
39
+ const grpcMethods: string[] = ["getAllAirlines"];
40
+ for (const method of grpcMethods) {
41
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
42
+ GrpcMethod("AirlineService", method)(constructor.prototype[method], method, descriptor);
43
+ Object.defineProperty(constructor.prototype, method, descriptor);
44
+ }
45
+ const grpcStreamMethods: string[] = [];
46
+ for (const method of grpcStreamMethods) {
47
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
48
+ GrpcStreamMethod("AirlineService", method)(constructor.prototype[method], method, descriptor);
49
+ Object.defineProperty(constructor.prototype, method, descriptor);
50
+ }
51
+ };
52
+ }
53
+
54
+ export const AIRLINE_SERVICE_NAME = "AirlineService";
@@ -0,0 +1,96 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.3
4
+ // protoc v3.21.12
5
+ // source: flight.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Timestamp } from "./google/protobuf/timestamp";
11
+
12
+ export const protobufPackage = "flight.v1";
13
+
14
+ export interface ListFlightsRequest {
15
+ origin: string;
16
+ destination: string;
17
+ departureDate: Timestamp | undefined;
18
+ }
19
+
20
+ export interface ListFlightsResponse {
21
+ flights: Flight[];
22
+ }
23
+
24
+ export interface GetFlightRequest {
25
+ id?: string | undefined;
26
+ flightNumber?: string | undefined;
27
+ bookingRef?: string | undefined;
28
+ }
29
+
30
+ export interface GetFlightResponse {
31
+ flight: FlightDetails | undefined;
32
+ }
33
+
34
+ export interface Flight {
35
+ id: string;
36
+ airlineCode: string;
37
+ flightNumber: string;
38
+ origin: string;
39
+ destination: string;
40
+ departureTime: Timestamp | undefined;
41
+ price: number;
42
+ currency: string;
43
+ }
44
+
45
+ export interface FlightDetails {
46
+ id: string;
47
+ airlineCode: string;
48
+ flightNumber: string;
49
+ aircraftType: string;
50
+ origin: string;
51
+ destination: string;
52
+ departureTime: Timestamp | undefined;
53
+ arrivalTime: Timestamp | undefined;
54
+ durationMinutes: number;
55
+ price: number;
56
+ currency: string;
57
+ availableSeats: number;
58
+ terminal: string;
59
+ gate: string;
60
+ amenities: string[];
61
+ }
62
+
63
+ export const FLIGHT_V1_PACKAGE_NAME = "flight.v1";
64
+
65
+ export interface FlightServiceClient {
66
+ listFlights(request: ListFlightsRequest): Observable<ListFlightsResponse>;
67
+
68
+ getFlight(request: GetFlightRequest): Observable<GetFlightResponse>;
69
+ }
70
+
71
+ export interface FlightServiceController {
72
+ listFlights(
73
+ request: ListFlightsRequest,
74
+ ): Promise<ListFlightsResponse> | Observable<ListFlightsResponse> | ListFlightsResponse;
75
+
76
+ getFlight(request: GetFlightRequest): Promise<GetFlightResponse> | Observable<GetFlightResponse> | GetFlightResponse;
77
+ }
78
+
79
+ export function FlightServiceControllerMethods() {
80
+ return function (constructor: Function) {
81
+ const grpcMethods: string[] = ["listFlights", "getFlight"];
82
+ for (const method of grpcMethods) {
83
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
84
+ GrpcMethod("FlightService", method)(constructor.prototype[method], method, descriptor);
85
+ Object.defineProperty(constructor.prototype, method, descriptor);
86
+ }
87
+ const grpcStreamMethods: string[] = [];
88
+ for (const method of grpcStreamMethods) {
89
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
90
+ GrpcStreamMethod("FlightService", method)(constructor.prototype[method], method, descriptor);
91
+ Object.defineProperty(constructor.prototype, method, descriptor);
92
+ }
93
+ };
94
+ }
95
+
96
+ export const FLIGHT_SERVICE_NAME = "FlightService";
@@ -0,0 +1,118 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.3
4
+ // protoc v3.21.12
5
+ // source: google/protobuf/timestamp.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "google.protobuf";
10
+
11
+ /**
12
+ * A Timestamp represents a point in time independent of any time zone or local
13
+ * calendar, encoded as a count of seconds and fractions of seconds at
14
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
15
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
16
+ * Gregorian calendar backwards to year one.
17
+ *
18
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
19
+ * second table is needed for interpretation, using a [24-hour linear
20
+ * smear](https://developers.google.com/time/smear).
21
+ *
22
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
23
+ * restricting to that range, we ensure that we can convert to and from [RFC
24
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
25
+ *
26
+ * # Examples
27
+ *
28
+ * Example 1: Compute Timestamp from POSIX `time()`.
29
+ *
30
+ * Timestamp timestamp;
31
+ * timestamp.set_seconds(time(NULL));
32
+ * timestamp.set_nanos(0);
33
+ *
34
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
35
+ *
36
+ * struct timeval tv;
37
+ * gettimeofday(&tv, NULL);
38
+ *
39
+ * Timestamp timestamp;
40
+ * timestamp.set_seconds(tv.tv_sec);
41
+ * timestamp.set_nanos(tv.tv_usec * 1000);
42
+ *
43
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
44
+ *
45
+ * FILETIME ft;
46
+ * GetSystemTimeAsFileTime(&ft);
47
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
48
+ *
49
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
50
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
51
+ * Timestamp timestamp;
52
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
53
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
54
+ *
55
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
56
+ *
57
+ * long millis = System.currentTimeMillis();
58
+ *
59
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
60
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
61
+ *
62
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
63
+ *
64
+ * Instant now = Instant.now();
65
+ *
66
+ * Timestamp timestamp =
67
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
68
+ * .setNanos(now.getNano()).build();
69
+ *
70
+ * Example 6: Compute Timestamp from current time in Python.
71
+ *
72
+ * timestamp = Timestamp()
73
+ * timestamp.GetCurrentTime()
74
+ *
75
+ * # JSON Mapping
76
+ *
77
+ * In JSON format, the Timestamp type is encoded as a string in the
78
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
79
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
80
+ * where {year} is always expressed using four digits while {month}, {day},
81
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
82
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
83
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
84
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
85
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
86
+ * able to accept both UTC and other timezones (as indicated by an offset).
87
+ *
88
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
89
+ * 01:30 UTC on January 15, 2017.
90
+ *
91
+ * In JavaScript, one can convert a Date object to this format using the
92
+ * standard
93
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
94
+ * method. In Python, a standard `datetime.datetime` object can be converted
95
+ * to this format using
96
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
97
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
98
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
99
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
100
+ * ) to obtain a formatter capable of generating timestamps in this format.
101
+ */
102
+ export interface Timestamp {
103
+ /**
104
+ * Represents seconds of UTC time since Unix epoch
105
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
106
+ * 9999-12-31T23:59:59Z inclusive.
107
+ */
108
+ seconds: number;
109
+ /**
110
+ * Non-negative fractions of a second at nanosecond resolution. Negative
111
+ * second values with fractions must still have non-negative nanos values
112
+ * that count forward in time. Must be from 0 to 999,999,999
113
+ * inclusive.
114
+ */
115
+ nanos: number;
116
+ }
117
+
118
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airticketss/contracts",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "description": "Protobuf definitions and generate TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,20 @@
1
+ syntax = "proto3";
2
+
3
+ package airline.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service AirlineService {
8
+ rpc GetAllAirlines (google.protobuf.Empty) returns (GetAllAirlinesResponse);
9
+ }
10
+
11
+ message GetAllAirlinesResponse {
12
+ repeated Airline airlines = 1;
13
+ }
14
+
15
+ message Airline {
16
+ string id = 1;
17
+ string title = 2;
18
+ string slug = 3;
19
+ string logo_url = 4;
20
+ }
@@ -0,0 +1,61 @@
1
+ syntax = "proto3";
2
+
3
+ package flight.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ service FlightService {
8
+ rpc ListFlights (ListFlightsRequest) returns (ListFlightsResponse);
9
+ rpc GetFlight (GetFlightRequest) returns (GetFlightResponse);
10
+ }
11
+
12
+ message ListFlightsRequest {
13
+ string origin = 1;
14
+ string destination = 2;
15
+ google.protobuf.Timestamp departure_date = 3;
16
+ }
17
+
18
+ message ListFlightsResponse {
19
+ repeated Flight flights = 1;
20
+ }
21
+
22
+ message GetFlightRequest {
23
+ oneof key {
24
+ string id = 1;
25
+ string flight_number = 2;
26
+ string booking_ref = 3;
27
+ }
28
+ }
29
+
30
+ message GetFlightResponse {
31
+ FlightDetails flight = 1;
32
+ }
33
+
34
+ message Flight {
35
+ string id = 1;
36
+ string airline_code = 2;
37
+ string flight_number = 3;
38
+ string origin = 4;
39
+ string destination = 5;
40
+ google.protobuf.Timestamp departure_time = 6;
41
+ double price = 7;
42
+ string currency = 8;
43
+ }
44
+
45
+ message FlightDetails {
46
+ string id = 1;
47
+ string airline_code = 2;
48
+ string flight_number = 3;
49
+ string aircraft_type = 4;
50
+ string origin = 5;
51
+ string destination = 6;
52
+ google.protobuf.Timestamp departure_time = 7;
53
+ google.protobuf.Timestamp arrival_time = 8;
54
+ int32 duration_minutes = 9;
55
+ double price = 10;
56
+ string currency = 11;
57
+ int32 available_seats = 12;
58
+ string terminal = 13;
59
+ string gate = 14;
60
+ repeated string amenities = 15;
61
+ }
package/proto/media.proto CHANGED
@@ -2,7 +2,7 @@ syntax = "proto3";
2
2
 
3
3
  package media.v1;
4
4
 
5
- option go_package = "github.com/airticketss/contracts/media;media";
5
+ option go_package = "github.com/airticketss/contracts/gen/go/media;media";
6
6
  option java_multiple_files = true;
7
7
 
8
8
  service MediaService {