@barupost/contracts 0.0.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.
Files changed (56) hide show
  1. package/dist/events/account/email-changed.interface.d.ts +4 -0
  2. package/dist/events/account/email-changed.interface.js +2 -0
  3. package/dist/events/account/index.d.ts +2 -0
  4. package/dist/events/account/index.js +18 -0
  5. package/dist/events/account/phone-changed.interface.d.ts +4 -0
  6. package/dist/events/account/phone-changed.interface.js +2 -0
  7. package/dist/events/auth/index.d.ts +1 -0
  8. package/dist/events/auth/index.js +17 -0
  9. package/dist/events/auth/otp-requested.interface.d.ts +5 -0
  10. package/dist/events/auth/otp-requested.interface.js +2 -0
  11. package/dist/events/index.d.ts +2 -0
  12. package/dist/events/index.js +18 -0
  13. package/dist/generated/account.d.ts +70 -0
  14. package/dist/generated/account.js +45 -0
  15. package/dist/generated/auth.d.ts +83 -0
  16. package/dist/generated/auth.js +34 -0
  17. package/dist/generated/google/protobuf/empty.d.ts +13 -0
  18. package/dist/generated/google/protobuf/empty.js +11 -0
  19. package/dist/generated/google/protobuf/timestamp.d.ts +109 -0
  20. package/dist/generated/google/protobuf/timestamp.js +11 -0
  21. package/dist/generated/index.d.ts +6 -0
  22. package/dist/generated/index.js +22 -0
  23. package/dist/generated/media.d.ts +124 -0
  24. package/dist/generated/media.js +35 -0
  25. package/dist/generated/posts.d.ts +259 -0
  26. package/dist/generated/posts.js +57 -0
  27. package/dist/generated/session.d.ts +56 -0
  28. package/dist/generated/session.js +32 -0
  29. package/dist/generated/users.d.ts +87 -0
  30. package/dist/generated/users.js +40 -0
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.js +19 -0
  33. package/dist/proto/index.d.ts +1 -0
  34. package/dist/proto/index.js +17 -0
  35. package/dist/proto/paths.d.ts +8 -0
  36. package/dist/proto/paths.js +12 -0
  37. package/gen/go/.gitkeep +0 -0
  38. package/gen/go/media/media.pb.go +1545 -0
  39. package/gen/go/media/media_grpc.pb.go +342 -0
  40. package/gen/ts/.gitkeep +0 -0
  41. package/gen/ts/account.ts +133 -0
  42. package/gen/ts/auth.ts +135 -0
  43. package/gen/ts/google/protobuf/empty.ts +23 -0
  44. package/gen/ts/google/protobuf/struct.ts +197 -0
  45. package/gen/ts/google/protobuf/timestamp.ts +119 -0
  46. package/gen/ts/media.ts +205 -0
  47. package/gen/ts/posts.ts +417 -0
  48. package/gen/ts/session.ts +110 -0
  49. package/gen/ts/users.ts +140 -0
  50. package/package.json +28 -0
  51. package/proto/account.proto +75 -0
  52. package/proto/auth.proto +91 -0
  53. package/proto/media.proto +120 -0
  54. package/proto/posts.proto +270 -0
  55. package/proto/session.proto +61 -0
  56. package/proto/users.proto +105 -0
