@bufbuild/protobuf 1.4.0 → 1.4.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.
@@ -1,17 +1,22 @@
1
- import { localName, safeIdentifier, safeObjectProperty } from "./private/names.js";
2
- import { getUnwrappedFieldType } from "./private/field-wrapper.js";
3
- import { scalarDefaultValue } from "./private/scalars.js";
4
1
  import { reifyWkt } from "./private/reify-wkt.js";
2
+ import type { DescEnum, DescEnumValue, DescField, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set";
3
+ import { LongType, ScalarType } from "./field.js";
5
4
  interface CodegenInfo {
5
+ /**
6
+ * Name of the runtime library NPM package.
7
+ */
6
8
  readonly packageName: string;
7
- readonly localName: typeof localName;
9
+ readonly localName: (desc: DescEnum | DescEnumValue | DescMessage | DescOneof | DescField | DescService | DescMethod) => string;
8
10
  readonly symbols: Record<RuntimeSymbolName, RuntimeSymbolInfo>;
9
- readonly getUnwrappedFieldType: typeof getUnwrappedFieldType;
11
+ readonly getUnwrappedFieldType: (field: DescField) => ScalarType | undefined;
10
12
  readonly wktSourceFiles: readonly string[];
11
- readonly scalarDefaultValue: typeof scalarDefaultValue;
13
+ readonly scalarDefaultValue: (type: ScalarType, longType: LongType) => any;
14
+ /**
15
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
16
+ */
12
17
  readonly reifyWkt: typeof reifyWkt;
13
- readonly safeIdentifier: typeof safeIdentifier;
14
- readonly safeObjectProperty: typeof safeObjectProperty;
18
+ readonly safeIdentifier: (name: string) => string;
19
+ readonly safeObjectProperty: (name: string) => string;
15
20
  }
16
21
  type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "LongType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
17
22
  type RuntimeSymbolInfo = {
@@ -20,7 +20,7 @@ const scalars_js_1 = require("./private/scalars.js");
20
20
  const reify_wkt_js_1 = require("./private/reify-wkt.js");
21
21
  const packageName = "@bufbuild/protobuf";
22
22
  exports.codegenInfo = {
23
- packageName,
23
+ packageName: "@bufbuild/protobuf",
24
24
  localName: names_js_1.localName,
25
25
  reifyWkt: reify_wkt_js_1.reifyWkt,
26
26
  getUnwrappedFieldType: field_wrapper_js_1.getUnwrappedFieldType,
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
17
- // @generated by protoc-gen-es v1.4.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.4.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
17
- // @generated by protoc-gen-es v1.4.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.4.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -1,4 +1,4 @@
1
- import type { JsonValue } from "../json-format";
1
+ import type { JsonValue } from "../json-format.js";
2
2
  /**
3
3
  *
4
4
  */
@@ -86,6 +86,8 @@ type DescWkt = {
86
86
  };
87
87
  };
88
88
  /**
89
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
90
+ *
89
91
  * Reifies a given DescMessage into a more concrete object representing its
90
92
  * respective well-known type. The returned object will contain properties
91
93
  * representing the WKT's defined fields.
@@ -16,6 +16,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.reifyWkt = void 0;
17
17
  const field_js_1 = require("../field.js");
18
18
  /**
19
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
20
+ *
19
21
  * Reifies a given DescMessage into a more concrete object representing its
20
22
  * respective well-known type. The returned object will contain properties
21
23
  * representing the WKT's defined fields.
@@ -3,6 +3,19 @@ import type { EnumType } from "./enum.js";
3
3
  import type { ServiceType } from "./service-type.js";
4
4
  /**
5
5
  * IMessageTypeRegistry provides look-up for message types.
6
+ *
7
+ * You can conveniently create a registry using the createRegistry()
8
+ * function:
9
+ *
10
+ * ```ts
11
+ * import { createRegistry } from "@bufbuild/protobuf";
12
+ * import { MyMessage, MyOtherMessage } from "./gen/my_message_pb.js";
13
+ *
14
+ * const reg: IMessageTypeRegistry = createRegistry(
15
+ * MyMessage,
16
+ * MyOtherMessage,
17
+ * );
18
+ * ```
6
19
  */
7
20
  export interface IMessageTypeRegistry {
8
21
  /**
@@ -1,17 +1,22 @@
1
- import { localName, safeIdentifier, safeObjectProperty } from "./private/names.js";
2
- import { getUnwrappedFieldType } from "./private/field-wrapper.js";
3
- import { scalarDefaultValue } from "./private/scalars.js";
4
1
  import { reifyWkt } from "./private/reify-wkt.js";
2
+ import type { DescEnum, DescEnumValue, DescField, DescMessage, DescMethod, DescOneof, DescService } from "./descriptor-set";
3
+ import { LongType, ScalarType } from "./field.js";
5
4
  interface CodegenInfo {
5
+ /**
6
+ * Name of the runtime library NPM package.
7
+ */
6
8
  readonly packageName: string;
7
- readonly localName: typeof localName;
9
+ readonly localName: (desc: DescEnum | DescEnumValue | DescMessage | DescOneof | DescField | DescService | DescMethod) => string;
8
10
  readonly symbols: Record<RuntimeSymbolName, RuntimeSymbolInfo>;
9
- readonly getUnwrappedFieldType: typeof getUnwrappedFieldType;
11
+ readonly getUnwrappedFieldType: (field: DescField) => ScalarType | undefined;
10
12
  readonly wktSourceFiles: readonly string[];
11
- readonly scalarDefaultValue: typeof scalarDefaultValue;
13
+ readonly scalarDefaultValue: (type: ScalarType, longType: LongType) => any;
14
+ /**
15
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
16
+ */
12
17
  readonly reifyWkt: typeof reifyWkt;
13
- readonly safeIdentifier: typeof safeIdentifier;
14
- readonly safeObjectProperty: typeof safeObjectProperty;
18
+ readonly safeIdentifier: (name: string) => string;
19
+ readonly safeObjectProperty: (name: string) => string;
15
20
  }
16
21
  type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "LongType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
17
22
  type RuntimeSymbolInfo = {
@@ -15,9 +15,10 @@ import { localName, safeIdentifier, safeObjectProperty, } from "./private/names.
15
15
  import { getUnwrappedFieldType } from "./private/field-wrapper.js";
16
16
  import { scalarDefaultValue } from "./private/scalars.js";
17
17
  import { reifyWkt } from "./private/reify-wkt.js";
18
+ import { LongType, ScalarType } from "./field.js";
18
19
  const packageName = "@bufbuild/protobuf";
19
20
  export const codegenInfo = {
20
- packageName,
21
+ packageName: "@bufbuild/protobuf",
21
22
  localName,
22
23
  reifyWkt,
23
24
  getUnwrappedFieldType,
@@ -11,7 +11,7 @@
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- // @generated by protoc-gen-es v1.4.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.4.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
15
15
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
16
16
  /* eslint-disable */
17
17
  import { proto3 } from "../../proto3.js";
@@ -11,7 +11,7 @@
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- // @generated by protoc-gen-es v1.4.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
14
+ // @generated by protoc-gen-es v1.4.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
15
15
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
16
16
  /* eslint-disable */
17
17
  import { proto3 } from "../../proto3.js";
@@ -1,4 +1,4 @@
1
- import type { JsonValue } from "../json-format";
1
+ import type { JsonValue } from "../json-format.js";
2
2
  /**
3
3
  *
4
4
  */
@@ -86,6 +86,8 @@ type DescWkt = {
86
86
  };
87
87
  };
88
88
  /**
89
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
90
+ *
89
91
  * Reifies a given DescMessage into a more concrete object representing its
90
92
  * respective well-known type. The returned object will contain properties
91
93
  * representing the WKT's defined fields.
@@ -13,6 +13,8 @@
13
13
  // limitations under the License.
14
14
  import { ScalarType } from "../field.js";
15
15
  /**
16
+ * @deprecated please use reifyWkt from @bufbuild/protoplugin/ecmascript instead
17
+ *
16
18
  * Reifies a given DescMessage into a more concrete object representing its
17
19
  * respective well-known type. The returned object will contain properties
18
20
  * representing the WKT's defined fields.
@@ -3,6 +3,19 @@ import type { EnumType } from "./enum.js";
3
3
  import type { ServiceType } from "./service-type.js";
4
4
  /**
5
5
  * IMessageTypeRegistry provides look-up for message types.
6
+ *
7
+ * You can conveniently create a registry using the createRegistry()
8
+ * function:
9
+ *
10
+ * ```ts
11
+ * import { createRegistry } from "@bufbuild/protobuf";
12
+ * import { MyMessage, MyOtherMessage } from "./gen/my_message_pb.js";
13
+ *
14
+ * const reg: IMessageTypeRegistry = createRegistry(
15
+ * MyMessage,
16
+ * MyOtherMessage,
17
+ * );
18
+ * ```
6
19
  */
7
20
  export interface IMessageTypeRegistry {
8
21
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
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": {