google-cloud-firestore 2.6.0 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3141b004673c1db562f162d9218ac680c0693e4d91a8eb48b7d17f444646e74a
4
- data.tar.gz: 4ab2bb6f69da5f8ad2e53464ae3712647b3642d49a465dc5f75d1dbc923979f5
3
+ metadata.gz: 97eefcf8baff5191871034a5c72d3b1ab423717e87c8891d59c332c0c20c69f1
4
+ data.tar.gz: 9d96c0d2ecb8e40e3270b1f70a3e06450bbe58ac2d2978f1ae111a170ffec298
5
5
  SHA512:
6
- metadata.gz: fd5dccbe067d6fea81556aae40b9fc9de2ca75fc389c919335217371d84578b68ad7c9854c84831bb368dd58982849c06f044cef0c864be586cdace0ea48994a
7
- data.tar.gz: 7a7f0ee2a3259f2a65119b0b31dbf781d7336f7c530301f4c7f0a7fdf95fea8a7773caa4ed172c9ce8c5ff9f9fe80dab830f37ef1e6d204ae7d770fdf9c066c0
6
+ metadata.gz: f653a12215f410fbcc43aef9b51d4790a696967661b6e5e51f122ea1f86f840d5384ffec6e69753a936c65a06691d673c7c2ab7317b7124339f0856aab97ad3f
7
+ data.tar.gz: 94d54e1fc6a4fbbeba256bd8397d6544cbeb4585e14510a58230979f5cb4fe74f591fd66a1abe8806b8ea0497cf564e328c91617a7a011804d29c2b53109934d
data/AUTHENTICATION.md CHANGED
@@ -95,7 +95,8 @@ client = Google::Cloud::Firestore.new
95
95
 
96
96
  ### Configuration
97
97
 
98
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
98
+ The **Project ID** and the path to the **Credentials JSON** file can be configured
99
+ instead of placing them in environment variables or providing them as arguments.
99
100
 
100
101
  ```ruby
101
102
  require "google/cloud/firestore"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Release History
2
2
 
3
+ ### 2.6.4 / 2021-08-26
4
+
5
+ #### Bug Fixes
6
+
7
+ * Fix google-cloud-resource-prefix header
8
+
9
+ ### 2.6.3 / 2021-08-24
10
+
11
+ #### Bug Fixes
12
+
13
+ * Fix transaction retry behavior
14
+
15
+ ### 2.6.2 / 2021-07-26
16
+
17
+ #### Bug Fixes
18
+
19
+ * Update FieldPath#formatted_string to correctly escape non-simple characters
20
+
21
+ ### 2.6.1 / 2021-07-08
22
+
23
+ #### Documentation
24
+
25
+ * Update AUTHENTICATION.md in handwritten packages
26
+
3
27
  ### 2.6.0 / 2021-06-15
4
28
 
5
29
  #### Features
@@ -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.0".freeze
19
+ VERSION = "2.6.4".freeze
20
20
  end
21
21
  end
22
22
  end
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.0
4
+ version: 2.6.4
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-06-15 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core