google-cloud-firestore 2.6.1 → 2.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91324b3d891244579ee53512847340a286c4cf1727c9a4eb5086966355029c93
4
- data.tar.gz: ad3b9d4907e71877a82d72a3d3f7c55952c45e0ea53ecb8becd8bc7569ef4bb9
3
+ metadata.gz: 8ce1f6d742ab22f8ae9048c2b32ee29066133c449a7ddcc6f1cc821a62f02151
4
+ data.tar.gz: 6818b31d6e877da83416f01494cd8034ba54ee99161ce443d7f6862ed65f1202
5
5
  SHA512:
6
- metadata.gz: b2f11c5888b49916f5383f1a7b46c190e35897e79d376e48f6ef950246fd91179b9f33a05aec1fb932ff72fe262174fca1b5ed4c8d4f8a4e1f3f69b5302bdbaf
7
- data.tar.gz: 24bd04f73584eeac0840fc0619c4003284c6193202763e751dd1bbf4c02539f4a44486587953cf90c5bd133377d02d8c871669affeaa9a22e2fa863c6f718f17
6
+ metadata.gz: a68a90e078451cade335996d3f7cb2545d1b275726ecfe8f417eeae480d42bf53cd181ad5ac53f42adbb516b9ccf9264172b038ef7c87843c8130617a35b2b90
7
+ data.tar.gz: 3535f4d765f78fd1da1cbc2808a974e9a0782d43e6cd3ed31c9f1ba33c4f31ea44142e3f66d28f27bd455eeae4cdea874c4e3953dc62da5871dd4c85b9aca5a4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Release History
2
2
 
3
+ ### 2.6.5 / 2021-10-25
4
+
5
+ #### Documentation
6
+
7
+ * Add documentation for quota_project Configuration attribute
8
+
9
+ ### 2.6.4 / 2021-08-26
10
+
11
+ #### Bug Fixes
12
+
13
+ * Fix google-cloud-resource-prefix header
14
+
15
+ ### 2.6.3 / 2021-08-24
16
+
17
+ #### Bug Fixes
18
+
19
+ * Fix transaction retry behavior
20
+
21
+ ### 2.6.2 / 2021-07-26
22
+
23
+ #### Bug Fixes
24
+
25
+ * Update FieldPath#formatted_string to correctly escape non-simple characters
26
+
3
27
  ### 2.6.1 / 2021-07-08
4
28
 
5
29
  #### Documentation
@@ -628,7 +628,24 @@ module Google
628
628
  commit_return = transaction.commit
629
629
  # Conditional return value, depending on truthy commit_response
630
630
  commit_response ? commit_return : transaction_return
631
- rescue Google::Cloud::UnavailableError => e
631
+ rescue Google::Cloud::AbortedError,
632
+ Google::Cloud::CanceledError,
633
+ Google::Cloud::UnknownError,
634
+ Google::Cloud::DeadlineExceededError,
635
+ Google::Cloud::InternalError,
636
+ Google::Cloud::UnauthenticatedError,
637
+ Google::Cloud::ResourceExhaustedError,
638
+ Google::Cloud::UnavailableError,
639
+ Google::Cloud::InvalidArgumentError => e
640
+
641
+ if e.instance_of? Google::Cloud::InvalidArgumentError
642
+ # Return if a previous call was retried but ultimately succeeded
643
+ return nil if backoff[:current].positive?
644
+ # The Firestore backend uses "INVALID_ARGUMENT" for transaction IDs that have expired.
645
+ # While INVALID_ARGUMENT is generally not retryable, we retry this specific case.
646
+ raise e unless e.message =~ /transaction has expired/
647
+ end
648
+
632
649
  # Re-raise if retried more than the max
633
650
  raise e if backoff[:current] > backoff[:max]
634
651
 
@@ -643,12 +660,6 @@ module Google
643
660
  transaction = Transaction.from_client \
644
661
  self, previous_transaction: transaction.transaction_id
645
662
  retry
646
- rescue Google::Cloud::InvalidArgumentError => e
647
- # Return if a previous call was retried but ultimately succeeded
648
- return nil if backoff[:current].positive?
649
-
650
- # Re-raise error.
651
- raise e
652
663
  rescue StandardError => e
653
664
  # Rollback transaction when handling unexpected error
654
665
  transaction.rollback rescue nil
@@ -209,19 +209,15 @@ module Google
209
209
 
210
210
  protected
211
211
 
212
- START_FIELD_PATH_CHARS = /\A[a-zA-Z_]/.freeze
213
212
  INVALID_FIELD_PATH_CHARS = %r{[~*/\[\]]}.freeze
213
+ SIMPLE_FIELD_PATH_CHARS = /\A[_a-zA-Z][_a-zA-Z0-9]*\Z/.freeze
214
214
 
215
215
  def escape_field_for_path field
216
216
  field = String field
217
217
 
218
- if INVALID_FIELD_PATH_CHARS.match(field) ||
219
- field["."] || field["`"] || field["\\"]
220
- escaped_field = field.gsub(/[`\\]/, "`" => "\\\`", "\\" => "\\\\")
221
- return "`#{escaped_field}`"
222
- end
218
+ return field if SIMPLE_FIELD_PATH_CHARS.match field
223
219
 
224
- return field if START_FIELD_PATH_CHARS.match field
220
+ field = field.gsub(/[`\\]/, "`" => "\\`", "\\" => "\\\\")
225
221
 
226
222
  "`#{field}`"
227
223
  end
@@ -48,7 +48,7 @@ module Google
48
48
  config.endpoint = host if host
49
49
  config.lib_name = "gccl"
50
50
  config.lib_version = Google::Cloud::Firestore::VERSION
51
- config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
51
+ config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}/databases/(default)" }
52
52
  end
53
53
  end
54
54
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Firestore
19
- VERSION = "2.6.1".freeze
19
+ VERSION = "2.6.5".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -122,6 +122,8 @@ module Google
122
122
  # parameter `keyfile` is considered deprecated, but may also be used.)
123
123
  # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
124
124
  # the set of resources and operations that the connection can access.
125
+ # * `quota_project` - (String) The project ID for a project that can be
126
+ # used by client libraries for quota and billing purposes.
125
127
  # * `timeout` - (Integer) Default timeout to use in requests.
126
128
  # * `endpoint` - (String) Override of the endpoint host name, or `nil`
127
129
  # to use the default endpoint.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-firestore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core