@bufbuild/protobuf 2.4.0 → 2.5.0
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
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DescFile } from "../descriptors.js";
|
|
2
2
|
import type { GenEnum } from "./types.js";
|
|
3
3
|
import type { JsonValue } from "../json-value.js";
|
|
4
|
+
export { tsEnum } from "../codegenv2/enum.js";
|
|
4
5
|
/**
|
|
5
6
|
* Hydrate an enum descriptor.
|
|
6
7
|
*
|
|
7
8
|
* @private
|
|
8
9
|
*/
|
|
9
10
|
export declare function enumDesc<Shape extends number, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenEnum<Shape, JsonType>;
|
|
10
|
-
/**
|
|
11
|
-
* Construct a TypeScript enum object at runtime from a descriptor.
|
|
12
|
-
*/
|
|
13
|
-
export declare function tsEnum(desc: DescEnum): enumObject;
|
|
14
|
-
type enumObject = {
|
|
15
|
-
[key: number]: string;
|
|
16
|
-
[k: string]: number | string;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.tsEnum = void 0;
|
|
16
17
|
exports.enumDesc = enumDesc;
|
|
17
|
-
|
|
18
|
+
var enum_js_1 = require("../codegenv2/enum.js");
|
|
19
|
+
Object.defineProperty(exports, "tsEnum", { enumerable: true, get: function () { return enum_js_1.tsEnum; } });
|
|
18
20
|
/**
|
|
19
21
|
* Hydrate an enum descriptor.
|
|
20
22
|
*
|
|
@@ -27,14 +29,3 @@ function enumDesc(file, path, ...paths) {
|
|
|
27
29
|
const e = paths.pop(); // we checked length above
|
|
28
30
|
return paths.reduce((acc, cur) => acc.nestedMessages[cur], file.messages[path]).nestedEnums[e];
|
|
29
31
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Construct a TypeScript enum object at runtime from a descriptor.
|
|
32
|
-
*/
|
|
33
|
-
function tsEnum(desc) {
|
|
34
|
-
const enumObject = {};
|
|
35
|
-
for (const value of desc.values) {
|
|
36
|
-
enumObject[value.localName] = value.number;
|
|
37
|
-
enumObject[value.number] = value.localName;
|
|
38
|
-
}
|
|
39
|
-
return enumObject;
|
|
40
|
-
}
|
|
@@ -13,23 +13,6 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.fileDesc =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const registry_js_1 = require("../registry.js");
|
|
20
|
-
const restore_json_names_js_1 = require("./restore-json-names.js");
|
|
21
|
-
const from_binary_js_1 = require("../from-binary.js");
|
|
22
|
-
/**
|
|
23
|
-
* Hydrate a file descriptor.
|
|
24
|
-
*
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
function fileDesc(b64, imports) {
|
|
28
|
-
var _a;
|
|
29
|
-
const root = (0, from_binary_js_1.fromBinary)(descriptor_pb_js_1.FileDescriptorProtoSchema, (0, base64_encoding_js_1.base64Decode)(b64));
|
|
30
|
-
root.messageType.forEach(restore_json_names_js_1.restoreJsonNames);
|
|
31
|
-
root.dependency = (_a = imports === null || imports === void 0 ? void 0 : imports.map((f) => f.proto.name)) !== null && _a !== void 0 ? _a : [];
|
|
32
|
-
const reg = (0, registry_js_1.createFileRegistry)(root, (protoFileName) => imports === null || imports === void 0 ? void 0 : imports.find((f) => f.proto.name === protoFileName));
|
|
33
|
-
// biome-ignore lint/style/noNonNullAssertion: non-null assertion because we just created the registry from the file we look up
|
|
34
|
-
return reg.getFile(root.name);
|
|
35
|
-
}
|
|
16
|
+
exports.fileDesc = void 0;
|
|
17
|
+
var file_js_1 = require("../codegenv2/file.js");
|
|
18
|
+
Object.defineProperty(exports, "fileDesc", { enumerable: true, get: function () { return file_js_1.fileDesc; } });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
export * from "
|
|
1
|
+
export * from "../codegenv2/boot.js";
|
|
2
|
+
export * from "../codegenv2/embed.js";
|
|
3
3
|
export * from "./enum.js";
|
|
4
4
|
export * from "./extension.js";
|
|
5
5
|
export * from "./file.js";
|
|
6
6
|
export * from "./message.js";
|
|
7
7
|
export * from "./service.js";
|
|
8
8
|
export * from "./symbols.js";
|
|
9
|
-
export * from "
|
|
9
|
+
export * from "../codegenv2/scalar.js";
|
|
10
10
|
export * from "./types.js";
|
|
@@ -27,13 +27,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
__exportStar(require("
|
|
31
|
-
__exportStar(require("
|
|
30
|
+
__exportStar(require("../codegenv2/boot.js"), exports);
|
|
31
|
+
__exportStar(require("../codegenv2/embed.js"), exports);
|
|
32
32
|
__exportStar(require("./enum.js"), exports);
|
|
33
33
|
__exportStar(require("./extension.js"), exports);
|
|
34
34
|
__exportStar(require("./file.js"), exports);
|
|
35
35
|
__exportStar(require("./message.js"), exports);
|
|
36
36
|
__exportStar(require("./service.js"), exports);
|
|
37
37
|
__exportStar(require("./symbols.js"), exports);
|
|
38
|
-
__exportStar(require("
|
|
38
|
+
__exportStar(require("../codegenv2/scalar.js"), exports);
|
|
39
39
|
__exportStar(require("./types.js"), exports);
|
|
@@ -10,66 +10,6 @@ export declare const wktPublicImportPaths: Readonly<Record<string, string>>;
|
|
|
10
10
|
* @private
|
|
11
11
|
*/
|
|
12
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
13
|
readonly codegen: {
|
|
74
14
|
readonly boot: {
|
|
75
15
|
readonly typeOnly: false;
|
|
@@ -132,4 +72,64 @@ export declare const symbols: {
|
|
|
132
72
|
readonly from: string;
|
|
133
73
|
};
|
|
134
74
|
};
|
|
75
|
+
readonly isMessage: {
|
|
76
|
+
readonly typeOnly: false;
|
|
77
|
+
readonly bootstrapWktFrom: "../../is-message.js";
|
|
78
|
+
readonly from: "@bufbuild/protobuf";
|
|
79
|
+
};
|
|
80
|
+
readonly Message: {
|
|
81
|
+
readonly typeOnly: true;
|
|
82
|
+
readonly bootstrapWktFrom: "../../types.js";
|
|
83
|
+
readonly from: "@bufbuild/protobuf";
|
|
84
|
+
};
|
|
85
|
+
readonly create: {
|
|
86
|
+
readonly typeOnly: false;
|
|
87
|
+
readonly bootstrapWktFrom: "../../create.js";
|
|
88
|
+
readonly from: "@bufbuild/protobuf";
|
|
89
|
+
};
|
|
90
|
+
readonly fromJson: {
|
|
91
|
+
readonly typeOnly: false;
|
|
92
|
+
readonly bootstrapWktFrom: "../../from-json.js";
|
|
93
|
+
readonly from: "@bufbuild/protobuf";
|
|
94
|
+
};
|
|
95
|
+
readonly fromJsonString: {
|
|
96
|
+
readonly typeOnly: false;
|
|
97
|
+
readonly bootstrapWktFrom: "../../from-json.js";
|
|
98
|
+
readonly from: "@bufbuild/protobuf";
|
|
99
|
+
};
|
|
100
|
+
readonly fromBinary: {
|
|
101
|
+
readonly typeOnly: false;
|
|
102
|
+
readonly bootstrapWktFrom: "../../from-binary.js";
|
|
103
|
+
readonly from: "@bufbuild/protobuf";
|
|
104
|
+
};
|
|
105
|
+
readonly toBinary: {
|
|
106
|
+
readonly typeOnly: false;
|
|
107
|
+
readonly bootstrapWktFrom: "../../to-binary.js";
|
|
108
|
+
readonly from: "@bufbuild/protobuf";
|
|
109
|
+
};
|
|
110
|
+
readonly toJson: {
|
|
111
|
+
readonly typeOnly: false;
|
|
112
|
+
readonly bootstrapWktFrom: "../../to-json.js";
|
|
113
|
+
readonly from: "@bufbuild/protobuf";
|
|
114
|
+
};
|
|
115
|
+
readonly toJsonString: {
|
|
116
|
+
readonly typeOnly: false;
|
|
117
|
+
readonly bootstrapWktFrom: "../../to-json.js";
|
|
118
|
+
readonly from: "@bufbuild/protobuf";
|
|
119
|
+
};
|
|
120
|
+
readonly protoInt64: {
|
|
121
|
+
readonly typeOnly: false;
|
|
122
|
+
readonly bootstrapWktFrom: "../../proto-int64.js";
|
|
123
|
+
readonly from: "@bufbuild/protobuf";
|
|
124
|
+
};
|
|
125
|
+
readonly JsonValue: {
|
|
126
|
+
readonly typeOnly: true;
|
|
127
|
+
readonly bootstrapWktFrom: "../../json-value.js";
|
|
128
|
+
readonly from: "@bufbuild/protobuf";
|
|
129
|
+
};
|
|
130
|
+
readonly JsonObject: {
|
|
131
|
+
readonly typeOnly: true;
|
|
132
|
+
readonly bootstrapWktFrom: "../../json-value.js";
|
|
133
|
+
readonly from: "@bufbuild/protobuf";
|
|
134
|
+
};
|
|
135
135
|
};
|
|
@@ -14,48 +14,20 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.symbols = exports.wktPublicImportPaths = exports.packageName = void 0;
|
|
17
|
+
const symbols_js_1 = require("../codegenv2/symbols.js");
|
|
17
18
|
/**
|
|
18
19
|
* @private
|
|
19
20
|
*/
|
|
20
|
-
exports.packageName =
|
|
21
|
+
exports.packageName = symbols_js_1.packageName;
|
|
21
22
|
/**
|
|
22
23
|
* @private
|
|
23
24
|
*/
|
|
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
|
-
};
|
|
25
|
+
exports.wktPublicImportPaths = symbols_js_1.wktPublicImportPaths;
|
|
41
26
|
/**
|
|
42
27
|
* @private
|
|
43
28
|
*/
|
|
44
29
|
// 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: {
|
|
30
|
+
exports.symbols = Object.assign(Object.assign({}, symbols_js_1.symbols), { codegen: {
|
|
59
31
|
boot: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/boot.js", from: exports.packageName + "/codegenv1" },
|
|
60
32
|
fileDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/file.js", from: exports.packageName + "/codegenv1" },
|
|
61
33
|
enumDesc: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/enum.js", from: exports.packageName + "/codegenv1" },
|
|
@@ -68,5 +40,4 @@ exports.symbols = {
|
|
|
68
40
|
GenExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" },
|
|
69
41
|
GenMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" },
|
|
70
42
|
GenService: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" },
|
|
71
|
-
}
|
|
72
|
-
};
|
|
43
|
+
} });
|
|
@@ -15,8 +15,9 @@ export type GenFile = DescFile;
|
|
|
15
15
|
*
|
|
16
16
|
* @private
|
|
17
17
|
*/
|
|
18
|
-
export type GenMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field"> & {
|
|
18
|
+
export type GenMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field" | "typeName"> & {
|
|
19
19
|
field: Record<MessageFieldNames<RuntimeShape>, DescField>;
|
|
20
|
+
typeName: RuntimeShape["$typeName"];
|
|
20
21
|
} & brandv1<RuntimeShape, JsonType>;
|
|
21
22
|
/**
|
|
22
23
|
* Describes an enumeration in a protobuf source file.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DescEnum, DescFile } from "../descriptors.js";
|
|
2
|
+
import type { GenEnum } from "./types.js";
|
|
3
|
+
import type { JsonValue } from "../json-value.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hydrate an enum descriptor.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare function enumDesc<Shape extends number, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenEnum<Shape, JsonType>;
|
|
10
|
+
/**
|
|
11
|
+
* Construct a TypeScript enum object at runtime from a descriptor.
|
|
12
|
+
*/
|
|
13
|
+
export declare function tsEnum(desc: DescEnum): enumObject;
|
|
14
|
+
type enumObject = {
|
|
15
|
+
[key: number]: string;
|
|
16
|
+
[k: string]: number | string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
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.enumDesc = enumDesc;
|
|
17
|
+
exports.tsEnum = tsEnum;
|
|
18
|
+
/**
|
|
19
|
+
* Hydrate an enum descriptor.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
function enumDesc(file, path, ...paths) {
|
|
24
|
+
if (paths.length == 0) {
|
|
25
|
+
return file.enums[path];
|
|
26
|
+
}
|
|
27
|
+
const e = paths.pop(); // we checked length above
|
|
28
|
+
return paths.reduce((acc, cur) => acc.nestedMessages[cur], file.messages[path]).nestedEnums[e];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Construct a TypeScript enum object at runtime from a descriptor.
|
|
32
|
+
*/
|
|
33
|
+
function tsEnum(desc) {
|
|
34
|
+
const enumObject = {};
|
|
35
|
+
for (const value of desc.values) {
|
|
36
|
+
enumObject[value.localName] = value.number;
|
|
37
|
+
enumObject[value.number] = value.localName;
|
|
38
|
+
}
|
|
39
|
+
return enumObject;
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Message } from "../types.js";
|
|
2
|
+
import type { DescFile } from "../descriptors.js";
|
|
3
|
+
import type { GenExtension } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hydrate an extension descriptor.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare function extDesc<Extendee extends Message, Value>(file: DescFile, path: number, ...paths: number[]): GenExtension<Extendee, Value>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.extDesc = extDesc;
|
|
17
|
+
/**
|
|
18
|
+
* Hydrate an extension descriptor.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
function extDesc(file, path, ...paths) {
|
|
23
|
+
if (paths.length == 0) {
|
|
24
|
+
return file.extensions[path];
|
|
25
|
+
}
|
|
26
|
+
const e = paths.pop(); // we checked length above
|
|
27
|
+
return paths.reduce((acc, cur) => acc.nestedMessages[cur], file.messages[path]).nestedExtensions[e];
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.fileDesc = fileDesc;
|
|
17
|
+
const base64_encoding_js_1 = require("../wire/base64-encoding.js");
|
|
18
|
+
const descriptor_pb_js_1 = require("../wkt/gen/google/protobuf/descriptor_pb.js");
|
|
19
|
+
const registry_js_1 = require("../registry.js");
|
|
20
|
+
const restore_json_names_js_1 = require("./restore-json-names.js");
|
|
21
|
+
const from_binary_js_1 = require("../from-binary.js");
|
|
22
|
+
/**
|
|
23
|
+
* Hydrate a file descriptor.
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
function fileDesc(b64, imports) {
|
|
28
|
+
var _a;
|
|
29
|
+
const root = (0, from_binary_js_1.fromBinary)(descriptor_pb_js_1.FileDescriptorProtoSchema, (0, base64_encoding_js_1.base64Decode)(b64));
|
|
30
|
+
root.messageType.forEach(restore_json_names_js_1.restoreJsonNames);
|
|
31
|
+
root.dependency = (_a = imports === null || imports === void 0 ? void 0 : imports.map((f) => f.proto.name)) !== null && _a !== void 0 ? _a : [];
|
|
32
|
+
const reg = (0, registry_js_1.createFileRegistry)(root, (protoFileName) => imports === null || imports === void 0 ? void 0 : imports.find((f) => f.proto.name === protoFileName));
|
|
33
|
+
// biome-ignore lint/style/noNonNullAssertion: non-null assertion because we just created the registry from the file we look up
|
|
34
|
+
return reg.getFile(root.name);
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./boot.js";
|
|
2
|
+
export * from "./embed.js";
|
|
3
|
+
export * from "./enum.js";
|
|
4
|
+
export * from "./extension.js";
|
|
5
|
+
export * from "./file.js";
|
|
6
|
+
export * from "./message.js";
|
|
7
|
+
export * from "./service.js";
|
|
8
|
+
export * from "./symbols.js";
|
|
9
|
+
export * from "./scalar.js";
|
|
10
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
__exportStar(require("./boot.js"), exports);
|
|
31
|
+
__exportStar(require("./embed.js"), exports);
|
|
32
|
+
__exportStar(require("./enum.js"), exports);
|
|
33
|
+
__exportStar(require("./extension.js"), exports);
|
|
34
|
+
__exportStar(require("./file.js"), exports);
|
|
35
|
+
__exportStar(require("./message.js"), exports);
|
|
36
|
+
__exportStar(require("./service.js"), exports);
|
|
37
|
+
__exportStar(require("./symbols.js"), exports);
|
|
38
|
+
__exportStar(require("./scalar.js"), exports);
|
|
39
|
+
__exportStar(require("./types.js"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Message } from "../types.js";
|
|
2
|
+
import type { DescFile } from "../descriptors.js";
|
|
3
|
+
import type { GenMessage } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hydrate a message descriptor.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare function messageDesc<Shape extends Message, Opt extends {
|
|
10
|
+
jsonType?: unknown;
|
|
11
|
+
validType?: unknown;
|
|
12
|
+
} = {
|
|
13
|
+
jsonType: undefined;
|
|
14
|
+
validType: undefined;
|
|
15
|
+
}>(file: DescFile, path: number, ...paths: number[]): GenMessage<Shape, Opt>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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.messageDesc = messageDesc;
|
|
17
|
+
/**
|
|
18
|
+
* Hydrate a message descriptor.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
function messageDesc(file, path, ...paths) {
|
|
23
|
+
return paths.reduce((acc, cur) => acc.nestedMessages[cur], file.messages[path]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GenService, GenServiceMethods } from "./types.js";
|
|
2
|
+
import type { DescFile } from "../descriptors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hydrate a service descriptor.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare function serviceDesc<T extends GenServiceMethods>(file: DescFile, path: number, ...paths: number[]): GenService<T>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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.serviceDesc = serviceDesc;
|
|
17
|
+
/**
|
|
18
|
+
* Hydrate a service descriptor.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
function serviceDesc(file, path, ...paths) {
|
|
23
|
+
if (paths.length > 0) {
|
|
24
|
+
throw new Error();
|
|
25
|
+
}
|
|
26
|
+
return file.services[path];
|
|
27
|
+
}
|