@ssoeasy-dev/proto 1.1.0-beta.2

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.
Files changed (41) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +228 -0
  3. package/gen/ts/abac/v1/employee_attribute.ts +501 -0
  4. package/gen/ts/abac/v1/models/employee_attribute.ts +190 -0
  5. package/gen/ts/auth/v1/auth.ts +663 -0
  6. package/gen/ts/auth/v1/verification.ts +340 -0
  7. package/gen/ts/common/v1/types.ts +142 -0
  8. package/gen/ts/companies/v1/models/company.ts +204 -0
  9. package/gen/ts/companies/v1/models/employee.ts +175 -0
  10. package/gen/ts/companies/v1/models/employee_company.ts +145 -0
  11. package/gen/ts/companies/v1/models/subscription.ts +166 -0
  12. package/gen/ts/companies/v1/owner.ts +569 -0
  13. package/gen/ts/google/protobuf/timestamp.ts +233 -0
  14. package/gen/ts/index.abac.ts +8 -0
  15. package/gen/ts/index.abac.v1.models.ts +8 -0
  16. package/gen/ts/index.abac.v1.ts +9 -0
  17. package/gen/ts/index.auth.ts +8 -0
  18. package/gen/ts/index.auth.v1.ts +9 -0
  19. package/gen/ts/index.common.ts +8 -0
  20. package/gen/ts/index.common.v1.ts +8 -0
  21. package/gen/ts/index.companies.ts +8 -0
  22. package/gen/ts/index.companies.v1.models.ts +11 -0
  23. package/gen/ts/index.companies.v1.ts +9 -0
  24. package/gen/ts/index.google.protobuf.ts +8 -0
  25. package/gen/ts/index.google.ts +8 -0
  26. package/gen/ts/index.services.ts +8 -0
  27. package/gen/ts/index.services.v1.ts +8 -0
  28. package/gen/ts/index.ts +13 -0
  29. package/gen/ts/services/v1/services.ts +293 -0
  30. package/package.json +69 -0
  31. package/proto/abac/v1/employee_attribute.proto +31 -0
  32. package/proto/abac/v1/models/employee_attribute.proto +11 -0
  33. package/proto/auth/v1/auth.proto +39 -0
  34. package/proto/auth/v1/verification.proto +25 -0
  35. package/proto/common/v1/types.proto +10 -0
  36. package/proto/companies/v1/models/company.proto +12 -0
  37. package/proto/companies/v1/models/employee.proto +11 -0
  38. package/proto/companies/v1/models/employee_company.proto +9 -0
  39. package/proto/companies/v1/models/subscription.proto +10 -0
  40. package/proto/companies/v1/owner.proto +38 -0
  41. package/proto/services/v1/services.proto +19 -0