@@ -0,0 +1,197 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.0
4
+ // protoc v6.33.2
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,119 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.2
4
+ // protoc v6.33.2
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://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
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 1970-01-01T00:00:00Z. Must
105
+ * be between -315576000000 and 315576000000 inclusive (which corresponds to
106
+ * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
107
+ */
108
+ seconds: number;
109
+ /**
110
+ * Non-negative fractions of a second at nanosecond resolution. This field is
111
+ * the nanosecond portion of the duration, not an alternative to seconds.
112
+ * Negative second values with fractions must still have non-negative nanos
113
+ * values that count forward in time. Must be between 0 and 999,999,999
114
+ * inclusive.
115
+ */
116
+ nanos: number;
117
+ }
118
+
119
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,205 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.2
4
+ // protoc v6.33.2
5
+ // source: media.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "media.v1";
12
+
13
+ export interface UploadRequest {
14
+ fileName: string;
15
+ folder: string;
16
+ contentType: string;
17
+ data: Uint8Array;
18
+ resizeWidth?: number | undefined;
19
+ resizeHeight?: number | undefined;
20
+ watermark?: boolean | undefined;
21
+ }
22
+
23
+ export interface UploadResponse {
24
+ key: string;
25
+ }
26
+
27
+ export interface GetRequest {
28
+ key: string;
29
+ }
30
+
31
+ export interface GetResponse {
32
+ data: Uint8Array;
33
+ contentType: string;
34
+ }
35
+
36
+ export interface DeleteRequest {
37
+ key: string;
38
+ }
39
+
40
+ export interface DeleteResponse {
41
+ ok: boolean;
42
+ }
43
+
44
+ /** === Presigned Urls === */
45
+ export interface GetPresignedUrlsRequest {
46
+ files: FileUploadInfo[];
47
+ }
48
+
49
+ export interface FileUploadInfo {
50
+ fileName: string;
51
+ folder: string;
52
+ contentType: string;
53
+ /** Размер файла в байтах */
54
+ size: number;
55
+ }
56
+
57
+ export interface GetPresignedUrlsResponse {
58
+ urls: PresignedUrlInfo[];
59
+ }
60
+
61
+ export interface PresignedUrlInfo {
62
+ /** Идентификатор файла (file0, file1, ...) */
63
+ field: string;
64
+ /** Presigned Url для загрузки */
65
+ url: string;
66
+ /** HTTP метод (PUT) */
67
+ method: string;
68
+ /** Максимальный размер в байтах */
69
+ sizeLimit: number;
70
+ /** Content-Type для загрузки */
71
+ contentType: string;
72
+ }
73
+
74
+ /** === Multipart Upload === */
75
+ export interface CreateMultipartUploadRequest {
76
+ fileName: string;
77
+ folder: string;
78
+ contentType: string;
79
+ }
80
+
81
+ export interface CreateMultipartUploadResponse {
82
+ uploadId: string;
83
+ /** S3 key для файла */
84
+ key: string;
85
+ }
86
+
87
+ export interface GetPresignedPartUrlsRequest {
88
+ uploadId: string;
89
+ key: string;
90
+ /** Количество частей */
91
+ partCount: number;
92
+ contentType: string;
93
+ }
94
+
95
+ export interface GetPresignedPartUrlsResponse {
96
+ parts: PresignedPartUrl[];
97
+ }
98
+
99
+ export interface PresignedPartUrl {
100
+ /** Номер части (начинается с 1) */
101
+ partNumber: number;
102
+ /** Presigned Url для загрузки части */
103
+ url: string;
104
+ /** HTTP метод (PUT) */
105
+ method: string;
106
+ }
107
+
108
+ export interface CompleteMultipartUploadRequest {
109
+ uploadId: string;
110
+ key: string;
111
+ /** Список загруженных частей с ETag */
112
+ parts: CompletedPart[];
113
+ }
114
+
115
+ export interface CompletedPart {
116
+ partNumber: number;
117
+ /** ETag полученный после загрузки части */
118
+ etag: string;
119
+ }
120
+
121
+ export interface CompleteMultipartUploadResponse {
122
+ ok: boolean;
123
+ /** Финальный S3 key */
124
+ key: string;
125
+ /** Публичный Url файла */
126
+ url: string;
127
+ }
128
+
129
+ export const MEDIA_V1_PACKAGE_NAME = "media.v1";
130
+
131
+ export interface MediaServiceClient {
132
+ /** Существующие методы */
133
+
134
+ upload(request: UploadRequest): Observable<UploadResponse>;
135
+
136
+ get(request: GetRequest): Observable<GetResponse>;
137
+
138
+ delete(request: DeleteRequest): Observable<DeleteResponse>;
139
+
140
+ /** Новые методы для presigned Urls */
141
+
142
+ getPresignedUrls(request: GetPresignedUrlsRequest): Observable<GetPresignedUrlsResponse>;
143
+
144
+ createMultipartUpload(request: CreateMultipartUploadRequest): Observable<CreateMultipartUploadResponse>;
145
+
146
+ getPresignedPartUrls(request: GetPresignedPartUrlsRequest): Observable<GetPresignedPartUrlsResponse>;
147
+
148
+ completeMultipartUpload(request: CompleteMultipartUploadRequest): Observable<CompleteMultipartUploadResponse>;
149
+ }
150
+
151
+ export interface MediaServiceController {
152
+ /** Существующие методы */
153
+
154
+ upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
155
+
156
+ get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
157
+
158
+ delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
159
+
160
+ /** Новые методы для presigned Urls */
161
+
162
+ getPresignedUrls(
163
+ request: GetPresignedUrlsRequest,
164
+ ): Promise<GetPresignedUrlsResponse> | Observable<GetPresignedUrlsResponse> | GetPresignedUrlsResponse;
165
+
166
+ createMultipartUpload(
167
+ request: CreateMultipartUploadRequest,
168
+ ): Promise<CreateMultipartUploadResponse> | Observable<CreateMultipartUploadResponse> | CreateMultipartUploadResponse;
169
+
170
+ getPresignedPartUrls(
171
+ request: GetPresignedPartUrlsRequest,
172
+ ): Promise<GetPresignedPartUrlsResponse> | Observable<GetPresignedPartUrlsResponse> | GetPresignedPartUrlsResponse;
173
+
174
+ completeMultipartUpload(
175
+ request: CompleteMultipartUploadRequest,
176
+ ):
177
+ | Promise<CompleteMultipartUploadResponse>
178
+ | Observable<CompleteMultipartUploadResponse>
179
+ | CompleteMultipartUploadResponse;
180
+ }
181
+
182
+ export function MediaServiceControllerMethods() {
183
+ return function (constructor: Function) {
184
+ const grpcMethods: string[] = [
185
+ "upload",
186
+ "get",
187
+ "delete",
188
+ "getPresignedUrls",
189
+ "createMultipartUpload",
190
+ "getPresignedPartUrls",
191
+ "completeMultipartUpload",
192
+ ];
193
+ for (const method of grpcMethods) {
194
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
195
+ GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
196
+ }
197
+ const grpcStreamMethods: string[] = [];
198
+ for (const method of grpcStreamMethods) {
199
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
200
+ GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
201
+ }
202
+ };
203
+ }
204
+
205
+ export const MEDIA_SERVICE_NAME = "MediaService";