From a894acafe055f970e55889616fea929004d013fc Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 31 Jul 2023 22:15:43 +0800 Subject: [PATCH 1/9] apply env flag to enum default vaule --- .../output1/akash/base/v1beta1/endpoint.ts | 4 +-- .../output1/akash/base/v1beta2/endpoint.ts | 4 +-- .../output1/akash/cert/v1beta2/cert.ts | 4 +-- .../akash/deployment/v1beta1/deployment.ts | 4 +-- .../output1/akash/deployment/v1beta1/group.ts | 4 +-- .../akash/deployment/v1beta2/deployment.ts | 4 +-- .../output1/akash/deployment/v1beta2/group.ts | 4 +-- .../output1/akash/escrow/v1beta1/types.ts | 8 ++--- .../output1/akash/escrow/v1beta2/types.ts | 8 ++--- .../output1/akash/market/v1beta2/bid.ts | 4 +-- .../output1/akash/market/v1beta2/lease.ts | 4 +-- .../output1/akash/market/v1beta2/order.ts | 4 +-- __fixtures__/output1/confio/proofs.ts | 24 ++++++------- __fixtures__/output1/cosmos/gov/v1/gov.ts | 8 ++--- __fixtures__/output1/cosmos/gov/v1/query.ts | 4 +-- __fixtures__/output1/cosmos/gov/v1/tx.ts | 4 +-- .../output1/cosmos/gov/v1beta1/gov.ts | 12 +++---- .../output1/cosmos/gov/v1beta1/query.ts | 4 +-- __fixtures__/output1/cosmos/gov/v1beta1/tx.ts | 4 +-- .../output1/cosmos/group/v1/events.ts | 4 +-- __fixtures__/output1/cosmos/group/v1/tx.ts | 12 +++---- __fixtures__/output1/cosmos/group/v1/types.ts | 16 ++++----- .../output1/cosmos/orm/v1alpha1/schema.ts | 4 +-- .../output1/cosmos/staking/v1beta1/authz.ts | 4 +-- .../output1/cosmos/staking/v1beta1/staking.ts | 4 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 4 +-- .../output1/cosmos/tx/v1beta1/service.ts | 8 ++--- __fixtures__/output1/cosmos/tx/v1beta1/tx.ts | 8 ++--- .../output1/cosmwasm/wasm/v1/types.ts | 16 ++++----- .../output1/evmos/claims/v1/claims.ts | 4 +-- __fixtures__/output1/evmos/erc20/v1/erc20.ts | 4 +-- __fixtures__/output1/google/api/backend.ts | 4 +-- .../output1/google/api/config_change.ts | 4 +-- __fixtures__/output1/google/api/consumer.ts | 4 +-- .../v1alpha1/conformance_service.ts | 4 +-- __fixtures__/output1/google/api/label.ts | 4 +-- __fixtures__/output1/google/api/metric.ts | 16 ++++----- .../output1/google/api/monitored_resource.ts | 4 +-- __fixtures__/output1/google/api/resource.ts | 4 +-- .../api/servicecontrol/v1/check_error.ts | 4 +-- .../google/api/servicecontrol/v1/log_entry.ts | 4 +-- .../google/api/servicecontrol/v1/operation.ts | 4 +-- .../api/servicecontrol/v1/quota_controller.ts | 8 ++--- .../servicecontrol/v1/service_controller.ts | 4 +-- .../api/servicemanagement/v1/resources.ts | 16 ++++----- .../servicemanagement/v1/servicemanager.ts | 4 +-- .../google/api/serviceusage/v1/resources.ts | 4 +-- .../api/serviceusage/v1/serviceusage.ts | 4 +-- .../api/serviceusage/v1beta1/resources.ts | 4 +-- .../api/serviceusage/v1beta1/serviceusage.ts | 16 ++++----- .../output1/google/logging/v2/log_entry.ts | 4 +-- .../output1/google/logging/v2/logging.ts | 4 +-- .../google/logging/v2/logging_config.ts | 12 +++---- .../google/logging/v2/logging_metrics.ts | 4 +-- __fixtures__/output1/google/protobuf/api.ts | 8 ++--- .../output1/google/protobuf/descriptor.ts | 24 ++++++------- __fixtures__/output1/google/protobuf/type.ts | 16 ++++----- __fixtures__/output1/helpers.ts | 32 ++++++++--------- .../output1/ibc/core/channel/v1/channel.ts | 16 ++++----- .../ibc/core/connection/v1/connection.ts | 8 ++--- .../output1/ibc/core/port/v1/query.ts | 4 +-- .../solomachine/v1/solomachine.ts | 8 ++--- .../solomachine/v2/solomachine.ts | 8 ++--- __fixtures__/output1/index.ts | 2 +- .../output1/osmosis/claim/v1beta1/query.ts | 4 +-- __fixtures__/output1/osmosis/lockup/lock.ts | 4 +-- .../output1/osmosis/superfluid/query.ts | 4 +-- .../output1/osmosis/superfluid/superfluid.ts | 4 +-- __fixtures__/output1/tendermint/abci/types.ts | 16 ++++----- .../output1/tendermint/types/types.ts | 12 +++---- .../output2/akash/base/v1beta1/endpoint.ts | 2 +- .../output2/akash/base/v1beta2/endpoint.ts | 2 +- .../output2/akash/cert/v1beta2/cert.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 2 +- .../output2/akash/deployment/v1beta1/group.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 2 +- .../output2/akash/deployment/v1beta2/group.ts | 2 +- .../output2/akash/escrow/v1beta1/types.ts | 4 +-- .../output2/akash/escrow/v1beta2/types.ts | 4 +-- .../output2/akash/market/v1beta2/bid.ts | 2 +- .../output2/akash/market/v1beta2/lease.ts | 2 +- .../output2/akash/market/v1beta2/order.ts | 2 +- __fixtures__/output2/confio/proofs.ts | 12 +++---- __fixtures__/output2/cosmos/gov/v1/gov.ts | 4 +-- __fixtures__/output2/cosmos/gov/v1/query.ts | 2 +- __fixtures__/output2/cosmos/gov/v1/tx.ts | 2 +- .../output2/cosmos/gov/v1beta1/gov.ts | 6 ++-- .../output2/cosmos/gov/v1beta1/query.ts | 2 +- __fixtures__/output2/cosmos/gov/v1beta1/tx.ts | 2 +- .../output2/cosmos/group/v1/events.ts | 2 +- __fixtures__/output2/cosmos/group/v1/tx.ts | 6 ++-- __fixtures__/output2/cosmos/group/v1/types.ts | 8 ++--- .../output2/cosmos/orm/v1alpha1/schema.ts | 2 +- .../output2/cosmos/staking/v1beta1/authz.ts | 2 +- .../output2/cosmos/staking/v1beta1/staking.ts | 2 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../output2/cosmos/tx/v1beta1/service.ts | 4 +-- __fixtures__/output2/cosmos/tx/v1beta1/tx.ts | 2 +- .../output2/cosmwasm/wasm/v1/types.ts | 8 ++--- .../output2/evmos/claims/v1/claims.ts | 2 +- __fixtures__/output2/evmos/erc20/v1/erc20.ts | 2 +- __fixtures__/output2/google/api/backend.ts | 2 +- .../output2/google/api/config_change.ts | 2 +- __fixtures__/output2/google/api/consumer.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- __fixtures__/output2/google/api/label.ts | 2 +- __fixtures__/output2/google/api/metric.ts | 8 ++--- .../output2/google/api/monitored_resource.ts | 2 +- __fixtures__/output2/google/api/resource.ts | 2 +- .../api/servicecontrol/v1/check_error.ts | 2 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../google/api/servicecontrol/v1/operation.ts | 2 +- .../api/servicecontrol/v1/quota_controller.ts | 4 +-- .../servicecontrol/v1/service_controller.ts | 2 +- .../api/servicemanagement/v1/resources.ts | 8 ++--- .../servicemanagement/v1/servicemanager.ts | 2 +- .../google/api/serviceusage/v1/resources.ts | 2 +- .../api/serviceusage/v1/serviceusage.ts | 2 +- .../api/serviceusage/v1beta1/resources.ts | 2 +- .../api/serviceusage/v1beta1/serviceusage.ts | 8 ++--- .../output2/google/logging/v2/log_entry.ts | 2 +- .../output2/google/logging/v2/logging.ts | 2 +- .../google/logging/v2/logging_config.ts | 6 ++-- .../google/logging/v2/logging_metrics.ts | 2 +- __fixtures__/output2/google/protobuf/api.ts | 4 +-- .../output2/google/protobuf/descriptor.ts | 12 +++---- __fixtures__/output2/google/protobuf/type.ts | 8 ++--- __fixtures__/output2/helpers.ts | 32 ++++++++--------- .../interchain_accounts/v1/packet.ts | 2 +- .../output2/ibc/core/channel/v1/channel.ts | 8 ++--- .../output2/ibc/core/channel/v1/tx.ts | 8 ++--- .../ibc/core/connection/v1/connection.ts | 4 +-- .../solomachine/v1/solomachine.ts | 4 +-- .../output2/osmosis/claim/v1beta1/query.ts | 2 +- __fixtures__/output2/osmosis/lockup/lock.ts | 2 +- .../output2/osmosis/superfluid/query.ts | 2 +- .../output2/osmosis/superfluid/superfluid.ts | 2 +- __fixtures__/output2/tendermint/abci/types.ts | 8 ++--- .../output2/tendermint/types/types.ts | 6 ++-- .../akash/cert/v1beta2/query.pinia.store.ts | 2 +- __fixtures__/v-next/outputosmojs/binary.ts | 22 ++++++------ .../evmos/erc20/v1/query.pinia.store.ts | 6 ++-- __fixtures__/v-next/outputosmojs/helpers.ts | 6 ++-- __fixtures__/v-next/outputosmojs/index.ts | 2 +- .../osmosis/gamm/v1beta1/query.pinia.store.ts | 30 ++++++++-------- .../osmosis/gamm/v2/query.pinia.store.ts | 2 +- __fixtures__/v-next/outputosmojs/varint.ts | 20 +++++------ __fixtures__/v-next/outputv2/helpers.ts | 32 ++++++++--------- __fixtures__/v-next/outputv2/index.ts | 2 +- __fixtures__/v-next/outputv3/grpc-gateway.ts | 24 ++++++------- __fixtures__/v-next/outputv3/helpers.ts | 32 ++++++++--------- __fixtures__/v-next/outputv3/index.ts | 2 +- .../akash/cert/v1beta2/query.pinia.store.ts | 2 +- __fixtures__/v-next/outputv4/binary.ts | 22 ++++++------ .../evmos/erc20/v1/query.pinia.store.ts | 6 ++-- __fixtures__/v-next/outputv4/helpers.ts | 6 ++-- __fixtures__/v-next/outputv4/index.ts | 2 +- .../osmosis/gamm/v1beta1/query.pinia.store.ts | 30 ++++++++-------- .../osmosis/gamm/v2/query.pinia.store.ts | 2 +- __fixtures__/v-next/outputv4/varint.ts | 20 +++++------ .../__snapshots__/object.spec.ts.snap | 12 +++---- .../src/encoding/proto/from-amino/utils.ts | 6 +++- .../ast/src/encoding/proto/from-json/utils.ts | 7 ++-- .../src/encoding/proto/from-sdk-json/utils.ts | 5 ++- .../ast/src/encoding/proto/from-sdk/utils.ts | 7 ++-- .../ast/src/encoding/proto/to-sdk/utils.ts | 2 +- packages/ast/types/src/bundle/bundle.d.ts | 1 - .../ast/types/src/clients/lcd/class/lcd.d.ts | 2 +- .../class/grpc-gateway/grpc-gateway.msg.d.ts | 1 - .../grpc-gateway/grpc-gateway.query.d.ts | 1 - .../rpc/class/grpc-web/grpc-web.msg.d.ts | 1 - .../rpc/class/grpc-web/grpc-web.query.d.ts | 1 - .../src/clients/rpc/class/tendermint/rpc.d.ts | 1 - .../src/clients/rpc/class/utils/rpc.d.ts | 3 +- .../src/clients/rpc/extension/extension.d.ts | 1 - packages/ast/types/src/docs/rpc-clients.d.ts | 2 +- .../src/encoding/amino/converter/index.d.ts | 2 +- .../encoding/amino/from-amino-json/index.d.ts | 2 +- .../encoding/amino/to-amino-json/index.d.ts | 2 +- .../ast/types/src/encoding/amino/utils.d.ts | 36 ++----------------- packages/ast/types/src/encoding/context.d.ts | 8 ++--- packages/ast/types/src/encoding/object.d.ts | 1 - .../src/encoding/proto/decode/index.d.ts | 2 +- .../src/encoding/proto/encode/index.d.ts | 2 +- .../ast/types/src/encoding/proto/enums.d.ts | 1 - .../src/encoding/proto/from-amino/index.d.ts | 2 +- .../src/encoding/proto/from-json/index.d.ts | 2 +- .../encoding/proto/from-partial/index.d.ts | 2 +- .../src/encoding/proto/from-proto/index.d.ts | 1 - .../encoding/proto/from-sdk-json/index.d.ts | 2 +- .../src/encoding/proto/from-sdk/index.d.ts | 2 +- .../encoding/proto/implements/decoder.d.ts | 2 +- .../encoding/proto/implements/from-amino.d.ts | 2 +- .../encoding/proto/implements/to-amino.d.ts | 2 +- .../src/encoding/proto/interface/amino.d.ts | 1 - .../src/encoding/proto/interface/proto.d.ts | 1 - .../src/encoding/proto/interface/sdk.d.ts | 1 - .../types/src/encoding/proto/props/index.d.ts | 1 - .../src/encoding/proto/to-amino/index.d.ts | 2 +- .../src/encoding/proto/to-json/index.d.ts | 2 +- .../src/encoding/proto/to-proto/index.d.ts | 1 - .../src/encoding/proto/to-sdk/index.d.ts | 2 +- .../ast/types/src/encoding/proto/types.d.ts | 5 ++- packages/ast/types/src/encoding/types.d.ts | 5 ++- packages/ast/types/src/plugins/plugins.d.ts | 2 +- packages/ast/types/src/state/mobx/mobx.d.ts | 1 - packages/ast/types/src/state/pinia/pinia.d.ts | 1 - .../src/state/react-query/react-query.d.ts | 1 - 208 files changed, 586 insertions(+), 626 deletions(-) diff --git a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts index cf61d40f2e..1325409735 100644 --- a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts @@ -74,7 +74,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 }; }, toJSON(message: Endpoint): unknown { @@ -89,7 +89,7 @@ export const Endpoint = { }, fromSDK(object: EndpointSDKType): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 }; }, toSDK(message: Endpoint): EndpointSDKType { diff --git a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts index 9b41329e8f..e0b7f13e25 100644 --- a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts @@ -90,7 +90,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, sequenceNumber: isSet(object.sequenceNumber) ? Number(object.sequenceNumber) : 0 }; }, @@ -108,7 +108,7 @@ export const Endpoint = { }, fromSDK(object: EndpointSDKType): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, sequenceNumber: object?.sequence_number }; }, diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.ts index 994c7273b0..932449f469 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.ts @@ -216,7 +216,7 @@ export const Certificate = { }, fromJSON(object: any): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, cert: isSet(object.cert) ? bytesFromBase64(object.cert) : new Uint8Array(), pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; @@ -237,7 +237,7 @@ export const Certificate = { }, fromSDK(object: CertificateSDKType): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, cert: object?.cert, pubkey: object?.pubkey }; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts index b8cf30a299..67377031cd 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts @@ -730,7 +730,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -754,7 +754,7 @@ export const Deployment = { fromSDK(object: DeploymentSDKType): Deployment { return { deploymentId: object.deployment_id ? DeploymentID.fromSDK(object.deployment_id) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: object?.version, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/group.ts b/__fixtures__/output1/akash/deployment/v1beta1/group.ts index be14a7b6de..e3939c7757 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/group.ts @@ -649,7 +649,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -673,7 +673,7 @@ export const Group = { fromSDK(object: GroupSDKType): Group { return { groupId: object.group_id ? GroupID.fromSDK(object.group_id) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: object.group_spec ? GroupSpec.fromSDK(object.group_spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts index 72adbfa891..2454870f46 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts @@ -198,7 +198,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -222,7 +222,7 @@ export const Deployment = { fromSDK(object: DeploymentSDKType): Deployment { return { deploymentId: object.deployment_id ? DeploymentID.fromSDK(object.deployment_id) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: object?.version, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/group.ts b/__fixtures__/output1/akash/deployment/v1beta2/group.ts index 5ce8148aa6..9914926b51 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/group.ts @@ -125,7 +125,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -149,7 +149,7 @@ export const Group = { fromSDK(object: GroupSDKType): Group { return { groupId: object.group_id ? GroupID.fromSDK(object.group_id) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: object.group_spec ? GroupSpec.fromSDK(object.group_spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/escrow/v1beta1/types.ts b/__fixtures__/output1/akash/escrow/v1beta1/types.ts index e9a6892182..db715a1481 100644 --- a/__fixtures__/output1/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta1/types.ts @@ -287,7 +287,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? Coin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO @@ -317,7 +317,7 @@ export const Account = { return { id: object.id ? AccountID.fromSDK(object.id) : undefined, owner: object?.owner, - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: object.balance ? Coin.fromSDK(object.balance) : undefined, transferred: object.transferred ? Coin.fromSDK(object.transferred) : undefined, settledAt: object?.settled_at @@ -410,7 +410,7 @@ export const Payment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, rate: isSet(object.rate) ? Coin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined @@ -443,7 +443,7 @@ export const Payment = { accountId: object.account_id ? AccountID.fromSDK(object.account_id) : undefined, paymentId: object?.payment_id, owner: object?.owner, - state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, rate: object.rate ? Coin.fromSDK(object.rate) : undefined, balance: object.balance ? Coin.fromSDK(object.balance) : undefined, withdrawn: object.withdrawn ? Coin.fromSDK(object.withdrawn) : undefined diff --git a/__fixtures__/output1/akash/escrow/v1beta2/types.ts b/__fixtures__/output1/akash/escrow/v1beta2/types.ts index 28061fed97..609f43061b 100644 --- a/__fixtures__/output1/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta2/types.ts @@ -314,7 +314,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? DecCoin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO, @@ -350,7 +350,7 @@ export const Account = { return { id: object.id ? AccountID.fromSDK(object.id) : undefined, owner: object?.owner, - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: object.balance ? DecCoin.fromSDK(object.balance) : undefined, transferred: object.transferred ? DecCoin.fromSDK(object.transferred) : undefined, settledAt: object?.settled_at, @@ -447,7 +447,7 @@ export const FractionalPayment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, rate: isSet(object.rate) ? DecCoin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined @@ -480,7 +480,7 @@ export const FractionalPayment = { accountId: object.account_id ? AccountID.fromSDK(object.account_id) : undefined, paymentId: object?.payment_id, owner: object?.owner, - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, rate: object.rate ? DecCoin.fromSDK(object.rate) : undefined, balance: object.balance ? DecCoin.fromSDK(object.balance) : undefined, withdrawn: object.withdrawn ? Coin.fromSDK(object.withdrawn) : undefined diff --git a/__fixtures__/output1/akash/market/v1beta2/bid.ts b/__fixtures__/output1/akash/market/v1beta2/bid.ts index b73bf667ee..dc8c67be98 100644 --- a/__fixtures__/output1/akash/market/v1beta2/bid.ts +++ b/__fixtures__/output1/akash/market/v1beta2/bid.ts @@ -524,7 +524,7 @@ export const Bid = { fromJSON(object: any): Bid { return { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -548,7 +548,7 @@ export const Bid = { fromSDK(object: BidSDKType): Bid { return { bidId: object.bid_id ? BidID.fromSDK(object.bid_id) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, price: object.price ? DecCoin.fromSDK(object.price) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/market/v1beta2/lease.ts b/__fixtures__/output1/akash/market/v1beta2/lease.ts index a9042244ff..56d0502241 100644 --- a/__fixtures__/output1/akash/market/v1beta2/lease.ts +++ b/__fixtures__/output1/akash/market/v1beta2/lease.ts @@ -300,7 +300,7 @@ export const Lease = { fromJSON(object: any): Lease { return { leaseId: isSet(object.leaseId) ? LeaseID.fromJSON(object.leaseId) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO, closedOn: isSet(object.closedOn) ? Long.fromValue(object.closedOn) : Long.ZERO @@ -327,7 +327,7 @@ export const Lease = { fromSDK(object: LeaseSDKType): Lease { return { leaseId: object.lease_id ? LeaseID.fromSDK(object.lease_id) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, price: object.price ? DecCoin.fromSDK(object.price) : undefined, createdAt: object?.created_at, closedOn: object?.closed_on diff --git a/__fixtures__/output1/akash/market/v1beta2/order.ts b/__fixtures__/output1/akash/market/v1beta2/order.ts index cee653dcc5..27398a7ffd 100644 --- a/__fixtures__/output1/akash/market/v1beta2/order.ts +++ b/__fixtures__/output1/akash/market/v1beta2/order.ts @@ -238,7 +238,7 @@ export const Order = { fromJSON(object: any): Order { return { orderId: isSet(object.orderId) ? OrderID.fromJSON(object.orderId) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, spec: isSet(object.spec) ? GroupSpec.fromJSON(object.spec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -262,7 +262,7 @@ export const Order = { fromSDK(object: OrderSDKType): Order { return { orderId: object.order_id ? OrderID.fromSDK(object.order_id) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, spec: object.spec ? GroupSpec.fromSDK(object.spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/confio/proofs.ts b/__fixtures__/output1/confio/proofs.ts index c54a96309d..ad11a886fe 100644 --- a/__fixtures__/output1/confio/proofs.ts +++ b/__fixtures__/output1/confio/proofs.ts @@ -802,10 +802,10 @@ export const LeafOp = { }, fromJSON(object: any): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : -1, - prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0, + prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, @@ -829,10 +829,10 @@ export const LeafOp = { }, fromSDK(object: LeafOpSDKType): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehashKey: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : -1, - prehashValue: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehashKey: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : 0, + prehashValue: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : 0, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, prefix: object?.prefix }; }, @@ -891,7 +891,7 @@ export const InnerOp = { }, fromJSON(object: any): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() }; @@ -912,7 +912,7 @@ export const InnerOp = { }, fromSDK(object: InnerOpSDKType): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, prefix: object?.prefix, suffix: object?.suffix }; @@ -1096,7 +1096,7 @@ export const InnerSpec = { minPrefixLength: isSet(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, maxPrefixLength: isSet(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 }; }, toJSON(message: InnerSpec): unknown { @@ -1130,7 +1130,7 @@ export const InnerSpec = { minPrefixLength: object?.min_prefix_length, maxPrefixLength: object?.max_prefix_length, emptyChild: object?.empty_child, - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 }; }, toSDK(message: InnerSpec): InnerSpecSDKType { diff --git a/__fixtures__/output1/cosmos/gov/v1/gov.ts b/__fixtures__/output1/cosmos/gov/v1/gov.ts index a190b6f4e3..9de5c364c6 100644 --- a/__fixtures__/output1/cosmos/gov/v1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1/gov.ts @@ -315,7 +315,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -333,7 +333,7 @@ export const WeightedVoteOption = { }, fromSDK(object: WeightedVoteOptionSDKType): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: object?.weight }; }, @@ -527,7 +527,7 @@ export const Proposal = { return { id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -577,7 +577,7 @@ export const Proposal = { return { id: object?.id, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined, diff --git a/__fixtures__/output1/cosmos/gov/v1/query.ts b/__fixtures__/output1/cosmos/gov/v1/query.ts index 4c60e27f89..38ddb110c4 100644 --- a/__fixtures__/output1/cosmos/gov/v1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1/query.ts @@ -351,7 +351,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined @@ -375,7 +375,7 @@ export const QueryProposalsRequest = { }, fromSDK(object: QueryProposalsRequestSDKType): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : -1, + proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, voter: object?.voter, depositor: object?.depositor, pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.ts b/__fixtures__/output1/cosmos/gov/v1/tx.ts index bbd0f08776..df40e55a90 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.ts @@ -430,7 +430,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, @@ -454,7 +454,7 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: object?.metadata }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts index 87d5cc11b9..aa5022f1bd 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts @@ -343,7 +343,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -361,7 +361,7 @@ export const WeightedVoteOption = { }, fromSDK(object: WeightedVoteOptionSDKType): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: object?.weight }; }, @@ -615,7 +615,7 @@ export const Proposal = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -658,7 +658,7 @@ export const Proposal = { return { proposalId: object?.proposal_id, content: object.content ? Any.fromSDK(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined, @@ -830,7 +830,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, @@ -858,7 +858,7 @@ export const Vote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts index f7959cc9eb..d05cbf7287 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts @@ -351,7 +351,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined @@ -375,7 +375,7 @@ export const QueryProposalsRequest = { }, fromSDK(object: QueryProposalsRequestSDKType): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : -1, + proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, voter: object?.voter, depositor: object?.depositor, pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts index ecf1f2b886..ec96cf98dc 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts @@ -283,7 +283,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 }; }, toJSON(message: MsgVote): unknown { @@ -304,7 +304,7 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 }; }, toSDK(message: MsgVote): MsgVoteSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/events.ts b/__fixtures__/output1/cosmos/group/v1/events.ts index 6afb3ce761..19952772dc 100644 --- a/__fixtures__/output1/cosmos/group/v1/events.ts +++ b/__fixtures__/output1/cosmos/group/v1/events.ts @@ -513,7 +513,7 @@ export const EventExec = { fromJSON(object: any): EventExec { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; }, toJSON(message: EventExec): unknown { @@ -531,7 +531,7 @@ export const EventExec = { fromSDK(object: EventExecSDKType): EventExec { return { proposalId: object?.proposal_id, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; }, toSDK(message: EventExec): EventExecSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/tx.ts b/__fixtures__/output1/cosmos/group/v1/tx.ts index 6a824bb708..949debbba0 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.ts @@ -1625,7 +1625,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], metadata: isSet(object.metadata) ? String(object.metadata) : "", messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toJSON(message: MsgSubmitProposal): unknown { @@ -1660,7 +1660,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], metadata: object?.metadata, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { @@ -1904,9 +1904,9 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "", - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toJSON(message: MsgVote): unknown { @@ -1931,9 +1931,9 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: object?.metadata, - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toSDK(message: MsgVote): MsgVoteSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/types.ts b/__fixtures__/output1/cosmos/group/v1/types.ts index 5f80ff10e1..5d78896298 100644 --- a/__fixtures__/output1/cosmos/group/v1/types.ts +++ b/__fixtures__/output1/cosmos/group/v1/types.ts @@ -1268,11 +1268,11 @@ export const Proposal = { submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, groupVersion: isSet(object.groupVersion) ? Long.fromValue(object.groupVersion) : Long.UZERO, groupPolicyVersion: isSet(object.groupPolicyVersion) ? Long.fromValue(object.groupPolicyVersion) : Long.UZERO, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, - executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : -1, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -1327,11 +1327,11 @@ export const Proposal = { submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, groupVersion: object?.group_version, groupPolicyVersion: object?.group_policy_version, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, votingPeriodEnd: object.voting_period_end ? Timestamp.fromSDK(object.voting_period_end) : undefined, - executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, + executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : 0, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [] }; }, @@ -1513,7 +1513,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "", submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined }; @@ -1540,7 +1540,7 @@ export const Vote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: object?.metadata, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined }; diff --git a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts index 44e2f98fd4..4a1a5654a6 100644 --- a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts @@ -247,7 +247,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: isSet(object.id) ? Number(object.id) : 0, protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", - storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0 }; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { @@ -268,7 +268,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: object?.id, protoFileName: object?.proto_file_name, - storageType: isSet(object.storage_type) ? storageTypeFromJSON(object.storage_type) : -1 + storageType: isSet(object.storage_type) ? storageTypeFromJSON(object.storage_type) : 0 }; }, toSDK(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntrySDKType { diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts index 41cf53a423..7e0a398515 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts @@ -149,7 +149,7 @@ export const StakeAuthorization = { maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, - authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0 }; }, toJSON(message: StakeAuthorization): unknown { @@ -173,7 +173,7 @@ export const StakeAuthorization = { maxTokens: object.max_tokens ? Coin.fromSDK(object.max_tokens) : undefined, allowList: object.allow_list ? StakeAuthorization_Validators.fromSDK(object.allow_list) : undefined, denyList: object.deny_list ? StakeAuthorization_Validators.fromSDK(object.deny_list) : undefined, - authorizationType: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : -1 + authorizationType: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : 0 }; }, toSDK(message: StakeAuthorization): StakeAuthorizationSDKType { diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts index eef445c2dc..fd82fc0a34 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts @@ -873,7 +873,7 @@ export const Validator = { operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, tokens: isSet(object.tokens) ? String(object.tokens) : "", delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "", description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, @@ -918,7 +918,7 @@ export const Validator = { operatorAddress: object?.operator_address, consensusPubkey: object.consensus_pubkey ? Any.fromSDK(object.consensus_pubkey) : undefined, jailed: object?.jailed, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, tokens: object?.tokens, delegatorShares: object?.delegator_shares, description: object.description ? Description.fromSDK(object.description) : undefined, diff --git a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts index 71a34821b3..54d748b6e1 100644 --- a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts @@ -407,7 +407,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() }; }, @@ -425,7 +425,7 @@ export const SignatureDescriptor_Data_Single = { }, fromSDK(object: SignatureDescriptor_Data_SingleSDKType): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, signature: object?.signature }; }, diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts index 2f7c398ec5..803caa7957 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts @@ -342,7 +342,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0 }; }, toJSON(message: GetTxsEventRequest): unknown { @@ -367,7 +367,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => e) : [], pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined, - orderBy: isSet(object.order_by) ? orderByFromJSON(object.order_by) : -1 + orderBy: isSet(object.order_by) ? orderByFromJSON(object.order_by) : 0 }; }, toSDK(message: GetTxsEventRequest): GetTxsEventRequestSDKType { @@ -516,7 +516,7 @@ export const BroadcastTxRequest = { fromJSON(object: any): BroadcastTxRequest { return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 }; }, toJSON(message: BroadcastTxRequest): unknown { @@ -534,7 +534,7 @@ export const BroadcastTxRequest = { fromSDK(object: BroadcastTxRequestSDKType): BroadcastTxRequest { return { txBytes: object?.tx_bytes, - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 }; }, toSDK(message: BroadcastTxRequest): BroadcastTxRequestSDKType { diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts index 1c1b51e1e4..3e87e0edd4 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts @@ -1159,7 +1159,7 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; }, toJSON(message: ModeInfo_Single): unknown { @@ -1174,7 +1174,7 @@ export const ModeInfo_Single = { }, fromSDK(object: ModeInfo_SingleSDKType): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; }, toSDK(message: ModeInfo_Single): ModeInfo_SingleSDKType { @@ -1486,7 +1486,7 @@ export const AuxSignerData = { return { address: isSet(object.address) ? String(object.address) : "", signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() }; }, @@ -1510,7 +1510,7 @@ export const AuxSignerData = { return { address: object?.address, signDoc: object.sign_doc ? SignDocDirectAux.fromSDK(object.sign_doc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, sig: object?.sig }; }, diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts index 46159938a6..1f84564492 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts @@ -256,7 +256,7 @@ export const AccessTypeParam = { }, fromJSON(object: any): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 }; }, toJSON(message: AccessTypeParam): unknown { @@ -271,7 +271,7 @@ export const AccessTypeParam = { }, fromSDK(object: AccessTypeParamSDKType): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 }; }, toSDK(message: AccessTypeParam): AccessTypeParamSDKType { @@ -318,7 +318,7 @@ export const AccessConfig = { }, fromJSON(object: any): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, address: isSet(object.address) ? String(object.address) : "" }; }, @@ -336,7 +336,7 @@ export const AccessConfig = { }, fromSDK(object: AccessConfigSDKType): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, address: object?.address }; }, @@ -393,7 +393,7 @@ export const Params = { fromJSON(object: any): Params { return { codeUploadAccess: isSet(object.codeUploadAccess) ? AccessConfig.fromJSON(object.codeUploadAccess) : undefined, - instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : -1, + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : 0, maxWasmCodeSize: isSet(object.maxWasmCodeSize) ? Long.fromValue(object.maxWasmCodeSize) : Long.UZERO }; }, @@ -414,7 +414,7 @@ export const Params = { fromSDK(object: ParamsSDKType): Params { return { codeUploadAccess: object.code_upload_access ? AccessConfig.fromSDK(object.code_upload_access) : undefined, - instantiateDefaultPermission: isSet(object.instantiate_default_permission) ? accessTypeFromJSON(object.instantiate_default_permission) : -1, + instantiateDefaultPermission: isSet(object.instantiate_default_permission) ? accessTypeFromJSON(object.instantiate_default_permission) : 0, maxWasmCodeSize: object?.max_wasm_code_size }; }, @@ -684,7 +684,7 @@ export const ContractCodeHistoryEntry = { }, fromJSON(object: any): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO, updated: isSet(object.updated) ? AbsoluteTxPosition.fromJSON(object.updated) : undefined, msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() @@ -708,7 +708,7 @@ export const ContractCodeHistoryEntry = { }, fromSDK(object: ContractCodeHistoryEntrySDKType): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, codeId: object?.code_id, updated: object.updated ? AbsoluteTxPosition.fromSDK(object.updated) : undefined, msg: object?.msg diff --git a/__fixtures__/output1/evmos/claims/v1/claims.ts b/__fixtures__/output1/evmos/claims/v1/claims.ts index 5b44f76973..4696147afe 100644 --- a/__fixtures__/output1/evmos/claims/v1/claims.ts +++ b/__fixtures__/output1/evmos/claims/v1/claims.ts @@ -155,7 +155,7 @@ export const Claim = { }, fromJSON(object: any): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : -1, + action: isSet(object.action) ? actionFromJSON(object.action) : 0, completed: isSet(object.completed) ? Boolean(object.completed) : false, claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" }; @@ -176,7 +176,7 @@ export const Claim = { }, fromSDK(object: ClaimSDKType): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : -1, + action: isSet(object.action) ? actionFromJSON(object.action) : 0, completed: object?.completed, claimableAmount: object?.claimable_amount }; diff --git a/__fixtures__/output1/evmos/erc20/v1/erc20.ts b/__fixtures__/output1/evmos/erc20/v1/erc20.ts index 2f9cd63e10..7ff0b0cc09 100644 --- a/__fixtures__/output1/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/output1/evmos/erc20/v1/erc20.ts @@ -188,7 +188,7 @@ export const TokenPair = { erc20Address: isSet(object.erc20Address) ? String(object.erc20Address) : "", denom: isSet(object.denom) ? String(object.denom) : "", enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 + contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : 0 }; }, toJSON(message: TokenPair): unknown { @@ -212,7 +212,7 @@ export const TokenPair = { erc20Address: object?.erc20_address, denom: object?.denom, enabled: object?.enabled, - contractOwner: isSet(object.contract_owner) ? ownerFromJSON(object.contract_owner) : -1 + contractOwner: isSet(object.contract_owner) ? ownerFromJSON(object.contract_owner) : 0 }; }, toSDK(message: TokenPair): TokenPairSDKType { diff --git a/__fixtures__/output1/google/api/backend.ts b/__fixtures__/output1/google/api/backend.ts index 44fea9fac9..af75ffddd1 100644 --- a/__fixtures__/output1/google/api/backend.ts +++ b/__fixtures__/output1/google/api/backend.ts @@ -358,7 +358,7 @@ export const BackendRule = { deadline: isSet(object.deadline) ? Number(object.deadline) : 0, minDeadline: isSet(object.minDeadline) ? Number(object.minDeadline) : 0, operationDeadline: isSet(object.operationDeadline) ? Number(object.operationDeadline) : 0, - pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : -1, + pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : 0, jwtAudience: isSet(object.jwtAudience) ? String(object.jwtAudience) : undefined, disableAuth: isSet(object.disableAuth) ? Boolean(object.disableAuth) : undefined, protocol: isSet(object.protocol) ? String(object.protocol) : "" @@ -397,7 +397,7 @@ export const BackendRule = { deadline: object?.deadline, minDeadline: object?.min_deadline, operationDeadline: object?.operation_deadline, - pathTranslation: isSet(object.path_translation) ? backendRule_PathTranslationFromJSON(object.path_translation) : -1, + pathTranslation: isSet(object.path_translation) ? backendRule_PathTranslationFromJSON(object.path_translation) : 0, jwtAudience: object?.jwt_audience, disableAuth: object?.disable_auth, protocol: object?.protocol diff --git a/__fixtures__/output1/google/api/config_change.ts b/__fixtures__/output1/google/api/config_change.ts index e546c135e0..142ac32b42 100644 --- a/__fixtures__/output1/google/api/config_change.ts +++ b/__fixtures__/output1/google/api/config_change.ts @@ -195,7 +195,7 @@ export const ConfigChange = { element: isSet(object.element) ? String(object.element) : "", oldValue: isSet(object.oldValue) ? String(object.oldValue) : "", newValue: isSet(object.newValue) ? String(object.newValue) : "", - changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : -1, + changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : 0, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] }; }, @@ -226,7 +226,7 @@ export const ConfigChange = { element: object?.element, oldValue: object?.old_value, newValue: object?.new_value, - changeType: isSet(object.change_type) ? changeTypeFromJSON(object.change_type) : -1, + changeType: isSet(object.change_type) ? changeTypeFromJSON(object.change_type) : 0, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/api/consumer.ts b/__fixtures__/output1/google/api/consumer.ts index df569be4f6..4a36029ed0 100644 --- a/__fixtures__/output1/google/api/consumer.ts +++ b/__fixtures__/output1/google/api/consumer.ts @@ -245,7 +245,7 @@ export const Property = { fromJSON(object: any): Property { return { name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, description: isSet(object.description) ? String(object.description) : "" }; }, @@ -266,7 +266,7 @@ export const Property = { fromSDK(object: PropertySDKType): Property { return { name: object?.name, - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, description: object?.description }; }, diff --git a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts index bab015b521..25d3e529ce 100644 --- a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -851,7 +851,7 @@ export const IssueDetails = { }, fromJSON(object: any): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, position: isSet(object.position) ? SourcePosition.fromJSON(object.position) : undefined, id: isSet(object.id) ? Long.fromValue(object.id) : Long.ZERO }; @@ -872,7 +872,7 @@ export const IssueDetails = { }, fromSDK(object: IssueDetailsSDKType): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, position: object.position ? SourcePosition.fromSDK(object.position) : undefined, id: object?.id }; diff --git a/__fixtures__/output1/google/api/label.ts b/__fixtures__/output1/google/api/label.ts index f5e6dd05ad..cba3c19f23 100644 --- a/__fixtures__/output1/google/api/label.ts +++ b/__fixtures__/output1/google/api/label.ts @@ -103,7 +103,7 @@ export const LabelDescriptor = { fromJSON(object: any): LabelDescriptor { return { key: isSet(object.key) ? String(object.key) : "", - valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, + valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : 0, description: isSet(object.description) ? String(object.description) : "" }; }, @@ -124,7 +124,7 @@ export const LabelDescriptor = { fromSDK(object: LabelDescriptorSDKType): LabelDescriptor { return { key: object?.key, - valueType: isSet(object.value_type) ? labelDescriptor_ValueTypeFromJSON(object.value_type) : -1, + valueType: isSet(object.value_type) ? labelDescriptor_ValueTypeFromJSON(object.value_type) : 0, description: object?.description }; }, diff --git a/__fixtures__/output1/google/api/metric.ts b/__fixtures__/output1/google/api/metric.ts index e96f6f7a33..4739fbe6d2 100644 --- a/__fixtures__/output1/google/api/metric.ts +++ b/__fixtures__/output1/google/api/metric.ts @@ -486,13 +486,13 @@ export const MetricDescriptor = { name: isSet(object.name) ? String(object.name) : "", type: isSet(object.type) ? String(object.type) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : -1, - valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : -1, + metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : 0, + valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : 0, unit: isSet(object.unit) ? String(object.unit) : "", description: isSet(object.description) ? String(object.description) : "", displayName: isSet(object.displayName) ? String(object.displayName) : "", metadata: isSet(object.metadata) ? MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata) : undefined, - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] }; }, @@ -539,13 +539,13 @@ export const MetricDescriptor = { name: object?.name, type: object?.type, labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromSDK(e)) : [], - metricKind: isSet(object.metric_kind) ? metricDescriptor_MetricKindFromJSON(object.metric_kind) : -1, - valueType: isSet(object.value_type) ? metricDescriptor_ValueTypeFromJSON(object.value_type) : -1, + metricKind: isSet(object.metric_kind) ? metricDescriptor_MetricKindFromJSON(object.metric_kind) : 0, + valueType: isSet(object.value_type) ? metricDescriptor_ValueTypeFromJSON(object.value_type) : 0, unit: object?.unit, description: object?.description, displayName: object?.display_name, metadata: object.metadata ? MetricDescriptor_MetricDescriptorMetadata.fromSDK(object.metadata) : undefined, - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1, + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0, monitoredResourceTypes: Array.isArray(object?.monitored_resource_types) ? object.monitored_resource_types.map((e: any) => e) : [] }; }, @@ -618,7 +618,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, samplePeriod: isSet(object.samplePeriod) ? Duration.fromJSON(object.samplePeriod) : undefined, ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined }; @@ -639,7 +639,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromSDK(object: MetricDescriptor_MetricDescriptorMetadataSDKType): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1, + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0, samplePeriod: object.sample_period ? Duration.fromSDK(object.sample_period) : undefined, ingestDelay: object.ingest_delay ? Duration.fromSDK(object.ingest_delay) : undefined }; diff --git a/__fixtures__/output1/google/api/monitored_resource.ts b/__fixtures__/output1/google/api/monitored_resource.ts index 86a271fb54..96f660b7d5 100644 --- a/__fixtures__/output1/google/api/monitored_resource.ts +++ b/__fixtures__/output1/google/api/monitored_resource.ts @@ -250,7 +250,7 @@ export const MonitoredResourceDescriptor = { displayName: isSet(object.displayName) ? String(object.displayName) : "", description: isSet(object.description) ? String(object.description) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0 }; }, toJSON(message: MonitoredResourceDescriptor): unknown { @@ -284,7 +284,7 @@ export const MonitoredResourceDescriptor = { displayName: object?.display_name, description: object?.description, labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromSDK(e)) : [], - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1 + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0 }; }, toSDK(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorSDKType { diff --git a/__fixtures__/output1/google/api/resource.ts b/__fixtures__/output1/google/api/resource.ts index 21b19b1263..cc3a4c0000 100644 --- a/__fixtures__/output1/google/api/resource.ts +++ b/__fixtures__/output1/google/api/resource.ts @@ -421,7 +421,7 @@ export const ResourceDescriptor = { type: isSet(object.type) ? String(object.type) : "", pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => String(e)) : [], nameField: isSet(object.nameField) ? String(object.nameField) : "", - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, plural: isSet(object.plural) ? String(object.plural) : "", singular: isSet(object.singular) ? String(object.singular) : "", style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] @@ -462,7 +462,7 @@ export const ResourceDescriptor = { type: object?.type, pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => e) : [], nameField: object?.name_field, - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, plural: object?.plural, singular: object?.singular, style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts index 26f2324869..97364f2bfe 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts @@ -277,7 +277,7 @@ export const CheckError = { }, fromJSON(object: any): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, subject: isSet(object.subject) ? String(object.subject) : "", detail: isSet(object.detail) ? String(object.detail) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined @@ -301,7 +301,7 @@ export const CheckError = { }, fromSDK(object: CheckErrorSDKType): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, subject: object?.subject, detail: object?.detail, status: object.status ? Status.fromSDK(object.status) : undefined diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts index 67ff01259e..08612a7ca2 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts @@ -344,7 +344,7 @@ export const LogEntry = { return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", @@ -409,7 +409,7 @@ export const LogEntry = { return { name: object?.name, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, trace: object?.trace, insertId: object?.insert_id, diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts index 105017650f..f58684a55f 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts @@ -331,7 +331,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metricValueSets) ? object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)) : [], logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -402,7 +402,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metric_value_sets) ? object.metric_value_sets.map((e: any) => MetricValueSet.fromSDK(e)) : [], logEntries: Array.isArray(object?.log_entries) ? object.log_entries.map((e: any) => LogEntry.fromSDK(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts index d0dd794848..dd48680d2b 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts @@ -558,7 +558,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 + quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : 0 }; }, toJSON(message: QuotaOperation): unknown { @@ -609,7 +609,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quota_metrics) ? object.quota_metrics.map((e: any) => MetricValueSet.fromSDK(e)) : [], - quotaMode: isSet(object.quota_mode) ? quotaOperation_QuotaModeFromJSON(object.quota_mode) : -1 + quotaMode: isSet(object.quota_mode) ? quotaOperation_QuotaModeFromJSON(object.quota_mode) : 0 }; }, toSDK(message: QuotaOperation): QuotaOperationSDKType { @@ -791,7 +791,7 @@ export const QuotaError = { }, fromJSON(object: any): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, subject: isSet(object.subject) ? String(object.subject) : "", description: isSet(object.description) ? String(object.description) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined @@ -815,7 +815,7 @@ export const QuotaError = { }, fromSDK(object: QuotaErrorSDKType): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, subject: object?.subject, description: object?.description, status: object.status ? Status.fromSDK(object.status) : undefined diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts index f9ecd2cf23..6d35b58cf6 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts @@ -575,7 +575,7 @@ export const CheckResponse_ConsumerInfo = { fromJSON(object: any): CheckResponse_ConsumerInfo { return { projectNumber: isSet(object.projectNumber) ? Long.fromValue(object.projectNumber) : Long.ZERO, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, consumerNumber: isSet(object.consumerNumber) ? Long.fromValue(object.consumerNumber) : Long.ZERO }; }, @@ -596,7 +596,7 @@ export const CheckResponse_ConsumerInfo = { fromSDK(object: CheckResponse_ConsumerInfoSDKType): CheckResponse_ConsumerInfo { return { projectNumber: object?.project_number, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, consumerNumber: object?.consumer_number }; }, diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts index 786dea61a6..cf47802a43 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts @@ -762,7 +762,7 @@ export const OperationMetadata_Step = { fromJSON(object: any): OperationMetadata_Step { return { description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 }; }, toJSON(message: OperationMetadata_Step): unknown { @@ -780,7 +780,7 @@ export const OperationMetadata_Step = { fromSDK(object: OperationMetadata_StepSDKType): OperationMetadata_Step { return { description: object?.description, - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 }; }, toSDK(message: OperationMetadata_Step): OperationMetadata_StepSDKType { @@ -836,7 +836,7 @@ export const Diagnostic = { fromJSON(object: any): Diagnostic { return { location: isSet(object.location) ? String(object.location) : "", - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, message: isSet(object.message) ? String(object.message) : "" }; }, @@ -857,7 +857,7 @@ export const Diagnostic = { fromSDK(object: DiagnosticSDKType): Diagnostic { return { location: object?.location, - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, message: object?.message }; }, @@ -991,7 +991,7 @@ export const ConfigFile = { return { filePath: isSet(object.filePath) ? String(object.filePath) : "", fileContents: isSet(object.fileContents) ? bytesFromBase64(object.fileContents) : new Uint8Array(), - fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 + fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : 0 }; }, toJSON(message: ConfigFile): unknown { @@ -1012,7 +1012,7 @@ export const ConfigFile = { return { filePath: object?.file_path, fileContents: object?.file_contents, - fileType: isSet(object.file_type) ? configFile_FileTypeFromJSON(object.file_type) : -1 + fileType: isSet(object.file_type) ? configFile_FileTypeFromJSON(object.file_type) : 0 }; }, toSDK(message: ConfigFile): ConfigFileSDKType { @@ -1217,7 +1217,7 @@ export const Rollout = { rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "", createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, createdBy: isSet(object.createdBy) ? String(object.createdBy) : "", - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, trafficPercentStrategy: isSet(object.trafficPercentStrategy) ? Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy) : undefined, deleteServiceStrategy: isSet(object.deleteServiceStrategy) ? Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy) : undefined, serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" @@ -1250,7 +1250,7 @@ export const Rollout = { rolloutId: object?.rollout_id, createTime: object.create_time ? Timestamp.fromSDK(object.create_time) : undefined, createdBy: object?.created_by, - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, trafficPercentStrategy: object.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromSDK(object.traffic_percent_strategy) : undefined, deleteServiceStrategy: object.delete_service_strategy ? Rollout_DeleteServiceStrategy.fromSDK(object.delete_service_strategy) : undefined, serviceName: object?.service_name diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts index c83d86513a..2e91d4d6c5 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts @@ -857,7 +857,7 @@ export const GetServiceConfigRequest = { return { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", configId: isSet(object.configId) ? String(object.configId) : "", - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 }; }, toJSON(message: GetServiceConfigRequest): unknown { @@ -878,7 +878,7 @@ export const GetServiceConfigRequest = { return { serviceName: object?.service_name, configId: object?.config_id, - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 }; }, toSDK(message: GetServiceConfigRequest): GetServiceConfigRequestSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts index a2ccc891f8..9f68664c2e 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts @@ -213,7 +213,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toJSON(message: Service): unknown { @@ -237,7 +237,7 @@ export const Service = { name: object?.name, parent: object?.parent, config: object.config ? ServiceConfig.fromSDK(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toSDK(message: Service): ServiceSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts index ad9f3d691c..0373221866 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts @@ -454,7 +454,7 @@ export const DisableServiceRequest = { return { name: isSet(object.name) ? String(object.name) : "", disableDependentServices: isSet(object.disableDependentServices) ? Boolean(object.disableDependentServices) : false, - checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 + checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : 0 }; }, toJSON(message: DisableServiceRequest): unknown { @@ -475,7 +475,7 @@ export const DisableServiceRequest = { return { name: object?.name, disableDependentServices: object?.disable_dependent_services, - checkIfServiceHasUsage: isSet(object.check_if_service_has_usage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage) : -1 + checkIfServiceHasUsage: isSet(object.check_if_service_has_usage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage) : 0 }; }, toSDK(message: DisableServiceRequest): DisableServiceRequestSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts index 9d1afa0c92..3023808987 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts @@ -667,7 +667,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toJSON(message: Service): unknown { @@ -691,7 +691,7 @@ export const Service = { name: object?.name, parent: object?.parent, config: object.config ? ServiceConfig.fromSDK(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toSDK(message: Service): ServiceSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts index 6d257f8d43..2bc79f113d 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1217,7 +1217,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: isSet(object.parent) ? String(object.parent) : "", pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: ListConsumerQuotaMetricsRequest): unknown { @@ -1241,7 +1241,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: object?.parent, pageSize: object?.page_size, pageToken: object?.page_token, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toSDK(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestSDKType { @@ -1367,7 +1367,7 @@ export const GetConsumerQuotaMetricRequest = { fromJSON(object: any): GetConsumerQuotaMetricRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: GetConsumerQuotaMetricRequest): unknown { @@ -1385,7 +1385,7 @@ export const GetConsumerQuotaMetricRequest = { fromSDK(object: GetConsumerQuotaMetricRequestSDKType): GetConsumerQuotaMetricRequest { return { name: object?.name, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toSDK(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestSDKType { @@ -1434,7 +1434,7 @@ export const GetConsumerQuotaLimitRequest = { fromJSON(object: any): GetConsumerQuotaLimitRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: GetConsumerQuotaLimitRequest): unknown { @@ -1452,7 +1452,7 @@ export const GetConsumerQuotaLimitRequest = { fromSDK(object: GetConsumerQuotaLimitRequestSDKType): GetConsumerQuotaLimitRequest { return { name: object?.name, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toSDK(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestSDKType { @@ -3283,7 +3283,7 @@ export const GetServiceIdentityResponse = { fromJSON(object: any): GetServiceIdentityResponse { return { identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 }; }, toJSON(message: GetServiceIdentityResponse): unknown { @@ -3301,7 +3301,7 @@ export const GetServiceIdentityResponse = { fromSDK(object: GetServiceIdentityResponseSDKType): GetServiceIdentityResponse { return { identity: object.identity ? ServiceIdentity.fromSDK(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 }; }, toSDK(message: GetServiceIdentityResponse): GetServiceIdentityResponseSDKType { diff --git a/__fixtures__/output1/google/logging/v2/log_entry.ts b/__fixtures__/output1/google/logging/v2/log_entry.ts index d10a878e8f..ad1ff8174c 100644 --- a/__fixtures__/output1/google/logging/v2/log_entry.ts +++ b/__fixtures__/output1/google/logging/v2/log_entry.ts @@ -504,7 +504,7 @@ export const LogEntry = { jsonPayload: isSet(object.jsonPayload) ? Struct.fromJSON(object.jsonPayload) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, receiveTimestamp: isSet(object.receiveTimestamp) ? fromJsonTimestamp(object.receiveTimestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, insertId: isSet(object.insertId) ? String(object.insertId) : "", httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ @@ -584,7 +584,7 @@ export const LogEntry = { jsonPayload: object.json_payload ? Struct.fromSDK(object.json_payload) : undefined, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, receiveTimestamp: object.receive_timestamp ? Timestamp.fromSDK(object.receive_timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, insertId: object?.insert_id, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ diff --git a/__fixtures__/output1/google/logging/v2/logging.ts b/__fixtures__/output1/google/logging/v2/logging.ts index 4a30c171bb..2a8274a552 100644 --- a/__fixtures__/output1/google/logging/v2/logging.ts +++ b/__fixtures__/output1/google/logging/v2/logging.ts @@ -1666,7 +1666,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 }; }, @@ -1684,7 +1684,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromSDK(object: TailLogEntriesResponse_SuppressionInfoSDKType): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, suppressedCount: object?.suppressed_count }; }, diff --git a/__fixtures__/output1/google/logging/v2/logging_config.ts b/__fixtures__/output1/google/logging/v2/logging_config.ts index d4ae71c01f..e6752f37d4 100644 --- a/__fixtures__/output1/google/logging/v2/logging_config.ts +++ b/__fixtures__/output1/google/logging/v2/logging_config.ts @@ -1678,7 +1678,7 @@ export const LogBucket = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, retentionDays: isSet(object.retentionDays) ? Number(object.retentionDays) : 0, locked: isSet(object.locked) ? Boolean(object.locked) : false, - lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : -1, + lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : 0, restrictedFields: Array.isArray(object?.restrictedFields) ? object.restrictedFields.map((e: any) => String(e)) : [], cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined }; @@ -1721,7 +1721,7 @@ export const LogBucket = { updateTime: object.update_time ? Timestamp.fromSDK(object.update_time) : undefined, retentionDays: object?.retention_days, locked: object?.locked, - lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, + lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : 0, restrictedFields: Array.isArray(object?.restricted_fields) ? object.restricted_fields.map((e: any) => e) : [], cmekSettings: object.cmek_settings ? CmekSettings.fromSDK(object.cmek_settings) : undefined }; @@ -1961,7 +1961,7 @@ export const LogSink = { description: isSet(object.description) ? String(object.description) : "", disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : -1, + outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : 0, writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "", includeChildren: isSet(object.includeChildren) ? Boolean(object.includeChildren) : false, bigqueryOptions: isSet(object.bigqueryOptions) ? BigQueryOptions.fromJSON(object.bigqueryOptions) : undefined, @@ -2013,7 +2013,7 @@ export const LogSink = { description: object?.description, disabled: object?.disabled, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromSDK(e)) : [], - outputVersionFormat: isSet(object.output_version_format) ? logSink_VersionFormatFromJSON(object.output_version_format) : -1, + outputVersionFormat: isSet(object.output_version_format) ? logSink_VersionFormatFromJSON(object.output_version_format) : 0, writerIdentity: object?.writer_identity, includeChildren: object?.include_children, bigqueryOptions: object.bigquery_options ? BigQueryOptions.fromSDK(object.bigquery_options) : undefined, @@ -4571,7 +4571,7 @@ export const CopyLogEntriesMetadata = { return { startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined, endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, + state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, cancellationRequested: isSet(object.cancellationRequested) ? Boolean(object.cancellationRequested) : false, request: isSet(object.request) ? CopyLogEntriesRequest.fromJSON(object.request) : undefined, progress: isSet(object.progress) ? Number(object.progress) : 0, @@ -4604,7 +4604,7 @@ export const CopyLogEntriesMetadata = { return { startTime: object.start_time ? Timestamp.fromSDK(object.start_time) : undefined, endTime: object.end_time ? Timestamp.fromSDK(object.end_time) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, + state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, cancellationRequested: object?.cancellation_requested, request: object.request ? CopyLogEntriesRequest.fromSDK(object.request) : undefined, progress: object?.progress, diff --git a/__fixtures__/output1/google/logging/v2/logging_metrics.ts b/__fixtures__/output1/google/logging/v2/logging_metrics.ts index 0222525e74..5599698307 100644 --- a/__fixtures__/output1/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/output1/google/logging/v2/logging_metrics.ts @@ -507,7 +507,7 @@ export const LogMetric = { bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 }; }, toJSON(message: LogMetric): unknown { @@ -569,7 +569,7 @@ export const LogMetric = { bucketOptions: object.bucket_options ? Distribution_BucketOptions.fromSDK(object.bucket_options) : undefined, createTime: object.create_time ? Timestamp.fromSDK(object.create_time) : undefined, updateTime: object.update_time ? Timestamp.fromSDK(object.update_time) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 }; }, toSDK(message: LogMetric): LogMetricSDKType { diff --git a/__fixtures__/output1/google/protobuf/api.ts b/__fixtures__/output1/google/protobuf/api.ts index 3dcdc38dae..77cdd75779 100644 --- a/__fixtures__/output1/google/protobuf/api.ts +++ b/__fixtures__/output1/google/protobuf/api.ts @@ -355,7 +355,7 @@ export const Api = { version: isSet(object.version) ? String(object.version) : "", sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Api): unknown { @@ -400,7 +400,7 @@ export const Api = { version: object?.version, sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromSDK(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toSDK(message: Api): ApiSDKType { @@ -506,7 +506,7 @@ export const Method = { responseTypeUrl: isSet(object.responseTypeUrl) ? String(object.responseTypeUrl) : "", responseStreaming: isSet(object.responseStreaming) ? Boolean(object.responseStreaming) : false, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Method): unknown { @@ -543,7 +543,7 @@ export const Method = { responseTypeUrl: object?.response_type_url, responseStreaming: object?.response_streaming, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toSDK(message: Method): MethodSDKType { diff --git a/__fixtures__/output1/google/protobuf/descriptor.ts b/__fixtures__/output1/google/protobuf/descriptor.ts index 0ef16ae987..19db8cd3ab 100644 --- a/__fixtures__/output1/google/protobuf/descriptor.ts +++ b/__fixtures__/output1/google/protobuf/descriptor.ts @@ -2134,8 +2134,8 @@ export const FieldDescriptorProto = { return { name: isSet(object.name) ? String(object.name) : "", number: isSet(object.number) ? Number(object.number) : 0, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, typeName: isSet(object.typeName) ? String(object.typeName) : "", extendee: isSet(object.extendee) ? String(object.extendee) : "", defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", @@ -2176,8 +2176,8 @@ export const FieldDescriptorProto = { return { name: object?.name, number: object?.number, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, typeName: object?.type_name, extendee: object?.extendee, defaultValue: object?.default_value, @@ -2919,7 +2919,7 @@ export const FileOptions = { javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) ? Boolean(object.javaGenerateEqualsAndHash) : false, javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, - optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : -1, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 0, goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, @@ -2998,7 +2998,7 @@ export const FileOptions = { javaMultipleFiles: object?.java_multiple_files, javaGenerateEqualsAndHash: object?.java_generate_equals_and_hash, javaStringCheckUtf8: object?.java_string_check_utf8, - optimizeFor: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : -1, + optimizeFor: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : 0, goPackage: object?.go_package, ccGenericServices: object?.cc_generic_services, javaGenericServices: object?.java_generic_services, @@ -3230,9 +3230,9 @@ export const FieldOptions = { }, fromJSON(object: any): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, packed: isSet(object.packed) ? Boolean(object.packed) : false, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, weak: isSet(object.weak) ? Boolean(object.weak) : false, @@ -3267,9 +3267,9 @@ export const FieldOptions = { }, fromSDK(object: FieldOptionsSDKType): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, packed: object?.packed, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, lazy: object?.lazy, deprecated: object?.deprecated, weak: object?.weak, @@ -3638,7 +3638,7 @@ export const MethodOptions = { fromJSON(object: any): MethodOptions { return { deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : -1, + idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, @@ -3663,7 +3663,7 @@ export const MethodOptions = { fromSDK(object: MethodOptionsSDKType): MethodOptions { return { deprecated: object?.deprecated, - idempotencyLevel: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : -1, + idempotencyLevel: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : 0, uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/protobuf/type.ts b/__fixtures__/output1/google/protobuf/type.ts index 506a597bba..4c1e5a6451 100644 --- a/__fixtures__/output1/google/protobuf/type.ts +++ b/__fixtures__/output1/google/protobuf/type.ts @@ -439,7 +439,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => String(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Type): unknown { @@ -481,7 +481,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => e) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toSDK(message: Type): TypeSDKType { @@ -601,8 +601,8 @@ export const Field = { }, fromJSON(object: any): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, number: isSet(object.number) ? Number(object.number) : 0, name: isSet(object.name) ? String(object.name) : "", typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", @@ -647,8 +647,8 @@ export const Field = { }, fromSDK(object: FieldSDKType): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, number: object?.number, name: object?.name, typeUrl: object?.type_url, @@ -741,7 +741,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromJSON(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Enum): unknown { @@ -776,7 +776,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromSDK(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toSDK(message: Enum): EnumSDKType { diff --git a/__fixtures__/output1/helpers.ts b/__fixtures__/output1/helpers.ts index 8658b32ada..53124a848b 100644 --- a/__fixtures__/output1/helpers.ts +++ b/__fixtures__/output1/helpers.ts @@ -146,11 +146,11 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -221,22 +221,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } diff --git a/__fixtures__/output1/ibc/core/channel/v1/channel.ts b/__fixtures__/output1/ibc/core/channel/v1/channel.ts index 3f172d002d..22814a56eb 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/channel.ts @@ -337,8 +337,8 @@ export const Channel = { }, fromJSON(object: any): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "" @@ -368,8 +368,8 @@ export const Channel = { }, fromSDK(object: ChannelSDKType): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connection_hops) ? object.connection_hops.map((e: any) => e) : [], version: object?.version @@ -462,8 +462,8 @@ export const IdentifiedChannel = { }, fromJSON(object: any): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "", @@ -499,8 +499,8 @@ export const IdentifiedChannel = { }, fromSDK(object: IdentifiedChannelSDKType): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connection_hops) ? object.connection_hops.map((e: any) => e) : [], version: object?.version, diff --git a/__fixtures__/output1/ibc/core/connection/v1/connection.ts b/__fixtures__/output1/ibc/core/connection/v1/connection.ts index 94a4e1d57c..cd2733149e 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/connection.ts @@ -261,7 +261,7 @@ export const ConnectionEnd = { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -292,7 +292,7 @@ export const ConnectionEnd = { return { clientId: object?.client_id, versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromSDK(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, delayPeriod: object?.delay_period }; @@ -380,7 +380,7 @@ export const IdentifiedConnection = { id: isSet(object.id) ? String(object.id) : "", clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -414,7 +414,7 @@ export const IdentifiedConnection = { id: object?.id, clientId: object?.client_id, versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromSDK(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, delayPeriod: object?.delay_period }; diff --git a/__fixtures__/output1/ibc/core/port/v1/query.ts b/__fixtures__/output1/ibc/core/port/v1/query.ts index 2f71a6da8e..c433700a5e 100644 --- a/__fixtures__/output1/ibc/core/port/v1/query.ts +++ b/__fixtures__/output1/ibc/core/port/v1/query.ts @@ -96,7 +96,7 @@ export const QueryAppVersionRequest = { return { portId: isSet(object.portId) ? String(object.portId) : "", connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, proposedVersion: isSet(object.proposedVersion) ? String(object.proposedVersion) : "" }; @@ -123,7 +123,7 @@ export const QueryAppVersionRequest = { return { portId: object?.port_id, connectionId: object?.connection_id, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, proposedVersion: object?.proposed_version }; diff --git a/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts index dcddec31c0..11e06b6e68 100644 --- a/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts @@ -789,7 +789,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -813,7 +813,7 @@ export const SignatureAndData = { fromSDK(object: SignatureAndDataSDKType): SignatureAndData { return { signature: object?.signature, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, data: object?.data, timestamp: object?.timestamp }; @@ -956,7 +956,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, @@ -983,7 +983,7 @@ export const SignBytes = { sequence: object?.sequence, timestamp: object?.timestamp, diversifier: object?.diversifier, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, data: object?.data }; }, diff --git a/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts index ba2d56f27a..dbddc2365f 100644 --- a/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts @@ -789,7 +789,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -813,7 +813,7 @@ export const SignatureAndData = { fromSDK(object: SignatureAndDataSDKType): SignatureAndData { return { signature: object?.signature, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, data: object?.data, timestamp: object?.timestamp }; @@ -956,7 +956,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, @@ -983,7 +983,7 @@ export const SignBytes = { sequence: object?.sequence, timestamp: object?.timestamp, diversifier: object?.diversifier, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, data: object?.data }; }, diff --git a/__fixtures__/output1/index.ts b/__fixtures__/output1/index.ts index 38dd89d1eb..b5ebddc0c6 100644 --- a/__fixtures__/output1/index.ts +++ b/__fixtures__/output1/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/output1/osmosis/claim/v1beta1/query.ts b/__fixtures__/output1/osmosis/claim/v1beta1/query.ts index d1ae385fd4..b08648acb0 100644 --- a/__fixtures__/output1/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/output1/osmosis/claim/v1beta1/query.ts @@ -415,7 +415,7 @@ export const QueryClaimableForActionRequest = { fromJSON(object: any): QueryClaimableForActionRequest { return { address: isSet(object.address) ? String(object.address) : "", - action: isSet(object.action) ? actionFromJSON(object.action) : -1 + action: isSet(object.action) ? actionFromJSON(object.action) : 0 }; }, toJSON(message: QueryClaimableForActionRequest): unknown { @@ -433,7 +433,7 @@ export const QueryClaimableForActionRequest = { fromSDK(object: QueryClaimableForActionRequestSDKType): QueryClaimableForActionRequest { return { address: object?.address, - action: isSet(object.action) ? actionFromJSON(object.action) : -1 + action: isSet(object.action) ? actionFromJSON(object.action) : 0 }; }, toSDK(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestSDKType { diff --git a/__fixtures__/output1/osmosis/lockup/lock.ts b/__fixtures__/output1/osmosis/lockup/lock.ts index 07bfff262f..adc1399ad4 100644 --- a/__fixtures__/output1/osmosis/lockup/lock.ts +++ b/__fixtures__/output1/osmosis/lockup/lock.ts @@ -323,7 +323,7 @@ export const QueryCondition = { }, fromJSON(object: any): QueryCondition { return { - lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : -1, + lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : 0, denom: isSet(object.denom) ? String(object.denom) : "", duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined @@ -347,7 +347,7 @@ export const QueryCondition = { }, fromSDK(object: QueryConditionSDKType): QueryCondition { return { - lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, + lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : 0, denom: object?.denom, duration: object.duration ? Duration.fromSDK(object.duration) : undefined, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined diff --git a/__fixtures__/output1/osmosis/superfluid/query.ts b/__fixtures__/output1/osmosis/superfluid/query.ts index 3d3c9c851c..806d15ce80 100644 --- a/__fixtures__/output1/osmosis/superfluid/query.ts +++ b/__fixtures__/output1/osmosis/superfluid/query.ts @@ -401,7 +401,7 @@ export const AssetTypeResponse = { }, fromJSON(object: any): AssetTypeResponse { return { - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 }; }, toJSON(message: AssetTypeResponse): unknown { @@ -416,7 +416,7 @@ export const AssetTypeResponse = { }, fromSDK(object: AssetTypeResponseSDKType): AssetTypeResponse { return { - assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : -1 + assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : 0 }; }, toSDK(message: AssetTypeResponse): AssetTypeResponseSDKType { diff --git a/__fixtures__/output1/osmosis/superfluid/superfluid.ts b/__fixtures__/output1/osmosis/superfluid/superfluid.ts index 6225b34863..d029e031cd 100644 --- a/__fixtures__/output1/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/output1/osmosis/superfluid/superfluid.ts @@ -185,7 +185,7 @@ export const SuperfluidAsset = { fromJSON(object: any): SuperfluidAsset { return { denom: isSet(object.denom) ? String(object.denom) : "", - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 }; }, toJSON(message: SuperfluidAsset): unknown { @@ -203,7 +203,7 @@ export const SuperfluidAsset = { fromSDK(object: SuperfluidAssetSDKType): SuperfluidAsset { return { denom: object?.denom, - assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : -1 + assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : 0 }; }, toSDK(message: SuperfluidAsset): SuperfluidAssetSDKType { diff --git a/__fixtures__/output1/tendermint/abci/types.ts b/__fixtures__/output1/tendermint/abci/types.ts index 4cae968a16..298214dd1a 100644 --- a/__fixtures__/output1/tendermint/abci/types.ts +++ b/__fixtures__/output1/tendermint/abci/types.ts @@ -1557,7 +1557,7 @@ export const RequestCheckTx = { fromJSON(object: any): RequestCheckTx { return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 }; }, toJSON(message: RequestCheckTx): unknown { @@ -1575,7 +1575,7 @@ export const RequestCheckTx = { fromSDK(object: RequestCheckTxSDKType): RequestCheckTx { return { tx: object?.tx, - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 }; }, toSDK(message: RequestCheckTx): RequestCheckTxSDKType { @@ -3418,7 +3418,7 @@ export const ResponseOfferSnapshot = { }, fromJSON(object: any): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; }, toJSON(message: ResponseOfferSnapshot): unknown { @@ -3433,7 +3433,7 @@ export const ResponseOfferSnapshot = { }, fromSDK(object: ResponseOfferSnapshotSDKType): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; }, toSDK(message: ResponseOfferSnapshot): ResponseOfferSnapshotSDKType { @@ -3551,7 +3551,7 @@ export const ResponseApplySnapshotChunk = { }, fromJSON(object: any): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, refetchChunks: Array.isArray(object?.refetchChunks) ? object.refetchChunks.map((e: any) => Number(e)) : [], rejectSenders: Array.isArray(object?.rejectSenders) ? object.rejectSenders.map((e: any) => String(e)) : [] }; @@ -3580,7 +3580,7 @@ export const ResponseApplySnapshotChunk = { }, fromSDK(object: ResponseApplySnapshotChunkSDKType): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, refetchChunks: Array.isArray(object?.refetch_chunks) ? object.refetch_chunks.map((e: any) => e) : [], rejectSenders: Array.isArray(object?.reject_senders) ? object.reject_senders.map((e: any) => e) : [] }; @@ -4339,7 +4339,7 @@ export const Evidence = { }, fromJSON(object: any): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, @@ -4366,7 +4366,7 @@ export const Evidence = { }, fromSDK(object: EvidenceSDKType): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, validator: object.validator ? Validator.fromSDK(object.validator) : undefined, height: object?.height, time: object.time ? Timestamp.fromSDK(object.time) : undefined, diff --git a/__fixtures__/output1/tendermint/types/types.ts b/__fixtures__/output1/tendermint/types/types.ts index 08375725d4..741f0f90e8 100644 --- a/__fixtures__/output1/tendermint/types/types.ts +++ b/__fixtures__/output1/tendermint/types/types.ts @@ -863,7 +863,7 @@ export const Vote = { }, fromJSON(object: any): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, @@ -899,7 +899,7 @@ export const Vote = { }, fromSDK(object: VoteSDKType): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: object?.height, round: object?.round, blockId: object.block_id ? BlockID.fromSDK(object.block_id) : undefined, @@ -1073,7 +1073,7 @@ export const CommitSig = { }, fromJSON(object: any): CommitSig { return { - blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : -1, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() @@ -1097,7 +1097,7 @@ export const CommitSig = { }, fromSDK(object: CommitSigSDKType): CommitSig { return { - blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, + blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : 0, validatorAddress: object?.validator_address, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, signature: object?.signature @@ -1185,7 +1185,7 @@ export const Proposal = { }, fromJSON(object: any): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, polRound: isSet(object.polRound) ? Number(object.polRound) : 0, @@ -1218,7 +1218,7 @@ export const Proposal = { }, fromSDK(object: ProposalSDKType): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: object?.height, round: object?.round, polRound: object?.pol_round, diff --git a/__fixtures__/output2/akash/base/v1beta1/endpoint.ts b/__fixtures__/output2/akash/base/v1beta1/endpoint.ts index e168e1ada0..9e48df34d6 100644 --- a/__fixtures__/output2/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/output2/akash/base/v1beta1/endpoint.ts @@ -71,7 +71,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 }; }, toJSON(message: Endpoint): unknown { diff --git a/__fixtures__/output2/akash/base/v1beta2/endpoint.ts b/__fixtures__/output2/akash/base/v1beta2/endpoint.ts index 378a52e832..2c86f36889 100644 --- a/__fixtures__/output2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/output2/akash/base/v1beta2/endpoint.ts @@ -86,7 +86,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, sequenceNumber: isSet(object.sequenceNumber) ? Number(object.sequenceNumber) : 0 }; }, diff --git a/__fixtures__/output2/akash/cert/v1beta2/cert.ts b/__fixtures__/output2/akash/cert/v1beta2/cert.ts index 31c3472cc7..25487ab01e 100644 --- a/__fixtures__/output2/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/output2/akash/cert/v1beta2/cert.ts @@ -174,7 +174,7 @@ export const Certificate = { }, fromJSON(object: any): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, cert: isSet(object.cert) ? bytesFromBase64(object.cert) : new Uint8Array(), pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; diff --git a/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts index 9ce00a4a6a..f35b4c0e57 100644 --- a/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts @@ -581,7 +581,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta1/group.ts b/__fixtures__/output2/akash/deployment/v1beta1/group.ts index 3109ae0621..7cd6f19209 100644 --- a/__fixtures__/output2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/output2/akash/deployment/v1beta1/group.ts @@ -524,7 +524,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts index 751ae45ef5..060689c516 100644 --- a/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts @@ -169,7 +169,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta2/group.ts b/__fixtures__/output2/akash/deployment/v1beta2/group.ts index c4777c9b60..554e50a1e8 100644 --- a/__fixtures__/output2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/output2/akash/deployment/v1beta2/group.ts @@ -119,7 +119,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/escrow/v1beta1/types.ts b/__fixtures__/output2/akash/escrow/v1beta1/types.ts index efd88d401d..34b3684589 100644 --- a/__fixtures__/output2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/output2/akash/escrow/v1beta1/types.ts @@ -251,7 +251,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? Coin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO @@ -354,7 +354,7 @@ export const Payment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, rate: isSet(object.rate) ? Coin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined diff --git a/__fixtures__/output2/akash/escrow/v1beta2/types.ts b/__fixtures__/output2/akash/escrow/v1beta2/types.ts index 0b2c41d7ea..c06e36a1e9 100644 --- a/__fixtures__/output2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/output2/akash/escrow/v1beta2/types.ts @@ -276,7 +276,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? DecCoin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO, @@ -385,7 +385,7 @@ export const FractionalPayment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, rate: isSet(object.rate) ? DecCoin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined diff --git a/__fixtures__/output2/akash/market/v1beta2/bid.ts b/__fixtures__/output2/akash/market/v1beta2/bid.ts index e6eed1d394..48ff656f0d 100644 --- a/__fixtures__/output2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/output2/akash/market/v1beta2/bid.ts @@ -425,7 +425,7 @@ export const Bid = { fromJSON(object: any): Bid { return { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/market/v1beta2/lease.ts b/__fixtures__/output2/akash/market/v1beta2/lease.ts index 755693c6f4..1e232b84d4 100644 --- a/__fixtures__/output2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/output2/akash/market/v1beta2/lease.ts @@ -240,7 +240,7 @@ export const Lease = { fromJSON(object: any): Lease { return { leaseId: isSet(object.leaseId) ? LeaseID.fromJSON(object.leaseId) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO, closedOn: isSet(object.closedOn) ? Long.fromValue(object.closedOn) : Long.ZERO diff --git a/__fixtures__/output2/akash/market/v1beta2/order.ts b/__fixtures__/output2/akash/market/v1beta2/order.ts index 71d9aadc3e..ac56fbf7b1 100644 --- a/__fixtures__/output2/akash/market/v1beta2/order.ts +++ b/__fixtures__/output2/akash/market/v1beta2/order.ts @@ -201,7 +201,7 @@ export const Order = { fromJSON(object: any): Order { return { orderId: isSet(object.orderId) ? OrderID.fromJSON(object.orderId) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, + state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, spec: isSet(object.spec) ? GroupSpec.fromJSON(object.spec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/confio/proofs.ts b/__fixtures__/output2/confio/proofs.ts index 0f29fe01c1..00fe69ac10 100644 --- a/__fixtures__/output2/confio/proofs.ts +++ b/__fixtures__/output2/confio/proofs.ts @@ -598,10 +598,10 @@ export const LeafOp = { }, fromJSON(object: any): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : -1, - prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0, + prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, @@ -669,7 +669,7 @@ export const InnerOp = { }, fromJSON(object: any): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() }; @@ -844,7 +844,7 @@ export const InnerSpec = { minPrefixLength: isSet(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, maxPrefixLength: isSet(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 }; }, toJSON(message: InnerSpec): unknown { diff --git a/__fixtures__/output2/cosmos/gov/v1/gov.ts b/__fixtures__/output2/cosmos/gov/v1/gov.ts index 8773da30cb..c87ac67fcf 100644 --- a/__fixtures__/output2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/output2/cosmos/gov/v1/gov.ts @@ -256,7 +256,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -438,7 +438,7 @@ export const Proposal = { return { id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, diff --git a/__fixtures__/output2/cosmos/gov/v1/query.ts b/__fixtures__/output2/cosmos/gov/v1/query.ts index b53a523e84..ab324e3dd0 100644 --- a/__fixtures__/output2/cosmos/gov/v1/query.ts +++ b/__fixtures__/output2/cosmos/gov/v1/query.ts @@ -254,7 +254,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined diff --git a/__fixtures__/output2/cosmos/gov/v1/tx.ts b/__fixtures__/output2/cosmos/gov/v1/tx.ts index b34c83f4c6..420d2bbaf4 100644 --- a/__fixtures__/output2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/output2/cosmos/gov/v1/tx.ts @@ -329,7 +329,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts index bd7207e852..c61bca2e25 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts @@ -267,7 +267,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -497,7 +497,7 @@ export const Proposal = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -666,7 +666,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/query.ts b/__fixtures__/output2/cosmos/gov/v1beta1/query.ts index da8c8a22a5..ba1deb10c6 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/query.ts @@ -254,7 +254,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts index bf9105267b..ba19024926 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts @@ -212,7 +212,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 }; }, toJSON(message: MsgVote): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/events.ts b/__fixtures__/output2/cosmos/group/v1/events.ts index 4d0e157955..f58d2710ed 100644 --- a/__fixtures__/output2/cosmos/group/v1/events.ts +++ b/__fixtures__/output2/cosmos/group/v1/events.ts @@ -407,7 +407,7 @@ export const EventExec = { fromJSON(object: any): EventExec { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 }; }, toJSON(message: EventExec): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/tx.ts b/__fixtures__/output2/cosmos/group/v1/tx.ts index cfc51a7f7e..692438fe1f 100644 --- a/__fixtures__/output2/cosmos/group/v1/tx.ts +++ b/__fixtures__/output2/cosmos/group/v1/tx.ts @@ -1280,7 +1280,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], metadata: isSet(object.metadata) ? String(object.metadata) : "", messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toJSON(message: MsgSubmitProposal): unknown { @@ -1504,9 +1504,9 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "", - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 + exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 }; }, toJSON(message: MsgVote): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/types.ts b/__fixtures__/output2/cosmos/group/v1/types.ts index a57c087c3d..0e03c3dfc2 100644 --- a/__fixtures__/output2/cosmos/group/v1/types.ts +++ b/__fixtures__/output2/cosmos/group/v1/types.ts @@ -1057,11 +1057,11 @@ export const Proposal = { submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, groupVersion: isSet(object.groupVersion) ? Long.fromValue(object.groupVersion) : Long.UZERO, groupPolicyVersion: isSet(object.groupPolicyVersion) ? Long.fromValue(object.groupPolicyVersion) : Long.UZERO, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, - executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : -1, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -1244,7 +1244,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, metadata: isSet(object.metadata) ? String(object.metadata) : "", submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined }; diff --git a/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts index 8cc20a96f8..93a88349ac 100644 --- a/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts @@ -221,7 +221,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: isSet(object.id) ? Number(object.id) : 0, protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", - storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0 }; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { diff --git a/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts b/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts index a85a9a35e4..0bbb07d920 100644 --- a/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts @@ -135,7 +135,7 @@ export const StakeAuthorization = { maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, - authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0 }; }, toJSON(message: StakeAuthorization): unknown { diff --git a/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts index 3c5eca59d4..580527ecf9 100644 --- a/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts @@ -639,7 +639,7 @@ export const Validator = { operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, tokens: isSet(object.tokens) ? String(object.tokens) : "", delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "", description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, diff --git a/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts index 66d9d8bae6..0821c7012d 100644 --- a/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts @@ -333,7 +333,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() }; }, diff --git a/__fixtures__/output2/cosmos/tx/v1beta1/service.ts b/__fixtures__/output2/cosmos/tx/v1beta1/service.ts index 205cb85ef2..a50abc827e 100644 --- a/__fixtures__/output2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/output2/cosmos/tx/v1beta1/service.ts @@ -259,7 +259,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0 }; }, toJSON(message: GetTxsEventRequest): unknown { @@ -393,7 +393,7 @@ export const BroadcastTxRequest = { fromJSON(object: any): BroadcastTxRequest { return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 }; }, toJSON(message: BroadcastTxRequest): unknown { diff --git a/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts index b20d202406..9a3368ff60 100644 --- a/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts @@ -720,7 +720,7 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; }, toJSON(message: ModeInfo_Single): unknown { diff --git a/__fixtures__/output2/cosmwasm/wasm/v1/types.ts b/__fixtures__/output2/cosmwasm/wasm/v1/types.ts index 3741b6b0d9..f296c7b376 100644 --- a/__fixtures__/output2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/output2/cosmwasm/wasm/v1/types.ts @@ -204,7 +204,7 @@ export const AccessTypeParam = { }, fromJSON(object: any): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 }; }, toJSON(message: AccessTypeParam): unknown { @@ -256,7 +256,7 @@ export const AccessConfig = { }, fromJSON(object: any): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, address: isSet(object.address) ? String(object.address) : "" }; }, @@ -312,7 +312,7 @@ export const Params = { fromJSON(object: any): Params { return { codeUploadAccess: isSet(object.codeUploadAccess) ? AccessConfig.fromJSON(object.codeUploadAccess) : undefined, - instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : -1 + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : 0 }; }, toJSON(message: Params): unknown { @@ -550,7 +550,7 @@ export const ContractCodeHistoryEntry = { }, fromJSON(object: any): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO, updated: isSet(object.updated) ? AbsoluteTxPosition.fromJSON(object.updated) : undefined, msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() diff --git a/__fixtures__/output2/evmos/claims/v1/claims.ts b/__fixtures__/output2/evmos/claims/v1/claims.ts index 2f3a46c7f9..c207902efc 100644 --- a/__fixtures__/output2/evmos/claims/v1/claims.ts +++ b/__fixtures__/output2/evmos/claims/v1/claims.ts @@ -133,7 +133,7 @@ export const Claim = { }, fromJSON(object: any): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : -1, + action: isSet(object.action) ? actionFromJSON(object.action) : 0, completed: isSet(object.completed) ? Boolean(object.completed) : false, claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" }; diff --git a/__fixtures__/output2/evmos/erc20/v1/erc20.ts b/__fixtures__/output2/evmos/erc20/v1/erc20.ts index c29f48efad..f6c77203cb 100644 --- a/__fixtures__/output2/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/output2/evmos/erc20/v1/erc20.ts @@ -152,7 +152,7 @@ export const TokenPair = { erc20Address: isSet(object.erc20Address) ? String(object.erc20Address) : "", denom: isSet(object.denom) ? String(object.denom) : "", enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 + contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : 0 }; }, toJSON(message: TokenPair): unknown { diff --git a/__fixtures__/output2/google/api/backend.ts b/__fixtures__/output2/google/api/backend.ts index 6c5c105481..f8cdf17db6 100644 --- a/__fixtures__/output2/google/api/backend.ts +++ b/__fixtures__/output2/google/api/backend.ts @@ -329,7 +329,7 @@ export const BackendRule = { deadline: isSet(object.deadline) ? Number(object.deadline) : 0, minDeadline: isSet(object.minDeadline) ? Number(object.minDeadline) : 0, operationDeadline: isSet(object.operationDeadline) ? Number(object.operationDeadline) : 0, - pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : -1, + pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : 0, jwtAudience: isSet(object.jwtAudience) ? String(object.jwtAudience) : undefined, disableAuth: isSet(object.disableAuth) ? Boolean(object.disableAuth) : undefined, protocol: isSet(object.protocol) ? String(object.protocol) : "" diff --git a/__fixtures__/output2/google/api/config_change.ts b/__fixtures__/output2/google/api/config_change.ts index 46e5102258..160e3b8363 100644 --- a/__fixtures__/output2/google/api/config_change.ts +++ b/__fixtures__/output2/google/api/config_change.ts @@ -174,7 +174,7 @@ export const ConfigChange = { element: isSet(object.element) ? String(object.element) : "", oldValue: isSet(object.oldValue) ? String(object.oldValue) : "", newValue: isSet(object.newValue) ? String(object.newValue) : "", - changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : -1, + changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : 0, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/api/consumer.ts b/__fixtures__/output2/google/api/consumer.ts index 4c39f9dc4b..674dc0cd3c 100644 --- a/__fixtures__/output2/google/api/consumer.ts +++ b/__fixtures__/output2/google/api/consumer.ts @@ -194,7 +194,7 @@ export const Property = { fromJSON(object: any): Property { return { name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, description: isSet(object.description) ? String(object.description) : "" }; }, diff --git a/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts index 92abfe1ee3..c6b04992e1 100644 --- a/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -678,7 +678,7 @@ export const IssueDetails = { }, fromJSON(object: any): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, position: isSet(object.position) ? SourcePosition.fromJSON(object.position) : undefined, id: isSet(object.id) ? Long.fromValue(object.id) : Long.ZERO }; diff --git a/__fixtures__/output2/google/api/label.ts b/__fixtures__/output2/google/api/label.ts index 87a63aa5fa..41447584df 100644 --- a/__fixtures__/output2/google/api/label.ts +++ b/__fixtures__/output2/google/api/label.ts @@ -98,7 +98,7 @@ export const LabelDescriptor = { fromJSON(object: any): LabelDescriptor { return { key: isSet(object.key) ? String(object.key) : "", - valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, + valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : 0, description: isSet(object.description) ? String(object.description) : "" }; }, diff --git a/__fixtures__/output2/google/api/metric.ts b/__fixtures__/output2/google/api/metric.ts index 4f5abfce47..3f5d4193bb 100644 --- a/__fixtures__/output2/google/api/metric.ts +++ b/__fixtures__/output2/google/api/metric.ts @@ -447,13 +447,13 @@ export const MetricDescriptor = { name: isSet(object.name) ? String(object.name) : "", type: isSet(object.type) ? String(object.type) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : -1, - valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : -1, + metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : 0, + valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : 0, unit: isSet(object.unit) ? String(object.unit) : "", description: isSet(object.description) ? String(object.description) : "", displayName: isSet(object.displayName) ? String(object.displayName) : "", metadata: isSet(object.metadata) ? MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata) : undefined, - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] }; }, @@ -541,7 +541,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, samplePeriod: isSet(object.samplePeriod) ? Duration.fromJSON(object.samplePeriod) : undefined, ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined }; diff --git a/__fixtures__/output2/google/api/monitored_resource.ts b/__fixtures__/output2/google/api/monitored_resource.ts index ad7016c003..24e705948c 100644 --- a/__fixtures__/output2/google/api/monitored_resource.ts +++ b/__fixtures__/output2/google/api/monitored_resource.ts @@ -190,7 +190,7 @@ export const MonitoredResourceDescriptor = { displayName: isSet(object.displayName) ? String(object.displayName) : "", description: isSet(object.description) ? String(object.description) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0 }; }, toJSON(message: MonitoredResourceDescriptor): unknown { diff --git a/__fixtures__/output2/google/api/resource.ts b/__fixtures__/output2/google/api/resource.ts index b24e26584a..0dc3c37b6d 100644 --- a/__fixtures__/output2/google/api/resource.ts +++ b/__fixtures__/output2/google/api/resource.ts @@ -355,7 +355,7 @@ export const ResourceDescriptor = { type: isSet(object.type) ? String(object.type) : "", pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => String(e)) : [], nameField: isSet(object.nameField) ? String(object.nameField) : "", - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, plural: isSet(object.plural) ? String(object.plural) : "", singular: isSet(object.singular) ? String(object.singular) : "", style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts index 49aefba798..22115dff40 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts @@ -268,7 +268,7 @@ export const CheckError = { }, fromJSON(object: any): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, subject: isSet(object.subject) ? String(object.subject) : "", detail: isSet(object.detail) ? String(object.detail) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts index a76f31c3b9..0c0aabc937 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts @@ -294,7 +294,7 @@ export const LogEntry = { return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts b/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts index e5bb181d92..c7ee7be2e4 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts @@ -301,7 +301,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metricValueSets) ? object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)) : [], logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts index d9e32ebed7..4296797140 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts @@ -497,7 +497,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 + quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : 0 }; }, toJSON(message: QuotaOperation): unknown { @@ -672,7 +672,7 @@ export const QuotaError = { }, fromJSON(object: any): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, subject: isSet(object.subject) ? String(object.subject) : "", description: isSet(object.description) ? String(object.description) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts index ef62845db5..756b588bda 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts @@ -479,7 +479,7 @@ export const CheckResponse_ConsumerInfo = { fromJSON(object: any): CheckResponse_ConsumerInfo { return { projectNumber: isSet(object.projectNumber) ? Long.fromValue(object.projectNumber) : Long.ZERO, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, consumerNumber: isSet(object.consumerNumber) ? Long.fromValue(object.consumerNumber) : Long.ZERO }; }, diff --git a/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts b/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts index bf7b477872..543d0410a8 100644 --- a/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts @@ -611,7 +611,7 @@ export const OperationMetadata_Step = { fromJSON(object: any): OperationMetadata_Step { return { description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 }; }, toJSON(message: OperationMetadata_Step): unknown { @@ -673,7 +673,7 @@ export const Diagnostic = { fromJSON(object: any): Diagnostic { return { location: isSet(object.location) ? String(object.location) : "", - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, message: isSet(object.message) ? String(object.message) : "" }; }, @@ -798,7 +798,7 @@ export const ConfigFile = { return { filePath: isSet(object.filePath) ? String(object.filePath) : "", fileContents: isSet(object.fileContents) ? bytesFromBase64(object.fileContents) : new Uint8Array(), - fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 + fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : 0 }; }, toJSON(message: ConfigFile): unknown { @@ -986,7 +986,7 @@ export const Rollout = { rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "", createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, createdBy: isSet(object.createdBy) ? String(object.createdBy) : "", - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, trafficPercentStrategy: isSet(object.trafficPercentStrategy) ? Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy) : undefined, deleteServiceStrategy: isSet(object.deleteServiceStrategy) ? Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy) : undefined, serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" diff --git a/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts index 05e976af53..43461f68d8 100644 --- a/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts @@ -677,7 +677,7 @@ export const GetServiceConfigRequest = { return { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", configId: isSet(object.configId) ? String(object.configId) : "", - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 }; }, toJSON(message: GetServiceConfigRequest): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1/resources.ts b/__fixtures__/output2/google/api/serviceusage/v1/resources.ts index 8adb3064c5..499897245c 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1/resources.ts @@ -190,7 +190,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toJSON(message: Service): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts index 9d9e4abdc3..7456f21b04 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts @@ -365,7 +365,7 @@ export const DisableServiceRequest = { return { name: isSet(object.name) ? String(object.name) : "", disableDependentServices: isSet(object.disableDependentServices) ? Boolean(object.disableDependentServices) : false, - checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 + checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : 0 }; }, toJSON(message: DisableServiceRequest): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts index 5af46280f8..c74df49537 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts @@ -567,7 +567,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 + state: isSet(object.state) ? stateFromJSON(object.state) : 0 }; }, toJSON(message: Service): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts index 1770f21986..1a8b822158 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts @@ -944,7 +944,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: isSet(object.parent) ? String(object.parent) : "", pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: ListConsumerQuotaMetricsRequest): unknown { @@ -1062,7 +1062,7 @@ export const GetConsumerQuotaMetricRequest = { fromJSON(object: any): GetConsumerQuotaMetricRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: GetConsumerQuotaMetricRequest): unknown { @@ -1117,7 +1117,7 @@ export const GetConsumerQuotaLimitRequest = { fromJSON(object: any): GetConsumerQuotaLimitRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 }; }, toJSON(message: GetConsumerQuotaLimitRequest): unknown { @@ -2612,7 +2612,7 @@ export const GetServiceIdentityResponse = { fromJSON(object: any): GetServiceIdentityResponse { return { identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 }; }, toJSON(message: GetServiceIdentityResponse): unknown { diff --git a/__fixtures__/output2/google/logging/v2/log_entry.ts b/__fixtures__/output2/google/logging/v2/log_entry.ts index 07355f983a..4fe2acd202 100644 --- a/__fixtures__/output2/google/logging/v2/log_entry.ts +++ b/__fixtures__/output2/google/logging/v2/log_entry.ts @@ -439,7 +439,7 @@ export const LogEntry = { jsonPayload: isSet(object.jsonPayload) ? Struct.fromJSON(object.jsonPayload) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, receiveTimestamp: isSet(object.receiveTimestamp) ? fromJsonTimestamp(object.receiveTimestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, insertId: isSet(object.insertId) ? String(object.insertId) : "", httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ diff --git a/__fixtures__/output2/google/logging/v2/logging.ts b/__fixtures__/output2/google/logging/v2/logging.ts index 76e80e18db..8587a09318 100644 --- a/__fixtures__/output2/google/logging/v2/logging.ts +++ b/__fixtures__/output2/google/logging/v2/logging.ts @@ -1350,7 +1350,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 }; }, diff --git a/__fixtures__/output2/google/logging/v2/logging_config.ts b/__fixtures__/output2/google/logging/v2/logging_config.ts index 296d194da3..393e082e73 100644 --- a/__fixtures__/output2/google/logging/v2/logging_config.ts +++ b/__fixtures__/output2/google/logging/v2/logging_config.ts @@ -1391,7 +1391,7 @@ export const LogBucket = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, retentionDays: isSet(object.retentionDays) ? Number(object.retentionDays) : 0, locked: isSet(object.locked) ? Boolean(object.locked) : false, - lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : -1, + lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : 0, restrictedFields: Array.isArray(object?.restrictedFields) ? object.restrictedFields.map((e: any) => String(e)) : [], cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined }; @@ -1626,7 +1626,7 @@ export const LogSink = { description: isSet(object.description) ? String(object.description) : "", disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : -1, + outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : 0, writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "", includeChildren: isSet(object.includeChildren) ? Boolean(object.includeChildren) : false, bigqueryOptions: isSet(object.bigqueryOptions) ? BigQueryOptions.fromJSON(object.bigqueryOptions) : undefined, @@ -3752,7 +3752,7 @@ export const CopyLogEntriesMetadata = { return { startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined, endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, + state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, cancellationRequested: isSet(object.cancellationRequested) ? Boolean(object.cancellationRequested) : false, request: isSet(object.request) ? CopyLogEntriesRequest.fromJSON(object.request) : undefined, progress: isSet(object.progress) ? Number(object.progress) : 0, diff --git a/__fixtures__/output2/google/logging/v2/logging_metrics.ts b/__fixtures__/output2/google/logging/v2/logging_metrics.ts index ced50d3e99..2ed460af14 100644 --- a/__fixtures__/output2/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/output2/google/logging/v2/logging_metrics.ts @@ -438,7 +438,7 @@ export const LogMetric = { bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 }; }, toJSON(message: LogMetric): unknown { diff --git a/__fixtures__/output2/google/protobuf/api.ts b/__fixtures__/output2/google/protobuf/api.ts index 58bffad3e6..72a38d7d93 100644 --- a/__fixtures__/output2/google/protobuf/api.ts +++ b/__fixtures__/output2/google/protobuf/api.ts @@ -243,7 +243,7 @@ export const Api = { version: isSet(object.version) ? String(object.version) : "", sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Api): unknown { @@ -360,7 +360,7 @@ export const Method = { responseTypeUrl: isSet(object.responseTypeUrl) ? String(object.responseTypeUrl) : "", responseStreaming: isSet(object.responseStreaming) ? Boolean(object.responseStreaming) : false, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Method): unknown { diff --git a/__fixtures__/output2/google/protobuf/descriptor.ts b/__fixtures__/output2/google/protobuf/descriptor.ts index cb4eeccaf6..370fa31808 100644 --- a/__fixtures__/output2/google/protobuf/descriptor.ts +++ b/__fixtures__/output2/google/protobuf/descriptor.ts @@ -1728,8 +1728,8 @@ export const FieldDescriptorProto = { return { name: isSet(object.name) ? String(object.name) : "", number: isSet(object.number) ? Number(object.number) : 0, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, typeName: isSet(object.typeName) ? String(object.typeName) : "", extendee: isSet(object.extendee) ? String(object.extendee) : "", defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", @@ -2379,7 +2379,7 @@ export const FileOptions = { javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) ? Boolean(object.javaGenerateEqualsAndHash) : false, javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, - optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : -1, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 0, goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, @@ -2614,9 +2614,9 @@ export const FieldOptions = { }, fromJSON(object: any): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, packed: isSet(object.packed) ? Boolean(object.packed) : false, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, weak: isSet(object.weak) ? Boolean(object.weak) : false, @@ -2932,7 +2932,7 @@ export const MethodOptions = { fromJSON(object: any): MethodOptions { return { deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : -1, + idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/protobuf/type.ts b/__fixtures__/output2/google/protobuf/type.ts index 96a0ddeb38..6a97be6ddb 100644 --- a/__fixtures__/output2/google/protobuf/type.ts +++ b/__fixtures__/output2/google/protobuf/type.ts @@ -394,7 +394,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => String(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Type): unknown { @@ -524,8 +524,8 @@ export const Field = { }, fromJSON(object: any): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, number: isSet(object.number) ? Number(object.number) : 0, name: isSet(object.name) ? String(object.name) : "", typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", @@ -632,7 +632,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromJSON(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 }; }, toJSON(message: Enum): unknown { diff --git a/__fixtures__/output2/helpers.ts b/__fixtures__/output2/helpers.ts index 9d0f745204..674ecc2536 100644 --- a/__fixtures__/output2/helpers.ts +++ b/__fixtures__/output2/helpers.ts @@ -148,11 +148,11 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -223,22 +223,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } diff --git a/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts b/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts index 98c2712de3..c3740904b1 100644 --- a/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts +++ b/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts @@ -95,7 +95,7 @@ export const InterchainAccountPacketData = { }, fromJSON(object: any): InterchainAccountPacketData { return { - type: isSet(object.type) ? typeFromJSON(object.type) : -1, + type: isSet(object.type) ? typeFromJSON(object.type) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), memo: isSet(object.memo) ? String(object.memo) : "" }; diff --git a/__fixtures__/output2/ibc/core/channel/v1/channel.ts b/__fixtures__/output2/ibc/core/channel/v1/channel.ts index 9ad0a3452b..b518b7d3bd 100644 --- a/__fixtures__/output2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/output2/ibc/core/channel/v1/channel.ts @@ -271,8 +271,8 @@ export const Channel = { }, fromJSON(object: any): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "" @@ -374,8 +374,8 @@ export const IdentifiedChannel = { }, fromJSON(object: any): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : -1, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "", diff --git a/__fixtures__/output2/ibc/core/channel/v1/tx.ts b/__fixtures__/output2/ibc/core/channel/v1/tx.ts index fbc355b2aa..15b8dc8e13 100644 --- a/__fixtures__/output2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/output2/ibc/core/channel/v1/tx.ts @@ -1011,7 +1011,7 @@ export const MsgRecvPacketResponse = { }, fromJSON(object: any): MsgRecvPacketResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 }; }, toJSON(message: MsgRecvPacketResponse): unknown { @@ -1141,7 +1141,7 @@ export const MsgTimeoutResponse = { }, fromJSON(object: any): MsgTimeoutResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 }; }, toJSON(message: MsgTimeoutResponse): unknown { @@ -1281,7 +1281,7 @@ export const MsgTimeoutOnCloseResponse = { }, fromJSON(object: any): MsgTimeoutOnCloseResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 }; }, toJSON(message: MsgTimeoutOnCloseResponse): unknown { @@ -1411,7 +1411,7 @@ export const MsgAcknowledgementResponse = { }, fromJSON(object: any): MsgAcknowledgementResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 }; }, toJSON(message: MsgAcknowledgementResponse): unknown { diff --git a/__fixtures__/output2/ibc/core/connection/v1/connection.ts b/__fixtures__/output2/ibc/core/connection/v1/connection.ts index 46f603e410..26db271fca 100644 --- a/__fixtures__/output2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/output2/ibc/core/connection/v1/connection.ts @@ -210,7 +210,7 @@ export const ConnectionEnd = { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -307,7 +307,7 @@ export const IdentifiedConnection = { id: isSet(object.id) ? String(object.id) : "", clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : -1, + state: isSet(object.state) ? stateFromJSON(object.state) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; diff --git a/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts index 28eb8dcaae..6ad4fc87d8 100644 --- a/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -597,7 +597,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -736,7 +736,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, diff --git a/__fixtures__/output2/osmosis/claim/v1beta1/query.ts b/__fixtures__/output2/osmosis/claim/v1beta1/query.ts index 2bcb1d8db6..1bd3d91199 100644 --- a/__fixtures__/output2/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/output2/osmosis/claim/v1beta1/query.ts @@ -328,7 +328,7 @@ export const QueryClaimableForActionRequest = { fromJSON(object: any): QueryClaimableForActionRequest { return { address: isSet(object.address) ? String(object.address) : "", - action: isSet(object.action) ? actionFromJSON(object.action) : -1 + action: isSet(object.action) ? actionFromJSON(object.action) : 0 }; }, toJSON(message: QueryClaimableForActionRequest): unknown { diff --git a/__fixtures__/output2/osmosis/lockup/lock.ts b/__fixtures__/output2/osmosis/lockup/lock.ts index 2ce3ace18b..e4299597d9 100644 --- a/__fixtures__/output2/osmosis/lockup/lock.ts +++ b/__fixtures__/output2/osmosis/lockup/lock.ts @@ -265,7 +265,7 @@ export const QueryCondition = { }, fromJSON(object: any): QueryCondition { return { - lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : -1, + lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : 0, denom: isSet(object.denom) ? String(object.denom) : "", duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined diff --git a/__fixtures__/output2/osmosis/superfluid/query.ts b/__fixtures__/output2/osmosis/superfluid/query.ts index 6dc5436436..b1896fea77 100644 --- a/__fixtures__/output2/osmosis/superfluid/query.ts +++ b/__fixtures__/output2/osmosis/superfluid/query.ts @@ -270,7 +270,7 @@ export const AssetTypeResponse = { }, fromJSON(object: any): AssetTypeResponse { return { - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 }; }, toJSON(message: AssetTypeResponse): unknown { diff --git a/__fixtures__/output2/osmosis/superfluid/superfluid.ts b/__fixtures__/output2/osmosis/superfluid/superfluid.ts index bff80bbf4a..b04e3197db 100644 --- a/__fixtures__/output2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/output2/osmosis/superfluid/superfluid.ts @@ -135,7 +135,7 @@ export const SuperfluidAsset = { fromJSON(object: any): SuperfluidAsset { return { denom: isSet(object.denom) ? String(object.denom) : "", - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 }; }, toJSON(message: SuperfluidAsset): unknown { diff --git a/__fixtures__/output2/tendermint/abci/types.ts b/__fixtures__/output2/tendermint/abci/types.ts index ac25746ffa..5aa494c7cd 100644 --- a/__fixtures__/output2/tendermint/abci/types.ts +++ b/__fixtures__/output2/tendermint/abci/types.ts @@ -1158,7 +1158,7 @@ export const RequestCheckTx = { fromJSON(object: any): RequestCheckTx { return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 }; }, toJSON(message: RequestCheckTx): unknown { @@ -2672,7 +2672,7 @@ export const ResponseOfferSnapshot = { }, fromJSON(object: any): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 }; }, toJSON(message: ResponseOfferSnapshot): unknown { @@ -2785,7 +2785,7 @@ export const ResponseApplySnapshotChunk = { }, fromJSON(object: any): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, refetchChunks: Array.isArray(object?.refetchChunks) ? object.refetchChunks.map((e: any) => Number(e)) : [], rejectSenders: Array.isArray(object?.rejectSenders) ? object.rejectSenders.map((e: any) => String(e)) : [] }; @@ -3425,7 +3425,7 @@ export const Evidence = { }, fromJSON(object: any): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, diff --git a/__fixtures__/output2/tendermint/types/types.ts b/__fixtures__/output2/tendermint/types/types.ts index e3e97f1045..976860b1e4 100644 --- a/__fixtures__/output2/tendermint/types/types.ts +++ b/__fixtures__/output2/tendermint/types/types.ts @@ -681,7 +681,7 @@ export const Vote = { }, fromJSON(object: any): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, @@ -847,7 +847,7 @@ export const CommitSig = { }, fromJSON(object: any): CommitSig { return { - blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : -1, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() @@ -943,7 +943,7 @@ export const Proposal = { }, fromJSON(object: any): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, polRound: isSet(object.polRound) ? Number(object.polRound) : 0, diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.pinia.store.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.pinia.store.ts index 68c2ce0e1e..2638dce5ad 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.pinia.store.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.pinia.store.ts @@ -18,7 +18,7 @@ export const usePiniaStore = defineStore('akash/cert/v1beta2/query.proto', { } }, actions: { - async fetchCertificates(param: QueryCertificatesRequestSDKType) { + async fetchCertificates(param : QueryCertificatesRequestSDKType) { this.certificates = await this.lcdClient.certificates(param); return this.certificates; } diff --git a/__fixtures__/v-next/outputosmojs/binary.ts b/__fixtures__/v-next/outputosmojs/binary.ts index e36065aa4b..f8751d571c 100644 --- a/__fixtures__/v-next/outputosmojs/binary.ts +++ b/__fixtures__/v-next/outputosmojs/binary.ts @@ -348,12 +348,12 @@ export class BinaryWriter { (value = value >>> 0) < 128 ? 1 : value < 16384 - ? 2 - : value < 2097152 - ? 3 - : value < 268435456 - ? 4 - : 5, + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, value )).len; return this; @@ -463,10 +463,10 @@ function pool( function indexOutOfRange(reader: BinaryReader, writeLength?: number) { return RangeError( "index out of range: " + - reader.pos + - " + " + - (writeLength || 1) + - " > " + - reader.len + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len ); } diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.pinia.store.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.pinia.store.ts index 8949ba1a68..47e7006eac 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.pinia.store.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.pinia.store.ts @@ -21,15 +21,15 @@ export const usePiniaStore = defineStore('evmos/erc20/v1/query.proto', { } }, actions: { - async fetchTokenPairs(param: QueryTokenPairsRequestSDKType) { + async fetchTokenPairs(param : QueryTokenPairsRequestSDKType) { this.tokenPairs = await this.lcdClient.tokenPairs(param); return this.tokenPairs; }, - async fetchTokenPair(param: QueryTokenPairRequestSDKType) { + async fetchTokenPair(param : QueryTokenPairRequestSDKType) { this.tokenPair = await this.lcdClient.tokenPair(param); return this.tokenPair; }, - async fetchParams(param: QueryParamsRequestSDKType) { + async fetchParams(param : QueryParamsRequestSDKType) { this.params = await this.lcdClient.params(param); return this.params; } diff --git a/__fixtures__/v-next/outputosmojs/helpers.ts b/__fixtures__/v-next/outputosmojs/helpers.ts index 7bfab7552c..f92d2b935a 100644 --- a/__fixtures__/v-next/outputosmojs/helpers.ts +++ b/__fixtures__/v-next/outputosmojs/helpers.ts @@ -182,9 +182,9 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record< - Exclude>, - never - >; + Exclude>, + never + >; export interface Rpc { request( diff --git a/__fixtures__/v-next/outputosmojs/index.ts b/__fixtures__/v-next/outputosmojs/index.ts index dc53658195..3c5f68131c 100644 --- a/__fixtures__/v-next/outputosmojs/index.ts +++ b/__fixtures__/v-next/outputosmojs/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.pinia.store.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.pinia.store.ts index 1d793b645e..ec9c29e017 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.pinia.store.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.pinia.store.ts @@ -34,63 +34,63 @@ export const usePiniaStore = defineStore('osmosis/gamm/v1beta1/query.proto', { } }, actions: { - async fetchPools(param: QueryPoolsRequestSDKType) { + async fetchPools(param : QueryPoolsRequestSDKType) { this.pools = await this.lcdClient.pools(param); return this.pools; }, - async fetchNumPools(param: QueryNumPoolsRequestSDKType) { + async fetchNumPools(param : QueryNumPoolsRequestSDKType) { this.numPools = await this.lcdClient.numPools(param); return this.numPools; }, - async fetchTotalLiquidity(param: QueryTotalLiquidityRequestSDKType) { + async fetchTotalLiquidity(param : QueryTotalLiquidityRequestSDKType) { this.totalLiquidity = await this.lcdClient.totalLiquidity(param); return this.totalLiquidity; }, - async fetchPoolsWithFilter(param: QueryPoolsWithFilterRequestSDKType) { + async fetchPoolsWithFilter(param : QueryPoolsWithFilterRequestSDKType) { this.poolsWithFilter = await this.lcdClient.poolsWithFilter(param); return this.poolsWithFilter; }, - async fetchPool(param: QueryPoolRequestSDKType) { + async fetchPool(param : QueryPoolRequestSDKType) { this.pool = await this.lcdClient.pool(param); return this.pool; }, - async fetchPoolType(param: QueryPoolTypeRequestSDKType) { + async fetchPoolType(param : QueryPoolTypeRequestSDKType) { this.poolType = await this.lcdClient.poolType(param); return this.poolType; }, - async fetchCalcJoinPoolNoSwapShares(param: QueryCalcJoinPoolNoSwapSharesRequestSDKType) { + async fetchCalcJoinPoolNoSwapShares(param : QueryCalcJoinPoolNoSwapSharesRequestSDKType) { this.calcJoinPoolNoSwapShares = await this.lcdClient.calcJoinPoolNoSwapShares(param); return this.calcJoinPoolNoSwapShares; }, - async fetchCalcJoinPoolShares(param: QueryCalcJoinPoolSharesRequestSDKType) { + async fetchCalcJoinPoolShares(param : QueryCalcJoinPoolSharesRequestSDKType) { this.calcJoinPoolShares = await this.lcdClient.calcJoinPoolShares(param); return this.calcJoinPoolShares; }, - async fetchCalcExitPoolCoinsFromShares(param: QueryCalcExitPoolCoinsFromSharesRequestSDKType) { + async fetchCalcExitPoolCoinsFromShares(param : QueryCalcExitPoolCoinsFromSharesRequestSDKType) { this.calcExitPoolCoinsFromShares = await this.lcdClient.calcExitPoolCoinsFromShares(param); return this.calcExitPoolCoinsFromShares; }, - async fetchPoolParams(param: QueryPoolParamsRequestSDKType) { + async fetchPoolParams(param : QueryPoolParamsRequestSDKType) { this.poolParams = await this.lcdClient.poolParams(param); return this.poolParams; }, - async fetchTotalPoolLiquidity(param: QueryTotalPoolLiquidityRequestSDKType) { + async fetchTotalPoolLiquidity(param : QueryTotalPoolLiquidityRequestSDKType) { this.totalPoolLiquidity = await this.lcdClient.totalPoolLiquidity(param); return this.totalPoolLiquidity; }, - async fetchTotalShares(param: QueryTotalSharesRequestSDKType) { + async fetchTotalShares(param : QueryTotalSharesRequestSDKType) { this.totalShares = await this.lcdClient.totalShares(param); return this.totalShares; }, - async fetchSpotPrice(param: QuerySpotPriceRequestSDKType) { + async fetchSpotPrice(param : QuerySpotPriceRequestSDKType) { this.spotPrice = await this.lcdClient.spotPrice(param); return this.spotPrice; }, - async fetchEstimateSwapExactAmountIn(param: QuerySwapExactAmountInRequestSDKType) { + async fetchEstimateSwapExactAmountIn(param : QuerySwapExactAmountInRequestSDKType) { this.estimateSwapExactAmountIn = await this.lcdClient.estimateSwapExactAmountIn(param); return this.estimateSwapExactAmountIn; }, - async fetchEstimateSwapExactAmountOut(param: QuerySwapExactAmountOutRequestSDKType) { + async fetchEstimateSwapExactAmountOut(param : QuerySwapExactAmountOutRequestSDKType) { this.estimateSwapExactAmountOut = await this.lcdClient.estimateSwapExactAmountOut(param); return this.estimateSwapExactAmountOut; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.pinia.store.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.pinia.store.ts index 0953a7c89e..8ccee9dc1f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.pinia.store.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.pinia.store.ts @@ -16,7 +16,7 @@ export const usePiniaStore = defineStore('osmosis/gamm/v2/query.proto', { } }, actions: { - async fetchSpotPrice(param: QuerySpotPriceRequestSDKType) { + async fetchSpotPrice(param : QuerySpotPriceRequestSDKType) { this.spotPrice = await this.lcdClient.spotPrice(param); return this.spotPrice; } diff --git a/__fixtures__/v-next/outputosmojs/varint.ts b/__fixtures__/v-next/outputosmojs/varint.ts index ae2e63b3b2..a83418dbc0 100644 --- a/__fixtures__/v-next/outputosmojs/varint.ts +++ b/__fixtures__/v-next/outputosmojs/varint.ts @@ -454,18 +454,18 @@ export function int64Length(lo: number, hi: number) { ? 1 : 2 : part0 < 2097152 - ? 3 - : 4 + ? 3 + : 4 : part1 < 16384 - ? part1 < 128 - ? 5 - : 6 - : part1 < 2097152 - ? 7 - : 8 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 : part2 < 128 - ? 9 - : 10; + ? 9 + : 10; } export function writeFixed32( diff --git a/__fixtures__/v-next/outputv2/helpers.ts b/__fixtures__/v-next/outputv2/helpers.ts index 8658b32ada..53124a848b 100644 --- a/__fixtures__/v-next/outputv2/helpers.ts +++ b/__fixtures__/v-next/outputv2/helpers.ts @@ -146,11 +146,11 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -221,22 +221,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } diff --git a/__fixtures__/v-next/outputv2/index.ts b/__fixtures__/v-next/outputv2/index.ts index 54aac3212c..86bee137e0 100644 --- a/__fixtures__/v-next/outputv2/index.ts +++ b/__fixtures__/v-next/outputv2/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/v-next/outputv3/grpc-gateway.ts b/__fixtures__/v-next/outputv3/grpc-gateway.ts index 9a1da6a8ef..a7d79a8b24 100644 --- a/__fixtures__/v-next/outputv3/grpc-gateway.ts +++ b/__fixtures__/v-next/outputv3/grpc-gateway.ts @@ -18,10 +18,10 @@ const s64 = new Array(123); // 65..90, 97..122, 48..57, 43, 47 for (let i = 0; i < 64;) - s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; + s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; export function b64Encode(buffer: Uint8Array, start: number, end: number): string { - let parts: string[] = null; + let parts: string[] = null; const chunk = []; let i = 0, // output index j = 0, // goto index @@ -67,16 +67,16 @@ export function b64Encode(buffer: Uint8Array, start: number, end: number): strin const invalidEncoding = "invalid encoding"; export function b64Decode(s: string): Uint8Array { - const buffer = []; - let offset = 0; + const buffer = []; + let offset = 0; let j = 0, // goto index - t; // temporary + t; // temporary for (let i = 0; i < s.length;) { let c = s.charCodeAt(i++); if (c === 61 && j > 1) - break; + break; if ((c = s64[c]) === undefined) - throw Error(invalidEncoding); + throw Error(invalidEncoding); switch (j) { case 0: t = c; @@ -99,12 +99,12 @@ export function b64Decode(s: string): Uint8Array { } } if (j === 1) - throw Error(invalidEncoding); + throw Error(invalidEncoding); return new Uint8Array(buffer); } function b64Test(s: string): boolean { - return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s); + return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s); } export interface InitReq extends RequestInit { @@ -112,7 +112,7 @@ export interface InitReq extends RequestInit { } export function replacer(key: any, value: any): any { - if (value && value.constructor === Uint8Array) { + if(value && value.constructor === Uint8Array) { return b64Encode(value, 0, value.length); } @@ -120,7 +120,7 @@ export function replacer(key: any, value: any): any { } export function fetchReq(path: string, init?: InitReq): Promise { - const { pathPrefix, ...req } = init || {} + const {pathPrefix, ...req} = init || {} const url = pathPrefix ? `${pathPrefix}${path}` : path @@ -139,7 +139,7 @@ export type NotifyStreamEntityArrival = (resp: T) => void * all entities will be returned as an array after the call finishes. **/ export async function fetchStreamingRequest(path: string, callback?: NotifyStreamEntityArrival, init?: InitReq) { - const { pathPrefix, ...req } = init || {} + const {pathPrefix, ...req} = init || {} const url = pathPrefix ? `${pathPrefix}${path}` : path const result = await fetch(url, req) // needs to use the .ok to check the status of HTTP status code diff --git a/__fixtures__/v-next/outputv3/helpers.ts b/__fixtures__/v-next/outputv3/helpers.ts index 8658b32ada..53124a848b 100644 --- a/__fixtures__/v-next/outputv3/helpers.ts +++ b/__fixtures__/v-next/outputv3/helpers.ts @@ -146,11 +146,11 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -221,22 +221,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } diff --git a/__fixtures__/v-next/outputv3/index.ts b/__fixtures__/v-next/outputv3/index.ts index 37c43a6886..a9b781e874 100644 --- a/__fixtures__/v-next/outputv3/index.ts +++ b/__fixtures__/v-next/outputv3/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.pinia.store.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.pinia.store.ts index 68c2ce0e1e..2638dce5ad 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.pinia.store.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.pinia.store.ts @@ -18,7 +18,7 @@ export const usePiniaStore = defineStore('akash/cert/v1beta2/query.proto', { } }, actions: { - async fetchCertificates(param: QueryCertificatesRequestSDKType) { + async fetchCertificates(param : QueryCertificatesRequestSDKType) { this.certificates = await this.lcdClient.certificates(param); return this.certificates; } diff --git a/__fixtures__/v-next/outputv4/binary.ts b/__fixtures__/v-next/outputv4/binary.ts index e36065aa4b..f8751d571c 100644 --- a/__fixtures__/v-next/outputv4/binary.ts +++ b/__fixtures__/v-next/outputv4/binary.ts @@ -348,12 +348,12 @@ export class BinaryWriter { (value = value >>> 0) < 128 ? 1 : value < 16384 - ? 2 - : value < 2097152 - ? 3 - : value < 268435456 - ? 4 - : 5, + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, value )).len; return this; @@ -463,10 +463,10 @@ function pool( function indexOutOfRange(reader: BinaryReader, writeLength?: number) { return RangeError( "index out of range: " + - reader.pos + - " + " + - (writeLength || 1) + - " > " + - reader.len + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len ); } diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.pinia.store.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.pinia.store.ts index 8949ba1a68..47e7006eac 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.pinia.store.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.pinia.store.ts @@ -21,15 +21,15 @@ export const usePiniaStore = defineStore('evmos/erc20/v1/query.proto', { } }, actions: { - async fetchTokenPairs(param: QueryTokenPairsRequestSDKType) { + async fetchTokenPairs(param : QueryTokenPairsRequestSDKType) { this.tokenPairs = await this.lcdClient.tokenPairs(param); return this.tokenPairs; }, - async fetchTokenPair(param: QueryTokenPairRequestSDKType) { + async fetchTokenPair(param : QueryTokenPairRequestSDKType) { this.tokenPair = await this.lcdClient.tokenPair(param); return this.tokenPair; }, - async fetchParams(param: QueryParamsRequestSDKType) { + async fetchParams(param : QueryParamsRequestSDKType) { this.params = await this.lcdClient.params(param); return this.params; } diff --git a/__fixtures__/v-next/outputv4/helpers.ts b/__fixtures__/v-next/outputv4/helpers.ts index 7bfab7552c..f92d2b935a 100644 --- a/__fixtures__/v-next/outputv4/helpers.ts +++ b/__fixtures__/v-next/outputv4/helpers.ts @@ -182,9 +182,9 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record< - Exclude>, - never - >; + Exclude>, + never + >; export interface Rpc { request( diff --git a/__fixtures__/v-next/outputv4/index.ts b/__fixtures__/v-next/outputv4/index.ts index 81735d4a8c..3424ed57e4 100644 --- a/__fixtures__/v-next/outputv4/index.ts +++ b/__fixtures__/v-next/outputv4/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.pinia.store.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.pinia.store.ts index 1d793b645e..ec9c29e017 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.pinia.store.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.pinia.store.ts @@ -34,63 +34,63 @@ export const usePiniaStore = defineStore('osmosis/gamm/v1beta1/query.proto', { } }, actions: { - async fetchPools(param: QueryPoolsRequestSDKType) { + async fetchPools(param : QueryPoolsRequestSDKType) { this.pools = await this.lcdClient.pools(param); return this.pools; }, - async fetchNumPools(param: QueryNumPoolsRequestSDKType) { + async fetchNumPools(param : QueryNumPoolsRequestSDKType) { this.numPools = await this.lcdClient.numPools(param); return this.numPools; }, - async fetchTotalLiquidity(param: QueryTotalLiquidityRequestSDKType) { + async fetchTotalLiquidity(param : QueryTotalLiquidityRequestSDKType) { this.totalLiquidity = await this.lcdClient.totalLiquidity(param); return this.totalLiquidity; }, - async fetchPoolsWithFilter(param: QueryPoolsWithFilterRequestSDKType) { + async fetchPoolsWithFilter(param : QueryPoolsWithFilterRequestSDKType) { this.poolsWithFilter = await this.lcdClient.poolsWithFilter(param); return this.poolsWithFilter; }, - async fetchPool(param: QueryPoolRequestSDKType) { + async fetchPool(param : QueryPoolRequestSDKType) { this.pool = await this.lcdClient.pool(param); return this.pool; }, - async fetchPoolType(param: QueryPoolTypeRequestSDKType) { + async fetchPoolType(param : QueryPoolTypeRequestSDKType) { this.poolType = await this.lcdClient.poolType(param); return this.poolType; }, - async fetchCalcJoinPoolNoSwapShares(param: QueryCalcJoinPoolNoSwapSharesRequestSDKType) { + async fetchCalcJoinPoolNoSwapShares(param : QueryCalcJoinPoolNoSwapSharesRequestSDKType) { this.calcJoinPoolNoSwapShares = await this.lcdClient.calcJoinPoolNoSwapShares(param); return this.calcJoinPoolNoSwapShares; }, - async fetchCalcJoinPoolShares(param: QueryCalcJoinPoolSharesRequestSDKType) { + async fetchCalcJoinPoolShares(param : QueryCalcJoinPoolSharesRequestSDKType) { this.calcJoinPoolShares = await this.lcdClient.calcJoinPoolShares(param); return this.calcJoinPoolShares; }, - async fetchCalcExitPoolCoinsFromShares(param: QueryCalcExitPoolCoinsFromSharesRequestSDKType) { + async fetchCalcExitPoolCoinsFromShares(param : QueryCalcExitPoolCoinsFromSharesRequestSDKType) { this.calcExitPoolCoinsFromShares = await this.lcdClient.calcExitPoolCoinsFromShares(param); return this.calcExitPoolCoinsFromShares; }, - async fetchPoolParams(param: QueryPoolParamsRequestSDKType) { + async fetchPoolParams(param : QueryPoolParamsRequestSDKType) { this.poolParams = await this.lcdClient.poolParams(param); return this.poolParams; }, - async fetchTotalPoolLiquidity(param: QueryTotalPoolLiquidityRequestSDKType) { + async fetchTotalPoolLiquidity(param : QueryTotalPoolLiquidityRequestSDKType) { this.totalPoolLiquidity = await this.lcdClient.totalPoolLiquidity(param); return this.totalPoolLiquidity; }, - async fetchTotalShares(param: QueryTotalSharesRequestSDKType) { + async fetchTotalShares(param : QueryTotalSharesRequestSDKType) { this.totalShares = await this.lcdClient.totalShares(param); return this.totalShares; }, - async fetchSpotPrice(param: QuerySpotPriceRequestSDKType) { + async fetchSpotPrice(param : QuerySpotPriceRequestSDKType) { this.spotPrice = await this.lcdClient.spotPrice(param); return this.spotPrice; }, - async fetchEstimateSwapExactAmountIn(param: QuerySwapExactAmountInRequestSDKType) { + async fetchEstimateSwapExactAmountIn(param : QuerySwapExactAmountInRequestSDKType) { this.estimateSwapExactAmountIn = await this.lcdClient.estimateSwapExactAmountIn(param); return this.estimateSwapExactAmountIn; }, - async fetchEstimateSwapExactAmountOut(param: QuerySwapExactAmountOutRequestSDKType) { + async fetchEstimateSwapExactAmountOut(param : QuerySwapExactAmountOutRequestSDKType) { this.estimateSwapExactAmountOut = await this.lcdClient.estimateSwapExactAmountOut(param); return this.estimateSwapExactAmountOut; } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.pinia.store.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.pinia.store.ts index 0953a7c89e..8ccee9dc1f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.pinia.store.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.pinia.store.ts @@ -16,7 +16,7 @@ export const usePiniaStore = defineStore('osmosis/gamm/v2/query.proto', { } }, actions: { - async fetchSpotPrice(param: QuerySpotPriceRequestSDKType) { + async fetchSpotPrice(param : QuerySpotPriceRequestSDKType) { this.spotPrice = await this.lcdClient.spotPrice(param); return this.spotPrice; } diff --git a/__fixtures__/v-next/outputv4/varint.ts b/__fixtures__/v-next/outputv4/varint.ts index ae2e63b3b2..a83418dbc0 100644 --- a/__fixtures__/v-next/outputv4/varint.ts +++ b/__fixtures__/v-next/outputv4/varint.ts @@ -454,18 +454,18 @@ export function int64Length(lo: number, hi: number) { ? 1 : 2 : part0 < 2097152 - ? 3 - : 4 + ? 3 + : 4 : part1 < 16384 - ? part1 < 128 - ? 5 - : 6 - : part1 < 2097152 - ? 7 - : 8 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 : part2 < 128 - ? 9 - : 10; + ? 9 + : 10; } export function writeFixed32( diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index 49b4e7c95b..0ec1188c9c 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -258,7 +258,7 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` return { address: isSet(object.address) ? String(object.address) : "", signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() }; }, @@ -282,7 +282,7 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` return { address: object?.address, signDoc: object.sign_doc ? SignDocDirectAux.fromSDK(object.sign_doc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, sig: object?.sig }; }, @@ -1929,7 +1929,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", @@ -1994,7 +1994,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` return { name: object?.name, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, trace: object?.trace, insertId: object?.insert_id, @@ -2163,7 +2163,7 @@ exports[`ibc/core/port/v1/query 1`] = ` return { portId: isSet(object.portId) ? String(object.portId) : "", connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, proposedVersion: isSet(object.proposedVersion) ? String(object.proposedVersion) : "" }; @@ -2190,7 +2190,7 @@ exports[`ibc/core/port/v1/query 1`] = ` return { portId: object?.port_id, connectionId: object?.connection_id, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, proposedVersion: object?.proposed_version }; diff --git a/packages/ast/src/encoding/proto/from-amino/utils.ts b/packages/ast/src/encoding/proto/from-amino/utils.ts index e064e1b622..99db5d35e3 100644 --- a/packages/ast/src/encoding/proto/from-amino/utils.ts +++ b/packages/ast/src/encoding/proto/from-amino/utils.ts @@ -300,6 +300,10 @@ export const fromAminoJSON = { origName } = getFieldNames(args.field); + const env = args.context.pluginValue( + 'env' + ); + args.context.addUtil('isSet'); const fromAminoJSONFuncName = args.context.getFromEnum(args.field); @@ -324,7 +328,7 @@ export const fromAminoJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(-1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-json/utils.ts b/packages/ast/src/encoding/proto/from-json/utils.ts index 278cc9d16d..386ab2898d 100644 --- a/packages/ast/src/encoding/proto/from-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-json/utils.ts @@ -215,6 +215,9 @@ export const fromJSON = { // mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, enum(args: FromJSONMethod) { const { messageProp, objProp } = getPropNames(args.field); + const env = args.context.pluginValue( + 'env' + ); args.context.addUtil('isSet'); const fromJSONFuncName = args.context.getFromEnum(args.field); @@ -239,7 +242,7 @@ export const fromJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(-1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) ) ); }, @@ -330,7 +333,7 @@ export const fromJSON = { const env = args.context.pluginValue( 'env' ); - if (env == 'default') { + if (!env || env == 'default') { timestampFormat = 'timestamp'; } switch (timestampFormat) { diff --git a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts index e95c73d2eb..8a9d695a6e 100644 --- a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts @@ -149,6 +149,9 @@ export const fromSDKJSON = { enum(args: FromSDKJSONMethod) { const { origName } = getFieldNames(args.field); args.context.addUtil('isSet'); + const env = args.context.pluginValue( + 'env' + ); const fromSDKJSONFuncName = args.context.getFromEnum(args.field); return t.objectProperty( @@ -160,7 +163,7 @@ export const fromSDKJSON = { t.callExpression(t.identifier(fromSDKJSONFuncName), [ t.memberExpression(t.identifier('object'), t.identifier(origName)) ]), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(-1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-sdk/utils.ts b/packages/ast/src/encoding/proto/from-sdk/utils.ts index 5efbb93867..a5363fc9ab 100644 --- a/packages/ast/src/encoding/proto/from-sdk/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk/utils.ts @@ -107,6 +107,9 @@ export const fromSDK = { propName, origName } = getFieldNames(args.field); + const env = args.context.pluginValue( + 'env' + ); args.context.addUtil('isSet'); const fromSDKFuncName = args.context.getFromEnum(args.field); @@ -132,7 +135,7 @@ export const fromSDK = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(-1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) ) ); }, @@ -152,7 +155,7 @@ export const fromSDK = { const env = args.context.pluginValue( 'env' ); - if(env == 'default'){ + if(!env || env == 'default'){ timestampFormat = 'timestamp'; } switch (timestampFormat) { diff --git a/packages/ast/src/encoding/proto/to-sdk/utils.ts b/packages/ast/src/encoding/proto/to-sdk/utils.ts index aae448ebc8..9ba6d126e5 100644 --- a/packages/ast/src/encoding/proto/to-sdk/utils.ts +++ b/packages/ast/src/encoding/proto/to-sdk/utils.ts @@ -156,7 +156,7 @@ export const toSDK = { const env = args.context.pluginValue( 'env' ); - if(env == 'default'){ + if(!env || env == 'default'){ timestampFormat = 'timestamp'; } switch (timestampFormat) { diff --git a/packages/ast/types/src/bundle/bundle.d.ts b/packages/ast/types/src/bundle/bundle.d.ts index aaa575ae26..448c0b4ba0 100644 --- a/packages/ast/types/src/bundle/bundle.d.ts +++ b/packages/ast/types/src/bundle/bundle.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { TelescopeOptions } from '@cosmology/types'; export declare const recursiveModuleBundle: (options: TelescopeOptions, obj: any) => any; export declare const recursiveOtherNameSpaces: (objs: any) => t.ObjectProperty[]; export declare const importNamespace: (ident: string, path: string) => t.ImportDeclaration; diff --git a/packages/ast/types/src/clients/lcd/class/lcd.d.ts b/packages/ast/types/src/clients/lcd/class/lcd.d.ts index 2c76dc09af..524adfa8da 100644 --- a/packages/ast/types/src/clients/lcd/class/lcd.d.ts +++ b/packages/ast/types/src/clients/lcd/class/lcd.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoService, ProtoServiceMethodInfo } from '@cosmology/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../../encoding'; export declare const getUrlTemplateString: (url: string) => { strs: any[]; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts index 1b80f56ad1..e8b78ff9f4 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts @@ -1,4 +1,3 @@ import { GenericParseContext } from '../../../../encoding'; -import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGRPCGatewayMsgClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts index 2f748a0a43..5809185f39 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts @@ -1,5 +1,4 @@ import { GenericParseContext } from '../../../../encoding'; -import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGRPCGatewayQueryClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGRPCGatewayWrapperClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts index 0d7799fef3..5898f8e2f1 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts @@ -1,5 +1,4 @@ import { GenericParseContext } from '../../../../encoding'; -import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGrpcWebMsgInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGrpcWebMsgClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts index f00d8d5964..a802f8d2e1 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts @@ -1,5 +1,4 @@ import { GenericParseContext } from "../../../../encoding"; -import { ProtoService } from "@cosmology/types"; import * as t from '@babel/types'; export declare const createGrpcWebQueryInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGrpcWebQueryClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts b/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts index 47036c7033..383dfa138c 100644 --- a/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts +++ b/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../../../encoding'; export declare const createRpcClientInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const getRpcClassName: (service: ProtoService) => string; diff --git a/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts b/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts index 89c1f060e5..d48c9148f1 100644 --- a/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts +++ b/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts @@ -1,6 +1,5 @@ -import { ProtoServiceMethod } from '@cosmology/types'; import * as t from '@babel/types'; -export declare const processRpcComment: (e: ProtoServiceMethod) => string; +export declare const processRpcComment: (e: ProtoServiceMethod) => any; export declare const cleanType: (ResponseType: string) => string; export declare const returnReponseType: (ResponseType: string) => t.TSTypeAnnotation; export declare const optionalBool: (hasParams: boolean, fieldNames: string[]) => boolean; diff --git a/packages/ast/types/src/clients/rpc/extension/extension.d.ts b/packages/ast/types/src/clients/rpc/extension/extension.d.ts index 75d8970f6d..aa19aadbc9 100644 --- a/packages/ast/types/src/clients/rpc/extension/extension.d.ts +++ b/packages/ast/types/src/clients/rpc/extension/extension.d.ts @@ -1,4 +1,3 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../../encoding'; export declare const createRpcQueryExtension: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/docs/rpc-clients.d.ts b/packages/ast/types/src/docs/rpc-clients.d.ts index 0aea007d5f..daa6dc3451 100644 --- a/packages/ast/types/src/docs/rpc-clients.d.ts +++ b/packages/ast/types/src/docs/rpc-clients.d.ts @@ -15,4 +15,4 @@ interface DocumentService { } export declare const documentRpcClients: (context: ProtoParseContext, myBase: string, store: ProtoStore) => DocumentRpcClient[]; export declare const documentRpcClientsReadme: (context: ProtoParseContext, myBase: string, store: ProtoStore) => string; -export { }; +export {}; diff --git a/packages/ast/types/src/encoding/amino/converter/index.d.ts b/packages/ast/types/src/encoding/amino/converter/index.d.ts index b0ecfe5919..ed7c453df5 100644 --- a/packages/ast/types/src/encoding/amino/converter/index.d.ts +++ b/packages/ast/types/src/encoding/amino/converter/index.d.ts @@ -14,4 +14,4 @@ interface AminoConverterParams { protos: ProtoType[]; } export declare const createAminoConverter: ({ name, root, context, protos }: AminoConverterParams) => t.ExportNamedDeclaration; -export { }; +export {}; diff --git a/packages/ast/types/src/encoding/amino/from-amino-json/index.d.ts b/packages/ast/types/src/encoding/amino/from-amino-json/index.d.ts index a6219788f4..26afc0a66a 100644 --- a/packages/ast/types/src/encoding/amino/from-amino-json/index.d.ts +++ b/packages/ast/types/src/encoding/amino/from-amino-json/index.d.ts @@ -16,4 +16,4 @@ interface fromAminoJSON { proto: ProtoType; } export declare const fromAminoJsonMethod: ({ context, proto }: fromAminoJSON) => t.ArrowFunctionExpression; -export { }; +export {}; diff --git a/packages/ast/types/src/encoding/amino/to-amino-json/index.d.ts b/packages/ast/types/src/encoding/amino/to-amino-json/index.d.ts index 50b983e296..98accb3193 100644 --- a/packages/ast/types/src/encoding/amino/to-amino-json/index.d.ts +++ b/packages/ast/types/src/encoding/amino/to-amino-json/index.d.ts @@ -16,4 +16,4 @@ interface toAminoJSON { proto: ProtoType; } export declare const toAminoJsonMethod: ({ context, proto }: toAminoJSON) => t.ArrowFunctionExpression; -export { }; +export {}; diff --git a/packages/ast/types/src/encoding/amino/utils.d.ts b/packages/ast/types/src/encoding/amino/utils.d.ts index c0c9576e6e..1515a8692c 100644 --- a/packages/ast/types/src/encoding/amino/utils.d.ts +++ b/packages/ast/types/src/encoding/amino/utils.d.ts @@ -1,39 +1,7 @@ -import { ProtoAny, ProtoRoot, ProtoType } from '@cosmology/types'; +import { ProtoAny, ProtoType } from '@cosmology/types'; import { GenericParseContext } from '../context'; export declare const getTypeUrlWithPkgAndName: (pkg: string, name: string) => string; export declare const getTypeUrl: (root: ProtoRoot, proto: ProtoAny | ProtoType) => string; export declare const arrayTypeNDim: (body: any, n: any) => any; export declare const getAminoTypeName: (context: GenericParseContext, root: ProtoRoot, proto: ProtoType) => any; -export declare const protoFieldsToArray: (proto: ProtoType) => { - type?: string; - name: string; - scope?: string[]; - parsedType?: { - name: string; - type: string; - }; - message?: string; - package?: string; - keyType?: string; - rule?: string; - id: number; - options: { - [key: string]: any; - deprecated?: boolean; - json_name?: string; - "(cosmos_proto.json_tag)"?: string; - "(cosmos_proto.accepts_interface)"?: string; - "(cosmos_proto.scalar)"?: string; - "(telescope:name)"?: string; - "(telescope:orig)"?: string; - "(telescope:camel)"?: string; - "(gogoproto.casttype)"?: string; - "(gogoproto.customtype)"?: string; - "(gogoproto.moretags)"?: string; - "(gogoproto.nullable)"?: boolean; - }; - comment?: string; - import?: string; - importedName?: string; - scopeType?: string; -}[]; +export declare const protoFieldsToArray: (proto: ProtoType) => any[]; diff --git a/packages/ast/types/src/encoding/context.d.ts b/packages/ast/types/src/encoding/context.d.ts index f084c53744..405e11c06a 100644 --- a/packages/ast/types/src/encoding/context.d.ts +++ b/packages/ast/types/src/encoding/context.d.ts @@ -26,20 +26,20 @@ export declare class GenericParseContext implements ParseContext { ref: ProtoRef; constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions); pluginValue(name: any): any; - isExcluded(): boolean; + isExcluded(): any; addUtil(util: any): void; addImport(imp: ImportUsage): void; addImportDerivative(imp: DerivativeImport): void; getTypeNameFromFieldName(name: string, importSrc: string): string; getTypeName(field: ProtoField): string; - lookupTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): import("@cosmology/proto-parser").Lookup; + lookupTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): any; getTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): any; } export declare class AminoParseContext extends GenericParseContext implements ParseContext { aminoCasingFn: Function; constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions); private setAminoCasingFn; - aminoCaseField(field: ProtoField): string; + aminoCaseField(field: ProtoField): any; lookupEnumFromJson(field: ProtoField, currentProtoPath: string): string; lookupEnumToJson(field: ProtoField, currentProtoPath: string): string; } @@ -48,4 +48,4 @@ export declare class ProtoParseContext extends GenericParseContext implements Pa getToEnum(field: ProtoField): string; getFromEnum(field: ProtoField): string; } -export { }; +export {}; diff --git a/packages/ast/types/src/encoding/object.d.ts b/packages/ast/types/src/encoding/object.d.ts index 69742be086..c256a158d6 100644 --- a/packages/ast/types/src/encoding/object.d.ts +++ b/packages/ast/types/src/encoding/object.d.ts @@ -1,4 +1,3 @@ import * as t from '@babel/types'; -import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from './context'; export declare const createObjectWithMethods: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/decode/index.d.ts b/packages/ast/types/src/encoding/proto/decode/index.d.ts index c2da82b568..c287337459 100644 --- a/packages/ast/types/src/encoding/proto/decode/index.d.ts +++ b/packages/ast/types/src/encoding/proto/decode/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; export interface DecodeMethod { typeName: string; context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/encode/index.d.ts b/packages/ast/types/src/encoding/proto/encode/index.d.ts index 19c5424a45..2ced13c57e 100644 --- a/packages/ast/types/src/encoding/proto/encode/index.d.ts +++ b/packages/ast/types/src/encoding/proto/encode/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface EncodeMethod { typeName: string; diff --git a/packages/ast/types/src/encoding/proto/enums.d.ts b/packages/ast/types/src/encoding/proto/enums.d.ts index 413d56d1aa..960cb01553 100644 --- a/packages/ast/types/src/encoding/proto/enums.d.ts +++ b/packages/ast/types/src/encoding/proto/enums.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoEnum } from '@cosmology/types'; import { ProtoParseContext } from '../context'; export declare const createProtoEnum: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; export declare const createProtoEnumFromJSON: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/from-amino/index.d.ts b/packages/ast/types/src/encoding/proto/from-amino/index.d.ts index 3cb26eec9e..31d61fe635 100644 --- a/packages/ast/types/src/encoding/proto/from-amino/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-amino/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromAminoJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-json/index.d.ts b/packages/ast/types/src/encoding/proto/from-json/index.d.ts index 29cb3a2547..b21889405f 100644 --- a/packages/ast/types/src/encoding/proto/from-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-json/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-partial/index.d.ts b/packages/ast/types/src/encoding/proto/from-partial/index.d.ts index 5f80381f19..dd8d1a394b 100644 --- a/packages/ast/types/src/encoding/proto/from-partial/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-partial/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; export interface FromPartialMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/from-proto/index.d.ts b/packages/ast/types/src/encoding/proto/from-proto/index.d.ts index e7828acf5a..3c5c02518c 100644 --- a/packages/ast/types/src/encoding/proto/from-proto/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-proto/index.d.ts @@ -1,4 +1,3 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoType } from '@cosmology/types'; export declare const fromProtoMsgMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; diff --git a/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts b/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts index 4256f5f972..9e0652d947 100644 --- a/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromSDKJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts b/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts index a8f1e177ca..1d4db841b4 100644 --- a/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromSDKMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/implements/decoder.d.ts b/packages/ast/types/src/encoding/proto/implements/decoder.d.ts index a491fee967..d38b7bf0cd 100644 --- a/packages/ast/types/src/encoding/proto/implements/decoder.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/decoder.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; +import { TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const getInterfaceDecoderName: (str: string) => string; export declare const createInterfaceDecoder: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts b/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts index be8f508034..47e34f2f8d 100644 --- a/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; +import { TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from "../../context"; export declare const getInterfaceFromAminoName: (str: string) => string; export declare const createInterfaceFromAmino: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts b/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts index 5164422795..6e28400b56 100644 --- a/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; +import { TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from "../../context"; export declare const getInterfaceToAminoName: (str: string) => string; export declare const createInterfaceToAmino: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/amino.d.ts b/packages/ast/types/src/encoding/proto/interface/amino.d.ts index b93724569f..fe12b95205 100644 --- a/packages/ast/types/src/encoding/proto/interface/amino.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/amino.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoEnum } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const createAminoType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; export declare const createAminoTypeType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/proto.d.ts b/packages/ast/types/src/encoding/proto/interface/proto.d.ts index 974851b09c..0805b11365 100644 --- a/packages/ast/types/src/encoding/proto/interface/proto.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/proto.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; import { TelescopeBaseTypes } from '../../types'; export declare const createProtoType: (context: ProtoParseContext, name: string, proto: ProtoType, type?: TelescopeBaseTypes) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/sdk.d.ts b/packages/ast/types/src/encoding/proto/interface/sdk.d.ts index 99198f98e8..abea695b76 100644 --- a/packages/ast/types/src/encoding/proto/interface/sdk.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/sdk.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoEnum, ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const createSDKType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; export declare const createEnumSDKType: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/props/index.d.ts b/packages/ast/types/src/encoding/proto/props/index.d.ts index da68552ccd..087e43d913 100644 --- a/packages/ast/types/src/encoding/proto/props/index.d.ts +++ b/packages/ast/types/src/encoding/proto/props/index.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoType } from '@cosmology/types'; export declare const createTypeUrlProperty: (context: ProtoParseContext, proto: ProtoType) => t.ObjectProperty; export declare const createAminoTypeProperty: (context: ProtoParseContext, proto: ProtoType) => t.ObjectProperty; diff --git a/packages/ast/types/src/encoding/proto/to-amino/index.d.ts b/packages/ast/types/src/encoding/proto/to-amino/index.d.ts index 4891dd5b46..214b0648f9 100644 --- a/packages/ast/types/src/encoding/proto/to-amino/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-amino/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField, ProtoType } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; export interface ToAminoJSONMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/to-json/index.d.ts b/packages/ast/types/src/encoding/proto/to-json/index.d.ts index 8e9cd0aa57..2cbca952f0 100644 --- a/packages/ast/types/src/encoding/proto/to-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-json/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField, ProtoType } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; export interface ToJSONMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/to-proto/index.d.ts b/packages/ast/types/src/encoding/proto/to-proto/index.d.ts index 106881e79d..e63164aa11 100644 --- a/packages/ast/types/src/encoding/proto/to-proto/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-proto/index.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoType } from '@cosmology/types'; export declare const toProtoMsgMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; export declare const toProtoMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; diff --git a/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts b/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts index 86369729e3..76da023840 100644 --- a/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField, ProtoType } from '@cosmology/types'; +import { ProtoField } from '@cosmology/types'; export interface ToSDKMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/types.d.ts b/packages/ast/types/src/encoding/proto/types.d.ts index a04c3b6a97..826bf01020 100644 --- a/packages/ast/types/src/encoding/proto/types.d.ts +++ b/packages/ast/types/src/encoding/proto/types.d.ts @@ -1,4 +1,3 @@ -import { ProtoType, ProtoField } from '@cosmology/types'; import { AminoParseContext, ProtoParseContext } from '../context'; export declare const SCALAR_TYPES: string[]; export declare const GOOGLE_TYPES: string[]; @@ -80,10 +79,10 @@ export declare const getPackedWireNumber: (type: any) => any; export declare const getTagNumber: (field: ProtoField) => number; export declare const getEnumToJsonName: (name: any) => string; export declare const getEnumFromJsonName: (name: any) => string; -export declare const getFieldsTypeName: (field: ProtoField) => string; +export declare const getFieldsTypeName: (field: ProtoField) => any; export declare const getKeyTypeEntryName: (typeName: string, prop: string) => string; export declare const getBaseCreateTypeFuncName: (name: any) => string; -export declare const getOneOfs: (type: ProtoType) => string[]; +export declare const getOneOfs: (type: ProtoType) => any; export declare const getFieldOptionality: (context: ProtoParseContext | AminoParseContext, field: ProtoField, isOneOf: boolean) => boolean; export declare const isScalarField: (field: ProtoField) => boolean; export declare const isArrayField: (field: ProtoField) => boolean; diff --git a/packages/ast/types/src/encoding/types.d.ts b/packages/ast/types/src/encoding/types.d.ts index 92506110fd..17653a4ba0 100644 --- a/packages/ast/types/src/encoding/types.d.ts +++ b/packages/ast/types/src/encoding/types.d.ts @@ -1,9 +1,8 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; import { GenericParseContext, ProtoParseContext } from './context'; export declare const getFieldNames: (field: ProtoField) => { - propName: string; - origName: string; + propName: any; + origName: any; }; export type TelescopeBaseTypes = 'Msg' | 'SDKType' | 'Amino' | 'AminoMsg' | 'ProtoMsg' | 'Encoded'; export declare const SymbolNames: { diff --git a/packages/ast/types/src/plugins/plugins.d.ts b/packages/ast/types/src/plugins/plugins.d.ts index 84860c1fd1..1f821c08ab 100644 --- a/packages/ast/types/src/plugins/plugins.d.ts +++ b/packages/ast/types/src/plugins/plugins.d.ts @@ -1,2 +1,2 @@ -import { TelescopeOptions, TelescopeOption } from '@cosmology/types'; +import { TelescopeOption } from '@cosmology/types'; export declare const getPluginValue: (optionName: TelescopeOption | string, currentPkg: string, options: TelescopeOptions) => any; diff --git a/packages/ast/types/src/state/mobx/mobx.d.ts b/packages/ast/types/src/state/mobx/mobx.d.ts index 053bea1aa8..f64ceda67b 100644 --- a/packages/ast/types/src/state/mobx/mobx.d.ts +++ b/packages/ast/types/src/state/mobx/mobx.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; /** * Entry for building stores. diff --git a/packages/ast/types/src/state/pinia/pinia.d.ts b/packages/ast/types/src/state/pinia/pinia.d.ts index dddbd6abb7..fe05662763 100644 --- a/packages/ast/types/src/state/pinia/pinia.d.ts +++ b/packages/ast/types/src/state/pinia/pinia.d.ts @@ -1,4 +1,3 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; export declare const createPiniaStore: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/state/react-query/react-query.d.ts b/packages/ast/types/src/state/react-query/react-query.d.ts index f9b417ae25..fb5791f4a2 100644 --- a/packages/ast/types/src/state/react-query/react-query.d.ts +++ b/packages/ast/types/src/state/react-query/react-query.d.ts @@ -1,5 +1,4 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; /** * Create an ASTs for a function creating hooks From c4135c40a415344162943b26293ff35acc1eab1b Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 1 Aug 2023 06:30:23 +0800 Subject: [PATCH 2/9] added flag for default enum and other types --- .../output1/akash/base/v1beta1/endpoint.ts | 4 +- .../output1/akash/base/v1beta2/endpoint.ts | 4 +- .../output1/akash/cert/v1beta2/cert.ts | 4 +- .../akash/deployment/v1beta1/deployment.ts | 4 +- .../output1/akash/deployment/v1beta1/group.ts | 4 +- .../akash/deployment/v1beta2/deployment.ts | 4 +- .../output1/akash/deployment/v1beta2/group.ts | 4 +- .../output1/akash/escrow/v1beta1/types.ts | 8 +-- .../output1/akash/escrow/v1beta2/types.ts | 8 +-- .../output1/akash/market/v1beta2/bid.ts | 4 +- .../output1/akash/market/v1beta2/lease.ts | 4 +- .../output1/akash/market/v1beta2/order.ts | 4 +- __fixtures__/output1/confio/proofs.ts | 24 +++---- __fixtures__/output1/cosmos/gov/v1/gov.ts | 8 +-- __fixtures__/output1/cosmos/gov/v1/query.ts | 4 +- __fixtures__/output1/cosmos/gov/v1/tx.ts | 4 +- .../output1/cosmos/gov/v1beta1/gov.ts | 12 ++-- .../output1/cosmos/gov/v1beta1/query.ts | 4 +- __fixtures__/output1/cosmos/gov/v1beta1/tx.ts | 4 +- .../output1/cosmos/group/v1/events.ts | 4 +- __fixtures__/output1/cosmos/group/v1/tx.ts | 12 ++-- __fixtures__/output1/cosmos/group/v1/types.ts | 16 ++--- .../output1/cosmos/orm/v1alpha1/schema.ts | 4 +- .../output1/cosmos/staking/v1beta1/authz.ts | 4 +- .../output1/cosmos/staking/v1beta1/staking.ts | 4 +- .../cosmos/tx/signing/v1beta1/signing.ts | 4 +- .../output1/cosmos/tx/v1beta1/service.ts | 8 +-- __fixtures__/output1/cosmos/tx/v1beta1/tx.ts | 8 +-- .../output1/cosmwasm/wasm/v1/types.ts | 16 ++--- .../output1/evmos/claims/v1/claims.ts | 4 +- __fixtures__/output1/evmos/erc20/v1/erc20.ts | 4 +- __fixtures__/output1/google/api/backend.ts | 4 +- .../output1/google/api/config_change.ts | 4 +- __fixtures__/output1/google/api/consumer.ts | 4 +- .../v1alpha1/conformance_service.ts | 4 +- __fixtures__/output1/google/api/label.ts | 4 +- __fixtures__/output1/google/api/metric.ts | 16 ++--- .../output1/google/api/monitored_resource.ts | 4 +- __fixtures__/output1/google/api/resource.ts | 4 +- .../api/servicecontrol/v1/check_error.ts | 4 +- .../google/api/servicecontrol/v1/log_entry.ts | 4 +- .../google/api/servicecontrol/v1/operation.ts | 4 +- .../api/servicecontrol/v1/quota_controller.ts | 8 +-- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/servicemanagement/v1/resources.ts | 16 ++--- .../servicemanagement/v1/servicemanager.ts | 4 +- .../google/api/serviceusage/v1/resources.ts | 4 +- .../api/serviceusage/v1/serviceusage.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 4 +- .../api/serviceusage/v1beta1/serviceusage.ts | 16 ++--- .../output1/google/logging/v2/log_entry.ts | 4 +- .../output1/google/logging/v2/logging.ts | 4 +- .../google/logging/v2/logging_config.ts | 12 ++-- .../google/logging/v2/logging_metrics.ts | 4 +- __fixtures__/output1/google/protobuf/api.ts | 8 +-- .../output1/google/protobuf/descriptor.ts | 24 +++---- __fixtures__/output1/google/protobuf/type.ts | 16 ++--- .../output1/ibc/core/channel/v1/channel.ts | 16 ++--- .../ibc/core/connection/v1/connection.ts | 8 +-- .../output1/ibc/core/port/v1/query.ts | 4 +- .../solomachine/v1/solomachine.ts | 8 +-- .../solomachine/v2/solomachine.ts | 8 +-- .../output1/osmosis/claim/v1beta1/query.ts | 4 +- __fixtures__/output1/osmosis/lockup/lock.ts | 4 +- .../output1/osmosis/superfluid/query.ts | 4 +- .../output1/osmosis/superfluid/superfluid.ts | 4 +- __fixtures__/output1/tendermint/abci/types.ts | 16 ++--- .../output1/tendermint/types/types.ts | 12 ++-- .../output2/akash/base/v1beta1/endpoint.ts | 2 +- .../output2/akash/base/v1beta2/endpoint.ts | 2 +- .../output2/akash/cert/v1beta2/cert.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 2 +- .../output2/akash/deployment/v1beta1/group.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 2 +- .../output2/akash/deployment/v1beta2/group.ts | 2 +- .../output2/akash/escrow/v1beta1/types.ts | 4 +- .../output2/akash/escrow/v1beta2/types.ts | 4 +- .../output2/akash/market/v1beta2/bid.ts | 2 +- .../output2/akash/market/v1beta2/lease.ts | 2 +- .../output2/akash/market/v1beta2/order.ts | 2 +- __fixtures__/output2/confio/proofs.ts | 12 ++-- __fixtures__/output2/cosmos/gov/v1/gov.ts | 4 +- __fixtures__/output2/cosmos/gov/v1/query.ts | 2 +- __fixtures__/output2/cosmos/gov/v1/tx.ts | 2 +- .../output2/cosmos/gov/v1beta1/gov.ts | 6 +- .../output2/cosmos/gov/v1beta1/query.ts | 2 +- __fixtures__/output2/cosmos/gov/v1beta1/tx.ts | 2 +- .../output2/cosmos/group/v1/events.ts | 2 +- __fixtures__/output2/cosmos/group/v1/tx.ts | 6 +- __fixtures__/output2/cosmos/group/v1/types.ts | 8 +-- .../output2/cosmos/orm/v1alpha1/schema.ts | 2 +- .../output2/cosmos/staking/v1beta1/authz.ts | 2 +- .../output2/cosmos/staking/v1beta1/staking.ts | 2 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../output2/cosmos/tx/v1beta1/service.ts | 4 +- __fixtures__/output2/cosmos/tx/v1beta1/tx.ts | 2 +- .../output2/cosmwasm/wasm/v1/types.ts | 8 +-- .../output2/evmos/claims/v1/claims.ts | 2 +- __fixtures__/output2/evmos/erc20/v1/erc20.ts | 2 +- __fixtures__/output2/google/api/backend.ts | 2 +- .../output2/google/api/config_change.ts | 2 +- __fixtures__/output2/google/api/consumer.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- __fixtures__/output2/google/api/label.ts | 2 +- __fixtures__/output2/google/api/metric.ts | 8 +-- .../output2/google/api/monitored_resource.ts | 2 +- __fixtures__/output2/google/api/resource.ts | 2 +- .../api/servicecontrol/v1/check_error.ts | 2 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../google/api/servicecontrol/v1/operation.ts | 2 +- .../api/servicecontrol/v1/quota_controller.ts | 4 +- .../servicecontrol/v1/service_controller.ts | 2 +- .../api/servicemanagement/v1/resources.ts | 8 +-- .../servicemanagement/v1/servicemanager.ts | 2 +- .../google/api/serviceusage/v1/resources.ts | 2 +- .../api/serviceusage/v1/serviceusage.ts | 2 +- .../api/serviceusage/v1beta1/resources.ts | 2 +- .../api/serviceusage/v1beta1/serviceusage.ts | 8 +-- .../output2/google/logging/v2/log_entry.ts | 2 +- .../output2/google/logging/v2/logging.ts | 2 +- .../google/logging/v2/logging_config.ts | 6 +- .../google/logging/v2/logging_metrics.ts | 2 +- __fixtures__/output2/google/protobuf/api.ts | 4 +- .../output2/google/protobuf/descriptor.ts | 12 ++-- __fixtures__/output2/google/protobuf/type.ts | 8 +-- .../interchain_accounts/v1/packet.ts | 2 +- .../output2/ibc/core/channel/v1/channel.ts | 8 +-- .../output2/ibc/core/channel/v1/tx.ts | 8 +-- .../ibc/core/connection/v1/connection.ts | 4 +- .../solomachine/v1/solomachine.ts | 4 +- .../output2/osmosis/claim/v1beta1/query.ts | 2 +- __fixtures__/output2/osmosis/lockup/lock.ts | 2 +- .../output2/osmosis/superfluid/query.ts | 2 +- .../output2/osmosis/superfluid/superfluid.ts | 2 +- __fixtures__/output2/tendermint/abci/types.ts | 8 +-- .../output2/tendermint/types/types.ts | 6 +- .../__snapshots__/object.spec.ts.snap | 12 ++-- .../src/encoding/proto/from-amino/utils.ts | 6 +- .../ast/src/encoding/proto/from-json/utils.ts | 6 +- .../src/encoding/proto/from-sdk-json/utils.ts | 6 +- .../ast/src/encoding/proto/from-sdk/utils.ts | 6 +- packages/ast/src/encoding/types.ts | 71 ++++++++++++++----- packages/types/src/telescope.ts | 4 ++ 143 files changed, 431 insertions(+), 402 deletions(-) diff --git a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts index 1325409735..cf61d40f2e 100644 --- a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts @@ -74,7 +74,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 }; }, toJSON(message: Endpoint): unknown { @@ -89,7 +89,7 @@ export const Endpoint = { }, fromSDK(object: EndpointSDKType): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 }; }, toSDK(message: Endpoint): EndpointSDKType { diff --git a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts index e0b7f13e25..9b41329e8f 100644 --- a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts @@ -90,7 +90,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, sequenceNumber: isSet(object.sequenceNumber) ? Number(object.sequenceNumber) : 0 }; }, @@ -108,7 +108,7 @@ export const Endpoint = { }, fromSDK(object: EndpointSDKType): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, sequenceNumber: object?.sequence_number }; }, diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.ts index 932449f469..994c7273b0 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.ts @@ -216,7 +216,7 @@ export const Certificate = { }, fromJSON(object: any): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, cert: isSet(object.cert) ? bytesFromBase64(object.cert) : new Uint8Array(), pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; @@ -237,7 +237,7 @@ export const Certificate = { }, fromSDK(object: CertificateSDKType): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, cert: object?.cert, pubkey: object?.pubkey }; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts index 67377031cd..b8cf30a299 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts @@ -730,7 +730,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -754,7 +754,7 @@ export const Deployment = { fromSDK(object: DeploymentSDKType): Deployment { return { deploymentId: object.deployment_id ? DeploymentID.fromSDK(object.deployment_id) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: object?.version, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/group.ts b/__fixtures__/output1/akash/deployment/v1beta1/group.ts index e3939c7757..be14a7b6de 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/group.ts @@ -649,7 +649,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -673,7 +673,7 @@ export const Group = { fromSDK(object: GroupSDKType): Group { return { groupId: object.group_id ? GroupID.fromSDK(object.group_id) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: object.group_spec ? GroupSpec.fromSDK(object.group_spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts index 2454870f46..72adbfa891 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts @@ -198,7 +198,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -222,7 +222,7 @@ export const Deployment = { fromSDK(object: DeploymentSDKType): Deployment { return { deploymentId: object.deployment_id ? DeploymentID.fromSDK(object.deployment_id) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: object?.version, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/group.ts b/__fixtures__/output1/akash/deployment/v1beta2/group.ts index 9914926b51..5ce8148aa6 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/group.ts @@ -125,7 +125,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -149,7 +149,7 @@ export const Group = { fromSDK(object: GroupSDKType): Group { return { groupId: object.group_id ? GroupID.fromSDK(object.group_id) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: object.group_spec ? GroupSpec.fromSDK(object.group_spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/escrow/v1beta1/types.ts b/__fixtures__/output1/akash/escrow/v1beta1/types.ts index db715a1481..e9a6892182 100644 --- a/__fixtures__/output1/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta1/types.ts @@ -287,7 +287,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? Coin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO @@ -317,7 +317,7 @@ export const Account = { return { id: object.id ? AccountID.fromSDK(object.id) : undefined, owner: object?.owner, - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: object.balance ? Coin.fromSDK(object.balance) : undefined, transferred: object.transferred ? Coin.fromSDK(object.transferred) : undefined, settledAt: object?.settled_at @@ -410,7 +410,7 @@ export const Payment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, rate: isSet(object.rate) ? Coin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined @@ -443,7 +443,7 @@ export const Payment = { accountId: object.account_id ? AccountID.fromSDK(object.account_id) : undefined, paymentId: object?.payment_id, owner: object?.owner, - state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, rate: object.rate ? Coin.fromSDK(object.rate) : undefined, balance: object.balance ? Coin.fromSDK(object.balance) : undefined, withdrawn: object.withdrawn ? Coin.fromSDK(object.withdrawn) : undefined diff --git a/__fixtures__/output1/akash/escrow/v1beta2/types.ts b/__fixtures__/output1/akash/escrow/v1beta2/types.ts index 609f43061b..28061fed97 100644 --- a/__fixtures__/output1/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta2/types.ts @@ -314,7 +314,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? DecCoin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO, @@ -350,7 +350,7 @@ export const Account = { return { id: object.id ? AccountID.fromSDK(object.id) : undefined, owner: object?.owner, - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: object.balance ? DecCoin.fromSDK(object.balance) : undefined, transferred: object.transferred ? DecCoin.fromSDK(object.transferred) : undefined, settledAt: object?.settled_at, @@ -447,7 +447,7 @@ export const FractionalPayment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, rate: isSet(object.rate) ? DecCoin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined @@ -480,7 +480,7 @@ export const FractionalPayment = { accountId: object.account_id ? AccountID.fromSDK(object.account_id) : undefined, paymentId: object?.payment_id, owner: object?.owner, - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, rate: object.rate ? DecCoin.fromSDK(object.rate) : undefined, balance: object.balance ? DecCoin.fromSDK(object.balance) : undefined, withdrawn: object.withdrawn ? Coin.fromSDK(object.withdrawn) : undefined diff --git a/__fixtures__/output1/akash/market/v1beta2/bid.ts b/__fixtures__/output1/akash/market/v1beta2/bid.ts index dc8c67be98..b73bf667ee 100644 --- a/__fixtures__/output1/akash/market/v1beta2/bid.ts +++ b/__fixtures__/output1/akash/market/v1beta2/bid.ts @@ -524,7 +524,7 @@ export const Bid = { fromJSON(object: any): Bid { return { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -548,7 +548,7 @@ export const Bid = { fromSDK(object: BidSDKType): Bid { return { bidId: object.bid_id ? BidID.fromSDK(object.bid_id) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, price: object.price ? DecCoin.fromSDK(object.price) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/akash/market/v1beta2/lease.ts b/__fixtures__/output1/akash/market/v1beta2/lease.ts index 56d0502241..a9042244ff 100644 --- a/__fixtures__/output1/akash/market/v1beta2/lease.ts +++ b/__fixtures__/output1/akash/market/v1beta2/lease.ts @@ -300,7 +300,7 @@ export const Lease = { fromJSON(object: any): Lease { return { leaseId: isSet(object.leaseId) ? LeaseID.fromJSON(object.leaseId) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO, closedOn: isSet(object.closedOn) ? Long.fromValue(object.closedOn) : Long.ZERO @@ -327,7 +327,7 @@ export const Lease = { fromSDK(object: LeaseSDKType): Lease { return { leaseId: object.lease_id ? LeaseID.fromSDK(object.lease_id) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, price: object.price ? DecCoin.fromSDK(object.price) : undefined, createdAt: object?.created_at, closedOn: object?.closed_on diff --git a/__fixtures__/output1/akash/market/v1beta2/order.ts b/__fixtures__/output1/akash/market/v1beta2/order.ts index 27398a7ffd..cee653dcc5 100644 --- a/__fixtures__/output1/akash/market/v1beta2/order.ts +++ b/__fixtures__/output1/akash/market/v1beta2/order.ts @@ -238,7 +238,7 @@ export const Order = { fromJSON(object: any): Order { return { orderId: isSet(object.orderId) ? OrderID.fromJSON(object.orderId) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, spec: isSet(object.spec) ? GroupSpec.fromJSON(object.spec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; @@ -262,7 +262,7 @@ export const Order = { fromSDK(object: OrderSDKType): Order { return { orderId: object.order_id ? OrderID.fromSDK(object.order_id) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, spec: object.spec ? GroupSpec.fromSDK(object.spec) : undefined, createdAt: object?.created_at }; diff --git a/__fixtures__/output1/confio/proofs.ts b/__fixtures__/output1/confio/proofs.ts index ad11a886fe..c54a96309d 100644 --- a/__fixtures__/output1/confio/proofs.ts +++ b/__fixtures__/output1/confio/proofs.ts @@ -802,10 +802,10 @@ export const LeafOp = { }, fromJSON(object: any): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, - prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0, - prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : -1, + prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : -1, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, @@ -829,10 +829,10 @@ export const LeafOp = { }, fromSDK(object: LeafOpSDKType): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, - prehashKey: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : 0, - prehashValue: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : 0, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + prehashKey: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : -1, + prehashValue: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : -1, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, prefix: object?.prefix }; }, @@ -891,7 +891,7 @@ export const InnerOp = { }, fromJSON(object: any): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() }; @@ -912,7 +912,7 @@ export const InnerOp = { }, fromSDK(object: InnerOpSDKType): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, prefix: object?.prefix, suffix: object?.suffix }; @@ -1096,7 +1096,7 @@ export const InnerSpec = { minPrefixLength: isSet(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, maxPrefixLength: isSet(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 }; }, toJSON(message: InnerSpec): unknown { @@ -1130,7 +1130,7 @@ export const InnerSpec = { minPrefixLength: object?.min_prefix_length, maxPrefixLength: object?.max_prefix_length, emptyChild: object?.empty_child, - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 }; }, toSDK(message: InnerSpec): InnerSpecSDKType { diff --git a/__fixtures__/output1/cosmos/gov/v1/gov.ts b/__fixtures__/output1/cosmos/gov/v1/gov.ts index 9de5c364c6..a190b6f4e3 100644 --- a/__fixtures__/output1/cosmos/gov/v1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1/gov.ts @@ -315,7 +315,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -333,7 +333,7 @@ export const WeightedVoteOption = { }, fromSDK(object: WeightedVoteOptionSDKType): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: object?.weight }; }, @@ -527,7 +527,7 @@ export const Proposal = { return { id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -577,7 +577,7 @@ export const Proposal = { return { id: object?.id, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined, diff --git a/__fixtures__/output1/cosmos/gov/v1/query.ts b/__fixtures__/output1/cosmos/gov/v1/query.ts index 38ddb110c4..4c60e27f89 100644 --- a/__fixtures__/output1/cosmos/gov/v1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1/query.ts @@ -351,7 +351,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined @@ -375,7 +375,7 @@ export const QueryProposalsRequest = { }, fromSDK(object: QueryProposalsRequestSDKType): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, + proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : -1, voter: object?.voter, depositor: object?.depositor, pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.ts b/__fixtures__/output1/cosmos/gov/v1/tx.ts index df40e55a90..bbd0f08776 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.ts @@ -430,7 +430,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, @@ -454,7 +454,7 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object?.metadata }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts index aa5022f1bd..87d5cc11b9 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts @@ -343,7 +343,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -361,7 +361,7 @@ export const WeightedVoteOption = { }, fromSDK(object: WeightedVoteOptionSDKType): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: object?.weight }; }, @@ -615,7 +615,7 @@ export const Proposal = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -658,7 +658,7 @@ export const Proposal = { return { proposalId: object?.proposal_id, content: object.content ? Any.fromSDK(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined, @@ -830,7 +830,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, @@ -858,7 +858,7 @@ export const Vote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts index d05cbf7287..f7959cc9eb 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts @@ -351,7 +351,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined @@ -375,7 +375,7 @@ export const QueryProposalsRequest = { }, fromSDK(object: QueryProposalsRequestSDKType): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, + proposalStatus: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : -1, voter: object?.voter, depositor: object?.depositor, pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts index ec96cf98dc..ecf1f2b886 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts @@ -283,7 +283,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 }; }, toJSON(message: MsgVote): unknown { @@ -304,7 +304,7 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 }; }, toSDK(message: MsgVote): MsgVoteSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/events.ts b/__fixtures__/output1/cosmos/group/v1/events.ts index 19952772dc..6afb3ce761 100644 --- a/__fixtures__/output1/cosmos/group/v1/events.ts +++ b/__fixtures__/output1/cosmos/group/v1/events.ts @@ -513,7 +513,7 @@ export const EventExec = { fromJSON(object: any): EventExec { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 }; }, toJSON(message: EventExec): unknown { @@ -531,7 +531,7 @@ export const EventExec = { fromSDK(object: EventExecSDKType): EventExec { return { proposalId: object?.proposal_id, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 }; }, toSDK(message: EventExec): EventExecSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/tx.ts b/__fixtures__/output1/cosmos/group/v1/tx.ts index 949debbba0..6a824bb708 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.ts @@ -1625,7 +1625,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], metadata: isSet(object.metadata) ? String(object.metadata) : "", messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toJSON(message: MsgSubmitProposal): unknown { @@ -1660,7 +1660,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], metadata: object?.metadata, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toSDK(message: MsgSubmitProposal): MsgSubmitProposalSDKType { @@ -1904,9 +1904,9 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "", - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toJSON(message: MsgVote): unknown { @@ -1931,9 +1931,9 @@ export const MsgVote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object?.metadata, - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toSDK(message: MsgVote): MsgVoteSDKType { diff --git a/__fixtures__/output1/cosmos/group/v1/types.ts b/__fixtures__/output1/cosmos/group/v1/types.ts index 5d78896298..5f80ff10e1 100644 --- a/__fixtures__/output1/cosmos/group/v1/types.ts +++ b/__fixtures__/output1/cosmos/group/v1/types.ts @@ -1268,11 +1268,11 @@ export const Proposal = { submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, groupVersion: isSet(object.groupVersion) ? Long.fromValue(object.groupVersion) : Long.UZERO, groupPolicyVersion: isSet(object.groupPolicyVersion) ? Long.fromValue(object.groupPolicyVersion) : Long.UZERO, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, - executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -1327,11 +1327,11 @@ export const Proposal = { submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined, groupVersion: object?.group_version, groupPolicyVersion: object?.group_policy_version, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined, votingPeriodEnd: object.voting_period_end ? Timestamp.fromSDK(object.voting_period_end) : undefined, - executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : 0, + executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [] }; }, @@ -1513,7 +1513,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "", submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined }; @@ -1540,7 +1540,7 @@ export const Vote = { return { proposalId: object?.proposal_id, voter: object?.voter, - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object?.metadata, submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined }; diff --git a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts index 4a1a5654a6..44e2f98fd4 100644 --- a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts @@ -247,7 +247,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: isSet(object.id) ? Number(object.id) : 0, protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", - storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0 + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 }; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { @@ -268,7 +268,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: object?.id, protoFileName: object?.proto_file_name, - storageType: isSet(object.storage_type) ? storageTypeFromJSON(object.storage_type) : 0 + storageType: isSet(object.storage_type) ? storageTypeFromJSON(object.storage_type) : -1 }; }, toSDK(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntrySDKType { diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts index 7e0a398515..41cf53a423 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts @@ -149,7 +149,7 @@ export const StakeAuthorization = { maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, - authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0 + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 }; }, toJSON(message: StakeAuthorization): unknown { @@ -173,7 +173,7 @@ export const StakeAuthorization = { maxTokens: object.max_tokens ? Coin.fromSDK(object.max_tokens) : undefined, allowList: object.allow_list ? StakeAuthorization_Validators.fromSDK(object.allow_list) : undefined, denyList: object.deny_list ? StakeAuthorization_Validators.fromSDK(object.deny_list) : undefined, - authorizationType: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : 0 + authorizationType: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : -1 }; }, toSDK(message: StakeAuthorization): StakeAuthorizationSDKType { diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts index fd82fc0a34..eef445c2dc 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts @@ -873,7 +873,7 @@ export const Validator = { operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, tokens: isSet(object.tokens) ? String(object.tokens) : "", delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "", description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, @@ -918,7 +918,7 @@ export const Validator = { operatorAddress: object?.operator_address, consensusPubkey: object.consensus_pubkey ? Any.fromSDK(object.consensus_pubkey) : undefined, jailed: object?.jailed, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, tokens: object?.tokens, delegatorShares: object?.delegator_shares, description: object.description ? Description.fromSDK(object.description) : undefined, diff --git a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts index 54d748b6e1..71a34821b3 100644 --- a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts @@ -407,7 +407,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() }; }, @@ -425,7 +425,7 @@ export const SignatureDescriptor_Data_Single = { }, fromSDK(object: SignatureDescriptor_Data_SingleSDKType): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, signature: object?.signature }; }, diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts index 803caa7957..2f7c398ec5 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts @@ -342,7 +342,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0 + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 }; }, toJSON(message: GetTxsEventRequest): unknown { @@ -367,7 +367,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => e) : [], pagination: object.pagination ? PageRequest.fromSDK(object.pagination) : undefined, - orderBy: isSet(object.order_by) ? orderByFromJSON(object.order_by) : 0 + orderBy: isSet(object.order_by) ? orderByFromJSON(object.order_by) : -1 }; }, toSDK(message: GetTxsEventRequest): GetTxsEventRequestSDKType { @@ -516,7 +516,7 @@ export const BroadcastTxRequest = { fromJSON(object: any): BroadcastTxRequest { return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 }; }, toJSON(message: BroadcastTxRequest): unknown { @@ -534,7 +534,7 @@ export const BroadcastTxRequest = { fromSDK(object: BroadcastTxRequestSDKType): BroadcastTxRequest { return { txBytes: object?.tx_bytes, - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 }; }, toSDK(message: BroadcastTxRequest): BroadcastTxRequestSDKType { diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts index 3e87e0edd4..1c1b51e1e4 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts @@ -1159,7 +1159,7 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 }; }, toJSON(message: ModeInfo_Single): unknown { @@ -1174,7 +1174,7 @@ export const ModeInfo_Single = { }, fromSDK(object: ModeInfo_SingleSDKType): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 }; }, toSDK(message: ModeInfo_Single): ModeInfo_SingleSDKType { @@ -1486,7 +1486,7 @@ export const AuxSignerData = { return { address: isSet(object.address) ? String(object.address) : "", signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() }; }, @@ -1510,7 +1510,7 @@ export const AuxSignerData = { return { address: object?.address, signDoc: object.sign_doc ? SignDocDirectAux.fromSDK(object.sign_doc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, sig: object?.sig }; }, diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts index 1f84564492..46159938a6 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts @@ -256,7 +256,7 @@ export const AccessTypeParam = { }, fromJSON(object: any): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 }; }, toJSON(message: AccessTypeParam): unknown { @@ -271,7 +271,7 @@ export const AccessTypeParam = { }, fromSDK(object: AccessTypeParamSDKType): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 }; }, toSDK(message: AccessTypeParam): AccessTypeParamSDKType { @@ -318,7 +318,7 @@ export const AccessConfig = { }, fromJSON(object: any): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, address: isSet(object.address) ? String(object.address) : "" }; }, @@ -336,7 +336,7 @@ export const AccessConfig = { }, fromSDK(object: AccessConfigSDKType): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, address: object?.address }; }, @@ -393,7 +393,7 @@ export const Params = { fromJSON(object: any): Params { return { codeUploadAccess: isSet(object.codeUploadAccess) ? AccessConfig.fromJSON(object.codeUploadAccess) : undefined, - instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : 0, + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : -1, maxWasmCodeSize: isSet(object.maxWasmCodeSize) ? Long.fromValue(object.maxWasmCodeSize) : Long.UZERO }; }, @@ -414,7 +414,7 @@ export const Params = { fromSDK(object: ParamsSDKType): Params { return { codeUploadAccess: object.code_upload_access ? AccessConfig.fromSDK(object.code_upload_access) : undefined, - instantiateDefaultPermission: isSet(object.instantiate_default_permission) ? accessTypeFromJSON(object.instantiate_default_permission) : 0, + instantiateDefaultPermission: isSet(object.instantiate_default_permission) ? accessTypeFromJSON(object.instantiate_default_permission) : -1, maxWasmCodeSize: object?.max_wasm_code_size }; }, @@ -684,7 +684,7 @@ export const ContractCodeHistoryEntry = { }, fromJSON(object: any): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO, updated: isSet(object.updated) ? AbsoluteTxPosition.fromJSON(object.updated) : undefined, msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() @@ -708,7 +708,7 @@ export const ContractCodeHistoryEntry = { }, fromSDK(object: ContractCodeHistoryEntrySDKType): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, codeId: object?.code_id, updated: object.updated ? AbsoluteTxPosition.fromSDK(object.updated) : undefined, msg: object?.msg diff --git a/__fixtures__/output1/evmos/claims/v1/claims.ts b/__fixtures__/output1/evmos/claims/v1/claims.ts index 4696147afe..5b44f76973 100644 --- a/__fixtures__/output1/evmos/claims/v1/claims.ts +++ b/__fixtures__/output1/evmos/claims/v1/claims.ts @@ -155,7 +155,7 @@ export const Claim = { }, fromJSON(object: any): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : 0, + action: isSet(object.action) ? actionFromJSON(object.action) : -1, completed: isSet(object.completed) ? Boolean(object.completed) : false, claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" }; @@ -176,7 +176,7 @@ export const Claim = { }, fromSDK(object: ClaimSDKType): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : 0, + action: isSet(object.action) ? actionFromJSON(object.action) : -1, completed: object?.completed, claimableAmount: object?.claimable_amount }; diff --git a/__fixtures__/output1/evmos/erc20/v1/erc20.ts b/__fixtures__/output1/evmos/erc20/v1/erc20.ts index 7ff0b0cc09..2f9cd63e10 100644 --- a/__fixtures__/output1/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/output1/evmos/erc20/v1/erc20.ts @@ -188,7 +188,7 @@ export const TokenPair = { erc20Address: isSet(object.erc20Address) ? String(object.erc20Address) : "", denom: isSet(object.denom) ? String(object.denom) : "", enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : 0 + contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 }; }, toJSON(message: TokenPair): unknown { @@ -212,7 +212,7 @@ export const TokenPair = { erc20Address: object?.erc20_address, denom: object?.denom, enabled: object?.enabled, - contractOwner: isSet(object.contract_owner) ? ownerFromJSON(object.contract_owner) : 0 + contractOwner: isSet(object.contract_owner) ? ownerFromJSON(object.contract_owner) : -1 }; }, toSDK(message: TokenPair): TokenPairSDKType { diff --git a/__fixtures__/output1/google/api/backend.ts b/__fixtures__/output1/google/api/backend.ts index af75ffddd1..44fea9fac9 100644 --- a/__fixtures__/output1/google/api/backend.ts +++ b/__fixtures__/output1/google/api/backend.ts @@ -358,7 +358,7 @@ export const BackendRule = { deadline: isSet(object.deadline) ? Number(object.deadline) : 0, minDeadline: isSet(object.minDeadline) ? Number(object.minDeadline) : 0, operationDeadline: isSet(object.operationDeadline) ? Number(object.operationDeadline) : 0, - pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : 0, + pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : -1, jwtAudience: isSet(object.jwtAudience) ? String(object.jwtAudience) : undefined, disableAuth: isSet(object.disableAuth) ? Boolean(object.disableAuth) : undefined, protocol: isSet(object.protocol) ? String(object.protocol) : "" @@ -397,7 +397,7 @@ export const BackendRule = { deadline: object?.deadline, minDeadline: object?.min_deadline, operationDeadline: object?.operation_deadline, - pathTranslation: isSet(object.path_translation) ? backendRule_PathTranslationFromJSON(object.path_translation) : 0, + pathTranslation: isSet(object.path_translation) ? backendRule_PathTranslationFromJSON(object.path_translation) : -1, jwtAudience: object?.jwt_audience, disableAuth: object?.disable_auth, protocol: object?.protocol diff --git a/__fixtures__/output1/google/api/config_change.ts b/__fixtures__/output1/google/api/config_change.ts index 142ac32b42..e546c135e0 100644 --- a/__fixtures__/output1/google/api/config_change.ts +++ b/__fixtures__/output1/google/api/config_change.ts @@ -195,7 +195,7 @@ export const ConfigChange = { element: isSet(object.element) ? String(object.element) : "", oldValue: isSet(object.oldValue) ? String(object.oldValue) : "", newValue: isSet(object.newValue) ? String(object.newValue) : "", - changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : 0, + changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : -1, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] }; }, @@ -226,7 +226,7 @@ export const ConfigChange = { element: object?.element, oldValue: object?.old_value, newValue: object?.new_value, - changeType: isSet(object.change_type) ? changeTypeFromJSON(object.change_type) : 0, + changeType: isSet(object.change_type) ? changeTypeFromJSON(object.change_type) : -1, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/api/consumer.ts b/__fixtures__/output1/google/api/consumer.ts index 4a36029ed0..df569be4f6 100644 --- a/__fixtures__/output1/google/api/consumer.ts +++ b/__fixtures__/output1/google/api/consumer.ts @@ -245,7 +245,7 @@ export const Property = { fromJSON(object: any): Property { return { name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, description: isSet(object.description) ? String(object.description) : "" }; }, @@ -266,7 +266,7 @@ export const Property = { fromSDK(object: PropertySDKType): Property { return { name: object?.name, - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, description: object?.description }; }, diff --git a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts index 25d3e529ce..bab015b521 100644 --- a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -851,7 +851,7 @@ export const IssueDetails = { }, fromJSON(object: any): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, position: isSet(object.position) ? SourcePosition.fromJSON(object.position) : undefined, id: isSet(object.id) ? Long.fromValue(object.id) : Long.ZERO }; @@ -872,7 +872,7 @@ export const IssueDetails = { }, fromSDK(object: IssueDetailsSDKType): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, position: object.position ? SourcePosition.fromSDK(object.position) : undefined, id: object?.id }; diff --git a/__fixtures__/output1/google/api/label.ts b/__fixtures__/output1/google/api/label.ts index cba3c19f23..f5e6dd05ad 100644 --- a/__fixtures__/output1/google/api/label.ts +++ b/__fixtures__/output1/google/api/label.ts @@ -103,7 +103,7 @@ export const LabelDescriptor = { fromJSON(object: any): LabelDescriptor { return { key: isSet(object.key) ? String(object.key) : "", - valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : 0, + valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, description: isSet(object.description) ? String(object.description) : "" }; }, @@ -124,7 +124,7 @@ export const LabelDescriptor = { fromSDK(object: LabelDescriptorSDKType): LabelDescriptor { return { key: object?.key, - valueType: isSet(object.value_type) ? labelDescriptor_ValueTypeFromJSON(object.value_type) : 0, + valueType: isSet(object.value_type) ? labelDescriptor_ValueTypeFromJSON(object.value_type) : -1, description: object?.description }; }, diff --git a/__fixtures__/output1/google/api/metric.ts b/__fixtures__/output1/google/api/metric.ts index 4739fbe6d2..e96f6f7a33 100644 --- a/__fixtures__/output1/google/api/metric.ts +++ b/__fixtures__/output1/google/api/metric.ts @@ -486,13 +486,13 @@ export const MetricDescriptor = { name: isSet(object.name) ? String(object.name) : "", type: isSet(object.type) ? String(object.type) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : 0, - valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : 0, + metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : -1, + valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : -1, unit: isSet(object.unit) ? String(object.unit) : "", description: isSet(object.description) ? String(object.description) : "", displayName: isSet(object.displayName) ? String(object.displayName) : "", metadata: isSet(object.metadata) ? MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata) : undefined, - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] }; }, @@ -539,13 +539,13 @@ export const MetricDescriptor = { name: object?.name, type: object?.type, labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromSDK(e)) : [], - metricKind: isSet(object.metric_kind) ? metricDescriptor_MetricKindFromJSON(object.metric_kind) : 0, - valueType: isSet(object.value_type) ? metricDescriptor_ValueTypeFromJSON(object.value_type) : 0, + metricKind: isSet(object.metric_kind) ? metricDescriptor_MetricKindFromJSON(object.metric_kind) : -1, + valueType: isSet(object.value_type) ? metricDescriptor_ValueTypeFromJSON(object.value_type) : -1, unit: object?.unit, description: object?.description, displayName: object?.display_name, metadata: object.metadata ? MetricDescriptor_MetricDescriptorMetadata.fromSDK(object.metadata) : undefined, - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0, + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1, monitoredResourceTypes: Array.isArray(object?.monitored_resource_types) ? object.monitored_resource_types.map((e: any) => e) : [] }; }, @@ -618,7 +618,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, samplePeriod: isSet(object.samplePeriod) ? Duration.fromJSON(object.samplePeriod) : undefined, ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined }; @@ -639,7 +639,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromSDK(object: MetricDescriptor_MetricDescriptorMetadataSDKType): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0, + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1, samplePeriod: object.sample_period ? Duration.fromSDK(object.sample_period) : undefined, ingestDelay: object.ingest_delay ? Duration.fromSDK(object.ingest_delay) : undefined }; diff --git a/__fixtures__/output1/google/api/monitored_resource.ts b/__fixtures__/output1/google/api/monitored_resource.ts index 96f660b7d5..86a271fb54 100644 --- a/__fixtures__/output1/google/api/monitored_resource.ts +++ b/__fixtures__/output1/google/api/monitored_resource.ts @@ -250,7 +250,7 @@ export const MonitoredResourceDescriptor = { displayName: isSet(object.displayName) ? String(object.displayName) : "", description: isSet(object.description) ? String(object.description) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0 + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 }; }, toJSON(message: MonitoredResourceDescriptor): unknown { @@ -284,7 +284,7 @@ export const MonitoredResourceDescriptor = { displayName: object?.display_name, description: object?.description, labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromSDK(e)) : [], - launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : 0 + launchStage: isSet(object.launch_stage) ? launchStageFromJSON(object.launch_stage) : -1 }; }, toSDK(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorSDKType { diff --git a/__fixtures__/output1/google/api/resource.ts b/__fixtures__/output1/google/api/resource.ts index cc3a4c0000..21b19b1263 100644 --- a/__fixtures__/output1/google/api/resource.ts +++ b/__fixtures__/output1/google/api/resource.ts @@ -421,7 +421,7 @@ export const ResourceDescriptor = { type: isSet(object.type) ? String(object.type) : "", pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => String(e)) : [], nameField: isSet(object.nameField) ? String(object.nameField) : "", - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, plural: isSet(object.plural) ? String(object.plural) : "", singular: isSet(object.singular) ? String(object.singular) : "", style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] @@ -462,7 +462,7 @@ export const ResourceDescriptor = { type: object?.type, pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => e) : [], nameField: object?.name_field, - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, plural: object?.plural, singular: object?.singular, style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts index 97364f2bfe..26f2324869 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts @@ -277,7 +277,7 @@ export const CheckError = { }, fromJSON(object: any): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, subject: isSet(object.subject) ? String(object.subject) : "", detail: isSet(object.detail) ? String(object.detail) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined @@ -301,7 +301,7 @@ export const CheckError = { }, fromSDK(object: CheckErrorSDKType): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, subject: object?.subject, detail: object?.detail, status: object.status ? Status.fromSDK(object.status) : undefined diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts index 08612a7ca2..67ff01259e 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts @@ -344,7 +344,7 @@ export const LogEntry = { return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", @@ -409,7 +409,7 @@ export const LogEntry = { return { name: object?.name, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, trace: object?.trace, insertId: object?.insert_id, diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts index f58684a55f..105017650f 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts @@ -331,7 +331,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metricValueSets) ? object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)) : [], logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -402,7 +402,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metric_value_sets) ? object.metric_value_sets.map((e: any) => MetricValueSet.fromSDK(e)) : [], logEntries: Array.isArray(object?.log_entries) ? object.log_entries.map((e: any) => LogEntry.fromSDK(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts index dd48680d2b..d0dd794848 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts @@ -558,7 +558,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : 0 + quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 }; }, toJSON(message: QuotaOperation): unknown { @@ -609,7 +609,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quota_metrics) ? object.quota_metrics.map((e: any) => MetricValueSet.fromSDK(e)) : [], - quotaMode: isSet(object.quota_mode) ? quotaOperation_QuotaModeFromJSON(object.quota_mode) : 0 + quotaMode: isSet(object.quota_mode) ? quotaOperation_QuotaModeFromJSON(object.quota_mode) : -1 }; }, toSDK(message: QuotaOperation): QuotaOperationSDKType { @@ -791,7 +791,7 @@ export const QuotaError = { }, fromJSON(object: any): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, subject: isSet(object.subject) ? String(object.subject) : "", description: isSet(object.description) ? String(object.description) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined @@ -815,7 +815,7 @@ export const QuotaError = { }, fromSDK(object: QuotaErrorSDKType): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, subject: object?.subject, description: object?.description, status: object.status ? Status.fromSDK(object.status) : undefined diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts index 6d35b58cf6..f9ecd2cf23 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts @@ -575,7 +575,7 @@ export const CheckResponse_ConsumerInfo = { fromJSON(object: any): CheckResponse_ConsumerInfo { return { projectNumber: isSet(object.projectNumber) ? Long.fromValue(object.projectNumber) : Long.ZERO, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, consumerNumber: isSet(object.consumerNumber) ? Long.fromValue(object.consumerNumber) : Long.ZERO }; }, @@ -596,7 +596,7 @@ export const CheckResponse_ConsumerInfo = { fromSDK(object: CheckResponse_ConsumerInfoSDKType): CheckResponse_ConsumerInfo { return { projectNumber: object?.project_number, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, consumerNumber: object?.consumer_number }; }, diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts index cf47802a43..786dea61a6 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts @@ -762,7 +762,7 @@ export const OperationMetadata_Step = { fromJSON(object: any): OperationMetadata_Step { return { description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 }; }, toJSON(message: OperationMetadata_Step): unknown { @@ -780,7 +780,7 @@ export const OperationMetadata_Step = { fromSDK(object: OperationMetadata_StepSDKType): OperationMetadata_Step { return { description: object?.description, - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 }; }, toSDK(message: OperationMetadata_Step): OperationMetadata_StepSDKType { @@ -836,7 +836,7 @@ export const Diagnostic = { fromJSON(object: any): Diagnostic { return { location: isSet(object.location) ? String(object.location) : "", - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, message: isSet(object.message) ? String(object.message) : "" }; }, @@ -857,7 +857,7 @@ export const Diagnostic = { fromSDK(object: DiagnosticSDKType): Diagnostic { return { location: object?.location, - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, message: object?.message }; }, @@ -991,7 +991,7 @@ export const ConfigFile = { return { filePath: isSet(object.filePath) ? String(object.filePath) : "", fileContents: isSet(object.fileContents) ? bytesFromBase64(object.fileContents) : new Uint8Array(), - fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : 0 + fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 }; }, toJSON(message: ConfigFile): unknown { @@ -1012,7 +1012,7 @@ export const ConfigFile = { return { filePath: object?.file_path, fileContents: object?.file_contents, - fileType: isSet(object.file_type) ? configFile_FileTypeFromJSON(object.file_type) : 0 + fileType: isSet(object.file_type) ? configFile_FileTypeFromJSON(object.file_type) : -1 }; }, toSDK(message: ConfigFile): ConfigFileSDKType { @@ -1217,7 +1217,7 @@ export const Rollout = { rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "", createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, createdBy: isSet(object.createdBy) ? String(object.createdBy) : "", - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: isSet(object.trafficPercentStrategy) ? Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy) : undefined, deleteServiceStrategy: isSet(object.deleteServiceStrategy) ? Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy) : undefined, serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" @@ -1250,7 +1250,7 @@ export const Rollout = { rolloutId: object?.rollout_id, createTime: object.create_time ? Timestamp.fromSDK(object.create_time) : undefined, createdBy: object?.created_by, - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: object.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromSDK(object.traffic_percent_strategy) : undefined, deleteServiceStrategy: object.delete_service_strategy ? Rollout_DeleteServiceStrategy.fromSDK(object.delete_service_strategy) : undefined, serviceName: object?.service_name diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts index 2e91d4d6c5..c83d86513a 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts @@ -857,7 +857,7 @@ export const GetServiceConfigRequest = { return { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", configId: isSet(object.configId) ? String(object.configId) : "", - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 }; }, toJSON(message: GetServiceConfigRequest): unknown { @@ -878,7 +878,7 @@ export const GetServiceConfigRequest = { return { serviceName: object?.service_name, configId: object?.config_id, - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 }; }, toSDK(message: GetServiceConfigRequest): GetServiceConfigRequestSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts index 9f68664c2e..a2ccc891f8 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts @@ -213,7 +213,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toJSON(message: Service): unknown { @@ -237,7 +237,7 @@ export const Service = { name: object?.name, parent: object?.parent, config: object.config ? ServiceConfig.fromSDK(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toSDK(message: Service): ServiceSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts index 0373221866..ad9f3d691c 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts @@ -454,7 +454,7 @@ export const DisableServiceRequest = { return { name: isSet(object.name) ? String(object.name) : "", disableDependentServices: isSet(object.disableDependentServices) ? Boolean(object.disableDependentServices) : false, - checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : 0 + checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 }; }, toJSON(message: DisableServiceRequest): unknown { @@ -475,7 +475,7 @@ export const DisableServiceRequest = { return { name: object?.name, disableDependentServices: object?.disable_dependent_services, - checkIfServiceHasUsage: isSet(object.check_if_service_has_usage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage) : 0 + checkIfServiceHasUsage: isSet(object.check_if_service_has_usage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage) : -1 }; }, toSDK(message: DisableServiceRequest): DisableServiceRequestSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts index 3023808987..9d1afa0c92 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts @@ -667,7 +667,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toJSON(message: Service): unknown { @@ -691,7 +691,7 @@ export const Service = { name: object?.name, parent: object?.parent, config: object.config ? ServiceConfig.fromSDK(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toSDK(message: Service): ServiceSDKType { diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts index 2bc79f113d..6d257f8d43 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1217,7 +1217,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: isSet(object.parent) ? String(object.parent) : "", pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: ListConsumerQuotaMetricsRequest): unknown { @@ -1241,7 +1241,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: object?.parent, pageSize: object?.page_size, pageToken: object?.page_token, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toSDK(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestSDKType { @@ -1367,7 +1367,7 @@ export const GetConsumerQuotaMetricRequest = { fromJSON(object: any): GetConsumerQuotaMetricRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: GetConsumerQuotaMetricRequest): unknown { @@ -1385,7 +1385,7 @@ export const GetConsumerQuotaMetricRequest = { fromSDK(object: GetConsumerQuotaMetricRequestSDKType): GetConsumerQuotaMetricRequest { return { name: object?.name, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toSDK(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestSDKType { @@ -1434,7 +1434,7 @@ export const GetConsumerQuotaLimitRequest = { fromJSON(object: any): GetConsumerQuotaLimitRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: GetConsumerQuotaLimitRequest): unknown { @@ -1452,7 +1452,7 @@ export const GetConsumerQuotaLimitRequest = { fromSDK(object: GetConsumerQuotaLimitRequestSDKType): GetConsumerQuotaLimitRequest { return { name: object?.name, - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toSDK(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestSDKType { @@ -3283,7 +3283,7 @@ export const GetServiceIdentityResponse = { fromJSON(object: any): GetServiceIdentityResponse { return { identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 }; }, toJSON(message: GetServiceIdentityResponse): unknown { @@ -3301,7 +3301,7 @@ export const GetServiceIdentityResponse = { fromSDK(object: GetServiceIdentityResponseSDKType): GetServiceIdentityResponse { return { identity: object.identity ? ServiceIdentity.fromSDK(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 }; }, toSDK(message: GetServiceIdentityResponse): GetServiceIdentityResponseSDKType { diff --git a/__fixtures__/output1/google/logging/v2/log_entry.ts b/__fixtures__/output1/google/logging/v2/log_entry.ts index ad1ff8174c..d10a878e8f 100644 --- a/__fixtures__/output1/google/logging/v2/log_entry.ts +++ b/__fixtures__/output1/google/logging/v2/log_entry.ts @@ -504,7 +504,7 @@ export const LogEntry = { jsonPayload: isSet(object.jsonPayload) ? Struct.fromJSON(object.jsonPayload) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, receiveTimestamp: isSet(object.receiveTimestamp) ? fromJsonTimestamp(object.receiveTimestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: isSet(object.insertId) ? String(object.insertId) : "", httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ @@ -584,7 +584,7 @@ export const LogEntry = { jsonPayload: object.json_payload ? Struct.fromSDK(object.json_payload) : undefined, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, receiveTimestamp: object.receive_timestamp ? Timestamp.fromSDK(object.receive_timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: object?.insert_id, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ diff --git a/__fixtures__/output1/google/logging/v2/logging.ts b/__fixtures__/output1/google/logging/v2/logging.ts index 2a8274a552..4a30c171bb 100644 --- a/__fixtures__/output1/google/logging/v2/logging.ts +++ b/__fixtures__/output1/google/logging/v2/logging.ts @@ -1666,7 +1666,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 }; }, @@ -1684,7 +1684,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromSDK(object: TailLogEntriesResponse_SuppressionInfoSDKType): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, suppressedCount: object?.suppressed_count }; }, diff --git a/__fixtures__/output1/google/logging/v2/logging_config.ts b/__fixtures__/output1/google/logging/v2/logging_config.ts index e6752f37d4..d4ae71c01f 100644 --- a/__fixtures__/output1/google/logging/v2/logging_config.ts +++ b/__fixtures__/output1/google/logging/v2/logging_config.ts @@ -1678,7 +1678,7 @@ export const LogBucket = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, retentionDays: isSet(object.retentionDays) ? Number(object.retentionDays) : 0, locked: isSet(object.locked) ? Boolean(object.locked) : false, - lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : 0, + lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : -1, restrictedFields: Array.isArray(object?.restrictedFields) ? object.restrictedFields.map((e: any) => String(e)) : [], cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined }; @@ -1721,7 +1721,7 @@ export const LogBucket = { updateTime: object.update_time ? Timestamp.fromSDK(object.update_time) : undefined, retentionDays: object?.retention_days, locked: object?.locked, - lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : 0, + lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, restrictedFields: Array.isArray(object?.restricted_fields) ? object.restricted_fields.map((e: any) => e) : [], cmekSettings: object.cmek_settings ? CmekSettings.fromSDK(object.cmek_settings) : undefined }; @@ -1961,7 +1961,7 @@ export const LogSink = { description: isSet(object.description) ? String(object.description) : "", disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : 0, + outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : -1, writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "", includeChildren: isSet(object.includeChildren) ? Boolean(object.includeChildren) : false, bigqueryOptions: isSet(object.bigqueryOptions) ? BigQueryOptions.fromJSON(object.bigqueryOptions) : undefined, @@ -2013,7 +2013,7 @@ export const LogSink = { description: object?.description, disabled: object?.disabled, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromSDK(e)) : [], - outputVersionFormat: isSet(object.output_version_format) ? logSink_VersionFormatFromJSON(object.output_version_format) : 0, + outputVersionFormat: isSet(object.output_version_format) ? logSink_VersionFormatFromJSON(object.output_version_format) : -1, writerIdentity: object?.writer_identity, includeChildren: object?.include_children, bigqueryOptions: object.bigquery_options ? BigQueryOptions.fromSDK(object.bigquery_options) : undefined, @@ -4571,7 +4571,7 @@ export const CopyLogEntriesMetadata = { return { startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined, endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, + state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: isSet(object.cancellationRequested) ? Boolean(object.cancellationRequested) : false, request: isSet(object.request) ? CopyLogEntriesRequest.fromJSON(object.request) : undefined, progress: isSet(object.progress) ? Number(object.progress) : 0, @@ -4604,7 +4604,7 @@ export const CopyLogEntriesMetadata = { return { startTime: object.start_time ? Timestamp.fromSDK(object.start_time) : undefined, endTime: object.end_time ? Timestamp.fromSDK(object.end_time) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, + state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: object?.cancellation_requested, request: object.request ? CopyLogEntriesRequest.fromSDK(object.request) : undefined, progress: object?.progress, diff --git a/__fixtures__/output1/google/logging/v2/logging_metrics.ts b/__fixtures__/output1/google/logging/v2/logging_metrics.ts index 5599698307..0222525e74 100644 --- a/__fixtures__/output1/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/output1/google/logging/v2/logging_metrics.ts @@ -507,7 +507,7 @@ export const LogMetric = { bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toJSON(message: LogMetric): unknown { @@ -569,7 +569,7 @@ export const LogMetric = { bucketOptions: object.bucket_options ? Distribution_BucketOptions.fromSDK(object.bucket_options) : undefined, createTime: object.create_time ? Timestamp.fromSDK(object.create_time) : undefined, updateTime: object.update_time ? Timestamp.fromSDK(object.update_time) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toSDK(message: LogMetric): LogMetricSDKType { diff --git a/__fixtures__/output1/google/protobuf/api.ts b/__fixtures__/output1/google/protobuf/api.ts index 77cdd75779..3dcdc38dae 100644 --- a/__fixtures__/output1/google/protobuf/api.ts +++ b/__fixtures__/output1/google/protobuf/api.ts @@ -355,7 +355,7 @@ export const Api = { version: isSet(object.version) ? String(object.version) : "", sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Api): unknown { @@ -400,7 +400,7 @@ export const Api = { version: object?.version, sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromSDK(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toSDK(message: Api): ApiSDKType { @@ -506,7 +506,7 @@ export const Method = { responseTypeUrl: isSet(object.responseTypeUrl) ? String(object.responseTypeUrl) : "", responseStreaming: isSet(object.responseStreaming) ? Boolean(object.responseStreaming) : false, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Method): unknown { @@ -543,7 +543,7 @@ export const Method = { responseTypeUrl: object?.response_type_url, responseStreaming: object?.response_streaming, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toSDK(message: Method): MethodSDKType { diff --git a/__fixtures__/output1/google/protobuf/descriptor.ts b/__fixtures__/output1/google/protobuf/descriptor.ts index 19db8cd3ab..0ef16ae987 100644 --- a/__fixtures__/output1/google/protobuf/descriptor.ts +++ b/__fixtures__/output1/google/protobuf/descriptor.ts @@ -2134,8 +2134,8 @@ export const FieldDescriptorProto = { return { name: isSet(object.name) ? String(object.name) : "", number: isSet(object.number) ? Number(object.number) : 0, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, typeName: isSet(object.typeName) ? String(object.typeName) : "", extendee: isSet(object.extendee) ? String(object.extendee) : "", defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", @@ -2176,8 +2176,8 @@ export const FieldDescriptorProto = { return { name: object?.name, number: object?.number, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, typeName: object?.type_name, extendee: object?.extendee, defaultValue: object?.default_value, @@ -2919,7 +2919,7 @@ export const FileOptions = { javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) ? Boolean(object.javaGenerateEqualsAndHash) : false, javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, - optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 0, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : -1, goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, @@ -2998,7 +2998,7 @@ export const FileOptions = { javaMultipleFiles: object?.java_multiple_files, javaGenerateEqualsAndHash: object?.java_generate_equals_and_hash, javaStringCheckUtf8: object?.java_string_check_utf8, - optimizeFor: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : 0, + optimizeFor: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : -1, goPackage: object?.go_package, ccGenericServices: object?.cc_generic_services, javaGenericServices: object?.java_generic_services, @@ -3230,9 +3230,9 @@ export const FieldOptions = { }, fromJSON(object: any): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, packed: isSet(object.packed) ? Boolean(object.packed) : false, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, weak: isSet(object.weak) ? Boolean(object.weak) : false, @@ -3267,9 +3267,9 @@ export const FieldOptions = { }, fromSDK(object: FieldOptionsSDKType): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, packed: object?.packed, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, lazy: object?.lazy, deprecated: object?.deprecated, weak: object?.weak, @@ -3638,7 +3638,7 @@ export const MethodOptions = { fromJSON(object: any): MethodOptions { return { deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, + idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : -1, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, @@ -3663,7 +3663,7 @@ export const MethodOptions = { fromSDK(object: MethodOptionsSDKType): MethodOptions { return { deprecated: object?.deprecated, - idempotencyLevel: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : 0, + idempotencyLevel: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : -1, uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] }; }, diff --git a/__fixtures__/output1/google/protobuf/type.ts b/__fixtures__/output1/google/protobuf/type.ts index 4c1e5a6451..506a597bba 100644 --- a/__fixtures__/output1/google/protobuf/type.ts +++ b/__fixtures__/output1/google/protobuf/type.ts @@ -439,7 +439,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => String(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Type): unknown { @@ -481,7 +481,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => e) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toSDK(message: Type): TypeSDKType { @@ -601,8 +601,8 @@ export const Field = { }, fromJSON(object: any): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, number: isSet(object.number) ? Number(object.number) : 0, name: isSet(object.name) ? String(object.name) : "", typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", @@ -647,8 +647,8 @@ export const Field = { }, fromSDK(object: FieldSDKType): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, number: object?.number, name: object?.name, typeUrl: object?.type_url, @@ -741,7 +741,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromJSON(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Enum): unknown { @@ -776,7 +776,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromSDK(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromSDK(e)) : [], sourceContext: object.source_context ? SourceContext.fromSDK(object.source_context) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toSDK(message: Enum): EnumSDKType { diff --git a/__fixtures__/output1/ibc/core/channel/v1/channel.ts b/__fixtures__/output1/ibc/core/channel/v1/channel.ts index 22814a56eb..3f172d002d 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/channel.ts @@ -337,8 +337,8 @@ export const Channel = { }, fromJSON(object: any): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "" @@ -368,8 +368,8 @@ export const Channel = { }, fromSDK(object: ChannelSDKType): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connection_hops) ? object.connection_hops.map((e: any) => e) : [], version: object?.version @@ -462,8 +462,8 @@ export const IdentifiedChannel = { }, fromJSON(object: any): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "", @@ -499,8 +499,8 @@ export const IdentifiedChannel = { }, fromSDK(object: IdentifiedChannelSDKType): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connection_hops) ? object.connection_hops.map((e: any) => e) : [], version: object?.version, diff --git a/__fixtures__/output1/ibc/core/connection/v1/connection.ts b/__fixtures__/output1/ibc/core/connection/v1/connection.ts index cd2733149e..94a4e1d57c 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/connection.ts @@ -261,7 +261,7 @@ export const ConnectionEnd = { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -292,7 +292,7 @@ export const ConnectionEnd = { return { clientId: object?.client_id, versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromSDK(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, delayPeriod: object?.delay_period }; @@ -380,7 +380,7 @@ export const IdentifiedConnection = { id: isSet(object.id) ? String(object.id) : "", clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -414,7 +414,7 @@ export const IdentifiedConnection = { id: object?.id, clientId: object?.client_id, versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromSDK(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, delayPeriod: object?.delay_period }; diff --git a/__fixtures__/output1/ibc/core/port/v1/query.ts b/__fixtures__/output1/ibc/core/port/v1/query.ts index c433700a5e..2f71a6da8e 100644 --- a/__fixtures__/output1/ibc/core/port/v1/query.ts +++ b/__fixtures__/output1/ibc/core/port/v1/query.ts @@ -96,7 +96,7 @@ export const QueryAppVersionRequest = { return { portId: isSet(object.portId) ? String(object.portId) : "", connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, proposedVersion: isSet(object.proposedVersion) ? String(object.proposedVersion) : "" }; @@ -123,7 +123,7 @@ export const QueryAppVersionRequest = { return { portId: object?.port_id, connectionId: object?.connection_id, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, proposedVersion: object?.proposed_version }; diff --git a/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts index 11e06b6e68..dcddec31c0 100644 --- a/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/output1/ibc/lightclients/solomachine/v1/solomachine.ts @@ -789,7 +789,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -813,7 +813,7 @@ export const SignatureAndData = { fromSDK(object: SignatureAndDataSDKType): SignatureAndData { return { signature: object?.signature, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, data: object?.data, timestamp: object?.timestamp }; @@ -956,7 +956,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, @@ -983,7 +983,7 @@ export const SignBytes = { sequence: object?.sequence, timestamp: object?.timestamp, diversifier: object?.diversifier, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, data: object?.data }; }, diff --git a/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts index dbddc2365f..ba2d56f27a 100644 --- a/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/output1/ibc/lightclients/solomachine/v2/solomachine.ts @@ -789,7 +789,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -813,7 +813,7 @@ export const SignatureAndData = { fromSDK(object: SignatureAndDataSDKType): SignatureAndData { return { signature: object?.signature, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, data: object?.data, timestamp: object?.timestamp }; @@ -956,7 +956,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, @@ -983,7 +983,7 @@ export const SignBytes = { sequence: object?.sequence, timestamp: object?.timestamp, diversifier: object?.diversifier, - dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : 0, + dataType: isSet(object.data_type) ? dataTypeFromJSON(object.data_type) : -1, data: object?.data }; }, diff --git a/__fixtures__/output1/osmosis/claim/v1beta1/query.ts b/__fixtures__/output1/osmosis/claim/v1beta1/query.ts index b08648acb0..d1ae385fd4 100644 --- a/__fixtures__/output1/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/output1/osmosis/claim/v1beta1/query.ts @@ -415,7 +415,7 @@ export const QueryClaimableForActionRequest = { fromJSON(object: any): QueryClaimableForActionRequest { return { address: isSet(object.address) ? String(object.address) : "", - action: isSet(object.action) ? actionFromJSON(object.action) : 0 + action: isSet(object.action) ? actionFromJSON(object.action) : -1 }; }, toJSON(message: QueryClaimableForActionRequest): unknown { @@ -433,7 +433,7 @@ export const QueryClaimableForActionRequest = { fromSDK(object: QueryClaimableForActionRequestSDKType): QueryClaimableForActionRequest { return { address: object?.address, - action: isSet(object.action) ? actionFromJSON(object.action) : 0 + action: isSet(object.action) ? actionFromJSON(object.action) : -1 }; }, toSDK(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestSDKType { diff --git a/__fixtures__/output1/osmosis/lockup/lock.ts b/__fixtures__/output1/osmosis/lockup/lock.ts index adc1399ad4..07bfff262f 100644 --- a/__fixtures__/output1/osmosis/lockup/lock.ts +++ b/__fixtures__/output1/osmosis/lockup/lock.ts @@ -323,7 +323,7 @@ export const QueryCondition = { }, fromJSON(object: any): QueryCondition { return { - lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : 0, + lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : -1, denom: isSet(object.denom) ? String(object.denom) : "", duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined @@ -347,7 +347,7 @@ export const QueryCondition = { }, fromSDK(object: QueryConditionSDKType): QueryCondition { return { - lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : 0, + lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, denom: object?.denom, duration: object.duration ? Duration.fromSDK(object.duration) : undefined, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined diff --git a/__fixtures__/output1/osmosis/superfluid/query.ts b/__fixtures__/output1/osmosis/superfluid/query.ts index 806d15ce80..3d3c9c851c 100644 --- a/__fixtures__/output1/osmosis/superfluid/query.ts +++ b/__fixtures__/output1/osmosis/superfluid/query.ts @@ -401,7 +401,7 @@ export const AssetTypeResponse = { }, fromJSON(object: any): AssetTypeResponse { return { - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 }; }, toJSON(message: AssetTypeResponse): unknown { @@ -416,7 +416,7 @@ export const AssetTypeResponse = { }, fromSDK(object: AssetTypeResponseSDKType): AssetTypeResponse { return { - assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : 0 + assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : -1 }; }, toSDK(message: AssetTypeResponse): AssetTypeResponseSDKType { diff --git a/__fixtures__/output1/osmosis/superfluid/superfluid.ts b/__fixtures__/output1/osmosis/superfluid/superfluid.ts index d029e031cd..6225b34863 100644 --- a/__fixtures__/output1/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/output1/osmosis/superfluid/superfluid.ts @@ -185,7 +185,7 @@ export const SuperfluidAsset = { fromJSON(object: any): SuperfluidAsset { return { denom: isSet(object.denom) ? String(object.denom) : "", - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 }; }, toJSON(message: SuperfluidAsset): unknown { @@ -203,7 +203,7 @@ export const SuperfluidAsset = { fromSDK(object: SuperfluidAssetSDKType): SuperfluidAsset { return { denom: object?.denom, - assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : 0 + assetType: isSet(object.asset_type) ? superfluidAssetTypeFromJSON(object.asset_type) : -1 }; }, toSDK(message: SuperfluidAsset): SuperfluidAssetSDKType { diff --git a/__fixtures__/output1/tendermint/abci/types.ts b/__fixtures__/output1/tendermint/abci/types.ts index 298214dd1a..4cae968a16 100644 --- a/__fixtures__/output1/tendermint/abci/types.ts +++ b/__fixtures__/output1/tendermint/abci/types.ts @@ -1557,7 +1557,7 @@ export const RequestCheckTx = { fromJSON(object: any): RequestCheckTx { return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 }; }, toJSON(message: RequestCheckTx): unknown { @@ -1575,7 +1575,7 @@ export const RequestCheckTx = { fromSDK(object: RequestCheckTxSDKType): RequestCheckTx { return { tx: object?.tx, - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 }; }, toSDK(message: RequestCheckTx): RequestCheckTxSDKType { @@ -3418,7 +3418,7 @@ export const ResponseOfferSnapshot = { }, fromJSON(object: any): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 }; }, toJSON(message: ResponseOfferSnapshot): unknown { @@ -3433,7 +3433,7 @@ export const ResponseOfferSnapshot = { }, fromSDK(object: ResponseOfferSnapshotSDKType): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 }; }, toSDK(message: ResponseOfferSnapshot): ResponseOfferSnapshotSDKType { @@ -3551,7 +3551,7 @@ export const ResponseApplySnapshotChunk = { }, fromJSON(object: any): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, refetchChunks: Array.isArray(object?.refetchChunks) ? object.refetchChunks.map((e: any) => Number(e)) : [], rejectSenders: Array.isArray(object?.rejectSenders) ? object.rejectSenders.map((e: any) => String(e)) : [] }; @@ -3580,7 +3580,7 @@ export const ResponseApplySnapshotChunk = { }, fromSDK(object: ResponseApplySnapshotChunkSDKType): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, refetchChunks: Array.isArray(object?.refetch_chunks) ? object.refetch_chunks.map((e: any) => e) : [], rejectSenders: Array.isArray(object?.reject_senders) ? object.reject_senders.map((e: any) => e) : [] }; @@ -4339,7 +4339,7 @@ export const Evidence = { }, fromJSON(object: any): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, @@ -4366,7 +4366,7 @@ export const Evidence = { }, fromSDK(object: EvidenceSDKType): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: object.validator ? Validator.fromSDK(object.validator) : undefined, height: object?.height, time: object.time ? Timestamp.fromSDK(object.time) : undefined, diff --git a/__fixtures__/output1/tendermint/types/types.ts b/__fixtures__/output1/tendermint/types/types.ts index 741f0f90e8..08375725d4 100644 --- a/__fixtures__/output1/tendermint/types/types.ts +++ b/__fixtures__/output1/tendermint/types/types.ts @@ -863,7 +863,7 @@ export const Vote = { }, fromJSON(object: any): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, @@ -899,7 +899,7 @@ export const Vote = { }, fromSDK(object: VoteSDKType): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: object?.height, round: object?.round, blockId: object.block_id ? BlockID.fromSDK(object.block_id) : undefined, @@ -1073,7 +1073,7 @@ export const CommitSig = { }, fromJSON(object: any): CommitSig { return { - blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : -1, validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() @@ -1097,7 +1097,7 @@ export const CommitSig = { }, fromSDK(object: CommitSigSDKType): CommitSig { return { - blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : 0, + blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, validatorAddress: object?.validator_address, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, signature: object?.signature @@ -1185,7 +1185,7 @@ export const Proposal = { }, fromJSON(object: any): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, polRound: isSet(object.polRound) ? Number(object.polRound) : 0, @@ -1218,7 +1218,7 @@ export const Proposal = { }, fromSDK(object: ProposalSDKType): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: object?.height, round: object?.round, polRound: object?.pol_round, diff --git a/__fixtures__/output2/akash/base/v1beta1/endpoint.ts b/__fixtures__/output2/akash/base/v1beta1/endpoint.ts index 9e48df34d6..e168e1ada0 100644 --- a/__fixtures__/output2/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/output2/akash/base/v1beta1/endpoint.ts @@ -71,7 +71,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0 + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 }; }, toJSON(message: Endpoint): unknown { diff --git a/__fixtures__/output2/akash/base/v1beta2/endpoint.ts b/__fixtures__/output2/akash/base/v1beta2/endpoint.ts index 2c86f36889..378a52e832 100644 --- a/__fixtures__/output2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/output2/akash/base/v1beta2/endpoint.ts @@ -86,7 +86,7 @@ export const Endpoint = { }, fromJSON(object: any): Endpoint { return { - kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1, sequenceNumber: isSet(object.sequenceNumber) ? Number(object.sequenceNumber) : 0 }; }, diff --git a/__fixtures__/output2/akash/cert/v1beta2/cert.ts b/__fixtures__/output2/akash/cert/v1beta2/cert.ts index 25487ab01e..31c3472cc7 100644 --- a/__fixtures__/output2/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/output2/akash/cert/v1beta2/cert.ts @@ -174,7 +174,7 @@ export const Certificate = { }, fromJSON(object: any): Certificate { return { - state: isSet(object.state) ? certificate_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? certificate_StateFromJSON(object.state) : -1, cert: isSet(object.cert) ? bytesFromBase64(object.cert) : new Uint8Array(), pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; diff --git a/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts index f35b4c0e57..9ce00a4a6a 100644 --- a/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/output2/akash/deployment/v1beta1/deployment.ts @@ -581,7 +581,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta1/group.ts b/__fixtures__/output2/akash/deployment/v1beta1/group.ts index 7cd6f19209..3109ae0621 100644 --- a/__fixtures__/output2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/output2/akash/deployment/v1beta1/group.ts @@ -524,7 +524,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts index 060689c516..751ae45ef5 100644 --- a/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/output2/akash/deployment/v1beta2/deployment.ts @@ -169,7 +169,7 @@ export const Deployment = { fromJSON(object: any): Deployment { return { deploymentId: isSet(object.deploymentId) ? DeploymentID.fromJSON(object.deploymentId) : undefined, - state: isSet(object.state) ? deployment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? deployment_StateFromJSON(object.state) : -1, version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array(), createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/deployment/v1beta2/group.ts b/__fixtures__/output2/akash/deployment/v1beta2/group.ts index 554e50a1e8..c4777c9b60 100644 --- a/__fixtures__/output2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/output2/akash/deployment/v1beta2/group.ts @@ -119,7 +119,7 @@ export const Group = { fromJSON(object: any): Group { return { groupId: isSet(object.groupId) ? GroupID.fromJSON(object.groupId) : undefined, - state: isSet(object.state) ? group_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? group_StateFromJSON(object.state) : -1, groupSpec: isSet(object.groupSpec) ? GroupSpec.fromJSON(object.groupSpec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/escrow/v1beta1/types.ts b/__fixtures__/output2/akash/escrow/v1beta1/types.ts index 34b3684589..efd88d401d 100644 --- a/__fixtures__/output2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/output2/akash/escrow/v1beta1/types.ts @@ -251,7 +251,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? Coin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO @@ -354,7 +354,7 @@ export const Payment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? payment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? payment_StateFromJSON(object.state) : -1, rate: isSet(object.rate) ? Coin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined diff --git a/__fixtures__/output2/akash/escrow/v1beta2/types.ts b/__fixtures__/output2/akash/escrow/v1beta2/types.ts index c06e36a1e9..0b2c41d7ea 100644 --- a/__fixtures__/output2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/output2/akash/escrow/v1beta2/types.ts @@ -276,7 +276,7 @@ export const Account = { return { id: isSet(object.id) ? AccountID.fromJSON(object.id) : undefined, owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? account_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? account_StateFromJSON(object.state) : -1, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, transferred: isSet(object.transferred) ? DecCoin.fromJSON(object.transferred) : undefined, settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO, @@ -385,7 +385,7 @@ export const FractionalPayment = { accountId: isSet(object.accountId) ? AccountID.fromJSON(object.accountId) : undefined, paymentId: isSet(object.paymentId) ? String(object.paymentId) : "", owner: isSet(object.owner) ? String(object.owner) : "", - state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? fractionalPayment_StateFromJSON(object.state) : -1, rate: isSet(object.rate) ? DecCoin.fromJSON(object.rate) : undefined, balance: isSet(object.balance) ? DecCoin.fromJSON(object.balance) : undefined, withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined diff --git a/__fixtures__/output2/akash/market/v1beta2/bid.ts b/__fixtures__/output2/akash/market/v1beta2/bid.ts index 48ff656f0d..e6eed1d394 100644 --- a/__fixtures__/output2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/output2/akash/market/v1beta2/bid.ts @@ -425,7 +425,7 @@ export const Bid = { fromJSON(object: any): Bid { return { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, - state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : -1, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/akash/market/v1beta2/lease.ts b/__fixtures__/output2/akash/market/v1beta2/lease.ts index 1e232b84d4..755693c6f4 100644 --- a/__fixtures__/output2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/output2/akash/market/v1beta2/lease.ts @@ -240,7 +240,7 @@ export const Lease = { fromJSON(object: any): Lease { return { leaseId: isSet(object.leaseId) ? LeaseID.fromJSON(object.leaseId) : undefined, - state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : -1, price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO, closedOn: isSet(object.closedOn) ? Long.fromValue(object.closedOn) : Long.ZERO diff --git a/__fixtures__/output2/akash/market/v1beta2/order.ts b/__fixtures__/output2/akash/market/v1beta2/order.ts index ac56fbf7b1..71d9aadc3e 100644 --- a/__fixtures__/output2/akash/market/v1beta2/order.ts +++ b/__fixtures__/output2/akash/market/v1beta2/order.ts @@ -201,7 +201,7 @@ export const Order = { fromJSON(object: any): Order { return { orderId: isSet(object.orderId) ? OrderID.fromJSON(object.orderId) : undefined, - state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, + state: isSet(object.state) ? order_StateFromJSON(object.state) : -1, spec: isSet(object.spec) ? GroupSpec.fromJSON(object.spec) : undefined, createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; diff --git a/__fixtures__/output2/confio/proofs.ts b/__fixtures__/output2/confio/proofs.ts index 00fe69ac10..0f29fe01c1 100644 --- a/__fixtures__/output2/confio/proofs.ts +++ b/__fixtures__/output2/confio/proofs.ts @@ -598,10 +598,10 @@ export const LeafOp = { }, fromJSON(object: any): LeafOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, - prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0, - prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : -1, + prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : -1, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, @@ -669,7 +669,7 @@ export const InnerOp = { }, fromJSON(object: any): InnerOp { return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() }; @@ -844,7 +844,7 @@ export const InnerSpec = { minPrefixLength: isSet(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, maxPrefixLength: isSet(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0 + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 }; }, toJSON(message: InnerSpec): unknown { diff --git a/__fixtures__/output2/cosmos/gov/v1/gov.ts b/__fixtures__/output2/cosmos/gov/v1/gov.ts index c87ac67fcf..8773da30cb 100644 --- a/__fixtures__/output2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/output2/cosmos/gov/v1/gov.ts @@ -256,7 +256,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -438,7 +438,7 @@ export const Proposal = { return { id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, diff --git a/__fixtures__/output2/cosmos/gov/v1/query.ts b/__fixtures__/output2/cosmos/gov/v1/query.ts index ab324e3dd0..b53a523e84 100644 --- a/__fixtures__/output2/cosmos/gov/v1/query.ts +++ b/__fixtures__/output2/cosmos/gov/v1/query.ts @@ -254,7 +254,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined diff --git a/__fixtures__/output2/cosmos/gov/v1/tx.ts b/__fixtures__/output2/cosmos/gov/v1/tx.ts index 420d2bbaf4..b34c83f4c6 100644 --- a/__fixtures__/output2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/output2/cosmos/gov/v1/tx.ts @@ -329,7 +329,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts index c61bca2e25..bd7207e852 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/gov.ts @@ -267,7 +267,7 @@ export const WeightedVoteOption = { }, fromJSON(object: any): WeightedVoteOption { return { - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, weight: isSet(object.weight) ? String(object.weight) : "" }; }, @@ -497,7 +497,7 @@ export const Proposal = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined, @@ -666,7 +666,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/query.ts b/__fixtures__/output2/cosmos/gov/v1beta1/query.ts index ba1deb10c6..da8c8a22a5 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/query.ts @@ -254,7 +254,7 @@ export const QueryProposalsRequest = { }, fromJSON(object: any): QueryProposalsRequest { return { - proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : 0, + proposalStatus: isSet(object.proposalStatus) ? proposalStatusFromJSON(object.proposalStatus) : -1, voter: isSet(object.voter) ? String(object.voter) : "", depositor: isSet(object.depositor) ? String(object.depositor) : "", pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined diff --git a/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts index ba19024926..bf9105267b 100644 --- a/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/output2/cosmos/gov/v1beta1/tx.ts @@ -212,7 +212,7 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0 + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 }; }, toJSON(message: MsgVote): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/events.ts b/__fixtures__/output2/cosmos/group/v1/events.ts index f58d2710ed..4d0e157955 100644 --- a/__fixtures__/output2/cosmos/group/v1/events.ts +++ b/__fixtures__/output2/cosmos/group/v1/events.ts @@ -407,7 +407,7 @@ export const EventExec = { fromJSON(object: any): EventExec { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, - result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : 0 + result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 }; }, toJSON(message: EventExec): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/tx.ts b/__fixtures__/output2/cosmos/group/v1/tx.ts index 692438fe1f..cfc51a7f7e 100644 --- a/__fixtures__/output2/cosmos/group/v1/tx.ts +++ b/__fixtures__/output2/cosmos/group/v1/tx.ts @@ -1280,7 +1280,7 @@ export const MsgSubmitProposal = { proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], metadata: isSet(object.metadata) ? String(object.metadata) : "", messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toJSON(message: MsgSubmitProposal): unknown { @@ -1504,9 +1504,9 @@ export const MsgVote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "", - exec: isSet(object.exec) ? execFromJSON(object.exec) : 0 + exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, toJSON(message: MsgVote): unknown { diff --git a/__fixtures__/output2/cosmos/group/v1/types.ts b/__fixtures__/output2/cosmos/group/v1/types.ts index 0e03c3dfc2..a57c087c3d 100644 --- a/__fixtures__/output2/cosmos/group/v1/types.ts +++ b/__fixtures__/output2/cosmos/group/v1/types.ts @@ -1057,11 +1057,11 @@ export const Proposal = { submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined, groupVersion: isSet(object.groupVersion) ? Long.fromValue(object.groupVersion) : Long.UZERO, groupPolicyVersion: isSet(object.groupPolicyVersion) ? Long.fromValue(object.groupPolicyVersion) : Long.UZERO, - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : 0, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, + result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, votingPeriodEnd: isSet(object.votingPeriodEnd) ? fromJsonTimestamp(object.votingPeriodEnd) : undefined, - executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : 0, + executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; }, @@ -1244,7 +1244,7 @@ export const Vote = { return { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO, voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: isSet(object.metadata) ? String(object.metadata) : "", submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined }; diff --git a/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts index 93a88349ac..8cc20a96f8 100644 --- a/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/output2/cosmos/orm/v1alpha1/schema.ts @@ -221,7 +221,7 @@ export const ModuleSchemaDescriptor_FileEntry = { return { id: isSet(object.id) ? Number(object.id) : 0, protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", - storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : 0 + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 }; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { diff --git a/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts b/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts index 0bbb07d920..a85a9a35e4 100644 --- a/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/output2/cosmos/staking/v1beta1/authz.ts @@ -135,7 +135,7 @@ export const StakeAuthorization = { maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, - authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : 0 + authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 }; }, toJSON(message: StakeAuthorization): unknown { diff --git a/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts index 580527ecf9..3c5eca59d4 100644 --- a/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/output2/cosmos/staking/v1beta1/staking.ts @@ -639,7 +639,7 @@ export const Validator = { operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, tokens: isSet(object.tokens) ? String(object.tokens) : "", delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "", description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, diff --git a/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts index 0821c7012d..66d9d8bae6 100644 --- a/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/output2/cosmos/tx/signing/v1beta1/signing.ts @@ -333,7 +333,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() }; }, diff --git a/__fixtures__/output2/cosmos/tx/v1beta1/service.ts b/__fixtures__/output2/cosmos/tx/v1beta1/service.ts index a50abc827e..205cb85ef2 100644 --- a/__fixtures__/output2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/output2/cosmos/tx/v1beta1/service.ts @@ -259,7 +259,7 @@ export const GetTxsEventRequest = { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0 + orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 }; }, toJSON(message: GetTxsEventRequest): unknown { @@ -393,7 +393,7 @@ export const BroadcastTxRequest = { fromJSON(object: any): BroadcastTxRequest { return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 }; }, toJSON(message: BroadcastTxRequest): unknown { diff --git a/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts index 9a3368ff60..b20d202406 100644 --- a/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/output2/cosmos/tx/v1beta1/tx.ts @@ -720,7 +720,7 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 }; }, toJSON(message: ModeInfo_Single): unknown { diff --git a/__fixtures__/output2/cosmwasm/wasm/v1/types.ts b/__fixtures__/output2/cosmwasm/wasm/v1/types.ts index f296c7b376..3741b6b0d9 100644 --- a/__fixtures__/output2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/output2/cosmwasm/wasm/v1/types.ts @@ -204,7 +204,7 @@ export const AccessTypeParam = { }, fromJSON(object: any): AccessTypeParam { return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0 + value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 }; }, toJSON(message: AccessTypeParam): unknown { @@ -256,7 +256,7 @@ export const AccessConfig = { }, fromJSON(object: any): AccessConfig { return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : 0, + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, address: isSet(object.address) ? String(object.address) : "" }; }, @@ -312,7 +312,7 @@ export const Params = { fromJSON(object: any): Params { return { codeUploadAccess: isSet(object.codeUploadAccess) ? AccessConfig.fromJSON(object.codeUploadAccess) : undefined, - instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : 0 + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : -1 }; }, toJSON(message: Params): unknown { @@ -550,7 +550,7 @@ export const ContractCodeHistoryEntry = { }, fromJSON(object: any): ContractCodeHistoryEntry { return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : 0, + operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO, updated: isSet(object.updated) ? AbsoluteTxPosition.fromJSON(object.updated) : undefined, msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() diff --git a/__fixtures__/output2/evmos/claims/v1/claims.ts b/__fixtures__/output2/evmos/claims/v1/claims.ts index c207902efc..2f3a46c7f9 100644 --- a/__fixtures__/output2/evmos/claims/v1/claims.ts +++ b/__fixtures__/output2/evmos/claims/v1/claims.ts @@ -133,7 +133,7 @@ export const Claim = { }, fromJSON(object: any): Claim { return { - action: isSet(object.action) ? actionFromJSON(object.action) : 0, + action: isSet(object.action) ? actionFromJSON(object.action) : -1, completed: isSet(object.completed) ? Boolean(object.completed) : false, claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" }; diff --git a/__fixtures__/output2/evmos/erc20/v1/erc20.ts b/__fixtures__/output2/evmos/erc20/v1/erc20.ts index f6c77203cb..c29f48efad 100644 --- a/__fixtures__/output2/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/output2/evmos/erc20/v1/erc20.ts @@ -152,7 +152,7 @@ export const TokenPair = { erc20Address: isSet(object.erc20Address) ? String(object.erc20Address) : "", denom: isSet(object.denom) ? String(object.denom) : "", enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : 0 + contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 }; }, toJSON(message: TokenPair): unknown { diff --git a/__fixtures__/output2/google/api/backend.ts b/__fixtures__/output2/google/api/backend.ts index f8cdf17db6..6c5c105481 100644 --- a/__fixtures__/output2/google/api/backend.ts +++ b/__fixtures__/output2/google/api/backend.ts @@ -329,7 +329,7 @@ export const BackendRule = { deadline: isSet(object.deadline) ? Number(object.deadline) : 0, minDeadline: isSet(object.minDeadline) ? Number(object.minDeadline) : 0, operationDeadline: isSet(object.operationDeadline) ? Number(object.operationDeadline) : 0, - pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : 0, + pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : -1, jwtAudience: isSet(object.jwtAudience) ? String(object.jwtAudience) : undefined, disableAuth: isSet(object.disableAuth) ? Boolean(object.disableAuth) : undefined, protocol: isSet(object.protocol) ? String(object.protocol) : "" diff --git a/__fixtures__/output2/google/api/config_change.ts b/__fixtures__/output2/google/api/config_change.ts index 160e3b8363..46e5102258 100644 --- a/__fixtures__/output2/google/api/config_change.ts +++ b/__fixtures__/output2/google/api/config_change.ts @@ -174,7 +174,7 @@ export const ConfigChange = { element: isSet(object.element) ? String(object.element) : "", oldValue: isSet(object.oldValue) ? String(object.oldValue) : "", newValue: isSet(object.newValue) ? String(object.newValue) : "", - changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : 0, + changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : -1, advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/api/consumer.ts b/__fixtures__/output2/google/api/consumer.ts index 674dc0cd3c..4c39f9dc4b 100644 --- a/__fixtures__/output2/google/api/consumer.ts +++ b/__fixtures__/output2/google/api/consumer.ts @@ -194,7 +194,7 @@ export const Property = { fromJSON(object: any): Property { return { name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, description: isSet(object.description) ? String(object.description) : "" }; }, diff --git a/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts index c6b04992e1..92abfe1ee3 100644 --- a/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/output2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -678,7 +678,7 @@ export const IssueDetails = { }, fromJSON(object: any): IssueDetails { return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, position: isSet(object.position) ? SourcePosition.fromJSON(object.position) : undefined, id: isSet(object.id) ? Long.fromValue(object.id) : Long.ZERO }; diff --git a/__fixtures__/output2/google/api/label.ts b/__fixtures__/output2/google/api/label.ts index 41447584df..87a63aa5fa 100644 --- a/__fixtures__/output2/google/api/label.ts +++ b/__fixtures__/output2/google/api/label.ts @@ -98,7 +98,7 @@ export const LabelDescriptor = { fromJSON(object: any): LabelDescriptor { return { key: isSet(object.key) ? String(object.key) : "", - valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : 0, + valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, description: isSet(object.description) ? String(object.description) : "" }; }, diff --git a/__fixtures__/output2/google/api/metric.ts b/__fixtures__/output2/google/api/metric.ts index 3f5d4193bb..4f5abfce47 100644 --- a/__fixtures__/output2/google/api/metric.ts +++ b/__fixtures__/output2/google/api/metric.ts @@ -447,13 +447,13 @@ export const MetricDescriptor = { name: isSet(object.name) ? String(object.name) : "", type: isSet(object.type) ? String(object.type) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : 0, - valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : 0, + metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : -1, + valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : -1, unit: isSet(object.unit) ? String(object.unit) : "", description: isSet(object.description) ? String(object.description) : "", displayName: isSet(object.displayName) ? String(object.displayName) : "", metadata: isSet(object.metadata) ? MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata) : undefined, - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] }; }, @@ -541,7 +541,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { return { - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, samplePeriod: isSet(object.samplePeriod) ? Duration.fromJSON(object.samplePeriod) : undefined, ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined }; diff --git a/__fixtures__/output2/google/api/monitored_resource.ts b/__fixtures__/output2/google/api/monitored_resource.ts index 24e705948c..ad7016c003 100644 --- a/__fixtures__/output2/google/api/monitored_resource.ts +++ b/__fixtures__/output2/google/api/monitored_resource.ts @@ -190,7 +190,7 @@ export const MonitoredResourceDescriptor = { displayName: isSet(object.displayName) ? String(object.displayName) : "", description: isSet(object.description) ? String(object.description) : "", labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0 + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 }; }, toJSON(message: MonitoredResourceDescriptor): unknown { diff --git a/__fixtures__/output2/google/api/resource.ts b/__fixtures__/output2/google/api/resource.ts index 0dc3c37b6d..b24e26584a 100644 --- a/__fixtures__/output2/google/api/resource.ts +++ b/__fixtures__/output2/google/api/resource.ts @@ -355,7 +355,7 @@ export const ResourceDescriptor = { type: isSet(object.type) ? String(object.type) : "", pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => String(e)) : [], nameField: isSet(object.nameField) ? String(object.nameField) : "", - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0, + history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, plural: isSet(object.plural) ? String(object.plural) : "", singular: isSet(object.singular) ? String(object.singular) : "", style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts index 22115dff40..49aefba798 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/check_error.ts @@ -268,7 +268,7 @@ export const CheckError = { }, fromJSON(object: any): CheckError { return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, subject: isSet(object.subject) ? String(object.subject) : "", detail: isSet(object.detail) ? String(object.detail) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts index 0c0aabc937..a76f31c3b9 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/log_entry.ts @@ -294,7 +294,7 @@ export const LogEntry = { return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts b/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts index c7ee7be2e4..e5bb181d92 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/operation.ts @@ -301,7 +301,7 @@ export const Operation = { }, {}) : {}, metricValueSets: Array.isArray(object?.metricValueSets) ? object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)) : [], logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : 0, + importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts index 4296797140..d9e32ebed7 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/quota_controller.ts @@ -497,7 +497,7 @@ export const QuotaOperation = { return acc; }, {}) : {}, quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : 0 + quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 }; }, toJSON(message: QuotaOperation): unknown { @@ -672,7 +672,7 @@ export const QuotaError = { }, fromJSON(object: any): QuotaError { return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : 0, + code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, subject: isSet(object.subject) ? String(object.subject) : "", description: isSet(object.description) ? String(object.description) : "", status: isSet(object.status) ? Status.fromJSON(object.status) : undefined diff --git a/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts index 756b588bda..ef62845db5 100644 --- a/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/output2/google/api/servicecontrol/v1/service_controller.ts @@ -479,7 +479,7 @@ export const CheckResponse_ConsumerInfo = { fromJSON(object: any): CheckResponse_ConsumerInfo { return { projectNumber: isSet(object.projectNumber) ? Long.fromValue(object.projectNumber) : Long.ZERO, - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, consumerNumber: isSet(object.consumerNumber) ? Long.fromValue(object.consumerNumber) : Long.ZERO }; }, diff --git a/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts b/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts index 543d0410a8..bf7b477872 100644 --- a/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/output2/google/api/servicemanagement/v1/resources.ts @@ -611,7 +611,7 @@ export const OperationMetadata_Step = { fromJSON(object: any): OperationMetadata_Step { return { description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : 0 + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 }; }, toJSON(message: OperationMetadata_Step): unknown { @@ -673,7 +673,7 @@ export const Diagnostic = { fromJSON(object: any): Diagnostic { return { location: isSet(object.location) ? String(object.location) : "", - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : 0, + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, message: isSet(object.message) ? String(object.message) : "" }; }, @@ -798,7 +798,7 @@ export const ConfigFile = { return { filePath: isSet(object.filePath) ? String(object.filePath) : "", fileContents: isSet(object.fileContents) ? bytesFromBase64(object.fileContents) : new Uint8Array(), - fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : 0 + fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 }; }, toJSON(message: ConfigFile): unknown { @@ -986,7 +986,7 @@ export const Rollout = { rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "", createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, createdBy: isSet(object.createdBy) ? String(object.createdBy) : "", - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : 0, + status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: isSet(object.trafficPercentStrategy) ? Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy) : undefined, deleteServiceStrategy: isSet(object.deleteServiceStrategy) ? Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy) : undefined, serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" diff --git a/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts index 43461f68d8..05e976af53 100644 --- a/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/output2/google/api/servicemanagement/v1/servicemanager.ts @@ -677,7 +677,7 @@ export const GetServiceConfigRequest = { return { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", configId: isSet(object.configId) ? String(object.configId) : "", - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : 0 + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 }; }, toJSON(message: GetServiceConfigRequest): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1/resources.ts b/__fixtures__/output2/google/api/serviceusage/v1/resources.ts index 499897245c..8adb3064c5 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1/resources.ts @@ -190,7 +190,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toJSON(message: Service): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts index 7456f21b04..9d9e4abdc3 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1/serviceusage.ts @@ -365,7 +365,7 @@ export const DisableServiceRequest = { return { name: isSet(object.name) ? String(object.name) : "", disableDependentServices: isSet(object.disableDependentServices) ? Boolean(object.disableDependentServices) : false, - checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : 0 + checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 }; }, toJSON(message: DisableServiceRequest): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts index c74df49537..5af46280f8 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1beta1/resources.ts @@ -567,7 +567,7 @@ export const Service = { name: isSet(object.name) ? String(object.name) : "", parent: isSet(object.parent) ? String(object.parent) : "", config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : 0 + state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, toJSON(message: Service): unknown { diff --git a/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts index 1a8b822158..1770f21986 100644 --- a/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/output2/google/api/serviceusage/v1beta1/serviceusage.ts @@ -944,7 +944,7 @@ export const ListConsumerQuotaMetricsRequest = { parent: isSet(object.parent) ? String(object.parent) : "", pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: ListConsumerQuotaMetricsRequest): unknown { @@ -1062,7 +1062,7 @@ export const GetConsumerQuotaMetricRequest = { fromJSON(object: any): GetConsumerQuotaMetricRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: GetConsumerQuotaMetricRequest): unknown { @@ -1117,7 +1117,7 @@ export const GetConsumerQuotaLimitRequest = { fromJSON(object: any): GetConsumerQuotaLimitRequest { return { name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : 0 + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, toJSON(message: GetConsumerQuotaLimitRequest): unknown { @@ -2612,7 +2612,7 @@ export const GetServiceIdentityResponse = { fromJSON(object: any): GetServiceIdentityResponse { return { identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : 0 + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 }; }, toJSON(message: GetServiceIdentityResponse): unknown { diff --git a/__fixtures__/output2/google/logging/v2/log_entry.ts b/__fixtures__/output2/google/logging/v2/log_entry.ts index 4fe2acd202..07355f983a 100644 --- a/__fixtures__/output2/google/logging/v2/log_entry.ts +++ b/__fixtures__/output2/google/logging/v2/log_entry.ts @@ -439,7 +439,7 @@ export const LogEntry = { jsonPayload: isSet(object.jsonPayload) ? Struct.fromJSON(object.jsonPayload) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, receiveTimestamp: isSet(object.receiveTimestamp) ? fromJsonTimestamp(object.receiveTimestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: isSet(object.insertId) ? String(object.insertId) : "", httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ diff --git a/__fixtures__/output2/google/logging/v2/logging.ts b/__fixtures__/output2/google/logging/v2/logging.ts index 8587a09318..76e80e18db 100644 --- a/__fixtures__/output2/google/logging/v2/logging.ts +++ b/__fixtures__/output2/google/logging/v2/logging.ts @@ -1350,7 +1350,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : 0, + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 }; }, diff --git a/__fixtures__/output2/google/logging/v2/logging_config.ts b/__fixtures__/output2/google/logging/v2/logging_config.ts index 393e082e73..296d194da3 100644 --- a/__fixtures__/output2/google/logging/v2/logging_config.ts +++ b/__fixtures__/output2/google/logging/v2/logging_config.ts @@ -1391,7 +1391,7 @@ export const LogBucket = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, retentionDays: isSet(object.retentionDays) ? Number(object.retentionDays) : 0, locked: isSet(object.locked) ? Boolean(object.locked) : false, - lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : 0, + lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : -1, restrictedFields: Array.isArray(object?.restrictedFields) ? object.restrictedFields.map((e: any) => String(e)) : [], cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined }; @@ -1626,7 +1626,7 @@ export const LogSink = { description: isSet(object.description) ? String(object.description) : "", disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : 0, + outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : -1, writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "", includeChildren: isSet(object.includeChildren) ? Boolean(object.includeChildren) : false, bigqueryOptions: isSet(object.bigqueryOptions) ? BigQueryOptions.fromJSON(object.bigqueryOptions) : undefined, @@ -3752,7 +3752,7 @@ export const CopyLogEntriesMetadata = { return { startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined, endTime: isSet(object.endTime) ? fromJsonTimestamp(object.endTime) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : 0, + state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: isSet(object.cancellationRequested) ? Boolean(object.cancellationRequested) : false, request: isSet(object.request) ? CopyLogEntriesRequest.fromJSON(object.request) : undefined, progress: isSet(object.progress) ? Number(object.progress) : 0, diff --git a/__fixtures__/output2/google/logging/v2/logging_metrics.ts b/__fixtures__/output2/google/logging/v2/logging_metrics.ts index 2ed460af14..ced50d3e99 100644 --- a/__fixtures__/output2/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/output2/google/logging/v2/logging_metrics.ts @@ -438,7 +438,7 @@ export const LogMetric = { bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined, updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : 0 + version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toJSON(message: LogMetric): unknown { diff --git a/__fixtures__/output2/google/protobuf/api.ts b/__fixtures__/output2/google/protobuf/api.ts index 72a38d7d93..58bffad3e6 100644 --- a/__fixtures__/output2/google/protobuf/api.ts +++ b/__fixtures__/output2/google/protobuf/api.ts @@ -243,7 +243,7 @@ export const Api = { version: isSet(object.version) ? String(object.version) : "", sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Api): unknown { @@ -360,7 +360,7 @@ export const Method = { responseTypeUrl: isSet(object.responseTypeUrl) ? String(object.responseTypeUrl) : "", responseStreaming: isSet(object.responseStreaming) ? Boolean(object.responseStreaming) : false, options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Method): unknown { diff --git a/__fixtures__/output2/google/protobuf/descriptor.ts b/__fixtures__/output2/google/protobuf/descriptor.ts index 370fa31808..cb4eeccaf6 100644 --- a/__fixtures__/output2/google/protobuf/descriptor.ts +++ b/__fixtures__/output2/google/protobuf/descriptor.ts @@ -1728,8 +1728,8 @@ export const FieldDescriptorProto = { return { name: isSet(object.name) ? String(object.name) : "", number: isSet(object.number) ? Number(object.number) : 0, - label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 0, - type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, typeName: isSet(object.typeName) ? String(object.typeName) : "", extendee: isSet(object.extendee) ? String(object.extendee) : "", defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", @@ -2379,7 +2379,7 @@ export const FileOptions = { javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) ? Boolean(object.javaGenerateEqualsAndHash) : false, javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, - optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 0, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : -1, goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, @@ -2614,9 +2614,9 @@ export const FieldOptions = { }, fromJSON(object: any): FieldOptions { return { - ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, packed: isSet(object.packed) ? Boolean(object.packed) : false, - jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, weak: isSet(object.weak) ? Boolean(object.weak) : false, @@ -2932,7 +2932,7 @@ export const MethodOptions = { fromJSON(object: any): MethodOptions { return { deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, + idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : -1, uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, diff --git a/__fixtures__/output2/google/protobuf/type.ts b/__fixtures__/output2/google/protobuf/type.ts index 6a97be6ddb..96a0ddeb38 100644 --- a/__fixtures__/output2/google/protobuf/type.ts +++ b/__fixtures__/output2/google/protobuf/type.ts @@ -394,7 +394,7 @@ export const Type = { oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => String(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Type): unknown { @@ -524,8 +524,8 @@ export const Field = { }, fromJSON(object: any): Field { return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : 0, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : 0, + kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, + cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, number: isSet(object.number) ? Number(object.number) : 0, name: isSet(object.name) ? String(object.name) : "", typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", @@ -632,7 +632,7 @@ export const Enum = { enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromJSON(e)) : [], options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : 0 + syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, toJSON(message: Enum): unknown { diff --git a/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts b/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts index c3740904b1..98c2712de3 100644 --- a/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts +++ b/__fixtures__/output2/ibc/applications/interchain_accounts/v1/packet.ts @@ -95,7 +95,7 @@ export const InterchainAccountPacketData = { }, fromJSON(object: any): InterchainAccountPacketData { return { - type: isSet(object.type) ? typeFromJSON(object.type) : 0, + type: isSet(object.type) ? typeFromJSON(object.type) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), memo: isSet(object.memo) ? String(object.memo) : "" }; diff --git a/__fixtures__/output2/ibc/core/channel/v1/channel.ts b/__fixtures__/output2/ibc/core/channel/v1/channel.ts index b518b7d3bd..9ad0a3452b 100644 --- a/__fixtures__/output2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/output2/ibc/core/channel/v1/channel.ts @@ -271,8 +271,8 @@ export const Channel = { }, fromJSON(object: any): Channel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "" @@ -374,8 +374,8 @@ export const IdentifiedChannel = { }, fromJSON(object: any): IdentifiedChannel { return { - state: isSet(object.state) ? stateFromJSON(object.state) : 0, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], version: isSet(object.version) ? String(object.version) : "", diff --git a/__fixtures__/output2/ibc/core/channel/v1/tx.ts b/__fixtures__/output2/ibc/core/channel/v1/tx.ts index 15b8dc8e13..fbc355b2aa 100644 --- a/__fixtures__/output2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/output2/ibc/core/channel/v1/tx.ts @@ -1011,7 +1011,7 @@ export const MsgRecvPacketResponse = { }, fromJSON(object: any): MsgRecvPacketResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 }; }, toJSON(message: MsgRecvPacketResponse): unknown { @@ -1141,7 +1141,7 @@ export const MsgTimeoutResponse = { }, fromJSON(object: any): MsgTimeoutResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 }; }, toJSON(message: MsgTimeoutResponse): unknown { @@ -1281,7 +1281,7 @@ export const MsgTimeoutOnCloseResponse = { }, fromJSON(object: any): MsgTimeoutOnCloseResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 }; }, toJSON(message: MsgTimeoutOnCloseResponse): unknown { @@ -1411,7 +1411,7 @@ export const MsgAcknowledgementResponse = { }, fromJSON(object: any): MsgAcknowledgementResponse { return { - result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : 0 + result: isSet(object.result) ? responseResultTypeFromJSON(object.result) : -1 }; }, toJSON(message: MsgAcknowledgementResponse): unknown { diff --git a/__fixtures__/output2/ibc/core/connection/v1/connection.ts b/__fixtures__/output2/ibc/core/connection/v1/connection.ts index 26db271fca..46f603e410 100644 --- a/__fixtures__/output2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/output2/ibc/core/connection/v1/connection.ts @@ -210,7 +210,7 @@ export const ConnectionEnd = { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; @@ -307,7 +307,7 @@ export const IdentifiedConnection = { id: isSet(object.id) ? String(object.id) : "", clientId: isSet(object.clientId) ? String(object.clientId) : "", versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], - state: isSet(object.state) ? stateFromJSON(object.state) : 0, + state: isSet(object.state) ? stateFromJSON(object.state) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, delayPeriod: isSet(object.delayPeriod) ? Long.fromValue(object.delayPeriod) : Long.UZERO }; diff --git a/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts index 6ad4fc87d8..28eb8dcaae 100644 --- a/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/output2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -597,7 +597,7 @@ export const SignatureAndData = { fromJSON(object: any): SignatureAndData { return { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO }; @@ -736,7 +736,7 @@ export const SignBytes = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO, timestamp: isSet(object.timestamp) ? Long.fromValue(object.timestamp) : Long.UZERO, diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", - dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : 0, + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, diff --git a/__fixtures__/output2/osmosis/claim/v1beta1/query.ts b/__fixtures__/output2/osmosis/claim/v1beta1/query.ts index 1bd3d91199..2bcb1d8db6 100644 --- a/__fixtures__/output2/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/output2/osmosis/claim/v1beta1/query.ts @@ -328,7 +328,7 @@ export const QueryClaimableForActionRequest = { fromJSON(object: any): QueryClaimableForActionRequest { return { address: isSet(object.address) ? String(object.address) : "", - action: isSet(object.action) ? actionFromJSON(object.action) : 0 + action: isSet(object.action) ? actionFromJSON(object.action) : -1 }; }, toJSON(message: QueryClaimableForActionRequest): unknown { diff --git a/__fixtures__/output2/osmosis/lockup/lock.ts b/__fixtures__/output2/osmosis/lockup/lock.ts index e4299597d9..2ce3ace18b 100644 --- a/__fixtures__/output2/osmosis/lockup/lock.ts +++ b/__fixtures__/output2/osmosis/lockup/lock.ts @@ -265,7 +265,7 @@ export const QueryCondition = { }, fromJSON(object: any): QueryCondition { return { - lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : 0, + lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : -1, denom: isSet(object.denom) ? String(object.denom) : "", duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined diff --git a/__fixtures__/output2/osmosis/superfluid/query.ts b/__fixtures__/output2/osmosis/superfluid/query.ts index b1896fea77..6dc5436436 100644 --- a/__fixtures__/output2/osmosis/superfluid/query.ts +++ b/__fixtures__/output2/osmosis/superfluid/query.ts @@ -270,7 +270,7 @@ export const AssetTypeResponse = { }, fromJSON(object: any): AssetTypeResponse { return { - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 }; }, toJSON(message: AssetTypeResponse): unknown { diff --git a/__fixtures__/output2/osmosis/superfluid/superfluid.ts b/__fixtures__/output2/osmosis/superfluid/superfluid.ts index b04e3197db..bff80bbf4a 100644 --- a/__fixtures__/output2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/output2/osmosis/superfluid/superfluid.ts @@ -135,7 +135,7 @@ export const SuperfluidAsset = { fromJSON(object: any): SuperfluidAsset { return { denom: isSet(object.denom) ? String(object.denom) : "", - assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : 0 + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 }; }, toJSON(message: SuperfluidAsset): unknown { diff --git a/__fixtures__/output2/tendermint/abci/types.ts b/__fixtures__/output2/tendermint/abci/types.ts index 5aa494c7cd..ac25746ffa 100644 --- a/__fixtures__/output2/tendermint/abci/types.ts +++ b/__fixtures__/output2/tendermint/abci/types.ts @@ -1158,7 +1158,7 @@ export const RequestCheckTx = { fromJSON(object: any): RequestCheckTx { return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), - type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0 + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 }; }, toJSON(message: RequestCheckTx): unknown { @@ -2672,7 +2672,7 @@ export const ResponseOfferSnapshot = { }, fromJSON(object: any): ResponseOfferSnapshot { return { - result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : 0 + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 }; }, toJSON(message: ResponseOfferSnapshot): unknown { @@ -2785,7 +2785,7 @@ export const ResponseApplySnapshotChunk = { }, fromJSON(object: any): ResponseApplySnapshotChunk { return { - result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : 0, + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, refetchChunks: Array.isArray(object?.refetchChunks) ? object.refetchChunks.map((e: any) => Number(e)) : [], rejectSenders: Array.isArray(object?.rejectSenders) ? object.rejectSenders.map((e: any) => String(e)) : [] }; @@ -3425,7 +3425,7 @@ export const Evidence = { }, fromJSON(object: any): Evidence { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, diff --git a/__fixtures__/output2/tendermint/types/types.ts b/__fixtures__/output2/tendermint/types/types.ts index 976860b1e4..e3e97f1045 100644 --- a/__fixtures__/output2/tendermint/types/types.ts +++ b/__fixtures__/output2/tendermint/types/types.ts @@ -681,7 +681,7 @@ export const Vote = { }, fromJSON(object: any): Vote { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, @@ -847,7 +847,7 @@ export const CommitSig = { }, fromJSON(object: any): CommitSig { return { - blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0, + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : -1, validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() @@ -943,7 +943,7 @@ export const Proposal = { }, fromJSON(object: any): Proposal { return { - type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, round: isSet(object.round) ? Number(object.round) : 0, polRound: isSet(object.polRound) ? Number(object.polRound) : 0, diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index 0ec1188c9c..49b4e7c95b 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -258,7 +258,7 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` return { address: isSet(object.address) ? String(object.address) : "", signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() }; }, @@ -282,7 +282,7 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` return { address: object?.address, signDoc: object.sign_doc ? SignDocDirectAux.fromSDK(object.sign_doc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, sig: object?.sig }; }, @@ -1929,7 +1929,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` return { name: isSet(object.name) ? String(object.name) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, trace: isSet(object.trace) ? String(object.trace) : "", insertId: isSet(object.insertId) ? String(object.insertId) : "", @@ -1994,7 +1994,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` return { name: object?.name, timestamp: object.timestamp ? Timestamp.fromSDK(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : 0, + severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object.http_request ? HttpRequest.fromSDK(object.http_request) : undefined, trace: object?.trace, insertId: object?.insert_id, @@ -2163,7 +2163,7 @@ exports[`ibc/core/port/v1/query 1`] = ` return { portId: isSet(object.portId) ? String(object.portId) : "", connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, proposedVersion: isSet(object.proposedVersion) ? String(object.proposedVersion) : "" }; @@ -2190,7 +2190,7 @@ exports[`ibc/core/port/v1/query 1`] = ` return { portId: object?.port_id, connectionId: object?.connection_id, - ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : 0, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, counterparty: object.counterparty ? Counterparty.fromSDK(object.counterparty) : undefined, proposedVersion: object?.proposed_version }; diff --git a/packages/ast/src/encoding/proto/from-amino/utils.ts b/packages/ast/src/encoding/proto/from-amino/utils.ts index 99db5d35e3..54c0948656 100644 --- a/packages/ast/src/encoding/proto/from-amino/utils.ts +++ b/packages/ast/src/encoding/proto/from-amino/utils.ts @@ -300,9 +300,7 @@ export const fromAminoJSON = { origName } = getFieldNames(args.field); - const env = args.context.pluginValue( - 'env' - ); + const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); args.context.addUtil('isSet'); const fromAminoJSONFuncName = args.context.getFromEnum(args.field); @@ -328,7 +326,7 @@ export const fromAminoJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-json/utils.ts b/packages/ast/src/encoding/proto/from-json/utils.ts index 386ab2898d..37689479d8 100644 --- a/packages/ast/src/encoding/proto/from-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-json/utils.ts @@ -215,9 +215,7 @@ export const fromJSON = { // mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, enum(args: FromJSONMethod) { const { messageProp, objProp } = getPropNames(args.field); - const env = args.context.pluginValue( - 'env' - ); + const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); args.context.addUtil('isSet'); const fromJSONFuncName = args.context.getFromEnum(args.field); @@ -242,7 +240,7 @@ export const fromJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts index 8a9d695a6e..4e76293882 100644 --- a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts @@ -149,9 +149,7 @@ export const fromSDKJSON = { enum(args: FromSDKJSONMethod) { const { origName } = getFieldNames(args.field); args.context.addUtil('isSet'); - const env = args.context.pluginValue( - 'env' - ); + const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); const fromSDKJSONFuncName = args.context.getFromEnum(args.field); return t.objectProperty( @@ -163,7 +161,7 @@ export const fromSDKJSON = { t.callExpression(t.identifier(fromSDKJSONFuncName), [ t.memberExpression(t.identifier('object'), t.identifier(origName)) ]), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-sdk/utils.ts b/packages/ast/src/encoding/proto/from-sdk/utils.ts index a5363fc9ab..bbdfb3eacf 100644 --- a/packages/ast/src/encoding/proto/from-sdk/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk/utils.ts @@ -107,9 +107,7 @@ export const fromSDK = { propName, origName } = getFieldNames(args.field); - const env = args.context.pluginValue( - 'env' - ); + const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); args.context.addUtil('isSet'); const fromSDKFuncName = args.context.getFromEnum(args.field); @@ -135,7 +133,7 @@ export const fromSDK = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(env === 'default' ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index 46fa4f9694..e39fff49a6 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -401,6 +401,9 @@ export const getDefaultTSTypeFromProtoType = ( const isOptional = getFieldOptionalityForDefaults(context, field, isOneOf); + const setDefaultEnumTo0 = context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); + const setDefaultOtherTypesToUndefined = context.pluginValue('prototypes.typingsFormat.setDefaultOtherTypesToUndefined'); + if (isOptional) { return t.identifier('undefined'); } @@ -451,25 +454,51 @@ export const getDefaultTSTypeFromProtoType = ( // OTHER TYPES case 'google.protobuf.Timestamp': - if (context.pluginValue('prototypes.typingsFormat.timestamp') === 'timestamp') { - return t.callExpression( + if(setDefaultOtherTypesToUndefined){ + return t.identifier('undefined'); + } else { + const timestampType = context.pluginValue('prototypes.typingsFormat.timestamp'); + + switch (timestampType) { + case 'timestamp': + return t.callExpression( t.memberExpression( t.identifier('Timestamp'), t.identifier('fromPartial') ), [t.objectExpression([])] - ) - } - if (context.pluginValue('prototypes.typingsFormat.timestamp') === 'date') { - return t.newExpression( + ) + case 'date': + return t.newExpression( t.identifier('Date'), [] - ); + ); + + default: + return t.identifier('undefined'); + } } - // TODO: add cases for this later on - // case 'google.protobuf.Duration': - // return t.identifier('undefined'); + // TODO: add cases for this later on + case 'google.protobuf.Duration': + if(setDefaultOtherTypesToUndefined) { + return t.identifier('undefined'); + } else { + return getDefaultTSTypeFromProtoTypeDefault(field); + } + case 'google.protobuf.Any': + if(setDefaultOtherTypesToUndefined) { + return t.identifier('undefined'); + } else { + return getDefaultTSTypeFromProtoTypeDefault(field); + } + + case 'cosmos.base.v1beta1.Coin': + if(setDefaultOtherTypesToUndefined) { + return t.identifier('undefined'); + } else { + return getDefaultTSTypeFromProtoTypeDefault(field); + } case 'cosmos.base.v1beta1.Coins': return t.arrayExpression([]); @@ -478,15 +507,19 @@ export const getDefaultTSTypeFromProtoType = ( console.warn('Undefined! Can\'t get field of type:', field); return t.identifier('undefined'); } else { - const temp = field.type.split("."); - const fieldName = temp[temp.length - 1]; - return t.callExpression( - t.memberExpression( - t.identifier(fieldName), - t.identifier('fromPartial') - ), - [t.objectExpression([])] - ) + return getDefaultTSTypeFromProtoTypeDefault(field) } }; }; + +function getDefaultTSTypeFromProtoTypeDefault(field: ProtoField) { + const temp = field.type.split("."); + const fieldName = temp[temp.length - 1]; + return t.callExpression( + t.memberExpression( + t.identifier(fieldName), + t.identifier('fromPartial') + ), + [t.objectExpression([])] + ) +} \ No newline at end of file diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index f957e896c9..e1eefb453a 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -76,6 +76,10 @@ interface TelescopeOpts { useExact?: boolean; timestamp?: 'date' | 'timestamp', duration?: 'duration' | 'string', + + setDefaultEnumTo0?: boolean; + setDefaultOtherTypesToUndefined?: boolean; + // temporary field to avoid breaking changes updatedDuration?: boolean }; From 857603ff6b654081245efe17dd252dbbc8aff57a Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 1 Aug 2023 06:49:10 +0800 Subject: [PATCH 3/9] remove unused option --- packages/ast/src/encoding/types.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index e39fff49a6..2f3b4b4fe1 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -401,7 +401,6 @@ export const getDefaultTSTypeFromProtoType = ( const isOptional = getFieldOptionalityForDefaults(context, field, isOneOf); - const setDefaultEnumTo0 = context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); const setDefaultOtherTypesToUndefined = context.pluginValue('prototypes.typingsFormat.setDefaultOtherTypesToUndefined'); if (isOptional) { From 8bb0755416463744834a0e0c1de258fa479a348d Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 1 Aug 2023 07:23:28 +0800 Subject: [PATCH 4/9] add test --- .../__snapshots__/proto.type.spec.ts.snap | 21 +++ .../ast/src/encoding/proto/proto.type.spec.ts | 24 +++ packages/ast/types/test-utils/index.d.ts | 152 +----------------- packages/types/types/telescope.d.ts | 2 + 4 files changed, 48 insertions(+), 151 deletions(-) diff --git a/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap index f1d892e320..dc67cbfbc5 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/proto.type.spec.ts.snap @@ -97,6 +97,27 @@ exports[`createCreateProtoType ValidatorUpdate 1`] = ` }" `; +exports[`createCreateProtoType orginal logic Header 1`] = ` +"function createBaseHeader(): Header { + return { + version: Consensus.fromPartial({}), + chainId: "", + height: Long.ZERO, + time: undefined, + lastBlockId: BlockID.fromPartial({}), + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +}" +`; + exports[`oneofs Value 1`] = ` "/** * \`Value\` represents a dynamically typed value which can be either diff --git a/packages/ast/src/encoding/proto/proto.type.spec.ts b/packages/ast/src/encoding/proto/proto.type.spec.ts index 926f7b5128..cc01f5aa7d 100644 --- a/packages/ast/src/encoding/proto/proto.type.spec.ts +++ b/packages/ast/src/encoding/proto/proto.type.spec.ts @@ -8,6 +8,7 @@ import { traverse, getNestedProto } from '@cosmology/proto-parser' import { defaultTelescopeOptions } from '@cosmology/types' import { ProtoParseContext } from '../context'; import { getTestProtoStore, expectCode, printCode } from '../../../test-utils'; +import deepmerge from 'deepmerge'; const store = getTestProtoStore(); store.traverseAll(); @@ -87,6 +88,29 @@ describe('createCreateProtoType', () => { }); }); +describe('createCreateProtoType orginal logic', () => { + const ref = store.findProto('tendermint/types/types.proto'); + + const options = deepmerge(defaultTelescopeOptions, { + prototypes: { + typingsFormat:{ + setDefaultEnumTo0: true, + setDefaultOtherTypesToUndefined: true, + } + } + }); + + const context = new ProtoParseContext(ref, store, options); + + it('Header', () => { + expectCode(createCreateProtoType( + context, + 'Header', + getNestedProto(types_tendermint).Header + )); + }); +}); + describe('traversed', () => { it('osmosis/claim/v1beta1/params', async () => { const ref = store.findProto('osmosis/claim/v1beta1/params.proto'); diff --git a/packages/ast/types/test-utils/index.d.ts b/packages/ast/types/test-utils/index.d.ts index b9d24415be..49294474ec 100644 --- a/packages/ast/types/test-utils/index.d.ts +++ b/packages/ast/types/test-utils/index.d.ts @@ -1,160 +1,10 @@ -import { ProtoType, TelescopeOptions } from '@cosmology/types'; +import { ProtoType } from '@cosmology/types'; import { ProtoStore } from '@cosmology/proto-parser'; import { AminoParseContext } from '../src/encoding/context'; import { GenericParseContext } from '../src/encoding'; export declare const expectCode: (ast: any) => void; export declare const printCode: (ast: any) => void; export declare const defaultTelescopeOptions: { - env: "default" | "v-next"; - removeUnusedImports: boolean; - classesUseArrowFunctions: boolean; - useSDKTypes: boolean; - includeExternalHelpers: boolean; - logLevel: import("@cosmology/types").TelescopeLogLevel; - interfaces: { - enabled?: boolean; - useUnionTypes?: boolean; - }; - prototypes: { - enabled?: boolean; - parser?: { - keepCase?: boolean; - alternateCommentMode?: boolean; - preferTrailingComment?: boolean; - }; - methods?: { - encode?: boolean; - decode?: boolean; - fromJSON?: boolean; - toJSON?: boolean; - fromPartial?: boolean; - toSDK?: boolean; - fromSDK?: boolean; - fromSDKJSON?: boolean; - toAmino?: boolean; - fromAmino?: boolean; - toProto?: boolean; - fromProto?: boolean; - }; - includePackageVar?: boolean; - fieldDefaultIsOptional?: boolean; - useOptionalNullable?: boolean; - allowUndefinedTypes?: boolean; - optionalQueryParams?: boolean; - optionalPageRequests?: boolean; - addTypeUrlToObjects?: boolean; - addAminoTypeToObjects?: boolean; - addTypeUrlToDecoders?: boolean; - excluded?: { - packages?: string[]; - protos?: string[]; - }; - includes?: { - packages?: string[]; - protos?: string[]; - }; - typingsFormat?: { - customTypes?: { - useCosmosSDKDec?: boolean; - }; - num64?: "bigint" | "long"; - useDeepPartial?: boolean; - useExact?: boolean; - timestamp?: "date" | "timestamp"; - duration?: "string" | "duration"; - updatedDuration?: boolean; - }; - }; - tsDisable: { - files?: string[]; - disableAll?: boolean; - patterns?: string[]; - }; - eslintDisable: { - files?: string[]; - disableAll?: boolean; - patterns?: string[]; - }; - bundle: { - enabled: boolean; - }; - cosmwasm: import("@cosmwasm/ts-codegen").TSBuilderInput; - aggregatedLCD: { - dir: string; - filename: string; - packages: string[]; - protos?: string[]; - addToBundle: boolean; - }; - stargateClients: { - enabled: boolean; - includeCosmosDefaultTypes?: boolean; - }; - aminoEncoding: { - enabled: boolean; - casingFn?: Function; - exceptions?: import("@cosmology/types").AminoExceptions; - typeUrlToAmino?: (typeUrl: string) => string; - useRecursiveV2encoding?: boolean; - }; - lcdClients: { - enabled: boolean; - scopedIsExclusive?: boolean; - bundle?: boolean; - scoped?: { - dir: string; - filename?: string; - packages: string[]; - protos?: string[]; - addToBundle: boolean; - methodName?: string; - }[]; - }; - rpcClients: { - type?: "tendermint" | "grpc-web" | "grpc-gateway"; - enabled: boolean; - inline?: boolean; - extensions?: boolean; - camelCase?: boolean; - scopedIsExclusive?: boolean; - bundle?: boolean; - enabledServices?: string[]; - scoped?: { - dir: string; - filename?: string; - packages: string[]; - protos?: string[]; - addToBundle: boolean; - methodNameQuery?: string; - methodNameTx?: string; - }[]; - }; - reactQuery: { - enabled: boolean; - include?: { - patterns?: string[]; - packages?: string[]; - protos?: string[]; - }; - }; - mobx: { - enabled: boolean; - include?: { - patterns?: string[]; - packages?: string[]; - protos?: string[]; - }; - }; - pinia: { - enabled: boolean; - include?: { - patterns?: string[]; - packages?: string[]; - protos?: string[]; - }; - }; - packages: Record; -} & { prototypes: { parser: { keepCase: boolean; diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index db6be67cea..6e324dfbdc 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -65,6 +65,8 @@ interface TelescopeOpts { useExact?: boolean; timestamp?: 'date' | 'timestamp'; duration?: 'duration' | 'string'; + setDefaultEnumTo0?: boolean; + setDefaultOtherTypesToUndefined?: boolean; updatedDuration?: boolean; }; }; From 5c987d6ef7961e57447d88b6b59e53f85aeddd2e Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 1 Aug 2023 07:36:03 +0800 Subject: [PATCH 5/9] edit readme for new options --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 57c197214a..15fb875f7d 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,8 @@ See [RPC Clients](#rpc-clients) for more info. | `prototypes.typingsFormat.useExact` | defaults to false, but if enabled uses the `Exact` TS type | `false` | | `prototypes.typingsFormat.timestamp` | use either `date` or `timestamp` for `Timestamp` proto type | "date" | | `prototypes.typingsFormat.duration` | use either `duration` or `string` for `Duration` proto type | "duration"| +| `prototypes.typingsFormat.setDefaultEnumTo0` | true: enum empty value would be 0, false: -1(value for enum unrecognized) |false| +| `prototypes.typingsFormat.setDefaultOtherTypesToUndefined` | true: Timestamp,Duration,Any,Coin empty value would be undefined., false: using fromPartial to get an empty obj |false| ### Protobuf parser @@ -720,7 +722,7 @@ Below will be an example of scaffold a `grant` Proto Msg for grpc-web and grpc-g const signed_tx = await signClient.sign('granter_address', [msg], fee, 'telescope: grant', signerData); const txRawBytes = Uint8Array.from(TxRaw.encode(signed_tx).finish()); - const res = await client.cosmos.tx.v1beta1.broadcastTx( + const res = await client.cosmos.tx.v1beta1.broadcastTx( { txBytes: txRawBytes, mode: BroadcastMode.BROADCAST_MODE_BLOCK From 4ba0af8b20d99c43ced112c50be863ef3d3fdc0d Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 4 Aug 2023 09:06:28 +0800 Subject: [PATCH 6/9] fixed naming --- README.md | 4 +- .../src/encoding/proto/from-amino/utils.ts | 4 +- .../ast/src/encoding/proto/from-json/utils.ts | 4 +- .../src/encoding/proto/from-sdk-json/utils.ts | 4 +- .../ast/src/encoding/proto/from-sdk/utils.ts | 4 +- .../ast/src/encoding/proto/proto.type.spec.ts | 4 +- packages/ast/src/encoding/types.ts | 10 +- packages/ast/types/test-utils/index.d.ts | 154 +++++++++++++++++- packages/types/src/telescope.ts | 8 +- packages/types/types/telescope.d.ts | 4 +- 10 files changed, 177 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 15fb875f7d..6d79c595a4 100644 --- a/README.md +++ b/README.md @@ -320,8 +320,8 @@ See [RPC Clients](#rpc-clients) for more info. | `prototypes.typingsFormat.useExact` | defaults to false, but if enabled uses the `Exact` TS type | `false` | | `prototypes.typingsFormat.timestamp` | use either `date` or `timestamp` for `Timestamp` proto type | "date" | | `prototypes.typingsFormat.duration` | use either `duration` or `string` for `Duration` proto type | "duration"| -| `prototypes.typingsFormat.setDefaultEnumTo0` | true: enum empty value would be 0, false: -1(value for enum unrecognized) |false| -| `prototypes.typingsFormat.setDefaultOtherTypesToUndefined` | true: Timestamp,Duration,Any,Coin empty value would be undefined., false: using fromPartial to get an empty obj |false| +| `prototypes.typingsFormat.setDefaultEnumToUnrecognized` | false: enum empty value would be 0, true: -1(value for enum unrecognized) |true| +| `prototypes.typingsFormat.setDefaultCustomTypesToUndefined` | true: Timestamp,Duration,Any,Coin empty value would be undefined., false: using fromPartial to get an empty obj |false| ### Protobuf parser diff --git a/packages/ast/src/encoding/proto/from-amino/utils.ts b/packages/ast/src/encoding/proto/from-amino/utils.ts index 54c0948656..cce7baab8c 100644 --- a/packages/ast/src/encoding/proto/from-amino/utils.ts +++ b/packages/ast/src/encoding/proto/from-amino/utils.ts @@ -300,7 +300,7 @@ export const fromAminoJSON = { origName } = getFieldNames(args.field); - const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); + const setDefaultEnumToUnrecognized = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumToUnrecognized'); args.context.addUtil('isSet'); const fromAminoJSONFuncName = args.context.getFromEnum(args.field); @@ -326,7 +326,7 @@ export const fromAminoJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(!setDefaultEnumToUnrecognized ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-json/utils.ts b/packages/ast/src/encoding/proto/from-json/utils.ts index 37689479d8..1f6735c628 100644 --- a/packages/ast/src/encoding/proto/from-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-json/utils.ts @@ -215,7 +215,7 @@ export const fromJSON = { // mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, enum(args: FromJSONMethod) { const { messageProp, objProp } = getPropNames(args.field); - const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); + const setDefaultEnumToUnrecognized = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumToUnrecognized'); args.context.addUtil('isSet'); const fromJSONFuncName = args.context.getFromEnum(args.field); @@ -240,7 +240,7 @@ export const fromJSON = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(!setDefaultEnumToUnrecognized ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts index 4e76293882..7f3781ff13 100644 --- a/packages/ast/src/encoding/proto/from-sdk-json/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk-json/utils.ts @@ -149,7 +149,7 @@ export const fromSDKJSON = { enum(args: FromSDKJSONMethod) { const { origName } = getFieldNames(args.field); args.context.addUtil('isSet'); - const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); + const setDefaultEnumToUnrecognized = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumToUnrecognized'); const fromSDKJSONFuncName = args.context.getFromEnum(args.field); return t.objectProperty( @@ -161,7 +161,7 @@ export const fromSDKJSON = { t.callExpression(t.identifier(fromSDKJSONFuncName), [ t.memberExpression(t.identifier('object'), t.identifier(origName)) ]), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(!setDefaultEnumToUnrecognized ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/from-sdk/utils.ts b/packages/ast/src/encoding/proto/from-sdk/utils.ts index bbdfb3eacf..f55a942fb0 100644 --- a/packages/ast/src/encoding/proto/from-sdk/utils.ts +++ b/packages/ast/src/encoding/proto/from-sdk/utils.ts @@ -107,7 +107,7 @@ export const fromSDK = { propName, origName } = getFieldNames(args.field); - const setDefaultEnumTo0 = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumTo0'); + const setDefaultEnumToUnrecognized = args.context.pluginValue('prototypes.typingsFormat.setDefaultEnumToUnrecognized'); args.context.addUtil('isSet'); const fromSDKFuncName = args.context.getFromEnum(args.field); @@ -133,7 +133,7 @@ export const fromSDK = { ) ] ), - args.isOptional ? t.identifier('undefined') : t.numericLiteral(setDefaultEnumTo0 ? 0 : -1) + args.isOptional ? t.identifier('undefined') : t.numericLiteral(!setDefaultEnumToUnrecognized ? 0 : -1) ) ); }, diff --git a/packages/ast/src/encoding/proto/proto.type.spec.ts b/packages/ast/src/encoding/proto/proto.type.spec.ts index cc01f5aa7d..248f0482be 100644 --- a/packages/ast/src/encoding/proto/proto.type.spec.ts +++ b/packages/ast/src/encoding/proto/proto.type.spec.ts @@ -94,8 +94,8 @@ describe('createCreateProtoType orginal logic', () => { const options = deepmerge(defaultTelescopeOptions, { prototypes: { typingsFormat:{ - setDefaultEnumTo0: true, - setDefaultOtherTypesToUndefined: true, + setDefaultEnumToUnrecognized: false, + setDefaultCustomTypesToUndefined: true, } } }); diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index 2f3b4b4fe1..8e761acdd5 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -401,7 +401,7 @@ export const getDefaultTSTypeFromProtoType = ( const isOptional = getFieldOptionalityForDefaults(context, field, isOneOf); - const setDefaultOtherTypesToUndefined = context.pluginValue('prototypes.typingsFormat.setDefaultOtherTypesToUndefined'); + const setDefaultCustomTypesToUndefined = context.pluginValue('prototypes.typingsFormat.setDefaultCustomTypesToUndefined'); if (isOptional) { return t.identifier('undefined'); @@ -453,7 +453,7 @@ export const getDefaultTSTypeFromProtoType = ( // OTHER TYPES case 'google.protobuf.Timestamp': - if(setDefaultOtherTypesToUndefined){ + if(setDefaultCustomTypesToUndefined){ return t.identifier('undefined'); } else { const timestampType = context.pluginValue('prototypes.typingsFormat.timestamp'); @@ -480,20 +480,20 @@ export const getDefaultTSTypeFromProtoType = ( // TODO: add cases for this later on case 'google.protobuf.Duration': - if(setDefaultOtherTypesToUndefined) { + if(setDefaultCustomTypesToUndefined) { return t.identifier('undefined'); } else { return getDefaultTSTypeFromProtoTypeDefault(field); } case 'google.protobuf.Any': - if(setDefaultOtherTypesToUndefined) { + if(setDefaultCustomTypesToUndefined) { return t.identifier('undefined'); } else { return getDefaultTSTypeFromProtoTypeDefault(field); } case 'cosmos.base.v1beta1.Coin': - if(setDefaultOtherTypesToUndefined) { + if(setDefaultCustomTypesToUndefined) { return t.identifier('undefined'); } else { return getDefaultTSTypeFromProtoTypeDefault(field); diff --git a/packages/ast/types/test-utils/index.d.ts b/packages/ast/types/test-utils/index.d.ts index 49294474ec..2bb9b9fcd5 100644 --- a/packages/ast/types/test-utils/index.d.ts +++ b/packages/ast/types/test-utils/index.d.ts @@ -1,10 +1,162 @@ -import { ProtoType } from '@cosmology/types'; +import { ProtoType, TelescopeOptions } from '@cosmology/types'; import { ProtoStore } from '@cosmology/proto-parser'; import { AminoParseContext } from '../src/encoding/context'; import { GenericParseContext } from '../src/encoding'; export declare const expectCode: (ast: any) => void; export declare const printCode: (ast: any) => void; export declare const defaultTelescopeOptions: { + env: "default" | "v-next"; + removeUnusedImports: boolean; + classesUseArrowFunctions: boolean; + useSDKTypes: boolean; + includeExternalHelpers: boolean; + logLevel: import("@cosmology/types").TelescopeLogLevel; + interfaces: { + enabled?: boolean; + useUnionTypes?: boolean; + }; + prototypes: { + enabled?: boolean; + parser?: { + keepCase?: boolean; + alternateCommentMode?: boolean; + preferTrailingComment?: boolean; + }; + methods?: { + encode?: boolean; + decode?: boolean; + fromJSON?: boolean; + toJSON?: boolean; + fromPartial?: boolean; + toSDK?: boolean; + fromSDK?: boolean; + fromSDKJSON?: boolean; + toAmino?: boolean; + fromAmino?: boolean; + toProto?: boolean; + fromProto?: boolean; + }; + includePackageVar?: boolean; + fieldDefaultIsOptional?: boolean; + useOptionalNullable?: boolean; + allowUndefinedTypes?: boolean; + optionalQueryParams?: boolean; + optionalPageRequests?: boolean; + addTypeUrlToObjects?: boolean; + addAminoTypeToObjects?: boolean; + addTypeUrlToDecoders?: boolean; + excluded?: { + packages?: string[]; + protos?: string[]; + }; + includes?: { + packages?: string[]; + protos?: string[]; + }; + typingsFormat?: { + customTypes?: { + useCosmosSDKDec?: boolean; + }; + num64?: "bigint" | "long"; + useDeepPartial?: boolean; + useExact?: boolean; + timestamp?: "date" | "timestamp"; + duration?: "string" | "duration"; + setDefaultEnumToUnrecognized?: boolean; + setDefaultCustomTypesToUndefined?: boolean; + updatedDuration?: boolean; + }; + }; + tsDisable: { + files?: string[]; + disableAll?: boolean; + patterns?: string[]; + }; + eslintDisable: { + files?: string[]; + disableAll?: boolean; + patterns?: string[]; + }; + bundle: { + enabled: boolean; + }; + cosmwasm: import("@cosmwasm/ts-codegen").TSBuilderInput; + aggregatedLCD: { + dir: string; + filename: string; + packages: string[]; + protos?: string[]; + addToBundle: boolean; + }; + stargateClients: { + enabled: boolean; + includeCosmosDefaultTypes?: boolean; + }; + aminoEncoding: { + enabled: boolean; + casingFn?: Function; + exceptions?: import("@cosmology/types").AminoExceptions; + typeUrlToAmino?: (typeUrl: string) => string; + useRecursiveV2encoding?: boolean; + }; + lcdClients: { + enabled: boolean; + scopedIsExclusive?: boolean; + bundle?: boolean; + scoped?: { + dir: string; + filename?: string; + packages: string[]; + protos?: string[]; + addToBundle: boolean; + methodName?: string; + }[]; + }; + rpcClients: { + type?: "tendermint" | "grpc-web" | "grpc-gateway"; + enabled: boolean; + inline?: boolean; + extensions?: boolean; + camelCase?: boolean; + scopedIsExclusive?: boolean; + bundle?: boolean; + enabledServices?: string[]; + scoped?: { + dir: string; + filename?: string; + packages: string[]; + protos?: string[]; + addToBundle: boolean; + methodNameQuery?: string; + methodNameTx?: string; + }[]; + }; + reactQuery: { + enabled: boolean; + include?: { + patterns?: string[]; + packages?: string[]; + protos?: string[]; + }; + }; + mobx: { + enabled: boolean; + include?: { + patterns?: string[]; + packages?: string[]; + protos?: string[]; + }; + }; + pinia: { + enabled: boolean; + include?: { + patterns?: string[]; + packages?: string[]; + protos?: string[]; + }; + }; + packages: Record; +} & { prototypes: { parser: { keepCase: boolean; diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index e1eefb453a..828b33b0a1 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -77,8 +77,8 @@ interface TelescopeOpts { timestamp?: 'date' | 'timestamp', duration?: 'duration' | 'string', - setDefaultEnumTo0?: boolean; - setDefaultOtherTypesToUndefined?: boolean; + setDefaultEnumToUnrecognized?: boolean; + setDefaultCustomTypesToUndefined?: boolean; // temporary field to avoid breaking changes updatedDuration?: boolean @@ -265,7 +265,9 @@ export const defaultTelescopeOptions: TelescopeOptions = { useExact: false, timestamp: 'date', duration: 'duration', - updatedDuration: false + updatedDuration: false, + + setDefaultEnumToUnrecognized: true, }, }, diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index 6e324dfbdc..dfd4247824 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -65,8 +65,8 @@ interface TelescopeOpts { useExact?: boolean; timestamp?: 'date' | 'timestamp'; duration?: 'duration' | 'string'; - setDefaultEnumTo0?: boolean; - setDefaultOtherTypesToUndefined?: boolean; + setDefaultEnumToUnrecognized?: boolean; + setDefaultCustomTypesToUndefined?: boolean; updatedDuration?: boolean; }; }; From a38507e326b1bb1db29fce420bc844d91ecebc5e Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sat, 5 Aug 2023 14:04:30 +0800 Subject: [PATCH 7/9] rebuild and regen types --- packages/ast/tsconfig.json | 37 +++++++++---------- packages/ast/types/src/bundle/bundle.d.ts | 1 + .../ast/types/src/clients/lcd/class/lcd.d.ts | 2 +- .../class/grpc-gateway/grpc-gateway.msg.d.ts | 1 + .../grpc-gateway/grpc-gateway.query.d.ts | 1 + .../rpc/class/grpc-web/grpc-web.msg.d.ts | 1 + .../rpc/class/grpc-web/grpc-web.query.d.ts | 1 + .../src/clients/rpc/class/tendermint/rpc.d.ts | 1 + .../src/clients/rpc/class/utils/rpc.d.ts | 3 +- .../src/clients/rpc/extension/extension.d.ts | 1 + .../ast/types/src/encoding/amino/utils.d.ts | 36 +++++++++++++++++- packages/ast/types/src/encoding/context.d.ts | 6 +-- packages/ast/types/src/encoding/object.d.ts | 1 + .../src/encoding/proto/decode/index.d.ts | 2 +- .../src/encoding/proto/encode/index.d.ts | 2 +- .../ast/types/src/encoding/proto/enums.d.ts | 1 + .../src/encoding/proto/from-amino/index.d.ts | 2 +- .../src/encoding/proto/from-json/index.d.ts | 2 +- .../encoding/proto/from-partial/index.d.ts | 2 +- .../src/encoding/proto/from-proto/index.d.ts | 1 + .../encoding/proto/from-sdk-json/index.d.ts | 2 +- .../src/encoding/proto/from-sdk/index.d.ts | 2 +- .../encoding/proto/implements/decoder.d.ts | 2 +- .../encoding/proto/implements/from-amino.d.ts | 2 +- .../encoding/proto/implements/to-amino.d.ts | 2 +- .../src/encoding/proto/interface/amino.d.ts | 1 + .../src/encoding/proto/interface/proto.d.ts | 1 + .../src/encoding/proto/interface/sdk.d.ts | 1 + .../types/src/encoding/proto/props/index.d.ts | 1 + .../src/encoding/proto/to-amino/index.d.ts | 2 +- .../src/encoding/proto/to-json/index.d.ts | 2 +- .../src/encoding/proto/to-proto/index.d.ts | 1 + .../src/encoding/proto/to-sdk/index.d.ts | 2 +- .../ast/types/src/encoding/proto/types.d.ts | 5 ++- packages/ast/types/src/encoding/types.d.ts | 5 ++- packages/ast/types/src/plugins/plugins.d.ts | 2 +- packages/ast/types/src/state/mobx/mobx.d.ts | 1 + packages/ast/types/src/state/pinia/pinia.d.ts | 1 + .../src/state/react-query/react-query.d.ts | 1 + packages/parser/types/store.d.ts | 2 +- packages/parser/types/utils.d.ts | 2 +- .../telescope/types/commands/transpile.d.ts | 4 +- packages/telescope/types/parse.d.ts | 2 +- packages/utils/src/slugs.ts | 2 +- 44 files changed, 103 insertions(+), 49 deletions(-) diff --git a/packages/ast/tsconfig.json b/packages/ast/tsconfig.json index defba4e081..65f1b78448 100644 --- a/packages/ast/tsconfig.json +++ b/packages/ast/tsconfig.json @@ -1,20 +1,19 @@ { - "compilerOptions": { - "target": "esnext", - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "declaration": true, - "declarationDir": "./types", - "emitDeclarationOnly": true, - "isolatedModules": true - }, - "include": [ - "src/**/*" - ], - "exclude": [ - "node_modules", - "src/**/*.spec.ts", - "src/__fixtures__/**/*" - ] -} \ No newline at end of file + "compilerOptions": { + "target": "esnext", + "moduleResolution": "node", + "allowJs": true, + "esModuleInterop": true, + "declaration": true, + "declarationDir": "./types", + "emitDeclarationOnly": true, + "isolatedModules": true + }, + "include": ["src/**/*"], + "exclude": [ + "node_modules", + "src/**/*.spec.ts", + "src/__fixtures__/**/*", + "types" + ] +} diff --git a/packages/ast/types/src/bundle/bundle.d.ts b/packages/ast/types/src/bundle/bundle.d.ts index 448c0b4ba0..aaa575ae26 100644 --- a/packages/ast/types/src/bundle/bundle.d.ts +++ b/packages/ast/types/src/bundle/bundle.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { TelescopeOptions } from '@cosmology/types'; export declare const recursiveModuleBundle: (options: TelescopeOptions, obj: any) => any; export declare const recursiveOtherNameSpaces: (objs: any) => t.ObjectProperty[]; export declare const importNamespace: (ident: string, path: string) => t.ImportDeclaration; diff --git a/packages/ast/types/src/clients/lcd/class/lcd.d.ts b/packages/ast/types/src/clients/lcd/class/lcd.d.ts index 524adfa8da..2c76dc09af 100644 --- a/packages/ast/types/src/clients/lcd/class/lcd.d.ts +++ b/packages/ast/types/src/clients/lcd/class/lcd.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoService } from '@cosmology/types'; +import { ProtoService, ProtoServiceMethodInfo } from '@cosmology/types'; import { GenericParseContext } from '../../../encoding'; export declare const getUrlTemplateString: (url: string) => { strs: any[]; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts index e8b78ff9f4..1b80f56ad1 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.msg.d.ts @@ -1,3 +1,4 @@ import { GenericParseContext } from '../../../../encoding'; +import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGRPCGatewayMsgClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts index 5809185f39..2f748a0a43 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-gateway/grpc-gateway.query.d.ts @@ -1,4 +1,5 @@ import { GenericParseContext } from '../../../../encoding'; +import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGRPCGatewayQueryClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGRPCGatewayWrapperClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts index 5898f8e2f1..0d7799fef3 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.msg.d.ts @@ -1,4 +1,5 @@ import { GenericParseContext } from '../../../../encoding'; +import { ProtoService } from '@cosmology/types'; import * as t from '@babel/types'; export declare const createGrpcWebMsgInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGrpcWebMsgClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts index a802f8d2e1..f00d8d5964 100644 --- a/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts +++ b/packages/ast/types/src/clients/rpc/class/grpc-web/grpc-web.query.d.ts @@ -1,4 +1,5 @@ import { GenericParseContext } from "../../../../encoding"; +import { ProtoService } from "@cosmology/types"; import * as t from '@babel/types'; export declare const createGrpcWebQueryInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const createGrpcWebQueryClass: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts b/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts index 383dfa138c..47036c7033 100644 --- a/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts +++ b/packages/ast/types/src/clients/rpc/class/tendermint/rpc.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../../../encoding'; export declare const createRpcClientInterface: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; export declare const getRpcClassName: (service: ProtoService) => string; diff --git a/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts b/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts index d48c9148f1..89c1f060e5 100644 --- a/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts +++ b/packages/ast/types/src/clients/rpc/class/utils/rpc.d.ts @@ -1,5 +1,6 @@ +import { ProtoServiceMethod } from '@cosmology/types'; import * as t from '@babel/types'; -export declare const processRpcComment: (e: ProtoServiceMethod) => any; +export declare const processRpcComment: (e: ProtoServiceMethod) => string; export declare const cleanType: (ResponseType: string) => string; export declare const returnReponseType: (ResponseType: string) => t.TSTypeAnnotation; export declare const optionalBool: (hasParams: boolean, fieldNames: string[]) => boolean; diff --git a/packages/ast/types/src/clients/rpc/extension/extension.d.ts b/packages/ast/types/src/clients/rpc/extension/extension.d.ts index aa19aadbc9..75d8970f6d 100644 --- a/packages/ast/types/src/clients/rpc/extension/extension.d.ts +++ b/packages/ast/types/src/clients/rpc/extension/extension.d.ts @@ -1,3 +1,4 @@ import * as t from '@babel/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../../encoding'; export declare const createRpcQueryExtension: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/amino/utils.d.ts b/packages/ast/types/src/encoding/amino/utils.d.ts index 1515a8692c..c0c9576e6e 100644 --- a/packages/ast/types/src/encoding/amino/utils.d.ts +++ b/packages/ast/types/src/encoding/amino/utils.d.ts @@ -1,7 +1,39 @@ -import { ProtoAny, ProtoType } from '@cosmology/types'; +import { ProtoAny, ProtoRoot, ProtoType } from '@cosmology/types'; import { GenericParseContext } from '../context'; export declare const getTypeUrlWithPkgAndName: (pkg: string, name: string) => string; export declare const getTypeUrl: (root: ProtoRoot, proto: ProtoAny | ProtoType) => string; export declare const arrayTypeNDim: (body: any, n: any) => any; export declare const getAminoTypeName: (context: GenericParseContext, root: ProtoRoot, proto: ProtoType) => any; -export declare const protoFieldsToArray: (proto: ProtoType) => any[]; +export declare const protoFieldsToArray: (proto: ProtoType) => { + type?: string; + name: string; + scope?: string[]; + parsedType?: { + name: string; + type: string; + }; + message?: string; + package?: string; + keyType?: string; + rule?: string; + id: number; + options: { + [key: string]: any; + deprecated?: boolean; + json_name?: string; + "(cosmos_proto.json_tag)"?: string; + "(cosmos_proto.accepts_interface)"?: string; + "(cosmos_proto.scalar)"?: string; + "(telescope:name)"?: string; + "(telescope:orig)"?: string; + "(telescope:camel)"?: string; + "(gogoproto.casttype)"?: string; + "(gogoproto.customtype)"?: string; + "(gogoproto.moretags)"?: string; + "(gogoproto.nullable)"?: boolean; + }; + comment?: string; + import?: string; + importedName?: string; + scopeType?: string; +}[]; diff --git a/packages/ast/types/src/encoding/context.d.ts b/packages/ast/types/src/encoding/context.d.ts index 405e11c06a..efa4f56fb5 100644 --- a/packages/ast/types/src/encoding/context.d.ts +++ b/packages/ast/types/src/encoding/context.d.ts @@ -26,20 +26,20 @@ export declare class GenericParseContext implements ParseContext { ref: ProtoRef; constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions); pluginValue(name: any): any; - isExcluded(): any; + isExcluded(): boolean; addUtil(util: any): void; addImport(imp: ImportUsage): void; addImportDerivative(imp: DerivativeImport): void; getTypeNameFromFieldName(name: string, importSrc: string): string; getTypeName(field: ProtoField): string; - lookupTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): any; + lookupTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): import("@cosmology/proto-parser").Lookup; getTypeFromCurrentPath(field: ProtoField, currentProtoPath: string): any; } export declare class AminoParseContext extends GenericParseContext implements ParseContext { aminoCasingFn: Function; constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions); private setAminoCasingFn; - aminoCaseField(field: ProtoField): any; + aminoCaseField(field: ProtoField): string; lookupEnumFromJson(field: ProtoField, currentProtoPath: string): string; lookupEnumToJson(field: ProtoField, currentProtoPath: string): string; } diff --git a/packages/ast/types/src/encoding/object.d.ts b/packages/ast/types/src/encoding/object.d.ts index c256a158d6..69742be086 100644 --- a/packages/ast/types/src/encoding/object.d.ts +++ b/packages/ast/types/src/encoding/object.d.ts @@ -1,3 +1,4 @@ import * as t from '@babel/types'; +import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from './context'; export declare const createObjectWithMethods: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/decode/index.d.ts b/packages/ast/types/src/encoding/proto/decode/index.d.ts index c287337459..c2da82b568 100644 --- a/packages/ast/types/src/encoding/proto/decode/index.d.ts +++ b/packages/ast/types/src/encoding/proto/decode/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; export interface DecodeMethod { typeName: string; context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/encode/index.d.ts b/packages/ast/types/src/encoding/proto/encode/index.d.ts index 2ced13c57e..19c5424a45 100644 --- a/packages/ast/types/src/encoding/proto/encode/index.d.ts +++ b/packages/ast/types/src/encoding/proto/encode/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface EncodeMethod { typeName: string; diff --git a/packages/ast/types/src/encoding/proto/enums.d.ts b/packages/ast/types/src/encoding/proto/enums.d.ts index 960cb01553..413d56d1aa 100644 --- a/packages/ast/types/src/encoding/proto/enums.d.ts +++ b/packages/ast/types/src/encoding/proto/enums.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoEnum } from '@cosmology/types'; import { ProtoParseContext } from '../context'; export declare const createProtoEnum: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; export declare const createProtoEnumFromJSON: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/from-amino/index.d.ts b/packages/ast/types/src/encoding/proto/from-amino/index.d.ts index 31d61fe635..3cb26eec9e 100644 --- a/packages/ast/types/src/encoding/proto/from-amino/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-amino/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromAminoJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-json/index.d.ts b/packages/ast/types/src/encoding/proto/from-json/index.d.ts index b21889405f..29cb3a2547 100644 --- a/packages/ast/types/src/encoding/proto/from-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-json/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-partial/index.d.ts b/packages/ast/types/src/encoding/proto/from-partial/index.d.ts index dd8d1a394b..5f80381f19 100644 --- a/packages/ast/types/src/encoding/proto/from-partial/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-partial/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; export interface FromPartialMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/from-proto/index.d.ts b/packages/ast/types/src/encoding/proto/from-proto/index.d.ts index 3c5c02518c..e7828acf5a 100644 --- a/packages/ast/types/src/encoding/proto/from-proto/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-proto/index.d.ts @@ -1,3 +1,4 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; +import { ProtoType } from '@cosmology/types'; export declare const fromProtoMsgMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; diff --git a/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts b/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts index 9e0652d947..4256f5f972 100644 --- a/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-sdk-json/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromSDKJSONMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts b/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts index 1d4db841b4..a8f1e177ca 100644 --- a/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts +++ b/packages/ast/types/src/encoding/proto/from-sdk/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoField } from '@cosmology/types'; +import { ProtoType, ProtoField } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export interface FromSDKMethod { context: ProtoParseContext; diff --git a/packages/ast/types/src/encoding/proto/implements/decoder.d.ts b/packages/ast/types/src/encoding/proto/implements/decoder.d.ts index d38b7bf0cd..a491fee967 100644 --- a/packages/ast/types/src/encoding/proto/implements/decoder.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/decoder.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { TraverseTypeUrlRef } from '@cosmology/types'; +import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const getInterfaceDecoderName: (str: string) => string; export declare const createInterfaceDecoder: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts b/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts index 47e34f2f8d..be8f508034 100644 --- a/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/from-amino.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { TraverseTypeUrlRef } from '@cosmology/types'; +import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from "../../context"; export declare const getInterfaceFromAminoName: (str: string) => string; export declare const createInterfaceFromAmino: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts b/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts index 6e28400b56..5164422795 100644 --- a/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts +++ b/packages/ast/types/src/encoding/proto/implements/to-amino.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { TraverseTypeUrlRef } from '@cosmology/types'; +import { ProtoRef, TraverseTypeUrlRef } from '@cosmology/types'; import { ProtoParseContext } from "../../context"; export declare const getInterfaceToAminoName: (str: string) => string; export declare const createInterfaceToAmino: (context: ProtoParseContext, ref: ProtoRef, interfaceName: string) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/amino.d.ts b/packages/ast/types/src/encoding/proto/interface/amino.d.ts index fe12b95205..b93724569f 100644 --- a/packages/ast/types/src/encoding/proto/interface/amino.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/amino.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoType, ProtoEnum } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const createAminoType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; export declare const createAminoTypeType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/proto.d.ts b/packages/ast/types/src/encoding/proto/interface/proto.d.ts index 0805b11365..974851b09c 100644 --- a/packages/ast/types/src/encoding/proto/interface/proto.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/proto.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; import { TelescopeBaseTypes } from '../../types'; export declare const createProtoType: (context: ProtoParseContext, name: string, proto: ProtoType, type?: TelescopeBaseTypes) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/interface/sdk.d.ts b/packages/ast/types/src/encoding/proto/interface/sdk.d.ts index abea695b76..99198f98e8 100644 --- a/packages/ast/types/src/encoding/proto/interface/sdk.d.ts +++ b/packages/ast/types/src/encoding/proto/interface/sdk.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoEnum, ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; export declare const createSDKType: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ExportNamedDeclaration; export declare const createEnumSDKType: (context: ProtoParseContext, name: string, proto: ProtoEnum) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/encoding/proto/props/index.d.ts b/packages/ast/types/src/encoding/proto/props/index.d.ts index 087e43d913..da68552ccd 100644 --- a/packages/ast/types/src/encoding/proto/props/index.d.ts +++ b/packages/ast/types/src/encoding/proto/props/index.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; +import { ProtoType } from '@cosmology/types'; export declare const createTypeUrlProperty: (context: ProtoParseContext, proto: ProtoType) => t.ObjectProperty; export declare const createAminoTypeProperty: (context: ProtoParseContext, proto: ProtoType) => t.ObjectProperty; diff --git a/packages/ast/types/src/encoding/proto/to-amino/index.d.ts b/packages/ast/types/src/encoding/proto/to-amino/index.d.ts index 214b0648f9..4891dd5b46 100644 --- a/packages/ast/types/src/encoding/proto/to-amino/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-amino/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField } from '@cosmology/types'; +import { ProtoField, ProtoType } from '@cosmology/types'; export interface ToAminoJSONMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/to-json/index.d.ts b/packages/ast/types/src/encoding/proto/to-json/index.d.ts index 2cbca952f0..8e9cd0aa57 100644 --- a/packages/ast/types/src/encoding/proto/to-json/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-json/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField } from '@cosmology/types'; +import { ProtoField, ProtoType } from '@cosmology/types'; export interface ToJSONMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/to-proto/index.d.ts b/packages/ast/types/src/encoding/proto/to-proto/index.d.ts index e63164aa11..106881e79d 100644 --- a/packages/ast/types/src/encoding/proto/to-proto/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-proto/index.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; +import { ProtoType } from '@cosmology/types'; export declare const toProtoMsgMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; export declare const toProtoMethod: (context: ProtoParseContext, name: string, proto: ProtoType) => t.ObjectMethod; diff --git a/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts b/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts index 76da023840..86369729e3 100644 --- a/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts +++ b/packages/ast/types/src/encoding/proto/to-sdk/index.d.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoParseContext } from '../../context'; -import { ProtoField } from '@cosmology/types'; +import { ProtoField, ProtoType } from '@cosmology/types'; export interface ToSDKMethod { context: ProtoParseContext; field: ProtoField; diff --git a/packages/ast/types/src/encoding/proto/types.d.ts b/packages/ast/types/src/encoding/proto/types.d.ts index 826bf01020..a04c3b6a97 100644 --- a/packages/ast/types/src/encoding/proto/types.d.ts +++ b/packages/ast/types/src/encoding/proto/types.d.ts @@ -1,3 +1,4 @@ +import { ProtoType, ProtoField } from '@cosmology/types'; import { AminoParseContext, ProtoParseContext } from '../context'; export declare const SCALAR_TYPES: string[]; export declare const GOOGLE_TYPES: string[]; @@ -79,10 +80,10 @@ export declare const getPackedWireNumber: (type: any) => any; export declare const getTagNumber: (field: ProtoField) => number; export declare const getEnumToJsonName: (name: any) => string; export declare const getEnumFromJsonName: (name: any) => string; -export declare const getFieldsTypeName: (field: ProtoField) => any; +export declare const getFieldsTypeName: (field: ProtoField) => string; export declare const getKeyTypeEntryName: (typeName: string, prop: string) => string; export declare const getBaseCreateTypeFuncName: (name: any) => string; -export declare const getOneOfs: (type: ProtoType) => any; +export declare const getOneOfs: (type: ProtoType) => string[]; export declare const getFieldOptionality: (context: ProtoParseContext | AminoParseContext, field: ProtoField, isOneOf: boolean) => boolean; export declare const isScalarField: (field: ProtoField) => boolean; export declare const isArrayField: (field: ProtoField) => boolean; diff --git a/packages/ast/types/src/encoding/types.d.ts b/packages/ast/types/src/encoding/types.d.ts index 17653a4ba0..92506110fd 100644 --- a/packages/ast/types/src/encoding/types.d.ts +++ b/packages/ast/types/src/encoding/types.d.ts @@ -1,8 +1,9 @@ import * as t from '@babel/types'; +import { ProtoField } from '@cosmology/types'; import { GenericParseContext, ProtoParseContext } from './context'; export declare const getFieldNames: (field: ProtoField) => { - propName: any; - origName: any; + propName: string; + origName: string; }; export type TelescopeBaseTypes = 'Msg' | 'SDKType' | 'Amino' | 'AminoMsg' | 'ProtoMsg' | 'Encoded'; export declare const SymbolNames: { diff --git a/packages/ast/types/src/plugins/plugins.d.ts b/packages/ast/types/src/plugins/plugins.d.ts index 1f821c08ab..84860c1fd1 100644 --- a/packages/ast/types/src/plugins/plugins.d.ts +++ b/packages/ast/types/src/plugins/plugins.d.ts @@ -1,2 +1,2 @@ -import { TelescopeOption } from '@cosmology/types'; +import { TelescopeOptions, TelescopeOption } from '@cosmology/types'; export declare const getPluginValue: (optionName: TelescopeOption | string, currentPkg: string, options: TelescopeOptions) => any; diff --git a/packages/ast/types/src/state/mobx/mobx.d.ts b/packages/ast/types/src/state/mobx/mobx.d.ts index f64ceda67b..053bea1aa8 100644 --- a/packages/ast/types/src/state/mobx/mobx.d.ts +++ b/packages/ast/types/src/state/mobx/mobx.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; /** * Entry for building stores. diff --git a/packages/ast/types/src/state/pinia/pinia.d.ts b/packages/ast/types/src/state/pinia/pinia.d.ts index fe05662763..dddbd6abb7 100644 --- a/packages/ast/types/src/state/pinia/pinia.d.ts +++ b/packages/ast/types/src/state/pinia/pinia.d.ts @@ -1,3 +1,4 @@ import * as t from '@babel/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; export declare const createPiniaStore: (context: GenericParseContext, service: ProtoService) => t.ExportNamedDeclaration; diff --git a/packages/ast/types/src/state/react-query/react-query.d.ts b/packages/ast/types/src/state/react-query/react-query.d.ts index fb5791f4a2..f9b417ae25 100644 --- a/packages/ast/types/src/state/react-query/react-query.d.ts +++ b/packages/ast/types/src/state/react-query/react-query.d.ts @@ -1,4 +1,5 @@ import * as t from '@babel/types'; +import { ProtoService } from '@cosmology/types'; import { GenericParseContext } from '../../encoding'; /** * Create an ASTs for a function creating hooks diff --git a/packages/parser/types/store.d.ts b/packages/parser/types/store.d.ts index 931183503c..d87f738a4a 100644 --- a/packages/parser/types/store.d.ts +++ b/packages/parser/types/store.d.ts @@ -46,4 +46,4 @@ export declare class ProtoStore { getTypeUrlMap(ref: ProtoRef): import("@cosmology/types").InterfaceTypeUrlMap; getServices(myBase: string): Record; } -export { }; +export {}; diff --git a/packages/parser/types/utils.d.ts b/packages/parser/types/utils.d.ts index 050954a3d5..8ee6f99f21 100644 --- a/packages/parser/types/utils.d.ts +++ b/packages/parser/types/utils.d.ts @@ -8,7 +8,7 @@ export declare const createTypeUrlTypeMap: (store: ProtoStore, fromRef: ProtoRef /** * test if a proto ref is included by the operation. * @param ref a ProtoRef with proto file info and package. - * @param exclude patterns(will be deprecated soon), packages, proto files to include + * @param include patterns(will be deprecated soon), packages, proto files to include * @returns */ export declare const isRefIncluded: (ref: ProtoRef, include?: { diff --git a/packages/telescope/types/commands/transpile.d.ts b/packages/telescope/types/commands/transpile.d.ts index d83188a8f3..7cda34517c 100644 --- a/packages/telescope/types/commands/transpile.d.ts +++ b/packages/telescope/types/commands/transpile.d.ts @@ -1,2 +1,4 @@ -declare const _default: (argv: any) => Promise; +declare const _default: (argv: { + [key: string]: string | string[]; +}) => Promise; export default _default; diff --git a/packages/telescope/types/parse.d.ts b/packages/telescope/types/parse.d.ts index 1c4521593a..5aeb130d5c 100644 --- a/packages/telescope/types/parse.d.ts +++ b/packages/telescope/types/parse.d.ts @@ -12,4 +12,4 @@ interface ParseRecur { isNested: boolean; } export declare const parseRecur: ({ context, obj, scope, isNested }: ParseRecur) => void; -export { }; +export {}; diff --git a/packages/utils/src/slugs.ts b/packages/utils/src/slugs.ts index a1ae808e7e..98b4cbfc87 100644 --- a/packages/utils/src/slugs.ts +++ b/packages/utils/src/slugs.ts @@ -1,4 +1,4 @@ -import { camel } from '@cosmology/utils'; +import { camel } from '.'; import { relative, dirname, extname } from 'path'; export const variableSlug = (str) => { From 1248b55ae1161de3280b7eaaa24d4ef2a4d78a3e Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Wed, 9 Aug 2023 07:10:07 +0800 Subject: [PATCH 8/9] keep format in output1 and output2 --- __fixtures__/output1/helpers.ts | 34 +++++++++++++++---------------- __fixtures__/output1/index.ts | 2 +- __fixtures__/output2/helpers.ts | 36 ++++++++++++++++----------------- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/__fixtures__/output1/helpers.ts b/__fixtures__/output1/helpers.ts index 53124a848b..d14762f911 100644 --- a/__fixtures__/output1/helpers.ts +++ b/__fixtures__/output1/helpers.ts @@ -140,17 +140,17 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.key !== "undefined") { // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); // Uint8Array to String options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -221,22 +221,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } diff --git a/__fixtures__/output1/index.ts b/__fixtures__/output1/index.ts index b5ebddc0c6..38dd89d1eb 100644 --- a/__fixtures__/output1/index.ts +++ b/__fixtures__/output1/index.ts @@ -3,7 +3,7 @@ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ - + export * from "./akash/bundle"; export * from "./akash/client"; export * from "./ics23/bundle"; diff --git a/__fixtures__/output2/helpers.ts b/__fixtures__/output2/helpers.ts index 674ecc2536..d14762f911 100644 --- a/__fixtures__/output2/helpers.ts +++ b/__fixtures__/output2/helpers.ts @@ -1,5 +1,3 @@ -//@ts-nocheck -/* eslint-disable */ /** * This file and any referenced files were automatically generated by @cosmology/telescope@latest * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain @@ -142,17 +140,17 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.key !== "undefined") { // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); // Uint8Array to String options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); } if (typeof pagination?.limit !== "undefined") { - options.params["pagination.limit"] = pagination.limit.toString() + options.params["pagination.limit"] = pagination.limit.toString() } if (typeof pagination?.offset !== "undefined") { - options.params["pagination.offset"] = pagination.offset.toString() - } + options.params["pagination.offset"] = pagination.offset.toString() + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -223,22 +221,22 @@ const fromJSON = (object: any): Timestamp => { }; const timestampFromJSON = (object: any): Timestamp => { - return { - seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, - nanos: isSet(object.nanos) ? Number(object.nanos) : 0, - }; + return { + seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; } - + export function fromJsonTimestamp(o: any): Timestamp { - if (o instanceof Date) { - return toTimestamp(o); - } else if (typeof o === "string") { - return toTimestamp(new Date(o)); - } else { - return timestampFromJSON(o); - } + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === "string") { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } } - + function numberToLong(number: number) { return Long.fromNumber(number); } From 2729dfdae74c2f25efa1fe3a7081b6b5fa72b02e Mon Sep 17 00:00:00 2001 From: Zhi Zhen Date: Wed, 9 Aug 2023 07:18:14 +0800 Subject: [PATCH 9/9] Update helpers.ts --- __fixtures__/output2/helpers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__fixtures__/output2/helpers.ts b/__fixtures__/output2/helpers.ts index d14762f911..cd20308db2 100644 --- a/__fixtures__/output2/helpers.ts +++ b/__fixtures__/output2/helpers.ts @@ -1,3 +1,5 @@ +//@ts-nocheck +/* eslint-disable */ /** * This file and any referenced files were automatically generated by @cosmology/telescope@latest * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain