@songtonyli/dsh-cli 0.1.32 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@bufbuild/protobuf/README.md +41 -0
  4. package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.js +66 -0
  5. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.js +18 -0
  6. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.js +31 -0
  7. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.js +28 -0
  8. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.js +18 -0
  9. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.js +39 -0
  10. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.js +24 -0
  11. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.js +27 -0
  12. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.js +43 -0
  13. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.js +15 -0
  14. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.js +105 -0
  15. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.js +244 -0
  16. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.js +58 -0
  17. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.js +28 -0
  18. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.js +35 -0
  19. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.js +39 -0
  20. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.js +24 -0
  21. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.js +29 -0
  22. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.js +67 -0
  23. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.js +27 -0
  24. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.js +74 -0
  25. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.js +15 -0
  26. package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +296 -0
  27. package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.js +53 -0
  28. package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.js +209 -0
  29. package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.js +168 -0
  30. package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.js +45 -0
  31. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +415 -0
  32. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +1037 -0
  33. package/node_modules/@bufbuild/protobuf/dist/commonjs/index.js +55 -0
  34. package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.js +33 -0
  35. package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.js +15 -0
  36. package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.js +70 -0
  37. package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +4 -0
  38. package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.js +131 -0
  39. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.js +36 -0
  40. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.js +78 -0
  41. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.js +41 -0
  42. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/message.js +157 -0
  43. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.js +115 -0
  44. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.js +110 -0
  45. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.js +376 -0
  46. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +292 -0
  47. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.js +16 -0
  48. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +469 -0
  49. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.js +129 -0
  50. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.js +149 -0
  51. package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +954 -0
  52. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.js +437 -0
  53. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +625 -0
  54. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.js +684 -0
  55. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.js +21 -0
  56. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.js +47 -0
  57. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.js +481 -0
  58. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.js +358 -0
  59. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.js +220 -0
  60. package/node_modules/@bufbuild/protobuf/dist/commonjs/types.js +15 -0
  61. package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.js +26 -0
  62. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.js +188 -0
  63. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +726 -0
  64. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.js +37 -0
  65. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.js +191 -0
  66. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.js +106 -0
  67. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.js +199 -0
  68. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.js +334 -0
  69. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.js +75 -0
  70. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.js +39 -0
  71. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.js +27 -0
  72. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.js +39 -0
  73. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +68 -0
  74. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.js +60 -0
  75. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.js +892 -0
  76. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.js +27 -0
  77. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.js +27 -0
  78. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.js +27 -0
  79. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.js +126 -0
  80. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.js +106 -0
  81. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.js +27 -0
  82. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.js +59 -0
  83. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.js +27 -0
  84. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.js +242 -0
  85. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.js +67 -0
  86. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.js +48 -0
  87. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/json.js +44 -0
  88. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.js +57 -0
  89. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.js +66 -0
  90. package/node_modules/@bufbuild/protobuf/dist/esm/clone.js +63 -0
  91. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.js +14 -0
  92. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.js +26 -0
  93. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.js +25 -0
  94. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.js +14 -0
  95. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.js +23 -0
  96. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.js +21 -0
  97. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.js +24 -0
  98. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.js +40 -0
  99. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.js +14 -0
  100. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +101 -0
  101. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +239 -0
  102. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +53 -0
  103. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +25 -0
  104. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +32 -0
  105. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +23 -0
  106. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js +21 -0
  107. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js +26 -0
  108. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +63 -0
  109. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +24 -0
  110. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +71 -0
  111. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +14 -0
  112. package/node_modules/@bufbuild/protobuf/dist/esm/create.js +293 -0
  113. package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.js +50 -0
  114. package/node_modules/@bufbuild/protobuf/dist/esm/equals.js +206 -0
  115. package/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +159 -0
  116. package/node_modules/@bufbuild/protobuf/dist/esm/fields.js +41 -0
  117. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +409 -0
  118. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +1029 -0
  119. package/node_modules/@bufbuild/protobuf/dist/esm/index.js +29 -0
  120. package/node_modules/@bufbuild/protobuf/dist/esm/is-message.js +30 -0
  121. package/node_modules/@bufbuild/protobuf/dist/esm/json-value.js +14 -0
  122. package/node_modules/@bufbuild/protobuf/dist/esm/merge.js +67 -0
  123. package/node_modules/@bufbuild/protobuf/dist/esm/package.json +4 -0
  124. package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +128 -0
  125. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +31 -0
  126. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +71 -0
  127. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.js +21 -0
  128. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/message.js +152 -0
  129. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +109 -0
  130. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +105 -0
  131. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.js +369 -0
  132. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +284 -0
  133. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.js +14 -0
  134. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +464 -0
  135. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +124 -0
  136. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +140 -0
  137. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +948 -0
  138. package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +433 -0
  139. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +620 -0
  140. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.js +680 -0
  141. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.js +15 -0
  142. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.js +44 -0
  143. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.js +477 -0
  144. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +355 -0
  145. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.js +214 -0
  146. package/node_modules/@bufbuild/protobuf/dist/esm/types.js +14 -0
  147. package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js +23 -0
  148. package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +184 -0
  149. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +721 -0
  150. package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +18 -0
  151. package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +186 -0
  152. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +101 -0
  153. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js +195 -0
  154. package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +325 -0
  155. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +69 -0
  156. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +35 -0
  157. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +24 -0
  158. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +36 -0
  159. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +65 -0
  160. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +57 -0
  161. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +888 -0
  162. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +24 -0
  163. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +24 -0
  164. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +24 -0
  165. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +123 -0
  166. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +103 -0
  167. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +24 -0
  168. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +56 -0
  169. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +24 -0
  170. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +239 -0
  171. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +64 -0
  172. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +32 -0
  173. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/json.js +41 -0
  174. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +50 -0
  175. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +61 -0
  176. package/node_modules/@bufbuild/protobuf/package.json +136 -0
  177. package/node_modules/@deepseek-ai/dsh-base/package.json +1 -0
  178. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +2 -2
  179. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  180. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +2 -2
  181. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +6 -0
  182. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +143 -0
  183. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +143 -0
  184. package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +3557 -0
  185. package/node_modules/@deepseek-ai/dsh-llm-cursor/package.json +61 -0
  186. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
  187. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +39 -26
  188. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +39 -26
  189. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +1121 -223
  190. package/package.json +5 -1
@@ -0,0 +1,29 @@
1
+ // Copyright 2021-2026 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 "./types.js";
15
+ export * from "./is-message.js";
16
+ export * from "./create.js";
17
+ export * from "./clone.js";
18
+ export * from "./descriptors.js";
19
+ export * from "./equals.js";
20
+ export * from "./fields.js";
21
+ export * from "./registry.js";
22
+ export { toBinary } from "./to-binary.js";
23
+ export { fromBinary, mergeFromBinary } from "./from-binary.js";
24
+ export * from "./to-json.js";
25
+ export * from "./from-json.js";
26
+ export * from "./merge.js";
27
+ export { hasExtension, getExtension, setExtension, clearExtension, hasOption, getOption, } from "./extensions.js";
28
+ export * from "./proto-int64.js";
29
+ export * from "./unknown-enum.js";
@@ -0,0 +1,30 @@
1
+ // Copyright 2021-2026 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
+ * Determine whether the given `arg` is a message.
16
+ * If `desc` is set, determine whether `arg` is this specific message.
17
+ */
18
+ export function isMessage(arg, schema) {
19
+ const isMessage = arg !== null &&
20
+ typeof arg == "object" &&
21
+ "$typeName" in arg &&
22
+ typeof arg.$typeName == "string";
23
+ if (!isMessage) {
24
+ return false;
25
+ }
26
+ if (schema === undefined) {
27
+ return true;
28
+ }
29
+ return schema.typeName === arg.$typeName;
30
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright 2021-2026 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 {};
@@ -0,0 +1,67 @@
1
+ // Copyright 2021-2026 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 { reflect } from "./reflect/reflect.js";
15
+ /**
16
+ * Merge message `source` into message `target`, following Protobuf semantics.
17
+ *
18
+ * This is the same as serializing the source message, then deserializing it
19
+ * into the target message via `mergeFromBinary()`, with one difference:
20
+ * While serialization will create a copy of all values, `merge()` will copy
21
+ * the reference for `bytes` and messages.
22
+ *
23
+ * Also see https://protobuf.com/docs/language-spec#merging-protobuf-messages
24
+ */
25
+ export function merge(schema, target, source) {
26
+ reflectMerge(reflect(schema, target), reflect(schema, source));
27
+ }
28
+ function reflectMerge(target, source) {
29
+ var _a;
30
+ var _b;
31
+ const sourceUnknown = source.message.$unknown;
32
+ if (sourceUnknown !== undefined && sourceUnknown.length > 0) {
33
+ (_a = (_b = target.message).$unknown) !== null && _a !== void 0 ? _a : (_b.$unknown = []);
34
+ target.message.$unknown.push(...sourceUnknown);
35
+ }
36
+ for (const f of target.fields) {
37
+ if (!source.isSet(f)) {
38
+ continue;
39
+ }
40
+ switch (f.fieldKind) {
41
+ case "scalar":
42
+ case "enum":
43
+ target.set(f, source.get(f));
44
+ break;
45
+ case "message":
46
+ if (target.isSet(f)) {
47
+ reflectMerge(target.get(f), source.get(f));
48
+ }
49
+ else {
50
+ target.set(f, source.get(f));
51
+ }
52
+ break;
53
+ case "list":
54
+ const list = target.get(f);
55
+ for (const e of source.get(f)) {
56
+ list.add(e);
57
+ }
58
+ break;
59
+ case "map":
60
+ const map = target.get(f);
61
+ for (const [k, v] of source.get(f)) {
62
+ map.set(k, v);
63
+ }
64
+ break;
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": false
4
+ }
@@ -0,0 +1,128 @@
1
+ // Copyright 2021-2026 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 { int64FromString, int64ToString, uInt64ToString, } from "./wire/varint.js";
15
+ /**
16
+ * Int64Support for the current environment.
17
+ */
18
+ export const protoInt64 = /*@__PURE__*/ makeInt64Support();
19
+ function makeInt64Support() {
20
+ const dv = new DataView(new ArrayBuffer(8));
21
+ // note that Safari 14 implements BigInt, but not the DataView methods
22
+ const ok = typeof BigInt === "function" &&
23
+ typeof dv.getBigInt64 === "function" &&
24
+ typeof dv.getBigUint64 === "function" &&
25
+ typeof dv.setBigInt64 === "function" &&
26
+ typeof dv.setBigUint64 === "function" &&
27
+ (!!globalThis.Deno ||
28
+ !!globalThis.Bun ||
29
+ typeof process != "object" ||
30
+ typeof process.env != "object" ||
31
+ process.env.BUF_BIGINT_DISABLE !== "1");
32
+ if (ok) {
33
+ const MIN = BigInt("-9223372036854775808");
34
+ const MAX = BigInt("9223372036854775807");
35
+ const UMIN = BigInt("0");
36
+ const UMAX = BigInt("18446744073709551615");
37
+ return {
38
+ zero: BigInt(0),
39
+ supported: true,
40
+ parse(value) {
41
+ const bi = typeof value == "bigint" ? value : BigInt(value);
42
+ if (bi > MAX || bi < MIN) {
43
+ throw new Error(`invalid int64: ${value}`);
44
+ }
45
+ return bi;
46
+ },
47
+ uParse(value) {
48
+ const bi = typeof value == "bigint" ? value : BigInt(value);
49
+ if (bi > UMAX || bi < UMIN) {
50
+ throw new Error(`invalid uint64: ${value}`);
51
+ }
52
+ return bi;
53
+ },
54
+ enc(value) {
55
+ dv.setBigInt64(0, this.parse(value), true);
56
+ return {
57
+ lo: dv.getInt32(0, true),
58
+ hi: dv.getInt32(4, true),
59
+ };
60
+ },
61
+ uEnc(value) {
62
+ dv.setBigInt64(0, this.uParse(value), true);
63
+ return {
64
+ lo: dv.getInt32(0, true),
65
+ hi: dv.getInt32(4, true),
66
+ };
67
+ },
68
+ dec(lo, hi) {
69
+ dv.setInt32(0, lo, true);
70
+ dv.setInt32(4, hi, true);
71
+ return dv.getBigInt64(0, true);
72
+ },
73
+ uDec(lo, hi) {
74
+ dv.setInt32(0, lo, true);
75
+ dv.setInt32(4, hi, true);
76
+ return dv.getBigUint64(0, true);
77
+ },
78
+ };
79
+ }
80
+ return {
81
+ zero: "0",
82
+ supported: false,
83
+ parse(value) {
84
+ if (typeof value != "string") {
85
+ value = value.toString();
86
+ }
87
+ assertInt64String(value);
88
+ return value;
89
+ },
90
+ uParse(value) {
91
+ if (typeof value != "string") {
92
+ value = value.toString();
93
+ }
94
+ assertUInt64String(value);
95
+ return value;
96
+ },
97
+ enc(value) {
98
+ if (typeof value != "string") {
99
+ value = value.toString();
100
+ }
101
+ assertInt64String(value);
102
+ return int64FromString(value);
103
+ },
104
+ uEnc(value) {
105
+ if (typeof value != "string") {
106
+ value = value.toString();
107
+ }
108
+ assertUInt64String(value);
109
+ return int64FromString(value);
110
+ },
111
+ dec(lo, hi) {
112
+ return int64ToString(lo, hi);
113
+ },
114
+ uDec(lo, hi) {
115
+ return uInt64ToString(lo, hi);
116
+ },
117
+ };
118
+ }
119
+ function assertInt64String(value) {
120
+ if (!/^-?[0-9]+$/.test(value)) {
121
+ throw new Error("invalid int64: " + value);
122
+ }
123
+ }
124
+ function assertUInt64String(value) {
125
+ if (!/^[0-9]+$/.test(value)) {
126
+ throw new Error("invalid uint64: " + value);
127
+ }
128
+ }
@@ -0,0 +1,31 @@
1
+ // Copyright 2021-2026 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,71 @@
1
+ // Copyright 2021-2026 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
+ export function isObject(arg) {
16
+ return arg !== null && typeof arg == "object" && !Array.isArray(arg);
17
+ }
18
+ export function isOneofADT(arg) {
19
+ return (arg !== null &&
20
+ typeof arg == "object" &&
21
+ "case" in arg &&
22
+ ((typeof arg.case == "string" && "value" in arg && arg.value != null) ||
23
+ (arg.case === undefined &&
24
+ (!("value" in arg) || arg.value === undefined))));
25
+ }
26
+ export function isReflectList(arg, field) {
27
+ var _a, _b, _c, _d;
28
+ if (isObject(arg) &&
29
+ unsafeLocal in arg &&
30
+ "add" in arg &&
31
+ "field" in arg &&
32
+ typeof arg.field == "function") {
33
+ if (field !== undefined) {
34
+ const a = field;
35
+ const 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
+ "desc" in arg &&
68
+ isObject(arg.desc) &&
69
+ arg.desc.kind === "message" &&
70
+ (messageDesc === undefined || arg.desc.typeName == messageDesc.typeName));
71
+ }
@@ -0,0 +1,21 @@
1
+ // Copyright 2021-2026 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 "./scalar.js";
20
+ export * from "./path.js";
21
+ export { isReflectList, isReflectMap, isReflectMessage } from "./guard.js";
@@ -0,0 +1,152 @@
1
+ // Copyright 2021-2026 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 { create } from "../create.js";
15
+ import { isObject } from "./guard.js";
16
+ import { isWrapperDesc } from "../wkt/wrappers.js";
17
+ // google.protobuf.NullValue.NULL_VALUE;
18
+ const NULL_VALUE = 0;
19
+ /**
20
+ * Return the conversions between the local representation of the field
21
+ * value and the message it represents.
22
+ *
23
+ * @private
24
+ */
25
+ export function localMessageMapper(field) {
26
+ // google.protobuf.Struct fields are stored as JsonObject.
27
+ if (usesJsonRepresentation(field)) {
28
+ return {
29
+ toMessage: (local) => wktStructToReflect(local),
30
+ toLocal: (message) => wktStructToLocal(message),
31
+ };
32
+ }
33
+ // Singular wrapper fields outside a oneof are unwrapped to the scalar value.
34
+ if (field.fieldKind == "message" &&
35
+ !field.oneof &&
36
+ isWrapperDesc(field.message)) {
37
+ const wrapperDesc = field.message;
38
+ const valueLocalName = wrapperDesc.fields[0].localName;
39
+ return {
40
+ toMessage: (local) => {
41
+ const message = create(wrapperDesc);
42
+ if (local !== undefined) {
43
+ message[valueLocalName] = local;
44
+ }
45
+ return message;
46
+ },
47
+ toLocal: (message) => message[valueLocalName],
48
+ };
49
+ }
50
+ // For all other fields, the local value is the message itself.
51
+ const childDesc = field.message;
52
+ return {
53
+ toMessage: (local) => (local === undefined ? create(childDesc) : local),
54
+ toLocal: (message) => message,
55
+ };
56
+ }
57
+ /**
58
+ * Returns true if values of this field are stored as JsonValue instead of
59
+ * a message: google.protobuf.Struct is represented with JsonObject when
60
+ * used in a field, except when used in google.protobuf.Value.
61
+ */
62
+ function usesJsonRepresentation(field) {
63
+ return (field.message.typeName == "google.protobuf.Struct" &&
64
+ field.parent.typeName != "google.protobuf.Value");
65
+ }
66
+ /**
67
+ * Convert the JsonValue representation of a google.protobuf.Struct to the
68
+ * message representation.
69
+ *
70
+ * @private
71
+ */
72
+ export function wktStructToReflect(json) {
73
+ const struct = {
74
+ $typeName: "google.protobuf.Struct",
75
+ fields: {},
76
+ };
77
+ if (isObject(json)) {
78
+ for (const k of Object.keys(json)) {
79
+ struct.fields[k] = wktValueToReflect(json[k]);
80
+ }
81
+ }
82
+ return struct;
83
+ }
84
+ /**
85
+ * Convert a google.protobuf.Struct message to its JsonValue representation.
86
+ *
87
+ * @private
88
+ */
89
+ export function wktStructToLocal(val) {
90
+ const json = {};
91
+ for (const k of Object.keys(val.fields)) {
92
+ json[k] = wktValueToLocal(val.fields[k]);
93
+ }
94
+ return json;
95
+ }
96
+ function wktValueToLocal(val) {
97
+ switch (val.kind.case) {
98
+ case "structValue":
99
+ return wktStructToLocal(val.kind.value);
100
+ case "listValue":
101
+ return val.kind.value.values.map(wktValueToLocal);
102
+ case "nullValue":
103
+ case undefined:
104
+ return null;
105
+ default:
106
+ return val.kind.value;
107
+ }
108
+ }
109
+ function wktValueToReflect(json) {
110
+ const value = {
111
+ $typeName: "google.protobuf.Value",
112
+ kind: { case: undefined },
113
+ };
114
+ switch (typeof json) {
115
+ case "number":
116
+ value.kind = { case: "numberValue", value: json };
117
+ break;
118
+ case "string":
119
+ value.kind = { case: "stringValue", value: json };
120
+ break;
121
+ case "boolean":
122
+ value.kind = { case: "boolValue", value: json };
123
+ break;
124
+ case "object":
125
+ if (json === null) {
126
+ value.kind = { case: "nullValue", value: NULL_VALUE };
127
+ }
128
+ else if (Array.isArray(json)) {
129
+ const listValue = {
130
+ $typeName: "google.protobuf.ListValue",
131
+ values: [],
132
+ };
133
+ if (Array.isArray(json)) {
134
+ for (const e of json) {
135
+ listValue.values.push(wktValueToReflect(e));
136
+ }
137
+ }
138
+ value.kind = {
139
+ case: "listValue",
140
+ value: listValue,
141
+ };
142
+ }
143
+ else {
144
+ value.kind = {
145
+ case: "structValue",
146
+ value: wktStructToReflect(json),
147
+ };
148
+ }
149
+ break;
150
+ }
151
+ return value;
152
+ }
@@ -0,0 +1,109 @@
1
+ // Copyright 2021-2026 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
+ * Return a fully-qualified name for a Protobuf descriptor.
16
+ * For a file descriptor, return the original file path.
17
+ *
18
+ * See https://protobuf.com/docs/language-spec#fully-qualified-names
19
+ */
20
+ export function qualifiedName(desc) {
21
+ switch (desc.kind) {
22
+ case "field":
23
+ case "oneof":
24
+ case "rpc":
25
+ return desc.parent.typeName + "." + desc.name;
26
+ case "enum_value": {
27
+ const p = desc.parent.parent
28
+ ? desc.parent.parent.typeName
29
+ : desc.parent.file.proto.package;
30
+ return p + (p.length > 0 ? "." : "") + desc.name;
31
+ }
32
+ case "service":
33
+ case "message":
34
+ case "enum":
35
+ case "extension":
36
+ return desc.typeName;
37
+ case "file":
38
+ return desc.proto.name;
39
+ }
40
+ }
41
+ /**
42
+ * Converts snake_case to protoCamelCase according to the convention
43
+ * used by protoc to convert a field name to a JSON name.
44
+ *
45
+ * See https://protobuf.com/docs/language-spec#default-json-names
46
+ *
47
+ * The function protoSnakeCase provides the reverse.
48
+ */
49
+ export function protoCamelCase(snakeCase) {
50
+ let capNext = false;
51
+ const b = [];
52
+ for (let i = 0; i < snakeCase.length; i++) {
53
+ let c = snakeCase.charAt(i);
54
+ switch (c) {
55
+ case "_":
56
+ capNext = true;
57
+ break;
58
+ case "0":
59
+ case "1":
60
+ case "2":
61
+ case "3":
62
+ case "4":
63
+ case "5":
64
+ case "6":
65
+ case "7":
66
+ case "8":
67
+ case "9":
68
+ b.push(c);
69
+ capNext = false;
70
+ break;
71
+ default:
72
+ if (capNext) {
73
+ capNext = false;
74
+ c = c.toUpperCase();
75
+ }
76
+ b.push(c);
77
+ break;
78
+ }
79
+ }
80
+ return b.join("");
81
+ }
82
+ /**
83
+ * Converts protoCamelCase to snake_case.
84
+ *
85
+ * This function is the reverse of function protoCamelCase. Note that some names
86
+ * are not reversible - for example, "foo__bar" -> "fooBar" -> "foo_bar".
87
+ */
88
+ export function protoSnakeCase(lowerCamelCase) {
89
+ return lowerCamelCase.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
90
+ }
91
+ /**
92
+ * Names that cannot be used for object properties because they are reserved
93
+ * by built-in JavaScript properties.
94
+ */
95
+ const reservedObjectProperties = new Set([
96
+ // names reserved by JavaScript
97
+ "constructor",
98
+ "toString",
99
+ "toJSON",
100
+ "valueOf",
101
+ ]);
102
+ /**
103
+ * Escapes names that are reserved for ECMAScript built-in object properties.
104
+ *
105
+ * Also see safeIdentifier() from @bufbuild/protoplugin.
106
+ */
107
+ export function safeObjectProperty(name) {
108
+ return reservedObjectProperties.has(name) ? name + "$" : name;
109
+ }