statelydb 0.28.0 → 0.30.0

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: 9b94f8450c52c3516c73d06b1a031eda14b971cc357c8a8dcd5194864ecfdf89
4
- data.tar.gz: 33ed8865a216af57d1ea99ffe9c24cd37a078e2ba555d3a04b654e8f25f9fdb3
3
+ metadata.gz: e351019a0ad023595d08e9bf19a94facc2d1b92d00682516b929a2fe7c5593f7
4
+ data.tar.gz: d347e52bee873414dfa4709d9be9a3a6fae27cbb0482a369bc725224c863eea5
5
5
  SHA512:
6
- metadata.gz: 1e163f64ad570dff9ace904d59137e2134a215d28da6540422943ba6b9b4ea2c23b95863aa6195e84ec06e617a3b494f487851174fe6bf6e05eb5bb09d9a3f88
7
- data.tar.gz: bc39bdaa7a57f7e7610cfdbd3b0bc088086d166f122f7355cc57db01c6cfd8d119a2a470a4ff103f38aefa3f43b1493958e39be0d3f6b342fb97c1d99df0ae23
6
+ metadata.gz: faf9e62e260a7c05b57071ae982105d03de3edc23137d5c068e9478afa5a5c03ed2367caca7f698a41c8b9e71862b49006ce6898db1a828bb5ec393df6d8eccf
7
+ data.tar.gz: e731ba43fdb7699136c2ffdd82f2ff6e2a1b83fe317371ccfb994f657b3a3260d04d5246e1e518470a48e8f9b1295c4118b220a3a2bdb90b24b578cdde82b708
@@ -5,7 +5,7 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x15\x64\x62/list_filters.proto\x12\nstately.db\"9\n\x0f\x46ilterCondition\x12\x1d\n\titem_type\x18\x01 \x01(\tH\x00R\x08itemTypeB\x07\n\x05valueBk\n\x0e\x63om.stately.dbB\x10ListFiltersProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
8
+ descriptor_data = "\n\x15\x64\x62/list_filters.proto\x12\nstately.db\"}\n\x0f\x46ilterCondition\x12\x1d\n\titem_type\x18\x01 \x01(\tH\x00R\x08itemType\x12\x42\n\x0e\x63\x65l_expression\x18\x02 \x01(\x0b\x32\x19.stately.db.CelExpressionH\x00R\rcelExpressionB\x07\n\x05value\"L\n\rCelExpression\x12\x1b\n\titem_type\x18\x01 \x01(\tR\x08itemType\x12\x1e\n\nexpression\x18\x02 \x01(\tR\nexpressionBk\n\x0e\x63om.stately.dbB\x10ListFiltersProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
9
9
 
10
10
  pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
11
  pool.add_serialized_file(descriptor_data)
@@ -13,5 +13,6 @@ pool.add_serialized_file(descriptor_data)
13
13
  module Stately
14
14
  module Db
15
15
  FilterCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.FilterCondition").msgclass
16
+ CelExpression = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.CelExpression").msgclass
16
17
  end
17
18
  end
@@ -15,7 +15,7 @@ require 'api/db/put_pb'
15
15
  require 'google/protobuf/empty_pb'
16
16
 
17
17
 
18
- descriptor_data = "\n\x14\x64\x62/transaction.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\xa3\x02\n\x14TransactionBeginList\x12&\n\x0fkey_path_prefix\x18\x01 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x02 \x01(\rR\x05limit\x12\x41\n\rsort_property\x18\x03 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x04 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12H\n\x11\x66ilter_conditions\x18\t \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x10\x66ilterConditions\"y\n\x17TransactionContinueList\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x04 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\"9\n\x0eTransactionPut\x12\'\n\x04puts\x18\x01 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\"E\n\x11TransactionDelete\x12\x30\n\x07\x64\x65letes\x18\x01 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\"@\n\x16TransactionGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\"D\n\x0bGeneratedID\x12\x14\n\x04uint\x18\x01 \x01(\x04H\x00R\x04uint\x12\x16\n\x05\x62ytes\x18\x02 \x01(\x0cH\x00R\x05\x62ytesB\x07\n\x05value\"Q\n\x11TransactionPutAck\x12<\n\rgenerated_ids\x18\x01 \x03(\x0b\x32\x17.stately.db.GeneratedIDR\x0cgeneratedIds\"\x96\x01\n\x17TransactionListResponse\x12\x37\n\x06result\x18\x01 \x01(\x0b\x32\x1d.stately.db.ListPartialResultH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x02 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\"\xa7\x01\n\x13TransactionFinished\x12\x1c\n\tcommitted\x18\x01 \x01(\x08R\tcommitted\x12\x31\n\x0bput_results\x18\x02 \x03(\x0b\x32\x10.stately.db.ItemR\nputResults\x12?\n\x0e\x64\x65lete_results\x18\x03 \x03(\x0b\x32\x18.stately.db.DeleteResultR\rdeleteResultsBk\n\x0e\x63om.stately.dbB\x10TransactionProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
18
+ descriptor_data = "\n\x14\x64\x62/transaction.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\xe4\x02\n\x14TransactionBeginList\x12&\n\x0fkey_path_prefix\x18\x01 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x02 \x01(\rR\x05limit\x12\x41\n\rsort_property\x18\x03 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x04 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12H\n\x11\x66ilter_conditions\x18\t \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x10\x66ilterConditions\x12?\n\x0ekey_conditions\x18\n \x03(\x0b\x32\x18.stately.db.KeyConditionR\rkeyConditions\"y\n\x17TransactionContinueList\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x04 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\"9\n\x0eTransactionPut\x12\'\n\x04puts\x18\x01 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\"E\n\x11TransactionDelete\x12\x30\n\x07\x64\x65letes\x18\x01 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\"@\n\x16TransactionGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\"D\n\x0bGeneratedID\x12\x14\n\x04uint\x18\x01 \x01(\x04H\x00R\x04uint\x12\x16\n\x05\x62ytes\x18\x02 \x01(\x0cH\x00R\x05\x62ytesB\x07\n\x05value\"Q\n\x11TransactionPutAck\x12<\n\rgenerated_ids\x18\x01 \x03(\x0b\x32\x17.stately.db.GeneratedIDR\x0cgeneratedIds\"\x96\x01\n\x17TransactionListResponse\x12\x37\n\x06result\x18\x01 \x01(\x0b\x32\x1d.stately.db.ListPartialResultH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x02 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\"\xa7\x01\n\x13TransactionFinished\x12\x1c\n\tcommitted\x18\x01 \x01(\x08R\tcommitted\x12\x31\n\x0bput_results\x18\x02 \x03(\x0b\x32\x10.stately.db.ItemR\nputResults\x12?\n\x0e\x64\x65lete_results\x18\x03 \x03(\x0b\x32\x18.stately.db.DeleteResultR\rdeleteResultsBk\n\x0e\x63om.stately.dbB\x10TransactionProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
19
19
 
20
20
  pool = ::Google::Protobuf::DescriptorPool.generated_pool
21
21
  pool.add_serialized_file(descriptor_data)
data/lib/key_path.rb CHANGED
@@ -47,7 +47,8 @@ module StatelyDB
47
47
  new.with(namespace, identifier)
48
48
  end
49
49
 
50
- # If the value is a binary string, encode it as a url-safe base64 string with padding removed.
50
+ # If the value is a binary string, encode it as a url-safe
51
+ # base64 string with padding removed.
51
52
  #
52
53
  # @param value [String, StatelyDB::UUID, #to_s] The value to convert to a key id.
53
54
  # @return [String]
data/lib/statelydb.rb CHANGED
@@ -84,7 +84,7 @@ module StatelyDB
84
84
 
85
85
  # Fetch a single Item from a StatelyDB Store at the given key_path.
86
86
  #
87
- # @param key_path [String] the path to the item
87
+ # @param key_path [StatelyDB::KeyPath, String] the path to the item
88
88
  # @return [StatelyDB::Item, NilClass] the Item or nil if not found
89
89
  # @raise [StatelyDB::Error] if the parameters are invalid or if the item is not found
90
90
  #
@@ -99,7 +99,8 @@ module StatelyDB
99
99
 
100
100
  # Fetch a batch of up to 100 Items from a StatelyDB Store at the given key_paths.
101
101
  #
102
- # @param key_paths [String, Array<String>] the paths to the items. Max 100 key paths.
102
+ # @param key_paths [StatelyDB::KeyPath, String, Array<StatelyDB::KeyPath, String>] the paths
103
+ # to the items. Max 100 key paths.
103
104
  # @return [Array<StatelyDB::Item>, NilClass] the items or nil if not found
104
105
  # @raise [StatelyDB::Error] if the parameters are invalid or if the item is not found
105
106
  #
@@ -124,10 +125,21 @@ module StatelyDB
124
125
 
125
126
  # Begin listing Items from a StatelyDB Store at the given prefix.
126
127
  #
127
- # @param prefix [String] the prefix to list
128
+ # @param prefix [StatelyDB::KeyPath, String] the prefix to list
128
129
  # @param limit [Integer] the maximum number of items to return
129
130
  # @param sort_property [String] the property to sort by
130
- # @param sort_direction [Symbol] the direction to sort by (:ascending or :descending)
131
+ # @param sort_direction [Symbol, String, Integer] the direction to sort by (:ascending or :descending)
132
+ # @param item_types [Array<Class, String>] the item types to filter by. The returned
133
+ # items will be instances of one of these types.
134
+ # @param gt [StatelyDB::KeyPath | String] filters results to only include items with a key greater than the
135
+ # specified value based on lexicographic ordering.
136
+ # @param gte [StatelyDB::KeyPath | String] filters results to only include items with a key greater than or equal to the
137
+ # specified value based on lexicographic ordering.
138
+ # @param lt [StatelyDB::KeyPath | String] filters results to only include items with a key less than the
139
+ # specified value based on lexicographic ordering.
140
+ # @param lte [StatelyDB::KeyPath | String] filters results to only include items with a key less than or equal to the
141
+ # specified value based on lexicographic ordering.
142
+
131
143
  # @return [Array<StatelyDB::Item>, StatelyDB::Token] the list of Items and the token
132
144
  #
133
145
  # @example
@@ -135,15 +147,32 @@ module StatelyDB
135
147
  def begin_list(prefix,
136
148
  limit: 100,
137
149
  sort_property: nil,
138
- sort_direction: :ascending)
150
+ sort_direction: :ascending,
151
+ item_types: [],
152
+ gt: nil,
153
+ gte: nil,
154
+ lt: nil,
155
+ lte: nil)
139
156
  sort_direction = sort_direction == :ascending ? 0 : 1
140
-
157
+ key_condition_params = [
158
+ [Stately::Db::Operator::OPERATOR_GREATER_THAN, gt.is_a?(String) ? gt : gt&.to_s],
159
+ [Stately::Db::Operator::OPERATOR_GREATER_THAN_OR_EQUAL, gte.is_a?(String) ? gte : gte&.to_s],
160
+ [Stately::Db::Operator::OPERATOR_LESS_THAN, lt.is_a?(String) ? lt : lt&.to_s],
161
+ [Stately::Db::Operator::OPERATOR_LESS_THAN_OR_EQUAL, lte.is_a?(String) ? lte : lte&.to_s]
162
+ ]
163
+ key_conditions = key_condition_params
164
+ .reject { |(_, value)| value.nil? }
165
+ .map { |(operator, key_path)| Stately::Db::KeyCondition.new(operator: operator, key_path: key_path) }
141
166
  req = Stately::Db::BeginListRequest.new(
142
167
  store_id: @store_id,
143
168
  key_path_prefix: String(prefix),
144
169
  limit:,
145
170
  sort_property:,
146
171
  sort_direction:,
172
+ filter_conditions: item_types.map do |item_type|
173
+ Stately::Db::FilterCondition.new(item_type: item_type.respond_to?(:name) ? item_type.name.split("::").last : item_type)
174
+ end,
175
+ key_conditions: key_conditions,
147
176
  allow_stale: @allow_stale,
148
177
  schema_id: @schema::SCHEMA_ID,
149
178
  schema_version_id: @schema::SCHEMA_VERSION_ID
@@ -322,7 +351,8 @@ module StatelyDB
322
351
 
323
352
  # Delete up to 50 Items from a StatelyDB Store at the given key_paths.
324
353
  #
325
- # @param key_paths [String, Array<String>] the paths to the items. Max 50 key paths.
354
+ # @param key_paths [StatelyDB::KeyPath, String, Array<StatelyDB::KeyPath, String>] the paths
355
+ # to the items. Max 50 key paths.
326
356
  # @raise [StatelyDB::Error] if the parameters are invalid
327
357
  # @raise [StatelyDB::Error] if the item is not found
328
358
  # @return [void] nil
@@ -178,7 +178,7 @@ module StatelyDB
178
178
  # Fetch Items from a StatelyDB Store at the given key_path. Note that Items need to exist before being retrieved inside a
179
179
  # transaction.
180
180
  #
181
- # @param key_path [String] the path to the item
181
+ # @param key_path [StatelyDB::KeyPath, String] the path to the item
182
182
  # @return [StatelyDB::Item, NilClass] the item or nil if not found
183
183
  # @raise [StatelyDB::Error::InvalidParameters] if the parameters are invalid
184
184
  # @raise [StatelyDB::Error::NotFound] if the item is not found
@@ -198,7 +198,7 @@ module StatelyDB
198
198
  # key_paths. Note that Items need to exist before being retrieved inside a
199
199
  # transaction.
200
200
  #
201
- # @param key_paths [String, Array<String>] the paths to the items. Max 100
201
+ # @param key_paths [StatelyDB::KeyPath, String, Array<StatelyDB::KeyPath, String>] the paths to the items. Max 100
202
202
  # key paths.
203
203
  # @return [Array<StatelyDB::Item>] the items
204
204
  # @raise [StatelyDB::Error::InvalidParameters] if the parameters are invalid
@@ -310,7 +310,8 @@ module StatelyDB
310
310
  # Delete up to 50 Items from a StatelyDB Store at the given key_paths. Results are not returned until the transaction is
311
311
  # committed and will be available in the Result object returned by commit.
312
312
  #
313
- # @param key_paths [String, Array<String>] the paths to the items. Max 50 key paths.
313
+ # @param key_paths [StatelyDB::KeyPath, String, Array<StatelyDB::KeyPath, String>] the paths
314
+ # to the items. Max 50 key paths.
314
315
  # @return [void] nil
315
316
  #
316
317
  # Example:
@@ -330,10 +331,21 @@ module StatelyDB
330
331
 
331
332
  # Begin listing Items from a StatelyDB Store at the given prefix.
332
333
  #
333
- # @param prefix [String] the prefix to list
334
+ # @param prefix [StatelyDB::KeyPath, String] the prefix to list
334
335
  # @param limit [Integer] the maximum number of items to return
335
336
  # @param sort_property [String] the property to sort by
336
337
  # @param sort_direction [Symbol] the direction to sort by (:ascending or :descending)
338
+ # @param item_types [Array<Class, String>] the item types to filter by. The returned
339
+ # items will be instances of one of these types.
340
+ # @param gt [StatelyDB::KeyPath | String] filters results to only include items with a key greater than the
341
+ # specified value based on lexicographic ordering.
342
+ # @param gte [StatelyDB::KeyPath | String] filters results to only include items with a key greater than or equal to the
343
+ # specified value based on lexicographic ordering.
344
+ # @param lt [StatelyDB::KeyPath | String] filters results to only include items with a key less than the
345
+ # specified value based on lexicographic ordering.
346
+ # @param lte [StatelyDB::KeyPath | String] filters results to only include items with a key less than or equal to the
347
+ # specified value based on lexicographic ordering.
348
+
337
349
  # @return [Array(Array<StatelyDB::Item>, ::Stately::Db::ListToken)] the list of Items and the token
338
350
  #
339
351
  # Example:
@@ -344,19 +356,42 @@ module StatelyDB
344
356
  def begin_list(prefix,
345
357
  limit: 100,
346
358
  sort_property: nil,
347
- sort_direction: :ascending)
359
+ sort_direction: :ascending,
360
+ item_types: [],
361
+ gt: nil,
362
+ gte: nil,
363
+ lt: nil,
364
+ lte: nil)
348
365
  sort_direction = case sort_direction
