@aptre/protobuf-es-lite 0.2.10 → 0.2.12

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 (79) hide show
  1. package/bin/protoc-gen-es-lite +2 -2
  2. package/dist/assert.js +4 -11
  3. package/dist/binary-encoding.js +69 -42
  4. package/dist/binary.js +87 -105
  5. package/dist/codegen-info.d.ts +0 -1
  6. package/dist/codegen-info.js +12 -16
  7. package/dist/create-descriptor-set.js +114 -118
  8. package/dist/descriptor-set.js +1 -2
  9. package/dist/enum.js +2 -7
  10. package/dist/feature-set.d.ts +1 -1
  11. package/dist/feature-set.js +18 -22
  12. package/dist/field-wrapper.js +12 -17
  13. package/dist/field.js +35 -34
  14. package/dist/google/index.js +9 -41
  15. package/dist/google/protobuf/any.pb.d.ts +2 -2
  16. package/dist/google/protobuf/any.pb.js +3 -6
  17. package/dist/google/protobuf/api.pb.d.ts +2 -2
  18. package/dist/google/protobuf/api.pb.js +56 -21
  19. package/dist/google/protobuf/compiler/plugin.pb.d.ts +2 -2
  20. package/dist/google/protobuf/compiler/plugin.pb.js +15 -18
  21. package/dist/google/protobuf/descriptor.pb.d.ts +19 -19
  22. package/dist/google/protobuf/descriptor.pb.js +831 -223
  23. package/dist/google/protobuf/duration.pb.d.ts +2 -2
  24. package/dist/google/protobuf/duration.pb.js +3 -6
  25. package/dist/google/protobuf/empty.pb.d.ts +2 -2
  26. package/dist/google/protobuf/empty.pb.js +3 -6
  27. package/dist/google/protobuf/source_context.pb.d.ts +2 -2
  28. package/dist/google/protobuf/source_context.pb.js +3 -6
  29. package/dist/google/protobuf/struct.pb.d.ts +3 -3
  30. package/dist/google/protobuf/struct.pb.js +31 -18
  31. package/dist/google/protobuf/timestamp.pb.d.ts +2 -2
  32. package/dist/google/protobuf/timestamp.pb.js +3 -6
  33. package/dist/google/protobuf/type.pb.d.ts +5 -5
  34. package/dist/google/protobuf/type.pb.js +74 -36
  35. package/dist/google/protobuf/wrappers.pb.d.ts +2 -2
  36. package/dist/google/protobuf/wrappers.pb.js +11 -14
  37. package/dist/index.js +12 -60
  38. package/dist/is-message.js +9 -16
  39. package/dist/json.d.ts +0 -9
  40. package/dist/json.js +72 -102
  41. package/dist/message.d.ts +3 -3
  42. package/dist/message.js +50 -57
  43. package/dist/names.js +12 -23
  44. package/dist/partial.js +15 -24
  45. package/dist/proto-base64.js +1 -4
  46. package/dist/proto-double.js +1 -4
  47. package/dist/proto-int64.js +9 -12
  48. package/dist/protoc-gen-es-lite/protoc-gen-es-lite-plugin.js +4 -7
  49. package/dist/protoc-gen-es-lite/typescript.js +27 -36
  50. package/dist/protoplugin/create-es-plugin.js +14 -18
  51. package/dist/protoplugin/ecmascript/file-preamble.js +5 -9
  52. package/dist/protoplugin/ecmascript/generated-file.js +16 -20
  53. package/dist/protoplugin/ecmascript/import-path.js +13 -20
  54. package/dist/protoplugin/ecmascript/import-symbol.js +1 -5
  55. package/dist/protoplugin/ecmascript/index.js +2 -7
  56. package/dist/protoplugin/ecmascript/jsdoc.js +1 -5
  57. package/dist/protoplugin/ecmascript/opaque-printables.js +1 -2
  58. package/dist/protoplugin/ecmascript/parameter.js +10 -14
  59. package/dist/protoplugin/ecmascript/reify-wkt.js +12 -16
  60. package/dist/protoplugin/ecmascript/runtime-imports.js +5 -9
  61. package/dist/protoplugin/ecmascript/schema.js +16 -20
  62. package/dist/protoplugin/ecmascript/target.js +1 -2
  63. package/dist/protoplugin/ecmascript/transpile.js +15 -42
  64. package/dist/protoplugin/error.js +4 -10
  65. package/dist/protoplugin/index.js +2 -7
  66. package/dist/protoplugin/plugin.js +1 -2
  67. package/dist/protoplugin/run-node.js +6 -10
  68. package/dist/scalar.js +9 -15
  69. package/dist/service-type.js +4 -7
  70. package/dist/text-format.js +25 -30
  71. package/dist/unknown.js +7 -12
  72. package/dist/util.d.ts +1 -1
  73. package/dist/util.js +49 -55
  74. package/dist/varint.js +7 -17
  75. package/example/example.pb.ts +24 -18
  76. package/package.json +10 -7
  77. package/tsconfig.base.json +3 -3
  78. package/dist/type-registry.d.ts +0 -43
  79. package/dist/type-registry.js +0 -15
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2021-2024 Buf Technologies, Inc.
3
2
  //
4
3
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,33 +11,31 @@
12
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
12
  // See the License for the specific language governing permissions and
14
13
  // limitations under the License.
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.createFeatureResolver = void 0;
17
- const descriptor_pb_js_1 = require("./google/protobuf/descriptor.pb.js");
18
- const proto_base64_js_1 = require("./proto-base64.js");
19
- const partial_js_1 = require("./partial.js");
14
+ import { Edition, FeatureSet, FeatureSetDefaults, } from "./google/protobuf/descriptor.pb.js";
15
+ import { protoBase64 } from "./proto-base64.js";
16
+ import { applyPartialMessage } from "./partial.js";
20
17
  /**
21
- * Return the edition feature defaults supported by @bufbuild/protobuf.
18
+ * Return the edition feature defaults supported by @aptre/protobuf-es-lite.
22
19
  */
23
20
  function getFeatureSetDefaults(options) {
24
- return descriptor_pb_js_1.FeatureSetDefaults.fromBinary(proto_base64_js_1.protoBase64.dec("ChESDAgBEAIYAiADKAEwAhjmBwoREgwIAhABGAEgAigBMAEY5wcKERIMCAEQARgBIAIoATABGOgHIOYHKOgH"), options);
21
+ return FeatureSetDefaults.fromBinary(protoBase64.dec("ChESDAgBEAIYAiADKAEwAhjmBwoREgwIAhABGAEgAigBMAEY5wcKERIMCAEQARgBIAIoATABGOgHIOYHKOgH"), options);
25
22
  }
26
23
  /**
27
24
  * Create an edition feature resolver with the given feature set defaults, or
28
- * the feature set defaults supported by @bufbuild/protobuf.
25
+ * the feature set defaults supported by @aptre/protobuf-es-lite.
29
26
  */
30
- function createFeatureResolver(edition, compiledFeatureSetDefaults, serializationOptions) {
31
- const fds = descriptor_pb_js_1.FeatureSetDefaults.create(compiledFeatureSetDefaults ?? getFeatureSetDefaults(serializationOptions));
27
+ export function createFeatureResolver(edition, compiledFeatureSetDefaults, serializationOptions) {
28
+ const fds = FeatureSetDefaults.create(compiledFeatureSetDefaults ?? getFeatureSetDefaults(serializationOptions));
32
29
  const min = fds.minimumEdition ?? 0;
33
30
  const max = fds.maximumEdition ?? 0;
34
31
  if (edition === 0) {
35
- throw new Error(`Edition ${descriptor_pb_js_1.Edition[edition]} is unknown and not supported.`);
32
+ throw new Error(`Edition ${Edition[edition]} is unknown and not supported.`);
36
33
  }
37
34
  if (edition < min) {
38
- throw new Error(`Edition ${descriptor_pb_js_1.Edition[edition]} is earlier than the minimum supported edition ${descriptor_pb_js_1.Edition[min]}`);
35
+ throw new Error(`Edition ${Edition[edition]} is earlier than the minimum supported edition ${Edition[min]}`);
39
36
  }
40
37
  if (max < edition) {
41
- throw new Error(`Edition ${descriptor_pb_js_1.Edition[edition]} is later than the maximum supported edition ${descriptor_pb_js_1.Edition[max]}`);
38
+ throw new Error(`Edition ${Edition[edition]} is later than the maximum supported edition ${Edition[max]}`);
42
39
  }
43
40
  let highestMatch = undefined;
44
41
  for (const c of fds.defaults ?? []) {
@@ -51,27 +48,26 @@ function createFeatureResolver(edition, compiledFeatureSetDefaults, serializatio
51
48
  }
52
49
  highestMatch = {
53
50
  e,
54
- f: c.features ?? descriptor_pb_js_1.FeatureSet.create(),
51
+ f: c.features ?? {},
55
52
  };
56
53
  }
57
54
  if (highestMatch === undefined) {
58
- throw new Error(`No valid default found for edition ${descriptor_pb_js_1.Edition[edition]}`);
55
+ throw new Error(`No valid default found for edition ${Edition[edition]}`);
59
56
  }
60
- const featureSetBin = descriptor_pb_js_1.FeatureSet.toBinary(highestMatch.f, serializationOptions);
57
+ const featureSetBin = FeatureSet.toBinary(highestMatch.f, serializationOptions);
61
58
  return (...rest) => {
62
- const f = descriptor_pb_js_1.FeatureSet.fromBinary(featureSetBin, serializationOptions);
59
+ const f = FeatureSet.fromBinary(featureSetBin, serializationOptions);
63
60
  for (const c of rest) {
64
61
  if (c !== undefined) {
65
- (0, partial_js_1.applyPartialMessage)(c, f, descriptor_pb_js_1.FeatureSet.fields);
62
+ applyPartialMessage(c, f, FeatureSet.fields);
66
63
  }
67
64
  }
68
65
  if (!validateMergedFeatures(f)) {
69
- throw new Error(`Invalid FeatureSet for edition ${descriptor_pb_js_1.Edition[edition]}`);
66
+ throw new Error(`Invalid FeatureSet for edition ${Edition[edition]}`);
70
67
  }
71
68
  return f;
72
69
  };
73
70
  }
74
- exports.createFeatureResolver = createFeatureResolver;
75
71
  // When protoc generates google.protobuf.FeatureSetDefaults, it ensures that
76
72
  // fields are not repeated or required, do not use oneof, and have a default
77
73
  // value.
@@ -90,7 +86,7 @@ exports.createFeatureResolver = createFeatureResolver;
90
86
  // As a sanity check, we validate that all fields known to our version of
91
87
  // FeatureSet are set.
92
88
  function validateMergedFeatures(featureSet) {
93
- for (const fi of descriptor_pb_js_1.FeatureSet.fields.list()) {
89
+ for (const fi of FeatureSet.fields.list()) {
94
90
  const v = featureSet[fi.localName];
95
91
  if (v === undefined) {
96
92
  return false;
@@ -1,23 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUnwrappedFieldType = exports.wrapField = void 0;
4
- const scalar_js_1 = require("./scalar.js");
1
+ import { ScalarType } from "./scalar.js";
5
2
  /**
6
3
  * Wrap a primitive message field value in its corresponding wrapper
7
4
  * message. This function is idempotent.
8
5
  */
9
- function wrapField(fieldWrapper, value) {
6
+ export function wrapField(fieldWrapper, value) {
10
7
  if (!fieldWrapper) {
11
8
  return value;
12
9
  }
13
10
  return fieldWrapper.wrapField(value);
14
11
  }
15
- exports.wrapField = wrapField;
16
12
  /**
17
13
  * If the given field uses one of the well-known wrapper types, return
18
14
  * the primitive type it wraps.
19
15
  */
20
- function getUnwrappedFieldType(field) {
16
+ export function getUnwrappedFieldType(field) {
21
17
  if (field.fieldKind !== "message") {
22
18
  return undefined;
23
19
  }
@@ -29,15 +25,14 @@ function getUnwrappedFieldType(field) {
29
25
  }
30
26
  return wktWrapperToScalarType[field.message.typeName];
31
27
  }
32
- exports.getUnwrappedFieldType = getUnwrappedFieldType;
33
28
  const wktWrapperToScalarType = {
34
- "google.protobuf.DoubleValue": scalar_js_1.ScalarType.DOUBLE,
35
- "google.protobuf.FloatValue": scalar_js_1.ScalarType.FLOAT,
36
- "google.protobuf.Int64Value": scalar_js_1.ScalarType.INT64,
37
- "google.protobuf.UInt64Value": scalar_js_1.ScalarType.UINT64,
38
- "google.protobuf.Int32Value": scalar_js_1.ScalarType.INT32,
39
- "google.protobuf.UInt32Value": scalar_js_1.ScalarType.UINT32,
40
- "google.protobuf.BoolValue": scalar_js_1.ScalarType.BOOL,
41
- "google.protobuf.StringValue": scalar_js_1.ScalarType.STRING,
42
- "google.protobuf.BytesValue": scalar_js_1.ScalarType.BYTES,
29
+ "google.protobuf.DoubleValue": ScalarType.DOUBLE,
30
+ "google.protobuf.FloatValue": ScalarType.FLOAT,
31
+ "google.protobuf.Int64Value": ScalarType.INT64,
32
+ "google.protobuf.UInt64Value": ScalarType.UINT64,
33
+ "google.protobuf.Int32Value": ScalarType.INT32,
34
+ "google.protobuf.UInt32Value": ScalarType.UINT32,
35
+ "google.protobuf.BoolValue": ScalarType.BOOL,
36
+ "google.protobuf.StringValue": ScalarType.STRING,
37
+ "google.protobuf.BytesValue": ScalarType.BYTES,
43
38
  };
package/dist/field.js CHANGED
@@ -1,13 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeFieldInfos = exports.InternalOneofInfo = exports.resolveMessageType = exports.fieldJsonName = exports.isFieldSet = exports.newFieldList = exports.FieldList = void 0;
4
- const assert_js_1 = require("./assert.js");
5
- const scalar_js_1 = require("./scalar.js");
6
- const names_js_1 = require("./names.js");
1
+ import { assert } from "./assert.js";
2
+ import { LongType, ScalarType, isScalarZeroValue } from "./scalar.js";
3
+ import { localFieldName, localOneofName, protoCamelCase } from "./names.js";
7
4
  /**
8
5
  * Provides convenient access to field information of a message type.
9
6
  */
10
- class FieldList {
7
+ export class FieldList {
8
+ _fields;
9
+ _normalizer;
10
+ all;
11
+ numbersAsc;
12
+ jsonNames;
13
+ numbers;
14
+ members;
11
15
  constructor(fields, normalizer) {
12
16
  this._fields = fields;
13
17
  this._normalizer = normalizer;
@@ -82,16 +86,14 @@ class FieldList {
82
86
  return this.members;
83
87
  }
84
88
  }
85
- exports.FieldList = FieldList;
86
89
  // newFieldList constructs a new field list.
87
- function newFieldList(fields, packedByDefault) {
90
+ export function newFieldList(fields, packedByDefault) {
88
91
  return new FieldList(fields, (source) => normalizeFieldInfos(source, packedByDefault));
89
92
  }
90
- exports.newFieldList = newFieldList;
91
93
  /**
92
94
  * Returns true if the field is set.
93
95
  */
94
- function isFieldSet(field, target) {
96
+ export function isFieldSet(field, target) {
95
97
  const localName = field.localName;
96
98
  if (field.repeated) {
97
99
  return target[localName].length > 0;
@@ -110,41 +112,42 @@ function isFieldSet(field, target) {
110
112
  if (field.kind == "enum") {
111
113
  return target[localName] !== field.T.values[0].no;
112
114
  }
113
- return !(0, scalar_js_1.isScalarZeroValue)(field.T, target[localName]);
115
+ return !isScalarZeroValue(field.T, target[localName]);
114
116
  case "message":
115
117
  return target[localName] !== undefined;
116
118
  case "map":
117
119
  return Object.keys(target[localName]).length > 0; // eslint-disable-line @typescript-eslint/no-unsafe-argument
118
120
  }
119
121
  }
120
- exports.isFieldSet = isFieldSet;
121
122
  /**
122
123
  * Returns the JSON name for a protobuf field, exactly like protoc does.
123
124
  */
124
- exports.fieldJsonName = names_js_1.protoCamelCase;
125
+ export const fieldJsonName = protoCamelCase;
125
126
  // resolveMessageType returns the message type calling the function if necessary.
126
- function resolveMessageType(t) {
127
+ export function resolveMessageType(t) {
127
128
  if (t instanceof Function) {
128
129
  return t();
129
130
  }
130
131
  return t;
131
132
  }
132
- exports.resolveMessageType = resolveMessageType;
133
133
  // InternarlOneofInfo implements OneofInfo.
134
- class InternalOneofInfo {
134
+ export class InternalOneofInfo {
135
+ kind = "oneof";
136
+ name;
137
+ localName;
138
+ repeated = false;
139
+ packed = false;
140
+ opt = false;
141
+ req = false;
142
+ default = undefined;
143
+ fields = [];
144
+ _lookup;
135
145
  constructor(name) {
136
- this.kind = "oneof";
137
- this.repeated = false;
138
- this.packed = false;
139
- this.opt = false;
140
- this.req = false;
141
- this.default = undefined;
142
- this.fields = [];
143
146
  this.name = name;
144
- this.localName = (0, names_js_1.localOneofName)(name);
147
+ this.localName = localOneofName(name);
145
148
  }
146
149
  addField(field) {
147
- (0, assert_js_1.assert)(field.oneof === this, `field ${field.name} not one of ${this.name}`);
150
+ assert(field.oneof === this, `field ${field.name} not one of ${this.name}`);
148
151
  this.fields.push(field);
149
152
  }
150
153
  findField(localName) {
@@ -157,23 +160,22 @@ class InternalOneofInfo {
157
160
  return this._lookup[localName];
158
161
  }
159
162
  }
160
- exports.InternalOneofInfo = InternalOneofInfo;
161
163
  /**
162
164
  * Convert a collection of field info to an array of normalized FieldInfo.
163
165
  *
164
166
  * The argument `packedByDefault` specifies whether fields that do not specify
165
167
  * `packed` should be packed (proto3) or unpacked (proto2).
166
168
  */
167
- function normalizeFieldInfos(fieldInfos, packedByDefault) {
169
+ export function normalizeFieldInfos(fieldInfos, packedByDefault) {
168
170
  const r = [];
169
171
  let o;
170
172
  for (const field of typeof fieldInfos == "function" ? fieldInfos() : (fieldInfos)) {
171
173
  const f = field;
172
- f.localName = (0, names_js_1.localFieldName)(field.name, field.oneof !== undefined);
173
- f.jsonName = field.jsonName ?? (0, exports.fieldJsonName)(field.name);
174
+ f.localName = localFieldName(field.name, field.oneof !== undefined);
175
+ f.jsonName = field.jsonName ?? fieldJsonName(field.name);
174
176
  f.repeated = field.repeated ?? false;
175
177
  if (field.kind == "scalar") {
176
- f.L = field.L ?? scalar_js_1.LongType.BIGINT;
178
+ f.L = field.L ?? LongType.BIGINT;
177
179
  }
178
180
  f.delimited = field.delimited ?? false;
179
181
  f.req = field.req ?? false;
@@ -183,8 +185,8 @@ function normalizeFieldInfos(fieldInfos, packedByDefault) {
183
185
  f.packed =
184
186
  field.kind == "enum" ||
185
187
  (field.kind == "scalar" &&
186
- field.T != scalar_js_1.ScalarType.BYTES &&
187
- field.T != scalar_js_1.ScalarType.STRING);
188
+ field.T != ScalarType.BYTES &&
189
+ field.T != ScalarType.STRING);
188
190
  }
189
191
  else {
190
192
  f.packed = false;
@@ -204,4 +206,3 @@ function normalizeFieldInfos(fieldInfos, packedByDefault) {
204
206
  }
205
207
  return r;
206
208
  }
207
- exports.normalizeFieldInfos = normalizeFieldInfos;
@@ -1,41 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SourceContext = exports.Mixin = exports.Method = exports.Api = exports.Struct = exports.ListValue = exports.NullValue = exports.Value = exports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = exports.Empty = exports.Any = exports.Duration = exports.Timestamp = exports.Syntax = exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = void 0;
4
- var type_pb_js_1 = require("./protobuf/type.pb.js");
5
- Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return type_pb_js_1.Type; } });
6
- Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return type_pb_js_1.Field; } });
7
- Object.defineProperty(exports, "Field_Kind", { enumerable: true, get: function () { return type_pb_js_1.Field_Kind; } });
8
- Object.defineProperty(exports, "Field_Cardinality", { enumerable: true, get: function () { return type_pb_js_1.Field_Cardinality; } });
9
- Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return type_pb_js_1.Enum; } });
10
- Object.defineProperty(exports, "EnumValue", { enumerable: true, get: function () { return type_pb_js_1.EnumValue; } });
11
- Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return type_pb_js_1.Option; } });
12
- Object.defineProperty(exports, "Syntax", { enumerable: true, get: function () { return type_pb_js_1.Syntax; } });
13
- var timestamp_pb_js_1 = require("./protobuf/timestamp.pb.js");
14
- Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return timestamp_pb_js_1.Timestamp; } });
15
- var duration_pb_js_1 = require("./protobuf/duration.pb.js");
16
- Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return duration_pb_js_1.Duration; } });
17
- var any_pb_js_1 = require("./protobuf/any.pb.js");
18
- Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return any_pb_js_1.Any; } });
19
- var empty_pb_js_1 = require("./protobuf/empty.pb.js");
20
- Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return empty_pb_js_1.Empty; } });
21
- var wrappers_pb_js_1 = require("./protobuf/wrappers.pb.js");
22
- Object.defineProperty(exports, "DoubleValue", { enumerable: true, get: function () { return wrappers_pb_js_1.DoubleValue; } });
23
- Object.defineProperty(exports, "FloatValue", { enumerable: true, get: function () { return wrappers_pb_js_1.FloatValue; } });
24
- Object.defineProperty(exports, "Int64Value", { enumerable: true, get: function () { return wrappers_pb_js_1.Int64Value; } });
25
- Object.defineProperty(exports, "UInt64Value", { enumerable: true, get: function () { return wrappers_pb_js_1.UInt64Value; } });
26
- Object.defineProperty(exports, "Int32Value", { enumerable: true, get: function () { return wrappers_pb_js_1.Int32Value; } });
27
- Object.defineProperty(exports, "UInt32Value", { enumerable: true, get: function () { return wrappers_pb_js_1.UInt32Value; } });
28
- Object.defineProperty(exports, "BoolValue", { enumerable: true, get: function () { return wrappers_pb_js_1.BoolValue; } });
29
- Object.defineProperty(exports, "StringValue", { enumerable: true, get: function () { return wrappers_pb_js_1.StringValue; } });
30
- Object.defineProperty(exports, "BytesValue", { enumerable: true, get: function () { return wrappers_pb_js_1.BytesValue; } });
31
- var struct_pb_js_1 = require("./protobuf/struct.pb.js");
32
- Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return struct_pb_js_1.Value; } });
33
- Object.defineProperty(exports, "NullValue", { enumerable: true, get: function () { return struct_pb_js_1.NullValue; } });
34
- Object.defineProperty(exports, "ListValue", { enumerable: true, get: function () { return struct_pb_js_1.ListValue; } });
35
- Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return struct_pb_js_1.Struct; } });
36
- var api_pb_js_1 = require("./protobuf/api.pb.js");
37
- Object.defineProperty(exports, "Api", { enumerable: true, get: function () { return api_pb_js_1.Api; } });
38
- Object.defineProperty(exports, "Method", { enumerable: true, get: function () { return api_pb_js_1.Method; } });
39
- Object.defineProperty(exports, "Mixin", { enumerable: true, get: function () { return api_pb_js_1.Mixin; } });
40
- var source_context_pb_js_1 = require("./protobuf/source_context.pb.js");
41
- Object.defineProperty(exports, "SourceContext", { enumerable: true, get: function () { return source_context_pb_js_1.SourceContext; } });
1
+ export { Type, Field, Field_Kind, Field_Cardinality, Enum, EnumValue, Option, Syntax, } from "./protobuf/type.pb.js";
2
+ export { Timestamp } from "./protobuf/timestamp.pb.js";
3
+ export { Duration } from "./protobuf/duration.pb.js";
4
+ export { Any } from "./protobuf/any.pb.js";
5
+ export { Empty } from "./protobuf/empty.pb.js";
6
+ export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue, } from "./protobuf/wrappers.pb.js";
7
+ export { Value, NullValue, ListValue, Struct } from "./protobuf/struct.pb.js";
8
+ export { Api, Method, Mixin } from "./protobuf/api.pb.js";
9
+ export { SourceContext } from "./protobuf/source_context.pb.js";
@@ -1,5 +1,5 @@
1
- import type { MessageType } from "../../";
2
- import { Message } from "../../";
1
+ import type { MessageType } from "../../index.js";
2
+ import { Message } from "../../index.js";
3
3
  export declare const protobufPackage = "google.protobuf";
