google-cloud-firestore 0.24.2 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +26 -0
  4. data/EMULATOR.md +49 -0
  5. data/lib/google-cloud-firestore.rb +6 -1
  6. data/lib/google/cloud/firestore.rb +36 -8
  7. data/lib/google/cloud/firestore/batch.rb +1 -1
  8. data/lib/google/cloud/firestore/client.rb +152 -4
  9. data/lib/google/cloud/firestore/collection_reference.rb +1 -1
  10. data/lib/google/cloud/firestore/commit_response.rb +1 -1
  11. data/lib/google/cloud/firestore/convert.rb +53 -38
  12. data/lib/google/cloud/firestore/credentials.rb +2 -2
  13. data/lib/google/cloud/firestore/document_reference.rb +2 -1
  14. data/lib/google/cloud/firestore/document_snapshot.rb +5 -5
  15. data/lib/google/cloud/firestore/field_path.rb +2 -2
  16. data/lib/google/cloud/firestore/field_value.rb +139 -9
  17. data/lib/google/cloud/firestore/query.rb +21 -15
  18. data/lib/google/cloud/firestore/query_snapshot.rb +1 -1
  19. data/lib/google/cloud/firestore/service.rb +31 -13
  20. data/lib/google/cloud/firestore/transaction.rb +39 -5
  21. data/lib/google/cloud/firestore/v1.rb +152 -0
  22. data/lib/google/cloud/firestore/v1/credentials.rb +42 -0
  23. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +64 -0
  24. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +136 -0
  25. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +574 -0
  26. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +219 -0
  27. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +237 -0
  28. data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +130 -0
  29. data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +29 -0
  30. data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +109 -0
  31. data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +26 -0
  32. data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +84 -0
  33. data/lib/google/cloud/firestore/v1/firestore_client.rb +1044 -0
  34. data/lib/google/cloud/firestore/v1/firestore_client_config.json +100 -0
  35. data/lib/google/cloud/firestore/v1beta1.rb +1 -1
  36. data/lib/google/cloud/firestore/v1beta1/credentials.rb +1 -1
  37. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +1 -1
  38. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +1 -1
  39. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +1 -1
  40. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +1 -1
  41. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +41 -1
  42. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +1 -1
  43. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +1 -1
  44. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +1 -1
  45. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +1 -65
  46. data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +1 -1
  47. data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +1 -1
  48. data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +1 -1
  49. data/lib/google/cloud/firestore/version.rb +1 -1
  50. data/lib/google/cloud/firestore/watch/enumerator_queue.rb +0 -2
  51. data/lib/google/cloud/firestore/watch/inventory.rb +2 -2
  52. data/lib/google/cloud/firestore/watch/listener.rb +16 -17
  53. data/lib/google/cloud/firestore/watch/order.rb +1 -1
  54. data/lib/google/firestore/v1/common_pb.rb +45 -0
  55. data/lib/google/firestore/v1/document_pb.rb +50 -0
  56. data/lib/google/firestore/v1/firestore_pb.rb +220 -0
  57. data/lib/google/firestore/v1/firestore_services_pb.rb +87 -0
  58. data/lib/google/firestore/v1/query_pb.rb +105 -0
  59. data/lib/google/firestore/v1/write_pb.rb +79 -0
  60. data/lib/google/firestore/v1beta1/firestore_services_pb.rb +2 -1
  61. data/lib/google/firestore/v1beta1/write_pb.rb +3 -0
  62. metadata +26 -5