349
366
  when :ascending
350
367
  0
351
368
  else
352
369
  1
353
370
  end
371
+ key_condition_params = [
372
+ [Stately::Db::Operator::OPERATOR_GREATER_THAN, gt.is_a?(String) ? gt : gt&.to_s],
373
+ [Stately::Db::Operator::OPERATOR_GREATER_THAN_OR_EQUAL, gte.is_a?(String) ? gte : gte&.to_s],
374
+ [Stately::Db::Operator::OPERATOR_LESS_THAN, lt.is_a?(String) ? lt : lt&.to_s],
375
+ [Stately::Db::Operator::OPERATOR_LESS_THAN_OR_EQUAL, lte.is_a?(String) ? lte : lte&.to_s]
376
+ ]
377
+ key_conditions = key_condition_params
378
+ .reject { |(_, value)| value.nil? }
379
+ .map do |(operator, key_path)|
380
+ Stately::Db::KeyCondition.new(operator: operator,
381
+ key_path: key_path)
382
+ end
354
383
  req = Stately::Db::TransactionRequest.new(
355
384
  begin_list: Stately::Db::TransactionBeginList.new(
356
385
  key_path_prefix: String(prefix),
357
386
  limit:,
358
387
  sort_property:,
359
- sort_direction:
388
+ sort_direction:,
389
+ filter_conditions: item_types.map do |item_type|
390
+ Stately::Db::FilterCondition.new(
391
+ item_type: item_type.respond_to?(:name) ? item_type.name.split("::").last : item_type
392
+ )
393
+ end,
394
+ key_conditions: key_conditions
360
395
  )
361
396
  )
362
397
  do_list_request_response(req)
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StatelyDB
4
- VERSION = "0.28.0"
4
+ VERSION = "0.30.0"
5
5
  end
@@ -8,29 +8,55 @@ class Stately::Db::FilterCondition
8
8
 
9
9
  sig do
10
10
  params(
11
- item_type: T.nilable(String)
11
+ item_type: T.nilable(String),
12
+ cel_expression: T.nilable(Stately::Db::CelExpression)
12
13
  ).void
13
14
  end
14
15
  def initialize(
15
- item_type: ""
16
+ item_type: "",
17
+ cel_expression: nil
16
18
  )
17
19
  end
18
20
 
19
- # item_type is the type of item to filter by.
21
+ # item_type is the type of item to include in a query response.
20
22
  sig { returns(String) }
21
23
  def item_type
22
24
  end
23
25
 
24
- # item_type is the type of item to filter by.
26
+ # item_type is the type of item to include in a query response.
25
27
  sig { params(value: String).void }
26
28
  def item_type=(value)
27
29
  end
28
30
 
29
- # item_type is the type of item to filter by.
31
+ # item_type is the type of item to include in a query response.
30
32
  sig { void }
31
33
  def clear_item_type
32
34
  end
33
35
 
36
+ # cel_expression is a CEL expression to evaluate against a specific item type.
37
+ # If an expression evaluates to true, the item is included in the results.
38
+ # This expression *only* applies to the item type specified in the
39
+ # CelExpression.item_type field, and is not applied to other item types in the query.
40
+ sig { returns(T.nilable(Stately::Db::CelExpression)) }
41
+ def cel_expression
42
+ end
43
+
44
+ # cel_expression is a CEL expression to evaluate against a specific item type.
45
+ # If an expression evaluates to true, the item is included in the results.
46
+ # This expression *only* applies to the item type specified in the
47
+ # CelExpression.item_type field, and is not applied to other item types in the query.
48
+ sig { params(value: T.nilable(Stately::Db::CelExpression)).void }
49
+ def cel_expression=(value)
50
+ end
51
+
52
+ # cel_expression is a CEL expression to evaluate against a specific item type.
53
+ # If an expression evaluates to true, the item is included in the results.
54
+ # This expression *only* applies to the item type specified in the
55
+ # CelExpression.item_type field, and is not applied to other item types in the query.
56
+ sig { void }
57
+ def clear_cel_expression
58
+ end
59
+
34
60
  sig { returns(T.nilable(Symbol)) }
35
61
  def value
36
62
  end
@@ -67,3 +93,100 @@ class Stately::Db::FilterCondition
67
93
  def self.descriptor
68
94
  end
69
95
  end
