ts-proto 2.2.1 → 2.2.2

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.
@@ -59,7 +59,7 @@ function generateDecoder(ctx, typeName) {
59
59
  }
60
60
  let TypeValue;
61
61
  if (name == "Timestamp") {
62
- TypeValue = (0, utils_1.impProto)(ctx.options, "google/protobuf/timestamp", name);
62
+ TypeValue = (0, utils_1.impProto)(ctx.options, "google/protobuf/timestamp", options.typePrefix + name + options.typeSuffix);
63
63
  const decoder = (0, ts_poet_1.code) `${TypeValue}.decode(value)`;
64
64
  if (ctx.options.useDate === options_1.DateOption.DATE ||
65
65
  ctx.options.useDate === options_1.DateOption.STRING ||
package/build/src/main.js CHANGED
@@ -636,7 +636,7 @@ function makeObjectIdMethods() {
636
636
  return { fromJsonObjectId, fromProtoObjectId, toProtoObjectId };
637
637
  }
638
638
  function makeTimestampMethods(options, longs, bytes) {
639
- const Timestamp = (0, utils_1.impProto)(options, "google/protobuf/timestamp", "Timestamp");
639
+ const Timestamp = (0, utils_1.impProto)(options, "google/protobuf/timestamp", `${options.typePrefix}Timestamp${options.typeSuffix}`);
640
640
  const NanoDate = (0, ts_poet_1.imp)("NanoDate=nano-date");
641
641
  let seconds = "Math.trunc(date.getTime() / 1_000)";
642
642
  let toNumberCode = "t.seconds";
@@ -726,12 +726,12 @@ function makeTimestampMethods(options, longs, bytes) {
726
726
  } else if (typeof o === "string") {
727
727
  return new ${bytes.globalThis}.Date(o);
728
728
  } else {
729
- return ${fromTimestamp}(Timestamp.fromJSON(o));
729
+ return ${fromTimestamp}(${options.typePrefix}Timestamp${options.typeSuffix}.fromJSON(o));
730
730
  }
731
731
  }
732
732
  `
733
733
  : (0, ts_poet_1.code) `
734
- function fromJsonTimestamp(o: any): Timestamp {
734
+ function fromJsonTimestamp(o: any): ${options.typePrefix}Timestamp${options.typeSuffix} {
735
735
  if (o instanceof ${bytes.globalThis}.Date) {
736
736
  return ${toTimestamp}(o);
737
737
  } else if (typeof o === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "",
5
5
  "main": "build/src/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",