@ssoeasy-dev/proto 1.1.1-beta.3 → 1.1.1-beta.4

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.
@@ -18,6 +18,16 @@ import {
18
18
  verificationTypeToNumber,
19
19
  } from "./verification";
20
20
 
21
+ export interface GetMeRequest {
22
+ $type: "auth.v1.GetMeRequest";
23
+ token: string;
24
+ }
25
+
26
+ export interface GetMeResponse {
27
+ $type: "auth.v1.GetMeResponse";
28
+ userId: string;
29
+ }
30
+
21
31
  export interface AuthCode {
22
32
  $type: "auth.v1.AuthCode";
23
33
  id: string;
@@ -77,6 +87,133 @@ export interface AuthorizeRequest {
77
87
  code?: CodeVerifier | undefined;
78
88
  }
79
89
 
90
+ function createBaseGetMeRequest(): GetMeRequest {
91
+ return { $type: "auth.v1.GetMeRequest", token: "" };
92
+ }
93
+
94
+ export const GetMeRequest: MessageFns<GetMeRequest, "auth.v1.GetMeRequest"> = {
95
+ $type: "auth.v1.GetMeRequest" as const,
96
+
97
+ encode(message: GetMeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
98
+ if (message.token !== "") {
99
+ writer.uint32(10).string(message.token);
100
+ }
101
+ return writer;
102
+ },
103
+
104
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeRequest {
105
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
106
+ const end = length === undefined ? reader.len : reader.pos + length;
107
+ const message = createBaseGetMeRequest();
108
+ while (reader.pos < end) {
109
+ const tag = reader.uint32();
110
+ switch (tag >>> 3) {
111
+ case 1: {
112
+ if (tag !== 10) {
113
+ break;
114
+ }
115
+
116
+ message.token = reader.string();
117
+ continue;
118
+ }
119
+ }
120
+ if ((tag & 7) === 4 || tag === 0) {
121
+ break;
122
+ }
123
+ reader.skip(tag & 7);
124
+ }
125
+ return message;
126
+ },
127
+
128
+ fromJSON(object: any): GetMeRequest {
129
+ return { $type: GetMeRequest.$type, token: isSet(object.token) ? globalThis.String(object.token) : "" };
130
+ },
131
+
132
+ toJSON(message: GetMeRequest): unknown {
133
+ const obj: any = {};
134
+ if (message.token !== "") {
135
+ obj.token = message.token;
136
+ }
137
+ return obj;
138
+ },
139
+
140
+ create<I extends Exact<DeepPartial<GetMeRequest>, I>>(base?: I): GetMeRequest {
141
+ return GetMeRequest.fromPartial(base ?? ({} as any));
142
+ },
143
+ fromPartial<I extends Exact<DeepPartial<GetMeRequest>, I>>(object: I): GetMeRequest {
144
+ const message = createBaseGetMeRequest();
145
+ message.token = object.token ?? "";
146
+ return message;
147
+ },
148
+ };
149
+
150
+ function createBaseGetMeResponse(): GetMeResponse {
151
+ return { $type: "auth.v1.GetMeResponse", userId: "" };
152
+ }
153
+
154
+ export const GetMeResponse: MessageFns<GetMeResponse, "auth.v1.GetMeResponse"> = {
155
+ $type: "auth.v1.GetMeResponse" as const,
156
+
157
+ encode(message: GetMeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
158
+ if (message.userId !== "") {
159
+ writer.uint32(10).string(message.userId);
160
+ }
161
+ return writer;
162
+ },
163
+
164
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMeResponse {
165
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
166
+ const end = length === undefined ? reader.len : reader.pos + length;
167
+ const message = createBaseGetMeResponse();
168
+ while (reader.pos < end) {
169
+ const tag = reader.uint32();
170
+ switch (tag >>> 3) {
171
+ case 1: {
172
+ if (tag !== 10) {
173
+ break;
174
+ }
175
+
176
+ message.userId = reader.string();
177
+ continue;
178
+ }
179
+ }
180
+ if ((tag & 7) === 4 || tag === 0) {
181
+ break;
182
+ }
183
+ reader.skip(tag & 7);
184
+ }
185
+ return message;
186
+ },
187
+
188
+ fromJSON(object: any): GetMeResponse {
189
+ return {
190
+ $type: GetMeResponse.$type,
191
+ userId: isSet(object.userId)
192
+ ? globalThis.String(object.userId)
193
+ : isSet(object.user_id)
194
+ ? globalThis.String(object.user_id)
195
+ : "",
196
+ };
197
+ },
198
+
199
+ toJSON(message: GetMeResponse): unknown {
200
+ const obj: any = {};
201
+ if (message.userId !== "") {
202
+ obj.userId = message.userId;
203
+ }
204
+ return obj;
205
+ },
206
+
207
+ create<I extends Exact<DeepPartial<GetMeResponse>, I>>(base?: I): GetMeResponse {
208
+ return GetMeResponse.fromPartial(base ?? ({} as any));
209
+ },
210
+ fromPartial<I extends Exact<DeepPartial<GetMeResponse>, I>>(object: I): GetMeResponse {
211
+ const message = createBaseGetMeResponse();
212
+ message.userId = object.userId ?? "";
213
+ return message;
214
+ },
215
+ };
216
+
80
217
  function createBaseAuthCode(): AuthCode {
81
218
  return { $type: "auth.v1.AuthCode", id: "", value: "", expiresAt: 0 };
82
219
  }
@@ -1008,6 +1145,14 @@ export const AuthServiceDefinition = {
1008
1145
  responseStream: false,
1009
1146
  options: {},
1010
1147
  },
1148
+ getMe: {
1149
+ name: "GetMe",
1150
+ requestType: GetMeRequest,
1151
+ requestStream: false,
1152
+ responseType: GetMeResponse,
1153
+ responseStream: false,
1154
+ options: {},
1155
+ },
1011
1156
  },
