@ciganov/contracts 1.0.4 → 1.0.5

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.
@@ -0,0 +1,240 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.6
4
+ // protoc v3.21.12
5
+ // source: google/protobuf/field_mask.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "google.protobuf";
10
+
11
+ /**
12
+ * `FieldMask` represents a set of symbolic field paths, for example:
13
+ *
14
+ * paths: "f.a"
15
+ * paths: "f.b.d"
16
+ *
17
+ * Here `f` represents a field in some root message, `a` and `b`
18
+ * fields in the message found in `f`, and `d` a field found in the
19
+ * message in `f.b`.
20
+ *
21
+ * Field masks are used to specify a subset of fields that should be
22
+ * returned by a get operation or modified by an update operation.
23
+ * Field masks also have a custom JSON encoding (see below).
24
+ *
25
+ * # Field Masks in Projections
26
+ *
27
+ * When used in the context of a projection, a response message or
28
+ * sub-message is filtered by the API to only contain those fields as
29
+ * specified in the mask. For example, if the mask in the previous
30
+ * example is applied to a response message as follows:
31
+ *
32
+ * f {
33
+ * a : 22
34
+ * b {
35
+ * d : 1
36
+ * x : 2
37
+ * }
38
+ * y : 13
39
+ * }
40
+ * z: 8
41
+ *
42
+ * The result will not contain specific values for fields x,y and z
43
+ * (their value will be set to the default, and omitted in proto text
44
+ * output):
45
+ *
46
+ * f {
47
+ * a : 22
48
+ * b {
49
+ * d : 1
50
+ * }
51
+ * }
52
+ *
53
+ * A repeated field is not allowed except at the last position of a
54
+ * paths string.
55
+ *
56
+ * If a FieldMask object is not present in a get operation, the
57
+ * operation applies to all fields (as if a FieldMask of all fields
58
+ * had been specified).
59
+ *
60
+ * Note that a field mask does not necessarily apply to the
61
+ * top-level response message. In case of a REST get operation, the
62
+ * field mask applies directly to the response, but in case of a REST
63
+ * list operation, the mask instead applies to each individual message
64
+ * in the returned resource list. In case of a REST custom method,
65
+ * other definitions may be used. Where the mask applies will be
66
+ * clearly documented together with its declaration in the API. In
67
+ * any case, the effect on the returned resource/resources is required
68
+ * behavior for APIs.
69
+ *
70
+ * # Field Masks in Update Operations
71
+ *
72
+ * A field mask in update operations specifies which fields of the
73
+ * targeted resource are going to be updated. The API is required
74
+ * to only change the values of the fields as specified in the mask
75
+ * and leave the others untouched. If a resource is passed in to
76
+ * describe the updated values, the API ignores the values of all
77
+ * fields not covered by the mask.
78
+ *
79
+ * If a repeated field is specified for an update operation, new values will
80
+ * be appended to the existing repeated field in the target resource. Note that
81
+ * a repeated field is only allowed in the last position of a `paths` string.
82
+ *
83
+ * If a sub-message is specified in the last position of the field mask for an
84
+ * update operation, then new value will be merged into the existing sub-message
85
+ * in the target resource.
86
+ *
87
+ * For example, given the target message:
88
+ *
89
+ * f {
90
+ * b {
91
+ * d: 1
92
+ * x: 2
93
+ * }
94
+ * c: [1]
95
+ * }
96
+ *
97
+ * And an update message:
98
+ *
99
+ * f {
100
+ * b {
101
+ * d: 10
102
+ * }
103
+ * c: [2]
104
+ * }
105
+ *
106
+ * then if the field mask is:
107
+ *
108
+ * paths: ["f.b", "f.c"]
109
+ *
110
+ * then the result will be:
111
+ *
112
+ * f {
113
+ * b {
114
+ * d: 10
115
+ * x: 2
116
+ * }
117
+ * c: [1, 2]
118
+ * }
119
+ *
120
+ * An implementation may provide options to override this default behavior for
121
+ * repeated and message fields.
122
+ *
123
+ * In order to reset a field's value to the default, the field must
124
+ * be in the mask and set to the default value in the provided resource.
125
+ * Hence, in order to reset all fields of a resource, provide a default
126
+ * instance of the resource and set all fields in the mask, or do
127
+ * not provide a mask as described below.
128
+ *
129
+ * If a field mask is not present on update, the operation applies to
130
+ * all fields (as if a field mask of all fields has been specified).
131
+ * Note that in the presence of schema evolution, this may mean that
132
+ * fields the client does not know and has therefore not filled into
133
+ * the request will be reset to their default. If this is unwanted
134
+ * behavior, a specific service may require a client to always specify
135
+ * a field mask, producing an error if not.
136
+ *
137
+ * As with get operations, the location of the resource which
138
+ * describes the updated values in the request message depends on the
139
+ * operation kind. In any case, the effect of the field mask is
140
+ * required to be honored by the API.
141
+ *
142
+ * ## Considerations for HTTP REST
143
+ *
144
+ * The HTTP kind of an update operation which uses a field mask must
145
+ * be set to PATCH instead of PUT in order to satisfy HTTP semantics
146
+ * (PUT must only be used for full updates).
147
+ *
148
+ * # JSON Encoding of Field Masks
149
+ *
150
+ * In JSON, a field mask is encoded as a single string where paths are
151
+ * separated by a comma. Fields name in each path are converted
152
+ * to/from lower-camel naming conventions.
153
+ *
154
+ * As an example, consider the following message declarations:
155
+ *
156
+ * message Profile {
157
+ * User user = 1;
158
+ * Photo photo = 2;
159
+ * }
160
+ * message User {
161
+ * string display_name = 1;
162
+ * string address = 2;
163
+ * }
164
+ *
165
+ * In proto a field mask for `Profile` may look as such:
166
+ *
167
+ * mask {
168
+ * paths: "user.display_name"
169
+ * paths: "photo"
170
+ * }
171
+ *
172
+ * In JSON, the same mask is represented as below:
173
+ *
174
+ * {
175
+ * mask: "user.displayName,photo"
176
+ * }
177
+ *
178
+ * # Field Masks and Oneof Fields
179
+ *
180
+ * Field masks treat fields in oneofs just as regular fields. Consider the
181
+ * following message:
182
+ *
183
+ * message SampleMessage {
184
+ * oneof test_oneof {
185
+ * string name = 4;
186
+ * SubMessage sub_message = 9;
187
+ * }
188
+ * }
189
+ *
190
+ * The field mask can be:
191
+ *
192
+ * mask {
193
+ * paths: "name"
194
+ * }
195
+ *
196
+ * Or:
197
+ *
198
+ * mask {
199
+ * paths: "sub_message"
200
+ * }
201
+ *
202
+ * Note that oneof type names ("test_oneof" in this case) cannot be used in
203
+ * paths.
204
+ *
205
+ * ## Field Mask Verification
206
+ *
207
+ * The implementation of any API method which has a FieldMask type field in the
208
+ * request should verify the included field paths, and return an
209
+ * `INVALID_ARGUMENT` error if any path is unmappable.
210
+ */
211
+ export interface FieldMask {
212
+ /** The set of field mask paths. */
213
+ paths: string[];
214
+ }
215
+
216
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
217
+
218
+ function createBaseFieldMask(): FieldMask {
219
+ return { paths: [] };
220
+ }
221
+
222
+ export const FieldMask: MessageFns<FieldMask> & FieldMaskWrapperFns = {
223
+ wrap(paths: string[]): FieldMask {
224
+ const result = createBaseFieldMask();
225
+ result.paths = paths;
226
+ return result;
227
+ },
228
+
229
+ unwrap(message: FieldMask): string[] {
230
+ return message.paths;
231
+ },
232
+ };
233
+
234
+ export interface MessageFns<T> {
235
+ }
236
+
237
+ export interface FieldMaskWrapperFns {
238
+ wrap(paths: string[]): FieldMask;
239
+ unwrap(message: FieldMask): string[];
240
+ }
package/gen/user.ts CHANGED
@@ -28,6 +28,7 @@ export interface CreateUserResponse {
28
28
 
29
29
  export interface PatchUserRequest {
30
30
  user: User | undefined;
31
+ updateMask: string[] | undefined;
31
32
  }
32
33
 
33
34
  export interface PatchUserResponse {
@@ -38,6 +39,7 @@ export interface User {
38
39
  id: string;
39
40
  displayName?: string | undefined;
40
41
  bio?: string | undefined;
42
+ email: string;
41
43
  successRate?: number | undefined;
42
44
  loseAmount?: number | undefined;
43
45
  avatar?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciganov/contracts",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Protobuf definitions and generated ts types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/proto/user.proto CHANGED
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package user.v1;
4
4
 
5
+ import "google/protobuf/field_mask.proto";
6
+
5
7
  service UserService {
6
8
  rpc GetMe(GetMeRequest) returns (GetMeResponse);
7
9
 
@@ -28,6 +30,7 @@ message CreateUserResponse {
28
30
 
29
31
  message PatchUserRequest {
30
32
  User user = 1;
33
+ google.protobuf.FieldMask update_mask = 2;
31
34
  }
32
35
 
33
36
  message PatchUserResponse {
@@ -38,7 +41,8 @@ message User {
38
41
  string id = 1;
39
42
  optional string display_name = 2;
40
43
  optional string bio = 3;
41
- optional int32 success_rate = 4;
42
- optional int32 lose_amount = 5;
43
- optional string avatar = 6;
44
+ string email = 4;
45
+ optional int32 success_rate = 5;
46
+ optional int32 lose_amount = 6;
47
+ optional string avatar = 7;
44
48
  }