@bite-ninja/zenu-sdk 0.2.3
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/.prettierignore +2 -0
- package/README.md +0 -0
- package/buf.gen.yaml +15 -0
- package/dist/client.d.ts +59 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/gen/google/protobuf/timestamp.d.ts +129 -0
- package/dist/gen/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/gen/zenu/users/v1/users_service.d.ts +117 -0
- package/dist/gen/zenu/users/v1/users_service.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3713 -0
- package/examples/sayHello.ts +10 -0
- package/package.json +36 -0
- package/src/client.ts +86 -0
- package/src/gen/google/protobuf/timestamp.ts +229 -0
- package/src/gen/zenu/users/v1/users_service.ts +814 -0
- package/src/index.ts +2 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: zenu/users/v1/users_service.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
10
|
+
import { Timestamp } from "../../../google/protobuf/timestamp.js";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "zenu.users.v1";
|
|
13
|
+
|
|
14
|
+
export enum RoleScope {
|
|
15
|
+
ROLE_SCOPE_UNSPECIFIED = 0,
|
|
16
|
+
ROLE_SCOPE_GLOBAL = 1,
|
|
17
|
+
ROLE_SCOPE_ORGANIZATION = 2,
|
|
18
|
+
ROLE_SCOPE_LOCATION = 3,
|
|
19
|
+
UNRECOGNIZED = -1,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function roleScopeFromJSON(object: any): RoleScope {
|
|
23
|
+
switch (object) {
|
|
24
|
+
case 0:
|
|
25
|
+
case "ROLE_SCOPE_UNSPECIFIED":
|
|
26
|
+
return RoleScope.ROLE_SCOPE_UNSPECIFIED;
|
|
27
|
+
case 1:
|
|
28
|
+
case "ROLE_SCOPE_GLOBAL":
|
|
29
|
+
return RoleScope.ROLE_SCOPE_GLOBAL;
|
|
30
|
+
case 2:
|
|
31
|
+
case "ROLE_SCOPE_ORGANIZATION":
|
|
32
|
+
return RoleScope.ROLE_SCOPE_ORGANIZATION;
|
|
33
|
+
case 3:
|
|
34
|
+
case "ROLE_SCOPE_LOCATION":
|
|
35
|
+
return RoleScope.ROLE_SCOPE_LOCATION;
|
|
36
|
+
case -1:
|
|
37
|
+
case "UNRECOGNIZED":
|
|
38
|
+
default:
|
|
39
|
+
return RoleScope.UNRECOGNIZED;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function roleScopeToJSON(object: RoleScope): string {
|
|
44
|
+
switch (object) {
|
|
45
|
+
case RoleScope.ROLE_SCOPE_UNSPECIFIED:
|
|
46
|
+
return "ROLE_SCOPE_UNSPECIFIED";
|
|
47
|
+
case RoleScope.ROLE_SCOPE_GLOBAL:
|
|
48
|
+
return "ROLE_SCOPE_GLOBAL";
|
|
49
|
+
case RoleScope.ROLE_SCOPE_ORGANIZATION:
|
|
50
|
+
return "ROLE_SCOPE_ORGANIZATION";
|
|
51
|
+
case RoleScope.ROLE_SCOPE_LOCATION:
|
|
52
|
+
return "ROLE_SCOPE_LOCATION";
|
|
53
|
+
case RoleScope.UNRECOGNIZED:
|
|
54
|
+
default:
|
|
55
|
+
return "UNRECOGNIZED";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export enum Role {
|
|
60
|
+
ROLE_UNSPECIFIED = 0,
|
|
61
|
+
ROLE_ADMINISTRATOR = 1,
|
|
62
|
+
ROLE_DEVELOPER = 2,
|
|
63
|
+
ROLE_MANAGER = 3,
|
|
64
|
+
ROLE_NINJA = 4,
|
|
65
|
+
ROLE_INSTORE = 5,
|
|
66
|
+
ROLE_EMPLOYEE = 6,
|
|
67
|
+
UNRECOGNIZED = -1,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function roleFromJSON(object: any): Role {
|
|
71
|
+
switch (object) {
|
|
72
|
+
case 0:
|
|
73
|
+
case "ROLE_UNSPECIFIED":
|
|
74
|
+
return Role.ROLE_UNSPECIFIED;
|
|
75
|
+
case 1:
|
|
76
|
+
case "ROLE_ADMINISTRATOR":
|
|
77
|
+
return Role.ROLE_ADMINISTRATOR;
|
|
78
|
+
case 2:
|
|
79
|
+
case "ROLE_DEVELOPER":
|
|
80
|
+
return Role.ROLE_DEVELOPER;
|
|
81
|
+
case 3:
|
|
82
|
+
case "ROLE_MANAGER":
|
|
83
|
+
return Role.ROLE_MANAGER;
|
|
84
|
+
case 4:
|
|
85
|
+
case "ROLE_NINJA":
|
|
86
|
+
return Role.ROLE_NINJA;
|
|
87
|
+
case 5:
|
|
88
|
+
case "ROLE_INSTORE":
|
|
89
|
+
return Role.ROLE_INSTORE;
|
|
90
|
+
case 6:
|
|
91
|
+
case "ROLE_EMPLOYEE":
|
|
92
|
+
return Role.ROLE_EMPLOYEE;
|
|
93
|
+
case -1:
|
|
94
|
+
case "UNRECOGNIZED":
|
|
95
|
+
default:
|
|
96
|
+
return Role.UNRECOGNIZED;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function roleToJSON(object: Role): string {
|
|
101
|
+
switch (object) {
|
|
102
|
+
case Role.ROLE_UNSPECIFIED:
|
|
103
|
+
return "ROLE_UNSPECIFIED";
|
|
104
|
+
case Role.ROLE_ADMINISTRATOR:
|
|
105
|
+
return "ROLE_ADMINISTRATOR";
|
|
106
|
+
case Role.ROLE_DEVELOPER:
|
|
107
|
+
return "ROLE_DEVELOPER";
|
|
108
|
+
case Role.ROLE_MANAGER:
|
|
109
|
+
return "ROLE_MANAGER";
|
|
110
|
+
case Role.ROLE_NINJA:
|
|
111
|
+
return "ROLE_NINJA";
|
|
112
|
+
case Role.ROLE_INSTORE:
|
|
113
|
+
return "ROLE_INSTORE";
|
|
114
|
+
case Role.ROLE_EMPLOYEE:
|
|
115
|
+
return "ROLE_EMPLOYEE";
|
|
116
|
+
case Role.UNRECOGNIZED:
|
|
117
|
+
default:
|
|
118
|
+
return "UNRECOGNIZED";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface SayHelloRequest {
|
|
123
|
+
name: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface SayHelloResponse {
|
|
127
|
+
message: string;
|
|
128
|
+
currentTime: Date | undefined;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface WhoAmIRequest {
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface WhoAmIResponse {
|
|
135
|
+
user: User | undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface User {
|
|
139
|
+
id: string;
|
|
140
|
+
email: string;
|
|
141
|
+
givenName: string;
|
|
142
|
+
familyName: string;
|
|
143
|
+
telephone: string;
|
|
144
|
+
image: string;
|
|
145
|
+
createdAt: Date | undefined;
|
|
146
|
+
updatedAt: Date | undefined;
|
|
147
|
+
roles: UserRole[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface UserRole {
|
|
151
|
+
role: Role;
|
|
152
|
+
scope: RoleScope;
|
|
153
|
+
organizationId?: string | undefined;
|
|
154
|
+
locationId?: string | undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function createBaseSayHelloRequest(): SayHelloRequest {
|
|
158
|
+
return { name: "" };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const SayHelloRequest: MessageFns<SayHelloRequest> = {
|
|
162
|
+
encode(message: SayHelloRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
163
|
+
if (message.name !== "") {
|
|
164
|
+
writer.uint32(10).string(message.name);
|
|
165
|
+
}
|
|
166
|
+
return writer;
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SayHelloRequest {
|
|
170
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
171
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
172
|
+
const message = createBaseSayHelloRequest();
|
|
173
|
+
while (reader.pos < end) {
|
|
174
|
+
const tag = reader.uint32();
|
|
175
|
+
switch (tag >>> 3) {
|
|
176
|
+
case 1: {
|
|
177
|
+
if (tag !== 10) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message.name = reader.string();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
reader.skip(tag & 7);
|
|
189
|
+
}
|
|
190
|
+
return message;
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
fromJSON(object: any): SayHelloRequest {
|
|
194
|
+
return { name: isSet(object.name) ? globalThis.String(object.name) : "" };
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
toJSON(message: SayHelloRequest): unknown {
|
|
198
|
+
const obj: any = {};
|
|
199
|
+
if (message.name !== "") {
|
|
200
|
+
obj.name = message.name;
|
|
201
|
+
}
|
|
202
|
+
return obj;
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
create<I extends Exact<DeepPartial<SayHelloRequest>, I>>(base?: I): SayHelloRequest {
|
|
206
|
+
return SayHelloRequest.fromPartial(base ?? ({} as any));
|
|
207
|
+
},
|
|
208
|
+
fromPartial<I extends Exact<DeepPartial<SayHelloRequest>, I>>(object: I): SayHelloRequest {
|
|
209
|
+
const message = createBaseSayHelloRequest();
|
|
210
|
+
message.name = object.name ?? "";
|
|
211
|
+
return message;
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
function createBaseSayHelloResponse(): SayHelloResponse {
|
|
216
|
+
return { message: "", currentTime: undefined };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const SayHelloResponse: MessageFns<SayHelloResponse> = {
|
|
220
|
+
encode(message: SayHelloResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
221
|
+
if (message.message !== "") {
|
|
222
|
+
writer.uint32(10).string(message.message);
|
|
223
|
+
}
|
|
224
|
+
if (message.currentTime !== undefined) {
|
|
225
|
+
Timestamp.encode(toTimestamp(message.currentTime), writer.uint32(18).fork()).join();
|
|
226
|
+
}
|
|
227
|
+
return writer;
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SayHelloResponse {
|
|
231
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
232
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
233
|
+
const message = createBaseSayHelloResponse();
|
|
234
|
+
while (reader.pos < end) {
|
|
235
|
+
const tag = reader.uint32();
|
|
236
|
+
switch (tag >>> 3) {
|
|
237
|
+
case 1: {
|
|
238
|
+
if (tag !== 10) {
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
message.message = reader.string();
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
case 2: {
|
|
246
|
+
if (tag !== 18) {
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
message.currentTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
reader.skip(tag & 7);
|
|
258
|
+
}
|
|
259
|
+
return message;
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
fromJSON(object: any): SayHelloResponse {
|
|
263
|
+
return {
|
|
264
|
+
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
265
|
+
currentTime: isSet(object.currentTime)
|
|
266
|
+
? fromJsonTimestamp(object.currentTime)
|
|
267
|
+
: isSet(object.current_time)
|
|
268
|
+
? fromJsonTimestamp(object.current_time)
|
|
269
|
+
: undefined,
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
toJSON(message: SayHelloResponse): unknown {
|
|
274
|
+
const obj: any = {};
|
|
275
|
+
if (message.message !== "") {
|
|
276
|
+
obj.message = message.message;
|
|
277
|
+
}
|
|
278
|
+
if (message.currentTime !== undefined) {
|
|
279
|
+
obj.currentTime = message.currentTime.toISOString();
|
|
280
|
+
}
|
|
281
|
+
return obj;
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
create<I extends Exact<DeepPartial<SayHelloResponse>, I>>(base?: I): SayHelloResponse {
|
|
285
|
+
return SayHelloResponse.fromPartial(base ?? ({} as any));
|
|
286
|
+
},
|
|
287
|
+
fromPartial<I extends Exact<DeepPartial<SayHelloResponse>, I>>(object: I): SayHelloResponse {
|
|
288
|
+
const message = createBaseSayHelloResponse();
|
|
289
|
+
message.message = object.message ?? "";
|
|
290
|
+
message.currentTime = object.currentTime ?? undefined;
|
|
291
|
+
return message;
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
function createBaseWhoAmIRequest(): WhoAmIRequest {
|
|
296
|
+
return {};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export const WhoAmIRequest: MessageFns<WhoAmIRequest> = {
|
|
300
|
+
encode(_: WhoAmIRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
301
|
+
return writer;
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
decode(input: BinaryReader | Uint8Array, length?: number): WhoAmIRequest {
|
|
305
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
306
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
307
|
+
const message = createBaseWhoAmIRequest();
|
|
308
|
+
while (reader.pos < end) {
|
|
309
|
+
const tag = reader.uint32();
|
|
310
|
+
switch (tag >>> 3) {
|
|
311
|
+
}
|
|
312
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
reader.skip(tag & 7);
|
|
316
|
+
}
|
|
317
|
+
return message;
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
fromJSON(_: any): WhoAmIRequest {
|
|
321
|
+
return {};
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
toJSON(_: WhoAmIRequest): unknown {
|
|
325
|
+
const obj: any = {};
|
|
326
|
+
return obj;
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
create<I extends Exact<DeepPartial<WhoAmIRequest>, I>>(base?: I): WhoAmIRequest {
|
|
330
|
+
return WhoAmIRequest.fromPartial(base ?? ({} as any));
|
|
331
|
+
},
|
|
332
|
+
fromPartial<I extends Exact<DeepPartial<WhoAmIRequest>, I>>(_: I): WhoAmIRequest {
|
|
333
|
+
const message = createBaseWhoAmIRequest();
|
|
334
|
+
return message;
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
function createBaseWhoAmIResponse(): WhoAmIResponse {
|
|
339
|
+
return { user: undefined };
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export const WhoAmIResponse: MessageFns<WhoAmIResponse> = {
|
|
343
|
+
encode(message: WhoAmIResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
344
|
+
if (message.user !== undefined) {
|
|
345
|
+
User.encode(message.user, writer.uint32(10).fork()).join();
|
|
346
|
+
}
|
|
347
|
+
return writer;
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
decode(input: BinaryReader | Uint8Array, length?: number): WhoAmIResponse {
|
|
351
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
352
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
353
|
+
const message = createBaseWhoAmIResponse();
|
|
354
|
+
while (reader.pos < end) {
|
|
355
|
+
const tag = reader.uint32();
|
|
356
|
+
switch (tag >>> 3) {
|
|
357
|
+
case 1: {
|
|
358
|
+
if (tag !== 10) {
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
message.user = User.decode(reader, reader.uint32());
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
reader.skip(tag & 7);
|
|
370
|
+
}
|
|
371
|
+
return message;
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
fromJSON(object: any): WhoAmIResponse {
|
|
375
|
+
return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined };
|
|
376
|
+
},
|
|
377
|
+
|
|
378
|
+
toJSON(message: WhoAmIResponse): unknown {
|
|
379
|
+
const obj: any = {};
|
|
380
|
+
if (message.user !== undefined) {
|
|
381
|
+
obj.user = User.toJSON(message.user);
|
|
382
|
+
}
|
|
383
|
+
return obj;
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
create<I extends Exact<DeepPartial<WhoAmIResponse>, I>>(base?: I): WhoAmIResponse {
|
|
387
|
+
return WhoAmIResponse.fromPartial(base ?? ({} as any));
|
|
388
|
+
},
|
|
389
|
+
fromPartial<I extends Exact<DeepPartial<WhoAmIResponse>, I>>(object: I): WhoAmIResponse {
|
|
390
|
+
const message = createBaseWhoAmIResponse();
|
|
391
|
+
message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;
|
|
392
|
+
return message;
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
function createBaseUser(): User {
|
|
397
|
+
return {
|
|
398
|
+
id: "",
|
|
399
|
+
email: "",
|
|
400
|
+
givenName: "",
|
|
401
|
+
familyName: "",
|
|
402
|
+
telephone: "",
|
|
403
|
+
image: "",
|
|
404
|
+
createdAt: undefined,
|
|
405
|
+
updatedAt: undefined,
|
|
406
|
+
roles: [],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export const User: MessageFns<User> = {
|
|
411
|
+
encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
412
|
+
if (message.id !== "") {
|
|
413
|
+
writer.uint32(10).string(message.id);
|
|
414
|
+
}
|
|
415
|
+
if (message.email !== "") {
|
|
416
|
+
writer.uint32(18).string(message.email);
|
|
417
|
+
}
|
|
418
|
+
if (message.givenName !== "") {
|
|
419
|
+
writer.uint32(26).string(message.givenName);
|
|
420
|
+
}
|
|
421
|
+
if (message.familyName !== "") {
|
|
422
|
+
writer.uint32(34).string(message.familyName);
|
|
423
|
+
}
|
|
424
|
+
if (message.telephone !== "") {
|
|
425
|
+
writer.uint32(42).string(message.telephone);
|
|
426
|
+
}
|
|
427
|
+
if (message.image !== "") {
|
|
428
|
+
writer.uint32(50).string(message.image);
|
|
429
|
+
}
|
|
430
|
+
if (message.createdAt !== undefined) {
|
|
431
|
+
Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
|
|
432
|
+
}
|
|
433
|
+
if (message.updatedAt !== undefined) {
|
|
434
|
+
Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
|
|
435
|
+
}
|
|
436
|
+
for (const v of message.roles) {
|
|
437
|
+
UserRole.encode(v!, writer.uint32(74).fork()).join();
|
|
438
|
+
}
|
|
439
|
+
return writer;
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
decode(input: BinaryReader | Uint8Array, length?: number): User {
|
|
443
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
444
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
445
|
+
const message = createBaseUser();
|
|
446
|
+
while (reader.pos < end) {
|
|
447
|
+
const tag = reader.uint32();
|
|
448
|
+
switch (tag >>> 3) {
|
|
449
|
+
case 1: {
|
|
450
|
+
if (tag !== 10) {
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
message.id = reader.string();
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
case 2: {
|
|
458
|
+
if (tag !== 18) {
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
message.email = reader.string();
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
case 3: {
|
|
466
|
+
if (tag !== 26) {
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
message.givenName = reader.string();
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
case 4: {
|
|
474
|
+
if (tag !== 34) {
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
message.familyName = reader.string();
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
case 5: {
|
|
482
|
+
if (tag !== 42) {
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
message.telephone = reader.string();
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
case 6: {
|
|
490
|
+
if (tag !== 50) {
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
message.image = reader.string();
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
case 7: {
|
|
498
|
+
if (tag !== 58) {
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
case 8: {
|
|
506
|
+
if (tag !== 66) {
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
case 9: {
|
|
514
|
+
if (tag !== 74) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
message.roles.push(UserRole.decode(reader, reader.uint32()));
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
reader.skip(tag & 7);
|
|
526
|
+
}
|
|
527
|
+
return message;
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
fromJSON(object: any): User {
|
|
531
|
+
return {
|
|
532
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
533
|
+
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
|
534
|
+
givenName: isSet(object.givenName)
|
|
535
|
+
? globalThis.String(object.givenName)
|
|
536
|
+
: isSet(object.given_name)
|
|
537
|
+
? globalThis.String(object.given_name)
|
|
538
|
+
: "",
|
|
539
|
+
familyName: isSet(object.familyName)
|
|
540
|
+
? globalThis.String(object.familyName)
|
|
541
|
+
: isSet(object.family_name)
|
|
542
|
+
? globalThis.String(object.family_name)
|
|
543
|
+
: "",
|
|
544
|
+
telephone: isSet(object.telephone) ? globalThis.String(object.telephone) : "",
|
|
545
|
+
image: isSet(object.image) ? globalThis.String(object.image) : "",
|
|
546
|
+
createdAt: isSet(object.createdAt)
|
|
547
|
+
? fromJsonTimestamp(object.createdAt)
|
|
548
|
+
: isSet(object.created_at)
|
|
549
|
+
? fromJsonTimestamp(object.created_at)
|
|
550
|
+
: undefined,
|
|
551
|
+
updatedAt: isSet(object.updatedAt)
|
|
552
|
+
? fromJsonTimestamp(object.updatedAt)
|
|
553
|
+
: isSet(object.updated_at)
|
|
554
|
+
? fromJsonTimestamp(object.updated_at)
|
|
555
|
+
: undefined,
|
|
556
|
+
roles: globalThis.Array.isArray(object?.roles)
|
|
557
|
+
? object.roles.map((e: any) => UserRole.fromJSON(e))
|
|
558
|
+
: [],
|
|
559
|
+
};
|
|
560
|
+
},
|
|
561
|
+
|
|
562
|
+
toJSON(message: User): unknown {
|
|
563
|
+
const obj: any = {};
|
|
564
|
+
if (message.id !== "") {
|
|
565
|
+
obj.id = message.id;
|
|
566
|
+
}
|
|
567
|
+
if (message.email !== "") {
|
|
568
|
+
obj.email = message.email;
|
|
569
|
+
}
|
|
570
|
+
if (message.givenName !== "") {
|
|
571
|
+
obj.givenName = message.givenName;
|
|
572
|
+
}
|
|
573
|
+
if (message.familyName !== "") {
|
|
574
|
+
obj.familyName = message.familyName;
|
|
575
|
+
}
|
|
576
|
+
if (message.telephone !== "") {
|
|
577
|
+
obj.telephone = message.telephone;
|
|
578
|
+
}
|
|
579
|
+
if (message.image !== "") {
|
|
580
|
+
obj.image = message.image;
|
|
581
|
+
}
|
|
582
|
+
if (message.createdAt !== undefined) {
|
|
583
|
+
obj.createdAt = message.createdAt.toISOString();
|
|
584
|
+
}
|
|
585
|
+
if (message.updatedAt !== undefined) {
|
|
586
|
+
obj.updatedAt = message.updatedAt.toISOString();
|
|
587
|
+
}
|
|
588
|
+
if (message.roles?.length) {
|
|
589
|
+
obj.roles = message.roles.map((e) => UserRole.toJSON(e));
|
|
590
|
+
}
|
|
591
|
+
return obj;
|
|
592
|
+
},
|
|
593
|
+
|
|
594
|
+
create<I extends Exact<DeepPartial<User>, I>>(base?: I): User {
|
|
595
|
+
return User.fromPartial(base ?? ({} as any));
|
|
596
|
+
},
|
|
597
|
+
fromPartial<I extends Exact<DeepPartial<User>, I>>(object: I): User {
|
|
598
|
+
const message = createBaseUser();
|
|
599
|
+
message.id = object.id ?? "";
|
|
600
|
+
message.email = object.email ?? "";
|
|
601
|
+
message.givenName = object.givenName ?? "";
|
|
602
|
+
message.familyName = object.familyName ?? "";
|
|
603
|
+
message.telephone = object.telephone ?? "";
|
|
604
|
+
message.image = object.image ?? "";
|
|
605
|
+
message.createdAt = object.createdAt ?? undefined;
|
|
606
|
+
message.updatedAt = object.updatedAt ?? undefined;
|
|
607
|
+
message.roles = object.roles?.map((e) => UserRole.fromPartial(e)) || [];
|
|
608
|
+
return message;
|
|
609
|
+
},
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
function createBaseUserRole(): UserRole {
|
|
613
|
+
return { role: 0, scope: 0, organizationId: undefined, locationId: undefined };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export const UserRole: MessageFns<UserRole> = {
|
|
617
|
+
encode(message: UserRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
618
|
+
if (message.role !== 0) {
|
|
619
|
+
writer.uint32(8).int32(message.role);
|
|
620
|
+
}
|
|
621
|
+
if (message.scope !== 0) {
|
|
622
|
+
writer.uint32(16).int32(message.scope);
|
|
623
|
+
}
|
|
624
|
+
if (message.organizationId !== undefined) {
|
|
625
|
+
writer.uint32(26).string(message.organizationId);
|
|
626
|
+
}
|
|
627
|
+
if (message.locationId !== undefined) {
|
|
628
|
+
writer.uint32(34).string(message.locationId);
|
|
629
|
+
}
|
|
630
|
+
return writer;
|
|
631
|
+
},
|
|
632
|
+
|
|
633
|
+
decode(input: BinaryReader | Uint8Array, length?: number): UserRole {
|
|
634
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
635
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
636
|
+
const message = createBaseUserRole();
|
|
637
|
+
while (reader.pos < end) {
|
|
638
|
+
const tag = reader.uint32();
|
|
639
|
+
switch (tag >>> 3) {
|
|
640
|
+
case 1: {
|
|
641
|
+
if (tag !== 8) {
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
message.role = reader.int32() as any;
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
case 2: {
|
|
649
|
+
if (tag !== 16) {
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
message.scope = reader.int32() as any;
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
case 3: {
|
|
657
|
+
if (tag !== 26) {
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
message.organizationId = reader.string();
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
case 4: {
|
|
665
|
+
if (tag !== 34) {
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
message.locationId = reader.string();
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
reader.skip(tag & 7);
|
|
677
|
+
}
|
|
678
|
+
return message;
|
|
679
|
+
},
|
|
680
|
+
|
|
681
|
+
fromJSON(object: any): UserRole {
|
|
682
|
+
return {
|
|
683
|
+
role: isSet(object.role) ? roleFromJSON(object.role) : 0,
|
|
684
|
+
scope: isSet(object.scope) ? roleScopeFromJSON(object.scope) : 0,
|
|
685
|
+
organizationId: isSet(object.organizationId)
|
|
686
|
+
? globalThis.String(object.organizationId)
|
|
687
|
+
: isSet(object.organization_id)
|
|
688
|
+
? globalThis.String(object.organization_id)
|
|
689
|
+
: undefined,
|
|
690
|
+
locationId: isSet(object.locationId)
|
|
691
|
+
? globalThis.String(object.locationId)
|
|
692
|
+
: isSet(object.location_id)
|
|
693
|
+
? globalThis.String(object.location_id)
|
|
694
|
+
: undefined,
|
|
695
|
+
};
|
|
696
|
+
},
|
|
697
|
+
|
|
698
|
+
toJSON(message: UserRole): unknown {
|
|
699
|
+
const obj: any = {};
|
|
700
|
+
if (message.role !== 0) {
|
|
701
|
+
obj.role = roleToJSON(message.role);
|
|
702
|
+
}
|
|
703
|
+
if (message.scope !== 0) {
|
|
704
|
+
obj.scope = roleScopeToJSON(message.scope);
|
|
705
|
+
}
|
|
706
|
+
if (message.organizationId !== undefined) {
|
|
707
|
+
obj.organizationId = message.organizationId;
|
|
708
|
+
}
|
|
709
|
+
if (message.locationId !== undefined) {
|
|
710
|
+
obj.locationId = message.locationId;
|
|
711
|
+
}
|
|
712
|
+
return obj;
|
|
713
|
+
},
|
|
714
|
+
|
|
715
|
+
create<I extends Exact<DeepPartial<UserRole>, I>>(base?: I): UserRole {
|
|
716
|
+
return UserRole.fromPartial(base ?? ({} as any));
|
|
717
|
+
},
|
|
718
|
+
fromPartial<I extends Exact<DeepPartial<UserRole>, I>>(object: I): UserRole {
|
|
719
|
+
const message = createBaseUserRole();
|
|
720
|
+
message.role = object.role ?? 0;
|
|
721
|
+
message.scope = object.scope ?? 0;
|
|
722
|
+
message.organizationId = object.organizationId ?? undefined;
|
|
723
|
+
message.locationId = object.locationId ?? undefined;
|
|
724
|
+
return message;
|
|
725
|
+
},
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
/** Users service. */
|
|
729
|
+
export type UsersServiceDefinition = typeof UsersServiceDefinition;
|
|
730
|
+
export const UsersServiceDefinition = {
|
|
731
|
+
name: "UsersService",
|
|
732
|
+
fullName: "zenu.users.v1.UsersService",
|
|
733
|
+
methods: {
|
|
734
|
+
/** Test RPC for initial setup */
|
|
735
|
+
sayHello: {
|
|
736
|
+
name: "SayHello",
|
|
737
|
+
requestType: SayHelloRequest,
|
|
738
|
+
requestStream: false,
|
|
739
|
+
responseType: SayHelloResponse,
|
|
740
|
+
responseStream: false,
|
|
741
|
+
options: {},
|
|
742
|
+
},
|
|
743
|
+
/** Get current authenticated user information */
|
|
744
|
+
whoAmI: {
|
|
745
|
+
name: "WhoAmI",
|
|
746
|
+
requestType: WhoAmIRequest,
|
|
747
|
+
requestStream: false,
|
|
748
|
+
responseType: WhoAmIResponse,
|
|
749
|
+
responseStream: false,
|
|
750
|
+
options: {},
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
} as const;
|
|
754
|
+
|
|
755
|
+
export interface UsersServiceImplementation<CallContextExt = {}> {
|
|
756
|
+
/** Test RPC for initial setup */
|
|
757
|
+
sayHello(request: SayHelloRequest, context: CallContext & CallContextExt): Promise<DeepPartial<SayHelloResponse>>;
|
|
758
|
+
/** Get current authenticated user information */
|
|
759
|
+
whoAmI(request: WhoAmIRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WhoAmIResponse>>;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export interface UsersServiceClient<CallOptionsExt = {}> {
|
|
763
|
+
/** Test RPC for initial setup */
|
|
764
|
+
sayHello(request: DeepPartial<SayHelloRequest>, options?: CallOptions & CallOptionsExt): Promise<SayHelloResponse>;
|
|
765
|
+
/** Get current authenticated user information */
|
|
766
|
+
whoAmI(request: DeepPartial<WhoAmIRequest>, options?: CallOptions & CallOptionsExt): Promise<WhoAmIResponse>;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
770
|
+
|
|
771
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
772
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
773
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
774
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
775
|
+
: Partial<T>;
|
|
776
|
+
|
|
777
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
778
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
779
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
780
|
+
|
|
781
|
+
function toTimestamp(date: Date): Timestamp {
|
|
782
|
+
const seconds = Math.trunc(date.getTime() / 1_000);
|
|
783
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
784
|
+
return { seconds, nanos };
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
788
|
+
let millis = (t.seconds || 0) * 1_000;
|
|
789
|
+
millis += (t.nanos || 0) / 1_000_000;
|
|
790
|
+
return new globalThis.Date(millis);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function fromJsonTimestamp(o: any): Date {
|
|
794
|
+
if (o instanceof globalThis.Date) {
|
|
795
|
+
return o;
|
|
796
|
+
} else if (typeof o === "string") {
|
|
797
|
+
return new globalThis.Date(o);
|
|
798
|
+
} else {
|
|
799
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function isSet(value: any): boolean {
|
|
804
|
+
return value !== null && value !== undefined;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export interface MessageFns<T> {
|
|
808
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
809
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
810
|
+
fromJSON(object: any): T;
|
|
811
|
+
toJSON(message: T): unknown;
|
|
812
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
813
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
814
|
+
}
|