@barumetric/contracts 1.3.25 → 1.3.27
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/events/images/process-images.interface.d.ts +1 -2
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +1 -0
- package/gen/ts/google/protobuf/struct.ts +197 -0
- package/gen/ts/google/protobuf/wrappers.ts +101 -0
- package/gen/ts/listings.ts +28 -1
- package/package.json +1 -1
- package/proto/listings.proto +29 -9
package/dist/events/index.d.ts
CHANGED
package/dist/events/index.js
CHANGED
|
@@ -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 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,101 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/wrappers.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper message for `double`.
|
|
13
|
+
*
|
|
14
|
+
* The JSON representation for `DoubleValue` is JSON number.
|
|
15
|
+
*/
|
|
16
|
+
export interface DoubleValue {
|
|
17
|
+
/** The double value. */
|
|
18
|
+
value: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Wrapper message for `float`.
|
|
23
|
+
*
|
|
24
|
+
* The JSON representation for `FloatValue` is JSON number.
|
|
25
|
+
*/
|
|
26
|
+
export interface FloatValue {
|
|
27
|
+
/** The float value. */
|
|
28
|
+
value: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Wrapper message for `int64`.
|
|
33
|
+
*
|
|
34
|
+
* The JSON representation for `Int64Value` is JSON string.
|
|
35
|
+
*/
|
|
36
|
+
export interface Int64Value {
|
|
37
|
+
/** The int64 value. */
|
|
38
|
+
value: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Wrapper message for `uint64`.
|
|
43
|
+
*
|
|
44
|
+
* The JSON representation for `UInt64Value` is JSON string.
|
|
45
|
+
*/
|
|
46
|
+
export interface UInt64Value {
|
|
47
|
+
/** The uint64 value. */
|
|
48
|
+
value: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Wrapper message for `int32`.
|
|
53
|
+
*
|
|
54
|
+
* The JSON representation for `Int32Value` is JSON number.
|
|
55
|
+
*/
|
|
56
|
+
export interface Int32Value {
|
|
57
|
+
/** The int32 value. */
|
|
58
|
+
value: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Wrapper message for `uint32`.
|
|
63
|
+
*
|
|
64
|
+
* The JSON representation for `UInt32Value` is JSON number.
|
|
65
|
+
*/
|
|
66
|
+
export interface UInt32Value {
|
|
67
|
+
/** The uint32 value. */
|
|
68
|
+
value: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Wrapper message for `bool`.
|
|
73
|
+
*
|
|
74
|
+
* The JSON representation for `BoolValue` is JSON `true` and `false`.
|
|
75
|
+
*/
|
|
76
|
+
export interface BoolValue {
|
|
77
|
+
/** The bool value. */
|
|
78
|
+
value: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Wrapper message for `string`.
|
|
83
|
+
*
|
|
84
|
+
* The JSON representation for `StringValue` is JSON string.
|
|
85
|
+
*/
|
|
86
|
+
export interface StringValue {
|
|
87
|
+
/** The string value. */
|
|
88
|
+
value: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Wrapper message for `bytes`.
|
|
93
|
+
*
|
|
94
|
+
* The JSON representation for `BytesValue` is JSON string.
|
|
95
|
+
*/
|
|
96
|
+
export interface BytesValue {
|
|
97
|
+
/** The bytes value. */
|
|
98
|
+
value: Uint8Array;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
package/gen/ts/listings.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { wrappers } from "protobufjs";
|
|
9
10
|
import { Observable } from "rxjs";
|
|
11
|
+
import { Struct } from "./google/protobuf/struct";
|
|
10
12
|
|
|
11
13
|
export const protobufPackage = "listings.v1";
|
|
12
14
|
|
|
@@ -34,6 +36,23 @@ export enum ListingStatus {
|
|
|
34
36
|
UNRECOGNIZED = -1,
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
export interface CreateListingRequest {
|
|
40
|
+
userId: string | undefined;
|
|
41
|
+
title: string | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
price?: number | undefined;
|
|
44
|
+
categoryId: string | undefined;
|
|
45
|
+
latitude?: number | undefined;
|
|
46
|
+
longitude?: number | undefined;
|
|
47
|
+
videoUrl?: string | undefined;
|
|
48
|
+
status?: string | undefined;
|
|
49
|
+
attributes?: { [key: string]: any } | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CreateListingResponse {
|
|
53
|
+
id: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
37
56
|
/** Запросы для получения данных */
|
|
38
57
|
export interface GetListingRequest {
|
|
39
58
|
id: string;
|
|
@@ -87,9 +106,13 @@ export interface Listing {
|
|
|
87
106
|
|
|
88
107
|
export const LISTINGS_V1_PACKAGE_NAME = "listings.v1";
|
|
89
108
|
|
|
109
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
110
|
+
|
|
90
111
|
export interface ListingsServiceClient {
|
|
91
112
|
/** Получение данных через gRPC */
|
|
92
113
|
|
|
114
|
+
createListing(request: CreateListingRequest): Observable<CreateListingResponse>;
|
|
115
|
+
|
|
93
116
|
getListing(request: GetListingRequest): Observable<GetListingResponse>;
|
|
94
117
|
|
|
95
118
|
getListingsByUser(request: GetListingsByUserRequest): Observable<GetListingsByUserResponse>;
|
|
@@ -100,6 +123,10 @@ export interface ListingsServiceClient {
|
|
|
100
123
|
export interface ListingsServiceController {
|
|
101
124
|
/** Получение данных через gRPC */
|
|
102
125
|
|
|
126
|
+
createListing(
|
|
127
|
+
request: CreateListingRequest,
|
|
128
|
+
): Promise<CreateListingResponse> | Observable<CreateListingResponse> | CreateListingResponse;
|
|
129
|
+
|
|
103
130
|
getListing(
|
|
104
131
|
request: GetListingRequest,
|
|
105
132
|
): Promise<GetListingResponse> | Observable<GetListingResponse> | GetListingResponse;
|
|
@@ -115,7 +142,7 @@ export interface ListingsServiceController {
|
|
|
115
142
|
|
|
116
143
|
export function ListingsServiceControllerMethods() {
|
|
117
144
|
return function (constructor: Function) {
|
|
118
|
-
const grpcMethods: string[] = ["getListing", "getListingsByUser", "getListingsByCategory"];
|
|
145
|
+
const grpcMethods: string[] = ["createListing", "getListing", "getListingsByUser", "getListingsByCategory"];
|
|
119
146
|
for (const method of grpcMethods) {
|
|
120
147
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
121
148
|
GrpcMethod("ListingsService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/listings.proto
CHANGED
|
@@ -3,14 +3,34 @@ syntax = "proto3";
|
|
|
3
3
|
package listings.v1;
|
|
4
4
|
|
|
5
5
|
import "google/protobuf/empty.proto";
|
|
6
|
+
import "google/protobuf/wrappers.proto";
|
|
7
|
+
import "google/protobuf/struct.proto";
|
|
6
8
|
|
|
7
9
|
service ListingsService {
|
|
8
10
|
// Получение данных через gRPC
|
|
11
|
+
rpc CreateListing (CreateListingRequest) returns (CreateListingResponse);
|
|
9
12
|
rpc GetListing (GetListingRequest) returns (GetListingResponse);
|
|
10
13
|
rpc GetListingsByUser (GetListingsByUserRequest) returns (GetListingsByUserResponse);
|
|
11
14
|
rpc GetListingsByCategory (GetListingsByCategoryRequest) returns (GetListingsByCategoryResponse);
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
message CreateListingRequest {
|
|
18
|
+
google.protobuf.StringValue user_id = 1;
|
|
19
|
+
google.protobuf.StringValue title = 2;
|
|
20
|
+
optional google.protobuf.StringValue description = 3;
|
|
21
|
+
optional google.protobuf.Int64Value price = 4;
|
|
22
|
+
google.protobuf.StringValue category_id = 5;
|
|
23
|
+
optional google.protobuf.FloatValue latitude = 6;
|
|
24
|
+
optional google.protobuf.FloatValue longitude = 7;
|
|
25
|
+
optional google.protobuf.StringValue video_url = 8;
|
|
26
|
+
optional google.protobuf.StringValue status = 9;
|
|
27
|
+
optional google.protobuf.Struct attributes = 10;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message CreateListingResponse {
|
|
31
|
+
google.protobuf.StringValue id = 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
14
34
|
// Запросы для получения данных
|
|
15
35
|
message GetListingRequest {
|
|
16
36
|
string id = 1;
|
|
@@ -64,13 +84,13 @@ message Listing {
|
|
|
64
84
|
// Статусы объявлений
|
|
65
85
|
enum ListingStatus {
|
|
66
86
|
UNSPECIFIED = 0;
|
|
67
|
-
DRAFT = 1;
|
|
68
|
-
ACTIVE = 2;
|
|
69
|
-
UNPUBLISHED = 3;
|
|
70
|
-
WITH_ERRORS = 4;
|
|
71
|
-
ARCHIVED = 5;
|
|
72
|
-
DELETED = 6;
|
|
73
|
-
PENDING_REVIEW = 7;
|
|
74
|
-
REJECTED = 8;
|
|
75
|
-
SUSPENDED = 9;
|
|
87
|
+
DRAFT = 1; // Черновик
|
|
88
|
+
ACTIVE = 2; // Активные
|
|
89
|
+
UNPUBLISHED = 3; // Неопубликованные
|
|
90
|
+
WITH_ERRORS = 4; // С ошибками
|
|
91
|
+
ARCHIVED = 5; // Архив
|
|
92
|
+
DELETED = 6; // Удаленные
|
|
93
|
+
PENDING_REVIEW = 7; // На модерации (внутренний)
|
|
94
|
+
REJECTED = 8; // Отклонено (внутренний)
|
|
95
|
+
SUSPENDED = 9; // Приостановлено (внутренний)
|
|
76
96
|
}
|