@control_yourself/contracts 0.3.4 → 0.4.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.
@@ -0,0 +1,68 @@
1
+ // @generated by protoc-gen-es v2.10.2 with parameter "target=ts"
2
+ // @generated from file me.proto (package me.v1, syntax proto3)
3
+ /* eslint-disable */
4
+
5
+ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
6
+ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
7
+ import type { Message } from "@bufbuild/protobuf";
8
+
9
+ /**
10
+ * Describes the file me.proto.
11
+ */
12
+ export const file_me: GenFile = /*@__PURE__*/
13
+ fileDesc("CghtZS5wcm90bxIFbWUudjEiHwoMR2V0TWVSZXF1ZXN0Eg8KB3VzZXJfaWQYASABKAUiLwoNR2V0TWVSZXNwb25zZRINCgVlbWFpbBgBIAEoCRIPCgd1c2VyX2lkGAIgASgFMj8KCU1lU2VydmljZRIyCgVHZXRNZRITLm1lLnYxLkdldE1lUmVxdWVzdBoULm1lLnYxLkdldE1lUmVzcG9uc2ViBnByb3RvMw");
14
+
15
+ /**
16
+ * @generated from message me.v1.GetMeRequest
17
+ */
18
+ export type GetMeRequest = Message<"me.v1.GetMeRequest"> & {
19
+ /**
20
+ * @generated from field: int32 user_id = 1;
21
+ */
22
+ userId: number;
23
+ };
24
+
25
+ /**
26
+ * Describes the message me.v1.GetMeRequest.
27
+ * Use `create(GetMeRequestSchema)` to create a new message.
28
+ */
29
+ export const GetMeRequestSchema: GenMessage<GetMeRequest> = /*@__PURE__*/
30
+ messageDesc(file_me, 0);
31
+
32
+ /**
33
+ * @generated from message me.v1.GetMeResponse
34
+ */
35
+ export type GetMeResponse = Message<"me.v1.GetMeResponse"> & {
36
+ /**
37
+ * @generated from field: string email = 1;
38
+ */
39
+ email: string;
40
+
41
+ /**
42
+ * @generated from field: int32 user_id = 2;
43
+ */
44
+ userId: number;
45
+ };
46
+
47
+ /**
48
+ * Describes the message me.v1.GetMeResponse.
49
+ * Use `create(GetMeResponseSchema)` to create a new message.
50
+ */
51
+ export const GetMeResponseSchema: GenMessage<GetMeResponse> = /*@__PURE__*/
52
+ messageDesc(file_me, 1);
53
+
54
+ /**
55
+ * @generated from service me.v1.MeService
56
+ */
57
+ export const MeService: GenService<{
58
+ /**
59
+ * @generated from rpc me.v1.MeService.GetMe
60
+ */
61
+ getMe: {
62
+ methodKind: "unary";
63
+ input: typeof GetMeRequestSchema;
64
+ output: typeof GetMeResponseSchema;
65
+ },
66
+ }> = /*@__PURE__*/
67
+ serviceDesc(file_me, 0);
68
+
@@ -554,10 +554,10 @@ export const RemoveIntegrationRequest: MessageFns<RemoveIntegrationRequest> = {
554
554
  },
555
555
  };
556
556
 
