@bufbuild/protobuf 1.3.1 → 1.3.3

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 (117) hide show
  1. package/dist/cjs/google/protobuf/struct_pb.js +1 -1
  2. package/dist/cjs/google/protobuf/type_pb.js +1 -1
  3. package/dist/esm/binary-encoding.d.ts +421 -0
  4. package/dist/esm/binary-format.d.ts +87 -0
  5. package/dist/esm/codegen-info.d.ts +23 -0
  6. package/dist/esm/create-descriptor-set.d.ts +16 -0
  7. package/dist/esm/create-registry-from-desc.d.ts +15 -0
  8. package/dist/esm/create-registry.d.ts +8 -0
  9. package/dist/esm/descriptor-set.d.ts +606 -0
  10. package/dist/esm/enum.d.ts +35 -0
  11. package/dist/esm/field-list.d.ts +27 -0
  12. package/dist/esm/field.d.ts +255 -0
  13. package/dist/esm/google/protobuf/any_pb.d.ts +156 -0
  14. package/dist/esm/google/protobuf/api_pb.d.ts +256 -0
  15. package/dist/esm/google/protobuf/compiler/plugin_pb.d.ts +236 -0
  16. package/dist/esm/google/protobuf/descriptor_pb.d.ts +1851 -0
  17. package/dist/esm/google/protobuf/duration_pb.d.ts +100 -0
  18. package/dist/esm/google/protobuf/empty_pb.d.ts +28 -0
  19. package/dist/esm/google/protobuf/field_mask_pb.d.ts +227 -0
  20. package/dist/esm/google/protobuf/source_context_pb.d.ts +29 -0
  21. package/dist/esm/google/protobuf/struct_pb.d.ts +158 -0
  22. package/dist/esm/google/protobuf/struct_pb.js +1 -1
  23. package/dist/esm/google/protobuf/timestamp_pb.d.ts +132 -0
  24. package/dist/esm/google/protobuf/type_pb.d.ts +437 -0
  25. package/dist/esm/google/protobuf/type_pb.js +1 -1
  26. package/dist/esm/google/protobuf/wrappers_pb.d.ts +267 -0
  27. package/dist/esm/google/varint.d.ts +70 -0
  28. package/dist/esm/index.d.ts +38 -0
  29. package/dist/esm/json-format.d.ts +110 -0
  30. package/dist/esm/message-type.d.ts +51 -0
  31. package/dist/esm/message.d.ts +130 -0
  32. package/dist/esm/private/assert.d.ts +16 -0
  33. package/dist/esm/private/binary-format-common.d.ts +13 -0
  34. package/dist/esm/private/binary-format-proto2.d.ts +2 -0
  35. package/dist/esm/private/binary-format-proto3.d.ts +2 -0
  36. package/dist/esm/private/enum.d.ts +27 -0
  37. package/dist/esm/private/field-list.d.ts +18 -0
  38. package/dist/esm/private/field-wrapper.d.ts +25 -0
  39. package/dist/esm/private/field.d.ts +15 -0
  40. package/dist/esm/private/json-format-common.d.ts +9 -0
  41. package/dist/esm/private/json-format-proto2.d.ts +2 -0
  42. package/dist/esm/private/json-format-proto3.d.ts +2 -0
  43. package/dist/esm/private/message-type.d.ts +18 -0
  44. package/dist/esm/private/names.d.ts +43 -0
  45. package/dist/esm/private/options-map.d.ts +7 -0
  46. package/dist/esm/private/proto-runtime.d.ts +47 -0
  47. package/dist/esm/private/reify-wkt.d.ts +100 -0
  48. package/dist/esm/private/scalars.d.ts +27 -0
  49. package/dist/esm/private/util-common.d.ts +2 -0
  50. package/dist/esm/private/util.d.ts +38 -0
  51. package/dist/esm/proto-base64.d.ts +18 -0
  52. package/dist/esm/proto-delimited.d.ts +54 -0
  53. package/dist/esm/proto-double.d.ts +5 -0
  54. package/dist/esm/proto-int64.d.ts +95 -0
  55. package/dist/esm/proto2.d.ts +4 -0
  56. package/dist/esm/proto3.d.ts +4 -0
  57. package/dist/esm/service-type.d.ts +96 -0
  58. package/dist/esm/to-plain-message.d.ts +9 -0
  59. package/dist/esm/type-registry.d.ts +30 -0
  60. package/dist/proxy/index.d.ts +1 -0
  61. package/dist/proxy/index.js +1 -0
  62. package/package.json +14 -11
  63. /package/dist/{types → cjs}/binary-encoding.d.ts +0 -0
  64. /package/dist/{types → cjs}/binary-format.d.ts +0 -0
  65. /package/dist/{types → cjs}/codegen-info.d.ts +0 -0
  66. /package/dist/{types → cjs}/create-descriptor-set.d.ts +0 -0
  67. /package/dist/{types → cjs}/create-registry-from-desc.d.ts +0 -0
  68. /package/dist/{types → cjs}/create-registry.d.ts +0 -0
  69. /package/dist/{types → cjs}/descriptor-set.d.ts +0 -0
  70. /package/dist/{types → cjs}/enum.d.ts +0 -0
  71. /package/dist/{types → cjs}/field-list.d.ts +0 -0
  72. /package/dist/{types → cjs}/field.d.ts +0 -0
  73. /package/dist/{types → cjs}/google/protobuf/any_pb.d.ts +0 -0
  74. /package/dist/{types → cjs}/google/protobuf/api_pb.d.ts +0 -0
  75. /package/dist/{types → cjs}/google/protobuf/compiler/plugin_pb.d.ts +0 -0
  76. /package/dist/{types → cjs}/google/protobuf/descriptor_pb.d.ts +0 -0
  77. /package/dist/{types → cjs}/google/protobuf/duration_pb.d.ts +0 -0
  78. /package/dist/{types → cjs}/google/protobuf/empty_pb.d.ts +0 -0
  79. /package/dist/{types → cjs}/google/protobuf/field_mask_pb.d.ts +0 -0
  80. /package/dist/{types → cjs}/google/protobuf/source_context_pb.d.ts +0 -0
  81. /package/dist/{types → cjs}/google/protobuf/struct_pb.d.ts +0 -0
  82. /package/dist/{types → cjs}/google/protobuf/timestamp_pb.d.ts +0 -0
  83. /package/dist/{types → cjs}/google/protobuf/type_pb.d.ts +0 -0
  84. /package/dist/{types → cjs}/google/protobuf/wrappers_pb.d.ts +0 -0
  85. /package/dist/{types → cjs}/google/varint.d.ts +0 -0
  86. /package/dist/{types → cjs}/index.d.ts +0 -0
  87. /package/dist/{types → cjs}/json-format.d.ts +0 -0
  88. /package/dist/{types → cjs}/message-type.d.ts +0 -0
  89. /package/dist/{types → cjs}/message.d.ts +0 -0
  90. /package/dist/{types → cjs}/private/assert.d.ts +0 -0
  91. /package/dist/{types → cjs}/private/binary-format-common.d.ts +0 -0
  92. /package/dist/{types → cjs}/private/binary-format-proto2.d.ts +0 -0
  93. /package/dist/{types → cjs}/private/binary-format-proto3.d.ts +0 -0
  94. /package/dist/{types → cjs}/private/enum.d.ts +0 -0
  95. /package/dist/{types → cjs}/private/field-list.d.ts +0 -0
  96. /package/dist/{types → cjs}/private/field-wrapper.d.ts +0 -0
  97. /package/dist/{types → cjs}/private/field.d.ts +0 -0
  98. /package/dist/{types → cjs}/private/json-format-common.d.ts +0 -0
  99. /package/dist/{types → cjs}/private/json-format-proto2.d.ts +0 -0
  100. /package/dist/{types → cjs}/private/json-format-proto3.d.ts +0 -0
  101. /package/dist/{types → cjs}/private/message-type.d.ts +0 -0
  102. /package/dist/{types → cjs}/private/names.d.ts +0 -0
  103. /package/dist/{types → cjs}/private/options-map.d.ts +0 -0
  104. /package/dist/{types → cjs}/private/proto-runtime.d.ts +0 -0
  105. /package/dist/{types → cjs}/private/reify-wkt.d.ts +0 -0
  106. /package/dist/{types → cjs}/private/scalars.d.ts +0 -0
  107. /package/dist/{types → cjs}/private/util-common.d.ts +0 -0
  108. /package/dist/{types → cjs}/private/util.d.ts +0 -0
  109. /package/dist/{types → cjs}/proto-base64.d.ts +0 -0
  110. /package/dist/{types → cjs}/proto-delimited.d.ts +0 -0
  111. /package/dist/{types → cjs}/proto-double.d.ts +0 -0
  112. /package/dist/{types → cjs}/proto-int64.d.ts +0 -0
  113. /package/dist/{types → cjs}/proto2.d.ts +0 -0
  114. /package/dist/{types → cjs}/proto3.d.ts +0 -0
  115. /package/dist/{types → cjs}/service-type.d.ts +0 -0
  116. /package/dist/{types → cjs}/to-plain-message.d.ts +0 -0
  117. /package/dist/{types → cjs}/type-registry.d.ts +0 -0
@@ -0,0 +1,96 @@
1
+ import type { AnyMessage, Message } from "./message.js";
2
+ import type { MessageType } from "./message-type.js";
3
+ /**
4
+ * ServiceType represents a protobuf services. It provides metadata for
5
+ * reflection-based operations.
6
+ */
7
+ export interface ServiceType {
8
+ /**
9
+ * The fully qualified name of the service.
10
+ */
11
+ readonly typeName: string;
12
+ /**
13
+ * A map of local name (safe to use in ECMAScript) to method.
14
+ */
15
+ readonly methods: {
16
+ [localName: string]: MethodInfo;
17
+ };
18
+ }
19
+ /**
20
+ * MethodInfo represents a method of a protobuf service, a remote procedure
21
+ * call. All methods provide the following properties:
22
+ *
23
+ * - "name": The original name of the protobuf rpc.
24
+ * - "I": The input message type.
25
+ * - "O": The output message type.
26
+ * - "kind": The method type.
27
+ * - "idempotency": User-provided indication whether the method will cause
28
+ * the same effect every time it is called.
29
+ */
30
+ export type MethodInfo<I extends Message<I> = AnyMessage, O extends Message<O> = AnyMessage> = MethodInfoUnary<I, O> | MethodInfoServerStreaming<I, O> | MethodInfoClientStreaming<I, O> | MethodInfoBiDiStreaming<I, O>;
31
+ /**
32
+ * A unary method: rpc (Input) returns (Output)
33
+ */
34
+ export interface MethodInfoUnary<I extends Message<I>, O extends Message<O>> extends miShared<I, O> {
35
+ readonly kind: MethodKind.Unary;
36
+ }
37
+ /**
38
+ * A server streaming method: rpc (Input) returns (stream Output)
39
+ */
40
+ export interface MethodInfoServerStreaming<I extends Message<I>, O extends Message<O>> extends miShared<I, O> {
41
+ readonly kind: MethodKind.ServerStreaming;
42
+ }
43
+ /**
44
+ * A client streaming method: rpc (stream Input) returns (Output)
45
+ */
46
+ export interface MethodInfoClientStreaming<I extends Message<I>, O extends Message<O>> extends miShared<I, O> {
47
+ readonly kind: MethodKind.ClientStreaming;
48
+ }
49
+ /**
50
+ * A method that streams bi-directionally: rpc (stream Input) returns (stream Output)
51
+ */
52
+ export interface MethodInfoBiDiStreaming<I extends Message<I>, O extends Message<O>> extends miShared<I, O> {
53
+ readonly kind: MethodKind.BiDiStreaming;
54
+ }
55
+ interface miShared<I extends Message<I> = AnyMessage, O extends Message<O> = AnyMessage> {
56
+ readonly name: string;
57
+ readonly I: MessageType<I>;
58
+ readonly O: MessageType<O>;
59
+ readonly idempotency?: MethodIdempotency;
60
+ }
61
+ /**
62
+ * MethodKind represents the four method types that can be declared in
63
+ * protobuf with the `stream` keyword:
64
+ *
65
+ * 1. Unary: rpc (Input) returns (Output)
66
+ * 2. ServerStreaming: rpc (Input) returns (stream Output)
67
+ * 3. ClientStreaming: rpc (stream Input) returns (Output)
68
+ * 4. BiDiStreaming: rpc (stream Input) returns (stream Output)
69
+ */
70
+ export declare enum MethodKind {
71
+ Unary = 0,
72
+ ServerStreaming = 1,
73
+ ClientStreaming = 2,
74
+ BiDiStreaming = 3
75
+ }
76
+ /**
77
+ * Is this method side-effect-free (or safe in HTTP parlance), or just
78
+ * idempotent, or neither? HTTP based RPC implementation may choose GET verb
79
+ * for safe methods, and PUT verb for idempotent methods instead of the
80
+ * default POST.
81
+ *
82
+ * This enum matches the protobuf enum google.protobuf.MethodOptions.IdempotencyLevel,
83
+ * defined in the well-known type google/protobuf/descriptor.proto, but
84
+ * drops UNKNOWN.
85
+ */
86
+ export declare enum MethodIdempotency {
87
+ /**
88
+ * Idempotent, no side effects.
89
+ */
90
+ NoSideEffects = 1,
91
+ /**
92
+ * Idempotent, but may have side effects.
93
+ */
94
+ Idempotent = 2
95
+ }
96
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Message } from "./message.js";
2
+ import type { PlainMessage } from "./message.js";
3
+ /**
4
+ * toPlainMessage returns a new object by striping
5
+ * all methods from a message, leaving only fields and
6
+ * oneof groups. It is recursive, meaning it applies this
7
+ * same logic to all nested message fields as well.
8
+ */
9
+ export declare function toPlainMessage<T extends Message<T>>(message: T): PlainMessage<T>;
@@ -0,0 +1,30 @@
1
+ import type { MessageType } from "./message-type.js";
2
+ import type { EnumType } from "./enum.js";
3
+ import type { ServiceType } from "./service-type.js";
4
+ /**
5
+ * IMessageTypeRegistry provides look-up for message types.
6
+ */
7
+ export interface IMessageTypeRegistry {
8
+ /**
9
+ * Find a message type by its protobuf type name.
10
+ */
11
+ findMessage(typeName: string): MessageType | undefined;
12
+ }
13
+ /**
14
+ * IEnumTypeRegistry provides look-up for enum types.
15
+ */
16
+ export interface IEnumTypeRegistry {
17
+ /**
18
+ * Find an enum type by its protobuf type name.
19
+ */
20
+ findEnum(typeName: string): EnumType | undefined;
21
+ }
22
+ /**
23
+ * IServiceTypeRegistry provides look-up for service types.
24
+ */
25
+ export interface IServiceTypeRegistry {
26
+ /**
27
+ * Find a service type by its protobuf type name.
28
+ */
29
+ findService(typeName: string): ServiceType | undefined;
30
+ }
@@ -0,0 +1 @@
1
+ export * from "../cjs/index.js";
@@ -0,0 +1 @@
1
+ export * from "../cjs/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "license": "(Apache-2.0 AND BSD-3-Clause)",
5
5
  "description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",
