Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-proto

Package Overview
Dependencies
Maintainers
1
Versions
359
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-proto - npm Package Compare versions

Comparing version 1.18.0 to 1.18.1

31

build/main.js

@@ -84,3 +84,3 @@ "use strict";

}, options);
if (hasAnyTimestamps && options.outputJsonMethods) {
if (hasAnyTimestamps && (options.outputJsonMethods || options.outputEncodeMethods)) {
file = addTimestampMethods(file, options);

@@ -98,4 +98,3 @@ }

}
if (initialOutput.includes('bytesFromBase64') ||
initialOutput.includes('base64FromBytes')) {
if (initialOutput.includes('bytesFromBase64') || initialOutput.includes('base64FromBytes')) {
file = addBytesUtilityMethods(file, options);

@@ -182,2 +181,15 @@ }

}
if (options.outputJsonMethods) {
file = file.addFunction(ts_poet_1.FunctionSpec.create('fromJsonTimestamp')
.addParameter('o', 'any')
.returns('Date')
.addCodeBlock(ts_poet_1.CodeBlock.empty()
.beginControlFlow('if (o instanceof Date)')
.addStatement('return o')
.nextControlFlow('else if (typeof o === "string")')
.addStatement('return new Date(o)')
.nextControlFlow('else')
.addStatement('return fromTimestamp(Timestamp.fromJSON(o))')
.endControlFlow()));
}
return file

@@ -197,14 +209,3 @@ .addFunction(ts_poet_1.FunctionSpec.create('toTimestamp')

.addStatement('millis += t.nanos / 1_000_000')
.addStatement('return new Date(millis)')))
.addFunction(ts_poet_1.FunctionSpec.create('fromJsonTimestamp')
.addParameter('o', 'any')
.returns('Date')
.addCodeBlock(ts_poet_1.CodeBlock.empty()
.beginControlFlow('if (o instanceof Date)')
.addStatement('return o')
.nextControlFlow('else if (typeof o === "string")')
.addStatement('return new Date(o)')
.nextControlFlow('else')
.addStatement('return fromTimestamp(Timestamp.fromJSON(o))')
.endControlFlow()));
.addStatement('return new Date(millis)')));
}

@@ -211,0 +212,0 @@ const UNRECOGNIZED_ENUM_NAME = 'UNRECOGNIZED';

{
"name": "ts-proto",
"version": "1.18.0",
"version": "1.18.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/plugin.js",

@@ -156,3 +156,3 @@ import {

);
if (hasAnyTimestamps && options.outputJsonMethods) {
if (hasAnyTimestamps && (options.outputJsonMethods || options.outputEncodeMethods)) {
file = addTimestampMethods(file, options);

@@ -173,4 +173,3 @@ }

}
if (initialOutput.includes('bytesFromBase64') ||
initialOutput.includes('base64FromBytes')) {
if (initialOutput.includes('bytesFromBase64') || initialOutput.includes('base64FromBytes')) {
file = addBytesUtilityMethods(file, options);

@@ -214,3 +213,4 @@ }

function addBytesUtilityMethods(file: FileSpec, options: Options): FileSpec {
return file.addCode(CodeBlock.of(`interface WindowBase64 {
return file.addCode(
CodeBlock.of(`interface WindowBase64 {
atob(b64: string): string;

@@ -239,3 +239,4 @@ btoa(bin: string): string;

return btoa(bin.join(''));
}`));
}`)
);
}

@@ -272,2 +273,20 @@

if (options.outputJsonMethods) {
file = file.addFunction(
FunctionSpec.create('fromJsonTimestamp')
.addParameter('o', 'any')
.returns('Date')
.addCodeBlock(
CodeBlock.empty()
.beginControlFlow('if (o instanceof Date)')
.addStatement('return o')
.nextControlFlow('else if (typeof o === "string")')
.addStatement('return new Date(o)')
.nextControlFlow('else')
.addStatement('return fromTimestamp(Timestamp.fromJSON(o))')
.endControlFlow()
)
);
}
return file

@@ -295,17 +314,2 @@ .addFunction(

)
)
.addFunction(
FunctionSpec.create('fromJsonTimestamp')
.addParameter('o', 'any')
.returns('Date')
.addCodeBlock(
CodeBlock.empty()
.beginControlFlow('if (o instanceof Date)')
.addStatement('return o')
.nextControlFlow('else if (typeof o === "string")')
.addStatement('return new Date(o)')
.nextControlFlow('else')
.addStatement('return fromTimestamp(Timestamp.fromJSON(o))')
.endControlFlow()
)
);

@@ -827,3 +831,4 @@ }

from,
isWithinOneOf(field) ? 'undefined' : defaultValue(field.type, options));
isWithinOneOf(field) ? 'undefined' : defaultValue(field.type, options)
);
} else if (isLong(field) && options.forceLong === LongOption.LONG) {

@@ -830,0 +835,0 @@ return CodeBlock.of(

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc