@bufbuild/protobuf 2.0.0-alpha.4 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +2 -3
  2. package/dist/cjs/clone.d.ts +1 -1
  3. package/dist/cjs/clone.js +5 -16
  4. package/dist/cjs/codegenv1/embed.js +25 -25
  5. package/dist/cjs/codegenv1/enum.d.ts +2 -1
  6. package/dist/cjs/codegenv1/file.js +1 -1
  7. package/dist/cjs/codegenv1/message.d.ts +2 -1
  8. package/dist/cjs/codegenv1/scalar.d.ts +4 -0
  9. package/dist/cjs/codegenv1/scalar.js +30 -1
  10. package/dist/cjs/codegenv1/symbols.d.ts +10 -0
  11. package/dist/cjs/codegenv1/symbols.js +2 -0
  12. package/dist/cjs/codegenv1/types.d.ts +7 -5
  13. package/dist/cjs/codegenv1/types.js +2 -1
  14. package/dist/cjs/create.d.ts +1 -1
  15. package/dist/cjs/create.js +47 -20
  16. package/dist/cjs/equals.d.ts +1 -1
  17. package/dist/cjs/equals.js +8 -15
  18. package/dist/cjs/from-binary.d.ts +2 -2
  19. package/dist/cjs/from-binary.js +6 -6
  20. package/dist/cjs/from-json.d.ts +14 -6
  21. package/dist/cjs/from-json.js +35 -33
  22. package/dist/cjs/is-message.d.ts +1 -1
  23. package/dist/cjs/is-message.js +3 -3
  24. package/dist/cjs/reflect/reflect-types.d.ts +13 -42
  25. package/dist/cjs/reflect/reflect.d.ts +29 -18
  26. package/dist/cjs/reflect/reflect.js +169 -45
  27. package/dist/cjs/reflect/scalar.d.ts +1 -1
  28. package/dist/cjs/registry.d.ts +18 -2
  29. package/dist/cjs/registry.js +63 -61
  30. package/dist/cjs/to-binary.d.ts +1 -1
  31. package/dist/cjs/to-binary.js +2 -2
  32. package/dist/cjs/to-json.d.ts +14 -4
  33. package/dist/cjs/to-json.js +26 -13
  34. package/dist/cjs/types.d.ts +9 -0
  35. package/dist/cjs/wire/size-delimited.d.ts +1 -1
  36. package/dist/cjs/wkt/any.d.ts +7 -7
  37. package/dist/cjs/wkt/any.js +5 -5
  38. package/dist/cjs/wkt/gen/google/protobuf/any_pb.d.ts +9 -3
  39. package/dist/cjs/wkt/gen/google/protobuf/any_pb.js +4 -4
  40. package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +88 -9
  41. package/dist/cjs/wkt/gen/google/protobuf/api_pb.js +8 -8
  42. package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +107 -11
  43. package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +11 -11
  44. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +1005 -92
  45. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +86 -86
  46. package/dist/cjs/wkt/gen/google/protobuf/duration_pb.d.ts +7 -3
  47. package/dist/cjs/wkt/gen/google/protobuf/duration_pb.js +4 -4
  48. package/dist/cjs/wkt/gen/google/protobuf/empty_pb.d.ts +7 -3
  49. package/dist/cjs/wkt/gen/google/protobuf/empty_pb.js +4 -4
  50. package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +7 -3
  51. package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.js +4 -4
  52. package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.d.ts +12 -3
  53. package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.js +4 -4
  54. package/dist/cjs/wkt/gen/google/protobuf/struct_pb.d.ts +25 -8
  55. package/dist/cjs/wkt/gen/google/protobuf/struct_pb.js +9 -9
  56. package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +7 -3
  57. package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.js +4 -4
  58. package/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +165 -16
  59. package/dist/cjs/wkt/gen/google/protobuf/type_pb.js +15 -15
  60. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +55 -19
  61. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.js +20 -20
  62. package/dist/cjs/wkt/timestamp.js +1 -2
  63. package/dist/esm/clone.d.ts +1 -1
  64. package/dist/esm/clone.js +5 -16
  65. package/dist/esm/codegenv1/embed.js +26 -26
  66. package/dist/esm/codegenv1/enum.d.ts +2 -1
  67. package/dist/esm/codegenv1/file.js +2 -2
  68. package/dist/esm/codegenv1/message.d.ts +2 -1
  69. package/dist/esm/codegenv1/scalar.d.ts +4 -0
  70. package/dist/esm/codegenv1/scalar.js +28 -0
  71. package/dist/esm/codegenv1/symbols.d.ts +10 -0
  72. package/dist/esm/codegenv1/symbols.js +2 -0
  73. package/dist/esm/codegenv1/types.d.ts +7 -5
  74. package/dist/esm/codegenv1/types.js +2 -1
  75. package/dist/esm/create.d.ts +1 -1
  76. package/dist/esm/create.js +47 -20
  77. package/dist/esm/equals.d.ts +1 -1
  78. package/dist/esm/equals.js +8 -15
  79. package/dist/esm/from-binary.d.ts +2 -2
  80. package/dist/esm/from-binary.js +6 -6
  81. package/dist/esm/from-json.d.ts +14 -6
  82. package/dist/esm/from-json.js +33 -33
  83. package/dist/esm/is-message.d.ts +1 -1
  84. package/dist/esm/is-message.js +3 -3
  85. package/dist/esm/reflect/reflect-types.d.ts +13 -42
  86. package/dist/esm/reflect/reflect-types.js +0 -1
  87. package/dist/esm/reflect/reflect.d.ts +29 -18
  88. package/dist/esm/reflect/reflect.js +170 -46
  89. package/dist/esm/reflect/scalar.d.ts +1 -1
  90. package/dist/esm/registry.d.ts +18 -2
  91. package/dist/esm/registry.js +61 -60
  92. package/dist/esm/to-binary.d.ts +1 -1
  93. package/dist/esm/to-binary.js +2 -2
  94. package/dist/esm/to-json.d.ts +14 -4
  95. package/dist/esm/to-json.js +24 -12
  96. package/dist/esm/types.d.ts +9 -0
  97. package/dist/esm/wire/size-delimited.d.ts +1 -1
  98. package/dist/esm/wkt/any.d.ts +7 -7
  99. package/dist/esm/wkt/any.js +6 -6
  100. package/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +9 -3
  101. package/dist/esm/wkt/gen/google/protobuf/any_pb.js +3 -3
  102. package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +88 -9
  103. package/dist/esm/wkt/gen/google/protobuf/api_pb.js +9 -9
  104. package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +107 -11
  105. package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +11 -11
  106. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +1005 -92
  107. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +84 -84
  108. package/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +7 -3
  109. package/dist/esm/wkt/gen/google/protobuf/duration_pb.js +3 -3
  110. package/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +7 -3
  111. package/dist/esm/wkt/gen/google/protobuf/empty_pb.js +3 -3
  112. package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +7 -3
  113. package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +3 -3
  114. package/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +12 -3
  115. package/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +3 -3
  116. package/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +25 -8
  117. package/dist/esm/wkt/gen/google/protobuf/struct_pb.js +8 -8
  118. package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +7 -3
  119. package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +3 -3
  120. package/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +165 -16
  121. package/dist/esm/wkt/gen/google/protobuf/type_pb.js +16 -16
  122. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +55 -19
  123. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +19 -19
  124. package/dist/esm/wkt/timestamp.js +2 -3
  125. package/package.json +8 -5
