@bufbuild/protobuf 1.9.0 → 2.0.0-alpha.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.
- package/dist/cjs/clone.d.ts +6 -0
- package/dist/cjs/clone.js +77 -0
- package/dist/cjs/codegenv1/boot.d.ts +63 -0
- package/dist/cjs/codegenv1/boot.js +102 -0
- package/dist/cjs/codegenv1/embed.d.ts +43 -0
- package/dist/cjs/codegenv1/embed.js +238 -0
- package/dist/cjs/codegenv1/enum.d.ts +17 -0
- package/dist/cjs/codegenv1/enum.js +41 -0
- package/dist/cjs/codegenv1/extension.d.ts +9 -0
- package/dist/cjs/codegenv1/extension.js +29 -0
- package/dist/cjs/codegenv1/file.d.ts +7 -0
- package/dist/cjs/codegenv1/file.js +38 -0
- package/dist/cjs/codegenv1/index.d.ts +9 -0
- package/dist/cjs/codegenv1/index.js +38 -0
- package/dist/cjs/codegenv1/message.d.ts +9 -0
- package/dist/cjs/codegenv1/message.js +25 -0
- package/dist/cjs/codegenv1/restore-json-names.d.ts +5 -0
- package/dist/cjs/codegenv1/restore-json-names.js +30 -0
- package/dist/cjs/codegenv1/service.d.ts +8 -0
- package/dist/cjs/codegenv1/service.js +28 -0
- package/dist/cjs/codegenv1/symbols.d.ts +125 -0
- package/dist/cjs/codegenv1/symbols.js +67 -0
- package/dist/cjs/codegenv1/types.d.ts +72 -0
- package/dist/cjs/codegenv1/types.js +21 -0
- package/dist/cjs/create.d.ts +9 -0
- package/dist/cjs/create.js +231 -0
- package/dist/{esm/descriptor-set.d.ts → cjs/desc-types.d.ts} +162 -243
- package/dist/cjs/equals.d.ts +9 -0
- package/dist/cjs/equals.js +133 -0
- package/dist/cjs/extensions.d.ts +59 -0
- package/dist/cjs/extensions.js +169 -0
- package/dist/cjs/fields.d.ts +23 -0
- package/dist/cjs/fields.js +46 -0
- package/dist/cjs/from-binary.d.ts +34 -0
- package/dist/cjs/from-binary.js +211 -0
- package/dist/cjs/from-json.d.ts +48 -0
- package/dist/cjs/from-json.js +610 -0
- package/dist/cjs/index.d.ts +16 -42
- package/dist/cjs/index.js +23 -55
- package/dist/cjs/is-message.d.ts +5 -20
- package/dist/cjs/is-message.js +11 -29
- package/dist/cjs/json-value.d.ts +16 -0
- package/dist/cjs/proto-int64.js +2 -2
- package/dist/cjs/reflect/error.d.ts +9 -0
- package/dist/cjs/reflect/error.js +36 -0
- package/dist/cjs/reflect/guard.d.ts +20 -0
- package/dist/cjs/reflect/guard.js +78 -0
- package/dist/cjs/reflect/index.d.ts +8 -0
- package/dist/cjs/reflect/index.js +41 -0
- package/dist/cjs/reflect/names.d.ts +11 -0
- package/dist/cjs/reflect/names.js +74 -0
- package/dist/cjs/reflect/nested-types.d.ts +12 -0
- package/dist/cjs/reflect/nested-types.js +71 -0
- package/dist/cjs/reflect/reflect-check.d.ts +10 -0
- package/dist/cjs/reflect/reflect-check.js +150 -0
- package/dist/cjs/reflect/reflect-types.d.ts +284 -0
- package/dist/cjs/{extension.js → reflect/reflect-types.js} +1 -0
- package/dist/cjs/reflect/reflect.d.ts +32 -0
- package/dist/cjs/reflect/reflect.js +434 -0
- package/dist/cjs/reflect/registry.d.ts +82 -0
- package/dist/cjs/reflect/registry.js +879 -0
- package/dist/{esm → cjs/reflect}/scalar.d.ts +21 -1
- package/dist/cjs/reflect/scalar.js +298 -0
- package/dist/cjs/reflect/unsafe.d.ts +58 -0
- package/dist/cjs/reflect/unsafe.js +166 -0
- package/dist/cjs/to-binary.d.ts +24 -0
- package/dist/cjs/to-binary.js +192 -0
- package/dist/cjs/to-json.d.ts +50 -0
- package/dist/cjs/to-json.js +364 -0
- package/dist/cjs/types.d.ts +68 -0
- package/dist/cjs/wire/base64-encoding.d.ts +23 -0
- package/dist/cjs/wire/base64-encoding.js +156 -0
- package/dist/cjs/wire/binary-encoding.d.ts +244 -0
- package/dist/cjs/{binary-encoding.js → wire/binary-encoding.js} +27 -20
- package/dist/cjs/wire/index.d.ts +5 -0
- package/dist/cjs/wire/index.js +34 -0
- package/dist/cjs/wire/size-delimited.d.ts +51 -0
- package/dist/cjs/wire/size-delimited.js +154 -0
- package/dist/cjs/wire/text-encoding.d.ts +26 -0
- package/dist/cjs/wire/text-encoding.js +55 -0
- package/dist/cjs/wire/text-format.d.ts +14 -0
- package/dist/cjs/{private → wire}/text-format.js +12 -2
- package/dist/{esm/google → cjs/wire}/varint.d.ts +2 -2
- package/dist/cjs/{google → wire}/varint.js +11 -10
- package/dist/cjs/wkt/any.d.ts +38 -0
- package/dist/cjs/wkt/any.js +76 -0
- package/dist/{esm → cjs/wkt/gen}/google/protobuf/any_pb.d.ts +13 -27
- package/dist/cjs/wkt/gen/google/protobuf/any_pb.js +27 -0
- package/dist/cjs/{google → wkt/gen/google}/protobuf/api_pb.d.ts +29 -38
- package/dist/cjs/wkt/gen/google/protobuf/api_pb.js +39 -0
- package/dist/cjs/{google → wkt/gen/google}/protobuf/compiler/plugin_pb.d.ts +67 -75
- package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +68 -0
- package/dist/cjs/{google → wkt/gen/google}/protobuf/descriptor_pb.d.ts +564 -527
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +794 -0
- package/dist/cjs/{google → wkt/gen/google}/protobuf/duration_pb.d.ts +13 -18
- package/dist/cjs/wkt/gen/google/protobuf/duration_pb.js +27 -0
- package/dist/cjs/wkt/gen/google/protobuf/empty_pb.d.ts +24 -0
- package/dist/cjs/wkt/gen/google/protobuf/empty_pb.js +27 -0
- package/dist/{esm → cjs/wkt/gen}/google/protobuf/field_mask_pb.d.ts +13 -18
- package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.js +27 -0
- package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.d.ts +26 -0
- package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.js +27 -0
- package/dist/{esm → cjs/wkt/gen}/google/protobuf/struct_pb.d.ts +44 -55
- package/dist/cjs/wkt/gen/google/protobuf/struct_pb.js +59 -0
- package/dist/cjs/{google → wkt/gen/google}/protobuf/timestamp_pb.d.ts +13 -21
- package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.js +27 -0
- package/dist/{esm → cjs/wkt/gen}/google/protobuf/type_pb.d.ts +77 -80
- package/dist/cjs/wkt/gen/google/protobuf/type_pb.js +242 -0
- package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +186 -0
- package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.js +67 -0
- package/dist/cjs/wkt/index.d.ts +15 -0
- package/dist/cjs/wkt/index.js +44 -0
- package/dist/cjs/wkt/timestamp.d.ts +21 -0
- package/dist/cjs/wkt/timestamp.js +58 -0
- package/dist/cjs/wkt/wrappers.d.ts +15 -0
- package/dist/cjs/wkt/wrappers.js +43 -0
- package/dist/esm/clone.d.ts +6 -0
- package/dist/esm/clone.js +73 -0
- package/dist/esm/codegenv1/boot.d.ts +63 -0
- package/dist/esm/codegenv1/boot.js +97 -0
- package/dist/esm/codegenv1/embed.d.ts +43 -0
- package/dist/esm/codegenv1/embed.js +232 -0
- package/dist/esm/codegenv1/enum.d.ts +17 -0
- package/dist/esm/codegenv1/enum.js +36 -0
- package/dist/esm/codegenv1/extension.d.ts +9 -0
- package/dist/esm/codegenv1/extension.js +25 -0
- package/dist/esm/codegenv1/file.d.ts +7 -0
- package/dist/esm/codegenv1/file.js +34 -0
- package/dist/esm/codegenv1/index.d.ts +9 -0
- package/dist/esm/codegenv1/index.js +22 -0
- package/dist/esm/codegenv1/message.d.ts +9 -0
- package/dist/esm/codegenv1/message.js +21 -0
- package/dist/esm/codegenv1/restore-json-names.d.ts +5 -0
- package/dist/esm/codegenv1/restore-json-names.js +26 -0
- package/dist/esm/codegenv1/service.d.ts +8 -0
- package/dist/esm/codegenv1/service.js +24 -0
- package/dist/esm/codegenv1/symbols.d.ts +125 -0
- package/dist/esm/codegenv1/symbols.js +64 -0
- package/dist/esm/codegenv1/types.d.ts +72 -0
- package/dist/esm/{field-list.js → codegenv1/types.js} +6 -0
- package/dist/esm/create.d.ts +9 -0
- package/dist/esm/create.js +228 -0
- package/dist/{cjs/descriptor-set.d.ts → esm/desc-types.d.ts} +162 -243
- package/dist/esm/equals.d.ts +9 -0
- package/dist/esm/equals.js +129 -0
- package/dist/esm/extensions.d.ts +59 -0
- package/dist/esm/extensions.js +159 -0
- package/dist/esm/fields.d.ts +23 -0
- package/dist/esm/fields.js +41 -0
- package/dist/esm/from-binary.d.ts +34 -0
- package/dist/esm/from-binary.js +205 -0
- package/dist/esm/from-json.d.ts +48 -0
- package/dist/esm/from-json.js +603 -0
- package/dist/esm/index.d.ts +16 -42
- package/dist/esm/index.js +13 -30
- package/dist/esm/is-message.d.ts +5 -20
- package/dist/esm/is-message.js +11 -29
- package/dist/esm/json-value.d.ts +16 -0
- package/dist/esm/proto-int64.js +2 -2
- package/dist/esm/reflect/error.d.ts +9 -0
- package/dist/esm/reflect/error.js +31 -0
- package/dist/esm/reflect/guard.d.ts +20 -0
- package/dist/esm/reflect/guard.js +70 -0
- package/dist/esm/reflect/index.d.ts +8 -0
- package/dist/esm/reflect/index.js +21 -0
- package/dist/esm/reflect/names.d.ts +11 -0
- package/dist/esm/reflect/names.js +69 -0
- package/dist/esm/reflect/nested-types.d.ts +12 -0
- package/dist/esm/reflect/nested-types.js +66 -0
- package/dist/esm/reflect/reflect-check.d.ts +10 -0
- package/dist/esm/reflect/reflect-check.js +143 -0
- package/dist/esm/reflect/reflect-types.d.ts +284 -0
- package/dist/esm/reflect/reflect-types.js +15 -0
- package/dist/esm/reflect/reflect.d.ts +32 -0
- package/dist/esm/reflect/reflect.js +428 -0
- package/dist/esm/reflect/registry.d.ts +82 -0
- package/dist/esm/reflect/registry.js +874 -0
- package/dist/{cjs → esm/reflect}/scalar.d.ts +21 -1
- package/dist/esm/reflect/scalar.js +289 -0
- package/dist/esm/reflect/unsafe.d.ts +58 -0
- package/dist/esm/reflect/unsafe.js +155 -0
- package/dist/esm/to-binary.d.ts +24 -0
- package/dist/esm/to-binary.js +187 -0
- package/dist/esm/to-json.d.ts +50 -0
- package/dist/esm/to-json.js +359 -0
- package/dist/esm/types.d.ts +68 -0
- package/dist/esm/wire/base64-encoding.d.ts +23 -0
- package/dist/esm/wire/base64-encoding.js +151 -0
- package/dist/esm/wire/binary-encoding.d.ts +244 -0
- package/dist/esm/{binary-encoding.js → wire/binary-encoding.js} +27 -20
- package/dist/esm/wire/index.d.ts +5 -0
- package/dist/esm/wire/index.js +18 -0
- package/dist/esm/wire/size-delimited.d.ts +51 -0
- package/dist/esm/wire/size-delimited.js +148 -0
- package/dist/esm/wire/text-encoding.d.ts +26 -0
- package/dist/esm/wire/text-encoding.js +50 -0
- package/dist/esm/wire/text-format.d.ts +14 -0
- package/dist/esm/{private → wire}/text-format.js +12 -2
- package/dist/{cjs/google → esm/wire}/varint.d.ts +2 -2
- package/dist/esm/{google → wire}/varint.js +11 -10
- package/dist/esm/wkt/any.d.ts +38 -0
- package/dist/esm/wkt/any.js +69 -0
- package/dist/{cjs → esm/wkt/gen}/google/protobuf/any_pb.d.ts +13 -27
- package/dist/esm/wkt/gen/google/protobuf/any_pb.js +24 -0
- package/dist/esm/{google → wkt/gen/google}/protobuf/api_pb.d.ts +29 -38
- package/dist/esm/wkt/gen/google/protobuf/api_pb.js +36 -0
- package/dist/esm/{google → wkt/gen/google}/protobuf/compiler/plugin_pb.d.ts +67 -75
- package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +65 -0
- package/dist/esm/{google → wkt/gen/google}/protobuf/descriptor_pb.d.ts +564 -527
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +790 -0
- package/dist/esm/{google → wkt/gen/google}/protobuf/duration_pb.d.ts +13 -18
- package/dist/esm/wkt/gen/google/protobuf/duration_pb.js +24 -0
- package/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +24 -0
- package/dist/esm/wkt/gen/google/protobuf/empty_pb.js +24 -0
- package/dist/{cjs → esm/wkt/gen}/google/protobuf/field_mask_pb.d.ts +13 -18
- package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +24 -0
- package/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +26 -0
- package/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +24 -0
- package/dist/{cjs → esm/wkt/gen}/google/protobuf/struct_pb.d.ts +44 -55
- package/dist/esm/wkt/gen/google/protobuf/struct_pb.js +56 -0
- package/dist/esm/{google → wkt/gen/google}/protobuf/timestamp_pb.d.ts +13 -21
- package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +24 -0
- package/dist/{cjs → esm/wkt/gen}/google/protobuf/type_pb.d.ts +77 -80
- package/dist/esm/wkt/gen/google/protobuf/type_pb.js +239 -0
- package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +186 -0
- package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +64 -0
- package/dist/esm/wkt/index.d.ts +15 -0
- package/dist/esm/wkt/index.js +28 -0
- package/dist/esm/wkt/timestamp.d.ts +21 -0
- package/dist/esm/wkt/timestamp.js +50 -0
- package/dist/esm/wkt/wrappers.d.ts +15 -0
- package/dist/esm/wkt/wrappers.js +38 -0
- package/package.json +37 -5
- package/dist/cjs/binary-encoding.d.ts +0 -420
- package/dist/cjs/binary-format.d.ts +0 -113
- package/dist/cjs/codegen-info.d.ts +0 -33
- package/dist/cjs/codegen-info.js +0 -69
- package/dist/cjs/create-descriptor-set.d.ts +0 -36
- package/dist/cjs/create-descriptor-set.js +0 -910
- package/dist/cjs/create-registry-from-desc.d.ts +0 -15
- package/dist/cjs/create-registry-from-desc.js +0 -264
- package/dist/cjs/create-registry.d.ts +0 -9
- package/dist/cjs/create-registry.js +0 -94
- package/dist/cjs/enum.d.ts +0 -35
- package/dist/cjs/extension-accessor.d.ts +0 -35
- package/dist/cjs/extension-accessor.js +0 -114
- package/dist/cjs/extension.d.ts +0 -24
- package/dist/cjs/field-list.d.ts +0 -27
- package/dist/cjs/field-list.js +0 -15
- package/dist/cjs/field.d.ts +0 -314
- package/dist/cjs/field.js +0 -15
- package/dist/cjs/google/protobuf/any_pb.js +0 -273
- package/dist/cjs/google/protobuf/api_pb.js +0 -316
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +0 -219
- package/dist/cjs/google/protobuf/descriptor_pb.js +0 -2034
- package/dist/cjs/google/protobuf/duration_pb.js +0 -169
- package/dist/cjs/google/protobuf/empty_pb.d.ts +0 -28
- package/dist/cjs/google/protobuf/empty_pb.js +0 -52
- package/dist/cjs/google/protobuf/field_mask_pb.js +0 -311
- package/dist/cjs/google/protobuf/source_context_pb.d.ts +0 -29
- package/dist/cjs/google/protobuf/source_context_pb.js +0 -55
- package/dist/cjs/google/protobuf/struct_pb.js +0 -240
- package/dist/cjs/google/protobuf/timestamp_pb.js +0 -213
- package/dist/cjs/google/protobuf/type_pb.js +0 -562
- package/dist/cjs/google/protobuf/wrappers_pb.d.ts +0 -267
- package/dist/cjs/google/protobuf/wrappers_pb.js +0 -569
- package/dist/cjs/json-format.d.ts +0 -111
- package/dist/cjs/json-format.js +0 -15
- package/dist/cjs/message-type.d.ts +0 -51
- package/dist/cjs/message-type.js +0 -15
- package/dist/cjs/message.d.ts +0 -131
- package/dist/cjs/message.js +0 -129
- package/dist/cjs/private/binary-format.d.ts +0 -7
- package/dist/cjs/private/binary-format.js +0 -430
- package/dist/cjs/private/enum.d.ts +0 -27
- package/dist/cjs/private/enum.js +0 -94
- package/dist/cjs/private/extensions.d.ts +0 -34
- package/dist/cjs/private/extensions.js +0 -86
- package/dist/cjs/private/feature-set.d.ts +0 -19
- package/dist/cjs/private/feature-set.js +0 -106
- package/dist/cjs/private/field-list.d.ts +0 -18
- package/dist/cjs/private/field-list.js +0 -76
- package/dist/cjs/private/field-normalize.d.ts +0 -9
- package/dist/cjs/private/field-normalize.js +0 -69
- package/dist/cjs/private/field-wrapper.d.ts +0 -25
- package/dist/cjs/private/field-wrapper.js +0 -57
- package/dist/cjs/private/field.d.ts +0 -16
- package/dist/cjs/private/field.js +0 -45
- package/dist/cjs/private/json-format.d.ts +0 -2
- package/dist/cjs/private/json-format.js +0 -626
- package/dist/cjs/private/message-type.d.ts +0 -18
- package/dist/cjs/private/message-type.js +0 -50
- package/dist/cjs/private/names.d.ts +0 -43
- package/dist/cjs/private/names.js +0 -278
- package/dist/cjs/private/options-map.d.ts +0 -7
- package/dist/cjs/private/options-map.js +0 -15
- package/dist/cjs/private/proto-runtime.d.ts +0 -53
- package/dist/cjs/private/proto-runtime.js +0 -41
- package/dist/cjs/private/reflect.d.ts +0 -9
- package/dist/cjs/private/reflect.js +0 -79
- package/dist/cjs/private/reify-wkt.d.ts +0 -102
- package/dist/cjs/private/reify-wkt.js +0 -172
- package/dist/cjs/private/scalars.d.ts +0 -18
- package/dist/cjs/private/scalars.js +0 -105
- package/dist/cjs/private/text-format.d.ts +0 -4
- package/dist/cjs/private/util-common.d.ts +0 -2
- package/dist/cjs/private/util-common.js +0 -237
- package/dist/cjs/private/util.d.ts +0 -38
- package/dist/cjs/private/util.js +0 -15
- package/dist/cjs/proto-base64.d.ts +0 -18
- package/dist/cjs/proto-base64.js +0 -128
- package/dist/cjs/proto-delimited.d.ts +0 -54
- package/dist/cjs/proto-delimited.js +0 -155
- package/dist/cjs/proto-double.d.ts +0 -5
- package/dist/cjs/proto-double.js +0 -29
- package/dist/cjs/proto2.d.ts +0 -4
- package/dist/cjs/proto2.js +0 -53
- package/dist/cjs/proto3.d.ts +0 -4
- package/dist/cjs/proto3.js +0 -56
- package/dist/cjs/scalar.js +0 -81
- package/dist/cjs/service-type.d.ts +0 -96
- package/dist/cjs/service-type.js +0 -53
- package/dist/cjs/to-plain-message.d.ts +0 -12
- package/dist/cjs/to-plain-message.js +0 -72
- package/dist/cjs/type-registry.d.ts +0 -57
- package/dist/cjs/type-registry.js +0 -15
- package/dist/esm/binary-encoding.d.ts +0 -420
- package/dist/esm/binary-format.d.ts +0 -113
- package/dist/esm/codegen-info.d.ts +0 -33
- package/dist/esm/codegen-info.js +0 -67
- package/dist/esm/create-descriptor-set.d.ts +0 -36
- package/dist/esm/create-descriptor-set.js +0 -906
- package/dist/esm/create-registry-from-desc.d.ts +0 -15
- package/dist/esm/create-registry-from-desc.js +0 -261
- package/dist/esm/create-registry.d.ts +0 -9
- package/dist/esm/create-registry.js +0 -90
- package/dist/esm/descriptor-set.js +0 -14
- package/dist/esm/enum.d.ts +0 -35
- package/dist/esm/extension-accessor.d.ts +0 -35
- package/dist/esm/extension-accessor.js +0 -107
- package/dist/esm/extension.d.ts +0 -24
- package/dist/esm/field-list.d.ts +0 -27
- package/dist/esm/field.d.ts +0 -314
- package/dist/esm/field.js +0 -14
- package/dist/esm/google/protobuf/any_pb.js +0 -269
- package/dist/esm/google/protobuf/api_pb.js +0 -310
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +0 -212
- package/dist/esm/google/protobuf/descriptor_pb.js +0 -1999
- package/dist/esm/google/protobuf/duration_pb.js +0 -165
- package/dist/esm/google/protobuf/empty_pb.d.ts +0 -28
- package/dist/esm/google/protobuf/empty_pb.js +0 -48
- package/dist/esm/google/protobuf/field_mask_pb.js +0 -307
- package/dist/esm/google/protobuf/source_context_pb.d.ts +0 -29
- package/dist/esm/google/protobuf/source_context_pb.js +0 -51
- package/dist/esm/google/protobuf/struct_pb.js +0 -234
- package/dist/esm/google/protobuf/timestamp_pb.js +0 -209
- package/dist/esm/google/protobuf/type_pb.js +0 -554
- package/dist/esm/google/protobuf/wrappers_pb.d.ts +0 -267
- package/dist/esm/google/protobuf/wrappers_pb.js +0 -557
- package/dist/esm/json-format.d.ts +0 -111
- package/dist/esm/json-format.js +0 -14
- package/dist/esm/message-type.d.ts +0 -51
- package/dist/esm/message-type.js +0 -14
- package/dist/esm/message.d.ts +0 -131
- package/dist/esm/message.js +0 -125
- package/dist/esm/private/binary-format.d.ts +0 -7
- package/dist/esm/private/binary-format.js +0 -426
- package/dist/esm/private/enum.d.ts +0 -27
- package/dist/esm/private/enum.js +0 -87
- package/dist/esm/private/extensions.d.ts +0 -34
- package/dist/esm/private/extensions.js +0 -81
- package/dist/esm/private/feature-set.d.ts +0 -19
- package/dist/esm/private/feature-set.js +0 -102
- package/dist/esm/private/field-list.d.ts +0 -18
- package/dist/esm/private/field-list.js +0 -72
- package/dist/esm/private/field-normalize.d.ts +0 -9
- package/dist/esm/private/field-normalize.js +0 -65
- package/dist/esm/private/field-wrapper.d.ts +0 -25
- package/dist/esm/private/field-wrapper.js +0 -53
- package/dist/esm/private/field.d.ts +0 -16
- package/dist/esm/private/field.js +0 -41
- package/dist/esm/private/json-format.d.ts +0 -2
- package/dist/esm/private/json-format.js +0 -623
- package/dist/esm/private/message-type.d.ts +0 -18
- package/dist/esm/private/message-type.js +0 -46
- package/dist/esm/private/names.d.ts +0 -43
- package/dist/esm/private/names.js +0 -269
- package/dist/esm/private/options-map.d.ts +0 -7
- package/dist/esm/private/options-map.js +0 -14
- package/dist/esm/private/proto-runtime.d.ts +0 -53
- package/dist/esm/private/proto-runtime.js +0 -37
- package/dist/esm/private/reflect.d.ts +0 -9
- package/dist/esm/private/reflect.js +0 -74
- package/dist/esm/private/reify-wkt.d.ts +0 -102
- package/dist/esm/private/reify-wkt.js +0 -168
- package/dist/esm/private/scalars.d.ts +0 -18
- package/dist/esm/private/scalars.js +0 -99
- package/dist/esm/private/text-format.d.ts +0 -4
- package/dist/esm/private/util-common.d.ts +0 -2
- package/dist/esm/private/util-common.js +0 -234
- package/dist/esm/private/util.d.ts +0 -38
- package/dist/esm/private/util.js +0 -14
- package/dist/esm/proto-base64.d.ts +0 -18
- package/dist/esm/proto-base64.js +0 -125
- package/dist/esm/proto-delimited.d.ts +0 -54
- package/dist/esm/proto-delimited.js +0 -152
- package/dist/esm/proto-double.d.ts +0 -5
- package/dist/esm/proto-double.js +0 -26
- package/dist/esm/proto2.d.ts +0 -4
- package/dist/esm/proto2.js +0 -50
- package/dist/esm/proto3.d.ts +0 -4
- package/dist/esm/proto3.js +0 -53
- package/dist/esm/scalar.js +0 -78
- package/dist/esm/service-type.d.ts +0 -96
- package/dist/esm/service-type.js +0 -50
- package/dist/esm/to-plain-message.d.ts +0 -12
- package/dist/esm/to-plain-message.js +0 -70
- package/dist/esm/type-registry.d.ts +0 -57
- package/dist/esm/type-registry.js +0 -14
- /package/dist/cjs/{binary-format.js → desc-types.js} +0 -0
- /package/dist/cjs/{descriptor-set.js → json-value.js} +0 -0
- /package/dist/cjs/{private → reflect}/assert.d.ts +0 -0
- /package/dist/cjs/{private → reflect}/assert.js +0 -0
- /package/dist/cjs/{enum.js → types.js} +0 -0
- /package/dist/esm/{binary-format.js → desc-types.js} +0 -0
- /package/dist/esm/{enum.js → json-value.js} +0 -0
- /package/dist/esm/{private → reflect}/assert.d.ts +0 -0
- /package/dist/esm/{private → reflect}/assert.js +0 -0
- /package/dist/esm/{extension.js → types.js} +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
16
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
+
var m = o[Symbol.asyncIterator], i;
|
|
18
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
19
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
20
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
21
|
+
};
|
|
22
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
23
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
24
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
25
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
26
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
27
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
28
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
29
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
30
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
31
|
+
function fulfill(value) { resume("next", value); }
|
|
32
|
+
function reject(value) { resume("throw", value); }
|
|
33
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sizeDelimitedPeek = exports.sizeDelimitedDecodeStream = exports.sizeDelimitedEncode = void 0;
|
|
37
|
+
const to_binary_js_1 = require("../to-binary.js");
|
|
38
|
+
const binary_encoding_js_1 = require("./binary-encoding.js");
|
|
39
|
+
const from_binary_js_1 = require("../from-binary.js");
|
|
40
|
+
/**
|
|
41
|
+
* Serialize a message, prefixing it with its size.
|
|
42
|
+
*
|
|
43
|
+
* A size-delimited message is a varint size in bytes, followed by exactly
|
|
44
|
+
* that many bytes of a message serialized with the binary format.
|
|
45
|
+
*
|
|
46
|
+
* This size-delimited format is compatible with other implementations.
|
|
47
|
+
* For details, see https://github.com/protocolbuffers/protobuf/issues/10229
|
|
48
|
+
*/
|
|
49
|
+
function sizeDelimitedEncode(messageDesc, message, options) {
|
|
50
|
+
const writer = new binary_encoding_js_1.BinaryWriter();
|
|
51
|
+
writer.bytes((0, to_binary_js_1.toBinary)(messageDesc, message, options));
|
|
52
|
+
return writer.finish();
|
|
53
|
+
}
|
|
54
|
+
exports.sizeDelimitedEncode = sizeDelimitedEncode;
|
|
55
|
+
/**
|
|
56
|
+
* Parse a stream of size-delimited messages.
|
|
57
|
+
*
|
|
58
|
+
* A size-delimited message is a varint size in bytes, followed by exactly
|
|
59
|
+
* that many bytes of a message serialized with the binary format.
|
|
60
|
+
*
|
|
61
|
+
* This size-delimited format is compatible with other implementations.
|
|
62
|
+
* For details, see https://github.com/protocolbuffers/protobuf/issues/10229
|
|
63
|
+
*/
|
|
64
|
+
function sizeDelimitedDecodeStream(messageDesc, iterable, options) {
|
|
65
|
+
return __asyncGenerator(this, arguments, function* sizeDelimitedDecodeStream_1() {
|
|
66
|
+
var _a, e_1, _b, _c;
|
|
67
|
+
// append chunk to buffer, returning updated buffer
|
|
68
|
+
function append(buffer, chunk) {
|
|
69
|
+
const n = new Uint8Array(buffer.byteLength + chunk.byteLength);
|
|
70
|
+
n.set(buffer);
|
|
71
|
+
n.set(chunk, buffer.length);
|
|
72
|
+
return n;
|
|
73
|
+
}
|
|
74
|
+
let buffer = new Uint8Array(0);
|
|
75
|
+
try {
|
|
76
|
+
for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a; _d = true) {
|
|
77
|
+
_c = iterable_1_1.value;
|
|
78
|
+
_d = false;
|
|
79
|
+
const chunk = _c;
|
|
80
|
+
buffer = append(buffer, chunk);
|
|
81
|
+
for (;;) {
|
|
82
|
+
const size = sizeDelimitedPeek(buffer);
|
|
83
|
+
if (size.eof) {
|
|
84
|
+
// size is incomplete, buffer more data
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (size.offset + size.size > buffer.byteLength) {
|
|
88
|
+
// message is incomplete, buffer more data
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
yield yield __await((0, from_binary_js_1.fromBinary)(messageDesc, buffer.subarray(size.offset, size.offset + size.size), options));
|
|
92
|
+
buffer = buffer.subarray(size.offset + size.size);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
97
|
+
finally {
|
|
98
|
+
try {
|
|
99
|
+
if (!_d && !_a && (_b = iterable_1.return)) yield __await(_b.call(iterable_1));
|
|
100
|
+
}
|
|
101
|
+
finally { if (e_1) throw e_1.error; }
|
|
102
|
+
}
|
|
103
|
+
if (buffer.byteLength > 0) {
|
|
104
|
+
throw new Error("incomplete data");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
exports.sizeDelimitedDecodeStream = sizeDelimitedDecodeStream;
|
|
109
|
+
/**
|
|
110
|
+
* Decodes the size from the given size-delimited message, which may be
|
|
111
|
+
* incomplete.
|
|
112
|
+
*
|
|
113
|
+
* Returns an object with the following properties:
|
|
114
|
+
* - size: The size of the delimited message in bytes
|
|
115
|
+
* - offset: The offset in the given byte array where the message starts
|
|
116
|
+
* - eof: true
|
|
117
|
+
*
|
|
118
|
+
* If the size-delimited data does not include all bytes of the varint size,
|
|
119
|
+
* the following object is returned:
|
|
120
|
+
* - size: null
|
|
121
|
+
* - offset: null
|
|
122
|
+
* - eof: false
|
|
123
|
+
*
|
|
124
|
+
* This function can be used to implement parsing of size-delimited messages
|
|
125
|
+
* from a stream.
|
|
126
|
+
*/
|
|
127
|
+
function sizeDelimitedPeek(data) {
|
|
128
|
+
const sizeEof = { eof: true, size: null, offset: null };
|
|
129
|
+
for (let i = 0; i < 10; i++) {
|
|
130
|
+
if (i > data.byteLength) {
|
|
131
|
+
return sizeEof;
|
|
132
|
+
}
|
|
133
|
+
if ((data[i] & 0x80) == 0) {
|
|
134
|
+
const reader = new binary_encoding_js_1.BinaryReader(data);
|
|
135
|
+
let size;
|
|
136
|
+
try {
|
|
137
|
+
size = reader.uint32();
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
if (e instanceof RangeError) {
|
|
141
|
+
return sizeEof;
|
|
142
|
+
}
|
|
143
|
+
throw e;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
eof: false,
|
|
147
|
+
size,
|
|
148
|
+
offset: reader.pos,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
throw new Error("invalid varint");
|
|
153
|
+
}
|
|
154
|
+
exports.sizeDelimitedPeek = sizeDelimitedPeek;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface TextEncoding {
|
|
2
|
+
/**
|
|
3
|
+
* Verify that the given text is valid UTF-8.
|
|
4
|
+
*/
|
|
5
|
+
checkUtf8: (text: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Encode UTF-8 text to binary.
|
|
8
|
+
*/
|
|
9
|
+
encodeUtf8: (text: string) => Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Decode UTF-8 text from binary.
|
|
12
|
+
*/
|
|
13
|
+
decodeUtf8: (bytes: Uint8Array) => string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Protobuf-ES requires the Text Encoding API to convert UTF-8 from and to
|
|
17
|
+
* binary. This WHATWG API is widely available, but it is not part of the
|
|
18
|
+
* ECMAScript standard. On runtimes where it is not available, use this
|
|
19
|
+
* function to provide your own implementation.
|
|
20
|
+
*
|
|
21
|
+
* Note that the Text Encoding API does not provide a way to validate UTF-8.
|
|
22
|
+
* Our implementation falls back to use encodeURIComponent().
|
|
23
|
+
*/
|
|
24
|
+
export declare function configureTextEncoding(textEncoding: TextEncoding): void;
|
|
25
|
+
export declare function getTextEncoding(): TextEncoding;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getTextEncoding = exports.configureTextEncoding = void 0;
|
|
17
|
+
const symbol = Symbol.for("@bufbuild/protobuf/text-encoding");
|
|
18
|
+
/**
|
|
19
|
+
* Protobuf-ES requires the Text Encoding API to convert UTF-8 from and to
|
|
20
|
+
* binary. This WHATWG API is widely available, but it is not part of the
|
|
21
|
+
* ECMAScript standard. On runtimes where it is not available, use this
|
|
22
|
+
* function to provide your own implementation.
|
|
23
|
+
*
|
|
24
|
+
* Note that the Text Encoding API does not provide a way to validate UTF-8.
|
|
25
|
+
* Our implementation falls back to use encodeURIComponent().
|
|
26
|
+
*/
|
|
27
|
+
function configureTextEncoding(textEncoding) {
|
|
28
|
+
globalThis[symbol] = textEncoding;
|
|
29
|
+
}
|
|
30
|
+
exports.configureTextEncoding = configureTextEncoding;
|
|
31
|
+
function getTextEncoding() {
|
|
32
|
+
if (globalThis[symbol] == undefined) {
|
|
33
|
+
const te = new globalThis.TextEncoder();
|
|
34
|
+
const td = new globalThis.TextDecoder();
|
|
35
|
+
globalThis[symbol] = {
|
|
36
|
+
encodeUtf8(text) {
|
|
37
|
+
return te.encode(text);
|
|
38
|
+
},
|
|
39
|
+
decodeUtf8(bytes) {
|
|
40
|
+
return td.decode(bytes);
|
|
41
|
+
},
|
|
42
|
+
checkUtf8(text) {
|
|
43
|
+
try {
|
|
44
|
+
encodeURIComponent(text);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return globalThis[symbol];
|
|
54
|
+
}
|
|
55
|
+
exports.getTextEncoding = getTextEncoding;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DescEnum } from "../desc-types.js";
|
|
2
|
+
import { ScalarType } from "../reflect/scalar.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse an enum value from the Protobuf text format.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseTextFormatEnumValue(descEnum: DescEnum, value: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* Parse a scalar value from the Protobuf text format.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseTextFormatScalarValue(type: ScalarType, value: string): number | boolean | string | bigint | Uint8Array;
|
|
@@ -14,15 +14,25 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.parseTextFormatScalarValue = exports.parseTextFormatEnumValue = void 0;
|
|
17
|
-
const assert_js_1 = require("
|
|
17
|
+
const assert_js_1 = require("../reflect/assert.js");
|
|
18
18
|
const proto_int64_js_1 = require("../proto-int64.js");
|
|
19
|
-
const scalar_js_1 = require("../scalar.js");
|
|
19
|
+
const scalar_js_1 = require("../reflect/scalar.js");
|
|
20
|
+
/**
|
|
21
|
+
* Parse an enum value from the Protobuf text format.
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
20
25
|
function parseTextFormatEnumValue(descEnum, value) {
|
|
21
26
|
const enumValue = descEnum.values.find((v) => v.name === value);
|
|
22
27
|
(0, assert_js_1.assert)(enumValue, `cannot parse ${descEnum.name} default value: ${value}`);
|
|
23
28
|
return enumValue.number;
|
|
24
29
|
}
|
|
25
30
|
exports.parseTextFormatEnumValue = parseTextFormatEnumValue;
|
|
31
|
+
/**
|
|
32
|
+
* Parse a scalar value from the Protobuf text format.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
26
36
|
function parseTextFormatScalarValue(type, value) {
|
|
27
37
|
switch (type) {
|
|
28
38
|
case scalar_js_1.ScalarType.STRING:
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
|
|
11
11
|
*/
|
|
12
|
-
export declare function varint64read(this:
|
|
12
|
+
export declare function varint64read<T extends ReaderLike>(this: T): [number, number];
|
|
13
13
|
/**
|
|
14
14
|
* Write a 64 bit varint, given as two JS numbers, to the given bytes array.
|
|
15
15
|
*
|
|
@@ -60,7 +60,7 @@ export declare function varint32write(value: number, bytes: number[]): void;
|
|
|
60
60
|
*
|
|
61
61
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
|
|
62
62
|
*/
|
|
63
|
-
export declare function varint32read(this:
|
|
63
|
+
export declare function varint32read<T extends ReaderLike>(this: T): number;
|
|
64
64
|
type ReaderLike = {
|
|
65
65
|
buf: Uint8Array;
|
|
66
66
|
pos: number;
|
|
@@ -162,7 +162,7 @@ function int64ToString(lo, hi) {
|
|
|
162
162
|
let bits = newBits(lo, hi);
|
|
163
163
|
// If we're treating the input as a signed value and the high bit is set, do
|
|
164
164
|
// a manual two's complement conversion before the decimal conversion.
|
|
165
|
-
const negative =
|
|
165
|
+
const negative = bits.hi & 0x80000000;
|
|
166
166
|
if (negative) {
|
|
167
167
|
bits = negate(bits.lo, bits.hi);
|
|
168
168
|
}
|
|
@@ -186,7 +186,7 @@ function uInt64ToString(lo, hi) {
|
|
|
186
186
|
// highBits <= 0x1FFFFF can be safely expressed with a double and retain
|
|
187
187
|
// integer precision.
|
|
188
188
|
// Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.
|
|
189
|
-
if (hi <=
|
|
189
|
+
if (hi <= 0x1fffff) {
|
|
190
190
|
return String(TWO_PWR_32_DBL * hi + lo);
|
|
191
191
|
}
|
|
192
192
|
// What this code is doing is essentially converting the input number from
|
|
@@ -198,15 +198,15 @@ function uInt64ToString(lo, hi) {
|
|
|
198
198
|
// 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.
|
|
199
199
|
// Split 32:32 representation into 16:24:24 representation so our
|
|
200
200
|
// intermediate digits don't overflow.
|
|
201
|
-
const low = lo &
|
|
202
|
-
const mid = ((lo >>> 24) | (hi << 8)) &
|
|
203
|
-
const high = (hi >> 16) &
|
|
201
|
+
const low = lo & 0xffffff;
|
|
202
|
+
const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff;
|
|
203
|
+
const high = (hi >> 16) & 0xffff;
|
|
204
204
|
// Assemble our three base-1e7 digits, ignoring carries. The maximum
|
|
205
205
|
// value in a digit at this step is representable as a 48-bit integer, which
|
|
206
206
|
// can be stored in a 64-bit floating point number.
|
|
207
|
-
let digitA = low +
|
|
208
|
-
let digitB = mid +
|
|
209
|
-
let digitC =
|
|
207
|
+
let digitA = low + mid * 6777216 + high * 6710656;
|
|
208
|
+
let digitB = mid + high * 8147497;
|
|
209
|
+
let digitC = high * 2;
|
|
210
210
|
// Apply carries from A to B and from B to C.
|
|
211
211
|
const base = 10000000;
|
|
212
212
|
if (digitA >= base) {
|
|
@@ -220,8 +220,9 @@ function uInt64ToString(lo, hi) {
|
|
|
220
220
|
// If digitC is 0, then we should have returned in the trivial code path
|
|
221
221
|
// at the top for non-safe integers. Given this, we can assume both digitB
|
|
222
222
|
// and digitA need leading zeros.
|
|
223
|
-
return digitC.toString() +
|
|
224
|
-
decimalFrom1e7WithLeadingZeros(
|
|
223
|
+
return (digitC.toString() +
|
|
224
|
+
decimalFrom1e7WithLeadingZeros(digitB) +
|
|
225
|
+
decimalFrom1e7WithLeadingZeros(digitA));
|
|
225
226
|
}
|
|
226
227
|
exports.uInt64ToString = uInt64ToString;
|
|
227
228
|
function toUnsigned(lo, hi) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Message, MessageShape } from "../types.js";
|
|
2
|
+
import type { Any } from "./gen/google/protobuf/any_pb.js";
|
|
3
|
+
import type { DescMessage } from "../desc-types.js";
|
|
4
|
+
import type { Registry } from "../reflect/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a `google.protobuf.Any` from a message.
|
|
7
|
+
*/
|
|
8
|
+
export declare function anyPack<Desc extends DescMessage>(messageDesc: Desc, message: MessageShape<Desc>): Any;
|
|
9
|
+
/**
|
|
10
|
+
* Packs the message into the given any.
|
|
11
|
+
*/
|
|
12
|
+
export declare function anyPack<Desc extends DescMessage>(messageDesc: Desc, message: MessageShape<Desc>, into: Any): void;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if the Any contains the type given by messageDesc.
|
|
15
|
+
*/
|
|
16
|
+
export declare function anyIs(any: Any, messageDesc: DescMessage): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the Any contains a message with the given typeName.
|
|
19
|
+
*/
|
|
20
|
+
export declare function anyIs(any: Any, typeName: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Unpacks the message the Any represents.
|
|
23
|
+
*
|
|
24
|
+
* Returns undefined if the Any is empty, or if packed type is not included
|
|
25
|
+
* in the given registry.
|
|
26
|
+
*/
|
|
27
|
+
export declare function anyUnpack(any: Any, registry: Registry): Message | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Unpacks the message the Any represents.
|
|
30
|
+
*
|
|
31
|
+
* Returns undefined if the Any is empty, or if it does not contain the type
|
|
32
|
+
* given by messageDesc.
|
|
33
|
+
*/
|
|
34
|
+
export declare function anyUnpack<Desc extends DescMessage>(any: Any, messageDesc: Desc): MessageShape<Desc> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Same as anyUnpack but unpacks into the target message.
|
|
37
|
+
*/
|
|
38
|
+
export declare function anyUnpackTo<Desc extends DescMessage>(any: Any, messageDesc: Desc, message: MessageShape<Desc>): MessageShape<Desc> | undefined;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.anyUnpackTo = exports.anyUnpack = exports.anyIs = exports.anyPack = void 0;
|
|
17
|
+
const any_pb_js_1 = require("./gen/google/protobuf/any_pb.js");
|
|
18
|
+
const create_js_1 = require("../create.js");
|
|
19
|
+
const to_binary_js_1 = require("../to-binary.js");
|
|
20
|
+
const from_binary_js_1 = require("../from-binary.js");
|
|
21
|
+
function anyPack(messageDesc, message, into) {
|
|
22
|
+
let ret = false;
|
|
23
|
+
if (!into) {
|
|
24
|
+
into = (0, create_js_1.create)(any_pb_js_1.AnyDesc);
|
|
25
|
+
ret = true;
|
|
26
|
+
}
|
|
27
|
+
into.value = (0, to_binary_js_1.toBinary)(messageDesc, message);
|
|
28
|
+
into.typeUrl = typeNameToUrl(message.$typeName);
|
|
29
|
+
return ret ? into : undefined;
|
|
30
|
+
}
|
|
31
|
+
exports.anyPack = anyPack;
|
|
32
|
+
function anyIs(any, descOrTypeName) {
|
|
33
|
+
if (any.typeUrl === "") {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const want = typeof descOrTypeName == "string"
|
|
37
|
+
? descOrTypeName
|
|
38
|
+
: descOrTypeName.typeName;
|
|
39
|
+
const got = typeUrlToName(any.typeUrl);
|
|
40
|
+
return want === got;
|
|
41
|
+
}
|
|
42
|
+
exports.anyIs = anyIs;
|
|
43
|
+
function anyUnpack(any, registryOrMessageDesc) {
|
|
44
|
+
if (any.typeUrl === "") {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const desc = registryOrMessageDesc.kind == "message"
|
|
48
|
+
? registryOrMessageDesc
|
|
49
|
+
: registryOrMessageDesc.getMessage(typeUrlToName(any.typeUrl));
|
|
50
|
+
if (!desc) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return (0, from_binary_js_1.fromBinary)(desc, any.value);
|
|
54
|
+
}
|
|
55
|
+
exports.anyUnpack = anyUnpack;
|
|
56
|
+
/**
|
|
57
|
+
* Same as anyUnpack but unpacks into the target message.
|
|
58
|
+
*/
|
|
59
|
+
function anyUnpackTo(any, messageDesc, message) {
|
|
60
|
+
if (any.typeUrl === "") {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return (0, from_binary_js_1.mergeFromBinary)(messageDesc, message, any.value);
|
|
64
|
+
}
|
|
65
|
+
exports.anyUnpackTo = anyUnpackTo;
|
|
66
|
+
function typeNameToUrl(name) {
|
|
67
|
+
return `type.googleapis.com/${name}`;
|
|
68
|
+
}
|
|
69
|
+
function typeUrlToName(url) {
|
|
70
|
+
const slash = url.lastIndexOf("/");
|
|
71
|
+
const name = slash >= 0 ? url.substring(slash + 1) : url;
|
|
72
|
+
if (!name.length) {
|
|
73
|
+
throw new Error(`invalid type url: ${url}`);
|
|
74
|
+
}
|
|
75
|
+
return name;
|
|
76
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Message } from "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type { FieldList } from "../../field-list.js";
|
|
8
|
-
import type { BinaryReadOptions } from "../../binary-format.js";
|
|
1
|
+
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js";
|
|
2
|
+
import type { Message } from "../../../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file google/protobuf/any.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const fileDesc_google_protobuf_any: GenDescFile;
|
|
9
7
|
/**
|
|
10
8
|
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
11
9
|
* URL that describes the type of the serialized message.
|
|
@@ -96,7 +94,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
|
|
|
96
94
|
*
|
|
97
95
|
* @generated from message google.protobuf.Any
|
|
98
96
|
*/
|
|
99
|
-
export
|
|
97
|
+
export type Any = Message<"google.protobuf.Any"> & {
|
|
100
98
|
/**
|
|
101
99
|
* A URL/resource name that uniquely identifies the type of the serialized
|
|
102
100
|
* protocol buffer message. This string must contain at least
|
|
@@ -137,21 +135,9 @@ export declare class Any extends Message<Any> {
|
|
|
137
135
|
* @generated from field: bytes value = 2;
|
|
138
136
|
*/
|
|
139
137
|
value: Uint8Array;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
is(type: MessageType | string): boolean;
|
|
147
|
-
private typeNameToUrl;
|
|
148
|
-
private typeUrlToName;
|
|
149
|
-
static readonly runtime: typeof proto3;
|
|
150
|
-
static readonly typeName = "google.protobuf.Any";
|
|
151
|
-
static readonly fields: FieldList;
|
|
152
|
-
static pack(message: Message): Any;
|
|
153
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Any;
|
|
154
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Any;
|
|
155
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Any;
|
|
156
|
-
static equals(a: Any | PlainMessage<Any> | undefined, b: Any | PlainMessage<Any> | undefined): boolean;
|
|
157
|
-
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Describes the message google.protobuf.Any.
|
|
141
|
+
* Use `create(AnyDesc)` to create a new message.
|
|
142
|
+
*/
|
|
143
|
+
export declare const AnyDesc: GenDescMessage<Any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AnyDesc = exports.fileDesc_google_protobuf_any = void 0;
|
|
17
|
+
const file_js_1 = require("../../../../codegenv1/file.js");
|
|
18
|
+
const message_js_1 = require("../../../../codegenv1/message.js");
|
|
19
|
+
/**
|
|
20
|
+
* Describes the file google/protobuf/any.proto.
|
|
21
|
+
*/
|
|
22
|
+
exports.fileDesc_google_protobuf_any = (0, file_js_1.fileDesc)("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiJgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnYKE2NvbS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2FueXBiogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");
|
|
23
|
+
/**
|
|
24
|
+
* Describes the message google.protobuf.Any.
|
|
25
|
+
* Use `create(AnyDesc)` to create a new message.
|
|
26
|
+
*/
|
|
27
|
+
exports.AnyDesc = (0, message_js_1.messageDesc)(exports.fileDesc_google_protobuf_any, 0);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { Option, Syntax } from "./type_pb.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js";
|
|
2
|
+
import type { SourceContext } from "./source_context_pb.js";
|
|
3
|
+
import type { Option, Syntax } from "./type_pb.js";
|
|
4
|
+
import type { Message } from "../../../../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Describes the file google/protobuf/api.proto.
|
|
7
|
+
*/
|
|
8
|
+
export declare const fileDesc_google_protobuf_api: GenDescFile;
|
|
9
9
|
/**
|
|
10
10
|
* Api is a light-weight descriptor for an API Interface.
|
|
11
11
|
*
|
|
@@ -19,7 +19,7 @@ import type { JsonReadOptions, JsonValue } from "../../json-format.js";
|
|
|
19
19
|
*
|
|
20
20
|
* @generated from message google.protobuf.Api
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type Api = Message<"google.protobuf.Api"> & {
|
|
23
23
|
/**
|
|
24
24
|
* The fully qualified name of this interface, including package name
|
|
25
25
|
* followed by the interface's simple name.
|
|
@@ -83,21 +83,18 @@ export declare class Api extends Message<Api> {
|
|
|
83
83
|
* @generated from field: google.protobuf.Syntax syntax = 7;
|
|
84
84
|
*/
|
|
85
85
|
syntax: Syntax;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Api;
|
|
93
|
-
static equals(a: Api | PlainMessage<Api> | undefined, b: Api | PlainMessage<Api> | undefined): boolean;
|
|
94
|
-
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Describes the message google.protobuf.Api.
|
|
89
|
+
* Use `create(ApiDesc)` to create a new message.
|
|
90
|
+
*/
|
|
91
|
+
export declare const ApiDesc: GenDescMessage<Api>;
|
|
95
92
|
/**
|
|
96
93
|
* Method represents a method of an API interface.
|
|
97
94
|
*
|
|
98
95
|
* @generated from message google.protobuf.Method
|
|
99
96
|
*/
|
|
100
|
-
export
|
|
97
|
+
export type Method = Message<"google.protobuf.Method"> & {
|
|
101
98
|
/**
|
|
102
99
|
* The simple name of this method.
|
|
103
100
|
*
|
|
@@ -140,15 +137,12 @@ export declare class Method extends Message<Method> {
|
|
|
140
137
|
* @generated from field: google.protobuf.Syntax syntax = 7;
|
|
141
138
|
*/
|
|
142
139
|
syntax: Syntax;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Method;
|
|
150
|
-
static equals(a: Method | PlainMessage<Method> | undefined, b: Method | PlainMessage<Method> | undefined): boolean;
|
|
151
|
-
}
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Describes the message google.protobuf.Method.
|
|
143
|
+
* Use `create(MethodDesc)` to create a new message.
|
|
144
|
+
*/
|
|
145
|
+
export declare const MethodDesc: GenDescMessage<Method>;
|
|
152
146
|
/**
|
|
153
147
|
* Declares an API Interface to be included in this interface. The including
|
|
154
148
|
* interface must redeclare all the methods from the included interface, but
|
|
@@ -231,7 +225,7 @@ export declare class Method extends Message<Method> {
|
|
|
231
225
|
*
|
|
232
226
|
* @generated from message google.protobuf.Mixin
|
|
233
227
|
*/
|
|
234
|
-
export
|
|
228
|
+
export type Mixin = Message<"google.protobuf.Mixin"> & {
|
|
235
229
|
/**
|
|
236
230
|
* The fully qualified name of the interface which is included.
|
|
237
231
|
*
|
|
@@ -245,12 +239,9 @@ export declare class Mixin extends Message<Mixin> {
|
|
|
245
239
|
* @generated from field: string root = 2;
|
|
246
240
|
*/
|
|
247
241
|
root: string;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Mixin;
|
|
255
|
-
static equals(a: Mixin | PlainMessage<Mixin> | undefined, b: Mixin | PlainMessage<Mixin> | undefined): boolean;
|
|
256
|
-
}
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Describes the message google.protobuf.Mixin.
|
|
245
|
+
* Use `create(MixinDesc)` to create a new message.
|
|
246
|
+
*/
|
|
247
|
+
export declare const MixinDesc: GenDescMessage<Mixin>;
|