Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update with generated code from protobufjs version 7.0.0 #1767

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7,818 changes: 4,365 additions & 3,453 deletions dev/protos/firestore_admin_v1_proto_api.d.ts

Large diffs are not rendered by default.

21,696 changes: 11,927 additions & 9,769 deletions dev/protos/firestore_admin_v1_proto_api.js

Large diffs are not rendered by default.

4,216 changes: 2,816 additions & 1,400 deletions dev/protos/firestore_v1_proto_api.d.ts

Large diffs are not rendered by default.

13,695 changes: 8,485 additions & 5,210 deletions dev/protos/firestore_v1_proto_api.js

Large diffs are not rendered by default.

3,960 changes: 2,483 additions & 1,477 deletions dev/protos/firestore_v1beta1_proto_api.d.ts

Large diffs are not rendered by default.

11,120 changes: 6,724 additions & 4,396 deletions dev/protos/firestore_v1beta1_proto_api.js

Large diffs are not rendered by default.

81 changes: 71 additions & 10 deletions dev/protos/google/api/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,22 @@ extend google.protobuf.MessageOptions {
// // For Kubernetes resources, the format is {api group}/{kind}.
// option (google.api.resource) = {
// type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
// name_descriptor: {
// pattern: "projects/{project}/topics/{topic}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
// name_descriptor:
// - pattern: "projects/{project}/topics/{topic}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
//
// Sometimes, resources have multiple patterns, typically because they can
// live under multiple parents.
Expand All @@ -75,21 +82,75 @@ extend google.protobuf.MessageOptions {
// message LogEntry {
// option (google.api.resource) = {
// type: "logging.googleapis.com/LogEntry"
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// name_descriptor: {
// pattern: "projects/{project}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// }
// name_descriptor: {
// pattern: "folders/{folder}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// parent_name_extractor: "folders/{folder}"
// }
// name_descriptor: {
// pattern: "organizations/{organization}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Organization"
// parent_name_extractor: "organizations/{organization}"
// }
// name_descriptor: {
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// parent_type: "billing.googleapis.com/BillingAccount"
// parent_name_extractor: "billingAccounts/{billing_account}"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'logging.googleapis.com/LogEntry'
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// name_descriptor:
// - pattern: "projects/{project}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// - pattern: "folders/{folder}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// parent_name_extractor: "folders/{folder}"
// - pattern: "organizations/{organization}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Organization"
// parent_name_extractor: "organizations/{organization}"
// - pattern: "billingAccounts/{billing_account}/logs/{log}"
// parent_type: "billing.googleapis.com/BillingAccount"
// parent_name_extractor: "billingAccounts/{billing_account}"
//
// For flexible resources, the resource name doesn't contain parent names, but
// the resource itself has parents for policy evaluation.
//
// Example:
//
// message Shelf {
// option (google.api.resource) = {
// type: "library.googleapis.com/Shelf"
// name_descriptor: {
// pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// }
// name_descriptor: {
// pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'library.googleapis.com/Shelf'
// name_descriptor:
// - pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// - pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
message ResourceDescriptor {
// A description of the historical or future-looking state of the
// resource pattern.
Expand Down
38 changes: 38 additions & 0 deletions dev/protos/google/firestore/admin/v1/firestore_admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ service FirestoreAdmin {
};
}

// Create a database.
rpc CreateDatabase(CreateDatabaseRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*}/databases"
body: "database"
};
option (google.api.method_signature) = "parent,database,database_id";
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "CreateDatabaseMetadata"
};
}

// Gets information about a database.
rpc GetDatabase(GetDatabaseRequest) returns (Database) {
option (google.api.http) = {
Expand Down Expand Up @@ -245,6 +258,31 @@ message ListDatabasesRequest {
];
}

// The request for [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase].
message CreateDatabaseRequest {
// Required. A parent name of the form
// `projects/{project_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "firestore.googleapis.com/Database"
}
];

// Required. The Database to create.
Database database = 2 [(google.api.field_behavior) = REQUIRED];

// Required. The ID to use for the database, which will become the final component of
// the database's resource name.
//
// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
// with first character a letter and the last a letter or a number. Must not
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
//
// "(default)" database id is also valid.
string database_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// The list of databases for a project.
message ListDatabasesResponse {
// The databases in the project.
Expand Down
80 changes: 80 additions & 0 deletions dev/protos/google/firestore/v1/firestore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package google.firestore.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/firestore/v1/aggregation_result.proto";
import "google/firestore/v1/common.proto";
import "google/firestore/v1/document.proto";
import "google/firestore/v1/query.proto";
Expand Down Expand Up @@ -135,6 +136,29 @@ service Firestore {
};
}

// Runs an aggregation query.
//
// Rather than producing [Document][google.firestore.v1.Document] results like [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery],
// this API allows running an aggregation to produce a series of
// [AggregationResult][google.firestore.v1.AggregationResult] server-side.
//
// High-Level Example:
//
// ```
// -- Return the number of documents in table given a filter.
// SELECT COUNT(*) FROM ( SELECT * FROM k where a = true );
// ```
rpc RunAggregationQuery(RunAggregationQueryRequest) returns (stream RunAggregationQueryResponse) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery"
body: "*"
additional_bindings {
post: "/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery"
body: "*"
}
};
}