@@ -13,7 +13,7 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.SyntaxDesc = exports.Syntax = exports.OptionDesc = exports.EnumValueDesc = exports.EnumDesc = exports.Field_CardinalityDesc = exports.Field_Cardinality = exports.Field_KindDesc = exports.Field_Kind = exports.FieldDesc = exports.TypeDesc = exports.fileDesc_google_protobuf_type = void 0;
16
+ exports.SyntaxSchema = exports.Syntax = exports.OptionSchema = exports.EnumValueSchema = exports.EnumSchema = exports.Field_CardinalitySchema = exports.Field_Cardinality = exports.Field_KindSchema = exports.Field_Kind = exports.FieldSchema = exports.TypeSchema = exports.file_google_protobuf_type = void 0;
17
17
  const file_js_1 = require("../../../../codegenv1/file.js");
18
18
  const any_pb_js_1 = require("./any_pb.js");
19
19
  const source_context_pb_js_1 = require("./source_context_pb.js");
@@ -22,17 +22,17 @@ const enum_js_1 = require("../../../../codegenv1/enum.js");
22
22
  /**
23
23
  * Describes the file google/protobuf/type.proto.
24
24
  */
25
- exports.fileDesc_google_protobuf_type = (0, file_js_1.fileDesc)("Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIugBCgRUeXBlEgwKBG5hbWUYASABKAkSJgoGZmllbGRzGAIgAygLMhYuZ29vZ2xlLnByb3RvYnVmLkZpZWxkEg4KBm9uZW9mcxgDIAMoCRIoCgdvcHRpb25zGAQgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgFIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgGIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgHIAEoCSLVBQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2dsZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIuZ29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgDIAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9mX2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAkSFQoNZGVmYXVsdF92YWx1ZRgLIAEoCSLIAgoES2luZBIQCgxUWVBFX1VOS05PV04QABIPCgtUWVBFX0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBFX0lOVDY0EAMSDwoLVFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoMVFlQRV9GSVhFRDY0EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09MEAgSDwoLVFlQRV9TVFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9NRVNTQUdFEAsSDgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJVFlQRV9FTlVNEA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVENjQQEBIPCgtUWVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2FyZGluYWxpdHkSFwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFMSVRZX09QVElPTkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRDQVJESU5BTElUWV9SRVBFQVRFRBADIt8BCgRFbnVtEgwKBG5hbWUYASABKAkSLQoJZW51bXZhbHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZRIoCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgFIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgGIAEoCSJTCglFbnVtVmFsdWUSDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSKAoHb3B0aW9ucxgDIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb24iOwoGT3B0aW9uEgwKBG5hbWUYASABKAkSIwoFdmFsdWUYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55KkMKBlN5bnRheBIRCg1TWU5UQVhfUFJPVE8yEAASEQoNU1lOVEFYX1BST1RPMxABEhMKD1NZTlRBWF9FRElUSU9OUxACQnsKE2NvbS5nb29nbGUucHJvdG9idWZCCVR5cGVQcm90b1ABWi1nb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi90eXBlcGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw", [any_pb_js_1.fileDesc_google_protobuf_any, source_context_pb_js_1.fileDesc_google_protobuf_source_context]);
25
+ exports.file_google_protobuf_type = (0, file_js_1.fileDesc)("Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIugBCgRUeXBlEgwKBG5hbWUYASABKAkSJgoGZmllbGRzGAIgAygLMhYuZ29vZ2xlLnByb3RvYnVmLkZpZWxkEg4KBm9uZW9mcxgDIAMoCRIoCgdvcHRpb25zGAQgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgFIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgGIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgHIAEoCSLVBQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2dsZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIuZ29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgDIAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9mX2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAkSFQoNZGVmYXVsdF92YWx1ZRgLIAEoCSLIAgoES2luZBIQCgxUWVBFX1VOS05PV04QABIPCgtUWVBFX0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBFX0lOVDY0EAMSDwoLVFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoMVFlQRV9GSVhFRDY0EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09MEAgSDwoLVFlQRV9TVFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9NRVNTQUdFEAsSDgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJVFlQRV9FTlVNEA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVENjQQEBIPCgtUWVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2FyZGluYWxpdHkSFwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFMSVRZX09QVElPTkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRDQVJESU5BTElUWV9SRVBFQVRFRBADIt8BCgRFbnVtEgwKBG5hbWUYASABKAkSLQoJZW51bXZhbHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZRIoCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgFIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgGIAEoCSJTCglFbnVtVmFsdWUSDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSKAoHb3B0aW9ucxgDIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb24iOwoGT3B0aW9uEgwKBG5hbWUYASABKAkSIwoFdmFsdWUYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55KkMKBlN5bnRheBIRCg1TWU5UQVhfUFJPVE8yEAASEQoNU1lOVEFYX1BST1RPMxABEhMKD1NZTlRBWF9FRElUSU9OUxACQnsKE2NvbS5nb29nbGUucHJvdG9idWZCCVR5cGVQcm90b1ABWi1nb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi90eXBlcGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw", [any_pb_js_1.file_google_protobuf_any, source_context_pb_js_1.file_google_protobuf_source_context]);
26
26
  /**
27
27
  * Describes the message google.protobuf.Type.
28
- * Use `create(TypeDesc)` to create a new message.
28
+ * Use `create(TypeSchema)` to create a new message.
29
29
  */