557
- export type MessengerServiceService = typeof MessengerServiceService;
558
- export const MessengerServiceService = {
557
+ export type IntegrationServiceService = typeof IntegrationServiceService;
558
+ export const IntegrationServiceService = {
559
559
  getIntegrations: {
560
- path: "/integration.v1.MessengerService/GetIntegrations",
560
+ path: "/integration.v1.IntegrationService/GetIntegrations",
561
561
  requestStream: false,
562
562
  responseStream: false,
563
563
  requestSerialize: (value: GetIntegrationsRequest): Buffer =>
@@ -568,7 +568,7 @@ export const MessengerServiceService = {
568
568
  responseDeserialize: (value: Buffer): GetIntegrationsResponse => GetIntegrationsResponse.decode(value),
569
569
  },
570
570
  removeIntegration: {
571
- path: "/integration.v1.MessengerService/RemoveIntegration",
571
+ path: "/integration.v1.IntegrationService/RemoveIntegration",
572
572
  requestStream: false,
573
573
  responseStream: false,
574
574
  requestSerialize: (value: RemoveIntegrationRequest): Buffer =>
@@ -579,12 +579,12 @@ export const MessengerServiceService = {
579
579
  },
580
580
  } as const;
581
581
 
582
- export interface MessengerServiceServer extends UntypedServiceImplementation {
582
+ export interface IntegrationServiceServer extends UntypedServiceImplementation {
583
583
  getIntegrations: handleUnaryCall<GetIntegrationsRequest, GetIntegrationsResponse>;
584
584
  removeIntegration: handleUnaryCall<RemoveIntegrationRequest, Empty>;
585
585
  }
586
586
 
587
- export interface MessengerServiceClient extends Client {
587
+ export interface IntegrationServiceClient extends Client {
588
588
  getIntegrations(
589
589
  request: GetIntegrationsRequest,
590
590
  callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
@@ -617,12 +617,12 @@ export interface MessengerServiceClient extends Client {
617
617
  ): ClientUnaryCall;
618
618
  }
619
619
 
620
- export const MessengerServiceClient = makeGenericClientConstructor(
621
- MessengerServiceService,
622
- "integration.v1.MessengerService",
620
+ export const IntegrationServiceClient = makeGenericClientConstructor(
621
+ IntegrationServiceService,
622
+ "integration.v1.IntegrationService",
623
623
  ) as unknown as {
624
- new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): MessengerServiceClient;
625
- service: typeof MessengerServiceService;
624
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): IntegrationServiceClient;
625
+ service: typeof IntegrationServiceService;
626
626
  serviceName: string;
627
627
  };
628
628
 
@@ -0,0 +1,241 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.2
4
+ // protoc unknown
5
+ // source: me.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import {
10
+ type CallOptions,
11
+ type ChannelCredentials,
12
+ Client,
13
+ type ClientOptions,
14
+ type ClientUnaryCall,
15
+ type handleUnaryCall,
16
+ makeGenericClientConstructor,
17
+ type Metadata,
18
+ type ServiceError,
19
+ type UntypedServiceImplementation,
20
+ } from "@grpc/grpc-js";
21
+
22
+ export const protobufPackage = "me.v1";
23
+
24
+ export interface GetMeRequest {
25
+ userId: number;
26
+ }
27
+
28
+ export interface GetMeResponse {
29
+ email: string;
30
+ userId: number;
31
+ }
32
+
33
+ function createBaseGetMeRequest(): GetMeRequest {
34
+ return { userId: 0 };
35
+ }
36
+
37
+ export const GetMeRequest: MessageFns<GetMeRequest> = {
38
+ encode(message: GetMeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
39
+ if (message.userId !== 0) {
40
+ writer.uint32(8).int32(message.userId);
41
+ }
42
+ return writer;
43
+ },
44
+
45
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeRequest {
46
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
47
+ const end = length === undefined ? reader.len : reader.pos + length;
48
+ const message = createBaseGetMeRequest();
49
+ while (reader.pos < end) {
50
+ const tag = reader.uint32();
51
+ switch (tag >>> 3) {
52
+ case 1: {
53
+ if (tag !== 8) {
54
+ break;
55
+ }
56
+
57
+ message.userId = reader.int32();
58
+ continue;
59
+ }
60
+ }
61
+ if ((tag & 7) === 4 || tag === 0) {
62
+ break;
63
+ }
64
+ reader.skip(tag & 7);
65
+ }
66
+ return message;
67
+ },
68
+
69
+ fromJSON(object: any): GetMeRequest {
70
+ return {
71
+ userId: isSet(object.userId)
72
+ ? globalThis.Number(object.userId)
73
+ : isSet(object.user_id)
74
+ ? globalThis.Number(object.user_id)
75
+ : 0,
76
+ };
77
+ },
78
+
79
+ toJSON(message: GetMeRequest): unknown {
80
+ const obj: any = {};
81
+ if (message.userId !== 0) {
82
+ obj.userId = Math.round(message.userId);
83
+ }
84
+ return obj;
85
+ },
86
+
87
+ create<I extends Exact<DeepPartial<GetMeRequest>, I>>(base?: I): GetMeRequest {
88
+ return GetMeRequest.fromPartial(base ?? ({} as any));
89
+ },
90
+ fromPartial<I extends Exact<DeepPartial<GetMeRequest>, I>>(object: I): GetMeRequest {
91
+ const message = createBaseGetMeRequest();
92
+ message.userId = object.userId ?? 0;
93
+ return message;
94
+ },
95
+ };
96
+
97
+ function createBaseGetMeResponse(): GetMeResponse {
98
+ return { email: "", userId: 0 };
99
+ }
100
+
101
+ export const GetMeResponse: MessageFns<GetMeResponse> = {
102
+ encode(message: GetMeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
103
+ if (message.email !== "") {
104
+ writer.uint32(10).string(message.email);
105
+ }
106
+ if (message.userId !== 0) {
107
+ writer.uint32(16).int32(message.userId);
108
+ }
109
+ return writer;
110
+ },
111
+
112
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeResponse {
113
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
114
+ const end = length === undefined ? reader.len : reader.pos + length;
115
+ const message = createBaseGetMeResponse();
116
+ while (reader.pos < end) {
117
+ const tag = reader.uint32();
118
+ switch (tag >>> 3) {
119
+ case 1: {
120
+ if (tag !== 10) {
121
+ break;
122
+ }
123
+
124
+ message.email = reader.string();
125
+ continue;
126
+ }
127
+ case 2: {
128
+ if (tag !== 16) {
129
+ break;
130
+ }
131
+
132
+ message.userId = reader.int32();
133
+ continue;
134
+ }
135
+ }
136
+ if ((tag & 7) === 4 || tag === 0) {
137
+ break;
138
+ }
139
+ reader.skip(tag & 7);
140
+ }
141
+ return message;
142
+ },
143
+
144
+ fromJSON(object: any): GetMeResponse {
145
+ return {
146
+ email: isSet(object.email) ? globalThis.String(object.email) : "",
147
+ userId: isSet(object.userId)
148
+ ? globalThis.Number(object.userId)
149
+ : isSet(object.user_id)
150
+ ? globalThis.Number(object.user_id)
151
+ : 0,
152
+ };
153
+ },
154
+
155
+ toJSON(message: GetMeResponse): unknown {
156
+ const obj: any = {};
157
+ if (message.email !== "") {
158
+ obj.email = message.email;
159
+ }
160
+ if (message.userId !== 0) {
161
+ obj.userId = Math.round(message.userId);
162
+ }
163
+ return obj;
164
+ },
165
+
166
+ create<I extends Exact<DeepPartial<GetMeResponse>, I>>(base?: I): GetMeResponse {
167
+ return GetMeResponse.fromPartial(base ?? ({} as any));
168
+ },
169
+ fromPartial<I extends Exact<DeepPartial<GetMeResponse>, I>>(object: I): GetMeResponse {
170
+ const message = createBaseGetMeResponse();
171
+ message.email = object.email ?? "";
172
+ message.userId = object.userId ?? 0;
173
+ return message;
174
+ },
175
+ };
176
+
177
+ export type MeServiceService = typeof MeServiceService;
178
+ export const MeServiceService = {
179
+ getMe: {
180
+ path: "/me.v1.MeService/GetMe",
181
+ requestStream: false,
182
+ responseStream: false,
183
+ requestSerialize: (value: GetMeRequest): Buffer => Buffer.from(GetMeRequest.encode(value).finish()),
184
+ requestDeserialize: (value: Buffer): GetMeRequest => GetMeRequest.decode(value),
185
+ responseSerialize: (value: GetMeResponse): Buffer => Buffer.from(GetMeResponse.encode(value).finish()),
186
+ responseDeserialize: (value: Buffer): GetMeResponse => GetMeResponse.decode(value),
187
+ },
188
+ } as const;
189
+
190
+ export interface MeServiceServer extends UntypedServiceImplementation {
191
+ getMe: handleUnaryCall<GetMeRequest, GetMeResponse>;
192
+ }
193
+
194
+ export interface MeServiceClient extends Client {
195
+ getMe(
196
+ request: GetMeRequest,
197
+ callback: (error: ServiceError | null, response: GetMeResponse) => void,
198
+ ): ClientUnaryCall;
199
+ getMe(
200
+ request: GetMeRequest,
201
+ metadata: Metadata,
202
+ callback: (error: ServiceError | null, response: GetMeResponse) => void,
203
+ ): ClientUnaryCall;
204
+ getMe(
205
+ request: GetMeRequest,
206
+ metadata: Metadata,
207
+ options: Partial<CallOptions>,
208
+ callback: (error: ServiceError | null, response: GetMeResponse) => void,
209
+ ): ClientUnaryCall;
210
+ }
211
+
212
+ export const MeServiceClient = makeGenericClientConstructor(MeServiceService, "me.v1.MeService") as unknown as {
213
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): MeServiceClient;
214
+ service: typeof MeServiceService;
215
+ serviceName: string;
216
+ };
217
+
218
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
219
+
220
+ export type DeepPartial<T> = T extends Builtin ? T
221
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
222
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
223
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
224
+ : Partial<T>;
225
+
226
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
227
+ export type Exact<P, I extends P> = P extends Builtin ? P
228
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
229
+
230
+ function isSet(value: any): boolean {
231
+ return value !== null && value !== undefined;
232
+ }
233
+
234
+ export interface MessageFns<T> {
235
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
236
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
237
+ fromJSON(object: any): T;
238
+ toJSON(message: T): unknown;
239
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
240
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
241
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@control_yourself/contracts",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "author": "vladimir.pariy@gmail.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,7 +3,7 @@ syntax = "proto3";
3
3
  package integration.v1;
4
4
  import "google/protobuf/empty.proto";
5
5
 
6
- service MessengerService {
6
+ service IntegrationService {
7
7
  rpc GetIntegrations (GetIntegrationsRequest) returns (GetIntegrationsResponse);
8
8
  rpc RemoveIntegration (RemoveIntegrationRequest) returns (google.protobuf.Empty);
9
9
  }
@@ -0,0 +1,15 @@
1
+ syntax = "proto3";
2
+
3
+ package me.v1;
4
+
5
+ service MeService {
6
+ rpc GetMe (GetMeRequest) returns (GetMeResponse);
7
+ }
8
+
9
+ message GetMeRequest {
10
+ int32 user_id = 1;
11
+ };
12
+ message GetMeResponse {
13
+ string email = 1;
14
+ int32 user_id = 2;
15
+ };