@@ -0,0 +1,100 @@
1
+ {
2
+ "interfaces": {
3
+ "google.firestore.v1.Firestore": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ },
21
+ "streaming": {
22
+ "initial_retry_delay_millis": 100,
23
+ "retry_delay_multiplier": 1.3,
24
+ "max_retry_delay_millis": 60000,
25
+ "initial_rpc_timeout_millis": 300000,
26
+ "rpc_timeout_multiplier": 1.0,
27
+ "max_rpc_timeout_millis": 300000,
28
+ "total_timeout_millis": 600000
29
+ }
30
+ },
31
+ "methods": {
32
+ "GetDocument": {
33
+ "timeout_millis": 60000,
34
+ "retry_codes_name": "idempotent",
35
+ "retry_params_name": "default"
36
+ },
37
+ "ListDocuments": {
38
+ "timeout_millis": 60000,
39
+ "retry_codes_name": "idempotent",
40
+ "retry_params_name": "default"
41
+ },
42
+ "CreateDocument": {
43
+ "timeout_millis": 60000,
44
+ "retry_codes_name": "non_idempotent",
45
+ "retry_params_name": "default"
46
+ },
47
+ "UpdateDocument": {
48
+ "timeout_millis": 60000,
49
+ "retry_codes_name": "non_idempotent",
50
+ "retry_params_name": "default"
51
+ },
52
+ "DeleteDocument": {
53
+ "timeout_millis": 60000,
54
+ "retry_codes_name": "idempotent",
55
+ "retry_params_name": "default"
56
+ },
57
+ "BatchGetDocuments": {
58
+ "timeout_millis": 300000,
59
+ "retry_codes_name": "idempotent",
60
+ "retry_params_name": "streaming"
61
+ },
62
+ "BeginTransaction": {
63
+ "timeout_millis": 60000,
64
+ "retry_codes_name": "idempotent",
65
+ "retry_params_name": "default"
66
+ },
67
+ "Commit": {
68
+ "timeout_millis": 60000,
69
+ "retry_codes_name": "non_idempotent",
70
+ "retry_params_name": "default"
71
+ },
72
+ "Rollback": {
73
+ "timeout_millis": 60000,
74
+ "retry_codes_name": "idempotent",
75
+ "retry_params_name": "default"
76
+ },
77
+ "RunQuery": {
78
+ "timeout_millis": 60000,
79
+ "retry_codes_name": "idempotent",
80
+ "retry_params_name": "streaming"
81
+ },
82
+ "Write": {
83
+ "timeout_millis": 86400000,
84
+ "retry_codes_name": "non_idempotent",
85
+ "retry_params_name": "streaming"
86
+ },
87
+ "Listen": {
88
+ "timeout_millis": 86400000,
89
+ "retry_codes_name": "idempotent",
90
+ "retry_params_name": "streaming"
91
+ },
92
+ "ListCollectionIds": {
93
+ "timeout_millis": 60000,
94
+ "retry_codes_name": "idempotent",
95
+ "retry_params_name": "default"
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -67,6 +67,46 @@ module Google
67
67
  # @!attribute [rw] set_to_server_value
68
68
  # @return [Google::Firestore::V1beta1::DocumentTransform::FieldTransform::ServerValue]
69
69
  # Sets the field to the given server value.
70
+ # @!attribute [rw] increment
71
+ # @return [Google::Firestore::V1beta1::Value]
72
+ # Adds the given value to the field's current value.
73
+ #
74
+ # This must be an integer or a double value.
75
+ # If the field is not an integer or double, or if the field does not yet
76
+ # exist, the transformation will set the field to the given value.
77
+ # If either of the given value or the current field value are doubles,
78
+ # both values will be interpreted as doubles. Double arithmetic and
79
+ # representation of double values follow IEEE 754 semantics.
80
+ # If there is positive/negative integer overflow, the field is resolved
81
+ # to the largest magnitude positive/negative integer.
82
+ # @!attribute [rw] maximum
83
+ # @return [Google::Firestore::V1beta1::Value]
84
+ # Sets the field to the maximum of its current value and the given value.
85
+ #
86
+ # This must be an integer or a double value.
87
+ # If the field is not an integer or double, or if the field does not yet
88
+ # exist, the transformation will set the field to the given value.
89
+ # If a maximum operation is applied where the field and the input value
90
+ # are of mixed types (that is - one is an integer and one is a double)
91
+ # the field takes on the type of the larger operand. If the operands are
92
+ # equivalent (e.g. 3 and 3.0), the field does not change.
93
+ # 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
94
+ # zero input value is always the stored value.
95
+ # The maximum of any numeric value x and NaN is NaN.
96
+ # @!attribute [rw] minimum
97
+ # @return [Google::Firestore::V1beta1::Value]
98
+ # Sets the field to the minimum of its current value and the given value.
99
+ #
100
+ # This must be an integer or a double value.
101
+ # If the field is not an integer or double, or if the field does not yet
102
+ # exist, the transformation will set the field to the input value.
103
+ # If a minimum operation is applied where the field and the input value
104
+ # are of mixed types (that is - one is an integer and one is a double)
105
+ # the field takes on the type of the smaller operand. If the operands are
106
+ # equivalent (e.g. 3 and 3.0), the field does not change.
107
+ # 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
108
+ # zero input value is always the stored value.
109
+ # The minimum of any numeric value x and NaN is NaN.
70
110
  # @!attribute [rw] append_missing_elements
71
111
  # @return [Google::Firestore::V1beta1::ArrayValue]
72
112
  # Append the given elements in order if they are not already present in
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -15,38 +15,6 @@
15
15
 
16
16
  module Google
17
17
  module Protobuf
18
- # Wrapper message for `double`.
19
- #
20
- # The JSON representation for `DoubleValue` is JSON number.
21
- # @!attribute [rw] value
22
- # @return [Float]
23
- # The double value.
24
- class DoubleValue; end
25
-
26
- # Wrapper message for `float`.
27
- #
28
- # The JSON representation for `FloatValue` is JSON number.
29
- # @!attribute [rw] value
30
- # @return [Float]
31
- # The float value.
32
- class FloatValue; end
33
-
34
- # Wrapper message for `int64`.
35
- #
36
- # The JSON representation for `Int64Value` is JSON string.
37
- # @!attribute [rw] value
38
- # @return [Integer]
39
- # The int64 value.
40
- class Int64Value; end
41
-
42
- # Wrapper message for `uint64`.
43
- #
44
- # The JSON representation for `UInt64Value` is JSON string.
45
- # @!attribute [rw] value
46
- # @return [Integer]
47
- # The uint64 value.
48
- class UInt64Value; end
49
-
50
18
  # Wrapper message for `int32`.
51
19
  #
52
20
  # The JSON representation for `Int32Value` is JSON number.
@@ -54,37 +22,5 @@ module Google
54
22
  # @return [Integer]
55
23
  # The int32 value.
56
24
  class Int32Value; end
57
-
58
- # Wrapper message for `uint32`.
59
- #
60
- # The JSON representation for `UInt32Value` is JSON number.
61
- # @!attribute [rw] value
62
- # @return [Integer]
63
- # The uint32 value.
64
- class UInt32Value; end
65
-
66
- # Wrapper message for `bool`.
67
- #
68
- # The JSON representation for `BoolValue` is JSON `true` and `false`.
69
- # @!attribute [rw] value
70
- # @return [true, false]
71
- # The bool value.
72
- class BoolValue; end
73
-
74
- # Wrapper message for `string`.
75
- #
76
- # The JSON representation for `StringValue` is JSON string.
77
- # @!attribute [rw] value
78
- # @return [String]
79
- # The string value.
80
- class StringValue; end
81
-
82
- # Wrapper message for `bytes`.
83
- #
84
- # The JSON representation for `BytesValue` is JSON string.
85
- # @!attribute [rw] value
86
- # @return [String]
87
- # The bytes value.
88
- class BytesValue; end
89
25
  end
90
26
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@
77
77
  "RunQuery": {
78
78
  "timeout_millis": 60000,
79
79
  "retry_codes_name": "idempotent",
80
- "retry_params_name": "default"
80
+ "retry_params_name": "streaming"
81
81
  },
82
82
  "Write": {
83
83
  "timeout_millis": 86400000,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Firestore
19
- VERSION = "0.24.2".freeze
19
+ VERSION = "0.25.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "thread"
17
-
18
16
  module Google
19
17
  module Cloud
20
18
  module Firestore
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/firestore/v1beta1"
16
+ require "google/cloud/firestore/v1"
17
17
  require "google/cloud/firestore/convert"
18
18
  require "google/cloud/firestore/document_reference"
19
19
  require "google/cloud/firestore/document_snapshot"
@@ -39,7 +39,7 @@ module Google
39
39
  @client = client
40
40
  @query = query
41
41
  @pending = {
42
- add: [],
42
+ add: [],
43
43
  delete: []
44
44
  }
45
45
  @current = nil
@@ -13,12 +13,11 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/firestore/v1beta1"
16
+ require "google/cloud/firestore/v1"
17
17
  require "google/cloud/firestore/convert"
18
18
  require "google/cloud/firestore/watch/enumerator_queue"
19
19
  require "google/cloud/firestore/watch/inventory"
20
20
  require "monitor"
21
- require "thread"
22
21
 
23
22
  module Google
24
23
  module Cloud
@@ -35,13 +34,13 @@ module Google
35
34
  raise ArgumentError if doc_ref.nil?
36
35
  raise ArgumentError if callback.nil?
37
36
 
38
- init_listen_req = Google::Firestore::V1beta1::ListenRequest.new(
39
- database: doc_ref.client.path,
40
- add_target: Google::Firestore::V1beta1::Target.new(
41
- documents: \
42
- Google::Firestore::V1beta1::Target::DocumentsTarget.new(
43
- documents: [doc_ref.path]
44
- )
37
+ documents = Google::Firestore::V1::Target::DocumentsTarget.new(
38
+ documents: [doc_ref.path]
39
+ )
40
+ init_listen_req = Google::Firestore::V1::ListenRequest.new(
41
+ database: doc_ref.client.path,
42
+ add_target: Google::Firestore::V1::Target.new(
43
+ documents: documents
45
44
  )
46
45
  )
47
46
 
@@ -52,11 +51,11 @@ module Google
52
51
  raise ArgumentError if query.nil?
53
52
  raise ArgumentError if callback.nil?
54
53
 
55
- init_listen_req = Google::Firestore::V1beta1::ListenRequest.new(
56
- database: query.client.path,
57
- add_target: Google::Firestore::V1beta1::Target.new(
58
- query: Google::Firestore::V1beta1::Target::QueryTarget.new(
59
- parent: query.parent_path,
54
+ init_listen_req = Google::Firestore::V1::ListenRequest.new(
55
+ database: query.client.path,
56
+ add_target: Google::Firestore::V1::Target.new(
57
+ query: Google::Firestore::V1::Target::QueryTarget.new(
58
+ parent: query.parent_path,
60
59
  structured_query: query.query
61
60
  )
62
61
  )
@@ -224,7 +223,7 @@ module Google
224
223
  raise RestartStream # Raise to restart the stream
225
224
  end
226
225
  when :document_change
227
- # A {Google::Firestore::V1beta1::Document Document} has changed.
226
+ # A {Google::Firestore::V1::Document Document} has changed.
228
227
 
229
228
  if response.document_change.removed_target_ids.any?
230
229
  @inventory.delete response.document_change.document.name
@@ -232,12 +231,12 @@ module Google
232
231
  @inventory.add response.document_change.document
233
232
  end
234
233
  when :document_delete
235
- # A {Google::Firestore::V1beta1::Document Document} has been
234
+ # A {Google::Firestore::V1::Document Document} has been
236
235
  # deleted.
237
236
 
238
237
  @inventory.delete response.document_delete.document
239
238
  when :document_remove
240
- # A {Google::Firestore::V1beta1::Document Document} has been
239
+ # A {Google::Firestore::V1::Document Document} has been
241
240
  # removed from a target (because it is no longer relevant to
242
241
  # that target).
243
242
 
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/firestore/v1beta1"
16
+ require "google/cloud/firestore/v1"
17
17
  require "google/cloud/firestore/convert"
18
18
  require "google/cloud/firestore/document_reference"
19
19
  require "google/cloud/firestore/document_snapshot"