30
- exports.TypeDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_type, 0);
30
+ exports.TypeSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_type, 0);
31
31
  /**
32
32
  * Describes the message google.protobuf.Field.
33
- * Use `create(FieldDesc)` to create a new message.
33
+ * Use `create(FieldSchema)` to create a new message.
34
34
  */
35
- exports.FieldDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_type, 1);
35
+ exports.FieldSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_type, 1);
36
36
  /**
37
37
  * Basic field types.
38
38
  *
@@ -158,7 +158,7 @@ var Field_Kind;
158
158
  /**
159
159
  * Describes the enum google.protobuf.Field.Kind.
160
160
  */
161
- exports.Field_KindDesc = (0, enum_js_1.enumDesc)(exports.fileDesc_google_protobuf_type, 1, 0);
161
+ exports.Field_KindSchema = (0, enum_js_1.enumDesc)(exports.file_google_protobuf_type, 1, 0);
162
162
  /**
163
163
  * Whether a field is optional, required, or repeated.
164
164
  *
@@ -194,22 +194,22 @@ var Field_Cardinality;
194
194
  /**
195
195
  * Describes the enum google.protobuf.Field.Cardinality.
196
196
  */
197
- exports.Field_CardinalityDesc = (0, enum_js_1.enumDesc)(exports.fileDesc_google_protobuf_type, 1, 1);
197
+ exports.Field_CardinalitySchema = (0, enum_js_1.enumDesc)(exports.file_google_protobuf_type, 1, 1);
198
198
  /**
199
199
  * Describes the message google.protobuf.Enum.
200
- * Use `create(EnumDesc)` to create a new message.
200
+ * Use `create(EnumSchema)` to create a new message.
201
201
  */
202
- exports.EnumDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_type, 2);
202
+ exports.EnumSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_type, 2);
203
203
  /**
204
204
  * Describes the message google.protobuf.EnumValue.
205
- * Use `create(EnumValueDesc)` to create a new message.
205
+ * Use `create(EnumValueSchema)` to create a new message.
206
206
  */
207
- exports.EnumValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_type, 3);
207
+ exports.EnumValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_type, 3);
208
208
  /**
209
209
  * Describes the message google.protobuf.Option.
210
- * Use `create(OptionDesc)` to create a new message.
210
+ * Use `create(OptionSchema)` to create a new message.
211
211
  */
212
- exports.OptionDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_type, 4);
212
+ exports.OptionSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_type, 4);
213
213
  /**
214
214
  * The syntax in which a protocol buffer element is defined.
215
215
  *
@@ -239,4 +239,4 @@ var Syntax;
239
239
  /**
240
240
  * Describes the enum google.protobuf.Syntax.
241
241
  */
242
- exports.SyntaxDesc = (0, enum_js_1.enumDesc)(exports.fileDesc_google_protobuf_type, 0);
242
+ exports.SyntaxSchema = (0, enum_js_1.enumDesc)(exports.file_google_protobuf_type, 0);
@@ -3,7 +3,7 @@ import type { Message } from "../../../../types.js";
3
3
  /**
4
4
  * Describes the file google/protobuf/wrappers.proto.
5
5
  */
6
- export declare const fileDesc_google_protobuf_wrappers: GenDescFile;
6
+ export declare const file_google_protobuf_wrappers: GenDescFile;
7
7
  /**
8
8
  * Wrapper message for `double`.
9
9
  *
@@ -19,11 +19,15 @@ export type DoubleValue = Message<"google.protobuf.DoubleValue"> & {
19
19
  */
20
20
  value: number;
21
21
  };
22
+ /**
23
+ * JSON type for the message google.protobuf.DoubleValue.
24
+ */
25
+ export type DoubleValueJson = number | "NaN" | "Infinity" | "-Infinity";
22
26
  /**
23
27
  * Describes the message google.protobuf.DoubleValue.
24
- * Use `create(DoubleValueDesc)` to create a new message.
28
+ * Use `create(DoubleValueSchema)` to create a new message.
25
29
  */
26
- export declare const DoubleValueDesc: GenDescMessage<DoubleValue>;
30
+ export declare const DoubleValueSchema: GenDescMessage<DoubleValue, DoubleValueJson>;
27
31
  /**
28
32
  * Wrapper message for `float`.
29
33
  *
@@ -39,11 +43,15 @@ export type FloatValue = Message<"google.protobuf.FloatValue"> & {
39
43
  */
40
44
  value: number;
41
45
  };
46
+ /**
47
+ * JSON type for the message google.protobuf.FloatValue.
48
+ */
49
+ export type FloatValueJson = number | "NaN" | "Infinity" | "-Infinity";
42
50
  /**
43
51
  * Describes the message google.protobuf.FloatValue.
44
- * Use `create(FloatValueDesc)` to create a new message.
52
+ * Use `create(FloatValueSchema)` to create a new message.
45
53
  */
46
- export declare const FloatValueDesc: GenDescMessage<FloatValue>;
54
+ export declare const FloatValueSchema: GenDescMessage<FloatValue, FloatValueJson>;
47
55
  /**
48
56
  * Wrapper message for `int64`.
49
57
  *
@@ -59,11 +67,15 @@ export type Int64Value = Message<"google.protobuf.Int64Value"> & {
59
67
  */
60
68
  value: bigint;
61
69
  };
70
+ /**
71
+ * JSON type for the message google.protobuf.Int64Value.
72
+ */
73
+ export type Int64ValueJson = string;
62
74
  /**
63
75
  * Describes the message google.protobuf.Int64Value.
64
- * Use `create(Int64ValueDesc)` to create a new message.
76
+ * Use `create(Int64ValueSchema)` to create a new message.
65
77
  */
66
- export declare const Int64ValueDesc: GenDescMessage<Int64Value>;
78
+ export declare const Int64ValueSchema: GenDescMessage<Int64Value, Int64ValueJson>;
67
79
  /**
68
80
  * Wrapper message for `uint64`.
69
81
  *
@@ -79,11 +91,15 @@ export type UInt64Value = Message<"google.protobuf.UInt64Value"> & {
79
91
  */
80
92
  value: bigint;
81
93
  };
94
+ /**
95
+ * JSON type for the message google.protobuf.UInt64Value.
96
+ */
97
+ export type UInt64ValueJson = string;
82
98
  /**
83
99
  * Describes the message google.protobuf.UInt64Value.
84
- * Use `create(UInt64ValueDesc)` to create a new message.
100
+ * Use `create(UInt64ValueSchema)` to create a new message.
85
101
  */
86
- export declare const UInt64ValueDesc: GenDescMessage<UInt64Value>;
102
+ export declare const UInt64ValueSchema: GenDescMessage<UInt64Value, UInt64ValueJson>;
87
103
  /**
88
104
  * Wrapper message for `int32`.
89
105
  *
@@ -99,11 +115,15 @@ export type Int32Value = Message<"google.protobuf.Int32Value"> & {
99
115
  */
100
116
  value: number;
101
117
  };
118
+ /**
119
+ * JSON type for the message google.protobuf.Int32Value.
120
+ */
121
+ export type Int32ValueJson = number;
102
122
  /**
103
123
  * Describes the message google.protobuf.Int32Value.
104
- * Use `create(Int32ValueDesc)` to create a new message.
124
+ * Use `create(Int32ValueSchema)` to create a new message.
105
125
  */
106
- export declare const Int32ValueDesc: GenDescMessage<Int32Value>;
126
+ export declare const Int32ValueSchema: GenDescMessage<Int32Value, Int32ValueJson>;
107
127
  /**
108
128
  * Wrapper message for `uint32`.
109
129
  *
@@ -119,11 +139,15 @@ export type UInt32Value = Message<"google.protobuf.UInt32Value"> & {
119
139
  */
120
140
  value: number;
121
141
  };
142
+ /**
143
+ * JSON type for the message google.protobuf.UInt32Value.
144
+ */
145
+ export type UInt32ValueJson = number;
122
146
  /**
123
147
  * Describes the message google.protobuf.UInt32Value.
124
- * Use `create(UInt32ValueDesc)` to create a new message.
148
+ * Use `create(UInt32ValueSchema)` to create a new message.
125
149
  */
126
- export declare const UInt32ValueDesc: GenDescMessage<UInt32Value>;
150
+ export declare const UInt32ValueSchema: GenDescMessage<UInt32Value, UInt32ValueJson>;
127
151
  /**
128
152
  * Wrapper message for `bool`.
129
153
  *
@@ -139,11 +163,15 @@ export type BoolValue = Message<"google.protobuf.BoolValue"> & {
139
163
  */
140
164
  value: boolean;
141
165
  };
166
+ /**
167
+ * JSON type for the message google.protobuf.BoolValue.
168
+ */
169
+ export type BoolValueJson = boolean;
142
170
  /**
143
171
  * Describes the message google.protobuf.BoolValue.
144
- * Use `create(BoolValueDesc)` to create a new message.
172
+ * Use `create(BoolValueSchema)` to create a new message.
145
173
  */
146
- export declare const BoolValueDesc: GenDescMessage<BoolValue>;
174
+ export declare const BoolValueSchema: GenDescMessage<BoolValue, BoolValueJson>;
147
175
  /**
148
176
  * Wrapper message for `string`.
149
177
  *
@@ -159,11 +187,15 @@ export type StringValue = Message<"google.protobuf.StringValue"> & {
159
187
  */
160
188
  value: string;