4
4
  /**
5
5
  * `Any` contains an arbitrary serialized protocol buffer message along with a
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Protocol Buffers - Google's data interchange format
3
2
  // Copyright 2008 Google Inc. All rights reserved.
4
3
  // https://developers.google.com/protocol-buffers/
@@ -28,11 +27,9 @@
28
27
  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
28
  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
29
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Any = exports.protobufPackage = void 0;
33
- const __1 = require("../../");
34
- exports.protobufPackage = "google.protobuf";
35
- exports.Any = (0, __1.createMessageType)({
30
+ import { createMessageType } from "../../index.js";
31
+ export const protobufPackage = "google.protobuf";
32
+ export const Any = createMessageType({
36
33
  typeName: "google.protobuf.Any",
37
34
  fields: [
38
35
  { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -1,5 +1,5 @@
1
- import type { MessageType } from "../../";
2
- import { Message } from "../../";
1
+ import type { MessageType } from "../../index.js";
2
+ import { Message } from "../../index.js";
3
3
  import type { Syntax } from "./type.pb.js";
4
4
  import { Option } from "./type.pb.js";
5
5
  import { SourceContext } from "./source_context.pb.js";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Protocol Buffers - Google's data interchange format
3
2
  // Copyright 2008 Google Inc. All rights reserved.
4
3
  // https://developers.google.com/protocol-buffers/
@@ -28,26 +27,50 @@
28
27
  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
28
  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
29
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Api = exports.Mixin = exports.Method = exports.protobufPackage = void 0;
33
- const __1 = require("../../");
34
- const type_pb_js_1 = require("./type.pb.js");
35
- const source_context_pb_js_1 = require("./source_context.pb.js");
36
- exports.protobufPackage = "google.protobuf";
37
- exports.Method = (0, __1.createMessageType)({
30
+ import { createMessageType } from "../../index.js";
31
+ import { Option, Syntax_Enum } from "./type.pb.js";
32
+ import { SourceContext } from "./source_context.pb.js";
33
+ export const protobufPackage = "google.protobuf";
34
+ export const Method = createMessageType({
38
35
  typeName: "google.protobuf.Method",
39
36
  fields: [
40
37
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
41
- { no: 2, name: "request_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
42
- { no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
43
- { no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
44
- { no: 5, name: "response_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
45
- { no: 6, name: "options", kind: "message", T: () => type_pb_js_1.Option, repeated: true },
46
- { no: 7, name: "syntax", kind: "enum", T: type_pb_js_1.Syntax_Enum },
38
+ {
39
+ no: 2,
40
+ name: "request_type_url",
41
+ kind: "scalar",
42
+ T: 9 /* ScalarType.STRING */,
43
+ },
44
+ {
45
+ no: 3,
46
+ name: "request_streaming",
47
+ kind: "scalar",
48
+ T: 8 /* ScalarType.BOOL */,
49
+ },
50
+ {
51
+ no: 4,
52
+ name: "response_type_url",
53
+ kind: "scalar",
54
+ T: 9 /* ScalarType.STRING */,
55
+ },
56
+ {
57
+ no: 5,
58
+ name: "response_streaming",
59
+ kind: "scalar",
60
+ T: 8 /* ScalarType.BOOL */,
61
+ },
62
+ {
63
+ no: 6,
64
+ name: "options",
65
+ kind: "message",
66
+ T: () => Option,
67
+ repeated: true,
68
+ },
69
+ { no: 7, name: "syntax", kind: "enum", T: Syntax_Enum },
47
70
  ],
48
71
  packedByDefault: true,
49
72
  });
50
- exports.Mixin = (0, __1.createMessageType)({
73
+ export const Mixin = createMessageType({
51
74
  typeName: "google.protobuf.Mixin",
52
75
  fields: [
53
76
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -55,16 +78,28 @@ exports.Mixin = (0, __1.createMessageType)({
55
78
  ],
56
79
  packedByDefault: true,
57
80
  });
58
- exports.Api = (0, __1.createMessageType)({
81
+ export const Api = createMessageType({
59
82
  typeName: "google.protobuf.Api",
60
83
  fields: [
61
84
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
62
- { no: 2, name: "methods", kind: "message", T: () => exports.Method, repeated: true },
63
- { no: 3, name: "options", kind: "message", T: () => type_pb_js_1.Option, repeated: true },
85
+ {
86
+ no: 2,
87
+ name: "methods",
88
+ kind: "message",
89
+ T: () => Method,
90
+ repeated: true,
91
+ },
92
+ {
93
+ no: 3,
94
+ name: "options",
95
+ kind: "message",
96
+ T: () => Option,
97
+ repeated: true,
98
+ },
64
99
  { no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
65
- { no: 5, name: "source_context", kind: "message", T: () => source_context_pb_js_1.SourceContext },
66
- { no: 6, name: "mixins", kind: "message", T: () => exports.Mixin, repeated: true },
67
- { no: 7, name: "syntax", kind: "enum", T: type_pb_js_1.Syntax_Enum },
100
+ { no: 5, name: "source_context", kind: "message", T: () => SourceContext },
101
+ { no: 6, name: "mixins", kind: "message", T: () => Mixin, repeated: true },
102
+ { no: 7, name: "syntax", kind: "enum", T: Syntax_Enum },
68
103
  ],
69
104
  packedByDefault: true,
70
105
  });
@@ -1,4 +1,4 @@
1
- import { MessageType } from "../../../";
1
+ import { MessageType } from "../../../index.js";
2
2
  import { FileDescriptorProto, GeneratedCodeInfo } from "../descriptor.pb.js";
3
3
  export declare const protobufPackage = "google.protobuf.compiler";
4
4
  /**
@@ -20,7 +20,7 @@ export declare enum CodeGeneratorResponse_Feature {
20
20
  */
21
21
  SUPPORTS_EDITIONS = 2
22
22
  }
23
- export declare const CodeGeneratorResponse_Feature_Enum: import("../../../enum").EnumType;
23
+ export declare const CodeGeneratorResponse_Feature_Enum: import("../../../enum.js").EnumType;
24
24
  /**
25
25
  * The version number of protocol compiler.
26
26
  *
@@ -1,12 +1,9 @@
1
- "use strict";
2
1
  // Protocol Buffers - Google's data interchange format
3
2
  // Copyright 2008 Google Inc. All rights reserved.
4
3
  //
5
4
  // Use of this source code is governed by a BSD-style
6
5
  // license that can be found in the LICENSE file or at
7
6
  // https://developers.google.com/open-source/licenses/bsd
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CodeGeneratorResponse = exports.CodeGeneratorResponse_File = exports.CodeGeneratorRequest = exports.Version = exports.CodeGeneratorResponse_Feature_Enum = exports.CodeGeneratorResponse_Feature = exports.protobufPackage = void 0;
10
7
  // Author: kenton@google.com (Kenton Varda)
11
8
  //
12
9
  // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
@@ -22,15 +19,15 @@ exports.CodeGeneratorResponse = exports.CodeGeneratorResponse_File = exports.Cod
22
19
  // @generated by protoc-gen-es-lite unknown with parameter "target=ts,ts_nocheck=false"
23
20
  // @generated from file google/protobuf/compiler/plugin.proto (package google.protobuf.compiler, syntax proto2)
24
21
  /* eslint-disable */
25
- const __1 = require("../../../");
26
- const descriptor_pb_js_1 = require("../descriptor.pb.js");
27
- exports.protobufPackage = "google.protobuf.compiler";
22
+ import { createEnumType, createMessageType, } from "../../../index.js";
23
+ import { FileDescriptorProto, GeneratedCodeInfo } from "../descriptor.pb.js";
24
+ export const protobufPackage = "google.protobuf.compiler";
28
25
  /**
29
26
  * Sync with code_generator.h.
30
27
  *
31
28
  * @generated from enum google.protobuf.compiler.CodeGeneratorResponse.Feature
32
29
  */
33
- var CodeGeneratorResponse_Feature;
30
+ export var CodeGeneratorResponse_Feature;
34
31
  (function (CodeGeneratorResponse_Feature) {
35
32
  /**
36
33
  * @generated from enum value: FEATURE_NONE = 0;
@@ -44,14 +41,14 @@ var CodeGeneratorResponse_Feature;
44
41
  * @generated from enum value: FEATURE_SUPPORTS_EDITIONS = 2;
45
42
  */
46
43
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["SUPPORTS_EDITIONS"] = 2] = "SUPPORTS_EDITIONS";
47
- })(CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = CodeGeneratorResponse_Feature = {}));
44
+ })(CodeGeneratorResponse_Feature || (CodeGeneratorResponse_Feature = {}));
48
45
  // CodeGeneratorResponse_Feature_Enum is the enum type for CodeGeneratorResponse_Feature.
49
- exports.CodeGeneratorResponse_Feature_Enum = (0, __1.createEnumType)("google.protobuf.compiler.CodeGeneratorResponse.Feature", [
46
+ export const CodeGeneratorResponse_Feature_Enum = createEnumType("google.protobuf.compiler.CodeGeneratorResponse.Feature", [
50
47
  { no: 0, name: "FEATURE_NONE" },
51
48
  { no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
52
49
  { no: 2, name: "FEATURE_SUPPORTS_EDITIONS" },
53
50
  ]);
54
- exports.Version = (0, __1.createMessageType)({
51
+ export const Version = createMessageType({
55
52
  typeName: "google.protobuf.compiler.Version",
56
53
  fields: [
57
54
  {
@@ -85,7 +82,7 @@ exports.Version = (0, __1.createMessageType)({
85
82
  ],
86
83
  packedByDefault: false,
87
84
  });
88
- exports.CodeGeneratorRequest = (0, __1.createMessageType)({
85
+ export const CodeGeneratorRequest = createMessageType({
89
86
  typeName: "google.protobuf.compiler.CodeGeneratorRequest",
90
87
  fields: [
91
88
  {
@@ -106,27 +103,27 @@ exports.CodeGeneratorRequest = (0, __1.createMessageType)({
106
103
  no: 15,
107
104
  name: "proto_file",
108
105
  kind: "message",
109
- T: () => descriptor_pb_js_1.FileDescriptorProto,
106
+ T: () => FileDescriptorProto,
110
107
  repeated: true,
111
108
  },
112
109
  {
113
110
  no: 17,
114
111
  name: "source_file_descriptors",
115
112
  kind: "message",
116
- T: () => descriptor_pb_js_1.FileDescriptorProto,
113
+ T: () => FileDescriptorProto,
117
114
  repeated: true,
118
115
  },
119
116
  {
120
117
  no: 3,
121
118
  name: "compiler_version",
122
119
  kind: "message",
123
- T: () => exports.Version,
120
+ T: () => Version,
124
121
  opt: true,
125
122
  },
126
123
  ],
127
124
  packedByDefault: false,
128
125
  });
129
- exports.CodeGeneratorResponse_File = (0, __1.createMessageType)({
126
+ export const CodeGeneratorResponse_File = createMessageType({
130
127
  typeName: "google.protobuf.compiler.CodeGeneratorResponse.File",
131
128
  fields: [
132
129
  {
@@ -154,13 +151,13 @@ exports.CodeGeneratorResponse_File = (0, __1.createMessageType)({
154
151
  no: 16,
155
152
  name: "generated_code_info",
156
153
  kind: "message",
157
- T: () => descriptor_pb_js_1.GeneratedCodeInfo,
154
+ T: () => GeneratedCodeInfo,
158
155
  opt: true,
159
156
  },
160
157
  ],
161
158
  packedByDefault: false,
162
159
  });
163
- exports.CodeGeneratorResponse = (0, __1.createMessageType)({
160
+ export const CodeGeneratorResponse = createMessageType({
164
161
  typeName: "google.protobuf.compiler.CodeGeneratorResponse",
165
162
  fields: [
166
163
  {
@@ -195,7 +192,7 @@ exports.CodeGeneratorResponse = (0, __1.createMessageType)({
195
192
  no: 15,
196
193
  name: "file",
197
194
  kind: "message",
198
- T: () => exports.CodeGeneratorResponse_File,
195
+ T: () => CodeGeneratorResponse_File,
199
196
  repeated: true,
200
197
  },
201
198
  ],