diff --git a/.gitignore b/.gitignore index fd7af019d..d4f03a0df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,6 @@ **/node_modules /.coverage /coverage -/.idea -/.vscode /.nyc_output /docs/ /out/ diff --git a/.jsdoc.js b/.jsdoc.js index e37e0473a..fa936266d 100644 --- a/.jsdoc.js +++ b/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2023 Google LLC', + copyright: 'Copyright 2024 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/spanner', diff --git a/CHANGELOG.md b/CHANGELOG.md index 485b49e73..18ccad4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ [1]: https://www.npmjs.com/package/nodejs-spanner?activeTab=versions +## [7.3.0](https://github.com/googleapis/nodejs-spanner/compare/v7.2.0...v7.3.0) (2024-02-08) + + +### Features + +* **spanner:** Add maxCommitDelay support ([#1992](https://github.com/googleapis/nodejs-spanner/issues/1992)) ([9f84408](https://github.com/googleapis/nodejs-spanner/commit/9f8440843fd8926a37ec300a318dad33b83b4f97)) + + +### Bug Fixes + +* **deps:** Update dependency google-gax to v4.1.0 ([#1981](https://github.com/googleapis/nodejs-spanner/issues/1981)) ([2a36150](https://github.com/googleapis/nodejs-spanner/commit/2a36150cb61e9abeef073724189cc651d29d8776)) +* **deps:** Update dependency google-gax to v4.2.0 ([#1988](https://github.com/googleapis/nodejs-spanner/issues/1988)) ([005589a](https://github.com/googleapis/nodejs-spanner/commit/005589a7727ee87948a55a6c7710f5150fc1c6a7)) +* **deps:** Update dependency google-gax to v4.2.1 ([#1989](https://github.com/googleapis/nodejs-spanner/issues/1989)) ([d2ae995](https://github.com/googleapis/nodejs-spanner/commit/d2ae9952e7449ce2321e69a6be36c9d50d863095)) +* **deps:** Update dependency google-gax to v4.3.0 ([#1990](https://github.com/googleapis/nodejs-spanner/issues/1990)) ([e625753](https://github.com/googleapis/nodejs-spanner/commit/e625753a37393f32d9e449aa7324763082f6c923)) + ## [7.2.0](https://github.com/googleapis/nodejs-spanner/compare/v7.1.0...v7.2.0) (2024-01-11) diff --git a/package.json b/package.json index 20782cb80..2f443ca40 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@google-cloud/spanner", "description": "Cloud Spanner Client Library for Node.js", - "version": "7.2.0", + "version": "7.3.0", "license": "Apache-2.0", "author": "Google Inc.", "engines": { @@ -65,7 +65,7 @@ "events-intercept": "^2.0.0", "extend": "^3.0.2", "google-auth-library": "^9.0.0", - "google-gax": "4.0.5", + "google-gax": "4.3.0", "grpc-gcp": "^1.0.0", "is": "^3.2.1", "lodash.snakecase": "^4.1.1", @@ -90,7 +90,7 @@ "@types/ncp": "^2.0.1", "@types/proxyquire": "^1.3.28", "@types/request": "^2.48.3", - "@types/sinon": "^10.0.0", + "@types/sinon": "^17.0.0", "@types/through2": "^2.0.34", "@types/uuid": "^9.0.0", "binary-search-bounds": "^2.0.4", @@ -99,7 +99,7 @@ "concat-stream": "^2.0.0", "dedent": "^1.0.0", "execa": "^5.0.0", - "gapic-tools": "^0.2.0", + "gapic-tools": "^0.3.0", "gts": "^5.0.0", "jsdoc": "^4.0.0", "jsdoc-fresh": "^3.0.0", @@ -111,7 +111,7 @@ "ncp": "^2.0.0", "p-limit": "^3.0.1", "proxyquire": "^2.0.1", - "sinon": "^15.0.0", + "sinon": "^17.0.0", "stats-lite": "^2.1.1", "time-span": "^4.0.0", "tmp": "^0.2.0", diff --git a/protos/google/spanner/admin/database/v1/spanner_database_admin.proto b/protos/google/spanner/admin/database/v1/spanner_database_admin.proto index 6cf0e5a4b..a522c08c1 100644 --- a/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +++ b/protos/google/spanner/admin/database/v1/spanner_database_admin.proto @@ -572,6 +572,23 @@ message CreateDatabaseRequest { // Optional. The dialect of the Cloud Spanner Database. DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + // 'extra_statements' above. + // Contains a protobuf-serialized + // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + // To generate it, [install](https://grpc.io/docs/protoc-installation/) and + // run `protoc` with --include_imports and --descriptor_set_out. For example, + // to generate for moon/shot/app.proto, run + // ``` + // $protoc --proto_path=/app_path --proto_path=/lib_path \ + // --include_imports \ + // --descriptor_set_out=descriptors.data \ + // moon/shot/app.proto + // ``` + // For more details, see protobuffer [self + // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + bytes proto_descriptors = 6 [(google.api.field_behavior) = OPTIONAL]; } // Metadata type for the operation returned by @@ -674,6 +691,22 @@ message UpdateDatabaseDdlRequest { // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns // `ALREADY_EXISTS`. string operation_id = 3; + + // Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + // Contains a protobuf-serialized + // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + // To generate it, [install](https://grpc.io/docs/protoc-installation/) and + // run `protoc` with --include_imports and --descriptor_set_out. For example, + // to generate for moon/shot/app.proto, run + // ``` + // $protoc --proto_path=/app_path --proto_path=/lib_path \ + // --include_imports \ + // --descriptor_set_out=descriptors.data \ + // moon/shot/app.proto + // ``` + // For more details, see protobuffer [self + // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + bytes proto_descriptors = 4 [(google.api.field_behavior) = OPTIONAL]; } // Action information extracted from a DDL statement. This proto is used to @@ -762,6 +795,13 @@ message GetDatabaseDdlResponse { // A list of formatted DDL statements defining the schema of the database // specified in the request. repeated string statements = 1; + + // Proto descriptors stored in the database. + // Contains a protobuf-serialized + // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + // For more details, see protobuffer [self + // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + bytes proto_descriptors = 2; } // The request for diff --git a/protos/google/spanner/v1/spanner.proto b/protos/google/spanner/v1/spanner.proto index 367928a45..ae193edc5 100644 --- a/protos/google/spanner/v1/spanner.proto +++ b/protos/google/spanner/v1/spanner.proto @@ -22,6 +22,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; @@ -927,9 +928,10 @@ message PartitionQueryRequest { // Required. The query request to generate partitions for. The request will // fail if the query is not root partitionable. For a query to be root - // partitionable, it needs to satisfy a few conditions. For example, the first - // operator in the query execution plan must be a distributed union operator. - // For more information about other conditions, see [Read data in + // partitionable, it needs to satisfy a few conditions. For example, if the + // query execution plan contains a distributed union operator, then it must be + // the first operator in the plan. For more information about other + // conditions, see [Read data in // parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). // // The query request must not contain DML commands, such as INSERT, UPDATE, or @@ -1163,6 +1165,14 @@ message CommitRequest { // Default value is `false`. bool return_commit_stats = 5; + // Optional. The amount of latency this request is willing to incur in order + // to improve throughput. If this field is not set, Spanner assumes requests + // are relatively latency sensitive and automatically determines an + // appropriate delay time. You can specify a batching delay value between 0 + // and 500 ms. + google.protobuf.Duration max_commit_delay = 8 + [(google.api.field_behavior) = OPTIONAL]; + // Common options for this request. RequestOptions request_options = 6; } diff --git a/protos/google/spanner/v1/type.proto b/protos/google/spanner/v1/type.proto index 412cfa126..8e28fa7fd 100644 --- a/protos/google/spanner/v1/type.proto +++ b/protos/google/spanner/v1/type.proto @@ -47,6 +47,13 @@ message Type { // typically is not needed to process the content of a value (it doesn't // affect serialization) and clients can ignore it on the read path. TypeAnnotationCode type_annotation = 4; + + // If [code][google.spanner.v1.Type.code] == + // [PROTO][google.spanner.v1.TypeCode.PROTO] or + // [code][google.spanner.v1.Type.code] == + // [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully + // qualified name of the proto type representing the proto/enum definition. + string proto_type_fqn = 5; } // `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type. @@ -96,6 +103,10 @@ enum TypeCode { // `"-Infinity"`. FLOAT64 = 3; + // Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or + // `"-Infinity"`. + FLOAT32 = 15; + // Encoded as `string` in RFC 3339 timestamp format. The time zone // must be present, and must be `"Z"`. // @@ -145,6 +156,13 @@ enum TypeCode { // preserved. // - JSON array elements will have their order preserved. JSON = 11; + + // Encoded as a base64-encoded `string`, as described in RFC 4648, + // section 4. + PROTO = 13; + + // Encoded as `string`, in decimal format. + ENUM = 14; } // `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to diff --git a/protos/protos.d.ts b/protos/protos.d.ts index f020eea26..5f5a40479 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -220,6 +220,21 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Edition enum. */ + enum Edition { + EDITION_UNKNOWN = 0, + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + EDITION_2023 = 1000, + EDITION_2024 = 1001, + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + EDITION_MAX = 2147483647 + } + /** Properties of a FileDescriptorProto. */ interface IFileDescriptorProto { @@ -260,7 +275,7 @@ export namespace google { syntax?: (string|null); /** FileDescriptorProto edition */ - edition?: (string|null); + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); } /** Represents a FileDescriptorProto. */ @@ -309,7 +324,7 @@ export namespace google { public syntax: string; /** FileDescriptorProto edition. */ - public edition: string; + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); /** * Creates a new FileDescriptorProto instance using the specified properties. @@ -1184,8 +1199,8 @@ export namespace google { /** Label enum. */ enum Label { LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, - LABEL_REPEATED = 3 + LABEL_REPEATED = 3, + LABEL_REQUIRED = 2 } } @@ -1897,9 +1912,6 @@ export namespace google { /** FileOptions pyGenericServices */ pyGenericServices?: (boolean|null); - /** FileOptions phpGenericServices */ - phpGenericServices?: (boolean|null); - /** FileOptions deprecated */ deprecated?: (boolean|null); @@ -1976,9 +1988,6 @@ export namespace google { /** FileOptions pyGenericServices. */ public pyGenericServices: boolean; - /** FileOptions phpGenericServices. */ - public phpGenericServices: boolean; - /** FileOptions deprecated. */ public deprecated: boolean; @@ -2452,7 +2461,7 @@ export namespace google { interface IEditionDefault { /** EditionDefault edition */ - edition?: (string|null); + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); /** EditionDefault value */ value?: (string|null); @@ -2468,7 +2477,7 @@ export namespace google { constructor(properties?: google.protobuf.FieldOptions.IEditionDefault); /** EditionDefault edition. */ - public edition: string; + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); /** EditionDefault value. */ public value: string; @@ -3391,17 +3400,14 @@ export namespace google { /** FeatureSet repeatedFieldEncoding */ repeatedFieldEncoding?: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding|null); - /** FeatureSet stringFieldValidation */ - stringFieldValidation?: (google.protobuf.FeatureSet.StringFieldValidation|keyof typeof google.protobuf.FeatureSet.StringFieldValidation|null); + /** FeatureSet utf8Validation */ + utf8Validation?: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation|null); /** FeatureSet messageEncoding */ messageEncoding?: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding|null); /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); - - /** FeatureSet rawFeatures */ - rawFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSet. */ @@ -3422,8 +3428,8 @@ export namespace google { /** FeatureSet repeatedFieldEncoding. */ public repeatedFieldEncoding: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding); - /** FeatureSet stringFieldValidation. */ - public stringFieldValidation: (google.protobuf.FeatureSet.StringFieldValidation|keyof typeof google.protobuf.FeatureSet.StringFieldValidation); + /** FeatureSet utf8Validation. */ + public utf8Validation: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation); /** FeatureSet messageEncoding. */ public messageEncoding: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding); @@ -3431,9 +3437,6 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); - /** FeatureSet rawFeatures. */ - public rawFeatures?: (google.protobuf.IFeatureSet|null); - /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -3536,11 +3539,10 @@ export namespace google { EXPANDED = 2 } - /** StringFieldValidation enum. */ - enum StringFieldValidation { - STRING_FIELD_VALIDATION_UNKNOWN = 0, - MANDATORY = 1, - HINT = 2, + /** Utf8Validation enum. */ + enum Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, NONE = 3 } @@ -3559,6 +3561,221 @@ export namespace google { } } + /** Properties of a FeatureSetDefaults. */ + interface IFeatureSetDefaults { + + /** FeatureSetDefaults defaults */ + defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); + + /** FeatureSetDefaults minimumEdition */ + minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetDefaults maximumEdition */ + maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSetDefaults. */ + class FeatureSetDefaults implements IFeatureSetDefaults { + + /** + * Constructs a new FeatureSetDefaults. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFeatureSetDefaults); + + /** FeatureSetDefaults defaults. */ + public defaults: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]; + + /** FeatureSetDefaults minimumEdition. */ + public minimumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetDefaults maximumEdition. */ + public maximumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetDefaults instance + */ + public static create(properties?: google.protobuf.IFeatureSetDefaults): google.protobuf.FeatureSetDefaults; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults; + + /** + * Verifies a FeatureSetDefaults message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetDefaults + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @param message FeatureSetDefaults + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetDefaults + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FeatureSetDefaults { + + /** Properties of a FeatureSetEditionDefault. */ + interface IFeatureSetEditionDefault { + + /** FeatureSetEditionDefault edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetEditionDefault features */ + features?: (google.protobuf.IFeatureSet|null); + } + + /** Represents a FeatureSetEditionDefault. */ + class FeatureSetEditionDefault implements IFeatureSetEditionDefault { + + /** + * Constructs a new FeatureSetEditionDefault. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault); + + /** FeatureSetEditionDefault edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetEditionDefault features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetEditionDefault instance + */ + public static create(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Verifies a FeatureSetEditionDefault message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetEditionDefault + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @param message FeatureSetEditionDefault + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a SourceCodeInfo. */ interface ISourceCodeInfo { @@ -9308,6 +9525,9 @@ export namespace google { /** CreateDatabaseRequest databaseDialect */ databaseDialect?: (google.spanner.admin.database.v1.DatabaseDialect|keyof typeof google.spanner.admin.database.v1.DatabaseDialect|null); + + /** CreateDatabaseRequest protoDescriptors */ + protoDescriptors?: (Uint8Array|string|null); } /** Represents a CreateDatabaseRequest. */ @@ -9334,6 +9554,9 @@ export namespace google { /** CreateDatabaseRequest databaseDialect. */ public databaseDialect: (google.spanner.admin.database.v1.DatabaseDialect|keyof typeof google.spanner.admin.database.v1.DatabaseDialect); + /** CreateDatabaseRequest protoDescriptors. */ + public protoDescriptors: (Uint8Array|string); + /** * Creates a new CreateDatabaseRequest instance using the specified properties. * @param [properties] Properties to set @@ -9829,6 +10052,9 @@ export namespace google { /** UpdateDatabaseDdlRequest operationId */ operationId?: (string|null); + + /** UpdateDatabaseDdlRequest protoDescriptors */ + protoDescriptors?: (Uint8Array|string|null); } /** Represents an UpdateDatabaseDdlRequest. */ @@ -9849,6 +10075,9 @@ export namespace google { /** UpdateDatabaseDdlRequest operationId. */ public operationId: string; + /** UpdateDatabaseDdlRequest protoDescriptors. */ + public protoDescriptors: (Uint8Array|string); + /** * Creates a new UpdateDatabaseDdlRequest instance using the specified properties. * @param [properties] Properties to set @@ -10362,6 +10591,9 @@ export namespace google { /** GetDatabaseDdlResponse statements */ statements?: (string[]|null); + + /** GetDatabaseDdlResponse protoDescriptors */ + protoDescriptors?: (Uint8Array|string|null); } /** Represents a GetDatabaseDdlResponse. */ @@ -10376,6 +10608,9 @@ export namespace google { /** GetDatabaseDdlResponse statements. */ public statements: string[]; + /** GetDatabaseDdlResponse protoDescriptors. */ + public protoDescriptors: (Uint8Array|string); + /** * Creates a new GetDatabaseDdlResponse instance using the specified properties. * @param [properties] Properties to set @@ -16975,6 +17210,9 @@ export namespace google { /** Type typeAnnotation */ typeAnnotation?: (google.spanner.v1.TypeAnnotationCode|keyof typeof google.spanner.v1.TypeAnnotationCode|null); + + /** Type protoTypeFqn */ + protoTypeFqn?: (string|null); } /** Represents a Type. */ @@ -16998,6 +17236,9 @@ export namespace google { /** Type typeAnnotation. */ public typeAnnotation: (google.spanner.v1.TypeAnnotationCode|keyof typeof google.spanner.v1.TypeAnnotationCode); + /** Type protoTypeFqn. */ + public protoTypeFqn: string; + /** * Creates a new Type instance using the specified properties. * @param [properties] Properties to set @@ -17285,6 +17526,7 @@ export namespace google { BOOL = 1, INT64 = 2, FLOAT64 = 3, + FLOAT32 = 15, TIMESTAMP = 4, DATE = 5, STRING = 6, @@ -17292,7 +17534,9 @@ export namespace google { ARRAY = 8, STRUCT = 9, NUMERIC = 10, - JSON = 11 + JSON = 11, + PROTO = 13, + ENUM = 14 } /** TypeAnnotationCode enum. */ @@ -20518,6 +20762,9 @@ export namespace google { /** CommitRequest returnCommitStats */ returnCommitStats?: (boolean|null); + /** CommitRequest maxCommitDelay */ + maxCommitDelay?: (google.protobuf.IDuration|null); + /** CommitRequest requestOptions */ requestOptions?: (google.spanner.v1.IRequestOptions|null); } @@ -20546,6 +20793,9 @@ export namespace google { /** CommitRequest returnCommitStats. */ public returnCommitStats: boolean; + /** CommitRequest maxCommitDelay. */ + public maxCommitDelay?: (google.protobuf.IDuration|null); + /** CommitRequest requestOptions. */ public requestOptions?: (google.spanner.v1.IRequestOptions|null); @@ -21065,7 +21315,8 @@ export namespace google { INPUT_ONLY = 4, IMMUTABLE = 5, UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7 + NON_EMPTY_DEFAULT = 7, + IDENTIFIER = 8 } /** Properties of a ResourceDescriptor. */ @@ -22917,6 +23168,9 @@ export namespace google { /** MethodSettings longRunning */ longRunning?: (google.api.MethodSettings.ILongRunning|null); + + /** MethodSettings autoPopulatedFields */ + autoPopulatedFields?: (string[]|null); } /** Represents a MethodSettings. */ @@ -22934,6 +23188,9 @@ export namespace google { /** MethodSettings longRunning. */ public longRunning?: (google.api.MethodSettings.ILongRunning|null); + /** MethodSettings autoPopulatedFields. */ + public autoPopulatedFields: string[]; + /** * Creates a new MethodSettings instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index f2790bb77..ccb5e2ed9 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -513,6 +513,38 @@ return FileDescriptorSet; })(); + /** + * Edition enum. + * @name google.protobuf.Edition + * @enum {number} + * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value + * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value + * @property {number} EDITION_2023=1000 EDITION_2023 value + * @property {number} EDITION_2024=1001 EDITION_2024 value + * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value + * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value + * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value + * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value + * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value + * @property {number} EDITION_MAX=2147483647 EDITION_MAX value + */ + protobuf.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[998] = "EDITION_PROTO2"] = 998; + values[valuesById[999] = "EDITION_PROTO3"] = 999; + values[valuesById[1000] = "EDITION_2023"] = 1000; + values[valuesById[1001] = "EDITION_2024"] = 1001; + values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; + values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; + values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; + values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; + values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; + values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; + return values; + })(); + protobuf.FileDescriptorProto = (function() { /** @@ -531,7 +563,7 @@ * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo * @property {string|null} [syntax] FileDescriptorProto syntax - * @property {string|null} [edition] FileDescriptorProto edition + * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition */ /** @@ -654,11 +686,11 @@ /** * FileDescriptorProto edition. - * @member {string} edition + * @member {google.protobuf.Edition} edition * @memberof google.protobuf.FileDescriptorProto * @instance */ - FileDescriptorProto.prototype.edition = ""; + FileDescriptorProto.prototype.edition = 0; /** * Creates a new FileDescriptorProto instance using the specified properties. @@ -716,7 +748,7 @@ if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); return writer; }; @@ -823,8 +855,8 @@ message.syntax = reader.string(); break; } - case 13: { - message.edition = reader.string(); + case 14: { + message.edition = reader.int32(); break; } default: @@ -939,8 +971,22 @@ if (!$util.isString(message.syntax)) return "syntax: string expected"; if (message.edition != null && message.hasOwnProperty("edition")) - if (!$util.isString(message.edition)) - return "edition: string expected"; + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } return null; }; @@ -1033,8 +1079,58 @@ } if (object.syntax != null) message.syntax = String(object.syntax); - if (object.edition != null) - message.edition = String(object.edition); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } return message; }; @@ -1066,7 +1162,7 @@ object.options = null; object.sourceCodeInfo = null; object.syntax = ""; - object.edition = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1114,7 +1210,7 @@ if (message.syntax != null && message.hasOwnProperty("syntax")) object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = message.edition; + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; return object; }; @@ -3153,8 +3249,8 @@ default: return "label: enum value expected"; case 1: - case 2: case 3: + case 2: break; } if (message.type != null && message.hasOwnProperty("type")) @@ -3234,14 +3330,14 @@ case 1: message.label = 1; break; - case "LABEL_REQUIRED": - case 2: - message.label = 2; - break; case "LABEL_REPEATED": case 3: message.label = 3; break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; } switch (object.type) { default: @@ -3471,14 +3567,14 @@ * @name google.protobuf.FieldDescriptorProto.Label * @enum {number} * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value - * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value */ FieldDescriptorProto.Label = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[1] = "LABEL_OPTIONAL"] = 1; - values[valuesById[2] = "LABEL_REQUIRED"] = 2; values[valuesById[3] = "LABEL_REPEATED"] = 3; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; return values; })(); @@ -5177,7 +5273,6 @@ * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices - * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices * @property {boolean|null} [deprecated] FileOptions deprecated * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix @@ -5289,14 +5384,6 @@ */ FileOptions.prototype.pyGenericServices = false; - /** - * FileOptions phpGenericServices. - * @member {boolean} phpGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpGenericServices = false; - /** * FileOptions deprecated. * @member {boolean} deprecated @@ -5451,8 +5538,6 @@ writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) - writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) @@ -5539,10 +5624,6 @@ message.pyGenericServices = reader.bool(); break; } - case 42: { - message.phpGenericServices = reader.bool(); - break; - } case 23: { message.deprecated = reader.bool(); break; @@ -5666,9 +5747,6 @@ if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) if (typeof message.pyGenericServices !== "boolean") return "pyGenericServices: boolean expected"; - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) - if (typeof message.phpGenericServices !== "boolean") - return "phpGenericServices: boolean expected"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -5772,8 +5850,6 @@ message.javaGenericServices = Boolean(object.javaGenericServices); if (object.pyGenericServices != null) message.pyGenericServices = Boolean(object.pyGenericServices); - if (object.phpGenericServices != null) - message.phpGenericServices = Boolean(object.phpGenericServices); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.ccEnableArenas != null) @@ -5855,7 +5931,6 @@ object.swiftPrefix = ""; object.phpClassPrefix = ""; object.phpNamespace = ""; - object.phpGenericServices = false; object.phpMetadataNamespace = ""; object.rubyPackage = ""; object.features = null; @@ -5894,8 +5969,6 @@ object.phpClassPrefix = message.phpClassPrefix; if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) object.phpNamespace = message.phpNamespace; - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) - object.phpGenericServices = message.phpGenericServices; if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) object.phpMetadataNamespace = message.phpMetadataNamespace; if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) @@ -6830,6 +6903,7 @@ case 5: case 6: case 7: + case 8: break; } } @@ -7046,6 +7120,10 @@ case 7: message[".google.api.fieldBehavior"][i] = 7; break; + case "IDENTIFIER": + case 8: + message[".google.api.fieldBehavior"][i] = 8; + break; } } if (object[".google.api.resourceReference"] != null) { @@ -7243,7 +7321,7 @@ * Properties of an EditionDefault. * @memberof google.protobuf.FieldOptions * @interface IEditionDefault - * @property {string|null} [edition] EditionDefault edition + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition * @property {string|null} [value] EditionDefault value */ @@ -7264,11 +7342,11 @@ /** * EditionDefault edition. - * @member {string} edition + * @member {google.protobuf.Edition} edition * @memberof google.protobuf.FieldOptions.EditionDefault * @instance */ - EditionDefault.prototype.edition = ""; + EditionDefault.prototype.edition = 0; /** * EditionDefault value. @@ -7302,10 +7380,10 @@ EditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.edition); if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); return writer; }; @@ -7340,8 +7418,8 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - message.edition = reader.string(); + case 3: { + message.edition = reader.int32(); break; } case 2: { @@ -7384,8 +7462,22 @@ if (typeof message !== "object" || message === null) return "object expected"; if (message.edition != null && message.hasOwnProperty("edition")) - if (!$util.isString(message.edition)) - return "edition: string expected"; + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } if (message.value != null && message.hasOwnProperty("value")) if (!$util.isString(message.value)) return "value: string expected"; @@ -7404,8 +7496,58 @@ if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) return object; var message = new $root.google.protobuf.FieldOptions.EditionDefault(); - if (object.edition != null) - message.edition = String(object.edition); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } if (object.value != null) message.value = String(object.value); return message; @@ -7425,13 +7567,13 @@ options = {}; var object = {}; if (options.defaults) { - object.edition = ""; object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = message.edition; if (message.value != null && message.hasOwnProperty("value")) object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; return object; }; @@ -9739,10 +9881,9 @@ * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding - * @property {google.protobuf.FeatureSet.StringFieldValidation|null} [stringFieldValidation] FeatureSet stringFieldValidation + * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat - * @property {google.protobuf.IFeatureSet|null} [rawFeatures] FeatureSet rawFeatures */ /** @@ -9785,12 +9926,12 @@ FeatureSet.prototype.repeatedFieldEncoding = 0; /** - * FeatureSet stringFieldValidation. - * @member {google.protobuf.FeatureSet.StringFieldValidation} stringFieldValidation + * FeatureSet utf8Validation. + * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation * @memberof google.protobuf.FeatureSet * @instance */ - FeatureSet.prototype.stringFieldValidation = 0; + FeatureSet.prototype.utf8Validation = 0; /** * FeatureSet messageEncoding. @@ -9808,14 +9949,6 @@ */ FeatureSet.prototype.jsonFormat = 0; - /** - * FeatureSet rawFeatures. - * @member {google.protobuf.IFeatureSet|null|undefined} rawFeatures - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.rawFeatures = null; - /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -9846,14 +9979,12 @@ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); - if (message.stringFieldValidation != null && Object.hasOwnProperty.call(message, "stringFieldValidation")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.stringFieldValidation); + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); - if (message.rawFeatures != null && Object.hasOwnProperty.call(message, "rawFeatures")) - $root.google.protobuf.FeatureSet.encode(message.rawFeatures, writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); return writer; }; @@ -9901,7 +10032,7 @@ break; } case 4: { - message.stringFieldValidation = reader.int32(); + message.utf8Validation = reader.int32(); break; } case 5: { @@ -9912,10 +10043,6 @@ message.jsonFormat = reader.int32(); break; } - case 999: { - message.rawFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } default: reader.skipType(tag & 7); break; @@ -9979,12 +10106,11 @@ case 2: break; } - if (message.stringFieldValidation != null && message.hasOwnProperty("stringFieldValidation")) - switch (message.stringFieldValidation) { + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + switch (message.utf8Validation) { default: - return "stringFieldValidation: enum value expected"; + return "utf8Validation: enum value expected"; case 0: - case 1: case 2: case 3: break; @@ -10007,11 +10133,6 @@ case 2: break; } - if (message.rawFeatures != null && message.hasOwnProperty("rawFeatures")) { - var error = $root.google.protobuf.FeatureSet.verify(message.rawFeatures); - if (error) - return "rawFeatures." + error; - } return null; }; @@ -10091,28 +10212,24 @@ message.repeatedFieldEncoding = 2; break; } - switch (object.stringFieldValidation) { + switch (object.utf8Validation) { default: - if (typeof object.stringFieldValidation === "number") { - message.stringFieldValidation = object.stringFieldValidation; + if (typeof object.utf8Validation === "number") { + message.utf8Validation = object.utf8Validation; break; } break; - case "STRING_FIELD_VALIDATION_UNKNOWN": + case "UTF8_VALIDATION_UNKNOWN": case 0: - message.stringFieldValidation = 0; + message.utf8Validation = 0; break; - case "MANDATORY": - case 1: - message.stringFieldValidation = 1; - break; - case "HINT": + case "VERIFY": case 2: - message.stringFieldValidation = 2; + message.utf8Validation = 2; break; case "NONE": case 3: - message.stringFieldValidation = 3; + message.utf8Validation = 3; break; } switch (object.messageEncoding) { @@ -10155,11 +10272,6 @@ message.jsonFormat = 2; break; } - if (object.rawFeatures != null) { - if (typeof object.rawFeatures !== "object") - throw TypeError(".google.protobuf.FeatureSet.rawFeatures: object expected"); - message.rawFeatures = $root.google.protobuf.FeatureSet.fromObject(object.rawFeatures); - } return message; }; @@ -10180,10 +10292,9 @@ object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; - object.stringFieldValidation = options.enums === String ? "STRING_FIELD_VALIDATION_UNKNOWN" : 0; + object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; - object.rawFeatures = null; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -10191,14 +10302,12 @@ object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; - if (message.stringFieldValidation != null && message.hasOwnProperty("stringFieldValidation")) - object.stringFieldValidation = options.enums === String ? $root.google.protobuf.FeatureSet.StringFieldValidation[message.stringFieldValidation] === undefined ? message.stringFieldValidation : $root.google.protobuf.FeatureSet.StringFieldValidation[message.stringFieldValidation] : message.stringFieldValidation; + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; - if (message.rawFeatures != null && message.hasOwnProperty("rawFeatures")) - object.rawFeatures = $root.google.protobuf.FeatureSet.toObject(message.rawFeatures, options); return object; }; @@ -10279,19 +10388,17 @@ })(); /** - * StringFieldValidation enum. - * @name google.protobuf.FeatureSet.StringFieldValidation + * Utf8Validation enum. + * @name google.protobuf.FeatureSet.Utf8Validation * @enum {number} - * @property {number} STRING_FIELD_VALIDATION_UNKNOWN=0 STRING_FIELD_VALIDATION_UNKNOWN value - * @property {number} MANDATORY=1 MANDATORY value - * @property {number} HINT=2 HINT value + * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value + * @property {number} VERIFY=2 VERIFY value * @property {number} NONE=3 NONE value */ - FeatureSet.StringFieldValidation = (function() { + FeatureSet.Utf8Validation = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STRING_FIELD_VALIDATION_UNKNOWN"] = 0; - values[valuesById[1] = "MANDATORY"] = 1; - values[valuesById[2] = "HINT"] = 2; + values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; + values[valuesById[2] = "VERIFY"] = 2; values[valuesById[3] = "NONE"] = 3; return values; })(); @@ -10331,6 +10438,702 @@ return FeatureSet; })(); + protobuf.FeatureSetDefaults = (function() { + + /** + * Properties of a FeatureSetDefaults. + * @memberof google.protobuf + * @interface IFeatureSetDefaults + * @property {Array.|null} [defaults] FeatureSetDefaults defaults + * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition + * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition + */ + + /** + * Constructs a new FeatureSetDefaults. + * @memberof google.protobuf + * @classdesc Represents a FeatureSetDefaults. + * @implements IFeatureSetDefaults + * @constructor + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + */ + function FeatureSetDefaults(properties) { + this.defaults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetDefaults defaults. + * @member {Array.} defaults + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.defaults = $util.emptyArray; + + /** + * FeatureSetDefaults minimumEdition. + * @member {google.protobuf.Edition} minimumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.minimumEdition = 0; + + /** + * FeatureSetDefaults maximumEdition. + * @member {google.protobuf.Edition} maximumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.maximumEdition = 0; + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance + */ + FeatureSetDefaults.create = function create(properties) { + return new FeatureSetDefaults(properties); + }; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.defaults != null && message.defaults.length) + for (var i = 0; i < message.defaults.length; ++i) + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); + return writer; + }; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.defaults && message.defaults.length)) + message.defaults = []; + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); + break; + } + case 4: { + message.minimumEdition = reader.int32(); + break; + } + case 5: { + message.maximumEdition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetDefaults message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetDefaults.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.defaults != null && message.hasOwnProperty("defaults")) { + if (!Array.isArray(message.defaults)) + return "defaults: array expected"; + for (var i = 0; i < message.defaults.length; ++i) { + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); + if (error) + return "defaults." + error; + } + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + switch (message.minimumEdition) { + default: + return "minimumEdition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + switch (message.maximumEdition) { + default: + return "maximumEdition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + */ + FeatureSetDefaults.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults(); + if (object.defaults) { + if (!Array.isArray(object.defaults)) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); + message.defaults = []; + for (var i = 0; i < object.defaults.length; ++i) { + if (typeof object.defaults[i] !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); + } + } + switch (object.minimumEdition) { + default: + if (typeof object.minimumEdition === "number") { + message.minimumEdition = object.minimumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.minimumEdition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.minimumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.minimumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.minimumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.minimumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.minimumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.minimumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.minimumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.minimumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.minimumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.minimumEdition = 2147483647; + break; + } + switch (object.maximumEdition) { + default: + if (typeof object.maximumEdition === "number") { + message.maximumEdition = object.maximumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.maximumEdition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.maximumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.maximumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.maximumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.maximumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.maximumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.maximumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.maximumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.maximumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.maximumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.maximumEdition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetDefaults.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.defaults = []; + if (options.defaults) { + object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.defaults && message.defaults.length) { + object.defaults = []; + for (var j = 0; j < message.defaults.length; ++j) + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; + return object; + }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults + * @instance + * @returns {Object.} JSON object + */ + FeatureSetDefaults.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetDefaults + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; + }; + + FeatureSetDefaults.FeatureSetEditionDefault = (function() { + + /** + * Properties of a FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @interface IFeatureSetEditionDefault + * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition + * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + */ + + /** + * Constructs a new FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @classdesc Represents a FeatureSetEditionDefault. + * @implements IFeatureSetEditionDefault + * @constructor + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + */ + function FeatureSetEditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetEditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.edition = 0; + + /** + * FeatureSetEditionDefault features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.features = null; + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance + */ + FeatureSetEditionDefault.create = function create(properties) { + return new FeatureSetEditionDefault(properties); + }; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetEditionDefault message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetEditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + return null; + }; + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + */ + FeatureSetEditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetEditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.features = null; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + * @returns {Object.} JSON object + */ + FeatureSetEditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; + }; + + return FeatureSetEditionDefault; + })(); + + return FeatureSetDefaults; + })(); + protobuf.SourceCodeInfo = (function() { /** @@ -23943,6 +24746,7 @@ * @property {Array.|null} [extraStatements] CreateDatabaseRequest extraStatements * @property {google.spanner.admin.database.v1.IEncryptionConfig|null} [encryptionConfig] CreateDatabaseRequest encryptionConfig * @property {google.spanner.admin.database.v1.DatabaseDialect|null} [databaseDialect] CreateDatabaseRequest databaseDialect + * @property {Uint8Array|null} [protoDescriptors] CreateDatabaseRequest protoDescriptors */ /** @@ -24001,6 +24805,14 @@ */ CreateDatabaseRequest.prototype.databaseDialect = 0; + /** + * CreateDatabaseRequest protoDescriptors. + * @member {Uint8Array} protoDescriptors + * @memberof google.spanner.admin.database.v1.CreateDatabaseRequest + * @instance + */ + CreateDatabaseRequest.prototype.protoDescriptors = $util.newBuffer([]); + /** * Creates a new CreateDatabaseRequest instance using the specified properties. * @function create @@ -24036,6 +24848,8 @@ $root.google.spanner.admin.database.v1.EncryptionConfig.encode(message.encryptionConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.databaseDialect != null && Object.hasOwnProperty.call(message, "databaseDialect")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.databaseDialect); + if (message.protoDescriptors != null && Object.hasOwnProperty.call(message, "protoDescriptors")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.protoDescriptors); return writer; }; @@ -24092,6 +24906,10 @@ message.databaseDialect = reader.int32(); break; } + case 6: { + message.protoDescriptors = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -24154,6 +24972,9 @@ case 2: break; } + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + if (!(message.protoDescriptors && typeof message.protoDescriptors.length === "number" || $util.isString(message.protoDescriptors))) + return "protoDescriptors: buffer expected"; return null; }; @@ -24205,6 +25026,11 @@ message.databaseDialect = 2; break; } + if (object.protoDescriptors != null) + if (typeof object.protoDescriptors === "string") + $util.base64.decode(object.protoDescriptors, message.protoDescriptors = $util.newBuffer($util.base64.length(object.protoDescriptors)), 0); + else if (object.protoDescriptors.length >= 0) + message.protoDescriptors = object.protoDescriptors; return message; }; @@ -24228,6 +25054,13 @@ object.createStatement = ""; object.encryptionConfig = null; object.databaseDialect = options.enums === String ? "DATABASE_DIALECT_UNSPECIFIED" : 0; + if (options.bytes === String) + object.protoDescriptors = ""; + else { + object.protoDescriptors = []; + if (options.bytes !== Array) + object.protoDescriptors = $util.newBuffer(object.protoDescriptors); + } } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -24242,6 +25075,8 @@ object.encryptionConfig = $root.google.spanner.admin.database.v1.EncryptionConfig.toObject(message.encryptionConfig, options); if (message.databaseDialect != null && message.hasOwnProperty("databaseDialect")) object.databaseDialect = options.enums === String ? $root.google.spanner.admin.database.v1.DatabaseDialect[message.databaseDialect] === undefined ? message.databaseDialect : $root.google.spanner.admin.database.v1.DatabaseDialect[message.databaseDialect] : message.databaseDialect; + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + object.protoDescriptors = options.bytes === String ? $util.base64.encode(message.protoDescriptors, 0, message.protoDescriptors.length) : options.bytes === Array ? Array.prototype.slice.call(message.protoDescriptors) : message.protoDescriptors; return object; }; @@ -25191,6 +26026,7 @@ * @property {string|null} [database] UpdateDatabaseDdlRequest database * @property {Array.|null} [statements] UpdateDatabaseDdlRequest statements * @property {string|null} [operationId] UpdateDatabaseDdlRequest operationId + * @property {Uint8Array|null} [protoDescriptors] UpdateDatabaseDdlRequest protoDescriptors */ /** @@ -25233,6 +26069,14 @@ */ UpdateDatabaseDdlRequest.prototype.operationId = ""; + /** + * UpdateDatabaseDdlRequest protoDescriptors. + * @member {Uint8Array} protoDescriptors + * @memberof google.spanner.admin.database.v1.UpdateDatabaseDdlRequest + * @instance + */ + UpdateDatabaseDdlRequest.prototype.protoDescriptors = $util.newBuffer([]); + /** * Creates a new UpdateDatabaseDdlRequest instance using the specified properties. * @function create @@ -25264,6 +26108,8 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.statements[i]); if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.operationId); + if (message.protoDescriptors != null && Object.hasOwnProperty.call(message, "protoDescriptors")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.protoDescriptors); return writer; }; @@ -25312,6 +26158,10 @@ message.operationId = reader.string(); break; } + case 4: { + message.protoDescriptors = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -25360,6 +26210,9 @@ if (message.operationId != null && message.hasOwnProperty("operationId")) if (!$util.isString(message.operationId)) return "operationId: string expected"; + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + if (!(message.protoDescriptors && typeof message.protoDescriptors.length === "number" || $util.isString(message.protoDescriptors))) + return "protoDescriptors: buffer expected"; return null; }; @@ -25386,6 +26239,11 @@ } if (object.operationId != null) message.operationId = String(object.operationId); + if (object.protoDescriptors != null) + if (typeof object.protoDescriptors === "string") + $util.base64.decode(object.protoDescriptors, message.protoDescriptors = $util.newBuffer($util.base64.length(object.protoDescriptors)), 0); + else if (object.protoDescriptors.length >= 0) + message.protoDescriptors = object.protoDescriptors; return message; }; @@ -25407,6 +26265,13 @@ if (options.defaults) { object.database = ""; object.operationId = ""; + if (options.bytes === String) + object.protoDescriptors = ""; + else { + object.protoDescriptors = []; + if (options.bytes !== Array) + object.protoDescriptors = $util.newBuffer(object.protoDescriptors); + } } if (message.database != null && message.hasOwnProperty("database")) object.database = message.database; @@ -25417,6 +26282,8 @@ } if (message.operationId != null && message.hasOwnProperty("operationId")) object.operationId = message.operationId; + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + object.protoDescriptors = options.bytes === String ? $util.base64.encode(message.protoDescriptors, 0, message.protoDescriptors.length) : options.bytes === Array ? Array.prototype.slice.call(message.protoDescriptors) : message.protoDescriptors; return object; }; @@ -26529,6 +27396,7 @@ * @memberof google.spanner.admin.database.v1 * @interface IGetDatabaseDdlResponse * @property {Array.|null} [statements] GetDatabaseDdlResponse statements + * @property {Uint8Array|null} [protoDescriptors] GetDatabaseDdlResponse protoDescriptors */ /** @@ -26555,6 +27423,14 @@ */ GetDatabaseDdlResponse.prototype.statements = $util.emptyArray; + /** + * GetDatabaseDdlResponse protoDescriptors. + * @member {Uint8Array} protoDescriptors + * @memberof google.spanner.admin.database.v1.GetDatabaseDdlResponse + * @instance + */ + GetDatabaseDdlResponse.prototype.protoDescriptors = $util.newBuffer([]); + /** * Creates a new GetDatabaseDdlResponse instance using the specified properties. * @function create @@ -26582,6 +27458,8 @@ if (message.statements != null && message.statements.length) for (var i = 0; i < message.statements.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.statements[i]); + if (message.protoDescriptors != null && Object.hasOwnProperty.call(message, "protoDescriptors")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.protoDescriptors); return writer; }; @@ -26622,6 +27500,10 @@ message.statements.push(reader.string()); break; } + case 2: { + message.protoDescriptors = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -26664,6 +27546,9 @@ if (!$util.isString(message.statements[i])) return "statements: string[] expected"; } + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + if (!(message.protoDescriptors && typeof message.protoDescriptors.length === "number" || $util.isString(message.protoDescriptors))) + return "protoDescriptors: buffer expected"; return null; }; @@ -26686,6 +27571,11 @@ for (var i = 0; i < object.statements.length; ++i) message.statements[i] = String(object.statements[i]); } + if (object.protoDescriptors != null) + if (typeof object.protoDescriptors === "string") + $util.base64.decode(object.protoDescriptors, message.protoDescriptors = $util.newBuffer($util.base64.length(object.protoDescriptors)), 0); + else if (object.protoDescriptors.length >= 0) + message.protoDescriptors = object.protoDescriptors; return message; }; @@ -26704,11 +27594,21 @@ var object = {}; if (options.arrays || options.defaults) object.statements = []; + if (options.defaults) + if (options.bytes === String) + object.protoDescriptors = ""; + else { + object.protoDescriptors = []; + if (options.bytes !== Array) + object.protoDescriptors = $util.newBuffer(object.protoDescriptors); + } if (message.statements && message.statements.length) { object.statements = []; for (var j = 0; j < message.statements.length; ++j) object.statements[j] = message.statements[j]; } + if (message.protoDescriptors != null && message.hasOwnProperty("protoDescriptors")) + object.protoDescriptors = options.bytes === String ? $util.base64.encode(message.protoDescriptors, 0, message.protoDescriptors.length) : options.bytes === Array ? Array.prototype.slice.call(message.protoDescriptors) : message.protoDescriptors; return object; }; @@ -42743,6 +43643,7 @@ * @property {google.spanner.v1.IType|null} [arrayElementType] Type arrayElementType * @property {google.spanner.v1.IStructType|null} [structType] Type structType * @property {google.spanner.v1.TypeAnnotationCode|null} [typeAnnotation] Type typeAnnotation + * @property {string|null} [protoTypeFqn] Type protoTypeFqn */ /** @@ -42792,6 +43693,14 @@ */ Type.prototype.typeAnnotation = 0; + /** + * Type protoTypeFqn. + * @member {string} protoTypeFqn + * @memberof google.spanner.v1.Type + * @instance + */ + Type.prototype.protoTypeFqn = ""; + /** * Creates a new Type instance using the specified properties. * @function create @@ -42824,6 +43733,8 @@ $root.google.spanner.v1.StructType.encode(message.structType, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.typeAnnotation != null && Object.hasOwnProperty.call(message, "typeAnnotation")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.typeAnnotation); + if (message.protoTypeFqn != null && Object.hasOwnProperty.call(message, "protoTypeFqn")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.protoTypeFqn); return writer; }; @@ -42874,6 +43785,10 @@ message.typeAnnotation = reader.int32(); break; } + case 5: { + message.protoTypeFqn = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42917,6 +43832,7 @@ case 1: case 2: case 3: + case 15: case 4: case 5: case 6: @@ -42925,6 +43841,8 @@ case 9: case 10: case 11: + case 13: + case 14: break; } if (message.arrayElementType != null && message.hasOwnProperty("arrayElementType")) { @@ -42947,6 +43865,9 @@ case 4: break; } + if (message.protoTypeFqn != null && message.hasOwnProperty("protoTypeFqn")) + if (!$util.isString(message.protoTypeFqn)) + return "protoTypeFqn: string expected"; return null; }; @@ -42985,6 +43906,10 @@ case 3: message.code = 3; break; + case "FLOAT32": + case 15: + message.code = 15; + break; case "TIMESTAMP": case 4: message.code = 4; @@ -43017,6 +43942,14 @@ case 11: message.code = 11; break; + case "PROTO": + case 13: + message.code = 13; + break; + case "ENUM": + case 14: + message.code = 14; + break; } if (object.arrayElementType != null) { if (typeof object.arrayElementType !== "object") @@ -43052,6 +43985,8 @@ message.typeAnnotation = 4; break; } + if (object.protoTypeFqn != null) + message.protoTypeFqn = String(object.protoTypeFqn); return message; }; @@ -43073,6 +44008,7 @@ object.arrayElementType = null; object.structType = null; object.typeAnnotation = options.enums === String ? "TYPE_ANNOTATION_CODE_UNSPECIFIED" : 0; + object.protoTypeFqn = ""; } if (message.code != null && message.hasOwnProperty("code")) object.code = options.enums === String ? $root.google.spanner.v1.TypeCode[message.code] === undefined ? message.code : $root.google.spanner.v1.TypeCode[message.code] : message.code; @@ -43082,6 +44018,8 @@ object.structType = $root.google.spanner.v1.StructType.toObject(message.structType, options); if (message.typeAnnotation != null && message.hasOwnProperty("typeAnnotation")) object.typeAnnotation = options.enums === String ? $root.google.spanner.v1.TypeAnnotationCode[message.typeAnnotation] === undefined ? message.typeAnnotation : $root.google.spanner.v1.TypeAnnotationCode[message.typeAnnotation] : message.typeAnnotation; + if (message.protoTypeFqn != null && message.hasOwnProperty("protoTypeFqn")) + object.protoTypeFqn = message.protoTypeFqn; return object; }; @@ -43578,6 +44516,7 @@ * @property {number} BOOL=1 BOOL value * @property {number} INT64=2 INT64 value * @property {number} FLOAT64=3 FLOAT64 value + * @property {number} FLOAT32=15 FLOAT32 value * @property {number} TIMESTAMP=4 TIMESTAMP value * @property {number} DATE=5 DATE value * @property {number} STRING=6 STRING value @@ -43586,6 +44525,8 @@ * @property {number} STRUCT=9 STRUCT value * @property {number} NUMERIC=10 NUMERIC value * @property {number} JSON=11 JSON value + * @property {number} PROTO=13 PROTO value + * @property {number} ENUM=14 ENUM value */ v1.TypeCode = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -43593,6 +44534,7 @@ values[valuesById[1] = "BOOL"] = 1; values[valuesById[2] = "INT64"] = 2; values[valuesById[3] = "FLOAT64"] = 3; + values[valuesById[15] = "FLOAT32"] = 15; values[valuesById[4] = "TIMESTAMP"] = 4; values[valuesById[5] = "DATE"] = 5; values[valuesById[6] = "STRING"] = 6; @@ -43601,6 +44543,8 @@ values[valuesById[9] = "STRUCT"] = 9; values[valuesById[10] = "NUMERIC"] = 10; values[valuesById[11] = "JSON"] = 11; + values[valuesById[13] = "PROTO"] = 13; + values[valuesById[14] = "ENUM"] = 14; return values; })(); @@ -51471,6 +52415,7 @@ * @property {google.spanner.v1.ITransactionOptions|null} [singleUseTransaction] CommitRequest singleUseTransaction * @property {Array.|null} [mutations] CommitRequest mutations * @property {boolean|null} [returnCommitStats] CommitRequest returnCommitStats + * @property {google.protobuf.IDuration|null} [maxCommitDelay] CommitRequest maxCommitDelay * @property {google.spanner.v1.IRequestOptions|null} [requestOptions] CommitRequest requestOptions */ @@ -51530,6 +52475,14 @@ */ CommitRequest.prototype.returnCommitStats = false; + /** + * CommitRequest maxCommitDelay. + * @member {google.protobuf.IDuration|null|undefined} maxCommitDelay + * @memberof google.spanner.v1.CommitRequest + * @instance + */ + CommitRequest.prototype.maxCommitDelay = null; + /** * CommitRequest requestOptions. * @member {google.spanner.v1.IRequestOptions|null|undefined} requestOptions @@ -51589,6 +52542,8 @@ writer.uint32(/* id 5, wireType 0 =*/40).bool(message.returnCommitStats); if (message.requestOptions != null && Object.hasOwnProperty.call(message, "requestOptions")) $root.google.spanner.v1.RequestOptions.encode(message.requestOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.maxCommitDelay != null && Object.hasOwnProperty.call(message, "maxCommitDelay")) + $root.google.protobuf.Duration.encode(message.maxCommitDelay, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -51645,6 +52600,10 @@ message.returnCommitStats = reader.bool(); break; } + case 8: { + message.maxCommitDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } case 6: { message.requestOptions = $root.google.spanner.v1.RequestOptions.decode(reader, reader.uint32()); break; @@ -51715,6 +52674,11 @@ if (message.returnCommitStats != null && message.hasOwnProperty("returnCommitStats")) if (typeof message.returnCommitStats !== "boolean") return "returnCommitStats: boolean expected"; + if (message.maxCommitDelay != null && message.hasOwnProperty("maxCommitDelay")) { + var error = $root.google.protobuf.Duration.verify(message.maxCommitDelay); + if (error) + return "maxCommitDelay." + error; + } if (message.requestOptions != null && message.hasOwnProperty("requestOptions")) { var error = $root.google.spanner.v1.RequestOptions.verify(message.requestOptions); if (error) @@ -51759,6 +52723,11 @@ } if (object.returnCommitStats != null) message.returnCommitStats = Boolean(object.returnCommitStats); + if (object.maxCommitDelay != null) { + if (typeof object.maxCommitDelay !== "object") + throw TypeError(".google.spanner.v1.CommitRequest.maxCommitDelay: object expected"); + message.maxCommitDelay = $root.google.protobuf.Duration.fromObject(object.maxCommitDelay); + } if (object.requestOptions != null) { if (typeof object.requestOptions !== "object") throw TypeError(".google.spanner.v1.CommitRequest.requestOptions: object expected"); @@ -51786,6 +52755,7 @@ object.session = ""; object.returnCommitStats = false; object.requestOptions = null; + object.maxCommitDelay = null; } if (message.session != null && message.hasOwnProperty("session")) object.session = message.session; @@ -51808,6 +52778,8 @@ object.returnCommitStats = message.returnCommitStats; if (message.requestOptions != null && message.hasOwnProperty("requestOptions")) object.requestOptions = $root.google.spanner.v1.RequestOptions.toObject(message.requestOptions, options); + if (message.maxCommitDelay != null && message.hasOwnProperty("maxCommitDelay")) + object.maxCommitDelay = $root.google.protobuf.Duration.toObject(message.maxCommitDelay, options); return object; }; @@ -52889,6 +53861,7 @@ * @property {number} IMMUTABLE=5 IMMUTABLE value * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + * @property {number} IDENTIFIER=8 IDENTIFIER value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -52900,6 +53873,7 @@ values[valuesById[5] = "IMMUTABLE"] = 5; values[valuesById[6] = "UNORDERED_LIST"] = 6; values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + values[valuesById[8] = "IDENTIFIER"] = 8; return values; })(); @@ -57859,6 +58833,7 @@ * @interface IMethodSettings * @property {string|null} [selector] MethodSettings selector * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning + * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields */ /** @@ -57870,6 +58845,7 @@ * @param {google.api.IMethodSettings=} [properties] Properties to set */ function MethodSettings(properties) { + this.autoPopulatedFields = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -57892,6 +58868,14 @@ */ MethodSettings.prototype.longRunning = null; + /** + * MethodSettings autoPopulatedFields. + * @member {Array.} autoPopulatedFields + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + /** * Creates a new MethodSettings instance using the specified properties. * @function create @@ -57920,6 +58904,9 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); return writer; }; @@ -57962,6 +58949,12 @@ message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); break; } + case 3: { + if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) + message.autoPopulatedFields = []; + message.autoPopulatedFields.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -58005,6 +58998,13 @@ if (error) return "longRunning." + error; } + if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { + if (!Array.isArray(message.autoPopulatedFields)) + return "autoPopulatedFields: array expected"; + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + if (!$util.isString(message.autoPopulatedFields[i])) + return "autoPopulatedFields: string[] expected"; + } return null; }; @@ -58027,6 +59027,13 @@ throw TypeError(".google.api.MethodSettings.longRunning: object expected"); message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); } + if (object.autoPopulatedFields) { + if (!Array.isArray(object.autoPopulatedFields)) + throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); + message.autoPopulatedFields = []; + for (var i = 0; i < object.autoPopulatedFields.length; ++i) + message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); + } return message; }; @@ -58043,6 +59050,8 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.autoPopulatedFields = []; if (options.defaults) { object.selector = ""; object.longRunning = null; @@ -58051,6 +59060,11 @@ object.selector = message.selector; if (message.longRunning != null && message.hasOwnProperty("longRunning")) object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); + if (message.autoPopulatedFields && message.autoPopulatedFields.length) { + object.autoPopulatedFields = []; + for (var j = 0; j < message.autoPopulatedFields.length; ++j) + object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; + } return object; }; diff --git a/protos/protos.json b/protos/protos.json index 64a1319ec..2cb1eb44e 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -34,6 +34,21 @@ } } }, + "Edition": { + "values": { + "EDITION_UNKNOWN": 0, + "EDITION_PROTO2": 998, + "EDITION_PROTO3": 999, + "EDITION_2023": 1000, + "EDITION_2024": 1001, + "EDITION_1_TEST_ONLY": 1, + "EDITION_2_TEST_ONLY": 2, + "EDITION_99997_TEST_ONLY": 99997, + "EDITION_99998_TEST_ONLY": 99998, + "EDITION_99999_TEST_ONLY": 99999, + "EDITION_MAX": 2147483647 + } + }, "FileDescriptorProto": { "fields": { "name": { @@ -98,8 +113,8 @@ "id": 12 }, "edition": { - "type": "string", - "id": 13 + "type": "Edition", + "id": 14 } } }, @@ -208,7 +223,8 @@ "type": "VerificationState", "id": 3, "options": { - "default": "UNVERIFIED" + "default": "UNVERIFIED", + "retention": "RETENTION_SOURCE" } } }, @@ -330,8 +346,8 @@ "Label": { "values": { "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3 + "LABEL_REPEATED": 3, + "LABEL_REQUIRED": 2 } } } @@ -519,13 +535,6 @@ "default": false } }, - "phpGenericServices": { - "type": "bool", - "id": 42, - "options": { - "default": false - } - }, "deprecated": { "type": "bool", "id": 23, @@ -585,6 +594,10 @@ ] ], "reserved": [ + [ + 42, + 42 + ], [ 38, 38 @@ -810,8 +823,8 @@ "EditionDefault": { "fields": { "edition": { - "type": "string", - "id": 1 + "type": "Edition", + "id": 3 }, "value": { "type": "string", @@ -1041,7 +1054,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", + "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } }, @@ -1051,7 +1064,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", + "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } }, @@ -1061,18 +1074,18 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", + "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } }, - "stringFieldValidation": { - "type": "StringFieldValidation", + "utf8Validation": { + "type": "Utf8Validation", "id": 4, "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", - "edition_defaults.value": "MANDATORY" + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "VERIFY" } }, "messageEncoding": { @@ -1081,7 +1094,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", + "edition_defaults.edition": "EDITION_PROTO2", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -1091,16 +1104,9 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "2023", + "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } - }, - "rawFeatures": { - "type": "FeatureSet", - "id": 999, - "options": { - "targets": "TARGET_TYPE_UNKNOWN" - } } }, "extensions": [ @@ -1117,6 +1123,12 @@ 9999 ] ], + "reserved": [ + [ + 999, + 999 + ] + ], "nested": { "FieldPresence": { "values": { @@ -1140,11 +1152,10 @@ "EXPANDED": 2 } }, - "StringFieldValidation": { + "Utf8Validation": { "values": { - "STRING_FIELD_VALIDATION_UNKNOWN": 0, - "MANDATORY": 1, - "HINT": 2, + "UTF8_VALIDATION_UNKNOWN": 0, + "VERIFY": 2, "NONE": 3 } }, @@ -1164,6 +1175,37 @@ } } }, + "FeatureSetDefaults": { + "fields": { + "defaults": { + "rule": "repeated", + "type": "FeatureSetEditionDefault", + "id": 1 + }, + "minimumEdition": { + "type": "Edition", + "id": 4 + }, + "maximumEdition": { + "type": "Edition", + "id": 5 + } + }, + "nested": { + "FeatureSetEditionDefault": { + "fields": { + "edition": { + "type": "Edition", + "id": 3 + }, + "features": { + "type": "FeatureSet", + "id": 2 + } + } + } + } + }, "SourceCodeInfo": { "fields": { "location": { @@ -2715,6 +2757,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "protoDescriptors": { + "type": "bytes", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -2796,6 +2845,13 @@ "operationId": { "type": "string", "id": 3 + }, + "protoDescriptors": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -2884,6 +2940,10 @@ "rule": "repeated", "type": "string", "id": 1 + }, + "protoDescriptors": { + "type": "bytes", + "id": 2 } } }, @@ -4523,6 +4583,10 @@ "typeAnnotation": { "type": "TypeAnnotationCode", "id": 4 + }, + "protoTypeFqn": { + "type": "string", + "id": 5 } } }, @@ -4555,6 +4619,7 @@ "BOOL": 1, "INT64": 2, "FLOAT64": 3, + "FLOAT32": 15, "TIMESTAMP": 4, "DATE": 5, "STRING": 6, @@ -4562,7 +4627,9 @@ "ARRAY": 8, "STRUCT": 9, "NUMERIC": 10, - "JSON": 11 + "JSON": 11, + "PROTO": 13, + "ENUM": 14 } }, "TypeAnnotationCode": { @@ -5508,6 +5575,13 @@ "type": "bool", "id": 5 }, + "maxCommitDelay": { + "type": "google.protobuf.Duration", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "requestOptions": { "type": "RequestOptions", "id": 6 @@ -5617,7 +5691,8 @@ "INPUT_ONLY": 4, "IMMUTABLE": 5, "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7 + "NON_EMPTY_DEFAULT": 7, + "IDENTIFIER": 8 } }, "resourceReference": { @@ -6018,6 +6093,11 @@ "longRunning": { "type": "LongRunning", "id": 2 + }, + "autoPopulatedFields": { + "rule": "repeated", + "type": "string", + "id": 3 } }, "nested": { diff --git a/samples/package.json b/samples/package.json index fa602eca0..d539d81ef 100644 --- a/samples/package.json +++ b/samples/package.json @@ -16,7 +16,7 @@ "dependencies": { "@google-cloud/kms": "^4.0.0", "@google-cloud/precise-date": "^4.0.0", - "@google-cloud/spanner": "^7.2.0", + "@google-cloud/spanner": "^7.3.0", "yargs": "^17.0.0" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index d2901bf71..2f2b1db3e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -316,7 +316,8 @@ class Spanner extends GrpcService { baseUrl: options.apiEndpoint || options.servicePath || - v1.SpannerClient.servicePath, + // TODO: for TPC, this needs to support universeDomain + 'spanner.googleapis.com', protosDir: path.resolve(__dirname, '../protos'), protoServices: { Operations: { diff --git a/src/transaction.ts b/src/transaction.ts index 4eb30bdda..11eb03657 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -69,6 +69,7 @@ export interface RequestOptions { export interface CommitOptions { requestOptions?: Pick; returnCommitStats?: boolean; + maxCommitDelay?: spannerClient.protobuf.IDuration; gaxOptions?: CallOptions; } @@ -979,7 +980,7 @@ export class Snapshot extends EventEmitter { * execution statistics for the SQL statement that * produced this result set. * @property {string} partitionToken The partition token. - * @property {number} seqno The Sequence number. + * @property {number} seqno The Sequence number. This option is used internally and will be overridden. * @property {string} sql The SQL string. * @property {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions] * Default query options to use with the database. These options will be @@ -1798,6 +1799,9 @@ export class Transaction extends Dml { * with the commit request. * @property {boolean} returnCommitStats Include statistics related to the * transaction in the {@link CommitResponse}. + * @property {spannerClient.proto.IDuration} maxCommitDelay Maximum amount + * of delay the commit is willing to incur in order to improve + * throughput. Value should be between 0ms and 500ms. * @property {object} [gaxOptions] The request configuration options, * See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} * for more details. @@ -1888,6 +1892,12 @@ export class Transaction extends Dml { ) { reqOpts.returnCommitStats = (options as CommitOptions).returnCommitStats; } + if ( + 'maxCommitDelay' in options && + (options as CommitOptions).maxCommitDelay + ) { + reqOpts.maxCommitDelay = (options as CommitOptions).maxCommitDelay; + } reqOpts.requestOptions = Object.assign( requestOptions || {}, this.requestOptions diff --git a/src/v1/database_admin_client.ts b/src/v1/database_admin_client.ts index 0878c545a..e2b95f901 100644 --- a/src/v1/database_admin_client.ts +++ b/src/v1/database_admin_client.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/database_admin_client_config.json`. @@ -58,6 +59,8 @@ export class DatabaseAdminClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -116,8 +119,20 @@ export class DatabaseAdminClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DatabaseAdminClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'spanner.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -132,7 +147,7 @@ export class DatabaseAdminClient { opts.numericEnums = true; // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -157,10 +172,10 @@ export class DatabaseAdminClient { this.auth.useJWTAccessWithScope = true; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -468,21 +483,52 @@ export class DatabaseAdminClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. @@ -1395,6 +1441,22 @@ export class DatabaseAdminClient { * Google default encryption. * @param {google.spanner.admin.database.v1.DatabaseDialect} [request.databaseDialect] * Optional. The dialect of the Cloud Spanner Database. + * @param {Buffer} [request.protoDescriptors] + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1727,6 +1789,21 @@ export class DatabaseAdminClient { * underscore. If the named operation already exists, * {@link protos.google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl|UpdateDatabaseDdl} returns * `ALREADY_EXISTS`. + * @param {Buffer} [request.protoDescriptors] + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/src/v1/instance_admin_client.ts b/src/v1/instance_admin_client.ts index 966a4630a..c31480793 100644 --- a/src/v1/instance_admin_client.ts +++ b/src/v1/instance_admin_client.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/instance_admin_client_config.json`. @@ -72,6 +73,8 @@ export class InstanceAdminClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -130,8 +133,20 @@ export class InstanceAdminClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InstanceAdminClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'spanner.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -146,7 +161,7 @@ export class InstanceAdminClient { opts.numericEnums = true; // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -171,10 +186,10 @@ export class InstanceAdminClient { this.auth.useJWTAccessWithScope = true; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -423,21 +438,52 @@ export class InstanceAdminClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/src/v1/spanner_client.ts b/src/v1/spanner_client.ts index 669cecadc..07dcc842d 100644 --- a/src/v1/spanner_client.ts +++ b/src/v1/spanner_client.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import type { import {Transform, PassThrough} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/spanner_client_config.json`. @@ -53,6 +54,8 @@ export class SpannerClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -110,8 +113,20 @@ export class SpannerClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SpannerClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'spanner.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SpannerClient { opts.numericEnums = true; // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -151,10 +166,10 @@ export class SpannerClient { this.auth.useJWTAccessWithScope = true; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -204,15 +219,18 @@ export class SpannerClient { this.descriptors.stream = { executeStreamingSql: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, - !!opts.fallback + !!opts.fallback, + /* gaxStreamingRetries: */ false ), streamingRead: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, - !!opts.fallback + !!opts.fallback, + /* gaxStreamingRetries: */ false ), batchWrite: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, - !!opts.fallback + !!opts.fallback, + /* gaxStreamingRetries: */ false ), }; @@ -329,21 +347,52 @@ export class SpannerClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'spanner.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. @@ -1310,6 +1359,12 @@ export class SpannerClient { * If `true`, then statistics related to the transaction will be included in * the {@link protos.google.spanner.v1.CommitResponse.commit_stats|CommitResponse}. * Default value is `false`. + * @param {google.protobuf.Duration} [request.maxCommitDelay] + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. * @param {object} [options] @@ -1499,9 +1554,10 @@ export class SpannerClient { * @param {string} request.sql * Required. The query request to generate partitions for. The request will * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, the first - * operator in the query execution plan must be a distributed union operator. - * For more information about other conditions, see [Read data in + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). * * The query request must not contain DML commands, such as INSERT, UPDATE, or diff --git a/system-test/fixtures/sample/package.json b/system-test/fixtures/sample/package.json index 8f3c02f4e..27a17bf19 100644 --- a/system-test/fixtures/sample/package.json +++ b/system-test/fixtures/sample/package.json @@ -16,7 +16,7 @@ "@google-cloud/spanner": "file:./spanner.tgz" }, "devDependencies": { - "@types/node": "^18.0.0", + "@types/node": "^20.0.0", "typescript": "^4.0.0", "gts": "^3.0.0" } diff --git a/test/gapic_database_admin_v1.ts b/test/gapic_database_admin_v1.ts index 9dea0d78b..cc1c4d8e5 100644 --- a/test/gapic_database_admin_v1.ts +++ b/test/gapic_database_admin_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -161,16 +161,62 @@ function stubAsyncIterationCall( describe('v1.DatabaseAdminClient', () => { describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - databaseadminModule.v1.DatabaseAdminClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new databaseadminModule.v1.DatabaseAdminClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - databaseadminModule.v1.DatabaseAdminClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new databaseadminModule.v1.DatabaseAdminClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + databaseadminModule.v1.DatabaseAdminClient.servicePath; + assert.strictEqual(servicePath, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + databaseadminModule.v1.DatabaseAdminClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new databaseadminModule.v1.DatabaseAdminClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/test/gapic_instance_admin_v1.ts b/test/gapic_instance_admin_v1.ts index 9e78ad37b..889f9ee0b 100644 --- a/test/gapic_instance_admin_v1.ts +++ b/test/gapic_instance_admin_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -161,16 +161,62 @@ function stubAsyncIterationCall( describe('v1.InstanceAdminClient', () => { describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - instanceadminModule.v1.InstanceAdminClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new instanceadminModule.v1.InstanceAdminClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - instanceadminModule.v1.InstanceAdminClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new instanceadminModule.v1.InstanceAdminClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + instanceadminModule.v1.InstanceAdminClient.servicePath; + assert.strictEqual(servicePath, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + instanceadminModule.v1.InstanceAdminClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new instanceadminModule.v1.InstanceAdminClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/test/gapic_spanner_v1.ts b/test/gapic_spanner_v1.ts index a545b3660..a8da50a21 100644 --- a/test/gapic_spanner_v1.ts +++ b/test/gapic_spanner_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -150,14 +150,60 @@ function stubAsyncIterationCall( describe('v1.SpannerClient', () => { describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = spannerModule.v1.SpannerClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new spannerModule.v1.SpannerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = spannerModule.v1.SpannerClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new spannerModule.v1.SpannerClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = spannerModule.v1.SpannerClient.servicePath; + assert.strictEqual(servicePath, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = spannerModule.v1.SpannerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'spanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new spannerModule.v1.SpannerClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new spannerModule.v1.SpannerClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'spanner.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new spannerModule.v1.SpannerClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/test/index.ts b/test/index.ts index 5f8df6e04..70f68857e 100644 --- a/test/index.ts +++ b/test/index.ts @@ -253,7 +253,7 @@ describe('Spanner', () => { const options = getFake(spanner).calledWith_[1]; assert.deepStrictEqual(config, { - baseUrl: fakeV1.SpannerClient.servicePath, + baseUrl: 'spanner.googleapis.com', protosDir: path.resolve(__dirname, '../protos'), protoServices: { Operations: { diff --git a/test/transaction.ts b/test/transaction.ts index 36d8c6988..11a8647e0 100644 --- a/test/transaction.ts +++ b/test/transaction.ts @@ -1633,7 +1633,14 @@ describe('Transaction', () => { }); it('should accept commit options', done => { - const options = {returnCommitStats: true}; + const maxCommitDelay = new google.protobuf.Duration({ + seconds: 0, // 0 seconds + nanos: 100000000, // 100,000,000 nanoseconds = 100 milliseconds + }); + const options = { + returnCommitStats: true, + maxCommitDelay: maxCommitDelay, + }; transaction.request = config => { assert.strictEqual(config.reqOpts.returnCommitStats, true); done();