161
189
  };
190
+ /**
191
+ * JSON type for the message google.protobuf.StringValue.
192
+ */
193
+ export type StringValueJson = string;
162
194
  /**
163
195
  * Describes the message google.protobuf.StringValue.
164
- * Use `create(StringValueDesc)` to create a new message.
196
+ * Use `create(StringValueSchema)` to create a new message.
165
197
  */
166
- export declare const StringValueDesc: GenDescMessage<StringValue>;
198
+ export declare const StringValueSchema: GenDescMessage<StringValue, StringValueJson>;
167
199
  /**
168
200
  * Wrapper message for `bytes`.
169
201
  *
@@ -179,8 +211,12 @@ export type BytesValue = Message<"google.protobuf.BytesValue"> & {
179
211
  */
180
212
  value: Uint8Array;
181
213
  };
214
+ /**
215
+ * JSON type for the message google.protobuf.BytesValue.
216
+ */
217
+ export type BytesValueJson = string;
182
218
  /**
183
219
  * Describes the message google.protobuf.BytesValue.
184
- * Use `create(BytesValueDesc)` to create a new message.
220
+ * Use `create(BytesValueSchema)` to create a new message.
185
221
  */
186
- export declare const BytesValueDesc: GenDescMessage<BytesValue>;
222
+ export declare const BytesValueSchema: GenDescMessage<BytesValue, BytesValueJson>;
@@ -13,55 +13,55 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.BytesValueDesc = exports.StringValueDesc = exports.BoolValueDesc = exports.UInt32ValueDesc = exports.Int32ValueDesc = exports.UInt64ValueDesc = exports.Int64ValueDesc = exports.FloatValueDesc = exports.DoubleValueDesc = exports.fileDesc_google_protobuf_wrappers = void 0;
16
+ exports.BytesValueSchema = exports.StringValueSchema = exports.BoolValueSchema = exports.UInt32ValueSchema = exports.Int32ValueSchema = exports.UInt64ValueSchema = exports.Int64ValueSchema = exports.FloatValueSchema = exports.DoubleValueSchema = exports.file_google_protobuf_wrappers = void 0;
17
17
  const file_js_1 = require("../../../../codegenv1/file.js");
18
18
  const message_js_1 = require("../../../../codegenv1/message.js");
19
19
  /**
20
20
  * Describes the file google/protobuf/wrappers.proto.
21
21
  */
22
- exports.fileDesc_google_protobuf_wrappers = (0, file_js_1.fileDesc)("Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZhbHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASABKAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoDSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUSDQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEKDAQoTY29tLmdvb2dsZS5wcm90b2J1ZkINV3JhcHBlcnNQcm90b1ABWjFnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi93cmFwcGVyc3Bi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");
22
+ exports.file_google_protobuf_wrappers = (0, file_js_1.fileDesc)("Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZhbHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASABKAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoDSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUSDQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEKDAQoTY29tLmdvb2dsZS5wcm90b2J1ZkINV3JhcHBlcnNQcm90b1ABWjFnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi93cmFwcGVyc3Bi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");
23
23
  /**
24
24
  * Describes the message google.protobuf.DoubleValue.
25
- * Use `create(DoubleValueDesc)` to create a new message.
25
+ * Use `create(DoubleValueSchema)` to create a new message.
26
26
  */
27
- exports.DoubleValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 0);
27
+ exports.DoubleValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 0);
28
28
  /**
29
29
  * Describes the message google.protobuf.FloatValue.
30
- * Use `create(FloatValueDesc)` to create a new message.
30
+ * Use `create(FloatValueSchema)` to create a new message.
31
31
  */
32
- exports.FloatValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 1);
32
+ exports.FloatValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 1);
33
33
  /**
34
34
  * Describes the message google.protobuf.Int64Value.
35
- * Use `create(Int64ValueDesc)` to create a new message.
35
+ * Use `create(Int64ValueSchema)` to create a new message.
36
36
  */
37
- exports.Int64ValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 2);
37
+ exports.Int64ValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 2);
38
38
  /**
39
39
  * Describes the message google.protobuf.UInt64Value.
40
- * Use `create(UInt64ValueDesc)` to create a new message.
40
+ * Use `create(UInt64ValueSchema)` to create a new message.
41
41
  */
42
- exports.UInt64ValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 3);
42
+ exports.UInt64ValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 3);
43
43
  /**
44
44
  * Describes the message google.protobuf.Int32Value.
45
- * Use `create(Int32ValueDesc)` to create a new message.
45
+ * Use `create(Int32ValueSchema)` to create a new message.
46
46
  */
47
- exports.Int32ValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 4);
47
+ exports.Int32ValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 4);
48
48
  /**
49
49
  * Describes the message google.protobuf.UInt32Value.
50
- * Use `create(UInt32ValueDesc)` to create a new message.
50
+ * Use `create(UInt32ValueSchema)` to create a new message.
51
51
  */
52
- exports.UInt32ValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 5);
52
+ exports.UInt32ValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 5);
53
53
  /**
54
54
  * Describes the message google.protobuf.BoolValue.
55
- * Use `create(BoolValueDesc)` to create a new message.
55
+ * Use `create(BoolValueSchema)` to create a new message.
56
56
  */
57
- exports.BoolValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 6);
57
+ exports.BoolValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 6);
58
58
  /**
59
59
  * Describes the message google.protobuf.StringValue.
60
- * Use `create(StringValueDesc)` to create a new message.
60
+ * Use `create(StringValueSchema)` to create a new message.
61
61
  */
