@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
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,42 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
12
|
-
export type {
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export type { Extension } from "./extension.js";
|
|
18
|
-
export { getExtension, setExtension, hasExtension, clearExtension, } from "./extension-accessor.js";
|
|
19
|
-
export type { ServiceType, MethodInfo, MethodInfoUnary, MethodInfoServerStreaming, MethodInfoClientStreaming, MethodInfoBiDiStreaming, } from "./service-type.js";
|
|
20
|
-
export { MethodKind, MethodIdempotency } from "./service-type.js";
|
|
21
|
-
export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
|
|
22
|
-
export type { IBinaryReader, IBinaryWriter } from "./binary-encoding.js";
|
|
23
|
-
export type { BinaryFormat, BinaryWriteOptions, BinaryReadOptions, } from "./binary-format.js";
|
|
24
|
-
export type { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptions, JsonWriteStringOptions, } from "./json-format.js";
|
|
25
|
-
export type { DescriptorSet, AnyDesc, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.js";
|
|
26
|
-
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
27
|
-
export type { IMessageTypeRegistry, IExtensionRegistry, } from "./type-registry.js";
|
|
28
|
-
export { createRegistry } from "./create-registry.js";
|
|
29
|
-
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
30
|
-
export { toPlainMessage } from "./to-plain-message.js";
|
|
31
|
-
export * from "./google/protobuf/compiler/plugin_pb.js";
|
|
32
|
-
export * from "./google/protobuf/api_pb.js";
|
|
33
|
-
export * from "./google/protobuf/any_pb.js";
|
|
34
|
-
export * from "./google/protobuf/descriptor_pb.js";
|
|
35
|
-
export * from "./google/protobuf/duration_pb.js";
|
|
36
|
-
export * from "./google/protobuf/empty_pb.js";
|
|
37
|
-
export * from "./google/protobuf/field_mask_pb.js";
|
|
38
|
-
export * from "./google/protobuf/source_context_pb.js";
|
|
39
|
-
export * from "./google/protobuf/struct_pb.js";
|
|
40
|
-
export * from "./google/protobuf/timestamp_pb.js";
|
|
41
|
-
export * from "./google/protobuf/type_pb.js";
|
|
42
|
-
export * from "./google/protobuf/wrappers_pb.js";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./is-message.js";
|
|
3
|
+
export * from "./create.js";
|
|
4
|
+
export * from "./clone.js";
|
|
5
|
+
export * from "./desc-types.js";
|
|
6
|
+
export * from "./equals.js";
|
|
7
|
+
export * from "./fields.js";
|
|
8
|
+
export type { JsonValue, JsonObject } from "./json-value.js";
|
|
9
|
+
export { toBinary } from "./to-binary.js";
|
|
10
|
+
export type { BinaryWriteOptions } from "./to-binary.js";
|
|
11
|
+
export { fromBinary, mergeFromBinary } from "./from-binary.js";
|
|
12
|
+
export type { BinaryReadOptions } from "./from-binary.js";
|
|
13
|
+
export * from "./to-json.js";
|
|
14
|
+
export * from "./from-json.js";
|
|
15
|
+
export { hasExtension, getExtension, setExtension, clearExtension, hasOption, getOption, } from "./extensions.js";
|
|
16
|
+
export * from "./proto-int64.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -11,33 +11,16 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
27
|
-
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
28
|
-
export { createRegistry } from "./create-registry.js";
|
|
29
|
-
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
30
|
-
export { toPlainMessage } from "./to-plain-message.js";
|
|
31
|
-
// ideally, we would export these types with sub-path exports:
|
|
32
|
-
export * from "./google/protobuf/compiler/plugin_pb.js";
|
|
33
|
-
export * from "./google/protobuf/api_pb.js";
|
|
34
|
-
export * from "./google/protobuf/any_pb.js";
|
|
35
|
-
export * from "./google/protobuf/descriptor_pb.js";
|
|
36
|
-
export * from "./google/protobuf/duration_pb.js";
|
|
37
|
-
export * from "./google/protobuf/empty_pb.js";
|
|
38
|
-
export * from "./google/protobuf/field_mask_pb.js";
|
|
39
|
-
export * from "./google/protobuf/source_context_pb.js";
|
|
40
|
-
export * from "./google/protobuf/struct_pb.js";
|
|
41
|
-
export * from "./google/protobuf/timestamp_pb.js";
|
|
42
|
-
export * from "./google/protobuf/type_pb.js";
|
|
43
|
-
export * from "./google/protobuf/wrappers_pb.js";
|
|
14
|
+
export * from "./types.js";
|
|
15
|
+
export * from "./is-message.js";
|
|
16
|
+
export * from "./create.js";
|
|
17
|
+
export * from "./clone.js";
|
|
18
|
+
export * from "./desc-types.js";
|
|
19
|
+
export * from "./equals.js";
|
|
20
|
+
export * from "./fields.js";
|
|
21
|
+
export { toBinary } from "./to-binary.js";
|
|
22
|
+
export { fromBinary, mergeFromBinary } from "./from-binary.js";
|
|
23
|
+
export * from "./to-json.js";
|
|
24
|
+
export * from "./from-json.js";
|
|
25
|
+
export { hasExtension, getExtension, setExtension, clearExtension, hasOption, getOption, } from "./extensions.js";
|
|
26
|
+
export * from "./proto-int64.js";
|
package/dist/esm/is-message.d.ts
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { Message } from "./message.js";
|
|
1
|
+
import type { MessageShape } from "./types.js";
|
|
2
|
+
import type { DescMessage } from "./desc-types.js";
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Just like `instanceof`, `isMessage` narrows the type. The advantage of
|
|
9
|
-
* `isMessage` is that it compares identity by the message type name, not by
|
|
10
|
-
* class identity. This makes it robust against the dual package hazard and
|
|
11
|
-
* similar situations, where the same message is duplicated.
|
|
12
|
-
*
|
|
13
|
-
* This function is _mostly_ equivalent to the `instanceof` operator. For
|
|
14
|
-
* example, `isMessage(foo, MyMessage)` is the same as `foo instanceof MyMessage`,
|
|
15
|
-
* and `isMessage(foo)` is the same as `foo instanceof Message`. In most cases,
|
|
16
|
-
* `isMessage` should be preferred over `instanceof`.
|
|
17
|
-
*
|
|
18
|
-
* However, due to the fact that `isMessage` does not use class identity, there
|
|
19
|
-
* are subtle differences between this function and `instanceof`. Notably,
|
|
20
|
-
* calling `isMessage` on an explicit type of Message will return false.
|
|
4
|
+
* Determine whether the given `arg` is a message.
|
|
5
|
+
* If `desc` is set, determine whether `arg` is this specific message.
|
|
21
6
|
*/
|
|
22
|
-
export declare function isMessage<
|
|
7
|
+
export declare function isMessage<Desc extends DescMessage>(arg: unknown, desc?: Desc): arg is MessageShape<Desc>;
|
package/dist/esm/is-message.js
CHANGED
|
@@ -11,38 +11,20 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Message } from "./message.js";
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* Just like `instanceof`, `isMessage` narrows the type. The advantage of
|
|
20
|
-
* `isMessage` is that it compares identity by the message type name, not by
|
|
21
|
-
* class identity. This makes it robust against the dual package hazard and
|
|
22
|
-
* similar situations, where the same message is duplicated.
|
|
23
|
-
*
|
|
24
|
-
* This function is _mostly_ equivalent to the `instanceof` operator. For
|
|
25
|
-
* example, `isMessage(foo, MyMessage)` is the same as `foo instanceof MyMessage`,
|
|
26
|
-
* and `isMessage(foo)` is the same as `foo instanceof Message`. In most cases,
|
|
27
|
-
* `isMessage` should be preferred over `instanceof`.
|
|
28
|
-
*
|
|
29
|
-
* However, due to the fact that `isMessage` does not use class identity, there
|
|
30
|
-
* are subtle differences between this function and `instanceof`. Notably,
|
|
31
|
-
* calling `isMessage` on an explicit type of Message will return false.
|
|
15
|
+
* Determine whether the given `arg` is a message.
|
|
16
|
+
* If `desc` is set, determine whether `arg` is this specific message.
|
|
32
17
|
*/
|
|
33
|
-
export function isMessage(arg,
|
|
34
|
-
|
|
18
|
+
export function isMessage(arg, desc) {
|
|
19
|
+
const isMessage = arg !== null &&
|
|
20
|
+
typeof arg == "object" &&
|
|
21
|
+
"$typeName" in arg &&
|
|
22
|
+
typeof arg.$typeName == "string";
|
|
23
|
+
if (!isMessage) {
|
|
35
24
|
return false;
|
|
36
25
|
}
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
const actualType = arg.getType();
|
|
41
|
-
if (actualType === null ||
|
|
42
|
-
typeof actualType != "function" ||
|
|
43
|
-
!("typeName" in actualType) ||
|
|
44
|
-
typeof actualType.typeName != "string") {
|
|
45
|
-
return false;
|
|
26
|
+
if (desc === undefined) {
|
|
27
|
+
return true;
|
|
46
28
|
}
|
|
47
|
-
return
|
|
29
|
+
return desc.typeName === arg.$typeName;
|
|
48
30
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents any possible JSON value:
|
|
3
|
+
* - number
|
|
4
|
+
* - string
|
|
5
|
+
* - boolean
|
|
6
|
+
* - null
|
|
7
|
+
* - object (with any JSON value as property)
|
|
8
|
+
* - array (with any JSON value as element)
|
|
9
|
+
*/
|
|
10
|
+
export type JsonValue = number | string | boolean | null | JsonObject | JsonValue[];
|
|
11
|
+
/**
|
|
12
|
+
* Represents a JSON object.
|
|
13
|
+
*/
|
|
14
|
+
export type JsonObject = {
|
|
15
|
+
[k: string]: JsonValue;
|
|
16
|
+
};
|
package/dist/esm/proto-int64.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { assert } from "./
|
|
15
|
-
import { int64FromString, int64ToString, uInt64ToString, } from "./
|
|
14
|
+
import { assert } from "./reflect/assert.js";
|
|
15
|
+
import { int64FromString, int64ToString, uInt64ToString, } from "./wire/varint.js";
|
|
16
16
|
function makeInt64Support() {
|
|
17
17
|
const dv = new DataView(new ArrayBuffer(8));
|
|
18
18
|
// note that Safari 14 implements BigInt, but not the DataView methods
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DescField, DescOneof } from "../desc-types.js";
|
|
2
|
+
declare const errorNames: string[];
|
|
3
|
+
export declare class FieldError extends Error {
|
|
4
|
+
readonly name: (typeof errorNames)[number];
|
|
5
|
+
constructor(fieldOrOneof: DescField | DescOneof, message: string, name?: (typeof errorNames)[number]);
|
|
6
|
+
readonly field: () => DescField | DescOneof;
|
|
7
|
+
}
|
|
8
|
+
export declare function isFieldError(arg: unknown): arg is FieldError;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
const errorNames = [
|
|
15
|
+
"FieldValueInvalidError",
|
|
16
|
+
"FieldListRangeError",
|
|
17
|
+
"ForeignFieldError",
|
|
18
|
+
];
|
|
19
|
+
export class FieldError extends Error {
|
|
20
|
+
constructor(fieldOrOneof, message, name = "FieldValueInvalidError") {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = name;
|
|
23
|
+
this.field = () => fieldOrOneof;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function isFieldError(arg) {
|
|
27
|
+
return (arg instanceof Error &&
|
|
28
|
+
errorNames.includes(arg.name) &&
|
|
29
|
+
"field" in arg &&
|
|
30
|
+
typeof arg.field == "function");
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Message } from "../types.js";
|
|
2
|
+
import type { ScalarValue } from "./scalar.js";
|
|
3
|
+
import type { ReflectList, ReflectMap, ReflectMessage } from "./reflect-types.js";
|
|
4
|
+
import type { DescField, DescMessage } from "../desc-types.js";
|
|
5
|
+
export declare function isObject(arg: unknown): arg is Record<string, unknown>;
|
|
6
|
+
export declare function isOneofADT(arg: unknown): arg is OneofADT;
|
|
7
|
+
export type OneofADT = {
|
|
8
|
+
case: undefined;
|
|
9
|
+
value?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
case: string;
|
|
12
|
+
value: Message | ScalarValue;
|
|
13
|
+
};
|
|
14
|
+
export declare function isReflectList(arg: unknown, field?: DescField & {
|
|
15
|
+
fieldKind: "list";
|
|
16
|
+
}): arg is ReflectList;
|
|
17
|
+
export declare function isReflectMap(arg: unknown, field?: DescField & {
|
|
18
|
+
fieldKind: "map";
|
|
19
|
+
}): arg is ReflectMap;
|
|
20
|
+
export declare function isReflectMessage(arg: unknown, messageDesc?: DescMessage): arg is ReflectMessage;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { unsafeLocal } from "./unsafe.js";
|
|
15
|
+
import { isMessage } from "../is-message.js";
|
|
16
|
+
export function isObject(arg) {
|
|
17
|
+
return arg !== null && typeof arg == "object" && !Array.isArray(arg);
|
|
18
|
+
}
|
|
19
|
+
export function isOneofADT(arg) {
|
|
20
|
+
return (arg !== null &&
|
|
21
|
+
typeof arg == "object" &&
|
|
22
|
+
"case" in arg &&
|
|
23
|
+
((typeof arg.case == "string" && "value" in arg && arg.value != null) ||
|
|
24
|
+
(arg.case === undefined &&
|
|
25
|
+
(!("value" in arg) || arg.value === undefined))));
|
|
26
|
+
}
|
|
27
|
+
export function isReflectList(arg, field) {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
if (isObject(arg) &&
|
|
30
|
+
unsafeLocal in arg &&
|
|
31
|
+
"add" in arg &&
|
|
32
|
+
"field" in arg &&
|
|
33
|
+
typeof arg.field == "function") {
|
|
34
|
+
if (field !== undefined) {
|
|
35
|
+
const a = field, b = arg.field();
|
|
36
|
+
return (a.listKind == b.listKind &&
|
|
37
|
+
a.scalar === b.scalar &&
|
|
38
|
+
((_a = a.message) === null || _a === void 0 ? void 0 : _a.typeName) === ((_b = b.message) === null || _b === void 0 ? void 0 : _b.typeName) &&
|
|
39
|
+
((_c = a.enum) === null || _c === void 0 ? void 0 : _c.typeName) === ((_d = b.enum) === null || _d === void 0 ? void 0 : _d.typeName));
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
export function isReflectMap(arg, field) {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
if (isObject(arg) &&
|
|
48
|
+
unsafeLocal in arg &&
|
|
49
|
+
"has" in arg &&
|
|
50
|
+
"field" in arg &&
|
|
51
|
+
typeof arg.field == "function") {
|
|
52
|
+
if (field !== undefined) {
|
|
53
|
+
const a = field, b = arg.field();
|
|
54
|
+
return (a.mapKey === b.mapKey &&
|
|
55
|
+
a.mapKind == b.mapKind &&
|
|
56
|
+
a.scalar === b.scalar &&
|
|
57
|
+
((_a = a.message) === null || _a === void 0 ? void 0 : _a.typeName) === ((_b = b.message) === null || _b === void 0 ? void 0 : _b.typeName) &&
|
|
58
|
+
((_c = a.enum) === null || _c === void 0 ? void 0 : _c.typeName) === ((_d = b.enum) === null || _d === void 0 ? void 0 : _d.typeName));
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
export function isReflectMessage(arg, messageDesc) {
|
|
65
|
+
return (isObject(arg) &&
|
|
66
|
+
unsafeLocal in arg &&
|
|
67
|
+
"message" in arg &&
|
|
68
|
+
isMessage(arg.message) &&
|
|
69
|
+
(messageDesc === undefined || arg.message.$typeName == messageDesc.typeName));
|
|
70
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./error.js";
|
|
2
|
+
export * from "./names.js";
|
|
3
|
+
export * from "./nested-types.js";
|
|
4
|
+
export * from "./reflect.js";
|
|
5
|
+
export * from "./reflect-types.js";
|
|
6
|
+
export * from "./registry.js";
|
|
7
|
+
export * from "./scalar.js";
|
|
8
|
+
export { isReflectList, isReflectMap, isReflectMessage } from "./guard.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export * from "./error.js";
|
|
15
|
+
export * from "./names.js";
|
|
16
|
+
export * from "./nested-types.js";
|
|
17
|
+
export * from "./reflect.js";
|
|
18
|
+
export * from "./reflect-types.js";
|
|
19
|
+
export * from "./registry.js";
|
|
20
|
+
export * from "./scalar.js";
|
|
21
|
+
export { isReflectList, isReflectMap, isReflectMessage } from "./guard.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts snake_case to protoCamelCase according to the convention
|
|
3
|
+
* used by protoc to convert a field name to a JSON name.
|
|
4
|
+
*/
|
|
5
|
+
export declare function protoCamelCase(snakeCase: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Escapes names that are reserved for ECMAScript built-in object properties.
|
|
8
|
+
*
|
|
9
|
+
* Also see safeIdentifier() from @bufbuild/protoplugin/ecmascript.
|
|
10
|
+
*/
|
|
11
|
+
export declare function safeObjectProperty(name: string): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
/**
|
|
15
|
+
* Converts snake_case to protoCamelCase according to the convention
|
|
16
|
+
* used by protoc to convert a field name to a JSON name.
|
|
17
|
+
*/
|
|
18
|
+
export function protoCamelCase(snakeCase) {
|
|
19
|
+
let capNext = false;
|
|
20
|
+
const b = [];
|
|
21
|
+
for (let i = 0; i < snakeCase.length; i++) {
|
|
22
|
+
let c = snakeCase.charAt(i);
|
|
23
|
+
switch (c) {
|
|
24
|
+
case "_":
|
|
25
|
+
capNext = true;
|
|
26
|
+
break;
|
|
27
|
+
case "0":
|
|
28
|
+
case "1":
|
|
29
|
+
case "2":
|
|
30
|
+
case "3":
|
|
31
|
+
case "4":
|
|
32
|
+
case "5":
|
|
33
|
+
case "6":
|
|
34
|
+
case "7":
|
|
35
|
+
case "8":
|
|
36
|
+
case "9":
|
|
37
|
+
b.push(c);
|
|
38
|
+
capNext = false;
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
if (capNext) {
|
|
42
|
+
capNext = false;
|
|
43
|
+
c = c.toUpperCase();
|
|
44
|
+
}
|
|
45
|
+
b.push(c);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return b.join("");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Names that cannot be used for object properties because they are reserved
|
|
53
|
+
* by built-in JavaScript properties.
|
|
54
|
+
*/
|
|
55
|
+
const reservedObjectProperties = new Set([
|
|
56
|
+
// names reserved by JavaScript
|
|
57
|
+
"constructor",
|
|
58
|
+
"toString",
|
|
59
|
+
"toJSON",
|
|
60
|
+
"valueOf",
|
|
61
|
+
]);
|
|
62
|
+
/**
|
|
63
|
+
* Escapes names that are reserved for ECMAScript built-in object properties.
|
|
64
|
+
*
|
|
65
|
+
* Also see safeIdentifier() from @bufbuild/protoplugin/ecmascript.
|
|
66
|
+
*/
|
|
67
|
+
export function safeObjectProperty(name) {
|
|
68
|
+
return reservedObjectProperties.has(name) ? name + "$" : name;
|
|
69
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnyDesc, DescEnum, DescExtension, DescFile, DescMessage, DescService } from "../desc-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Iterate over all types - enumerations, extensions, services, messages -
|
|
4
|
+
* and enumerations, extensions and messages nested in messages.
|
|
5
|
+
*/
|
|
6
|
+
export declare function nestedTypes(desc: DescFile | DescMessage): Iterable<DescMessage | DescEnum | DescExtension | DescService>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the ancestors of a given Protobuf element, up to the file.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parentTypes(desc: AnyDesc): Parent[];
|
|
11
|
+
type Parent = DescFile | DescEnum | DescMessage | DescService;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
/**
|
|
15
|
+
* Iterate over all types - enumerations, extensions, services, messages -
|
|
16
|
+
* and enumerations, extensions and messages nested in messages.
|
|
17
|
+
*/
|
|
18
|
+
export function* nestedTypes(desc) {
|
|
19
|
+
switch (desc.kind) {
|
|
20
|
+
case "file":
|
|
21
|
+
for (const message of desc.messages) {
|
|
22
|
+
yield message;
|
|
23
|
+
yield* nestedTypes(message);
|
|
24
|
+
}
|
|
25
|
+
yield* desc.enums;
|
|
26
|
+
yield* desc.services;
|
|
27
|
+
yield* desc.extensions;
|
|
28
|
+
break;
|
|
29
|
+
case "message":
|
|
30
|
+
for (const message of desc.nestedMessages) {
|
|
31
|
+
yield message;
|
|
32
|
+
yield* nestedTypes(message);
|
|
33
|
+
}
|
|
34
|
+
yield* desc.nestedEnums;
|
|
35
|
+
yield* desc.nestedExtensions;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the ancestors of a given Protobuf element, up to the file.
|
|
41
|
+
*/
|
|
42
|
+
export function parentTypes(desc) {
|
|
43
|
+
const parents = [];
|
|
44
|
+
while (desc.kind !== "file") {
|
|
45
|
+
const p = parent(desc);
|
|
46
|
+
desc = p;
|
|
47
|
+
parents.push(p);
|
|
48
|
+
}
|
|
49
|
+
return parents;
|
|
50
|
+
}
|
|
51
|
+
function parent(desc) {
|
|
52
|
+
var _a;
|
|
53
|
+
switch (desc.kind) {
|
|
54
|
+
case "enum_value":
|
|
55
|
+
case "field":
|
|
56
|
+
case "oneof":
|
|
57
|
+
case "rpc":
|
|
58
|
+
return desc.parent;
|
|
59
|
+
case "service":
|
|
60
|
+
return desc.file;
|
|
61
|
+
case "extension":
|
|
62
|
+
case "enum":
|
|
63
|
+
case "message":
|
|
64
|
+
return (_a = desc.parent) !== null && _a !== void 0 ? _a : desc.file;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DescField } from "../desc-types.js";
|
|
2
|
+
import { FieldError } from "./error.js";
|
|
3
|
+
export declare function checkField(field: DescField, value: unknown): FieldError | undefined;
|
|
4
|
+
export declare function checkListItem(field: DescField & {
|
|
5
|
+
fieldKind: "list";
|
|
6
|
+
}, index: number, value: unknown): FieldError | undefined;
|
|
7
|
+
export declare function checkMapEntry(field: DescField & {
|
|
8
|
+
fieldKind: "map";
|
|
9
|
+
}, key: unknown, value: unknown): FieldError | undefined;
|
|
10
|
+
export declare function formatVal(val: unknown): string;
|