96
+
97
+ class Stately::Db::CelExpression
98
+ include ::Google::Protobuf::MessageExts
99
+ extend ::Google::Protobuf::MessageExts::ClassMethods
100
+
101
+ sig do
102
+ params(
103
+ item_type: T.nilable(String),
104
+ expression: T.nilable(String)
105
+ ).void
106
+ end
107
+ def initialize(
108
+ item_type: "",
109
+ expression: ""
110
+ )
111
+ end
112
+
113
+ # item_type is the itemType to evaluate the expression against.
114
+ sig { returns(String) }
115
+ def item_type
116
+ end
117
+
118
+ # item_type is the itemType to evaluate the expression against.
119
+ sig { params(value: String).void }
120
+ def item_type=(value)
121
+ end
122
+
123
+ # item_type is the itemType to evaluate the expression against.
124
+ sig { void }
125
+ def clear_item_type
126
+ end
127
+
128
+ # expression is the CEL expression to evaluate.
129
+ # If the expression evaluates to true, the item is included in the results,
130
+ # otherwise it is excluded.
131
+ #
132
+ # In the context of the CEL expression, 'this' refers to the item being evaluated.
133
+ # For example, the expression is "this.foo == 'bar'" means that the item
134
+ # must have a property 'foo' with the value 'bar' to be included in the results.
135
+ sig { returns(String) }
136
+ def expression
137
+ end
138
+
139
+ # expression is the CEL expression to evaluate.
140
+ # If the expression evaluates to true, the item is included in the results,
141
+ # otherwise it is excluded.
142
+ #
143
+ # In the context of the CEL expression, 'this' refers to the item being evaluated.
144
+ # For example, the expression is "this.foo == 'bar'" means that the item
145
+ # must have a property 'foo' with the value 'bar' to be included in the results.
146
+ sig { params(value: String).void }
147
+ def expression=(value)
148
+ end
149
+
150
+ # expression is the CEL expression to evaluate.
151
+ # If the expression evaluates to true, the item is included in the results,
152
+ # otherwise it is excluded.
153
+ #
154
+ # In the context of the CEL expression, 'this' refers to the item being evaluated.
155
+ # For example, the expression is "this.foo == 'bar'" means that the item
156
+ # must have a property 'foo' with the value 'bar' to be included in the results.
157
+ sig { void }
158
+ def clear_expression
159
+ end
160
+
161
+ sig { params(field: String).returns(T.untyped) }
162
+ def [](field)
163
+ end
164
+
165
+ sig { params(field: String, value: T.untyped).void }
166
+ def []=(field, value)
167
+ end
168
+
169
+ sig { returns(T::Hash[Symbol, T.untyped]) }
170
+ def to_h
171
+ end
172
+
173
+ sig { params(str: String).returns(Stately::Db::CelExpression) }
174
+ def self.decode(str)
175
+ end
176
+
177
+ sig { params(msg: Stately::Db::CelExpression).returns(String) }
178
+ def self.encode(msg)
179
+ end
180
+
181
+ sig { params(str: String, kw: T.untyped).returns(Stately::Db::CelExpression) }
182
+ def self.decode_json(str, **kw)
183
+ end
184
+
185
+ sig { params(msg: Stately::Db::CelExpression, kw: T.untyped).returns(String) }
186
+ def self.encode_json(msg, **kw)
187
+ end
188
+
189
+ sig { returns(::Google::Protobuf::Descriptor) }
190
+ def self.descriptor
191
+ end
192
+ end
@@ -619,7 +619,8 @@ class Stately::Db::TransactionBeginList
619
619
  limit: T.nilable(Integer),
620
620
  sort_property: T.nilable(T.any(Symbol, String, Integer)),
621
621
  sort_direction: T.nilable(T.any(Symbol, String, Integer)),
622
- filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)])
622
+ filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)]),
623
+ key_conditions: T.nilable(T::Array[T.nilable(Stately::Db::KeyCondition)])
623
624
  ).void
624
625
  end
625
626
  def initialize(
@@ -627,7 +628,8 @@ class Stately::Db::TransactionBeginList
627
628
  limit: 0,
628
629
  sort_property: :SORTABLE_PROPERTY_KEY_PATH,
629
630
  sort_direction: :SORT_ASCENDING,
630
- filter_conditions: []
631
+ filter_conditions: [],
632
+ key_conditions: []
631
633
  )
632
634
  end
633
635
 
@@ -730,6 +732,102 @@ class Stately::Db::TransactionBeginList
730
732
  def clear_filter_conditions
731
733
  end
732
734
 
