@quokkacinema/contracts 1.0.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.
- package/gen/auth.ts +47 -0
- package/gen/google/protobuf/duration.ts +89 -0
- package/gen/google/protobuf/empty.ts +23 -0
- package/gen/google/protobuf/struct.ts +197 -0
- package/gen/google/protobuf/timestamp.ts +118 -0
- package/package.json +23 -0
- package/proto/auth.proto +52 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth.v1";
|
|
12
|
+
|
|
13
|
+
export interface SendOtpRequest {
|
|
14
|
+
identifier: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SendOtpResponse {
|
|
19
|
+
ok: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
23
|
+
|
|
24
|
+
export interface AuthServiceClient {
|
|
25
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AuthServiceController {
|
|
29
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function AuthServiceControllerMethods() {
|
|
33
|
+
return function (constructor: Function) {
|
|
34
|
+
const grpcMethods: string[] = ["sendOtp"];
|
|
35
|
+
for (const method of grpcMethods) {
|
|
36
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
37
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
38
|
+
}
|
|
39
|
+
const grpcStreamMethods: string[] = [];
|
|
40
|
+
for (const method of grpcStreamMethods) {
|
|
41
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
42
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/duration.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Duration represents a signed, fixed-length span of time represented
|
|
13
|
+
* as a count of seconds and fractions of seconds at nanosecond
|
|
14
|
+
* resolution. It is independent of any calendar and concepts like "day"
|
|
15
|
+
* or "month". It is related to Timestamp in that the difference between
|
|
16
|
+
* two Timestamp values is a Duration and it can be added or subtracted
|
|
17
|
+
* from a Timestamp. Range is approximately +-10,000 years.
|
|
18
|
+
*
|
|
19
|
+
* # Examples
|
|
20
|
+
*
|
|
21
|
+
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
22
|
+
*
|
|
23
|
+
* Timestamp start = ...;
|
|
24
|
+
* Timestamp end = ...;
|
|
25
|
+
* Duration duration = ...;
|
|
26
|
+
*
|
|
27
|
+
* duration.seconds = end.seconds - start.seconds;
|
|
28
|
+
* duration.nanos = end.nanos - start.nanos;
|
|
29
|
+
*
|
|
30
|
+
* if (duration.seconds < 0 && duration.nanos > 0) {
|
|
31
|
+
* duration.seconds += 1;
|
|
32
|
+
* duration.nanos -= 1000000000;
|
|
33
|
+
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
34
|
+
* duration.seconds -= 1;
|
|
35
|
+
* duration.nanos += 1000000000;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
39
|
+
*
|
|
40
|
+
* Timestamp start = ...;
|
|
41
|
+
* Duration duration = ...;
|
|
42
|
+
* Timestamp end = ...;
|
|
43
|
+
*
|
|
44
|
+
* end.seconds = start.seconds + duration.seconds;
|
|
45
|
+
* end.nanos = start.nanos + duration.nanos;
|
|
46
|
+
*
|
|
47
|
+
* if (end.nanos < 0) {
|
|
48
|
+
* end.seconds -= 1;
|
|
49
|
+
* end.nanos += 1000000000;
|
|
50
|
+
* } else if (end.nanos >= 1000000000) {
|
|
51
|
+
* end.seconds += 1;
|
|
52
|
+
* end.nanos -= 1000000000;
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* Example 3: Compute Duration from datetime.timedelta in Python.
|
|
56
|
+
*
|
|
57
|
+
* td = datetime.timedelta(days=3, minutes=10)
|
|
58
|
+
* duration = Duration()
|
|
59
|
+
* duration.FromTimedelta(td)
|
|
60
|
+
*
|
|
61
|
+
* # JSON Mapping
|
|
62
|
+
*
|
|
63
|
+
* In JSON format, the Duration type is encoded as a string rather than an
|
|
64
|
+
* object, where the string ends in the suffix "s" (indicating seconds) and
|
|
65
|
+
* is preceded by the number of seconds, with nanoseconds expressed as
|
|
66
|
+
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
67
|
+
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
68
|
+
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
69
|
+
* microsecond should be expressed in JSON format as "3.000001s".
|
|
70
|
+
*/
|
|
71
|
+
export interface Duration {
|
|
72
|
+
/**
|
|
73
|
+
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
74
|
+
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
75
|
+
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
76
|
+
*/
|
|
77
|
+
seconds: number;
|
|
78
|
+
/**
|
|
79
|
+
* Signed fractions of a second at nanosecond resolution of the span
|
|
80
|
+
* of time. Durations less than one second are represented with a 0
|
|
81
|
+
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
82
|
+
* of one second or more, a non-zero value for the `nanos` field must be
|
|
83
|
+
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
84
|
+
* to +999,999,999 inclusive.
|
|
85
|
+
*/
|
|
86
|
+
nanos: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/empty.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A generic empty message that you can re-use to avoid defining duplicated
|
|
13
|
+
* empty messages in your APIs. A typical example is to use it as the request
|
|
14
|
+
* or the response type of an API method. For instance:
|
|
15
|
+
*
|
|
16
|
+
* service Foo {
|
|
17
|
+
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
export interface Empty {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/struct.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { wrappers } from "protobufjs";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "google.protobuf";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
14
|
+
* `Value` type union.
|
|
15
|
+
*
|
|
16
|
+
* The JSON representation for `NullValue` is JSON `null`.
|
|
17
|
+
*/
|
|
18
|
+
export enum NullValue {
|
|
19
|
+
/** NULL_VALUE - Null value. */
|
|
20
|
+
NULL_VALUE = 0,
|
|
21
|
+
UNRECOGNIZED = -1,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `Struct` represents a structured data value, consisting of fields
|
|
26
|
+
* which map to dynamically typed values. In some languages, `Struct`
|
|
27
|
+
* might be supported by a native representation. For example, in
|
|
28
|
+
* scripting languages like JS a struct is represented as an
|
|
29
|
+
* object. The details of that representation are described together
|
|
30
|
+
* with the proto support for the language.
|
|
31
|
+
*
|
|
32
|
+
* The JSON representation for `Struct` is JSON object.
|
|
33
|
+
*/
|
|
34
|
+
export interface Struct {
|
|
35
|
+
/** Unordered map of dynamically typed values. */
|
|
36
|
+
fields: { [key: string]: any | undefined };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Struct_FieldsEntry {
|
|
40
|
+
key: string;
|
|
41
|
+
value: any | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `Value` represents a dynamically typed value which can be either
|
|
46
|
+
* null, a number, a string, a boolean, a recursive struct value, or a
|
|
47
|
+
* list of values. A producer of value is expected to set one of these
|
|
48
|
+
* variants. Absence of any variant indicates an error.
|
|
49
|
+
*
|
|
50
|
+
* The JSON representation for `Value` is JSON value.
|
|
51
|
+
*/
|
|
52
|
+
export interface Value {
|
|
53
|
+
/** Represents a null value. */
|
|
54
|
+
nullValue?:
|
|
55
|
+
| NullValue
|
|
56
|
+
| undefined;
|
|
57
|
+
/** Represents a double value. */
|
|
58
|
+
numberValue?:
|
|
59
|
+
| number
|
|
60
|
+
| undefined;
|
|
61
|
+
/** Represents a string value. */
|
|
62
|
+
stringValue?:
|
|
63
|
+
| string
|
|
64
|
+
| undefined;
|
|
65
|
+
/** Represents a boolean value. */
|
|
66
|
+
boolValue?:
|
|
67
|
+
| boolean
|
|
68
|
+
| undefined;
|
|
69
|
+
/** Represents a structured value. */
|
|
70
|
+
structValue?:
|
|
71
|
+
| { [key: string]: any }
|
|
72
|
+
| undefined;
|
|
73
|
+
/** Represents a repeated `Value`. */
|
|
74
|
+
listValue?: Array<any> | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* `ListValue` is a wrapper around a repeated field of values.
|
|
79
|
+
*
|
|
80
|
+
* The JSON representation for `ListValue` is JSON array.
|
|
81
|
+
*/
|
|
82
|
+
export interface ListValue {
|
|
83
|
+
/** Repeated field of dynamically typed values. */
|
|
84
|
+
values: any[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
88
|
+
|
|
89
|
+
function createBaseStruct(): Struct {
|
|
90
|
+
return { fields: {} };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const Struct: MessageFns<Struct> & StructWrapperFns = {
|
|
94
|
+
wrap(object: { [key: string]: any } | undefined): Struct {
|
|
95
|
+
const struct = createBaseStruct();
|
|
96
|
+
|
|
97
|
+
if (object !== undefined) {
|
|
98
|
+
for (const key of globalThis.Object.keys(object)) {
|
|
99
|
+
struct.fields[key] = Value.wrap(object[key]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return struct;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
unwrap(message: Struct): { [key: string]: any } {
|
|
106
|
+
const object: { [key: string]: any } = {};
|
|
107
|
+
if (message.fields) {
|
|
108
|
+
for (const key of globalThis.Object.keys(message.fields)) {
|
|
109
|
+
object[key] = Value.unwrap(message.fields[key]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return object;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function createBaseValue(): Value {
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const Value: MessageFns<Value> & AnyValueWrapperFns = {
|
|
121
|
+
wrap(value: any): Value {
|
|
122
|
+
const result = {} as any;
|
|
123
|
+
if (value === null) {
|
|
124
|
+
result.nullValue = NullValue.NULL_VALUE;
|
|
125
|
+
} else if (typeof value === "boolean") {
|
|
126
|
+
result.boolValue = value;
|
|
127
|
+
} else if (typeof value === "number") {
|
|
128
|
+
result.numberValue = value;
|
|
129
|
+
} else if (typeof value === "string") {
|
|
130
|
+
result.stringValue = value;
|
|
131
|
+
} else if (globalThis.Array.isArray(value)) {
|
|
132
|
+
result.listValue = ListValue.wrap(value);
|
|
133
|
+
} else if (typeof value === "object") {
|
|
134
|
+
result.structValue = Struct.wrap(value);
|
|
135
|
+
} else if (typeof value !== "undefined") {
|
|
136
|
+
throw new globalThis.Error("Unsupported any value type: " + typeof value);
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined {
|
|
142
|
+
if (message?.hasOwnProperty("stringValue") && message.stringValue !== undefined) {
|
|
143
|
+
return message.stringValue;
|
|
144
|
+
} else if (message?.hasOwnProperty("numberValue") && message?.numberValue !== undefined) {
|
|
145
|
+
return message.numberValue;
|
|
146
|
+
} else if (message?.hasOwnProperty("boolValue") && message?.boolValue !== undefined) {
|
|
147
|
+
return message.boolValue;
|
|
148
|
+
} else if (message?.hasOwnProperty("structValue") && message?.structValue !== undefined) {
|
|
149
|
+
return Struct.unwrap(message.structValue as any);
|
|
150
|
+
} else if (message?.hasOwnProperty("listValue") && message?.listValue !== undefined) {
|
|
151
|
+
return ListValue.unwrap(message.listValue);
|
|
152
|
+
} else if (message?.hasOwnProperty("nullValue") && message?.nullValue !== undefined) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function createBaseListValue(): ListValue {
|
|
160
|
+
return { values: [] };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const ListValue: MessageFns<ListValue> & ListValueWrapperFns = {
|
|
164
|
+
wrap(array: Array<any> | undefined): ListValue {
|
|
165
|
+
const result = createBaseListValue();
|
|
166
|
+
result.values = (array ?? []).map(Value.wrap);
|
|
167
|
+
return result;
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
unwrap(message: ListValue): Array<any> {
|
|
171
|
+
if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) {
|
|
172
|
+
return message.values.map(Value.unwrap);
|
|
173
|
+
} else {
|
|
174
|
+
return message as any;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
180
|
+
|
|
181
|
+
export interface MessageFns<T> {
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface StructWrapperFns {
|
|
185
|
+
wrap(object: { [key: string]: any } | undefined): Struct;
|
|
186
|
+
unwrap(message: Struct): { [key: string]: any };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface AnyValueWrapperFns {
|
|
190
|
+
wrap(value: any): Value;
|
|
191
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface ListValueWrapperFns {
|
|
195
|
+
wrap(array: Array<any> | undefined): ListValue;
|
|
196
|
+
unwrap(message: ListValue): Array<any>;
|
|
197
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quokkacinema/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Protocol buffer contracts for Cinema microservices",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"generate": "PATH=\"./node_modules/.bin:$PATH\" protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"proto",
|
|
11
|
+
"gen"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"ts-proto": "^2.4.0"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@nestjs/microservices": "^11.1.11",
|
|
21
|
+
"rxjs": "^7.8.2"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/empty.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
import "google/protobuf/duration.proto";
|
|
8
|
+
import "google/protobuf/struct.proto";
|
|
9
|
+
|
|
10
|
+
service AuthService {
|
|
11
|
+
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
12
|
+
|
|
13
|
+
// rpc Ping(google.protobuf.Empty) returns (PingResponse);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message SendOtpRequest {
|
|
17
|
+
string identifier = 1;
|
|
18
|
+
string type = 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message SendOtpResponse {
|
|
22
|
+
string ok = 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// message UserSession {
|
|
26
|
+
// string id = 1;
|
|
27
|
+
// google.protobuf.Duration duration = 2;
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
// message UserMessage {
|
|
31
|
+
// string id = 1;
|
|
32
|
+
// google.protobuf.Timestamp created_at = 2;
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
// message UserProfile {
|
|
36
|
+
// string id = 1;
|
|
37
|
+
// int32 age = 2;
|
|
38
|
+
// double rating = 3;
|
|
39
|
+
// bool isActive = 4;
|
|
40
|
+
// repeated string roles = 5;
|
|
41
|
+
// map<string, string> metadata = 6;
|
|
42
|
+
// Status status = 7;
|
|
43
|
+
// oneof contact {
|
|
44
|
+
// string phone = 8;
|
|
45
|
+
// string email = 9;
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
// enum Status {
|
|
50
|
+
// UNKNOWN = 0;
|
|
51
|
+
// KNOWN = 1;
|
|
52
|
+
// }
|