From 6912260a7a7d4f59fba21a767ef8fa4ef7a65db9 Mon Sep 17 00:00:00 2001 From: Michael Lehenbauer Date: Fri, 20 Apr 2018 10:22:29 -0700 Subject: [PATCH 1/2] Update protos w/o array features. --- .../src/protos/firestore_proto_api.d.ts | 23 ------ .../src/protos/google/api/http.proto | 72 +++++++++++------- .../google/firestore/v1beta1/common.proto | 3 +- .../google/firestore/v1beta1/document.proto | 7 +- .../google/firestore/v1beta1/firestore.proto | 73 +++++++++++++++---- .../google/firestore/v1beta1/query.proto | 3 +- .../google/firestore/v1beta1/write.proto | 14 ++-- .../src/protos/google/protobuf/any.proto | 21 ++++-- .../protos/google/protobuf/timestamp.proto | 8 +- 9 files changed, 141 insertions(+), 83 deletions(-) diff --git a/packages/firestore/src/protos/firestore_proto_api.d.ts b/packages/firestore/src/protos/firestore_proto_api.d.ts index 6bf317de50e..cc36473a031 100644 --- a/packages/firestore/src/protos/firestore_proto_api.d.ts +++ b/packages/firestore/src/protos/firestore_proto_api.d.ts @@ -64,15 +64,6 @@ export interface IIndexFieldModeEnum { values(): Array; } export declare const IndexFieldModeEnum: IIndexFieldModeEnum; -export declare type IndexOperationMetadataOperationType = - | 'OPERATION_TYPE_UNSPECIFIED' - | 'CREATING_INDEX'; -export interface IIndexOperationMetadataOperationTypeEnum { - OPERATION_TYPE_UNSPECIFIED: IndexOperationMetadataOperationType; - CREATING_INDEX: IndexOperationMetadataOperationType; - values(): Array; -} -export declare const IndexOperationMetadataOperationTypeEnum: IIndexOperationMetadataOperationTypeEnum; export declare type IndexState = | 'STATE_UNSPECIFIED' | 'CREATING' @@ -235,14 +226,6 @@ export declare namespace firestoreV1beta1ApiClientInterfaces { fieldPath?: string; mode?: IndexFieldMode; } - interface IndexOperationMetadata { - startTime?: string; - endTime?: string; - index?: string; - operationType?: IndexOperationMetadataOperationType; - cancelled?: boolean; - documentProgress?: Progress; - } interface LatLng { latitude?: number; longitude?: number; @@ -293,10 +276,6 @@ export declare namespace firestoreV1beta1ApiClientInterfaces { exists?: boolean; updateTime?: string; } - interface Progress { - workCompleted?: string; - workEstimated?: string; - } interface Projection { fields?: Array; } @@ -425,7 +404,6 @@ export declare type FieldTransform = firestoreV1beta1ApiClientInterfaces.FieldTr export declare type Filter = firestoreV1beta1ApiClientInterfaces.Filter; export declare type Index = firestoreV1beta1ApiClientInterfaces.Index; export declare type IndexField = firestoreV1beta1ApiClientInterfaces.IndexField; -export declare type IndexOperationMetadata = firestoreV1beta1ApiClientInterfaces.IndexOperationMetadata; export declare type LatLng = firestoreV1beta1ApiClientInterfaces.LatLng; export declare type ListCollectionIdsRequest = firestoreV1beta1ApiClientInterfaces.ListCollectionIdsRequest; export declare type ListCollectionIdsResponse = firestoreV1beta1ApiClientInterfaces.ListCollectionIdsResponse; @@ -437,7 +415,6 @@ export declare type MapValue = firestoreV1beta1ApiClientInterfaces.MapValue; export declare type Operation = firestoreV1beta1ApiClientInterfaces.Operation; export declare type Order = firestoreV1beta1ApiClientInterfaces.Order; export declare type Precondition = firestoreV1beta1ApiClientInterfaces.Precondition; -export declare type Progress = firestoreV1beta1ApiClientInterfaces.Progress; export declare type Projection = firestoreV1beta1ApiClientInterfaces.Projection; export declare type QueryTarget = firestoreV1beta1ApiClientInterfaces.QueryTarget; export declare type ReadOnly = firestoreV1beta1ApiClientInterfaces.ReadOnly; diff --git a/packages/firestore/src/protos/google/api/http.proto b/packages/firestore/src/protos/google/api/http.proto index 5f8538a0164..78d515d4b6a 100644 --- a/packages/firestore/src/protos/google/api/http.proto +++ b/packages/firestore/src/protos/google/api/http.proto @@ -1,4 +1,4 @@ -// Copyright 2016 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ option java_package = "com.google.api"; option objc_class_prefix = "GAPI"; -// Defines the HTTP configuration for a service. It contains a list of +// Defines the HTTP configuration for an API service. It contains a list of // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method // to one or more HTTP REST API methods. message Http { @@ -32,14 +32,22 @@ message Http { // // **NOTE:** All service configuration rules follow "last one wins" order. repeated HttpRule rules = 1; + + // When set to true, URL path parmeters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; } // `HttpRule` defines the mapping of an RPC method to one or more HTTP -// REST APIs. The mapping determines what portions of the request -// message are populated from the path, query parameters, or body of -// the HTTP request. The mapping is typically specified as an -// `google.api.http` annotation, see "google/api/annotations.proto" -// for details. +// REST API methods. The mapping specifies how different portions of the RPC +// request message are mapped to URL path, URL query parameters, and +// HTTP request body. The mapping is typically specified as an +// `google.api.http` annotation on the RPC method, +// see "google/api/annotations.proto" for details. // // The mapping consists of a field specifying the path template and // method kind. The path template can refer to fields in the request @@ -87,6 +95,11 @@ message Http { // parameters. Assume the following definition of the request message: // // +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}"; +// } +// } // message GetMessageRequest { // message SubMessage { // string subfield = 1; @@ -199,7 +212,7 @@ message Http { // to the request message are as follows: // // 1. The `body` field specifies either `*` or a field path, or is -// omitted. If omitted, it assumes there is no HTTP body. +// omitted. If omitted, it indicates there is no HTTP request body. // 2. Leaf fields (recursive expansion of nested messages in the // request) can be classified into three types: // (a) Matched in the URL template. @@ -218,28 +231,34 @@ message Http { // FieldPath = IDENT { "." IDENT } ; // Verb = ":" LITERAL ; // -// The syntax `*` matches a single path segment. It follows the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String -// Expansion. +// The syntax `*` matches a single path segment. The syntax `**` matches zero +// or more path segments, which must be the last part of the path except the +// `Verb`. The syntax `LITERAL` matches literal text in the path. // -// The syntax `**` matches zero or more path segments. It follows the semantics -// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved -// Expansion. NOTE: it must be the last segment in the path except the Verb. -// -// The syntax `LITERAL` matches literal text in the URL path. -// -// The syntax `Variable` matches the entire path as specified by its template; -// this nested template must not contain further variables. If a variable +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable // matches a single path segment, its template may be omitted, e.g. `{var}` // is equivalent to `{var=*}`. // +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path, all characters +// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the +// Discovery Document as `{var}`. +// +// If a variable contains one or more path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path, all +// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables +// show up in the Discovery Document as `{+var}`. +// +// NOTE: While the single segment variable matches the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 +// Simple String Expansion, the multi segment variable **does not** match +// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. +// // NOTE: the field paths in variables and in the `body` must not refer to // repeated fields or map fields. -// -// Use CustomHttpPattern to specify any HTTP method that is not included in the -// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for -// a given URL path rule. The wild-card rule is useful for services that provide -// content to Web (HTML) clients. message HttpRule { // Selects methods to which this rule applies. // @@ -265,7 +284,10 @@ message HttpRule { // Used for updating a resource. string patch = 6; - // Custom pattern is used for defining custom verbs. + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. CustomHttpPattern custom = 8; } diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/common.proto b/packages/firestore/src/protos/google/firestore/v1beta1/common.proto index e6243234657..5ceb7b9fe68 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/common.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/common.proto @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ option java_multiple_files = true; option java_outer_classname = "CommonProto"; option java_package = "com.google.firestore.v1beta1"; option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; // A set of field paths on a document. diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/document.proto b/packages/firestore/src/protos/google/firestore/v1beta1/document.proto index cf6001dbfc0..cd84c7a8c10 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/document.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/document.proto @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ option java_multiple_files = true; option java_outer_classname = "DocumentProto"; option java_package = "com.google.firestore.v1beta1"; option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; // A Firestore document. @@ -42,7 +43,7 @@ message Document { // The map keys represent field names. // // A simple field name contains only characters `a` to `z`, `A` to `Z`, - // `0` to `9`, or `_`, and must not start with `0` to `9` or `_`. For example, + // `0` to `9`, or `_`, and must not start with `0` to `9`. For example, // `foo_bar_17`. // // Field names matching the regular expression `__.*__` are reserved. Reserved @@ -72,7 +73,7 @@ message Document { // Output only. The time at which the document was last changed. // - // This value is initally set to the `create_time` then increases + // This value is initially set to the `create_time` then increases // monotonically with each change to the document. It can also be // compared to values from other documents and the `read_time` of a query. google.protobuf.Timestamp update_time = 4; diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/firestore.proto b/packages/firestore/src/protos/google/firestore/v1beta1/firestore.proto index 624ce6cba14..c7e85610e1d 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/firestore.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/firestore.proto @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2018 Google Inc. // // 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 @@ option java_multiple_files = true; option java_outer_classname = "FirestoreProto"; option java_package = "com.google.firestore.v1beta1"; option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; // Specification of the Firestore API. @@ -55,27 +56,39 @@ option objc_class_prefix = "GCFS"; service Firestore { // Gets a single document. rpc GetDocument(GetDocumentRequest) returns (Document) { - option (google.api.http) = { get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" }; + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + }; } // Lists documents. rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { - option (google.api.http) = { get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" }; + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" + }; } // Creates a new document. rpc CreateDocument(CreateDocumentRequest) returns (Document) { - option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}" body: "document" }; + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}" + body: "document" + }; } // Updates or inserts a document. rpc UpdateDocument(UpdateDocumentRequest) returns (Document) { - option (google.api.http) = { patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}" body: "document" }; + option (google.api.http) = { + patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}" + body: "document" + }; } // Deletes a document. rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" }; + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}" + }; } // Gets multiple documents. @@ -83,42 +96,74 @@ service Firestore { // Documents returned by this method are not guaranteed to be returned in the // same order that they were requested. rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet" + body: "*" + }; } // Starts a new transaction. rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction" + body: "*" + }; } // Commits a transaction, while optionally updating documents. rpc Commit(CommitRequest) returns (CommitResponse) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:commit" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:commit" + body: "*" + }; } // Rolls back a transaction. rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback" + body: "*" + }; } // Runs a query. rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) { - option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery" + body: "*" + } + }; } // Streams batches of document updates and deletes, in order. rpc Write(stream WriteRequest) returns (stream WriteResponse) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:write" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:write" + body: "*" + }; } // Listens to changes. rpc Listen(stream ListenRequest) returns (stream ListenResponse) { - option (google.api.http) = { post: "/v1beta1/{database=projects/*/databases/*}/documents:listen" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}/documents:listen" + body: "*" + }; } // Lists all the collection IDs underneath a document. rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) { - option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds" body: "*" }; + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds" + body: "*" + } + }; } } diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/query.proto b/packages/firestore/src/protos/google/firestore/v1beta1/query.proto index d19b0222822..335124e769f 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/query.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/query.proto @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ option java_multiple_files = true; option java_outer_classname = "QueryProto"; option java_package = "com.google.firestore.v1beta1"; option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; // A Firestore query. diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/write.proto b/packages/firestore/src/protos/google/firestore/v1beta1/write.proto index 73ec3d9a4a3..a090a0b700d 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/write.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/write.proto @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ option java_multiple_files = true; option java_outer_classname = "WriteProto"; option java_package = "com.google.firestore.v1beta1"; option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\V1beta1"; // A write on a document. @@ -50,9 +51,10 @@ message Write { // The fields to update in this write. // // This field can be set only when the operation is `update`. - // None of the field paths in the mask may contain a reserved name. - // If the document exists on the server and has fields not referenced in the - // mask, they are left unchanged. + // If the mask is not set for an `update` and the document exists, any + // existing data will be overwritten. + // If the mask is set and the document on the server has fields not covered by + // the mask, they are left unchanged. // Fields referenced in the mask, but not present in the input document, are // deleted from the document on the server. // The field paths in this mask must not contain a reserved field name. @@ -73,7 +75,8 @@ message DocumentTransform { // Unspecified. This value must not be used. SERVER_VALUE_UNSPECIFIED = 0; - // The time at which the server processed the request. + // The time at which the server processed the request, with millisecond + // precision. REQUEST_TIME = 1; } @@ -93,6 +96,7 @@ message DocumentTransform { // The list of transformations to apply to the fields of the document, in // order. + // This must not be empty. repeated FieldTransform field_transforms = 2; } diff --git a/packages/firestore/src/protos/google/protobuf/any.proto b/packages/firestore/src/protos/google/protobuf/any.proto index c7486676231..49329425583 100644 --- a/packages/firestore/src/protos/google/protobuf/any.proto +++ b/packages/firestore/src/protos/google/protobuf/any.proto @@ -120,17 +120,18 @@ option objc_class_prefix = "GPB"; // } // message Any { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: // // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the @@ -139,6 +140,10 @@ message Any { // on changes to types. (Use versioned type names to manage // breaking changes.) // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // diff --git a/packages/firestore/src/protos/google/protobuf/timestamp.proto b/packages/firestore/src/protos/google/protobuf/timestamp.proto index b7cbd17502f..eafb3fa03a6 100644 --- a/packages/firestore/src/protos/google/protobuf/timestamp.proto +++ b/packages/firestore/src/protos/google/protobuf/timestamp.proto @@ -103,7 +103,9 @@ option objc_class_prefix = "GPB"; // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required, though only UTC (as indicated by "Z") is presently supported. +// is required. A proto3 JSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. @@ -114,8 +116,8 @@ option objc_class_prefix = "GPB"; // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) -// to obtain a formatter capable of generating timestamps in this format. +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// ) to obtain a formatter capable of generating timestamps in this format. // // message Timestamp { From 751fffafcf4340faf5891c2ed503c907c075ab91 Mon Sep 17 00:00:00 2001 From: Michael Lehenbauer Date: Fri, 20 Apr 2018 10:23:25 -0700 Subject: [PATCH 2/2] Update protos w/ array features. --- .../src/protos/firestore_proto_api.d.ts | 6 ++++- .../google/firestore/v1beta1/query.proto | 3 +++ .../google/firestore/v1beta1/write.proto | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/firestore/src/protos/firestore_proto_api.d.ts b/packages/firestore/src/protos/firestore_proto_api.d.ts index cc36473a031..0acef72a8bc 100644 --- a/packages/firestore/src/protos/firestore_proto_api.d.ts +++ b/packages/firestore/src/protos/firestore_proto_api.d.ts @@ -33,7 +33,8 @@ export declare type FieldFilterOp = | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' - | 'EQUAL'; + | 'EQUAL' + | 'ARRAY_CONTAINS'; export interface IFieldFilterOpEnum { OPERATOR_UNSPECIFIED: FieldFilterOp; LESS_THAN: FieldFilterOp; @@ -41,6 +42,7 @@ export interface IFieldFilterOpEnum { GREATER_THAN: FieldFilterOp; GREATER_THAN_OR_EQUAL: FieldFilterOp; EQUAL: FieldFilterOp; + ARRAY_CONTAINS: FieldFilterOp; values(): Array; } export declare const FieldFilterOpEnum: IFieldFilterOpEnum; @@ -210,6 +212,8 @@ export declare namespace firestoreV1beta1ApiClientInterfaces { interface FieldTransform { fieldPath?: string; setToServerValue?: FieldTransformSetToServerValue; + appendMissingElements?: ArrayValue; + removeAllFromArray?: ArrayValue; } interface Filter { compositeFilter?: CompositeFilter; diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/query.proto b/packages/firestore/src/protos/google/firestore/v1beta1/query.proto index 335124e769f..5f5b0cfd4bd 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/query.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/query.proto @@ -99,6 +99,9 @@ message StructuredQuery { // Equal. EQUAL = 5; + + // Contains. Requires that the field is an array. + ARRAY_CONTAINS = 7; } // The field to filter by. diff --git a/packages/firestore/src/protos/google/firestore/v1beta1/write.proto b/packages/firestore/src/protos/google/firestore/v1beta1/write.proto index a090a0b700d..3f4732bdb3b 100644 --- a/packages/firestore/src/protos/google/firestore/v1beta1/write.proto +++ b/packages/firestore/src/protos/google/firestore/v1beta1/write.proto @@ -88,6 +88,32 @@ message DocumentTransform { oneof transform_type { // Sets the field to the given server value. ServerValue set_to_server_value = 2; + + // Append the given elements in order if they are not already present in + // the current field value. + // If the field is not an array, or if the field does not yet exist, it is + // first set to the empty array. + // + // Equivalent numbers of different types (e.g. 3L and 3.0) are + // considered equal when checking if a value is missing. + // NaN is equal to NaN, and Null is equal to Null. + // If the input contains multiple equivalent values, only the first will + // be considered. + // + // The corresponding transform_result will be the null value. + ArrayValue append_missing_elements = 6; + + // Remove all of the given elements from the array in the field. + // If the field is not an array, or if the field does not yet exist, it is + // set to the empty array. + // + // Equivalent numbers of the different types (e.g. 3L and 3.0) are + // considered equal when deciding whether an element should be removed. + // NaN is equal to NaN, and Null is equal to Null. + // This will remove all equivalent values if there are duplicates. + // + // The corresponding transform_result will be the null value. + ArrayValue remove_all_from_array = 7; } }