735
+ # key_conditions are a set of conditions to apply to the list operation.
736
+ # Wherever possible, Stately will apply these key conditions at the DB layer
737
+ # to optimize the list operation cost.
738
+ #
739
+ # A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
740
+ # operator and one with a LESS_THAN (or equal to) operator. Together these amount to
741
+ # a "between" condition on the key path.
742
+ #
743
+ # If these conditions are provided they must share the same prefix as the
744
+ # key_path_prefix. For example this is valid:
745
+ #
746
+ # key_path_prefix: "/group-:groupID/namespace"
747
+ # key_conditions:
748
+ # - key_path: "/group-:groupID/namespace-44"
749
+ # operator: GREATER_THAN_OR_EQUAL
750
+ # - key_path: "/group-:groupID/namespace-100"
751
+ # operator: LESS_THAN_OR_EQUAL
752
+ #
753
+ # A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
754
+ # with the key conditions.
755
+ #
756
+ # The following is NOT valid because the key_path_prefix does not
757
+ # share the same prefix as the key conditions:
758
+ #
759
+ # key_path_prefix: "/group-:groupID/namespace"
760
+ # key_conditions:
761
+ # - key_path: "/group-:groupID/beatles-1984"
762
+ # operator: GREATER_THAN_OR_EQUAL
763
+ sig { returns(T::Array[T.nilable(Stately::Db::KeyCondition)]) }
764
+ def key_conditions
765
+ end
766
+
767
+ # key_conditions are a set of conditions to apply to the list operation.
768
+ # Wherever possible, Stately will apply these key conditions at the DB layer
769
+ # to optimize the list operation cost.
770
+ #
771
+ # A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
772
+ # operator and one with a LESS_THAN (or equal to) operator. Together these amount to
773
+ # a "between" condition on the key path.
774
+ #
775
+ # If these conditions are provided they must share the same prefix as the
776
+ # key_path_prefix. For example this is valid:
777
+ #
778
+ # key_path_prefix: "/group-:groupID/namespace"
779
+ # key_conditions:
780
+ # - key_path: "/group-:groupID/namespace-44"
781
+ # operator: GREATER_THAN_OR_EQUAL
782
+ # - key_path: "/group-:groupID/namespace-100"
783
+ # operator: LESS_THAN_OR_EQUAL
784
+ #
785
+ # A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
786
+ # with the key conditions.
787
+ #
788
+ # The following is NOT valid because the key_path_prefix does not
789
+ # share the same prefix as the key conditions:
790
+ #
791
+ # key_path_prefix: "/group-:groupID/namespace"
792
+ # key_conditions:
793
+ # - key_path: "/group-:groupID/beatles-1984"
794
+ # operator: GREATER_THAN_OR_EQUAL
795
+ sig { params(value: ::Google::Protobuf::RepeatedField).void }
796
+ def key_conditions=(value)
797
+ end
798
+
799
+ # key_conditions are a set of conditions to apply to the list operation.
800
+ # Wherever possible, Stately will apply these key conditions at the DB layer
801
+ # to optimize the list operation cost.
802
+ #
803
+ # A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
804
+ # operator and one with a LESS_THAN (or equal to) operator. Together these amount to
805
+ # a "between" condition on the key path.
806
+ #
807
+ # If these conditions are provided they must share the same prefix as the
808
+ # key_path_prefix. For example this is valid:
809
+ #
810
+ # key_path_prefix: "/group-:groupID/namespace"
811
+ # key_conditions:
812
+ # - key_path: "/group-:groupID/namespace-44"
813
+ # operator: GREATER_THAN_OR_EQUAL
814
+ # - key_path: "/group-:groupID/namespace-100"
815
+ # operator: LESS_THAN_OR_EQUAL
816
+ #
817
+ # A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
818
+ # with the key conditions.
819
+ #
820
+ # The following is NOT valid because the key_path_prefix does not
821
+ # share the same prefix as the key conditions:
822
+ #
823
+ # key_path_prefix: "/group-:groupID/namespace"
824
+ # key_conditions:
825
+ # - key_path: "/group-:groupID/beatles-1984"
826
+ # operator: GREATER_THAN_OR_EQUAL
827
+ sig { void }
828
+ def clear_key_conditions
829
+ end
830
+
733
831
  sig { params(field: String).returns(T.untyped) }
734
832
  def [](field)
735
833
  end
data/rbi/statelydb.rbi CHANGED
@@ -182,7 +182,8 @@ module StatelyDB
182
182
  sig { params(namespace: String, identifier: T.nilable(T.any(String, StatelyDB::UUID, T.untyped))).returns(StatelyDB::KeyPath) }
183
183
  def self.with(namespace, identifier = nil); end
184
184
 
185
- # If the value is a binary string, encode it as a url-safe base64 string with padding removed.
185
+ # If the value is a binary string, encode it as a url-safe
186
+ # base64 string with padding removed.
186
187
  #
187
188
  # _@param_ `value` — The value to convert to a key id.
188
189
  sig { params(value: T.any(String, StatelyDB::UUID, T.untyped)).returns(String) }
@@ -244,7 +245,7 @@ module StatelyDB
244
245
  # ```ruby
245
246
  # client.get("/ItemType-identifier")
246
247
  # ```
247
- sig { params(key_path: String).returns(T.any(StatelyDB::Item, NilClass)) }
248
+ sig { params(key_path: T.any(StatelyDB::KeyPath, String)).returns(T.any(StatelyDB::Item, NilClass)) }
248
249
  def get(key_path); end
249
250
 
250
251
  # Fetch a batch of up to 100 Items from a StatelyDB Store at the given key_paths.
@@ -256,19 +257,9 @@ module StatelyDB
256
257
  # ```ruby
257
258
  # client.data.get_batch("/ItemType-identifier", "/ItemType-identifier2")
258
259
  # ```
259
- sig { params(key_paths: T.any(String, T::Array[String])).returns(T.any(T::Array[StatelyDB::Item], NilClass)) }
260
+ sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).returns(T.any(T::Array[StatelyDB::Item], NilClass)) }
260
261
  def get_batch(*key_paths); end
261
262
 
262
- # Begin listing Items from a StatelyDB Store at the given prefix.
263
- #
264
- # _@param_ `prefix` — the prefix to list
265
- #
266
- # _@param_ `limit` — the maximum number of items to return
267
- #
268
- # _@param_ `sort_property` — the property to sort by
269
- #
270
- # _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
271
- #
272
263
  # _@return_ — the list of Items and the token
273
264
  #
274
265
  # ```ruby
@@ -276,13 +267,18 @@ module StatelyDB
276
267
  # ```
277
268
  sig do
278
269
  params(
279
- prefix: String,
280
- limit: Integer,
281
- sort_property: T.nilable(String),
282
- sort_direction: Symbol
270
+ prefix: T.untyped,
271
+ limit: T.untyped,
272
+ sort_property: T.untyped,
273
+ sort_direction: T.untyped,
274
+ item_types: T.untyped,
275
+ gt: T.untyped,
276
+ gte: T.untyped,
277
+ lt: T.untyped,
278
+ lte: T.untyped
283
279
  ).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token))
284
280
  end
285
- def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending); end
281
+ def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], gt: nil, gte: nil, lt: nil, lte: nil); end
286
282
 
287
283
  # Continue listing Items from a StatelyDB Store using a token.
288
284
  #
@@ -404,7 +400,7 @@ module StatelyDB
404
400
  # ```ruby
405
401
  # client.data.delete("/ItemType-identifier", "/ItemType-identifier2")
406
402
  # ```
407
- sig { params(key_paths: T.any(String, T::Array[String])).void }
403
+ sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).void }
408
404
  def delete(*key_paths); end
409
405
 
410
406
  # Transaction takes a block and executes the block within a transaction.
@@ -931,7 +927,7 @@ module StatelyDB
931
927
  # item = txn.get("/ItemType-identifier")
932
928
  # end
933
929
  # ```
934
- sig { params(key_path: String).returns(T.any(StatelyDB::Item, NilClass)) }
930
+ sig { params(key_path: T.any(StatelyDB::KeyPath, String)).returns(T.any(StatelyDB::Item, NilClass)) }
935
931
  def get(key_path); end
936
932
 
937
933
  # Fetch a batch of up to 100 Items from a StatelyDB Store at the given
@@ -947,7 +943,7 @@ module StatelyDB
947
943
  # _@param_ `key_paths` — the paths to the items. Max 100
948
944
  #
949
945
  # _@return_ — the items
950
- sig { params(key_paths: T.any(String, T::Array[String])).returns(T::Array[StatelyDB::Item]) }
946
+ sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).returns(T::Array[StatelyDB::Item]) }
951
947
  def get_batch(*key_paths); end
952
948
 
953
949
  # Put a single Item into a StatelyDB store. Results are not returned until the transaction is
@@ -1007,35 +1003,30 @@ module StatelyDB
1007
1003
  # _@param_ `key_paths` — the paths to the items. Max 50 key paths.
1008
1004
  #
1009
1005
  # _@return_ — nil
1010
- sig { params(key_paths: T.any(String, T::Array[String])).void }
1006
+ sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).void }
1011
1007
  def delete(*key_paths); end
1012
1008
 
1013
- # Begin listing Items from a StatelyDB Store at the given prefix.
1014
- #
1015
1009
  # Example:
1016
1010
  # client.data.transaction do |txn|
1017
1011
  # (items, token) = txn.begin_list("/ItemType-identifier")
1018
1012
  # (items, token) = txn.continue_list(token)
1019
1013
  # end
1020
1014
  #
1021
- # _@param_ `prefix` — the prefix to list
1022
- #
1023
- # _@param_ `limit` — the maximum number of items to return
1024
- #
1025
- # _@param_ `sort_property` — the property to sort by
1026
- #
1027
- # _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
1028
- #
1029
1015
  # _@return_ — the list of Items and the token
1030
1016
  sig do
1031
1017
  params(
1032
- prefix: String,
1033
- limit: Integer,
1034
- sort_property: T.nilable(String),
1035
- sort_direction: Symbol
1018
+ prefix: T.untyped,
1019
+ limit: T.untyped,
1020
+ sort_property: T.untyped,
1021
+ sort_direction: T.untyped,
1022
+ item_types: T.untyped,
1023
+ gt: T.untyped,
1024
+ gte: T.untyped,
1025
+ lt: T.untyped,
1026
+ lte: T.untyped
1036
1027
  ).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken])
1037
1028
  end
1038
- def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending); end
1029
+ def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], gt: nil, gte: nil, lt: nil, lte: nil); end
1039
1030
 
1040
1031
  # Continue listing Items from a StatelyDB Store using a token.
1041
1032
  #
data/sig/statelydb.rbs CHANGED
@@ -151,7 +151,8 @@ module StatelyDB
151
151
  # ```
152
152
  def self.with: (String namespace, ?(String | StatelyDB::UUID | _ToS)? identifier) -> StatelyDB::KeyPath
153
153
 
154
- # If the value is a binary string, encode it as a url-safe base64 string with padding removed.
154
+ # If the value is a binary string, encode it as a url-safe
155
+ # base64 string with padding removed.
155
156
  #
156
157
  # _@param_ `value` — The value to convert to a key id.
157
158
  def self.to_key_id: ((String | StatelyDB::UUID | _ToS) value) -> String
@@ -207,7 +208,7 @@ module StatelyDB
207
208
  # ```ruby
208
209
  # client.get("/ItemType-identifier")
209
210
  # ```
210
- def get: (String key_path) -> (StatelyDB::Item | NilClass)
211
+ def get: ((StatelyDB::KeyPath | String) key_path) -> (StatelyDB::Item | NilClass)
211
212
 
212
213
  # Fetch a batch of up to 100 Items from a StatelyDB Store at the given key_paths.
213
214
  #
@@ -218,28 +219,23 @@ module StatelyDB
218
219
  # ```ruby
219
220
  # client.data.get_batch("/ItemType-identifier", "/ItemType-identifier2")
220
221
  # ```
221
- def get_batch: (*(String | ::Array[String]) key_paths) -> (::Array[StatelyDB::Item] | NilClass)
222
+ def get_batch: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> (::Array[StatelyDB::Item] | NilClass)
222
223
 
223
- # Begin listing Items from a StatelyDB Store at the given prefix.
224
- #
225
- # _@param_ `prefix` — the prefix to list
226
- #
227
- # _@param_ `limit` — the maximum number of items to return
228
- #
229
- # _@param_ `sort_property` — the property to sort by
230
- #
231
- # _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
232
- #
233
224
  # _@return_ — the list of Items and the token
234
225
  #
235
226
  # ```ruby
236
227
  # client.data.begin_list("/ItemType-identifier", limit: 10, sort_direction: :ascending)
237
228
  # ```
238
229
  def begin_list: (
239
- String prefix,
240
- ?limit: Integer,
241
- ?sort_property: String?,
242
- ?sort_direction: Symbol
230
+ untyped prefix,
231
+ ?limit: untyped,
232
+ ?sort_property: untyped,
233
+ ?sort_direction: untyped,
234
+ ?item_types: untyped,
235
+ ?gt: untyped,
236
+ ?gte: untyped,
237
+ ?lt: untyped,
238
+ ?lte: untyped
243
239
  ) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
244
240
 
245
241
  # Continue listing Items from a StatelyDB Store using a token.
@@ -354,7 +350,7 @@ module StatelyDB
354
350
  # ```ruby
355
351
  # client.data.delete("/ItemType-identifier", "/ItemType-identifier2")
356
352
  # ```
357
- def delete: (*(String | ::Array[String]) key_paths) -> void
353
+ def delete: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> void
358
354
 
359
355
  # Transaction takes a block and executes the block within a transaction.
360
356
  # If the block raises an exception, the transaction is rolled back.
@@ -817,7 +813,7 @@ module StatelyDB
817
813
  # item = txn.get("/ItemType-identifier")
818
814
  # end
819
815
  # ```
820
- def get: (String key_path) -> (StatelyDB::Item | NilClass)
816
+ def get: ((StatelyDB::KeyPath | String) key_path) -> (StatelyDB::Item | NilClass)
821
817
 
822
818
  # Fetch a batch of up to 100 Items from a StatelyDB Store at the given
823
819
  # key_paths. Note that Items need to exist before being retrieved inside a
@@ -832,7 +828,7 @@ module StatelyDB
832
828
  # _@param_ `key_paths` — the paths to the items. Max 100
833
829
  #
834
830
  # _@return_ — the items
835
- def get_batch: (*(String | ::Array[String]) key_paths) -> ::Array[StatelyDB::Item]
831
+ def get_batch: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> ::Array[StatelyDB::Item]
836
832
 
837
833
  # Put a single Item into a StatelyDB store. Results are not returned until the transaction is
838
834
  # committed and will be available in the Result object returned by commit. An identifier for
@@ -889,30 +885,25 @@ module StatelyDB
889
885
  # _@param_ `key_paths` — the paths to the items. Max 50 key paths.
890
886
  #
891
887
  # _@return_ — nil
892
- def delete: (*(String | ::Array[String]) key_paths) -> void
888
+ def delete: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> void
893
889
 
894
- # Begin listing Items from a StatelyDB Store at the given prefix.
895
- #
896
890
  # Example:
897
891
  # client.data.transaction do |txn|
898
892
  # (items, token) = txn.begin_list("/ItemType-identifier")
899
893
  # (items, token) = txn.continue_list(token)
900
894
  # end
901
895
  #
902
- # _@param_ `prefix` — the prefix to list
903
- #
904
- # _@param_ `limit` — the maximum number of items to return
905
- #
906
- # _@param_ `sort_property` — the property to sort by
907
- #
908
- # _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
909
- #
910
896
  # _@return_ — the list of Items and the token
911
897
  def begin_list: (
912
- String prefix,
913
- ?limit: Integer,
914
- ?sort_property: String?,
915
- ?sort_direction: Symbol
898
+ untyped prefix,
899
+ ?limit: untyped,
900
+ ?sort_property: untyped,
901
+ ?sort_direction: untyped,
902
+ ?item_types: untyped,
903
+ ?gt: untyped,
904
+ ?gte: untyped,
905
+ ?lt: untyped,
906
+ ?lte: untyped
916
907
  ) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
917
908
 
918
909
  # Continue listing Items from a StatelyDB Store using a token.
@@ -1017,6 +1008,7 @@ module Stately
1017
1008
  TransactionListResponse: untyped
1018
1009
  TransactionFinished: untyped
1019
1010
  FilterCondition: untyped
1011
+ CelExpression: untyped
1020
1012
  ContinueListRequest: untyped
1021
1013
  ContinueListDirection: untyped
1022
1014
  ContinueScanRequest: untyped
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statelydb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stately Cloud, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-24 00:00:00.000000000 Z
11
+ date: 2025-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubygems_version: 3.5.22
155
+ rubygems_version: 3.4.19
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: A library for interacting with StatelyDB