// Partitions a query by returning partition cursors that can be used to run
// the query in parallel. The returned partition cursors are split points that
// can be used by RunQuery as starting/end points for the query results.
Expand Down Expand Up @@ -534,6 +558,62 @@ message RunQueryResponse {
}
}

// The request for [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery].
message RunAggregationQueryRequest {
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// The query to run.
oneof query_type {
// An aggregation query.
StructuredAggregationQuery structured_aggregation_query = 2;
}

// The consistency mode for the query, defaults to strong consistency.
oneof consistency_selector {
// Run the aggregation within an already active transaction.
//
// The value here is the opaque transaction ID to execute the query in.
bytes transaction = 4;

// Starts a new transaction as part of the query, defaulting to read-only.
//
// The new transaction ID will be returned as the first response in the
// stream.
TransactionOptions new_transaction = 5;

// Executes the query at the given timestamp.
//
// Requires:
//
// * Cannot be more than 270 seconds in the past.
google.protobuf.Timestamp read_time = 6;
}
}

// The response for [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery].
message RunAggregationQueryResponse {
// A single aggregation result.
//
// Not present when reporting partial progress or when the query produced
// zero results.
AggregationResult result = 1;

// The transaction that was started as part of this request.
//
// Only present on the first response when the request requested to start
// a new transaction.
bytes transaction = 2;

// The time at which the aggregate value is valid for.
google.protobuf.Timestamp read_time = 3;
}

// The request for [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery].
message PartitionQueryRequest {
// Required. The parent resource name. In the format:
Expand Down
87 changes: 87 additions & 0 deletions dev/protos/google/firestore/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ message StructuredQuery {

// Documents are required to satisfy all of the combined filters.
AND = 1;

// Documents are required to satisfy at least one of the combined filters.
OR = 2;
}

// The operator for combining multiple filters.
Expand Down Expand Up @@ -292,6 +295,90 @@ message StructuredQuery {
google.protobuf.Int32Value limit = 5;
}

// Firestore query for running an aggregation over a [StructuredQuery][google.firestore.v1.StructuredQuery].
message StructuredAggregationQuery {
// Defines a aggregation that produces a single result.
message Aggregation {
// Count of documents that match the query.
//
// The `COUNT(*)` aggregation function operates on the entire document
// so it does not require a field reference.
message Count {
// Optional. Optional constraint on the maximum number of documents to count.
//
// This provides a way to set an upper bound on the number of documents
// to scan, limiting latency and cost.
//
// Unspecified is interpreted as no bound.
//
// High-Level Example:
//
// ```
// AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
// ```
//
// Requires:
//
// * Must be greater than zero when present.
google.protobuf.Int64Value up_to = 1 [(google.api.field_behavior) = OPTIONAL];
}

// The type of aggregation to perform, required.
oneof operator {
// Count aggregator.
Count count = 1;
}

// Optional. Optional name of the field to store the result of the aggregation into.
//
// If not provided, Firestore will pick a default name following the format
// `field_<incremental_id++>`. For example:
//
// ```
// AGGREGATE
// COUNT_UP_TO(1) AS count_up_to_1,
// COUNT_UP_TO(2),
// COUNT_UP_TO(3) AS count_up_to_3,
// COUNT_UP_TO(4)
// OVER (
// ...
// );
// ```
//
// becomes:
//
// ```
// AGGREGATE
// COUNT_UP_TO(1) AS count_up_to_1,
// COUNT_UP_TO(2) AS field_1,
// COUNT_UP_TO(3) AS count_up_to_3,
// COUNT_UP_TO(4) AS field_2
// OVER (
// ...
// );
// ```
//
// Requires:
//
// * Must be unique across all aggregation aliases.
// * Conform to [document field name][google.firestore.v1.Document.fields] limitations.
string alias = 7 [(google.api.field_behavior) = OPTIONAL];
}

// The base query to aggregate over.
oneof query_type {
// Nested structured query.
StructuredQuery structured_query = 1;
}

// Optional. Series of aggregations to apply over the results of the `structured_query`.
//
// Requires:
//
// * A minimum of one and maximum of five aggregations per query.
repeated Aggregation aggregations = 3 [(google.api.field_behavior) = OPTIONAL];
}

// A position in a query result set.
message Cursor {
// The values that represent a position, in the order they appear in
Expand Down
4 changes: 2 additions & 2 deletions dev/protos/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PBTS="$(npm bin)/pbts"
pushd "$WORK_DIR"

# Clone necessary git repos.
git clone --depth 1 https://github.com/googleapis/googleapis.git
git clone -b preview --depth 1 https://github.com/googleapis/googleapis.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why -b preview?

git clone --depth 1 https://github.com/google/protobuf.git

# Copy necessary protos.
Expand Down Expand Up @@ -71,7 +71,7 @@ cp googleapis/google/type/latlng.proto \
"${PROTOS_DIR}/google/type/"

mkdir -p "${PROTOS_DIR}/google/protobuf"
cp protobuf/src/google/protobuf/{any,empty,field_mask,struct,timestamp,wrappers}.proto \
cp protobuf/src/google/protobuf/{any,descriptor,empty,field_mask,struct,timestamp,wrappers}.proto \
"${PROTOS_DIR}/google/protobuf/"

popd
Expand Down