-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: output-encode-only methods (#787)
* feat: allow to export only encode or decode methods * feat: added encodeonly mode to encodemethods * feat: changed option to encode-only * feat: changed outputencodemethods parameters * feat: solved PR discussions * feat: set nestjs === false for encode-only --------- Co-authored-by: frabat <a206719283@sptgjzhy633.tfayd.com> Co-authored-by: 206719283 <a206719283@nuuunif3jdqn3.tfayd.com> Co-authored-by: Frabat <battisfa.francesco3@gmail.com>
- Loading branch information
1 parent
733dea9
commit 3594410
Showing
18 changed files
with
843 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
message Encode { | ||
string encode = 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable */ | ||
import * as _m0 from "protobufjs/minimal"; | ||
|
||
export const protobufPackage = ""; | ||
|
||
export interface Encode { | ||
encode: string; | ||
} | ||
|
||
function createBaseEncode(): Encode { | ||
return { encode: "" }; | ||
} | ||
|
||
export const Encode = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): Encode { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseEncode(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.encode = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; |
344 changes: 344 additions & 0 deletions
344
integration/output-decode-only/google/protobuf/wrappers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,344 @@ | ||
/* eslint-disable */ | ||
import * as Long from "long"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
|
||
export const protobufPackage = "google.protobuf"; | ||
|
||
/** | ||
* Wrapper message for `double`. | ||
* | ||
* The JSON representation for `DoubleValue` is JSON number. | ||
*/ | ||
export interface DoubleValue { | ||
/** The double value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `float`. | ||
* | ||
* The JSON representation for `FloatValue` is JSON number. | ||
*/ | ||
export interface FloatValue { | ||
/** The float value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `int64`. | ||
* | ||
* The JSON representation for `Int64Value` is JSON string. | ||
*/ | ||
export interface Int64Value { | ||
/** The int64 value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `uint64`. | ||
* | ||
* The JSON representation for `UInt64Value` is JSON string. | ||
*/ | ||
export interface UInt64Value { | ||
/** The uint64 value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `int32`. | ||
* | ||
* The JSON representation for `Int32Value` is JSON number. | ||
*/ | ||
export interface Int32Value { | ||
/** The int32 value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `uint32`. | ||
* | ||
* The JSON representation for `UInt32Value` is JSON number. | ||
*/ | ||
export interface UInt32Value { | ||
/** The uint32 value. */ | ||
value: number; | ||
} | ||
|
||
/** | ||
* Wrapper message for `bool`. | ||
* | ||
* The JSON representation for `BoolValue` is JSON `true` and `false`. | ||
*/ | ||
export interface BoolValue { | ||
/** The bool value. */ | ||
value: boolean; | ||
} | ||
|
||
/** | ||
* Wrapper message for `string`. | ||
* | ||
* The JSON representation for `StringValue` is JSON string. | ||
*/ | ||
export interface StringValue { | ||
/** The string value. */ | ||
value: string; | ||
} | ||
|
||
/** | ||
* Wrapper message for `bytes`. | ||
* | ||
* The JSON representation for `BytesValue` is JSON string. | ||
*/ | ||
export interface BytesValue { | ||
/** The bytes value. */ | ||
value: Uint8Array; | ||
} | ||
|
||
function createBaseDoubleValue(): DoubleValue { | ||
return { value: 0 }; | ||
} | ||
|
||
export const DoubleValue = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): DoubleValue { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseDoubleValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.double(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseFloatValue(): FloatValue { | ||
return { value: 0 }; | ||
} | ||
|
||
export const FloatValue = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): FloatValue { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseFloatValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.float(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseInt64Value(): Int64Value { | ||
return { value: 0 }; | ||
} | ||
|
||
export const Int64Value = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): Int64Value { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseInt64Value(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = longToNumber(reader.int64() as Long); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseUInt64Value(): UInt64Value { | ||
return { value: 0 }; | ||
} | ||
|
||
export const UInt64Value = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): UInt64Value { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseUInt64Value(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = longToNumber(reader.uint64() as Long); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseInt32Value(): Int32Value { | ||
return { value: 0 }; | ||
} | ||
|
||
export const Int32Value = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): Int32Value { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseInt32Value(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.int32(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseUInt32Value(): UInt32Value { | ||
return { value: 0 }; | ||
} | ||
|
||
export const UInt32Value = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): UInt32Value { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseUInt32Value(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.uint32(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseBoolValue(): BoolValue { | ||
return { value: false }; | ||
} | ||
|
||
export const BoolValue = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): BoolValue { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseBoolValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.bool(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseStringValue(): StringValue { | ||
return { value: "" }; | ||
} | ||
|
||
export const StringValue = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): StringValue { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseStringValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseBytesValue(): BytesValue { | ||
return { value: new Uint8Array() }; | ||
} | ||
|
||
export const BytesValue = { | ||
decode(input: _m0.Reader | Uint8Array, length?: number): BytesValue { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseBytesValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.value = reader.bytes(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
}; | ||
|
||
declare var self: any | undefined; | ||
declare var window: any | undefined; | ||
declare var global: any | undefined; | ||
var tsProtoGlobalThis: any = (() => { | ||
if (typeof globalThis !== "undefined") { | ||
return globalThis; | ||
} | ||
if (typeof self !== "undefined") { | ||
return self; | ||
} | ||
if (typeof window !== "undefined") { | ||
return window; | ||
} | ||
if (typeof global !== "undefined") { | ||
return global; | ||
} | ||
throw "Unable to locate global object"; | ||
})(); | ||
|
||
function longToNumber(long: Long): number { | ||
if (long.gt(Number.MAX_SAFE_INTEGER)) { | ||
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); | ||
} | ||
return long.toNumber(); | ||
} | ||
|
||
// If you get a compile-error about 'Constructor<Long> and ... have no overlap', | ||
// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. | ||
if (_m0.util.Long !== Long) { | ||
_m0.util.Long = Long as any; | ||
_m0.configure(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
outputEncodeMethods=decode-only,outputPartialMethods=false,outputJsonMethods=false,nestJs=false |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
message Encode { | ||
string encode = 1; | ||
} | ||
|
Oops, something went wrong.