@aptre/protobuf-es-lite 0.2.12 → 0.2.13

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.
@@ -34,7 +34,6 @@ export const protobufPackage = "google.protobuf";
34
34
  /**
35
35
  * The syntax in which a protocol buffer element is defined.
36
36
  *
37
- *
38
37
  * @generated from enum google.protobuf.Syntax
39
38
  */
40
39
  export var Syntax;
@@ -42,21 +41,18 @@ export var Syntax;
42
41
  /**
43
42
  * Syntax `proto2`.
44
43
  *
45
- *
46
44
  * @generated from enum value: SYNTAX_PROTO2 = 0;
47
45
  */
48
46
  Syntax[Syntax["PROTO2"] = 0] = "PROTO2";
49
47
  /**
50
48
  * Syntax `proto3`.
51
49
  *
52
- *
53
50
  * @generated from enum value: SYNTAX_PROTO3 = 1;
54
51
  */
55
52
  Syntax[Syntax["PROTO3"] = 1] = "PROTO3";
56
53
  /**
57
54
  * Syntax `editions`.
58
55
  *
59
- *
60
56
  * @generated from enum value: SYNTAX_EDITIONS = 2;
61
57
  */
62
58
  Syntax[Syntax["EDITIONS"] = 2] = "EDITIONS";
@@ -70,7 +66,6 @@ export const Syntax_Enum = createEnumType("google.protobuf.Syntax", [
70
66
  /**
71
67
  * Basic field types.
72
68
  *
73
- *
74
69
  * @generated from enum google.protobuf.Field.Kind
75
70
  */
76
71
  export var Field_Kind;
@@ -78,133 +73,114 @@ export var Field_Kind;
78
73
  /**
79
74
  * Field type unknown.
80
75
  *
81
- *
82
76
  * @generated from enum value: TYPE_UNKNOWN = 0;
83
77
  */
84
78
  Field_Kind[Field_Kind["TYPE_UNKNOWN"] = 0] = "TYPE_UNKNOWN";
85
79
  /**
86
80
  * Field type double.
87
81
  *
88
- *
89
82
  * @generated from enum value: TYPE_DOUBLE = 1;
90
83
  */
91
84
  Field_Kind[Field_Kind["TYPE_DOUBLE"] = 1] = "TYPE_DOUBLE";
92
85
  /**
93
86
  * Field type float.
94
87
  *
95
- *
96
88
  * @generated from enum value: TYPE_FLOAT = 2;
97
89
  */
98
90
  Field_Kind[Field_Kind["TYPE_FLOAT"] = 2] = "TYPE_FLOAT";
99
91
  /**
100
92
  * Field type int64.
101
93
  *
102
- *
103
94
  * @generated from enum value: TYPE_INT64 = 3;
104
95
  */
105
96
  Field_Kind[Field_Kind["TYPE_INT64"] = 3] = "TYPE_INT64";
106
97
  /**
107
98
  * Field type uint64.
108
99
  *
109
- *
110
100
  * @generated from enum value: TYPE_UINT64 = 4;
111
101
  */
112
102
  Field_Kind[Field_Kind["TYPE_UINT64"] = 4] = "TYPE_UINT64";
113
103
  /**
114
104
  * Field type int32.
115
105
  *
116
- *
117
106
  * @generated from enum value: TYPE_INT32 = 5;
118
107
  */
119
108
  Field_Kind[Field_Kind["TYPE_INT32"] = 5] = "TYPE_INT32";
120
109
  /**
121
110
  * Field type fixed64.
122
111
  *
123
- *
124
112
  * @generated from enum value: TYPE_FIXED64 = 6;
125
113
  */
126
114
  Field_Kind[Field_Kind["TYPE_FIXED64"] = 6] = "TYPE_FIXED64";
127
115
  /**
128
116
  * Field type fixed32.
129
117
  *
130
- *
131
118
  * @generated from enum value: TYPE_FIXED32 = 7;
132
119
  */
133
120
  Field_Kind[Field_Kind["TYPE_FIXED32"] = 7] = "TYPE_FIXED32";
134
121
  /**
135
122
  * Field type bool.
136
123
  *
137
- *
138
124
  * @generated from enum value: TYPE_BOOL = 8;
139
125
  */
140
126
  Field_Kind[Field_Kind["TYPE_BOOL"] = 8] = "TYPE_BOOL";
141
127
  /**
142
128
  * Field type string.
143
129
  *
144
- *
145
130
  * @generated from enum value: TYPE_STRING = 9;
146
131
  */
147
132
  Field_Kind[Field_Kind["TYPE_STRING"] = 9] = "TYPE_STRING";
148
133
  /**
149
134
  * Field type group. Proto2 syntax only, and deprecated.
150
135
  *
151
- *
152
136
  * @generated from enum value: TYPE_GROUP = 10;
153
137
  */
154
138
  Field_Kind[Field_Kind["TYPE_GROUP"] = 10] = "TYPE_GROUP";
155
139
  /**
156
140
  * Field type message.
157
141
  *
158
- *
159
142
  * @generated from enum value: TYPE_MESSAGE = 11;
160
143
  */
161
144
  Field_Kind[Field_Kind["TYPE_MESSAGE"] = 11] = "TYPE_MESSAGE";
162
145
  /**
163
146
  * Field type bytes.
164
147
  *
165
- *
166
148
  * @generated from enum value: TYPE_BYTES = 12;
167
149
  */
168
150
  Field_Kind[Field_Kind["TYPE_BYTES"] = 12] = "TYPE_BYTES";
169
151
  /**
170
152
  * Field type uint32.
171
153
  *
172
- *
173
154
  * @generated from enum value: TYPE_UINT32 = 13;
174
155
  */
175
156
  Field_Kind[Field_Kind["TYPE_UINT32"] = 13] = "TYPE_UINT32";
176
157
  /**
177
158
  * Field type enum.
178
159
  *
179
- *
180
160
  * @generated from enum value: TYPE_ENUM = 14;
181
161
  */
182
162
  Field_Kind[Field_Kind["TYPE_ENUM"] = 14] = "TYPE_ENUM";
183
163
  /**
184
164
  * Field type sfixed32.
185
165
  *
186
- *
187
166
  * @generated from enum value: TYPE_SFIXED32 = 15;
188
167
  */
189
168
  Field_Kind[Field_Kind["TYPE_SFIXED32"] = 15] = "TYPE_SFIXED32";
190
169
  /**
191
170
  * Field type sfixed64.
192
171
  *
193
- *
194
172
  * @generated from enum value: TYPE_SFIXED64 = 16;
195
173
  */
196
174
  Field_Kind[Field_Kind["TYPE_SFIXED64"] = 16] = "TYPE_SFIXED64";
197
175
  /**
198
176
  * Field type sint32.
199
177
  *
200
- *
201
178
  * @generated from enum value: TYPE_SINT32 = 17;
202
179
  */
203
180
  Field_Kind[Field_Kind["TYPE_SINT32"] = 17] = "TYPE_SINT32";
204
181
  /**
205
182
  * Field type sint64.
206
183
  *
207
- *
208
184
  * @generated from enum value: TYPE_SINT64 = 18;
209
185
  */
210
186
  Field_Kind[Field_Kind["TYPE_SINT64"] = 18] = "TYPE_SINT64";
@@ -234,7 +210,6 @@ export const Field_Kind_Enum = createEnumType("google.protobuf.Field.Kind", [
234
210
  /**
235
211
  * Whether a field is optional, required, or repeated.
236
212
  *
237
- *
238
213
  * @generated from enum google.protobuf.Field.Cardinality
239
214
  */
240
215
  export var Field_Cardinality;
@@ -242,28 +217,24 @@ export var Field_Cardinality;
242
217
  /**
243
218
  * For fields with unknown cardinality.
244
219
  *
245
- *
246
220
  * @generated from enum value: CARDINALITY_UNKNOWN = 0;
247
221
  */
248
222
  Field_Cardinality[Field_Cardinality["UNKNOWN"] = 0] = "UNKNOWN";
249
223
  /**
250
224
  * For optional fields.
251
225
  *
252
- *
253
226
  * @generated from enum value: CARDINALITY_OPTIONAL = 1;
254
227
  */
255
228
  Field_Cardinality[Field_Cardinality["OPTIONAL"] = 1] = "OPTIONAL";
256
229
  /**
257
230
  * For required fields. Proto2 syntax only.
258
231
  *
259
- *
260
232
  * @generated from enum value: CARDINALITY_REQUIRED = 2;
261
233
  */
262
234
  Field_Cardinality[Field_Cardinality["REQUIRED"] = 2] = "REQUIRED";
263
235
  /**
264
236
  * For repeated fields.
265
237
  *
266
- *
267
238
  * @generated from enum value: CARDINALITY_REPEATED = 3;
268
239
  */
269
240
  Field_Cardinality[Field_Cardinality["REPEATED"] = 3] = "REPEATED";
@@ -293,20 +264,9 @@ export const Field = createMessageType({
293
264
  { no: 6, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
294
265
  { no: 7, name: "oneof_index", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
295
266
  { no: 8, name: "packed", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
296
- {
297
- no: 9,
298
- name: "options",
299
- kind: "message",
300
- T: () => Option,
301
- repeated: true,
302
- },
267
+ { no: 9, name: "options", kind: "message", T: () => Option, repeated: true },
303
268
  { no: 10, name: "json_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
304
- {
305
- no: 11,
306
- name: "default_value",
307
- kind: "scalar",
308
- T: 9 /* ScalarType.STRING */,
309
- },
269
+ { no: 11, name: "default_value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
310
270
  ],
311
271
  packedByDefault: true,
312
272
  });
@@ -315,20 +275,8 @@ export const Type = createMessageType({
315
275
  fields: [
316
276
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
317
277
  { no: 2, name: "fields", kind: "message", T: () => Field, repeated: true },
318
- {
319
- no: 3,
320
- name: "oneofs",
321
- kind: "scalar",
322
- T: 9 /* ScalarType.STRING */,
323
- repeated: true,
324
- },
325
- {
326
- no: 4,
327
- name: "options",
328
- kind: "message",
329
- T: () => Option,
330
- repeated: true,
331
- },
278
+ { no: 3, name: "oneofs", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
279
+ { no: 4, name: "options", kind: "message", T: () => Option, repeated: true },
332
280
  { no: 5, name: "source_context", kind: "message", T: () => SourceContext },
333
281
  { no: 6, name: "syntax", kind: "enum", T: Syntax_Enum },
334
282
  { no: 7, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -340,13 +288,7 @@ export const EnumValue = createMessageType({
340
288
  fields: [
341
289
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
342
290
  { no: 2, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
343
- {
344
- no: 3,
345
- name: "options",
346
- kind: "message",
347
- T: () => Option,
348
- repeated: true,
349
- },
291
+ { no: 3, name: "options", kind: "message", T: () => Option, repeated: true },
350
292
  ],
351
293
  packedByDefault: true,
352
294
  });
@@ -354,20 +296,8 @@ export const Enum = createMessageType({
354
296
  typeName: "google.protobuf.Enum",
355
297
  fields: [
356
298
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
357
- {
358
- no: 2,
359
- name: "enumvalue",
360
- kind: "message",
361
- T: () => EnumValue,
362
- repeated: true,
363
- },
364
- {
365
- no: 3,
366
- name: "options",
367
- kind: "message",
368
- T: () => Option,
369
- repeated: true,
370
- },
299
+ { no: 2, name: "enumvalue", kind: "message", T: () => EnumValue, repeated: true },
300
+ { no: 3, name: "options", kind: "message", T: () => Option, repeated: true },
371
301
  { no: 4, name: "source_context", kind: "message", T: () => SourceContext },
372
302
  { no: 5, name: "syntax", kind: "enum", T: Syntax_Enum },
373
303
  { no: 6, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -8,15 +8,13 @@ export declare const protobufPackage = "google.protobuf";
8
8
  *
9
9
  * protobuf-go-lite:disable-text
10
10
  *
11
- *
12
11
  * @generated from message google.protobuf.DoubleValue
13
12
  */
14
13
  export type DoubleValue = Message<{
15
14
  /**
16
15
  * The double value.
17
16
  *
18
- *
19
- * @generated from field: double value = 1 [packed = false, default = , jstype = JS_NORMAL];
17
+ * @generated from field: double value = 1;
20
18
  */
21
19
  value?: number;
22
20
  }>;
@@ -28,15 +26,13 @@ export declare const DoubleValue: MessageType<DoubleValue>;
28
26
  *
29
27
  * protobuf-go-lite:disable-text
30
28
  *
31
- *
32
29
  * @generated from message google.protobuf.FloatValue
33
30
  */
34
31
  export type FloatValue = Message<{
35
32
  /**
36
33
  * The float value.
37
34
  *
38
- *
39
- * @generated from field: float value = 1 [packed = false, default = , jstype = JS_NORMAL];
35
+ * @generated from field: float value = 1;
40
36
  */
41
37
  value?: number;
42
38
  }>;
@@ -48,15 +44,13 @@ export declare const FloatValue: MessageType<FloatValue>;
48
44
  *
49
45
  * protobuf-go-lite:disable-text
50
46
  *
51
- *
52
47
  * @generated from message google.protobuf.Int64Value
53
48
  */
54
49
  export type Int64Value = Message<{
55
50
  /**
56
51
  * The int64 value.
57
52
  *
58
- *
59
- * @generated from field: int64 value = 1 [packed = false, default = , jstype = JS_NORMAL];
53
+ * @generated from field: int64 value = 1;
60
54
  */
61
55
  value?: bigint;
62
56
  }>;
@@ -68,15 +62,13 @@ export declare const Int64Value: MessageType<Int64Value>;
68
62
  *
69
63
  * protobuf-go-lite:disable-text
70
64
  *
71
- *
72
65
  * @generated from message google.protobuf.UInt64Value
73
66
  */
74
67
  export type UInt64Value = Message<{
75
68
  /**
76
69
  * The uint64 value.
77
70
  *
78
- *
79
- * @generated from field: uint64 value = 1 [packed = false, default = , jstype = JS_NORMAL];
71
+ * @generated from field: uint64 value = 1;
80
72
  */
81
73
  value?: bigint;
82
74
  }>;
@@ -88,15 +80,13 @@ export declare const UInt64Value: MessageType<UInt64Value>;
88
80
  *
89
81
  * protobuf-go-lite:disable-text
90
82
  *
91
- *
92
83
  * @generated from message google.protobuf.Int32Value
93
84
  */
94
85
  export type Int32Value = Message<{
95
86
  /**
96
87
  * The int32 value.
97
88
  *
98
- *
99
- * @generated from field: int32 value = 1 [packed = false, default = , jstype = JS_NORMAL];
89
+ * @generated from field: int32 value = 1;
100
90
  */
101
91
  value?: number;
102
92
  }>;
@@ -108,15 +98,13 @@ export declare const Int32Value: MessageType<Int32Value>;
108
98
  *
109
99
  * protobuf-go-lite:disable-text
110
100
  *
111
- *
112
101
  * @generated from message google.protobuf.UInt32Value
113
102
  */
114
103
  export type UInt32Value = Message<{
115
104
  /**
116
105
  * The uint32 value.
117
106
  *
118
- *
119
- * @generated from field: uint32 value = 1 [packed = false, default = , jstype = JS_NORMAL];
107
+ * @generated from field: uint32 value = 1;
120
108
  */
121
109
  value?: number;
122
110
  }>;
@@ -128,15 +116,13 @@ export declare const UInt32Value: MessageType<UInt32Value>;
128
116
  *
129
117
  * protobuf-go-lite:disable-text
130
118
  *
131
- *
132
119
  * @generated from message google.protobuf.BoolValue
133
120
  */
134
121
  export type BoolValue = Message<{
135
122
  /**
136
123
  * The bool value.
137
124
  *
138
- *
139
- * @generated from field: bool value = 1 [packed = false, default = , jstype = JS_NORMAL];
125
+ * @generated from field: bool value = 1;
140
126
  */
141
127
  value?: boolean;
142
128
  }>;
@@ -148,15 +134,13 @@ export declare const BoolValue: MessageType<BoolValue>;
148
134
  *
149
135
  * protobuf-go-lite:disable-text
150
136
  *
151
- *
152
137
  * @generated from message google.protobuf.StringValue
153
138
  */
154
139
  export type StringValue = Message<{
155
140
  /**
156
141
  * The string value.
157
142
  *
158
- *
159
- * @generated from field: string value = 1 [packed = false, default = "", jstype = JS_NORMAL];
143
+ * @generated from field: string value = 1;
160
144
  */
161
145
  value?: string;
162
146
  }>;
@@ -168,15 +152,13 @@ export declare const StringValue: MessageType<StringValue>;
168
152
  *
169
153
  * protobuf-go-lite:disable-text
170
154
  *
171
- *
172
155
  * @generated from message google.protobuf.BytesValue
173
156
  */
174
157
  export type BytesValue = Message<{
175
158
  /**
176
159
  * The bytes value.
177
160
  *
178
- *
179
- * @generated from field: bytes value = 1 [packed = false, default = "", jstype = JS_NORMAL];
161
+ * @generated from field: bytes value = 1;
180
162
  */
181
163
  value?: Uint8Array;
182
164
  }>;
package/dist/message.d.ts CHANGED
@@ -25,7 +25,7 @@ export type AnyMessage = {
25
25
  * - metadata for reflection-based operations
26
26
  * - common functionality like serialization
27
27
  */
28
- export interface MessageType<T extends Message<T>> {
28
+ export interface MessageType<T extends Message<T> = AnyMessage> {
29
29
  /**
30
30
  * The fully qualified name of the message.
31
31
  */
@@ -45,7 +45,7 @@ export interface MessageType<T extends Message<T>> {
45
45
  /**
46
46
  * Create a deep copy.
47
47
  */
48
- clone(a: T | undefined | null): T | undefined | null;
48
+ clone(a: Message<T> | undefined | null): Message<T> | undefined | null;
49
49
  /**
50
50
  * Parse from binary data, merging fields.
51
51
  *
@@ -55,33 +55,33 @@ export interface MessageType<T extends Message<T>> {
55
55
  * If a message field is already present, it will be merged with the
56
56
  * new data.
57
57
  */
58
- fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): T;
58
+ fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Message<T>;
59
59
  /**
60
60
  * Parse a message from a JSON value.
61
61
  */
62
- fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): T;
62
+ fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Message<T>;
63
63
  /**
64
64
  * Parse a message from a JSON string.
65
65
  */
66
- fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): T;
66
+ fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Message<T>;
67
67
  /**
68
68
  * Returns true if the given arguments have equal field values, recursively.
69
69
  * Will also return true if both messages are `undefined` or `null`.
70
70
  */
71
- equals(a: T | undefined | null, b: T | undefined | null): boolean;
71
+ equals(a: Message<T> | undefined | null, b: Message<T> | undefined | null): boolean;
72
72
  /**
73
73
  * Serialize the message to binary data.
74
74
  */
75
- toBinary(a: T, options?: Partial<BinaryWriteOptions>): Uint8Array;
75
+ toBinary(a: Message<T>, options?: Partial<BinaryWriteOptions>): Uint8Array;
76
76
  /**
77
77
  * Serialize the message to a JSON value, a JavaScript value that can be
78
78
  * passed to JSON.stringify().
79
79
  */
80
- toJson(a: T, options?: Partial<JsonWriteOptions>): JsonValue;
80
+ toJson(a: Message<T>, options?: Partial<JsonWriteOptions>): JsonValue;
81
81
  /**
82
82
  * Serialize the message to a JSON string.
83
83
  */
84
- toJsonString(a: T, options?: Partial<JsonWriteStringOptions>): string;
84
+ toJsonString(a: Message<T>, options?: Partial<JsonWriteStringOptions>): string;
85
85
  }
86
86
  export interface MessageTypeParams<T extends Message<T>> extends Pick<MessageType<T>, "typeName" | "fieldWrapper"> {
87
87
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aptre/protobuf-es-lite",
3
3
  "description": "Lightweight Protobuf codegen for TypeScript and JavaScript.",
4
- "version": "0.2.12",
4
+ "version": "0.2.13",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "url": "git+ssh://git@github.com/aperturerobotics/protobuf-es-lite.git"