62
- exports.StringValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 7);
62
+ exports.StringValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 7);
63
63
  /**
64
64
  * Describes the message google.protobuf.BytesValue.
65
- * Use `create(BytesValueDesc)` to create a new message.
65
+ * Use `create(BytesValueSchema)` to create a new message.
66
66
  */
67
- exports.BytesValueDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_wrappers, 8);
67
+ exports.BytesValueSchema = (0, message_js_1.messageDesc)(exports.file_google_protobuf_wrappers, 8);
@@ -21,7 +21,6 @@ const proto_int64_js_1 = require("../proto-int64.js");
21
21
  * Create a google.protobuf.Timestamp for the current time.
22
22
  */
23
23
  function timestampNow() {
24
- Date.now();
25
24
  return timestampFromDate(new Date());
26
25
  }
27
26
  exports.timestampNow = timestampNow;
@@ -43,7 +42,7 @@ exports.timestampDate = timestampDate;
43
42
  * Create a google.protobuf.Timestamp message from a Unix timestamp in milliseconds.
44
43
  */
45
44
  function timestampFromMs(timestampMs) {
46
- return (0, create_js_1.create)(timestamp_pb_js_1.TimestampDesc, {
45
+ return (0, create_js_1.create)(timestamp_pb_js_1.TimestampSchema, {
47
46
  seconds: proto_int64_js_1.protoInt64.parse(Math.floor(timestampMs / 1000)),
48
47
  nanos: (timestampMs % 1000) * 1000000,
49
48
  });
@@ -3,4 +3,4 @@ import { type DescMessage } from "./descriptors.js";
3
3
  /**
4
4
  * Create a deep copy of a message, including extensions and unknown fields.
5
5
  */
6
- export declare function clone<Desc extends DescMessage>(messageDesc: Desc, message: MessageShape<Desc>): MessageShape<Desc>;
6
+ export declare function clone<Desc extends DescMessage>(schema: Desc, message: MessageShape<Desc>): MessageShape<Desc>;
package/dist/esm/clone.js CHANGED
@@ -17,9 +17,8 @@ import { isReflectMessage } from "./reflect/guard.js";
17
17
  /**
18
18
  * Create a deep copy of a message, including extensions and unknown fields.
19
19
  */
20
- export function clone(messageDesc, message) {
21
- return cloneReflect(reflect(messageDesc, message))
22
- .message;
20
+ export function clone(schema, message) {
21
+ return cloneReflect(reflect(schema, message)).message;
23
22
  }
24
23
  function cloneReflect(i) {
25
24
  const o = reflect(i.desc);
@@ -29,31 +28,21 @@ function cloneReflect(i) {
29
28
  }
30
29
  switch (f.fieldKind) {
31
30
  default: {
32
- const err = o.set(f, cloneSingular(f, i.get(f)));
33
- if (err) {
34
- throw err;
35
- }
31
+ o.set(f, cloneSingular(f, i.get(f)));
36
32
  break;
37
33
  }
38
34
  case "list":
39
35
  // eslint-disable-next-line no-case-declarations
40
36
  const list = o.get(f);
41
37
  for (const item of i.get(f)) {
42
- const err = list.add(cloneSingular(f, item));
43
- if (err) {
44
- throw err;
45
- }
38
+ list.add(cloneSingular(f, item));
46
39
  }
47
40
  break;
48
41
  case "map":
49
42
  // eslint-disable-next-line no-case-declarations
50
43
  const map = o.get(f);
51
44
  for (const entry of i.get(f).entries()) {
52
- // @ts-expect-error TODO fix type error
53
- const err = map.set(entry[0], cloneSingular(f, entry[1]));
54
- if (err) {
55
- throw err;
56
- }
45
+ map.set(entry[0], cloneSingular(f, entry[1]));
57
46
  }
58
47
  break;
59
48
  }
@@ -16,7 +16,7 @@ import { isFieldSet, clearField } from "../fields.js";
16
16
  import { base64Encode } from "../wire/base64-encoding.js";
17
17
  import { toBinary } from "../to-binary.js";
18
18
  import { clone } from "../clone.js";
19
- import { Edition, FieldDescriptorProtoDesc, FieldOptionsDesc, FileDescriptorProtoDesc, } from "../wkt/gen/google/protobuf/descriptor_pb.js";
19
+ import { Edition, FieldDescriptorProtoSchema, FieldOptionsSchema, FileDescriptorProtoSchema, } from "../wkt/gen/google/protobuf/descriptor_pb.js";
20
20
  /**
21
21
  * Create necessary information to embed a file descriptor in
22
22
  * generated code.
@@ -27,14 +27,14 @@ export function embedFileDesc(file) {
27
27
  const embed = {
28
28
  bootable: false,
29
29
  proto() {
30
- const stripped = clone(FileDescriptorProtoDesc, file);
31
- clearField(stripped, FileDescriptorProtoDesc.field.dependency);
32
- clearField(stripped, FileDescriptorProtoDesc.field.sourceCodeInfo);
30
+ const stripped = clone(FileDescriptorProtoSchema, file);
31
+ clearField(stripped, FileDescriptorProtoSchema.field.dependency);
32
+ clearField(stripped, FileDescriptorProtoSchema.field.sourceCodeInfo);
33
33
  stripped.messageType.map(stripJsonNames);
34
34
  return stripped;
35
35
  },
36
36
  base64() {
37
- const bytes = toBinary(FileDescriptorProtoDesc, this.proto());
37
+ const bytes = toBinary(FileDescriptorProtoSchema, this.proto());
38
38
  return base64Encode(bytes, "std_raw");
39
39
  },
40
40
  };
@@ -46,7 +46,7 @@ export function embedFileDesc(file) {
46
46
  function stripJsonNames(d) {
47
47
  for (const f of d.field) {
48
48
  if (f.jsonName === protoCamelCase(f.name)) {
49
- clearField(f, FieldDescriptorProtoDesc.field.jsonName);
49
+ clearField(f, FieldDescriptorProtoSchema.field.jsonName);
50
50
  }
51
51
  }
52
52
  for (const n of d.nestedType) {
@@ -155,27 +155,27 @@ function createDescriptorBoot(proto) {
155
155
  return b;
156
156
  }
157
157
  function createFieldDescriptorBoot(proto) {
158
- assert(isFieldSet(proto, FieldDescriptorProtoDesc.field.name));
159
- assert(isFieldSet(proto, FieldDescriptorProtoDesc.field.number));
160
- assert(isFieldSet(proto, FieldDescriptorProtoDesc.field.type));
161
- assert(!isFieldSet(proto, FieldDescriptorProtoDesc.field.oneofIndex));
162
- assert(!isFieldSet(proto, FieldDescriptorProtoDesc.field.jsonName) ||
158
+ assert(isFieldSet(proto, FieldDescriptorProtoSchema.field.name));
159
+ assert(isFieldSet(proto, FieldDescriptorProtoSchema.field.number));
160
+ assert(isFieldSet(proto, FieldDescriptorProtoSchema.field.type));
161
+ assert(!isFieldSet(proto, FieldDescriptorProtoSchema.field.oneofIndex));
162
+ assert(!isFieldSet(proto, FieldDescriptorProtoSchema.field.jsonName) ||
163
163
  proto.jsonName === protoCamelCase(proto.name));
164
164
  const b = {
165
165
  name: proto.name,
166
166
  number: proto.number,
167
167
  type: proto.type,
168
168
  };
169
- if (isFieldSet(proto, FieldDescriptorProtoDesc.field.label)) {
169
+ if (isFieldSet(proto, FieldDescriptorProtoSchema.field.label)) {
170
170
  b.label = proto.label;
171
171
  }
172
- if (isFieldSet(proto, FieldDescriptorProtoDesc.field.typeName)) {
172
+ if (isFieldSet(proto, FieldDescriptorProtoSchema.field.typeName)) {
173
173
  b.typeName = proto.typeName;
174
174
  }
175
- if (isFieldSet(proto, FieldDescriptorProtoDesc.field.extendee)) {
175
+ if (isFieldSet(proto, FieldDescriptorProtoSchema.field.extendee)) {
176
176
  b.extendee = proto.extendee;
177
177
  }
178
- if (isFieldSet(proto, FieldDescriptorProtoDesc.field.defaultValue)) {
178
+ if (isFieldSet(proto, FieldDescriptorProtoSchema.field.defaultValue)) {
179
179
  b.defaultValue = proto.defaultValue;
180
180
  }
181
181
  if (proto.options) {
@@ -185,19 +185,19 @@ function createFieldDescriptorBoot(proto) {
185
185
  }
186
186
  function createFieldOptionsBoot(proto) {
187
187
  const b = {};
188
- assert(!isFieldSet(proto, FieldOptionsDesc.field.ctype));
189
- if (isFieldSet(proto, FieldOptionsDesc.field.packed)) {
188
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.ctype));
189
+ if (isFieldSet(proto, FieldOptionsSchema.field.packed)) {
190
190
  b.packed = proto.packed;
191
191
  }
192
- assert(!isFieldSet(proto, FieldOptionsDesc.field.jstype));
193
- assert(!isFieldSet(proto, FieldOptionsDesc.field.lazy));
194
- assert(!isFieldSet(proto, FieldOptionsDesc.field.unverifiedLazy));
195
- if (isFieldSet(proto, FieldOptionsDesc.field.deprecated)) {
192
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.jstype));
193
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.lazy));
194
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.unverifiedLazy));
195
+ if (isFieldSet(proto, FieldOptionsSchema.field.deprecated)) {
196
196
  b.deprecated = proto.deprecated;
197
197
  }
198
- assert(!isFieldSet(proto, FieldOptionsDesc.field.weak));
199
- assert(!isFieldSet(proto, FieldOptionsDesc.field.debugRedact));
200
- if (isFieldSet(proto, FieldOptionsDesc.field.retention)) {
198
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.weak));
199
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.debugRedact));
200
+ if (isFieldSet(proto, FieldOptionsSchema.field.retention)) {
201
201
  b.retention = proto.retention;
202
202
  }
203
203
  if (proto.targets.length) {
@@ -209,8 +209,8 @@ function createFieldOptionsBoot(proto) {
209
209
  edition: d.edition,
210
210
  }));
211
211
  }
212
- assert(!isFieldSet(proto, FieldOptionsDesc.field.features));
213
- assert(!isFieldSet(proto, FieldOptionsDesc.field.uninterpretedOption));
212
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.features));
213
+ assert(!isFieldSet(proto, FieldOptionsSchema.field.uninterpretedOption));
214
214
  return b;
215
215
  }
216
216
  function createEnumDescriptorBoot(proto) {
@@ -1,11 +1,12 @@
1
1
  import type { DescEnum, DescFile } from "../descriptors.js";
2
2
  import type { GenDescEnum } from "./types.js";
3
+ import type { JsonValue } from "../json-value.js";
3
4
  /**
4
5
  * Hydrate an enum descriptor.
5
6
  *
6
7
  * @private
7
8
  */
8
- export declare function enumDesc<Shape>(file: DescFile, path: number, ...paths: number[]): GenDescEnum<Shape>;
9
+ export declare function enumDesc<Shape, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescEnum<Shape, JsonType>;
9
10
  /**
10
11
  * Construct a TypeScript enum object at runtime from a descriptor.
11
12
  */
@@ -12,7 +12,7 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { base64Decode } from "../wire/base64-encoding.js";
15
- import { FileDescriptorProtoDesc } from "../wkt/gen/google/protobuf/descriptor_pb.js";
15
+ import { FileDescriptorProtoSchema } from "../wkt/gen/google/protobuf/descriptor_pb.js";
16
16
  import { createFileRegistry } from "../registry.js";
17
17
  import { restoreJsonNames } from "./restore-json-names.js";
18
18
  import { fromBinary } from "../from-binary.js";
@@ -23,7 +23,7 @@ import { fromBinary } from "../from-binary.js";
23
23
  */
24
24
  export function fileDesc(b64, imports) {
25
25
  var _a;
26
- const root = fromBinary(FileDescriptorProtoDesc, base64Decode(b64));
26
+ const root = fromBinary(FileDescriptorProtoSchema, base64Decode(b64));
27
27
  root.messageType.forEach(restoreJsonNames);
28
28
  root.dependency = (_a = imports === null || imports === void 0 ? void 0 : imports.map((f) => f.proto.name)) !== null && _a !== void 0 ? _a : [];
29
29
  const reg = createFileRegistry(root, (protoFileName) => imports === null || imports === void 0 ? void 0 : imports.find((f) => f.proto.name === protoFileName));
@@ -1,9 +1,10 @@
1
1
  import type { Message } from "../types.js";
2
2
  import type { DescFile } from "../descriptors.js";
3
3
  import type { GenDescMessage } from "./types.js";
4
+ import type { JsonValue } from "../json-value.js";
4
5
  /**
5
6
  * Hydrate a message descriptor.
6
7
  *
7
8
  * @private
8
9
  */
9
- export declare function messageDesc<Shape extends Message>(file: DescFile, path: number, ...paths: number[]): GenDescMessage<Shape>;
10
+ export declare function messageDesc<Shape extends Message, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescMessage<Shape, JsonType>;
@@ -3,3 +3,7 @@ import { ScalarType } from "../descriptors.js";
3
3
  * Return the TypeScript type (as a string) for the given scalar type.
4
4
  */
5
5
  export declare function scalarTypeScriptType(scalar: ScalarType, longAsString: boolean): "string" | "boolean" | "bigint" | "bigint | string" | "Uint8Array" | "number";
6
+ /**
7
+ * Return the JSON type (as a string) for the given scalar type.
8
+ */
9
+ export declare function scalarJsonType(scalar: ScalarType): "string" | "boolean" | "number" | `number | "NaN" | "Infinity" | "-Infinity"`;
@@ -33,3 +33,31 @@ export function scalarTypeScriptType(scalar, longAsString) {
33
33
  return "number";
34
34
  }
35
35
  }
36
+ /**
37
+ * Return the JSON type (as a string) for the given scalar type.
38
+ */
39
+ export function scalarJsonType(scalar) {
40
+ switch (scalar) {
41
+ case ScalarType.DOUBLE:
42
+ case ScalarType.FLOAT:
43
+ return `number | "NaN" | "Infinity" | "-Infinity"`;
44
+ case ScalarType.UINT64:
45
+ case ScalarType.SFIXED64:
46
+ case ScalarType.FIXED64:
47
+ case ScalarType.SINT64:
48
+ case ScalarType.INT64:
49
+ return "string";
50
+ case ScalarType.INT32:
51
+ case ScalarType.FIXED32:
52
+ case ScalarType.UINT32:
53
+ case ScalarType.SFIXED32:
54
+ case ScalarType.SINT32:
55
+ return "number";
56
+ case ScalarType.STRING:
57
+ return "string";
58
+ case ScalarType.BOOL:
59
+ return "boolean";
60
+ case ScalarType.BYTES:
61
+ return "string";
62
+ }
63
+ }
@@ -60,6 +60,16 @@ export declare const symbols: {
60
60
  readonly bootstrapWktFrom: "../../proto-int64.js";
61
61
  readonly from: "@bufbuild/protobuf";
62
62
  };
63
+ readonly JsonValue: {
64
+ readonly typeOnly: true;
65
+ readonly bootstrapWktFrom: "../../json-value.js";
66
+ readonly from: "@bufbuild/protobuf";
67
+ };
68
+ readonly JsonObject: {
69
+ readonly typeOnly: true;
70
+ readonly bootstrapWktFrom: "../../json-value.js";
71
+ readonly from: "@bufbuild/protobuf";
72
+ };
63
73
  readonly codegen: {
64
74
  readonly boot: {
65
75
  readonly typeOnly: false;
@@ -47,6 +47,8 @@ export const symbols = {
47
47
  toJson: { typeOnly: false, bootstrapWktFrom: "../../to-json.js", from: packageName },
48
48
  toJsonString: { typeOnly: false, bootstrapWktFrom: "../../to-json.js", from: packageName },
49
49
  protoInt64: { typeOnly: false, bootstrapWktFrom: "../../proto-int64.js", from: packageName },
50
+ JsonValue: { typeOnly: true, bootstrapWktFrom: "../../json-value.js", from: packageName },
51
+ JsonObject: { typeOnly: true, bootstrapWktFrom: "../../json-value.js", from: packageName },
50
52
  codegen: {
51
53
  boot: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/boot.js", from: packageName + "/codegenv1" },
52
54
  fileDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/file.js", from: packageName + "/codegenv1" },