@aptre/protobuf-es-lite 0.2.10 → 0.2.11

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 (73) hide show
  1. package/bin/protoc-gen-es-lite +2 -2
  2. package/dist/assert.js +4 -11
  3. package/dist/binary-encoding.js +30 -35
  4. package/dist/binary.js +84 -96
  5. package/dist/codegen-info.js +12 -15
  6. package/dist/create-descriptor-set.js +113 -117
  7. package/dist/descriptor-set.js +1 -2
  8. package/dist/enum.js +2 -7
  9. package/dist/feature-set.js +16 -20
  10. package/dist/field-wrapper.js +12 -17
  11. package/dist/field.js +18 -27
  12. package/dist/google/index.js +9 -41
  13. package/dist/google/protobuf/any.pb.d.ts +2 -2
  14. package/dist/google/protobuf/any.pb.js +3 -6
  15. package/dist/google/protobuf/api.pb.d.ts +2 -2
  16. package/dist/google/protobuf/api.pb.js +14 -17
  17. package/dist/google/protobuf/compiler/plugin.pb.d.ts +2 -2
  18. package/dist/google/protobuf/compiler/plugin.pb.js +15 -18
  19. package/dist/google/protobuf/descriptor.pb.d.ts +19 -19
  20. package/dist/google/protobuf/descriptor.pb.js +156 -160
  21. package/dist/google/protobuf/duration.pb.d.ts +2 -2
  22. package/dist/google/protobuf/duration.pb.js +3 -6
  23. package/dist/google/protobuf/empty.pb.d.ts +2 -2
  24. package/dist/google/protobuf/empty.pb.js +3 -6
  25. package/dist/google/protobuf/source_context.pb.d.ts +2 -2
  26. package/dist/google/protobuf/source_context.pb.js +3 -6
  27. package/dist/google/protobuf/struct.pb.d.ts +3 -3
  28. package/dist/google/protobuf/struct.pb.js +13 -16
  29. package/dist/google/protobuf/timestamp.pb.d.ts +2 -2
  30. package/dist/google/protobuf/timestamp.pb.js +3 -6
  31. package/dist/google/protobuf/type.pb.d.ts +5 -5
  32. package/dist/google/protobuf/type.pb.js +31 -34
  33. package/dist/google/protobuf/wrappers.pb.d.ts +2 -2
  34. package/dist/google/protobuf/wrappers.pb.js +11 -14
  35. package/dist/index.js +12 -60
  36. package/dist/is-message.js +9 -16
  37. package/dist/json.js +72 -80
  38. package/dist/message.js +48 -55
  39. package/dist/names.js +12 -23
  40. package/dist/partial.js +13 -17
  41. package/dist/proto-base64.js +1 -4
  42. package/dist/proto-double.js +1 -4
  43. package/dist/proto-int64.js +9 -12
  44. package/dist/protoc-gen-es-lite/protoc-gen-es-lite-plugin.js +4 -7
  45. package/dist/protoc-gen-es-lite/typescript.js +27 -36
  46. package/dist/protoplugin/create-es-plugin.js +13 -17
  47. package/dist/protoplugin/ecmascript/file-preamble.js +5 -9
  48. package/dist/protoplugin/ecmascript/generated-file.js +16 -20
  49. package/dist/protoplugin/ecmascript/import-path.js +13 -20
  50. package/dist/protoplugin/ecmascript/import-symbol.js +1 -5
  51. package/dist/protoplugin/ecmascript/index.js +2 -7
  52. package/dist/protoplugin/ecmascript/jsdoc.js +1 -5
  53. package/dist/protoplugin/ecmascript/opaque-printables.js +1 -2
  54. package/dist/protoplugin/ecmascript/parameter.js +10 -14
  55. package/dist/protoplugin/ecmascript/reify-wkt.js +12 -16
  56. package/dist/protoplugin/ecmascript/runtime-imports.js +5 -9
  57. package/dist/protoplugin/ecmascript/schema.js +16 -20
  58. package/dist/protoplugin/ecmascript/target.js +1 -2
  59. package/dist/protoplugin/ecmascript/transpile.js +15 -42
  60. package/dist/protoplugin/error.js +3 -9
  61. package/dist/protoplugin/index.js +2 -7
  62. package/dist/protoplugin/plugin.js +1 -2
  63. package/dist/protoplugin/run-node.js +6 -10
  64. package/dist/scalar.js +9 -15
  65. package/dist/service-type.js +4 -7
  66. package/dist/text-format.js +25 -30
  67. package/dist/type-registry.js +1 -2
  68. package/dist/unknown.js +7 -12
  69. package/dist/util.d.ts +1 -1
  70. package/dist/util.js +49 -55
  71. package/dist/varint.js +7 -17
  72. package/package.json +10 -7
  73. package/tsconfig.base.json +2 -2
@@ -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
18
  * Return the edition feature defaults supported by @bufbuild/protobuf.
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
25
  * the feature set defaults supported by @bufbuild/protobuf.
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 ?? FeatureSet.create(),
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,10 @@
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 {
11
8
  constructor(fields, normalizer) {
12
9
  this._fields = fields;
13
10
  this._normalizer = normalizer;
@@ -82,16 +79,14 @@ class FieldList {
82
79
  return this.members;
83
80
  }
84
81
  }
85
- exports.FieldList = FieldList;
86
82
  // newFieldList constructs a new field list.
87
- function newFieldList(fields, packedByDefault) {
83
+ export function newFieldList(fields, packedByDefault) {
88
84
  return new FieldList(fields, (source) => normalizeFieldInfos(source, packedByDefault));
89
85
  }
90
- exports.newFieldList = newFieldList;
91
86
  /**
92
87
  * Returns true if the field is set.
93
88
  */
94
- function isFieldSet(field, target) {
89
+ export function isFieldSet(field, target) {
95
90
  const localName = field.localName;
96
91
  if (field.repeated) {
97
92
  return target[localName].length > 0;
@@ -110,28 +105,26 @@ function isFieldSet(field, target) {
110
105
  if (field.kind == "enum") {
111
106
  return target[localName] !== field.T.values[0].no;
112
107
  }
113
- return !(0, scalar_js_1.isScalarZeroValue)(field.T, target[localName]);
108
+ return !isScalarZeroValue(field.T, target[localName]);
114
109
  case "message":
115
110
  return target[localName] !== undefined;
116
111
  case "map":
117
112
  return Object.keys(target[localName]).length > 0; // eslint-disable-line @typescript-eslint/no-unsafe-argument
118
113
  }
119
114
  }
120
- exports.isFieldSet = isFieldSet;
121
115
  /**
122
116
  * Returns the JSON name for a protobuf field, exactly like protoc does.
123
117
  */
124
- exports.fieldJsonName = names_js_1.protoCamelCase;
118
+ export const fieldJsonName = protoCamelCase;
125
119
  // resolveMessageType returns the message type calling the function if necessary.
126
- function resolveMessageType(t) {
120
+ export function resolveMessageType(t) {
127
121
  if (t instanceof Function) {
128
122
  return t();
129
123
  }
130
124
  return t;
131
125
  }
132
- exports.resolveMessageType = resolveMessageType;
133
126
  // InternarlOneofInfo implements OneofInfo.
134
- class InternalOneofInfo {
127
+ export class InternalOneofInfo {
135
128
  constructor(name) {
136
129
  this.kind = "oneof";
137
130
  this.repeated = false;
@@ -141,10 +134,10 @@ class InternalOneofInfo {
141
134
  this.default = undefined;
142
135
  this.fields = [];
143
136
  this.name = name;
144
- this.localName = (0, names_js_1.localOneofName)(name);
137
+ this.localName = localOneofName(name);
145
138
  }
146
139
  addField(field) {
147
- (0, assert_js_1.assert)(field.oneof === this, `field ${field.name} not one of ${this.name}`);
140
+ assert(field.oneof === this, `field ${field.name} not one of ${this.name}`);
148
141
  this.fields.push(field);
149
142
  }
150
143
  findField(localName) {
@@ -157,23 +150,22 @@ class InternalOneofInfo {
157
150
  return this._lookup[localName];
158
151
  }
159
152
  }
160
- exports.InternalOneofInfo = InternalOneofInfo;
161
153
  /**
162
154
  * Convert a collection of field info to an array of normalized FieldInfo.
163
155
  *
164
156
  * The argument `packedByDefault` specifies whether fields that do not specify
165
157
  * `packed` should be packed (proto3) or unpacked (proto2).
166
158
  */
167
- function normalizeFieldInfos(fieldInfos, packedByDefault) {
159
+ export function normalizeFieldInfos(fieldInfos, packedByDefault) {
168
160
  const r = [];
169
161
  let o;
170
162
  for (const field of typeof fieldInfos == "function" ? fieldInfos() : (fieldInfos)) {
171
163
  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);
164
+ f.localName = localFieldName(field.name, field.oneof !== undefined);
165
+ f.jsonName = field.jsonName ?? fieldJsonName(field.name);
174
166
  f.repeated = field.repeated ?? false;
175
167
  if (field.kind == "scalar") {
176
- f.L = field.L ?? scalar_js_1.LongType.BIGINT;
168
+ f.L = field.L ?? LongType.BIGINT;
177
169
  }
178
170
  f.delimited = field.delimited ?? false;
179
171
  f.req = field.req ?? false;
@@ -183,8 +175,8 @@ function normalizeFieldInfos(fieldInfos, packedByDefault) {
183
175
  f.packed =
184
176
  field.kind == "enum" ||
185
177
  (field.kind == "scalar" &&
186
- field.T != scalar_js_1.ScalarType.BYTES &&
187
- field.T != scalar_js_1.ScalarType.STRING);
178
+ field.T != ScalarType.BYTES &&
179
+ field.T != ScalarType.STRING);
188
180
  }
189
181
  else {
190
182
  f.packed = false;
@@ -204,4 +196,3 @@ function normalizeFieldInfos(fieldInfos, packedByDefault) {
204
196
  }
205
197
  return r;
206
198
  }
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,13 +27,11 @@
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 */ },
@@ -42,12 +39,12 @@ exports.Method = (0, __1.createMessageType)({
42
39
  { no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
43
40
  { no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
44
41
  { 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 },
42
+ { no: 6, name: "options", kind: "message", T: () => Option, repeated: true },
43
+ { no: 7, name: "syntax", kind: "enum", T: Syntax_Enum },
47
44
  ],
48
45
  packedByDefault: true,
49
46
  });
50
- exports.Mixin = (0, __1.createMessageType)({
47
+ export const Mixin = createMessageType({
51
48
  typeName: "google.protobuf.Mixin",
52
49
  fields: [
53
50
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
@@ -55,16 +52,16 @@ exports.Mixin = (0, __1.createMessageType)({
55
52
  ],
56
53
  packedByDefault: true,
57
54
  });
58
- exports.Api = (0, __1.createMessageType)({
55
+ export const Api = createMessageType({
59
56
  typeName: "google.protobuf.Api",
60
57
  fields: [
61
58
  { 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 },
59
+ { no: 2, name: "methods", kind: "message", T: () => Method, repeated: true },
60
+ { no: 3, name: "options", kind: "message", T: () => Option, repeated: true },
64
61
  { 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 },
62
+ { no: 5, name: "source_context", kind: "message", T: () => SourceContext },
63
+ { no: 6, name: "mixins", kind: "message", T: () => Mixin, repeated: true },
64
+ { no: 7, name: "syntax", kind: "enum", T: Syntax_Enum },
68
65
  ],
69
66
  packedByDefault: true,
70
67
  });
@@ -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
  ],