@@ -0,0 +1,233 @@
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: google/protobuf/timestamp.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+
10
+ /**
11
+ * A Timestamp represents a point in time independent of any time zone or local
12
+ * calendar, encoded as a count of seconds and fractions of seconds at
13
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
14
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
15
+ * Gregorian calendar backwards to year one.
16
+ *
17
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
18
+ * second table is needed for interpretation, using a [24-hour linear
19
+ * smear](https://developers.google.com/time/smear).
20
+ *
21
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
22
+ * restricting to that range, we ensure that we can convert to and from [RFC
23
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
24
+ *
25
+ * # Examples
26
+ *
27
+ * Example 1: Compute Timestamp from POSIX `time()`.
28
+ *
29
+ * Timestamp timestamp;
30
+ * timestamp.set_seconds(time(NULL));
31
+ * timestamp.set_nanos(0);
32
+ *
33
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
34
+ *
35
+ * struct timeval tv;
36
+ * gettimeofday(&tv, NULL);
37
+ *
38
+ * Timestamp timestamp;
39
+ * timestamp.set_seconds(tv.tv_sec);
40
+ * timestamp.set_nanos(tv.tv_usec * 1000);
41
+ *
42
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
43
+ *
44
+ * FILETIME ft;
45
+ * GetSystemTimeAsFileTime(&ft);
46
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
47
+ *
48
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
49
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
50
+ * Timestamp timestamp;
51
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
52
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
53
+ *
54
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
55
+ *
56
+ * long millis = System.currentTimeMillis();
57
+ *
58
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
59
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
60
+ *
61
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
62
+ *
63
+ * Instant now = Instant.now();
64
+ *
65
+ * Timestamp timestamp =
66
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
67
+ * .setNanos(now.getNano()).build();
68
+ *
69
+ * Example 6: Compute Timestamp from current time in Python.
70
+ *
71
+ * timestamp = Timestamp()
72
+ * timestamp.GetCurrentTime()
73
+ *
74
+ * # JSON Mapping
75
+ *
76
+ * In JSON format, the Timestamp type is encoded as a string in the
77
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
79
+ * where {year} is always expressed using four digits while {month}, {day},
80
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
81
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
84
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
+ * able to accept both UTC and other timezones (as indicated by an offset).
86
+ *
87
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
+ * 01:30 UTC on January 15, 2017.
89
+ *
90
+ * In JavaScript, one can convert a Date object to this format using the
91
+ * standard
92
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
+ * method. In Python, a standard `datetime.datetime` object can be converted
94
+ * to this format using
95
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
99
+ * ) to obtain a formatter capable of generating timestamps in this format.
100
+ */
101
+ export interface Timestamp {
102
+ $type: "google.protobuf.Timestamp";
103
+ /**
104
+ * Represents seconds of UTC time since Unix epoch
105
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
106
+ * 9999-12-31T23:59:59Z inclusive.
107
+ */
108
+ seconds: number;
109
+ /**
110
+ * Non-negative fractions of a second at nanosecond resolution. Negative
111
+ * second values with fractions must still have non-negative nanos values
112
+ * that count forward in time. Must be from 0 to 999,999,999
113
+ * inclusive.
114
+ */
115
+ nanos: number;
116
+ }
117
+
118
+ function createBaseTimestamp(): Timestamp {
119
+ return { $type: "google.protobuf.Timestamp", seconds: 0, nanos: 0 };
120
+ }
121
+
122
+ export const Timestamp: MessageFns<Timestamp, "google.protobuf.Timestamp"> = {
123
+ $type: "google.protobuf.Timestamp" as const,
124
+
125
+ encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
126
+ if (message.seconds !== 0) {
127
+ writer.uint32(8).int64(message.seconds);
128
+ }
129
+ if (message.nanos !== 0) {
130
+ writer.uint32(16).int32(message.nanos);
131
+ }
132
+ return writer;
133
+ },
134
+
135
+ decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
136
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
137
+ const end = length === undefined ? reader.len : reader.pos + length;
138
+ const message = createBaseTimestamp();
139
+ while (reader.pos < end) {
140
+ const tag = reader.uint32();
141
+ switch (tag >>> 3) {
142
+ case 1: {
143
+ if (tag !== 8) {
144
+ break;
145
+ }
146
+
147
+ message.seconds = longToNumber(reader.int64());
148
+ continue;
149
+ }
150
+ case 2: {
151
+ if (tag !== 16) {
152
+ break;
153
+ }
154
+
155
+ message.nanos = reader.int32();
156
+ continue;
157
+ }
158
+ }
159
+ if ((tag & 7) === 4 || tag === 0) {
160
+ break;
161
+ }
162
+ reader.skip(tag & 7);
163
+ }
164
+ return message;
165
+ },
166
+
167
+ fromJSON(object: any): Timestamp {
168
+ return {
169
+ $type: Timestamp.$type,
170
+ seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
171
+ nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
172
+ };
173
+ },
174
+
175
+ toJSON(message: Timestamp): unknown {
176
+ const obj: any = {};
177
+ if (message.seconds !== 0) {
178
+ obj.seconds = Math.round(message.seconds);
179
+ }
180
+ if (message.nanos !== 0) {
181
+ obj.nanos = Math.round(message.nanos);
182
+ }
183
+ return obj;
184
+ },
185
+
186
+ create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
187
+ return Timestamp.fromPartial(base ?? ({} as any));
188
+ },
189
+ fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
190
+ const message = createBaseTimestamp();
191
+ message.seconds = object.seconds ?? 0;
192
+ message.nanos = object.nanos ?? 0;
193
+ return message;
194
+ },
195
+ };
196
+
197
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
198
+
199
+ type DeepPartial<T> = T extends Builtin ? T
200
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
201
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
202
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
203
+ : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
204
+ : Partial<T>;
205
+
206
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
207
+ type Exact<P, I extends P> = P extends Builtin ? P
208
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
209
+
210
+ function longToNumber(int64: { toString(): string }): number {
211
+ const num = globalThis.Number(int64.toString());
212
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
213
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
214
+ }
215
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
216
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
217
+ }
218
+ return num;
219
+ }
220
+
221
+ function isSet(value: any): boolean {
222
+ return value !== null && value !== undefined;
223
+ }
224
+
225
+ interface MessageFns<T, V extends string> {
226
+ readonly $type: V;
227
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
228
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
229
+ fromJSON(object: any): T;
230
+ toJSON(message: T): unknown;
231
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
232
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
233
+ }
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as v1 from "./index.abac.v1";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./abac/v1/models/employee_attribute";
@@ -0,0 +1,9 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as models from "./index.abac.v1.models";
9
+ export * from "./abac/v1/employee_attribute";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as v1 from "./index.auth.v1";
@@ -0,0 +1,9 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./auth/v1/verification";
9
+ export * from "./auth/v1/auth";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as v1 from "./index.common.v1";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./common/v1/types";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as v1 from "./index.companies.v1";
@@ -0,0 +1,11 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./companies/v1/models/company";
9
+ export * from "./companies/v1/models/employee";
10
+ export * from "./companies/v1/models/employee_company";
11
+ export * from "./companies/v1/models/subscription";
@@ -0,0 +1,9 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as models from "./index.companies.v1.models";
9
+ export * from "./companies/v1/owner";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./google/protobuf/timestamp";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as protobuf from "./index.google.protobuf";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as v1 from "./index.services.v1";
@@ -0,0 +1,8 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * from "./services/v1/services";
@@ -0,0 +1,13 @@
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
+
6
+ /* eslint-disable */
7
+
8
+ export * as abac from "./index.abac";
9
+ export * as auth from "./index.auth";
10
+ export * as google from "./index.google";
11
+ export * as common from "./index.common";
12
+ export * as companies from "./index.companies";
13
+ export * as services from "./index.services";
@@ -0,0 +1,293 @@
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: services/v1/services.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 GetServiceByIdRequest {
12
+ $type: "services.v1.GetServiceByIdRequest";
13
+ id: string;
14
+ }
15
+
16
+ export interface ServiceResponse {
17
+ $type: "services.v1.ServiceResponse";
18
+ id: string;
19
+ name: string;
20
+ description?: string | undefined;
21
+ ownerCompanyId: string;
22
+ createdAt: number;
23
+ }
24
+
25
+ function createBaseGetServiceByIdRequest(): GetServiceByIdRequest {
26
+ return { $type: "services.v1.GetServiceByIdRequest", id: "" };
27
+ }
28
+
29
+ export const GetServiceByIdRequest: MessageFns<GetServiceByIdRequest, "services.v1.GetServiceByIdRequest"> = {
30
+ $type: "services.v1.GetServiceByIdRequest" as const,
31
+
32
+ encode(message: GetServiceByIdRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
33
+ if (message.id !== "") {
34
+ writer.uint32(10).string(message.id);
35
+ }
36
+ return writer;
37
+ },
38
+
39
+ decode(input: BinaryReader | Uint8Array, length?: number): GetServiceByIdRequest {
40
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
41
+ const end = length === undefined ? reader.len : reader.pos + length;
42
+ const message = createBaseGetServiceByIdRequest();
43
+ while (reader.pos < end) {
44
+ const tag = reader.uint32();
45
+ switch (tag >>> 3) {
46
+ case 1: {
47
+ if (tag !== 10) {
48
+ break;
49
+ }
50
+
51
+ message.id = reader.string();
52
+ continue;
53
+ }
54
+ }
55
+ if ((tag & 7) === 4 || tag === 0) {
56
+ break;
57
+ }
58
+ reader.skip(tag & 7);
59
+ }
60
+ return message;
61
+ },
62
+
63
+ fromJSON(object: any): GetServiceByIdRequest {
64
+ return { $type: GetServiceByIdRequest.$type, id: isSet(object.id) ? globalThis.String(object.id) : "" };
65
+ },
66
+
67
+ toJSON(message: GetServiceByIdRequest): unknown {
68
+ const obj: any = {};
69
+ if (message.id !== "") {
70
+ obj.id = message.id;
71
+ }
72
+ return obj;
73
+ },
74
+
75
+ create<I extends Exact<DeepPartial<GetServiceByIdRequest>, I>>(base?: I): GetServiceByIdRequest {
76
+ return GetServiceByIdRequest.fromPartial(base ?? ({} as any));
77
+ },
78
+ fromPartial<I extends Exact<DeepPartial<GetServiceByIdRequest>, I>>(object: I): GetServiceByIdRequest {
79
+ const message = createBaseGetServiceByIdRequest();
80
+ message.id = object.id ?? "";
81
+ return message;
82
+ },
83
+ };
84
+
85
+ function createBaseServiceResponse(): ServiceResponse {
86
+ return {
87
+ $type: "services.v1.ServiceResponse",
88
+ id: "",
89
+ name: "",
90
+ description: undefined,
91
+ ownerCompanyId: "",
92
+ createdAt: 0,
93
+ };
94
+ }
95
+
96
+ export const ServiceResponse: MessageFns<ServiceResponse, "services.v1.ServiceResponse"> = {
97
+ $type: "services.v1.ServiceResponse" as const,
98
+
99
+ encode(message: ServiceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
100
+ if (message.id !== "") {
101
+ writer.uint32(10).string(message.id);
102
+ }
103
+ if (message.name !== "") {
104
+ writer.uint32(18).string(message.name);
105
+ }
106
+ if (message.description !== undefined) {
107
+ writer.uint32(26).string(message.description);
108
+ }
109
+ if (message.ownerCompanyId !== "") {
110
+ writer.uint32(34).string(message.ownerCompanyId);
111
+ }
112
+ if (message.createdAt !== 0) {
113
+ writer.uint32(40).int64(message.createdAt);
114
+ }
115
+ return writer;
116
+ },
117
+
118
+ decode(input: BinaryReader | Uint8Array, length?: number): ServiceResponse {
119
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
120
+ const end = length === undefined ? reader.len : reader.pos + length;
121
+ const message = createBaseServiceResponse();
122
+ while (reader.pos < end) {
123
+ const tag = reader.uint32();
124
+ switch (tag >>> 3) {
125
+ case 1: {
126
+ if (tag !== 10) {
127
+ break;
128
+ }
129
+
130
+ message.id = reader.string();
131
+ continue;
132
+ }
133
+ case 2: {
134
+ if (tag !== 18) {
135
+ break;
136
+ }
137
+
138
+ message.name = reader.string();
139
+ continue;
140
+ }
141
+ case 3: {
142
+ if (tag !== 26) {
143
+ break;
144
+ }
145
+
146
+ message.description = reader.string();
147
+ continue;
148
+ }
149
+ case 4: {
150
+ if (tag !== 34) {
151
+ break;
152
+ }
153
+
154
+ message.ownerCompanyId = reader.string();
155
+ continue;
156
+ }
157
+ case 5: {
158
+ if (tag !== 40) {
159
+ break;
160
+ }
161
+
162
+ message.createdAt = longToNumber(reader.int64());
163
+ continue;
164
+ }
165
+ }
166
+ if ((tag & 7) === 4 || tag === 0) {
167
+ break;
168
+ }
169
+ reader.skip(tag & 7);
170
+ }
171
+ return message;
172
+ },
173
+
174
+ fromJSON(object: any): ServiceResponse {
175
+ return {
176
+ $type: ServiceResponse.$type,
177
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
178
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
179
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
180
+ ownerCompanyId: isSet(object.ownerCompanyId)
181
+ ? globalThis.String(object.ownerCompanyId)
182
+ : isSet(object.owner_company_id)
183
+ ? globalThis.String(object.owner_company_id)
184
+ : "",
185
+ createdAt: isSet(object.createdAt)
186
+ ? globalThis.Number(object.createdAt)
187
+ : isSet(object.created_at)
188
+ ? globalThis.Number(object.created_at)
189
+ : 0,
190
+ };
191
+ },
192
+
193
+ toJSON(message: ServiceResponse): unknown {
194
+ const obj: any = {};
195
+ if (message.id !== "") {
196
+ obj.id = message.id;
197
+ }
198
+ if (message.name !== "") {
199
+ obj.name = message.name;
200
+ }
201
+ if (message.description !== undefined) {
202
+ obj.description = message.description;
203
+ }
204
+ if (message.ownerCompanyId !== "") {
205
+ obj.ownerCompanyId = message.ownerCompanyId;
206
+ }
207
+ if (message.createdAt !== 0) {
208
+ obj.createdAt = Math.round(message.createdAt);
209
+ }
210
+ return obj;
211
+ },
212
+
213
+ create<I extends Exact<DeepPartial<ServiceResponse>, I>>(base?: I): ServiceResponse {
214
+ return ServiceResponse.fromPartial(base ?? ({} as any));
215
+ },
216
+ fromPartial<I extends Exact<DeepPartial<ServiceResponse>, I>>(object: I): ServiceResponse {
217
+ const message = createBaseServiceResponse();
218
+ message.id = object.id ?? "";
219
+ message.name = object.name ?? "";
220
+ message.description = object.description ?? undefined;
221
+ message.ownerCompanyId = object.ownerCompanyId ?? "";
222
+ message.createdAt = object.createdAt ?? 0;
223
+ return message;
224
+ },
225
+ };
226
+
227
+ export type ServicesServiceDefinition = typeof ServicesServiceDefinition;
228
+ export const ServicesServiceDefinition = {
229
+ name: "ServicesService",
230
+ fullName: "services.v1.ServicesService",
231
+ methods: {
232
+ getServiceById: {
233
+ name: "GetServiceById",
234
+ requestType: GetServiceByIdRequest,
235
+ requestStream: false,
236
+ responseType: ServiceResponse,
237
+ responseStream: false,
238
+ options: {},
239
+ },
240
+ },
241
+ } as const;
242
+
243
+ export interface ServicesServiceImplementation<CallContextExt = {}> {
244
+ getServiceById(
245
+ request: GetServiceByIdRequest,
246
+ context: CallContext & CallContextExt,
247
+ ): Promise<DeepPartial<ServiceResponse>>;
248
+ }
249
+
250
+ export interface ServicesServiceClient<CallOptionsExt = {}> {
251
+ getServiceById(
252
+ request: DeepPartial<GetServiceByIdRequest>,
253
+ options?: CallOptions & CallOptionsExt,
254
+ ): Promise<ServiceResponse>;
255
+ }
256
+
257
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
258
+
259
+ type DeepPartial<T> = T extends Builtin ? T
260
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
261
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
262
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
263
+ : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
264
+ : Partial<T>;
265
+
266
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
267
+ type Exact<P, I extends P> = P extends Builtin ? P
268
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
269
+
270
+ function longToNumber(int64: { toString(): string }): number {
271
+ const num = globalThis.Number(int64.toString());
272
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
273
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
274
+ }
275
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
276
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
277
+ }
278
+ return num;
279
+ }
280
+
281
+ function isSet(value: any): boolean {
282
+ return value !== null && value !== undefined;
283
+ }
284
+
285
+ interface MessageFns<T, V extends string> {
286
+ readonly $type: V;
287
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
288
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
289
+ fromJSON(object: any): T;
290
+ toJSON(message: T): unknown;
291
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
292
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
293
+ }