1012
1157
  } as const;
1013
1158
 
@@ -1023,6 +1168,7 @@ export interface AuthServiceImplementation<CallContextExt = {}> {
1023
1168
  login(request: LoginRequest, context: CallContext & CallContextExt): Promise<DeepPartial<LoginResponse>>;
1024
1169
  authorize(request: AuthorizeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Tokens>>;
1025
1170
  logout(request: Tokens, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
1171
+ getMe(request: GetMeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetMeResponse>>;
1026
1172
  }
1027
1173
 
1028
1174
  export interface AuthServiceClient<CallOptionsExt = {}> {
@@ -1037,6 +1183,7 @@ export interface AuthServiceClient<CallOptionsExt = {}> {
1037
1183
  login(request: DeepPartial<LoginRequest>, options?: CallOptions & CallOptionsExt): Promise<LoginResponse>;
1038
1184
  authorize(request: DeepPartial<AuthorizeRequest>, options?: CallOptions & CallOptionsExt): Promise<Tokens>;
1039
1185
  logout(request: DeepPartial<Tokens>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
1186
+ getMe(request: DeepPartial<GetMeRequest>, options?: CallOptions & CallOptionsExt): Promise<GetMeResponse>;
1040
1187
  }
1041
1188
 
1042
1189
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
@@ -0,0 +1,327 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.4
4
+ // protoc unknown
5
+ // source: companies/v1/employee.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+
11
+ export interface GetByUserIdRequest {
12
+ $type: "companies.v1.GetByUserIdRequest";
13
+ userId: string;
14
+ }
15
+
16
+ export interface EmployeeCompany {
17
+ $type: "companies.v1.EmployeeCompany";
18
+ id: string;
19
+ name: string;
20
+ }
21
+
22
+ export interface GetByUserIdResponse {
23
+ $type: "companies.v1.GetByUserIdResponse";
24
+ firstname: string;
25
+ lastname: string;
26
+ companies: EmployeeCompany[];
27
+ }
28
+
29
+ function createBaseGetByUserIdRequest(): GetByUserIdRequest {
30
+ return { $type: "companies.v1.GetByUserIdRequest", userId: "" };
31
+ }
32
+
33
+ export const GetByUserIdRequest: MessageFns<GetByUserIdRequest, "companies.v1.GetByUserIdRequest"> = {
34
+ $type: "companies.v1.GetByUserIdRequest" as const,
35
+
36
+ encode(message: GetByUserIdRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
37
+ if (message.userId !== "") {
38
+ writer.uint32(10).string(message.userId);
39
+ }
40
+ return writer;
41
+ },
42
+
43
+ decode(input: BinaryReader | Uint8Array, length?: number): GetByUserIdRequest {
44
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
45
+ const end = length === undefined ? reader.len : reader.pos + length;
46
+ const message = createBaseGetByUserIdRequest();
47
+ while (reader.pos < end) {
48
+ const tag = reader.uint32();
49
+ switch (tag >>> 3) {
50
+ case 1: {
51
+ if (tag !== 10) {
52
+ break;
53
+ }
54
+
55
+ message.userId = reader.string();
56
+ continue;
57
+ }
58
+ }
59
+ if ((tag & 7) === 4 || tag === 0) {
60
+ break;
61
+ }
62
+ reader.skip(tag & 7);
63
+ }
64
+ return message;
65
+ },
66
+
67
+ fromJSON(object: any): GetByUserIdRequest {
68
+ return {
69
+ $type: GetByUserIdRequest.$type,
70
+ userId: isSet(object.userId)
71
+ ? globalThis.String(object.userId)
72
+ : isSet(object.user_id)
73
+ ? globalThis.String(object.user_id)
74
+ : "",
75
+ };
76
+ },
77
+
78
+ toJSON(message: GetByUserIdRequest): unknown {
79
+ const obj: any = {};
80
+ if (message.userId !== "") {
81
+ obj.userId = message.userId;
82
+ }
83
+ return obj;
84
+ },
85
+
86
+ create<I extends Exact<DeepPartial<GetByUserIdRequest>, I>>(base?: I): GetByUserIdRequest {
87
+ return GetByUserIdRequest.fromPartial(base ?? ({} as any));
88
+ },
89
+ fromPartial<I extends Exact<DeepPartial<GetByUserIdRequest>, I>>(object: I): GetByUserIdRequest {
90
+ const message = createBaseGetByUserIdRequest();
91
+ message.userId = object.userId ?? "";
92
+ return message;
93
+ },
94
+ };
95
+
96
+ function createBaseEmployeeCompany(): EmployeeCompany {
97
+ return { $type: "companies.v1.EmployeeCompany", id: "", name: "" };
98
+ }
99
+
100
+ export const EmployeeCompany: MessageFns<EmployeeCompany, "companies.v1.EmployeeCompany"> = {
101
+ $type: "companies.v1.EmployeeCompany" as const,
102
+
103
+ encode(message: EmployeeCompany, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
104
+ if (message.id !== "") {
105
+ writer.uint32(10).string(message.id);
106
+ }
107
+ if (message.name !== "") {
108
+ writer.uint32(18).string(message.name);
109
+ }
110
+ return writer;
111
+ },
112
+
113
+ decode(input: BinaryReader | Uint8Array, length?: number): EmployeeCompany {
114
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
115
+ const end = length === undefined ? reader.len : reader.pos + length;
116
+ const message = createBaseEmployeeCompany();
117
+ while (reader.pos < end) {
118
+ const tag = reader.uint32();
119
+ switch (tag >>> 3) {
120
+ case 1: {
121
+ if (tag !== 10) {
122
+ break;
123
+ }
124
+
125
+ message.id = reader.string();
126
+ continue;
127
+ }
128
+ case 2: {
129
+ if (tag !== 18) {
130
+ break;
131
+ }
132
+
133
+ message.name = reader.string();
134
+ continue;
135
+ }
136
+ }
137
+ if ((tag & 7) === 4 || tag === 0) {
138
+ break;
139
+ }
140
+ reader.skip(tag & 7);
141
+ }
142
+ return message;
143
+ },
144
+
145
+ fromJSON(object: any): EmployeeCompany {
146
+ return {
147
+ $type: EmployeeCompany.$type,
148
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
149
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
150
+ };
151
+ },
152
+
153
+ toJSON(message: EmployeeCompany): unknown {
154
+ const obj: any = {};
155
+ if (message.id !== "") {
156
+ obj.id = message.id;
157
+ }
158
+ if (message.name !== "") {
159
+ obj.name = message.name;
160
+ }
161
+ return obj;
162
+ },
163
+
164
+ create<I extends Exact<DeepPartial<EmployeeCompany>, I>>(base?: I): EmployeeCompany {
165
+ return EmployeeCompany.fromPartial(base ?? ({} as any));
166
+ },
167
+ fromPartial<I extends Exact<DeepPartial<EmployeeCompany>, I>>(object: I): EmployeeCompany {
168
+ const message = createBaseEmployeeCompany();
169
+ message.id = object.id ?? "";
170
+ message.name = object.name ?? "";
171
+ return message;
172
+ },
173
+ };
174
+
175
+ function createBaseGetByUserIdResponse(): GetByUserIdResponse {
176
+ return { $type: "companies.v1.GetByUserIdResponse", firstname: "", lastname: "", companies: [] };
177
+ }
178
+
179
+ export const GetByUserIdResponse: MessageFns<GetByUserIdResponse, "companies.v1.GetByUserIdResponse"> = {
180
+ $type: "companies.v1.GetByUserIdResponse" as const,
181
+
182
+ encode(message: GetByUserIdResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
183
+ if (message.firstname !== "") {
184
+ writer.uint32(10).string(message.firstname);
185
+ }
186
+ if (message.lastname !== "") {
187
+ writer.uint32(18).string(message.lastname);
188
+ }
189
+ for (const v of message.companies) {
190
+ EmployeeCompany.encode(v!, writer.uint32(26).fork()).join();
191
+ }
192
+ return writer;
193
+ },
194
+
195
+ decode(input: BinaryReader | Uint8Array, length?: number): GetByUserIdResponse {
196
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
197
+ const end = length === undefined ? reader.len : reader.pos + length;
198
+ const message = createBaseGetByUserIdResponse();
199
+ while (reader.pos < end) {
200
+ const tag = reader.uint32();
201
+ switch (tag >>> 3) {
202
+ case 1: {
203
+ if (tag !== 10) {
204
+ break;
205
+ }
206
+
207
+ message.firstname = reader.string();
208
+ continue;
209
+ }
210
+ case 2: {
211
+ if (tag !== 18) {
212
+ break;
213
+ }
214
+
215
+ message.lastname = reader.string();
216
+ continue;
217
+ }
218
+ case 3: {
219
+ if (tag !== 26) {
220
+ break;
221
+ }
222
+
223
+ message.companies.push(EmployeeCompany.decode(reader, reader.uint32()));
224
+ continue;
225
+ }
226
+ }
227
+ if ((tag & 7) === 4 || tag === 0) {
228
+ break;
229
+ }
230
+ reader.skip(tag & 7);
231
+ }
232
+ return message;
233
+ },
234
+
235
+ fromJSON(object: any): GetByUserIdResponse {
236
+ return {
237
+ $type: GetByUserIdResponse.$type,
238
+ firstname: isSet(object.firstname) ? globalThis.String(object.firstname) : "",
239
+ lastname: isSet(object.lastname) ? globalThis.String(object.lastname) : "",
240
+ companies: globalThis.Array.isArray(object?.companies)
241
+ ? object.companies.map((e: any) => EmployeeCompany.fromJSON(e))
242
+ : [],
243
+ };
244
+ },
245
+
246
+ toJSON(message: GetByUserIdResponse): unknown {
247
+ const obj: any = {};
248
+ if (message.firstname !== "") {
249
+ obj.firstname = message.firstname;
250
+ }
251
+ if (message.lastname !== "") {
252
+ obj.lastname = message.lastname;
253
+ }
254
+ if (message.companies?.length) {
255
+ obj.companies = message.companies.map((e) => EmployeeCompany.toJSON(e));
256
+ }
257
+ return obj;
258
+ },
259
+
260
+ create<I extends Exact<DeepPartial<GetByUserIdResponse>, I>>(base?: I): GetByUserIdResponse {
261
+ return GetByUserIdResponse.fromPartial(base ?? ({} as any));
262
+ },
263
+ fromPartial<I extends Exact<DeepPartial<GetByUserIdResponse>, I>>(object: I): GetByUserIdResponse {
264
+ const message = createBaseGetByUserIdResponse();
265
+ message.firstname = object.firstname ?? "";
266
+ message.lastname = object.lastname ?? "";
267
+ message.companies = object.companies?.map((e) => EmployeeCompany.fromPartial(e)) || [];
268
+ return message;
269
+ },
270
+ };
271
+
272
+ export type EmployeeServiceDefinition = typeof EmployeeServiceDefinition;
273
+ export const EmployeeServiceDefinition = {
274
+ name: "EmployeeService",
275
+ fullName: "companies.v1.EmployeeService",
276
+ methods: {
277
+ getByUserId: {
278
+ name: "GetByUserId",
279
+ requestType: GetByUserIdRequest,
280
+ requestStream: false,
281
+ responseType: GetByUserIdResponse,
282
+ responseStream: false,
283
+ options: {},
284
+ },
285
+ },
286
+ } as const;
287
+
288
+ export interface EmployeeServiceImplementation<CallContextExt = {}> {
289
+ getByUserId(
290
+ request: GetByUserIdRequest,
291
+ context: CallContext & CallContextExt,
292
+ ): Promise<DeepPartial<GetByUserIdResponse>>;
293
+ }
294
+
295
+ export interface EmployeeServiceClient<CallOptionsExt = {}> {
296
+ getByUserId(
297
+ request: DeepPartial<GetByUserIdRequest>,
298
+ options?: CallOptions & CallOptionsExt,
299
+ ): Promise<GetByUserIdResponse>;
300
+ }
301
+
302
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
303
+
304
+ type DeepPartial<T> = T extends Builtin ? T
305
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
306
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
307
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
308
+ : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
309
+ : Partial<T>;
310
+
311
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
312
+ type Exact<P, I extends P> = P extends Builtin ? P
313
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
314
+
315
+ function isSet(value: any): boolean {
316
+ return value !== null && value !== undefined;
317
+ }
318
+
319
+ interface MessageFns<T, V extends string> {
320
+ readonly $type: V;
321
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
322
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
323
+ fromJSON(object: any): T;
324
+ toJSON(message: T): unknown;
325
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
326
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
327
+ }
@@ -5,5 +5,6 @@
5
5
 
6
6
  /* eslint-disable */
7
7
 
8
+ export * from "./companies/v1/employee";
8
9
  export * from "./companies/v1/owner";
9
10
  export * from "./companies/v1/service";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssoeasy-dev/proto",
3
- "version": "1.1.1-beta.3",
3
+ "version": "1.1.1-beta.4",
4
4
  "description": "gRPC proto contracts and generated TypeScript clients for SSOEasy",
5
5
  "main": "gen/ts/index.ts",
6
6
  "types": "gen/ts/index.ts",
@@ -13,6 +13,15 @@ service AuthService {
13
13
  rpc Login(LoginRequest) returns (LoginResponse);
14
14
  rpc Authorize(AuthorizeRequest) returns (auth.v1.Tokens);
15
15
  rpc Logout(Tokens) returns (common.v1.StatusResponse);
16
+ rpc GetMe(GetMeRequest) returns (GetMeResponse);
17
+ }
18
+
19
+ message GetMeRequest {
20
+ string token = 1;
21
+ }
22
+
23
+ message GetMeResponse {
24
+ string user_id = 1;
16
25
  }
17
26
 
18
27
  message AuthCode {
@@ -0,0 +1,22 @@
1
+ syntax = "proto3";
2
+
3
+ package companies.v1;
4
+
5
+ service EmployeeService {
6
+ rpc GetByUserId(GetByUserIdRequest) returns (GetByUserIdResponse);
7
+ }
8
+
9
+ message GetByUserIdRequest {
10
+ string user_id = 1;
11
+ }
12
+
13
+ message EmployeeCompany {
14
+ string id = 1;
15
+ string name = 2;
16
+ }
17
+
18
+ message GetByUserIdResponse {
19
+ string firstname = 1;
20
+ string lastname = 2;
21
+ repeated EmployeeCompany companies = 3;
22
+ }