Skip to content

Commit

Permalink
Merge branch 'stephenh:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Frabat committed Aug 23, 2023
2 parents cdb2adc + be5c22e commit 613b28a
Show file tree
Hide file tree
Showing 181 changed files with 1,545 additions and 1,143 deletions.
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 120
}
"printWidth": 120,
"trailingComma": "all"
}
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
## [1.156.7](https://github.com/stephenh/ts-proto/compare/v1.156.6...v1.156.7) (2023-08-18)


### Bug Fixes

* always use Map for int64 keys ([#708](https://github.com/stephenh/ts-proto/issues/708)) ([#905](https://github.com/stephenh/ts-proto/issues/905)) ([cf2fb59](https://github.com/stephenh/ts-proto/commit/cf2fb59de20f8a60ead23294439dacbdbe6dfc14))

## [1.156.6](https://github.com/stephenh/ts-proto/compare/v1.156.5...v1.156.6) (2023-08-16)


### Bug Fixes

* use correct imports for optional fields ([#904](https://github.com/stephenh/ts-proto/issues/904)) ([fa13ec7](https://github.com/stephenh/ts-proto/commit/fa13ec752c6564af045081548f5fc5cabb687151))

## [1.156.5](https://github.com/stephenh/ts-proto/compare/v1.156.4...v1.156.5) (2023-08-15)


### Bug Fixes

* remove-enum-prefix for nested enums ([#903](https://github.com/stephenh/ts-proto/issues/903)) ([efdbf47](https://github.com/stephenh/ts-proto/commit/efdbf476b26c49c1bc56f9404f49667f2acc1f8b))

## [1.156.4](https://github.com/stephenh/ts-proto/compare/v1.156.3...v1.156.4) (2023-08-15)


### Bug Fixes

* enum default value when remove-enum-prefix and string-enum both on ([#902](https://github.com/stephenh/ts-proto/issues/902)) ([594b137](https://github.com/stephenh/ts-proto/commit/594b137cdffbf6256b9d0ee6bb82822ce22c7b94))

## [1.156.3](https://github.com/stephenh/ts-proto/compare/v1.156.2...v1.156.3) (2023-08-13)


### Bug Fixes

* Only check file dependencies once/file. ([#901](https://github.com/stephenh/ts-proto/issues/901)) ([8d61980](https://github.com/stephenh/ts-proto/commit/8d6198020a5ec775b0dbaf7e08924f4bdcc677f8)), closes [#900](https://github.com/stephenh/ts-proto/issues/900)

## [1.156.2](https://github.com/stephenh/ts-proto/compare/v1.156.1...v1.156.2) (2023-07-29)


### Bug Fixes

* Add 'as any' in create ([#895](https://github.com/stephenh/ts-proto/issues/895)) ([4214d5a](https://github.com/stephenh/ts-proto/commit/4214d5af98817f317760298b1b2e03a8e956329c)), closes [#838](https://github.com/stephenh/ts-proto/issues/838)

## [1.156.1](https://github.com/stephenh/ts-proto/compare/v1.156.0...v1.156.1) (2023-07-22)


### Bug Fixes

* Depend specifically on long 5.2.3. ([#892](https://github.com/stephenh/ts-proto/issues/892)) ([2b976f2](https://github.com/stephenh/ts-proto/commit/2b976f295fc1fbab6d0fb5ad86cfad26ed722c8a))

# [1.156.0](https://github.com/stephenh/ts-proto/compare/v1.155.1...v1.156.0) (2023-07-20)


### Features

* **ts-proto-#859:** added encode-only options to toJSON methods ([#886](https://github.com/stephenh/ts-proto/issues/886)) ([d0cf57d](https://github.com/stephenh/ts-proto/commit/d0cf57d9a1aebdec3bec67585658362b1a38d6a3)), closes [ts-proto-#859](https://github.com/ts-proto-/issues/859) [ts-proto-#859](https://github.com/ts-proto-/issues/859) [ts-proto#859](https://github.com/ts-proto/issues/859) [ts-proto#859](https://github.com/ts-proto/issues/859) [ts-proto-#859](https://github.com/ts-proto-/issues/859)

## [1.155.1](https://github.com/stephenh/ts-proto/compare/v1.155.0...v1.155.1) (2023-07-15)


Expand Down
3 changes: 1 addition & 2 deletions integration/angular/simple-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ export const SimpleMessage = {
},

create<I extends Exact<DeepPartial<SimpleMessage>, I>>(base?: I): SimpleMessage {
return SimpleMessage.fromPartial(base ?? {});
return SimpleMessage.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<SimpleMessage>, I>>(object: I): SimpleMessage {
const message = createBaseSimpleMessage();
message.numberField = object.numberField ?? 0;
Expand Down
3 changes: 1 addition & 2 deletions integration/async-iterable-services-abort-signal/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ export const EchoMsg = {
},

create<I extends Exact<DeepPartial<EchoMsg>, I>>(base?: I): EchoMsg {
return EchoMsg.fromPartial(base ?? {});
return EchoMsg.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<EchoMsg>, I>>(object: I): EchoMsg {
const message = createBaseEchoMsg();
message.body = object.body ?? "";
Expand Down
3 changes: 1 addition & 2 deletions integration/async-iterable-services/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ export const EchoMsg = {
},

create<I extends Exact<DeepPartial<EchoMsg>, I>>(base?: I): EchoMsg {
return EchoMsg.fromPartial(base ?? {});
return EchoMsg.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<EchoMsg>, I>>(object: I): EchoMsg {
const message = createBaseEchoMsg();
message.body = object.body ?? "";
Expand Down
Binary file modified integration/avoid-import-conflicts/simple.bin
Binary file not shown.
5 changes: 5 additions & 0 deletions integration/avoid-import-conflicts/simple.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ message Simple {
simple2.Simple otherSimple = 2;
}

message DifferentSimple {
string name = 1;
optional simple2.Simple otherOptionalSimple2 = 2;
}

message SimpleEnums {
SimpleEnum local_enum = 1;
simple2.SimpleEnum import_enum = 2;
Expand Down
95 changes: 87 additions & 8 deletions integration/avoid-import-conflicts/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export interface Simple {
otherSimple: Simple3 | undefined;
}

export interface DifferentSimple {
name: string;
otherOptionalSimple2?: Simple3 | undefined;
}

export interface SimpleEnums {
localEnum: SimpleEnum;
importEnum: SimpleEnum1;
Expand Down Expand Up @@ -133,9 +138,8 @@ export const Simple = {
},

create<I extends Exact<DeepPartial<Simple>, I>>(base?: I): Simple {
return Simple.fromPartial(base ?? {});
return Simple.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<Simple>, I>>(object: I): Simple {
const message = createBaseSimple();
message.name = object.name ?? "";
Expand All @@ -146,6 +150,84 @@ export const Simple = {
},
};

function createBaseDifferentSimple(): DifferentSimple {
return { name: "", otherOptionalSimple2: undefined };
}

export const DifferentSimple = {
encode(message: DifferentSimple, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.otherOptionalSimple2 !== undefined) {
Simple3.encode(message.otherOptionalSimple2, writer.uint32(18).fork()).ldelim();
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): DifferentSimple {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDifferentSimple();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}

message.otherOptionalSimple2 = Simple3.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): DifferentSimple {
return {
name: isSet(object.name) ? String(object.name) : "",
otherOptionalSimple2: isSet(object.otherOptionalSimple2)
? Simple3.fromJSON(object.otherOptionalSimple2)
: undefined,
};
},

toJSON(message: DifferentSimple): unknown {
const obj: any = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.otherOptionalSimple2 !== undefined) {
obj.otherOptionalSimple2 = Simple3.toJSON(message.otherOptionalSimple2);
}
return obj;
},

create<I extends Exact<DeepPartial<DifferentSimple>, I>>(base?: I): DifferentSimple {
return DifferentSimple.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<DifferentSimple>, I>>(object: I): DifferentSimple {
const message = createBaseDifferentSimple();
message.name = object.name ?? "";
message.otherOptionalSimple2 = (object.otherOptionalSimple2 !== undefined && object.otherOptionalSimple2 !== null)
? Simple3.fromPartial(object.otherOptionalSimple2)
: undefined;
return message;
},
};

function createBaseSimpleEnums(): SimpleEnums {
return { localEnum: 0, importEnum: 0 };
}
Expand Down Expand Up @@ -210,9 +292,8 @@ export const SimpleEnums = {
},

create<I extends Exact<DeepPartial<SimpleEnums>, I>>(base?: I): SimpleEnums {
return SimpleEnums.fromPartial(base ?? {});
return SimpleEnums.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<SimpleEnums>, I>>(object: I): SimpleEnums {
const message = createBaseSimpleEnums();
message.localEnum = object.localEnum ?? 0;
Expand Down Expand Up @@ -269,9 +350,8 @@ export const FooServiceCreateRequest = {
},

create<I extends Exact<DeepPartial<FooServiceCreateRequest>, I>>(base?: I): FooServiceCreateRequest {
return FooServiceCreateRequest.fromPartial(base ?? {});
return FooServiceCreateRequest.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<FooServiceCreateRequest>, I>>(object: I): FooServiceCreateRequest {
const message = createBaseFooServiceCreateRequest();
message.kind = object.kind ?? 0;
Expand Down Expand Up @@ -327,9 +407,8 @@ export const FooServiceCreateResponse = {
},

create<I extends Exact<DeepPartial<FooServiceCreateResponse>, I>>(base?: I): FooServiceCreateResponse {
return FooServiceCreateResponse.fromPartial(base ?? {});
return FooServiceCreateResponse.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<FooServiceCreateResponse>, I>>(object: I): FooServiceCreateResponse {
const message = createBaseFooServiceCreateResponse();
message.kind = object.kind ?? 0;
Expand Down
3 changes: 1 addition & 2 deletions integration/avoid-import-conflicts/simple2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ export const Simple = {
},

create<I extends Exact<DeepPartial<Simple>, I>>(base?: I): Simple {
return Simple.fromPartial(base ?? {});
return Simple.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<Simple>, I>>(object: I): Simple {
const message = createBaseSimple();
message.name = object.name ?? "";
Expand Down
3 changes: 1 addition & 2 deletions integration/barrel-imports/bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ export const Bar = {
},

create<I extends Exact<DeepPartial<Bar>, I>>(base?: I): Bar {
return Bar.fromPartial(base ?? {});
return Bar.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<Bar>, I>>(object: I): Bar {
const message = createBaseBar();
message.name = object.name ?? "";
Expand Down
3 changes: 1 addition & 2 deletions integration/barrel-imports/foo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ export const Foo = {
},

create<I extends Exact<DeepPartial<Foo>, I>>(base?: I): Foo {
return Foo.fromPartial(base ?? {});
return Foo.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<Foo>, I>>(object: I): Foo {
const message = createBaseFoo();
message.name = object.name ?? "";
Expand Down
30 changes: 10 additions & 20 deletions integration/batching-with-context-esModuleInterop/batching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ export const BatchQueryRequest = {
},

create<I extends Exact<DeepPartial<BatchQueryRequest>, I>>(base?: I): BatchQueryRequest {
return BatchQueryRequest.fromPartial(base ?? {});
return BatchQueryRequest.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<BatchQueryRequest>, I>>(object: I): BatchQueryRequest {
const message = createBaseBatchQueryRequest();
message.ids = object.ids?.map((e) => e) || [];
Expand Down Expand Up @@ -152,9 +151,8 @@ export const BatchQueryResponse = {
},

create<I extends Exact<DeepPartial<BatchQueryResponse>, I>>(base?: I): BatchQueryResponse {
return BatchQueryResponse.fromPartial(base ?? {});
return BatchQueryResponse.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<BatchQueryResponse>, I>>(object: I): BatchQueryResponse {
const message = createBaseBatchQueryResponse();
message.entities = object.entities?.map((e) => Entity.fromPartial(e)) || [];
Expand Down Expand Up @@ -210,9 +208,8 @@ export const BatchMapQueryRequest = {
},

create<I extends Exact<DeepPartial<BatchMapQueryRequest>, I>>(base?: I): BatchMapQueryRequest {
return BatchMapQueryRequest.fromPartial(base ?? {});
return BatchMapQueryRequest.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<BatchMapQueryRequest>, I>>(object: I): BatchMapQueryRequest {
const message = createBaseBatchMapQueryRequest();
message.ids = object.ids?.map((e) => e) || [];
Expand Down Expand Up @@ -284,9 +281,8 @@ export const BatchMapQueryResponse = {
},

create<I extends Exact<DeepPartial<BatchMapQueryResponse>, I>>(base?: I): BatchMapQueryResponse {
return BatchMapQueryResponse.fromPartial(base ?? {});
return BatchMapQueryResponse.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<BatchMapQueryResponse>, I>>(object: I): BatchMapQueryResponse {
const message = createBaseBatchMapQueryResponse();
message.entities = Object.entries(object.entities ?? {}).reduce<{ [key: string]: Entity }>((acc, [key, value]) => {
Expand Down Expand Up @@ -365,9 +361,8 @@ export const BatchMapQueryResponse_EntitiesEntry = {
create<I extends Exact<DeepPartial<BatchMapQueryResponse_EntitiesEntry>, I>>(
base?: I,
): BatchMapQueryResponse_EntitiesEntry {
return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? {});
return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<BatchMapQueryResponse_EntitiesEntry>, I>>(
object: I,
): BatchMapQueryResponse_EntitiesEntry {
Expand Down Expand Up @@ -428,9 +423,8 @@ export const GetOnlyMethodRequest = {
},

create<I extends Exact<DeepPartial<GetOnlyMethodRequest>, I>>(base?: I): GetOnlyMethodRequest {
return GetOnlyMethodRequest.fromPartial(base ?? {});
return GetOnlyMethodRequest.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<GetOnlyMethodRequest>, I>>(object: I): GetOnlyMethodRequest {
const message = createBaseGetOnlyMethodRequest();
message.id = object.id ?? "";
Expand Down Expand Up @@ -486,9 +480,8 @@ export const GetOnlyMethodResponse = {
},

create<I extends Exact<DeepPartial<GetOnlyMethodResponse>, I>>(base?: I): GetOnlyMethodResponse {
return GetOnlyMethodResponse.fromPartial(base ?? {});
return GetOnlyMethodResponse.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<GetOnlyMethodResponse>, I>>(object: I): GetOnlyMethodResponse {
const message = createBaseGetOnlyMethodResponse();
message.entity = (object.entity !== undefined && object.entity !== null)
Expand Down Expand Up @@ -546,9 +539,8 @@ export const WriteMethodRequest = {
},

create<I extends Exact<DeepPartial<WriteMethodRequest>, I>>(base?: I): WriteMethodRequest {
return WriteMethodRequest.fromPartial(base ?? {});
return WriteMethodRequest.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<WriteMethodRequest>, I>>(object: I): WriteMethodRequest {
const message = createBaseWriteMethodRequest();
message.id = object.id ?? "";
Expand Down Expand Up @@ -591,9 +583,8 @@ export const WriteMethodResponse = {
},

create<I extends Exact<DeepPartial<WriteMethodResponse>, I>>(base?: I): WriteMethodResponse {
return WriteMethodResponse.fromPartial(base ?? {});
return WriteMethodResponse.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<WriteMethodResponse>, I>>(_: I): WriteMethodResponse {
const message = createBaseWriteMethodResponse();
return message;
Expand Down Expand Up @@ -661,9 +652,8 @@ export const Entity = {
},

create<I extends Exact<DeepPartial<Entity>, I>>(base?: I): Entity {
return Entity.fromPartial(base ?? {});
return Entity.fromPartial(base ?? ({} as any));
},

fromPartial<I extends Exact<DeepPartial<Entity>, I>>(object: I): Entity {
const message = createBaseEntity();
message.id = object.id ?? "";
Expand Down
Loading

0 comments on commit 613b28a

Please sign in to comment.