6
6
  "repository": {
@@ -8,20 +8,23 @@
8
8
  "url": "https://github.com/bufbuild/protobuf-es.git",
9
9
  "directory": "packages/protobuf"
10
10
  },
11
- "sideEffects": false,
12
11
  "scripts": {
13
- "clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
14
- "build": "npm run build:cjs && npm run build:esm+types",
15
- "build:cjs": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
16
- "build:esm+types": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
12
+ "clean": "rm -rf ./dist/*",
13
+ "build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
14
+ "build:cjs": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
15
+ "build:esm": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
16
+ "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
17
+ "attw": "attw --pack"
17
18
  },
18
- "main": "./dist/cjs/index.js",
19
19
  "type": "module",
20
- "types": "./dist/types/index.d.ts",
20
+ "sideEffects": false,
21
+ "main": "./dist/cjs/index.js",
21
22
  "exports": {
22
- "import": "./dist/esm/index.js",
23
- "require": "./dist/cjs/index.js",
24
- "types": "./dist/types/index.d.ts"
23
+ ".": {
24
+ "module": "./dist/esm/index.js",
25
+ "require": "./dist/cjs/index.js",
26
+ "import": "./dist/proxy/index.js"
27
+ }
25
28
  },
26
29
  "files": [
27
30
  "dist/**"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes