@bufbuild/protobuf 2.4.0 → 2.5.1
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/codegenv1/enum.d.ts +2 -10
- package/dist/cjs/codegenv1/enum.js +3 -12
- package/dist/cjs/codegenv1/file.d.ts +1 -7
- package/dist/cjs/codegenv1/file.js +3 -20
- package/dist/cjs/codegenv1/index.d.ts +3 -3
- package/dist/cjs/codegenv1/index.js +3 -3
- package/dist/cjs/codegenv1/symbols.d.ts +60 -60
- package/dist/cjs/codegenv1/symbols.js +5 -34
- package/dist/cjs/codegenv1/types.d.ts +2 -1
- package/dist/cjs/codegenv2/enum.d.ts +18 -0
- package/dist/cjs/codegenv2/enum.js +40 -0
- package/dist/cjs/codegenv2/extension.d.ts +9 -0
- package/dist/cjs/codegenv2/extension.js +28 -0
- package/dist/cjs/codegenv2/file.d.ts +7 -0
- package/dist/cjs/codegenv2/file.js +35 -0
- package/dist/cjs/codegenv2/index.d.ts +10 -0
- package/dist/cjs/codegenv2/index.js +39 -0
- package/dist/cjs/codegenv2/message.d.ts +15 -0
- package/dist/cjs/codegenv2/message.js +24 -0
- package/dist/cjs/codegenv2/service.d.ts +8 -0
- package/dist/cjs/codegenv2/service.js +27 -0
- package/dist/cjs/codegenv2/symbols.d.ts +135 -0
- package/dist/cjs/codegenv2/symbols.js +72 -0
- package/dist/cjs/codegenv2/types.d.ts +81 -0
- package/dist/cjs/codegenv2/types.js +22 -0
- package/dist/cjs/types.d.ts +25 -8
- package/dist/cjs/wkt/gen/google/protobuf/any_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/any_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +10 -4
- package/dist/cjs/wkt/gen/google/protobuf/api_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +13 -5
- package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +3 -3
- package/dist/cjs/wkt/gen/google/protobuf/cpp_features_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/cpp_features_pb.js +4 -4
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +100 -34
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +3 -3
- package/dist/cjs/wkt/gen/google/protobuf/duration_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/duration_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/empty_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/empty_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +4 -4
- package/dist/cjs/wkt/gen/google/protobuf/java_features_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/java_features_pb.js +4 -4
- package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/struct_pb.d.ts +10 -4
- package/dist/cjs/wkt/gen/google/protobuf/struct_pb.js +3 -3
- package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +4 -2
- package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.js +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +16 -6
- package/dist/cjs/wkt/gen/google/protobuf/type_pb.js +3 -3
- package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +28 -10
- package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.js +2 -2
- package/dist/esm/codegenv1/enum.d.ts +2 -10
- package/dist/esm/codegenv1/enum.js +1 -11
- package/dist/esm/codegenv1/file.d.ts +1 -7
- package/dist/esm/codegenv1/file.js +1 -19
- package/dist/esm/codegenv1/index.d.ts +3 -3
- package/dist/esm/codegenv1/index.js +3 -3
- package/dist/esm/codegenv1/symbols.d.ts +60 -60
- package/dist/esm/codegenv1/symbols.js +5 -34
- package/dist/esm/codegenv1/types.d.ts +2 -1
- package/dist/esm/codegenv2/enum.d.ts +18 -0
- package/dist/esm/codegenv2/enum.js +36 -0
- package/dist/esm/codegenv2/extension.d.ts +9 -0
- package/dist/esm/codegenv2/extension.js +25 -0
- package/dist/esm/codegenv2/file.d.ts +7 -0
- package/dist/esm/codegenv2/file.js +32 -0
- package/dist/esm/codegenv2/index.d.ts +10 -0
- package/dist/esm/codegenv2/index.js +23 -0
- package/dist/esm/codegenv2/message.d.ts +15 -0
- package/dist/esm/codegenv2/message.js +21 -0
- package/dist/esm/codegenv2/service.d.ts +8 -0
- package/dist/esm/codegenv2/service.js +24 -0
- package/dist/esm/codegenv2/symbols.d.ts +135 -0
- package/dist/esm/codegenv2/symbols.js +69 -0
- package/dist/esm/codegenv2/types.d.ts +81 -0
- package/dist/esm/codegenv2/types.js +21 -0
- package/dist/esm/types.d.ts +25 -8
- package/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/any_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +10 -4
- package/dist/esm/wkt/gen/google/protobuf/api_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +13 -5
- package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +3 -3
- package/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +4 -4
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +100 -34
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +3 -3
- package/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/duration_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/empty_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +4 -4
- package/dist/esm/wkt/gen/google/protobuf/java_features_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +4 -4
- package/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +10 -4
- package/dist/esm/wkt/gen/google/protobuf/struct_pb.js +3 -3
- package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +4 -2
- package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +2 -2
- package/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +16 -6
- package/dist/esm/wkt/gen/google/protobuf/type_pb.js +3 -3
- package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +28 -10
- package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +2 -2
- package/package.json +9 -2
- /package/dist/cjs/{codegenv1 → codegenv2}/boot.d.ts +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/boot.js +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/embed.d.ts +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/embed.js +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/restore-json-names.d.ts +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/restore-json-names.js +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/scalar.d.ts +0 -0
- /package/dist/cjs/{codegenv1 → codegenv2}/scalar.js +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/boot.d.ts +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/boot.js +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/embed.d.ts +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/embed.js +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/restore-json-names.d.ts +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/restore-json-names.js +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/scalar.d.ts +0 -0
- /package/dist/esm/{codegenv1 → codegenv2}/scalar.js +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
*/
|
|
4
|
+
export declare const packageName = "@bufbuild/protobuf";
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare const wktPublicImportPaths: Readonly<Record<string, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare const symbols: {
|
|
13
|
+
readonly isMessage: {
|
|
14
|
+
readonly typeOnly: false;
|
|
15
|
+
readonly bootstrapWktFrom: "../../is-message.js";
|
|
16
|
+
readonly from: "@bufbuild/protobuf";
|
|
17
|
+
};
|
|
18
|
+
readonly Message: {
|
|
19
|
+
readonly typeOnly: true;
|
|
20
|
+
readonly bootstrapWktFrom: "../../types.js";
|
|
21
|
+
readonly from: "@bufbuild/protobuf";
|
|
22
|
+
};
|
|
23
|
+
readonly create: {
|
|
24
|
+
readonly typeOnly: false;
|
|
25
|
+
readonly bootstrapWktFrom: "../../create.js";
|
|
26
|
+
readonly from: "@bufbuild/protobuf";
|
|
27
|
+
};
|
|
28
|
+
readonly fromJson: {
|
|
29
|
+
readonly typeOnly: false;
|
|
30
|
+
readonly bootstrapWktFrom: "../../from-json.js";
|
|
31
|
+
readonly from: "@bufbuild/protobuf";
|
|
32
|
+
};
|
|
33
|
+
readonly fromJsonString: {
|
|
34
|
+
readonly typeOnly: false;
|
|
35
|
+
readonly bootstrapWktFrom: "../../from-json.js";
|
|
36
|
+
readonly from: "@bufbuild/protobuf";
|
|
37
|
+
};
|
|
38
|
+
readonly fromBinary: {
|
|
39
|
+
readonly typeOnly: false;
|
|
40
|
+
readonly bootstrapWktFrom: "../../from-binary.js";
|
|
41
|
+
readonly from: "@bufbuild/protobuf";
|
|
42
|
+
};
|
|
43
|
+
readonly toBinary: {
|
|
44
|
+
readonly typeOnly: false;
|
|
45
|
+
readonly bootstrapWktFrom: "../../to-binary.js";
|
|
46
|
+
readonly from: "@bufbuild/protobuf";
|
|
47
|
+
};
|
|
48
|
+
readonly toJson: {
|
|
49
|
+
readonly typeOnly: false;
|
|
50
|
+
readonly bootstrapWktFrom: "../../to-json.js";
|
|
51
|
+
readonly from: "@bufbuild/protobuf";
|
|
52
|
+
};
|
|
53
|
+
readonly toJsonString: {
|
|
54
|
+
readonly typeOnly: false;
|
|
55
|
+
readonly bootstrapWktFrom: "../../to-json.js";
|
|
56
|
+
readonly from: "@bufbuild/protobuf";
|
|
57
|
+
};
|
|
58
|
+
readonly protoInt64: {
|
|
59
|
+
readonly typeOnly: false;
|
|
60
|
+
readonly bootstrapWktFrom: "../../proto-int64.js";
|
|
61
|
+
readonly from: "@bufbuild/protobuf";
|
|
62
|
+
};
|
|
63
|
+
readonly JsonValue: {
|
|
64
|
+
readonly typeOnly: true;
|
|
65
|
+
readonly bootstrapWktFrom: "../../json-value.js";
|
|
66
|
+
readonly from: "@bufbuild/protobuf";
|
|
67
|
+
};
|
|
68
|
+
readonly JsonObject: {
|
|
69
|
+
readonly typeOnly: true;
|
|
70
|
+
readonly bootstrapWktFrom: "../../json-value.js";
|
|
71
|
+
readonly from: "@bufbuild/protobuf";
|
|
72
|
+
};
|
|
73
|
+
readonly codegen: {
|
|
74
|
+
readonly boot: {
|
|
75
|
+
readonly typeOnly: false;
|
|
76
|
+
readonly bootstrapWktFrom: "../../codegenv2/boot.js";
|
|
77
|
+
readonly from: string;
|
|
78
|
+
};
|
|
79
|
+
readonly fileDesc: {
|
|
80
|
+
readonly typeOnly: false;
|
|
81
|
+
readonly bootstrapWktFrom: "../../codegenv2/file.js";
|
|
82
|
+
readonly from: string;
|
|
83
|
+
};
|
|
84
|
+
readonly enumDesc: {
|
|
85
|
+
readonly typeOnly: false;
|
|
86
|
+
readonly bootstrapWktFrom: "../../codegenv2/enum.js";
|
|
87
|
+
readonly from: string;
|
|
88
|
+
};
|
|
89
|
+
readonly extDesc: {
|
|
90
|
+
readonly typeOnly: false;
|
|
91
|
+
readonly bootstrapWktFrom: "../../codegenv2/extension.js";
|
|
92
|
+
readonly from: string;
|
|
93
|
+
};
|
|
94
|
+
readonly messageDesc: {
|
|
95
|
+
readonly typeOnly: false;
|
|
96
|
+
readonly bootstrapWktFrom: "../../codegenv2/message.js";
|
|
97
|
+
readonly from: string;
|
|
98
|
+
};
|
|
99
|
+
readonly serviceDesc: {
|
|
100
|
+
readonly typeOnly: false;
|
|
101
|
+
readonly bootstrapWktFrom: "../../codegenv2/service.js";
|
|
102
|
+
readonly from: string;
|
|
103
|
+
};
|
|
104
|
+
readonly tsEnum: {
|
|
105
|
+
readonly typeOnly: false;
|
|
106
|
+
readonly bootstrapWktFrom: "../../codegenv2/enum.js";
|
|
107
|
+
readonly from: string;
|
|
108
|
+
};
|
|
109
|
+
readonly GenFile: {
|
|
110
|
+
readonly typeOnly: true;
|
|
111
|
+
readonly bootstrapWktFrom: "../../codegenv2/types.js";
|
|
112
|
+
readonly from: string;
|
|
113
|
+
};
|
|
114
|
+
readonly GenEnum: {
|
|
115
|
+
readonly typeOnly: true;
|
|
116
|
+
readonly bootstrapWktFrom: "../../codegenv2/types.js";
|
|
117
|
+
readonly from: string;
|
|
118
|
+
};
|
|
119
|
+
readonly GenExtension: {
|
|
120
|
+
readonly typeOnly: true;
|
|
121
|
+
readonly bootstrapWktFrom: "../../codegenv2/types.js";
|
|
122
|
+
readonly from: string;
|
|
123
|
+
};
|
|
124
|
+
readonly GenMessage: {
|
|
125
|
+
readonly typeOnly: true;
|
|
126
|
+
readonly bootstrapWktFrom: "../../codegenv2/types.js";
|
|
127
|
+
readonly from: string;
|
|
128
|
+
};
|
|
129
|
+
readonly GenService: {
|
|
130
|
+
readonly typeOnly: true;
|
|
131
|
+
readonly bootstrapWktFrom: "../../codegenv2/types.js";
|
|
132
|
+
readonly from: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2025 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.symbols = exports.wktPublicImportPaths = exports.packageName = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
exports.packageName = "@bufbuild/protobuf";
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
exports.wktPublicImportPaths = {
|
|
25
|
+
"google/protobuf/compiler/plugin.proto": exports.packageName + "/wkt",
|
|
26
|
+
"google/protobuf/any.proto": exports.packageName + "/wkt",
|
|
27
|
+
"google/protobuf/api.proto": exports.packageName + "/wkt",
|
|
28
|
+
"google/protobuf/cpp_features.proto": exports.packageName + "/wkt",
|
|
29
|
+
"google/protobuf/descriptor.proto": exports.packageName + "/wkt",
|
|
30
|
+
"google/protobuf/duration.proto": exports.packageName + "/wkt",
|
|
31
|
+
"google/protobuf/empty.proto": exports.packageName + "/wkt",
|
|
32
|
+
"google/protobuf/field_mask.proto": exports.packageName + "/wkt",
|
|
33
|
+
"google/protobuf/go_features.proto": exports.packageName + "/wkt",
|
|
34
|
+
"google/protobuf/java_features.proto": exports.packageName + "/wkt",
|
|
35
|
+
"google/protobuf/source_context.proto": exports.packageName + "/wkt",
|
|
36
|
+
"google/protobuf/struct.proto": exports.packageName + "/wkt",
|
|
37
|
+
"google/protobuf/timestamp.proto": exports.packageName + "/wkt",
|
|
38
|
+
"google/protobuf/type.proto": exports.packageName + "/wkt",
|
|
39
|
+
"google/protobuf/wrappers.proto": exports.packageName + "/wkt",
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
// biome-ignore format: want this to read well
|
|
45
|
+
exports.symbols = {
|
|
46
|
+
isMessage: { typeOnly: false, bootstrapWktFrom: "../../is-message.js", from: exports.packageName },
|
|
47
|
+
Message: { typeOnly: true, bootstrapWktFrom: "../../types.js", from: exports.packageName },
|
|
48
|
+
create: { typeOnly: false, bootstrapWktFrom: "../../create.js", from: exports.packageName },
|
|
49
|
+
fromJson: { typeOnly: false, bootstrapWktFrom: "../../from-json.js", from: exports.packageName },
|
|
50
|
+
fromJsonString: { typeOnly: false, bootstrapWktFrom: "../../from-json.js", from: exports.packageName },
|
|
51
|
+
fromBinary: { typeOnly: false, bootstrapWktFrom: "../../from-binary.js", from: exports.packageName },
|
|
52
|
+
toBinary: { typeOnly: false, bootstrapWktFrom: "../../to-binary.js", from: exports.packageName },
|
|
53
|
+
toJson: { typeOnly: false, bootstrapWktFrom: "../../to-json.js", from: exports.packageName },
|
|
54
|
+
toJsonString: { typeOnly: false, bootstrapWktFrom: "../../to-json.js", from: exports.packageName },
|
|
55
|
+
protoInt64: { typeOnly: false, bootstrapWktFrom: "../../proto-int64.js", from: exports.packageName },
|
|
56
|
+
JsonValue: { typeOnly: true, bootstrapWktFrom: "../../json-value.js", from: exports.packageName },
|
|
57
|
+
JsonObject: { typeOnly: true, bootstrapWktFrom: "../../json-value.js", from: exports.packageName },
|
|
58
|
+
codegen: {
|
|
59
|
+
boot: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/boot.js", from: exports.packageName + "/codegenv2" },
|
|
60
|
+
fileDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/file.js", from: exports.packageName + "/codegenv2" },
|
|
61
|
+
enumDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/enum.js", from: exports.packageName + "/codegenv2" },
|
|
62
|
+
extDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/extension.js", from: exports.packageName + "/codegenv2" },
|
|
63
|
+
messageDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/message.js", from: exports.packageName + "/codegenv2" },
|
|
64
|
+
serviceDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/service.js", from: exports.packageName + "/codegenv2" },
|
|
65
|
+
tsEnum: { typeOnly: false, bootstrapWktFrom: "../../codegenv2/enum.js", from: exports.packageName + "/codegenv2" },
|
|
66
|
+
GenFile: { typeOnly: true, bootstrapWktFrom: "../../codegenv2/types.js", from: exports.packageName + "/codegenv2" },
|
|
67
|
+
GenEnum: { typeOnly: true, bootstrapWktFrom: "../../codegenv2/types.js", from: exports.packageName + "/codegenv2" },
|
|
68
|
+
GenExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv2/types.js", from: exports.packageName + "/codegenv2" },
|
|
69
|
+
GenMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv2/types.js", from: exports.packageName + "/codegenv2" },
|
|
70
|
+
GenService: { typeOnly: true, bootstrapWktFrom: "../../codegenv2/types.js", from: exports.packageName + "/codegenv2" },
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Message } from "../types.js";
|
|
2
|
+
import type { DescEnum, DescEnumValue, DescExtension, DescField, DescFile, DescMessage, DescMethod, DescService } from "../descriptors.js";
|
|
3
|
+
import type { JsonValue } from "../json-value.js";
|
|
4
|
+
/**
|
|
5
|
+
* Describes a protobuf source file.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export type GenFile = DescFile;
|
|
10
|
+
/**
|
|
11
|
+
* Describes a message declaration in a protobuf source file.
|
|
12
|
+
*
|
|
13
|
+
* This type is identical to DescMessage, but carries additional type
|
|
14
|
+
* information.
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
export type GenMessage<RuntimeShape extends Message, Opt extends {
|
|
19
|
+
jsonType?: unknown;
|
|
20
|
+
validType?: unknown;
|
|
21
|
+
} = {
|
|
22
|
+
jsonType?: unknown;
|
|
23
|
+
validType?: unknown;
|
|
24
|
+
}> = Omit<DescMessage, "field" | "typeName"> & {
|
|
25
|
+
field: Record<MessageFieldNames<RuntimeShape>, DescField>;
|
|
26
|
+
typeName: RuntimeShape["$typeName"];
|
|
27
|
+
} & brandv2<RuntimeShape, Opt>;
|
|
28
|
+
/**
|
|
29
|
+
* Describes an enumeration in a protobuf source file.
|
|
30
|
+
*
|
|
31
|
+
* This type is identical to DescEnum, but carries additional type
|
|
32
|
+
* information.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
export type GenEnum<RuntimeShape extends number, JsonType extends JsonValue = JsonValue> = Omit<DescEnum, "value"> & {
|
|
37
|
+
value: Record<RuntimeShape, DescEnumValue>;
|
|
38
|
+
} & brandv2<RuntimeShape, JsonType>;
|
|
39
|
+
/**
|
|
40
|
+
* Describes an extension in a protobuf source file.
|
|
41
|
+
*
|
|
42
|
+
* This type is identical to DescExtension, but carries additional type
|
|
43
|
+
* information.
|
|
44
|
+
*
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
export type GenExtension<Extendee extends Message = Message, RuntimeShape = unknown> = DescExtension & brandv2<Extendee, RuntimeShape>;
|
|
48
|
+
/**
|
|
49
|
+
* Describes a service declaration in a protobuf source file.
|
|
50
|
+
*
|
|
51
|
+
* This type is identical to DescService, but carries additional type
|
|
52
|
+
* information.
|
|
53
|
+
*
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
export type GenService<RuntimeShape extends GenServiceMethods> = Omit<DescService, "method"> & {
|
|
57
|
+
method: {
|
|
58
|
+
[K in keyof RuntimeShape]: RuntimeShape[K] & DescMethod;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
export type GenServiceMethods = Record<string, Pick<DescMethod, "input" | "output" | "methodKind">>;
|
|
65
|
+
declare class brandv2<A, B = unknown> {
|
|
66
|
+
protected v: "codegenv2";
|
|
67
|
+
protected a: A | boolean;
|
|
68
|
+
protected b: B | boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Union of the property names of all fields, including oneof members.
|
|
72
|
+
* For an anonymous message (no generated message shape), it's simply a string.
|
|
73
|
+
*/
|
|
74
|
+
type MessageFieldNames<T extends Message> = Message extends T ? string : Exclude<keyof {
|
|
75
|
+
[P in keyof T as P extends ("$typeName" | "$unknown") ? never : T[P] extends Oneof<infer K> ? K : P]-?: true;
|
|
76
|
+
}, number | symbol>;
|
|
77
|
+
type Oneof<K extends string> = {
|
|
78
|
+
case: K | undefined;
|
|
79
|
+
value?: unknown;
|
|
80
|
+
};
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2025 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
|
+
class brandv2 {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.v = "codegenv2";
|
|
19
|
+
this.a = false;
|
|
20
|
+
this.b = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { GenEnum, GenExtension, GenMessage } from "./codegenv1/types.js";
|
|
1
|
+
import type { GenEnum as GenEnumV1, GenExtension as GenExtensionV1, GenMessage as GenMessageV1 } from "./codegenv1/types.js";
|
|
2
|
+
import type { GenEnum as GenEnumV2, GenExtension as GenExtensionV2, GenMessage as GenMessageV2 } from "./codegenv2/types.js";
|
|
2
3
|
import type { DescEnum, DescExtension, DescMessage, DescMethod } from "./descriptors.js";
|
|
3
4
|
import type { OneofADT } from "./reflect/guard.js";
|
|
4
5
|
import type { WireType } from "./wire/index.js";
|
|
@@ -19,32 +20,48 @@ export type Message<TypeName extends string = string> = {
|
|
|
19
20
|
/**
|
|
20
21
|
* Extract the message type from a message descriptor.
|
|
21
22
|
*/
|
|
22
|
-
export type MessageShape<Desc extends DescMessage> = Desc extends
|
|
23
|
+
export type MessageShape<Desc extends DescMessage> = Desc extends GenMessageV1<infer RuntimeShapeV1> ? RuntimeShapeV1 : Desc extends GenMessageV2<infer RuntimeShape> ? RuntimeShape : Message;
|
|
23
24
|
/**
|
|
24
25
|
* Extract the message JSON type from a message descriptor.
|
|
26
|
+
*
|
|
27
|
+
* JSON types are only available for code generated with the plugin option
|
|
28
|
+
* `json_types=true`. If JSON types are unavailable, this type falls back to the
|
|
29
|
+
* `JsonValue` type.
|
|
25
30
|
*/
|
|
26
|
-
export type MessageJsonType<Desc extends DescMessage> = Desc extends
|
|
31
|
+
export type MessageJsonType<Desc extends DescMessage> = Desc extends GenMessageV1<Message, infer JsonTypeV1 extends JsonValue> ? JsonTypeV1 : Desc extends GenMessageV2<Message, {
|
|
32
|
+
jsonType: infer JsonType extends JsonValue;
|
|
33
|
+
}> ? JsonType : JsonValue;
|
|
34
|
+
/**
|
|
35
|
+
* Extract the message Valid type from a message descriptor.
|
|
36
|
+
*
|
|
37
|
+
* Valid types are only available for code generated with the plugin option
|
|
38
|
+
* `valid_types`. If Valid types are unavailable, this type falls back to the
|
|
39
|
+
* regular message shape.
|
|
40
|
+
*/
|
|
41
|
+
export type MessageValidType<Desc extends DescMessage> = Desc extends GenMessageV1<infer RuntimeShapeV1> ? RuntimeShapeV1 : Desc extends GenMessageV2<Message, {
|
|
42
|
+
validType: infer ValidType extends Message;
|
|
43
|
+
}> ? ValidType : Desc extends GenMessageV2<infer RuntimeShape> ? RuntimeShape : Message;
|
|
27
44
|
/**
|
|
28
45
|
* Extract the init type from a message descriptor.
|
|
29
46
|
* The init type is accepted by the function create().
|
|
30
47
|
*/
|
|
31
|
-
export type MessageInitShape<Desc extends DescMessage> = Desc extends
|
|
48
|
+
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessageV1<infer RuntimeShape> ? MessageInit<RuntimeShape> : Desc extends GenMessageV2<infer RuntimeShape> ? MessageInit<RuntimeShape> : Record<string, unknown>;
|
|
32
49
|
/**
|
|
33
50
|
* Extract the enum type of from an enum descriptor.
|
|
34
51
|
*/
|
|
35
|
-
export type EnumShape<Desc extends DescEnum> = Desc extends
|
|
52
|
+
export type EnumShape<Desc extends DescEnum> = Desc extends GenEnumV1<infer RuntimeShape> ? RuntimeShape : Desc extends GenEnumV2<infer RuntimeShape> ? RuntimeShape : number;
|
|
36
53
|
/**
|
|
37
54
|
* Extract the enum JSON type from a enum descriptor.
|
|
38
55
|
*/
|
|
39
|
-
export type EnumJsonType<Desc extends DescEnum> = Desc extends
|
|
56
|
+
export type EnumJsonType<Desc extends DescEnum> = Desc extends GenEnumV1<number, infer JsonType> ? JsonType : Desc extends GenEnumV2<number, infer JsonType> ? JsonType : string | null;
|
|
40
57
|
/**
|
|
41
58
|
* Extract the value type from an extension descriptor.
|
|
42
59
|
*/
|
|
43
|
-
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends
|
|
60
|
+
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends GenExtensionV1<Message, infer RuntimeShape> ? RuntimeShape : Desc extends GenExtensionV2<Message, infer RuntimeShape> ? RuntimeShape : unknown;
|
|
44
61
|
/**
|
|
45
62
|
* Extract the type of the extended message from an extension descriptor.
|
|
46
63
|
*/
|
|
47
|
-
export type Extendee<Desc extends DescExtension> = Desc extends
|
|
64
|
+
export type Extendee<Desc extends DescExtension> = Desc extends GenExtensionV1<infer Extendee> ? Extendee : Desc extends GenExtensionV2<infer Extendee> ? Extendee : Message;
|
|
48
65
|
/**
|
|
49
66
|
* Unknown fields are fields that were not recognized during parsing, or
|
|
50
67
|
* extension.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenFile, GenMessage } from "../../../../
|
|
1
|
+
import type { GenFile, GenMessage } from "../../../../codegenv2/types.js";
|
|
2
2
|
import type { Message } from "../../../../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Describes the file google/protobuf/any.proto.
|
|
@@ -233,4 +233,6 @@ export type AnyJson = {
|
|
|
233
233
|
* Describes the message google.protobuf.Any.
|
|
234
234
|
* Use `create(AnySchema)` to create a new message.
|
|
235
235
|
*/
|
|
236
|
-
export declare const AnySchema: GenMessage<Any,
|
|
236
|
+
export declare const AnySchema: GenMessage<Any, {
|
|
237
|
+
jsonType: AnyJson;
|
|
238
|
+
}>;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.AnySchema = exports.file_google_protobuf_any = void 0;
|
|
17
|
-
const file_js_1 = require("../../../../
|
|
18
|
-
const message_js_1 = require("../../../../
|
|
17
|
+
const file_js_1 = require("../../../../codegenv2/file.js");
|
|
18
|
+
const message_js_1 = require("../../../../codegenv2/message.js");
|
|
19
19
|
/**
|
|
20
20
|
* Describes the file google/protobuf/any.proto.
|
|
21
21
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenFile, GenMessage } from "../../../../
|
|
1
|
+
import type { GenFile, GenMessage } from "../../../../codegenv2/types.js";
|
|
2
2
|
import type { SourceContext, SourceContextJson } from "./source_context_pb.js";
|
|
3
3
|
import type { Option, OptionJson, Syntax, SyntaxJson } from "./type_pb.js";
|
|
4
4
|
import type { Message } from "../../../../types.js";
|
|
@@ -166,7 +166,9 @@ export type ApiJson = {
|
|
|
166
166
|
* Describes the message google.protobuf.Api.
|
|
167
167
|
* Use `create(ApiSchema)` to create a new message.
|
|
168
168
|
*/
|
|
169
|
-
export declare const ApiSchema: GenMessage<Api,
|
|
169
|
+
export declare const ApiSchema: GenMessage<Api, {
|
|
170
|
+
jsonType: ApiJson;
|
|
171
|
+
}>;
|
|
170
172
|
/**
|
|
171
173
|
* Method represents a method of an API interface.
|
|
172
174
|
*
|
|
@@ -269,7 +271,9 @@ export type MethodJson = {
|
|
|
269
271
|
* Describes the message google.protobuf.Method.
|
|
270
272
|
* Use `create(MethodSchema)` to create a new message.
|
|
271
273
|
*/
|
|
272
|
-
export declare const MethodSchema: GenMessage<Method,
|
|
274
|
+
export declare const MethodSchema: GenMessage<Method, {
|
|
275
|
+
jsonType: MethodJson;
|
|
276
|
+
}>;
|
|
273
277
|
/**
|
|
274
278
|
* Declares an API Interface to be included in this interface. The including
|
|
275
279
|
* interface must redeclare all the methods from the included interface, but
|
|
@@ -468,4 +472,6 @@ export type MixinJson = {
|
|
|
468
472
|
* Describes the message google.protobuf.Mixin.
|
|
469
473
|
* Use `create(MixinSchema)` to create a new message.
|
|
470
474
|
*/
|
|
471
|
-
export declare const MixinSchema: GenMessage<Mixin,
|
|
475
|
+
export declare const MixinSchema: GenMessage<Mixin, {
|
|
476
|
+
jsonType: MixinJson;
|
|
477
|
+
}>;
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.MixinSchema = exports.MethodSchema = exports.ApiSchema = exports.file_google_protobuf_api = void 0;
|
|
17
|
-
const file_js_1 = require("../../../../
|
|
17
|
+
const file_js_1 = require("../../../../codegenv2/file.js");
|
|
18
18
|
const source_context_pb_js_1 = require("./source_context_pb.js");
|
|
19
19
|
const type_pb_js_1 = require("./type_pb.js");
|
|
20
|
-
const message_js_1 = require("../../../../
|
|
20
|
+
const message_js_1 = require("../../../../codegenv2/message.js");
|
|
21
21
|
/**
|
|
22
22
|
* Describes the file google/protobuf/api.proto.
|
|
23
23
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenEnum, GenFile, GenMessage } from "../../../../../
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage } from "../../../../../codegenv2/types.js";
|
|
2
2
|
import type { FileDescriptorProto, FileDescriptorProtoJson, GeneratedCodeInfo, GeneratedCodeInfoJson } from "../descriptor_pb.js";
|
|
3
3
|
import type { Message } from "../../../../../types.js";
|
|
4
4
|
/**
|
|
@@ -61,7 +61,9 @@ export type VersionJson = {
|
|
|
61
61
|
* Describes the message google.protobuf.compiler.Version.
|
|
62
62
|
* Use `create(VersionSchema)` to create a new message.
|
|
63
63
|
*/
|
|
64
|
-
export declare const VersionSchema: GenMessage<Version,
|
|
64
|
+
export declare const VersionSchema: GenMessage<Version, {
|
|
65
|
+
jsonType: VersionJson;
|
|
66
|
+
}>;
|
|
65
67
|
/**
|
|
66
68
|
* An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
|
67
69
|
*
|
|
@@ -184,7 +186,9 @@ export type CodeGeneratorRequestJson = {
|
|
|
184
186
|
* Describes the message google.protobuf.compiler.CodeGeneratorRequest.
|
|
185
187
|
* Use `create(CodeGeneratorRequestSchema)` to create a new message.
|
|
186
188
|
*/
|
|
187
|
-
export declare const CodeGeneratorRequestSchema: GenMessage<CodeGeneratorRequest,
|
|
189
|
+
export declare const CodeGeneratorRequestSchema: GenMessage<CodeGeneratorRequest, {
|
|
190
|
+
jsonType: CodeGeneratorRequestJson;
|
|
191
|
+
}>;
|
|
188
192
|
/**
|
|
189
193
|
* The plugin writes an encoded CodeGeneratorResponse to stdout.
|
|
190
194
|
*
|
|
@@ -287,7 +291,9 @@ export type CodeGeneratorResponseJson = {
|
|
|
287
291
|
* Describes the message google.protobuf.compiler.CodeGeneratorResponse.
|
|
288
292
|
* Use `create(CodeGeneratorResponseSchema)` to create a new message.
|
|
289
293
|
*/
|
|
290
|
-
export declare const CodeGeneratorResponseSchema: GenMessage<CodeGeneratorResponse,
|
|
294
|
+
export declare const CodeGeneratorResponseSchema: GenMessage<CodeGeneratorResponse, {
|
|
295
|
+
jsonType: CodeGeneratorResponseJson;
|
|
296
|
+
}>;
|
|
291
297
|
/**
|
|
292
298
|
* Represents a single generated file.
|
|
293
299
|
*
|
|
@@ -450,7 +456,9 @@ export type CodeGeneratorResponse_FileJson = {
|
|
|
450
456
|
* Describes the message google.protobuf.compiler.CodeGeneratorResponse.File.
|
|
451
457
|
* Use `create(CodeGeneratorResponse_FileSchema)` to create a new message.
|
|
452
458
|
*/
|
|
453
|
-
export declare const CodeGeneratorResponse_FileSchema: GenMessage<CodeGeneratorResponse_File,
|
|
459
|
+
export declare const CodeGeneratorResponse_FileSchema: GenMessage<CodeGeneratorResponse_File, {
|
|
460
|
+
jsonType: CodeGeneratorResponse_FileJson;
|
|
461
|
+
}>;
|
|
454
462
|
/**
|
|
455
463
|
* Sync with code_generator.h.
|
|
456
464
|
*
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.CodeGeneratorResponse_FeatureSchema = exports.CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse_FileSchema = exports.CodeGeneratorResponseSchema = exports.CodeGeneratorRequestSchema = exports.VersionSchema = exports.file_google_protobuf_compiler_plugin = void 0;
|
|
17
|
-
const file_js_1 = require("../../../../../
|
|
17
|
+
const file_js_1 = require("../../../../../codegenv2/file.js");
|
|
18
18
|
const descriptor_pb_js_1 = require("../descriptor_pb.js");
|
|
19
|
-
const message_js_1 = require("../../../../../
|
|
20
|
-
const enum_js_1 = require("../../../../../
|
|
19
|
+
const message_js_1 = require("../../../../../codegenv2/message.js");
|
|
20
|
+
const enum_js_1 = require("../../../../../codegenv2/enum.js");
|
|
21
21
|
/**
|
|
22
22
|
* Describes the file google/protobuf/compiler/plugin.proto.
|
|
23
23
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenEnum, GenExtension, GenFile, GenMessage } from "../../../../
|
|
1
|
+
import type { GenEnum, GenExtension, GenFile, GenMessage } from "../../../../codegenv2/types.js";
|
|
2
2
|
import type { FeatureSet } from "./descriptor_pb.js";
|
|
3
3
|
import type { Message } from "../../../../types.js";
|
|
4
4
|
/**
|
|
@@ -53,7 +53,9 @@ export type CppFeaturesJson = {
|
|
|
53
53
|
* Describes the message pb.CppFeatures.
|
|
54
54
|
* Use `create(CppFeaturesSchema)` to create a new message.
|
|
55
55
|
*/
|
|
56
|
-
export declare const CppFeaturesSchema: GenMessage<CppFeatures,
|
|
56
|
+
export declare const CppFeaturesSchema: GenMessage<CppFeatures, {
|
|
57
|
+
jsonType: CppFeaturesJson;
|
|
58
|
+
}>;
|
|
57
59
|
/**
|
|
58
60
|
* @generated from enum pb.CppFeatures.StringType
|
|
59
61
|
*/
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.cpp = exports.CppFeatures_StringTypeSchema = exports.CppFeatures_StringType = exports.CppFeaturesSchema = exports.file_google_protobuf_cpp_features = void 0;
|
|
17
|
-
const file_js_1 = require("../../../../
|
|
17
|
+
const file_js_1 = require("../../../../codegenv2/file.js");
|
|
18
18
|
const descriptor_pb_js_1 = require("./descriptor_pb.js");
|
|
19
|
-
const message_js_1 = require("../../../../
|
|
20
|
-
const enum_js_1 = require("../../../../
|
|
21
|
-
const extension_js_1 = require("../../../../
|
|
19
|
+
const message_js_1 = require("../../../../codegenv2/message.js");
|
|
20
|
+
const enum_js_1 = require("../../../../codegenv2/enum.js");
|
|
21
|
+
const extension_js_1 = require("../../../../codegenv2/extension.js");
|
|
22
22
|
/**
|
|
23
23
|
* Describes the file google/protobuf/cpp_features.proto.
|
|
24
24
|
*/
|