@shock-cinema/contracts 1.0.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.
- package/gen/auth.ts +202 -0
- package/gen/google/protobuf/any.ts +259 -0
- package/gen/google/protobuf/duration.ts +200 -0
- package/gen/google/protobuf/empty.ts +86 -0
- package/gen/google/protobuf/struct.ts +591 -0
- package/gen/google/protobuf/timestamp.ts +230 -0
- package/gen/test.ts +589 -0
- package/package.json +22 -0
- package/proto/auth.proto +16 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: google/protobuf/empty.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "google.protobuf";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A generic empty message that you can re-use to avoid defining duplicated
|
|
14
|
+
* empty messages in your APIs. A typical example is to use it as the request
|
|
15
|
+
* or the response type of an API method. For instance:
|
|
16
|
+
*
|
|
17
|
+
* service Foo {
|
|
18
|
+
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export interface Empty {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function createBaseEmpty(): Empty {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Empty: MessageFns<Empty> = {
|
|
29
|
+
encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
30
|
+
return writer;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Empty {
|
|
34
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
36
|
+
const message = createBaseEmpty();
|
|
37
|
+
while (reader.pos < end) {
|
|
38
|
+
const tag = reader.uint32();
|
|
39
|
+
switch (tag >>> 3) {
|
|
40
|
+
}
|
|
41
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
reader.skip(tag & 7);
|
|
45
|
+
}
|
|
46
|
+
return message;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
fromJSON(_: any): Empty {
|
|
50
|
+
return {};
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
toJSON(_: Empty): unknown {
|
|
54
|
+
const obj: any = {};
|
|
55
|
+
return obj;
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
create<I extends Exact<DeepPartial<Empty>, I>>(base?: I): Empty {
|
|
59
|
+
return Empty.fromPartial(base ?? ({} as any));
|
|
60
|
+
},
|
|
61
|
+
fromPartial<I extends Exact<DeepPartial<Empty>, I>>(_: I): Empty {
|
|
62
|
+
const message = createBaseEmpty();
|
|
63
|
+
return message;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
68
|
+
|
|
69
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
70
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
71
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
72
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
73
|
+
: Partial<T>;
|
|
74
|
+
|
|
75
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
76
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
77
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
78
|
+
|
|
79
|
+
export interface MessageFns<T> {
|
|
80
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
81
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
82
|
+
fromJSON(object: any): T;
|
|
83
|
+
toJSON(message: T): unknown;
|
|
84
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
85
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
86
|
+
}
|
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: google/protobuf/struct.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "google.protobuf";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
14
|
+
* `Value` type union.
|
|
15
|
+
*
|
|
16
|
+
* The JSON representation for `NullValue` is JSON `null`.
|
|
17
|
+
*/
|
|
18
|
+
export enum NullValue {
|
|
19
|
+
/** NULL_VALUE - Null value. */
|
|
20
|
+
NULL_VALUE = 0,
|
|
21
|
+
UNRECOGNIZED = -1,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function nullValueFromJSON(object: any): NullValue {
|
|
25
|
+
switch (object) {
|
|
26
|
+
case 0:
|
|
27
|
+
case "NULL_VALUE":
|
|
28
|
+
return NullValue.NULL_VALUE;
|
|
29
|
+
case -1:
|
|
30
|
+
case "UNRECOGNIZED":
|
|
31
|
+
default:
|
|
32
|
+
return NullValue.UNRECOGNIZED;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function nullValueToJSON(object: NullValue): string {
|
|
37
|
+
switch (object) {
|
|
38
|
+
case NullValue.NULL_VALUE:
|
|
39
|
+
return "NULL_VALUE";
|
|
40
|
+
case NullValue.UNRECOGNIZED:
|
|
41
|
+
default:
|
|
42
|
+
return "UNRECOGNIZED";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `Struct` represents a structured data value, consisting of fields
|
|
48
|
+
* which map to dynamically typed values. In some languages, `Struct`
|
|
49
|
+
* might be supported by a native representation. For example, in
|
|
50
|
+
* scripting languages like JS a struct is represented as an
|
|
51
|
+
* object. The details of that representation are described together
|
|
52
|
+
* with the proto support for the language.
|
|
53
|
+
*
|
|
54
|
+
* The JSON representation for `Struct` is JSON object.
|
|
55
|
+
*/
|
|
56
|
+
export interface Struct {
|
|
57
|
+
/** Unordered map of dynamically typed values. */
|
|
58
|
+
fields: { [key: string]: any | undefined };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface Struct_FieldsEntry {
|
|
62
|
+
key: string;
|
|
63
|
+
value: any | undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `Value` represents a dynamically typed value which can be either
|
|
68
|
+
* null, a number, a string, a boolean, a recursive struct value, or a
|
|
69
|
+
* list of values. A producer of value is expected to set one of these
|
|
70
|
+
* variants. Absence of any variant indicates an error.
|
|
71
|
+
*
|
|
72
|
+
* The JSON representation for `Value` is JSON value.
|
|
73
|
+
*/
|
|
74
|
+
export interface Value {
|
|
75
|
+
/** Represents a null value. */
|
|
76
|
+
nullValue?:
|
|
77
|
+
| NullValue
|
|
78
|
+
| undefined;
|
|
79
|
+
/** Represents a double value. */
|
|
80
|
+
numberValue?:
|
|
81
|
+
| number
|
|
82
|
+
| undefined;
|
|
83
|
+
/** Represents a string value. */
|
|
84
|
+
stringValue?:
|
|
85
|
+
| string
|
|
86
|
+
| undefined;
|
|
87
|
+
/** Represents a boolean value. */
|
|
88
|
+
boolValue?:
|
|
89
|
+
| boolean
|
|
90
|
+
| undefined;
|
|
91
|
+
/** Represents a structured value. */
|
|
92
|
+
structValue?:
|
|
93
|
+
| { [key: string]: any }
|
|
94
|
+
| undefined;
|
|
95
|
+
/** Represents a repeated `Value`. */
|
|
96
|
+
listValue?: Array<any> | undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* `ListValue` is a wrapper around a repeated field of values.
|
|
101
|
+
*
|
|
102
|
+
* The JSON representation for `ListValue` is JSON array.
|
|
103
|
+
*/
|
|
104
|
+
export interface ListValue {
|
|
105
|
+
/** Repeated field of dynamically typed values. */
|
|
106
|
+
values: any[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function createBaseStruct(): Struct {
|
|
110
|
+
return { fields: {} };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const Struct: MessageFns<Struct> & StructWrapperFns = {
|
|
114
|
+
encode(message: Struct, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
115
|
+
globalThis.Object.entries(message.fields).forEach(([key, value]: [string, any | undefined]) => {
|
|
116
|
+
if (value !== undefined) {
|
|
117
|
+
Struct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return writer;
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Struct {
|
|
124
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
125
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
126
|
+
const message = createBaseStruct();
|
|
127
|
+
while (reader.pos < end) {
|
|
128
|
+
const tag = reader.uint32();
|
|
129
|
+
switch (tag >>> 3) {
|
|
130
|
+
case 1: {
|
|
131
|
+
if (tag !== 10) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
|
|
136
|
+
if (entry1.value !== undefined) {
|
|
137
|
+
message.fields[entry1.key] = entry1.value;
|
|
138
|
+
}
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
reader.skip(tag & 7);
|
|
146
|
+
}
|
|
147
|
+
return message;
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
fromJSON(object: any): Struct {
|
|
151
|
+
return {
|
|
152
|
+
fields: isObject(object.fields)
|
|
153
|
+
? (globalThis.Object.entries(object.fields) as [string, any][]).reduce(
|
|
154
|
+
(acc: { [key: string]: any | undefined }, [key, value]: [string, any]) => {
|
|
155
|
+
acc[key] = value as any | undefined;
|
|
156
|
+
return acc;
|
|
157
|
+
},
|
|
158
|
+
{},
|
|
159
|
+
)
|
|
160
|
+
: {},
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
toJSON(message: Struct): unknown {
|
|
165
|
+
const obj: any = {};
|
|
166
|
+
if (message.fields) {
|
|
167
|
+
const entries = globalThis.Object.entries(message.fields) as [string, any | undefined][];
|
|
168
|
+
if (entries.length > 0) {
|
|
169
|
+
obj.fields = {};
|
|
170
|
+
entries.forEach(([k, v]) => {
|
|
171
|
+
obj.fields[k] = v;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return obj;
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
create<I extends Exact<DeepPartial<Struct>, I>>(base?: I): Struct {
|
|
179
|
+
return Struct.fromPartial(base ?? ({} as any));
|
|
180
|
+
},
|
|
181
|
+
fromPartial<I extends Exact<DeepPartial<Struct>, I>>(object: I): Struct {
|
|
182
|
+
const message = createBaseStruct();
|
|
183
|
+
message.fields = (globalThis.Object.entries(object.fields ?? {}) as [string, any | undefined][]).reduce(
|
|
184
|
+
(acc: { [key: string]: any | undefined }, [key, value]: [string, any | undefined]) => {
|
|
185
|
+
if (value !== undefined) {
|
|
186
|
+
acc[key] = value;
|
|
187
|
+
}
|
|
188
|
+
return acc;
|
|
189
|
+
},
|
|
190
|
+
{},
|
|
191
|
+
);
|
|
192
|
+
return message;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
wrap(object: { [key: string]: any } | undefined): Struct {
|
|
196
|
+
const struct = createBaseStruct();
|
|
197
|
+
|
|
198
|
+
if (object !== undefined) {
|
|
199
|
+
for (const key of globalThis.Object.keys(object)) {
|
|
200
|
+
struct.fields[key] = object[key];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return struct;
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
unwrap(message: Struct): { [key: string]: any } {
|
|
207
|
+
const object: { [key: string]: any } = {};
|
|
208
|
+
if (message.fields) {
|
|
209
|
+
for (const key of globalThis.Object.keys(message.fields)) {
|
|
210
|
+
object[key] = message.fields[key];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return object;
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
function createBaseStruct_FieldsEntry(): Struct_FieldsEntry {
|
|
218
|
+
return { key: "", value: undefined };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const Struct_FieldsEntry: MessageFns<Struct_FieldsEntry> = {
|
|
222
|
+
encode(message: Struct_FieldsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
223
|
+
if (message.key !== "") {
|
|
224
|
+
writer.uint32(10).string(message.key);
|
|
225
|
+
}
|
|
226
|
+
if (message.value !== undefined) {
|
|
227
|
+
Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join();
|
|
228
|
+
}
|
|
229
|
+
return writer;
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Struct_FieldsEntry {
|
|
233
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
234
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
235
|
+
const message = createBaseStruct_FieldsEntry();
|
|
236
|
+
while (reader.pos < end) {
|
|
237
|
+
const tag = reader.uint32();
|
|
238
|
+
switch (tag >>> 3) {
|
|
239
|
+
case 1: {
|
|
240
|
+
if (tag !== 10) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
message.key = reader.string();
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
case 2: {
|
|
248
|
+
if (tag !== 18) {
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
reader.skip(tag & 7);
|
|
260
|
+
}
|
|
261
|
+
return message;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
fromJSON(object: any): Struct_FieldsEntry {
|
|
265
|
+
return {
|
|
266
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
267
|
+
value: isSet(object?.value) ? object.value : undefined,
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
toJSON(message: Struct_FieldsEntry): unknown {
|
|
272
|
+
const obj: any = {};
|
|
273
|
+
if (message.key !== "") {
|
|
274
|
+
obj.key = message.key;
|
|
275
|
+
}
|
|
276
|
+
if (message.value !== undefined) {
|
|
277
|
+
obj.value = message.value;
|
|
278
|
+
}
|
|
279
|
+
return obj;
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
create<I extends Exact<DeepPartial<Struct_FieldsEntry>, I>>(base?: I): Struct_FieldsEntry {
|
|
283
|
+
return Struct_FieldsEntry.fromPartial(base ?? ({} as any));
|
|
284
|
+
},
|
|
285
|
+
fromPartial<I extends Exact<DeepPartial<Struct_FieldsEntry>, I>>(object: I): Struct_FieldsEntry {
|
|
286
|
+
const message = createBaseStruct_FieldsEntry();
|
|
287
|
+
message.key = object.key ?? "";
|
|
288
|
+
message.value = object.value ?? undefined;
|
|
289
|
+
return message;
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
function createBaseValue(): Value {
|
|
294
|
+
return {
|
|
295
|
+
nullValue: undefined,
|
|
296
|
+
numberValue: undefined,
|
|
297
|
+
stringValue: undefined,
|
|
298
|
+
boolValue: undefined,
|
|
299
|
+
structValue: undefined,
|
|
300
|
+
listValue: undefined,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export const Value: MessageFns<Value> & AnyValueWrapperFns = {
|
|
305
|
+
encode(message: Value, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
306
|
+
if (message.nullValue !== undefined) {
|
|
307
|
+
writer.uint32(8).int32(message.nullValue);
|
|
308
|
+
}
|
|
309
|
+
if (message.numberValue !== undefined) {
|
|
310
|
+
writer.uint32(17).double(message.numberValue);
|
|
311
|
+
}
|
|
312
|
+
if (message.stringValue !== undefined) {
|
|
313
|
+
writer.uint32(26).string(message.stringValue);
|
|
314
|
+
}
|
|
315
|
+
if (message.boolValue !== undefined) {
|
|
316
|
+
writer.uint32(32).bool(message.boolValue);
|
|
317
|
+
}
|
|
318
|
+
if (message.structValue !== undefined) {
|
|
319
|
+
Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).join();
|
|
320
|
+
}
|
|
321
|
+
if (message.listValue !== undefined) {
|
|
322
|
+
ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).join();
|
|
323
|
+
}
|
|
324
|
+
return writer;
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Value {
|
|
328
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
329
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
330
|
+
const message = createBaseValue();
|
|
331
|
+
while (reader.pos < end) {
|
|
332
|
+
const tag = reader.uint32();
|
|
333
|
+
switch (tag >>> 3) {
|
|
334
|
+
case 1: {
|
|
335
|
+
if (tag !== 8) {
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
message.nullValue = reader.int32() as any;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
case 2: {
|
|
343
|
+
if (tag !== 17) {
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
message.numberValue = reader.double();
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
case 3: {
|
|
351
|
+
if (tag !== 26) {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
message.stringValue = reader.string();
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
case 4: {
|
|
359
|
+
if (tag !== 32) {
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
message.boolValue = reader.bool();
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
case 5: {
|
|
367
|
+
if (tag !== 42) {
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
case 6: {
|
|
375
|
+
if (tag !== 50) {
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
reader.skip(tag & 7);
|
|
387
|
+
}
|
|
388
|
+
return message;
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
fromJSON(object: any): Value {
|
|
392
|
+
return {
|
|
393
|
+
nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined,
|
|
394
|
+
numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined,
|
|
395
|
+
stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined,
|
|
396
|
+
boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined,
|
|
397
|
+
structValue: isObject(object.structValue) ? object.structValue : undefined,
|
|
398
|
+
listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : undefined,
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
toJSON(message: Value): unknown {
|
|
403
|
+
const obj: any = {};
|
|
404
|
+
if (message.nullValue !== undefined) {
|
|
405
|
+
obj.nullValue = nullValueToJSON(message.nullValue);
|
|
406
|
+
}
|
|
407
|
+
if (message.numberValue !== undefined) {
|
|
408
|
+
obj.numberValue = message.numberValue;
|
|
409
|
+
}
|
|
410
|
+
if (message.stringValue !== undefined) {
|
|
411
|
+
obj.stringValue = message.stringValue;
|
|
412
|
+
}
|
|
413
|
+
if (message.boolValue !== undefined) {
|
|
414
|
+
obj.boolValue = message.boolValue;
|
|
415
|
+
}
|
|
416
|
+
if (message.structValue !== undefined) {
|
|
417
|
+
obj.structValue = message.structValue;
|
|
418
|
+
}
|
|
419
|
+
if (message.listValue !== undefined) {
|
|
420
|
+
obj.listValue = message.listValue;
|
|
421
|
+
}
|
|
422
|
+
return obj;
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
create<I extends Exact<DeepPartial<Value>, I>>(base?: I): Value {
|
|
426
|
+
return Value.fromPartial(base ?? ({} as any));
|
|
427
|
+
},
|
|
428
|
+
fromPartial<I extends Exact<DeepPartial<Value>, I>>(object: I): Value {
|
|
429
|
+
const message = createBaseValue();
|
|
430
|
+
message.nullValue = object.nullValue ?? undefined;
|
|
431
|
+
message.numberValue = object.numberValue ?? undefined;
|
|
432
|
+
message.stringValue = object.stringValue ?? undefined;
|
|
433
|
+
message.boolValue = object.boolValue ?? undefined;
|
|
434
|
+
message.structValue = object.structValue ?? undefined;
|
|
435
|
+
message.listValue = object.listValue ?? undefined;
|
|
436
|
+
return message;
|
|
437
|
+
},
|
|
438
|
+
|
|
439
|
+
wrap(value: any): Value {
|
|
440
|
+
const result = createBaseValue();
|
|
441
|
+
if (value === null) {
|
|
442
|
+
result.nullValue = NullValue.NULL_VALUE;
|
|
443
|
+
} else if (typeof value === "boolean") {
|
|
444
|
+
result.boolValue = value;
|
|
445
|
+
} else if (typeof value === "number") {
|
|
446
|
+
result.numberValue = value;
|
|
447
|
+
} else if (typeof value === "string") {
|
|
448
|
+
result.stringValue = value;
|
|
449
|
+
} else if (globalThis.Array.isArray(value)) {
|
|
450
|
+
result.listValue = value;
|
|
451
|
+
} else if (typeof value === "object") {
|
|
452
|
+
result.structValue = value;
|
|
453
|
+
} else if (typeof value !== "undefined") {
|
|
454
|
+
throw new globalThis.Error("Unsupported any value type: " + typeof value);
|
|
455
|
+
}
|
|
456
|
+
return result;
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined {
|
|
460
|
+
if (message.stringValue !== undefined) {
|
|
461
|
+
return message.stringValue;
|
|
462
|
+
} else if (message?.numberValue !== undefined) {
|
|
463
|
+
return message.numberValue;
|
|
464
|
+
} else if (message?.boolValue !== undefined) {
|
|
465
|
+
return message.boolValue;
|
|
466
|
+
} else if (message?.structValue !== undefined) {
|
|
467
|
+
return message.structValue as any;
|
|
468
|
+
} else if (message?.listValue !== undefined) {
|
|
469
|
+
return message.listValue;
|
|
470
|
+
} else if (message?.nullValue !== undefined) {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
return undefined;
|
|
474
|
+
},
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
function createBaseListValue(): ListValue {
|
|
478
|
+
return { values: [] };
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export const ListValue: MessageFns<ListValue> & ListValueWrapperFns = {
|
|
482
|
+
encode(message: ListValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
483
|
+
for (const v of message.values) {
|
|
484
|
+
Value.encode(Value.wrap(v!), writer.uint32(10).fork()).join();
|
|
485
|
+
}
|
|
486
|
+
return writer;
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListValue {
|
|
490
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
491
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
492
|
+
const message = createBaseListValue();
|
|
493
|
+
while (reader.pos < end) {
|
|
494
|
+
const tag = reader.uint32();
|
|
495
|
+
switch (tag >>> 3) {
|
|
496
|
+
case 1: {
|
|
497
|
+
if (tag !== 10) {
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
reader.skip(tag & 7);
|
|
509
|
+
}
|
|
510
|
+
return message;
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
fromJSON(object: any): ListValue {
|
|
514
|
+
return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] };
|
|
515
|
+
},
|
|
516
|
+
|
|
517
|
+
toJSON(message: ListValue): unknown {
|
|
518
|
+
const obj: any = {};
|
|
519
|
+
if (message.values?.length) {
|
|
520
|
+
obj.values = message.values;
|
|
521
|
+
}
|
|
522
|
+
return obj;
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
create<I extends Exact<DeepPartial<ListValue>, I>>(base?: I): ListValue {
|
|
526
|
+
return ListValue.fromPartial(base ?? ({} as any));
|
|
527
|
+
},
|
|
528
|
+
fromPartial<I extends Exact<DeepPartial<ListValue>, I>>(object: I): ListValue {
|
|
529
|
+
const message = createBaseListValue();
|
|
530
|
+
message.values = object.values?.map((e) => e) || [];
|
|
531
|
+
return message;
|
|
532
|
+
},
|
|
533
|
+
|
|
534
|
+
wrap(array: Array<any> | undefined): ListValue {
|
|
535
|
+
const result = createBaseListValue();
|
|
536
|
+
result.values = array ?? [];
|
|
537
|
+
return result;
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
unwrap(message: ListValue): Array<any> {
|
|
541
|
+
if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) {
|
|
542
|
+
return message.values;
|
|
543
|
+
} else {
|
|
544
|
+
return message as any;
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
550
|
+
|
|
551
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
552
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
553
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
554
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
555
|
+
: Partial<T>;
|
|
556
|
+
|
|
557
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
558
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
559
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
560
|
+
|
|
561
|
+
function isObject(value: any): boolean {
|
|
562
|
+
return typeof value === "object" && value !== null;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function isSet(value: any): boolean {
|
|
566
|
+
return value !== null && value !== undefined;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export interface MessageFns<T> {
|
|
570
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
571
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
572
|
+
fromJSON(object: any): T;
|
|
573
|
+
toJSON(message: T): unknown;
|
|
574
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
575
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface StructWrapperFns {
|
|
579
|
+
wrap(object: { [key: string]: any } | undefined): Struct;
|
|
580
|
+
unwrap(message: Struct): { [key: string]: any };
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export interface AnyValueWrapperFns {
|
|
584
|
+
wrap(value: any): Value;
|
|
585
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface ListValueWrapperFns {
|
|
589
|
+
wrap(array: Array<any> | undefined): ListValue;
|
|
590
|
+
unwrap(message: ListValue): Array<any>;
|
|
591
|
+
}
|