From ccbb1f08c6cad820c2a71d1a060bd9c3099032c3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Date: Fri, 2 Feb 2024 01:30:40 +0000 Subject: [PATCH] feat(firestore): update the API #### firestore:v1beta1 The following keys were added: - schemas.Document.properties.fields.description - schemas.QueryPlan.description - schemas.QueryPlan.id - schemas.QueryPlan.properties.planInfo.additionalProperties.description - schemas.QueryPlan.properties.planInfo.additionalProperties.type - schemas.QueryPlan.properties.planInfo.description - schemas.QueryPlan.properties.planInfo.type - schemas.QueryPlan.type - schemas.ResultSetStats.description - schemas.ResultSetStats.id - schemas.ResultSetStats.properties.queryPlan.$ref - schemas.ResultSetStats.properties.queryPlan.description - schemas.ResultSetStats.properties.queryStats.additionalProperties.description - schemas.ResultSetStats.properties.queryStats.additionalProperties.type - schemas.ResultSetStats.properties.queryStats.description - schemas.ResultSetStats.properties.queryStats.type - schemas.ResultSetStats.type - schemas.RunAggregationQueryRequest.properties.mode.description - schemas.RunAggregationQueryRequest.properties.mode.enum - schemas.RunAggregationQueryRequest.properties.mode.enumDescriptions - schemas.RunAggregationQueryRequest.properties.mode.type - schemas.RunAggregationQueryResponse.properties.stats.$ref - schemas.RunAggregationQueryResponse.properties.stats.description - schemas.RunQueryRequest.properties.mode.description - schemas.RunQueryRequest.properties.mode.enum - schemas.RunQueryRequest.properties.mode.enumDescriptions - schemas.RunQueryRequest.properties.mode.type - schemas.RunQueryResponse.properties.stats.$ref - schemas.RunQueryResponse.properties.stats.description The following keys were changed: - schemas.StructuredQuery.description #### firestore:v1 The following keys were added: - schemas.Document.properties.fields.description - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.description - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.id - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.properties.database.description - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.properties.database.type - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.properties.snapshotTime.description - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.properties.snapshotTime.format - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.properties.snapshotTime.type - schemas.GoogleFirestoreAdminV1DatabaseSnapshot.type - schemas.GoogleFirestoreAdminV1RestoreDatabaseRequest.properties.databaseSnapshot.$ref - schemas.GoogleFirestoreAdminV1RestoreDatabaseRequest.properties.databaseSnapshot.description - schemas.QueryPlan.description - schemas.QueryPlan.id - schemas.QueryPlan.properties.planInfo.additionalProperties.description - schemas.QueryPlan.properties.planInfo.additionalProperties.type - schemas.QueryPlan.properties.planInfo.description - schemas.QueryPlan.properties.planInfo.type - schemas.QueryPlan.type - schemas.ResultSetStats.description - schemas.ResultSetStats.id - schemas.ResultSetStats.properties.queryPlan.$ref - schemas.ResultSetStats.properties.queryPlan.description - schemas.ResultSetStats.properties.queryStats.additionalProperties.description - schemas.ResultSetStats.properties.queryStats.additionalProperties.type - schemas.ResultSetStats.properties.queryStats.description - schemas.ResultSetStats.properties.queryStats.type - schemas.ResultSetStats.type - schemas.RunAggregationQueryRequest.properties.mode.description - schemas.RunAggregationQueryRequest.properties.mode.enum - schemas.RunAggregationQueryRequest.properties.mode.enumDescriptions - schemas.RunAggregationQueryRequest.properties.mode.type - schemas.RunAggregationQueryResponse.properties.stats.$ref - schemas.RunAggregationQueryResponse.properties.stats.description - schemas.RunQueryRequest.properties.mode.description - schemas.RunQueryRequest.properties.mode.enum - schemas.RunQueryRequest.properties.mode.enumDescriptions - schemas.RunQueryRequest.properties.mode.type - schemas.RunQueryResponse.properties.stats.$ref - schemas.RunQueryResponse.properties.stats.description The following keys were changed: - resources.projects.resources.databases.resources.collectionGroups.resources.fields.methods.list.description - schemas.StructuredQuery.description --- discovery/firestore-v1.json | 97 +++++++++++++++++++++++++++++++- discovery/firestore-v1beta1.json | 75 +++++++++++++++++++++++- src/apis/firestore/v1.ts | 62 +++++++++++++++++++- src/apis/firestore/v1beta1.ts | 43 +++++++++++++- 4 files changed, 269 insertions(+), 8 deletions(-) diff --git a/discovery/firestore-v1.json b/discovery/firestore-v1.json index 0a3b2a6bec..fcbfd57f22 100644 --- a/discovery/firestore-v1.json +++ b/discovery/firestore-v1.json @@ -530,7 +530,7 @@ ] }, "list": { - "description": "Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false or `ttlConfig:*`.", + "description": "Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false` or `ttlConfig:*`.", "flatPath": "v1/projects/{projectsId}/databases/{databasesId}/collectionGroups/{collectionGroupsId}/fields", "httpMethod": "GET", "id": "firestore.projects.databases.collectionGroups.fields.list", @@ -1672,7 +1672,7 @@ } } }, - "revision": "20231103", + "revision": "20240117", "rootUrl": "https://firestore.googleapis.com/", "schemas": { "Aggregation": { @@ -2016,6 +2016,7 @@ "additionalProperties": { "$ref": "Value" }, + "description": "The document's fields. The map keys represent field names. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The field names, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty. Field paths may be used in other contexts to refer to structured fields defined here. For `map_value`, the field path is represented by a dot-delimited (`.`) string of segments. Each segment is either a simple field name (defined below) or a quoted field name. For example, the structured field `\"foo\" : { map_value: { \"x&y\" : { string_value: \"hello\" }}}` would be represented by the field path `` foo.`x&y` ``. 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`. For example, `foo_bar_17`. A quoted field name starts and ends with `` ` `` and may contain any character. Some characters, including `` ` ``, must be escaped using a `\\`. For example, `` `x&y` `` represents `x&y` and `` `bak\\`tik` `` represents `` bak`tik ``.", "type": "object" }, "name": { @@ -2526,6 +2527,22 @@ }, "type": "object" }, + "GoogleFirestoreAdminV1DatabaseSnapshot": { + "description": "A consistent snapshot of a database at a specific point in time.", + "id": "GoogleFirestoreAdminV1DatabaseSnapshot", + "properties": { + "database": { + "description": "Required. A name of the form `projects/{project_id}/databases/{database_id}`", + "type": "string" + }, + "snapshotTime": { + "description": "Required. The timestamp at which the database snapshot is taken. The requested timestamp must be a whole minute within the PITR window.", + "format": "google-datetime", + "type": "string" + } + }, + "type": "object" + }, "GoogleFirestoreAdminV1DeleteDatabaseMetadata": { "description": "Metadata related to the delete database operation.", "id": "GoogleFirestoreAdminV1DeleteDatabaseMetadata", @@ -3212,6 +3229,10 @@ "databaseId": { "description": "Required. The ID to use for the database, which will become the final component of the database's resource name. This database id must not be associated with an existing database. This value should be 4-63 characters. Valid characters are /a-z-/ 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.", "type": "string" + }, + "databaseSnapshot": { + "$ref": "GoogleFirestoreAdminV1DatabaseSnapshot", + "description": "Database snapshot to restore from. The source database must exist and have enabled PITR. The restored database will be created in the same location as the source database." } }, "type": "object" @@ -3691,6 +3712,21 @@ }, "type": "object" }, + "QueryPlan": { + "description": "Plan for the query.", + "id": "QueryPlan", + "properties": { + "planInfo": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Planning phase information for the query. It will include: { \"indexes_used\": [ {\"query_scope\": \"Collection\", \"properties\": \"(foo ASC, __name__ ASC)\"}, {\"query_scope\": \"Collection\", \"properties\": \"(bar ASC, __name__ ASC)\"} ] }", + "type": "object" + } + }, + "type": "object" + }, "QueryTarget": { "description": "A target specified by a query.", "id": "QueryTarget", @@ -3730,6 +3766,25 @@ }, "type": "object" }, + "ResultSetStats": { + "description": "Planning and execution statistics for the query.", + "id": "ResultSetStats", + "properties": { + "queryPlan": { + "$ref": "QueryPlan", + "description": "Plan for the query." + }, + "queryStats": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Aggregated statistics from the execution of the query. This will only be present when the request specifies `PROFILE` mode. For example, a query will return the statistics including: { \"results_returned\": \"20\", \"documents_scanned\": \"20\", \"indexes_entries_scanned\": \"10050\", \"total_execution_time\": \"100.7 msecs\" }", + "type": "object" + } + }, + "type": "object" + }, "RollbackRequest": { "description": "The request for Firestore.Rollback.", "id": "RollbackRequest", @@ -3746,6 +3801,20 @@ "description": "The request for Firestore.RunAggregationQuery.", "id": "RunAggregationQueryRequest", "properties": { + "mode": { + "description": "Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results.", + "enum": [ + "NORMAL", + "PLAN", + "PROFILE" + ], + "enumDescriptions": [ + "The default mode. Only the query results are returned.", + "This mode returns only the query plan, without any results or execution statistics information.", + "This mode returns both the query plan and the execution statistics along with the results." + ], + "type": "string" + }, "newTransaction": { "$ref": "TransactionOptions", "description": "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." @@ -3780,6 +3849,10 @@ "$ref": "AggregationResult", "description": "A single aggregation result. Not present when reporting partial progress." }, + "stats": { + "$ref": "ResultSetStats", + "description": "Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream." + }, "transaction": { "description": "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.", "format": "byte", @@ -3792,6 +3865,20 @@ "description": "The request for Firestore.RunQuery.", "id": "RunQueryRequest", "properties": { + "mode": { + "description": "Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results.", + "enum": [ + "NORMAL", + "PLAN", + "PROFILE" + ], + "enumDescriptions": [ + "The default mode. Only the query results are returned.", + "This mode returns only the query plan, without any results or execution statistics information.", + "This mode returns both the query plan and the execution statistics along with the results." + ], + "type": "string" + }, "newTransaction": { "$ref": "TransactionOptions", "description": "Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream." @@ -3835,6 +3922,10 @@ "format": "int32", "type": "integer" }, + "stats": { + "$ref": "ResultSetStats", + "description": "Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream." + }, "transaction": { "description": "The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.", "format": "byte", @@ -3889,7 +3980,7 @@ "type": "object" }, "StructuredQuery": { - "description": "A Firestore query.", + "description": "A Firestore query. The query stages are executed in the following order: 1. from 2. where 3. select 4. order_by + start_at + end_at 5. offset 6. limit", "id": "StructuredQuery", "properties": { "endAt": { diff --git a/discovery/firestore-v1beta1.json b/discovery/firestore-v1beta1.json index 4c6ea1f3f7..2596572241 100644 --- a/discovery/firestore-v1beta1.json +++ b/discovery/firestore-v1beta1.json @@ -950,7 +950,7 @@ } } }, - "revision": "20231002", + "revision": "20240117", "rootUrl": "https://firestore.googleapis.com/", "schemas": { "Aggregation": { @@ -1294,6 +1294,7 @@ "additionalProperties": { "$ref": "Value" }, + "description": "The document's fields. The map keys represent field names. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The field names, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty. Field paths may be used in other contexts to refer to structured fields defined here. For `map_value`, the field path is represented by a dot-delimited (`.`) string of segments. Each segment is either a simple field name (defined below) or a quoted field name. For example, the structured field `\"foo\" : { map_value: { \"x&y\" : { string_value: \"hello\" }}}` would be represented by the field path `` foo.`x&y` ``. 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`. For example, `foo_bar_17`. A quoted field name starts and ends with `` ` `` and may contain any character. Some characters, including `` ` ``, must be escaped using a `\\`. For example, `` `x&y` `` represents `x&y` and `` `bak\\`tik` `` represents `` bak`tik ``.", "type": "object" }, "name": { @@ -2252,6 +2253,21 @@ }, "type": "object" }, + "QueryPlan": { + "description": "Plan for the query.", + "id": "QueryPlan", + "properties": { + "planInfo": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Planning phase information for the query. It will include: { \"indexes_used\": [ {\"query_scope\": \"Collection\", \"properties\": \"(foo ASC, __name__ ASC)\"}, {\"query_scope\": \"Collection\", \"properties\": \"(bar ASC, __name__ ASC)\"} ] }", + "type": "object" + } + }, + "type": "object" + }, "QueryTarget": { "description": "A target specified by a query.", "id": "QueryTarget", @@ -2291,6 +2307,25 @@ }, "type": "object" }, + "ResultSetStats": { + "description": "Planning and execution statistics for the query.", + "id": "ResultSetStats", + "properties": { + "queryPlan": { + "$ref": "QueryPlan", + "description": "Plan for the query." + }, + "queryStats": { + "additionalProperties": { + "description": "Properties of the object.", + "type": "any" + }, + "description": "Aggregated statistics from the execution of the query. This will only be present when the request specifies `PROFILE` mode. For example, a query will return the statistics including: { \"results_returned\": \"20\", \"documents_scanned\": \"20\", \"indexes_entries_scanned\": \"10050\", \"total_execution_time\": \"100.7 msecs\" }", + "type": "object" + } + }, + "type": "object" + }, "RollbackRequest": { "description": "The request for Firestore.Rollback.", "id": "RollbackRequest", @@ -2307,6 +2342,20 @@ "description": "The request for Firestore.RunAggregationQuery.", "id": "RunAggregationQueryRequest", "properties": { + "mode": { + "description": "Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results.", + "enum": [ + "NORMAL", + "PLAN", + "PROFILE" + ], + "enumDescriptions": [ + "The default mode. Only the query results are returned.", + "This mode returns only the query plan, without any results or execution statistics information.", + "This mode returns both the query plan and the execution statistics along with the results." + ], + "type": "string" + }, "newTransaction": { "$ref": "TransactionOptions", "description": "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." @@ -2341,6 +2390,10 @@ "$ref": "AggregationResult", "description": "A single aggregation result. Not present when reporting partial progress." }, + "stats": { + "$ref": "ResultSetStats", + "description": "Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream." + }, "transaction": { "description": "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.", "format": "byte", @@ -2353,6 +2406,20 @@ "description": "The request for Firestore.RunQuery.", "id": "RunQueryRequest", "properties": { + "mode": { + "description": "Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results.", + "enum": [ + "NORMAL", + "PLAN", + "PROFILE" + ], + "enumDescriptions": [ + "The default mode. Only the query results are returned.", + "This mode returns only the query plan, without any results or execution statistics information.", + "This mode returns both the query plan and the execution statistics along with the results." + ], + "type": "string" + }, "newTransaction": { "$ref": "TransactionOptions", "description": "Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream." @@ -2396,6 +2463,10 @@ "format": "int32", "type": "integer" }, + "stats": { + "$ref": "ResultSetStats", + "description": "Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream." + }, "transaction": { "description": "The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.", "format": "byte", @@ -2450,7 +2521,7 @@ "type": "object" }, "StructuredQuery": { - "description": "A Firestore query.", + "description": "A Firestore query. The query stages are executed in the following order: 1. from 2. where 3. select 4. order_by + start_at + end_at 5. offset 6. limit", "id": "StructuredQuery", "properties": { "endAt": { diff --git a/src/apis/firestore/v1.ts b/src/apis/firestore/v1.ts index 274f874081..6a715d09d3 100644 --- a/src/apis/firestore/v1.ts +++ b/src/apis/firestore/v1.ts @@ -370,6 +370,9 @@ export namespace firestore_v1 { * Output only. The time at which the document was created. This value increases monotonically when a document is deleted then recreated. It can also be compared to values from other documents and the `read_time` of a query. */ createTime?: string | null; + /** + * The document's fields. The map keys represent field names. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The field names, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty. Field paths may be used in other contexts to refer to structured fields defined here. For `map_value`, the field path is represented by a dot-delimited (`.`) string of segments. Each segment is either a simple field name (defined below) or a quoted field name. For example, the structured field `"foo" : { map_value: { "x&y" : { string_value: "hello" \}\}\}` would be represented by the field path `` foo.`x&y` ``. 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`. For example, `foo_bar_17`. A quoted field name starts and ends with `` ` `` and may contain any character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x&y` `` represents `x&y` and `` `bak\`tik` `` represents `` bak`tik ``. + */ fields?: {[key: string]: Schema$Value} | null; /** * The resource name of the document, for example `projects/{project_id\}/databases/{database_id\}/documents/{document_path\}`. @@ -690,6 +693,19 @@ export namespace firestore_v1 { */ versionRetentionPeriod?: string | null; } + /** + * A consistent snapshot of a database at a specific point in time. + */ + export interface Schema$GoogleFirestoreAdminV1DatabaseSnapshot { + /** + * Required. A name of the form `projects/{project_id\}/databases/{database_id\}` + */ + database?: string | null; + /** + * Required. The timestamp at which the database snapshot is taken. The requested timestamp must be a whole minute within the PITR window. + */ + snapshotTime?: string | null; + } /** * Metadata related to the delete database operation. */ @@ -1105,6 +1121,10 @@ export namespace firestore_v1 { * Required. The ID to use for the database, which will become the final component of the database's resource name. This database id must not be associated with an existing database. This value should be 4-63 characters. Valid characters are /a-z-/ 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. */ databaseId?: string | null; + /** + * Database snapshot to restore from. The source database must exist and have enabled PITR. The restored database will be created in the same location as the source database. + */ + databaseSnapshot?: Schema$GoogleFirestoreAdminV1DatabaseSnapshot; } /** * Backup specific statistics. @@ -1427,6 +1447,15 @@ export namespace firestore_v1 { */ fields?: Schema$FieldReference[]; } + /** + * Plan for the query. + */ + export interface Schema$QueryPlan { + /** + * Planning phase information for the query. It will include: { "indexes_used": [ {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"\}, {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"\} ] \} + */ + planInfo?: {[key: string]: any} | null; + } /** * A target specified by a query. */ @@ -1458,6 +1487,19 @@ export namespace firestore_v1 { */ retryTransaction?: string | null; } + /** + * Planning and execution statistics for the query. + */ + export interface Schema$ResultSetStats { + /** + * Plan for the query. + */ + queryPlan?: Schema$QueryPlan; + /** + * Aggregated statistics from the execution of the query. This will only be present when the request specifies `PROFILE` mode. For example, a query will return the statistics including: { "results_returned": "20", "documents_scanned": "20", "indexes_entries_scanned": "10050", "total_execution_time": "100.7 msecs" \} + */ + queryStats?: {[key: string]: any} | null; + } /** * The request for Firestore.Rollback. */ @@ -1471,6 +1513,10 @@ export namespace firestore_v1 { * The request for Firestore.RunAggregationQuery. */ export interface Schema$RunAggregationQueryRequest { + /** + * Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results. + */ + mode?: string | null; /** * 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. */ @@ -1500,6 +1546,10 @@ export namespace firestore_v1 { * A single aggregation result. Not present when reporting partial progress. */ result?: Schema$AggregationResult; + /** + * Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream. + */ + stats?: Schema$ResultSetStats; /** * 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. */ @@ -1509,6 +1559,10 @@ export namespace firestore_v1 { * The request for Firestore.RunQuery. */ export interface Schema$RunQueryRequest { + /** + * Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results. + */ + mode?: string | null; /** * Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream. */ @@ -1546,6 +1600,10 @@ export namespace firestore_v1 { * The number of results that have been skipped due to an offset between the last response and the current response. */ skippedResults?: number | null; + /** + * Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream. + */ + stats?: Schema$ResultSetStats; /** * The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response. */ @@ -1582,7 +1640,7 @@ export namespace firestore_v1 { structuredQuery?: Schema$StructuredQuery; } /** - * A Firestore query. + * A Firestore query. The query stages are executed in the following order: 1. from 2. where 3. select 4. order_by + start_at + end_at 5. offset 6. limit */ export interface Schema$StructuredQuery { /** @@ -3353,7 +3411,7 @@ export namespace firestore_v1 { } /** - * Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false or `ttlConfig:*`. + * Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false` or `ttlConfig:*`. * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. diff --git a/src/apis/firestore/v1beta1.ts b/src/apis/firestore/v1beta1.ts index 1b255dc111..b958d2c880 100644 --- a/src/apis/firestore/v1beta1.ts +++ b/src/apis/firestore/v1beta1.ts @@ -370,6 +370,9 @@ export namespace firestore_v1beta1 { * Output only. The time at which the document was created. This value increases monotonically when a document is deleted then recreated. It can also be compared to values from other documents and the `read_time` of a query. */ createTime?: string | null; + /** + * The document's fields. The map keys represent field names. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The field names, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty. Field paths may be used in other contexts to refer to structured fields defined here. For `map_value`, the field path is represented by a dot-delimited (`.`) string of segments. Each segment is either a simple field name (defined below) or a quoted field name. For example, the structured field `"foo" : { map_value: { "x&y" : { string_value: "hello" \}\}\}` would be represented by the field path `` foo.`x&y` ``. 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`. For example, `foo_bar_17`. A quoted field name starts and ends with `` ` `` and may contain any character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x&y` `` represents `x&y` and `` `bak\`tik` `` represents `` bak`tik ``. + */ fields?: {[key: string]: Schema$Value} | null; /** * The resource name of the document, for example `projects/{project_id\}/databases/{database_id\}/documents/{document_path\}`. @@ -1012,6 +1015,15 @@ export namespace firestore_v1beta1 { */ fields?: Schema$FieldReference[]; } + /** + * Plan for the query. + */ + export interface Schema$QueryPlan { + /** + * Planning phase information for the query. It will include: { "indexes_used": [ {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"\}, {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"\} ] \} + */ + planInfo?: {[key: string]: any} | null; + } /** * A target specified by a query. */ @@ -1043,6 +1055,19 @@ export namespace firestore_v1beta1 { */ retryTransaction?: string | null; } + /** + * Planning and execution statistics for the query. + */ + export interface Schema$ResultSetStats { + /** + * Plan for the query. + */ + queryPlan?: Schema$QueryPlan; + /** + * Aggregated statistics from the execution of the query. This will only be present when the request specifies `PROFILE` mode. For example, a query will return the statistics including: { "results_returned": "20", "documents_scanned": "20", "indexes_entries_scanned": "10050", "total_execution_time": "100.7 msecs" \} + */ + queryStats?: {[key: string]: any} | null; + } /** * The request for Firestore.Rollback. */ @@ -1056,6 +1081,10 @@ export namespace firestore_v1beta1 { * The request for Firestore.RunAggregationQuery. */ export interface Schema$RunAggregationQueryRequest { + /** + * Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results. + */ + mode?: string | null; /** * 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. */ @@ -1085,6 +1114,10 @@ export namespace firestore_v1beta1 { * A single aggregation result. Not present when reporting partial progress. */ result?: Schema$AggregationResult; + /** + * Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream. + */ + stats?: Schema$ResultSetStats; /** * 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. */ @@ -1094,6 +1127,10 @@ export namespace firestore_v1beta1 { * The request for Firestore.RunQuery. */ export interface Schema$RunQueryRequest { + /** + * Optional. The mode in which the query request is processed. This field is optional, and when not provided, it defaults to `NORMAL` mode where no additional statistics will be returned with the query results. + */ + mode?: string | null; /** * Starts a new transaction and reads the documents. Defaults to a read-only transaction. The new transaction ID will be returned as the first response in the stream. */ @@ -1131,6 +1168,10 @@ export namespace firestore_v1beta1 { * The number of results that have been skipped due to an offset between the last response and the current response. */ skippedResults?: number | null; + /** + * Query plan and execution statistics. Note that the returned stats are subject to change as Firestore evolves. This is only present when the request specifies a mode other than `NORMAL` and is sent only once with the last response in the stream. + */ + stats?: Schema$ResultSetStats; /** * The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response. */ @@ -1167,7 +1208,7 @@ export namespace firestore_v1beta1 { structuredQuery?: Schema$StructuredQuery; } /** - * A Firestore query. + * A Firestore query. The query stages are executed in the following order: 1. from 2. where 3. select 4. order_by + start_at + end_at 5. offset 6. limit */ export interface Schema$StructuredQuery { /**