statelydb 0.32.2 → 0.33.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.
data/rbi/db/list_pb.rbi CHANGED
@@ -12,7 +12,6 @@ class Stately::Db::BeginListRequest
12
12
  key_path_prefix: T.nilable(String),
13
13
  limit: T.nilable(Integer),
14
14
  allow_stale: T.nilable(T::Boolean),
15
- sort_property: T.nilable(T.any(Symbol, String, Integer)),
16
15
  sort_direction: T.nilable(T.any(Symbol, String, Integer)),
17
16
  schema_version_id: T.nilable(Integer),
18
17
  schema_id: T.nilable(Integer),
@@ -25,7 +24,6 @@ class Stately::Db::BeginListRequest
25
24
  key_path_prefix: "",
26
25
  limit: 0,
27
26
  allow_stale: false,
28
- sort_property: :SORTABLE_PROPERTY_KEY_PATH,
29
27
  sort_direction: :SORT_ASCENDING,
30
28
  schema_version_id: 0,
31
29
  schema_id: 0,
@@ -118,24 +116,6 @@ class Stately::Db::BeginListRequest
118
116
  def clear_allow_stale
119
117
  end
120
118
 
121
- # sort_property is the property of the item to sort the results by. If this
122
- # is not set, we will sort by key path.
123
- sig { returns(T.any(Symbol, Integer)) }
124
- def sort_property
125
- end
126
-
127
- # sort_property is the property of the item to sort the results by. If this
128
- # is not set, we will sort by key path.
129
- sig { params(value: T.any(Symbol, String, Integer)).void }
130
- def sort_property=(value)
131
- end
132
-
133
- # sort_property is the property of the item to sort the results by. If this
134
- # is not set, we will sort by key path.
135
- sig { void }
136
- def clear_sort_property
137
- end
138
-
139
119
  # sort_direction is the direction to sort the results in. If this is not set,
140
120
  # we will sort in ascending order.
141
121
  sig { returns(T.any(Symbol, Integer)) }
@@ -617,7 +617,6 @@ class Stately::Db::TransactionBeginList
617
617
  params(
618
618
  key_path_prefix: T.nilable(String),
619
619
  limit: T.nilable(Integer),
620
- sort_property: T.nilable(T.any(Symbol, String, Integer)),
621
620
  sort_direction: T.nilable(T.any(Symbol, String, Integer)),
622
621
  filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)]),
623
622
  key_conditions: T.nilable(T::Array[T.nilable(Stately::Db::KeyCondition)])
@@ -626,7 +625,6 @@ class Stately::Db::TransactionBeginList
626
625
  def initialize(
627
626
  key_path_prefix: "",
628
627
  limit: 0,
629
- sort_property: :SORTABLE_PROPERTY_KEY_PATH,
630
628
  sort_direction: :SORT_ASCENDING,
631
629
  filter_conditions: [],
632
630
  key_conditions: []
@@ -675,24 +673,6 @@ class Stately::Db::TransactionBeginList
675
673
  def clear_limit
676
674
  end
677
675
 
678
- # sort_property is the property of the item to sort the results by. If this
679
- # is not set, we will sort by key path.
680
- sig { returns(T.any(Symbol, Integer)) }
681
- def sort_property
682
- end
683
-
684
- # sort_property is the property of the item to sort the results by. If this
685
- # is not set, we will sort by key path.
686
- sig { params(value: T.any(Symbol, String, Integer)).void }
687
- def sort_property=(value)
688
- end
689
-
690
- # sort_property is the property of the item to sort the results by. If this
691
- # is not set, we will sort by key path.
692
- sig { void }
693
- def clear_sort_property
694
- end
695
-
696
676
  # sort_direction is the direction to sort the results in. If this is not set,
697
677
  # we will sort in ascending order.
698
678
  sig { returns(T.any(Symbol, Integer)) }
data/rbi/statelydb.rbi CHANGED
@@ -223,12 +223,14 @@ module StatelyDB
223
223
  sig { void }
224
224
  def close; end
225
225
 
226
- # Set whether to allow stale results for all operations with this client. This produces a new client
227
- # with the allow_stale flag set.
226
+ # Returns a new client that is either OK with or not OK with stale reads.
227
+ # This affects get and list operations from the returned client. Use this
228
+ # only if you know you can tolerate stale reads. This can result in improved
229
+ # performance, availability, and cost.
228
230
  #
229
- # _@param_ `allow_stale` — whether to allow stale results
231
+ # _@param_ `allow_stale` — Whether staleness is allowed or not.
230
232
  #
231
- # _@return_ — a new client with the allow_stale flag set
233
+ # _@return_ — A clone of the existing client with allow_stale set to the new value.
232
234
  #
233
235
  # ```ruby
234
236
  # client.with_allow_stale(true).get("/ItemType-identifier")
@@ -236,9 +238,9 @@ module StatelyDB
236
238
  sig { params(allow_stale: T::Boolean).returns(T.self_type) }
237
239
  def with_allow_stale(allow_stale); end
238
240
 
239
- # Fetch a single Item from a StatelyDB Store at the given key_path.
241
+ # get retrieves an item by its full key path.
240
242
  #
241
- # _@param_ `key_path` — the path to the item
243
+ # _@param_ `key_path` — The full key path of the item.
242
244
  #
243
245
  # _@return_ — the Item or nil if not found
244
246
  #
@@ -248,16 +250,21 @@ module StatelyDB
248
250
  sig { params(key_path: T.any(StatelyDB::KeyPath, String)).returns(T.any(StatelyDB::Item, NilClass)) }
249
251
  def get(key_path); end
250
252
 
251
- # Fetch a batch of up to 100 Items from a StatelyDB Store at the given key_paths.
253
+ # get_batch retrieves multiple items by their full key paths. This will
254
+ # return the corresponding items that exist. Use begin_list instead if you
255
+ # want to retrieve multiple items but don't already know the full key paths
256
+ # of the items you want to get. You can get items of different types in a
257
+ # single get_batch - you will need to check the class of each result to
258
+ # determine what item type it is.
252
259
  #
253
- # _@param_ `key_paths` — the paths to the items. Max 100 key paths.
260
+ # _@param_ `key_paths` — The full key path of each item to load.
254
261
  #
255
- # _@return_ — the items or nil if not found
262
+ # _@return_ — the list of items that were found.
256
263
  #
257
264
  # ```ruby
258
265
  # client.data.get_batch("/ItemType-identifier", "/ItemType-identifier2")
259
266
  # ```
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)) }
267
+ sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).returns(T::Array[StatelyDB::Item]) }
261
268
  def get_batch(*key_paths); end
262
269
 
263
270
  # _@return_ — the list of Items and the token
@@ -269,7 +276,6 @@ module StatelyDB
269
276
  params(
270
277
  prefix: T.untyped,
271
278
  limit: T.untyped,
272
- sort_property: T.untyped,
273
279
  sort_direction: T.untyped,
274
280
  item_types: T.untyped,
275
281
  cel_filters: T.untyped,
@@ -279,11 +285,26 @@ module StatelyDB
279
285
  lte: T.untyped
280
286
  ).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token))
281
287
  end
282
- def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], cel_filters: [], gt: nil, gte: nil, lt: nil, lte: nil); end
283
-
284
- # Continue listing Items from a StatelyDB Store using a token.
285
- #
286
- # _@param_ `token` the token to continue from
288
+ def begin_list(prefix, limit: 100, sort_direction: :ascending, item_types: [], cel_filters: [], gt: nil, gte: nil, lt: nil, lte: nil); end
289
+
290
+ # continue_list takes the token from a begin_list call and returns the next
291
+ # "page" of results based on the original query parameters and pagination
292
+ # options. It doesn't have options because it is a continuation of a
293
+ # previous list operation. It will return a new token which can be used for
294
+ # another continue_list call, and so on. The token is the same one used by
295
+ # sync_list - each time you call either continue_list or sync_list, you
296
+ # should pass the latest version of the token, and the result will include a
297
+ # new version of the token to use in subsequent calls. You may interleave
298
+ # continue_list and sync_list calls however you like, but it does not make
299
+ # sense to make both calls in parallel. Calls to continue_list are tied to
300
+ # the authorization of the original begin_list call, so if the original
301
+ # begin_list call was allowed, continue_list with its token should also be
302
+ # allowed.
303
+ #
304
+ # You can list items of different types in a single continue_list, and you
305
+ # can check the class of each result to handle different item types.
306
+ #
307
+ # _@param_ `token` — The latest token from a previous list operation.
287
308
  #
288
309
  # _@return_ — the list of Items and the token
289
310
  #
@@ -294,13 +315,14 @@ module StatelyDB
294
315
  sig { params(token: StatelyDB::Token).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token)) }
295
316
  def continue_list(token); end
296
317
 
297
- # Initiates a scan request which will scan over the entire store and apply
298
- # the provided filters. This API returns a token that you can pass to
299
- # continue_scan to paginate through the result set. This can fail if the
300
- # caller does not have permission to read Items.
318
+ # begin_scan initiates a scan request which will scan over the entire store
319
+ # and apply the provided filters. This API returns a token that you can pass
320
+ # to continue_scan to paginate through the result set.
321
+ #
322
+ # begin_scan can return items of many types, and you can check the class of
323
+ # each result to handle different item types.
301
324
  #
302
- # WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER
303
- # OF ITEMS.
325
+ # WARNING: THIS API CAN BE EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
304
326
  #
305
327
  # _@param_ `limit` — the max number of items to retrieve. If set to 0 then the first page of results will be returned which may empty because it does not contain items of your selected item types. Be sure to check token.can_continue to see if there are more results to fetch.
306
328
  #
@@ -328,12 +350,14 @@ module StatelyDB
328
350
  end
329
351
  def begin_scan(limit: 0, item_types: [], cel_filters: [], total_segments: nil, segment_index: nil); end
330
352
 
331
- # continue_scan takes the token from a begin_scan call and returns more results
332
- # based on the original request parameters and pagination options.
353
+ # continue_scan takes the token from a begin_scan call and returns the
354
+ # next "page" of results based on the original query parameters and
355
+ # pagination options.
333
356
  #
334
- # WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
357
+ # You can scan items of different types in a single continue_scan, and you
358
+ # can check the class of each result to handle different item types.
335
359
  #
336
- # _@param_ `token` — the token to continue from
360
+ # _@param_ `token` — the token from the previous scan operation.
337
361
  #
338
362
  # _@return_ — the list of Items and the token
339
363
  #
@@ -344,7 +368,39 @@ module StatelyDB
344
368
  sig { params(token: StatelyDB::Token).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token)) }
345
369
  def continue_scan(token); end
346
370
 
347
- # Sync a list of Items from a StatelyDB Store.
371
+ # sync_list returns all changes to Items within the result set of a previous
372
+ # List operation. For all Items within the result set that were modified, it
373
+ # returns the full Item at in its current state. If the result set has
374
+ # already been expanded to the end (in the direction of the original
375
+ # begin_list request), sync_list will return newly created Items as well. It
376
+ # also returns a list of Item key paths that were deleted since the last
377
+ # sync_list, which you should reconcile with your view of items returned
378
+ # from previous begin_list/continue_list calls. Using this API, you can
379
+ # start with an initial set of items from begin_list, and then stay up to
380
+ # date on any changes via repeated sync_list requests over time.
381
+ #
382
+ # The token is the same one used by continue_list - each time you call
383
+ # either continue_list or sync_list, you should pass the latest version of
384
+ # the token, and then use the new token from the result in subsequent calls.
385
+ # You may interleave continue_list and sync_list calls however you like, but
386
+ # it does not make sense to make both calls in parallel. Calls to sync_list
387
+ # are tied to the authorization of the original begin_list call, so if the
388
+ # original begin_list call was allowed, sync_list with its token should also
389
+ # be allowed.
390
+ #
391
+ # The result will contain:
392
+ # - changed_items: Items that were changed or added since the last
393
+ # sync_list call.
394
+ # - deleted_item_paths: The key paths of items that were deleted since
395
+ # the last sync_list call.
396
+ # - updated_outside_list_window_paths: Item that were updated but
397
+ # are not within the current result set. You can treat this like
398
+ # deleted_item_paths, but the item hasn't actually been deleted, it's
399
+ # just not part of your view of the list anymore.
400
+ # - is_reset: A reset signal that indicates any previously cached
401
+ # view of the result set is no longer valid. You should throw away
402
+ # any locally cached data. Use the changed_items list from this result
403
+ # as the new view of the result set.
348
404
  #
349
405
  # _@param_ `token` — the token to sync from
350
406
  #
@@ -357,15 +413,22 @@ module StatelyDB
357
413
  sig { params(token: StatelyDB::Token).returns(StatelyDB::SyncResult) }
358
414
  def sync_list(token); end
359
415
 
360
- # Put an Item into a StatelyDB Store at the given key_path.
416
+ # put adds an Item to the Store, or replaces the Item if it already exists
417
+ # at that path.
418
+ #
419
+ # This call will fail if:
420
+ # - The Item conflicts with an existing Item at the same path and the
421
+ # must_not_exist option is set, or the item's ID will be chosen with
422
+ # an `initialValue` and one of its other key paths conflicts with an
423
+ # existing item.
361
424
  #
362
- # _@param_ `item` — a StatelyDB Item
425
+ # _@param_ `item` — An Item from your generated schema.
363
426
  #
364
427
  # _@param_ `must_not_exist` — A condition that indicates this item must not already exist at any of its key paths. If there is already an item at one of those paths, the Put operation will fail with a "ConditionalCheckFailed" error. Note that if the item has an `initialValue` field in its key, that initial value will automatically be chosen not to conflict with existing items, so this condition only applies to key paths that do not contain the `initialValue` field.
365
428
  #
366
429
  # _@param_ `overwrite_metadata_timestamps` — If set to true, the server will set the `createdAtTime` and/or `lastModifiedAtTime` fields based on the current values in this item (assuming you've mapped them to a field using `fromMetadata`). Without this, those fields are always ignored and the server sets them to the appropriate times. This option can be useful when migrating data from another system.
367
430
  #
368
- # _@return_ — the item that was stored
431
+ # _@return_ — The item that was put, with any server-generated fields filled in.
369
432
  #
370
433
  # client.data.put(my_item)
371
434
  # ```ruby
@@ -377,13 +440,21 @@ module StatelyDB
377
440
  sig { params(item: StatelyDB::Item, must_not_exist: T::Boolean, overwrite_metadata_timestamps: T::Boolean).returns(StatelyDB::Item) }
378
441
  def put(item, must_not_exist: false, overwrite_metadata_timestamps: false); end
379
442
 
380
- # Put a batch of up to 50 Items into a StatelyDB Store.
443
+ # put_batch adds multiple Items to the Store, or replaces Items if they
444
+ # already exist at that path. You can put items of different types in a
445
+ # single put_batch. All puts in the request are applied atomically - there
446
+ # are no partial successes.
381
447
  #
382
- # Max 50 items.
448
+ # This will fail if:
449
+ # - Any Item conflicts with an existing Item at the same path and its
450
+ # must_not_exist option is set, or the item's ID will be chosen with an
451
+ # `initialValue` and one of its other key paths conflicts with an existing
452
+ # item.
383
453
  #
384
- # _@param_ `items` — the items to store.
454
+ # _@param_ `items` — Items from your generated schema.
385
455
  #
386
- # _@return_ — the items that were stored
456
+ # _@return_ — The items that were put, with any server-generated fields filled in.
457
+ # They are returned in the same order they were provided.
387
458
  #
388
459
  # ```ruby
389
460
  # client.data.put_batch(item1, item2)
@@ -395,21 +466,47 @@ module StatelyDB
395
466
  sig { params(items: T.any(StatelyDB::Item, T::Array[StatelyDB::Item])).returns(T::Array[StatelyDB::Item]) }
396
467
  def put_batch(*items); end
397
468
 
398
- # Delete up to 50 Items from a StatelyDB Store at the given key_paths.
469
+ # delete removes one or more items from the Store by their full key paths.
470
+ # delete succeeds even if there isn't an item at that key path. Tombstones
471
+ # will be saved for deleted items for some time, so that sync_list can
472
+ # return information about deleted items. Deletes are always applied
473
+ # atomically; all will fail or all will succeed.
474
+ #
475
+ # The full key paths of the items. @raise [StatelyDB::Error] if the
476
+ # parameters are invalid @raise [StatelyDB::Error] if the item is not found
399
477
  #
400
- # _@param_ `key_paths` — the paths to the items. Max 50 key paths.
478
+ # _@param_ `key_paths`
401
479
  #
402
480
  # _@return_ — nil
403
481
  #
482
+ # client.data.delete("/ItemType-identifier",
404
483
  # ```ruby
405
- # client.data.delete("/ItemType-identifier", "/ItemType-identifier2")
484
+ # "/ItemType-identifier2")
406
485
  # ```
407
486
  sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).void }
408
487
  def delete(*key_paths); end
409
488
 
410
- # Transaction takes a block and executes the block within a transaction.
411
- # If the block raises an exception, the transaction is rolled back.
412
- # If the block completes successfully, the transaction is committed.
489
+ # transaction allows you to issue reads and writes in any order, and all
490
+ # writes will either succeed or all will fail when the transaction finishes.
491
+ # It takes a block with a single argument that can be used to run commands
492
+ # within the transaction.
493
+ #
494
+ # Reads are guaranteed to reflect the state as of when the transaction
495
+ # started. A transaction may fail if another transaction commits before this
496
+ # one finishes - in that case, you should retry your transaction.
497
+ #
498
+ # If any error is thrown from the block, the transaction is aborted and none
499
+ # of the changes made in it will be applied. If the handler returns without
500
+ # error, the transaction is automatically committed.
501
+ #
502
+ # If any of the operations in the block fails (e.g. a request is invalid)
503
+ # you may not find out until the *next* operation, or once the block
504
+ # finishes, due to some technicalities about how requests are handled.
505
+ #
506
+ # When the transaction is committed, the result property will contain the
507
+ # full version of any items that were put in the transaction, and the
508
+ # committed property will be True. If the transaction was aborted, the
509
+ # committed property will be False.
413
510
  #
414
511
  # _@return_ — the result of the transaction
415
512
  #
@@ -919,10 +1016,9 @@ module StatelyDB
919
1016
  sig { returns(T::Boolean) }
920
1017
  def open?; end
921
1018
 
922
- # Fetch Items from a StatelyDB Store at the given key_path. Note that Items need to exist before being retrieved inside a
923
- # transaction.
1019
+ # get retrieves an item by its full key path.
924
1020
  #
925
- # _@param_ `key_path` — the path to the item
1021
+ # _@param_ `key_path` — The full key path of the item.
926
1022
  #
927
1023
  # _@return_ — the item or nil if not found
928
1024
  #
@@ -934,9 +1030,12 @@ module StatelyDB
934
1030
  sig { params(key_path: T.any(StatelyDB::KeyPath, String)).returns(T.any(StatelyDB::Item, NilClass)) }
935
1031
  def get(key_path); end
936
1032
 
937
- # Fetch a batch of up to 100 Items from a StatelyDB Store at the given
938
- # key_paths. Note that Items need to exist before being retrieved inside a
939
- # transaction.
1033
+ # get_batch retrieves multiple items by their full key paths. This will
1034
+ # return the corresponding items that exist. Use begin_list instead if you
1035
+ # want to retrieve multiple items but don't already know the full key
1036
+ # paths of the items you want to get. You can get items of different types
1037
+ # in a single get_batch - you will need to check the class of each result
1038
+ # to determine what item type each item is.
940
1039
  #
941
1040
  # key paths.
942
1041
  # Example:
@@ -944,27 +1043,35 @@ module StatelyDB
944
1043
  # items = txn.get_batch("/foo", "/bar")
945
1044
  # end
946
1045
  #
947
- # _@param_ `key_paths` — the paths to the items. Max 100
1046
+ # _@param_ `key_paths` — the paths to the items.
948
1047
  #
949
1048
  # _@return_ — the items
950
1049
  sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).returns(T::Array[StatelyDB::Item]) }
951
1050
  def get_batch(*key_paths); end
952
1051
 
953
- # Put a single Item into a StatelyDB store. Results are not returned until the transaction is
954
- # committed and will be available in the Result object returned by commit. An identifier for
955
- # the item will be returned while inside the transaction block.
1052
+ # put adds an Item to the Store, or replaces the Item if it already exists
1053
+ # at that path. Unlike the put method outside of a transaction, this only
1054
+ # returns the generated ID of the item, and then only if the item was
1055
+ # newly created and has an `initialValue` field in its key. This is so you
1056
+ # can use that ID in subsequent puts to reference newly created items. The
1057
+ # final put items will not be returned until the transaction is committed,
1058
+ # in which case they will be included in the `StatelyDB::Transaction::Transaction::Result.puts`
1059
+ # list.
956
1060
  #
957
1061
  # results.puts.each do |result|
958
1062
  # puts result.key_path
959
1063
  # end
960
1064
  #
961
- # _@param_ `item` — the item to store
1065
+ # _@param_ `item` — the item to put
962
1066
  #
963
1067
  # _@param_ `must_not_exist` — A condition that indicates this item must not already exist at any of its key paths. If there is already an item at one of those paths, the Put operation will fail with a "ConditionalCheckFailed" error. Note that if the item has an `initialValue` field in its key, that initial value will automatically be chosen not to conflict with existing items, so this condition only applies to key paths that do not contain the `initialValue` field.
964
1068
  #
965
1069
  # _@param_ `overwrite_metadata_timestamps` — If set to true, the server will set the `createdAtTime` and/or `lastModifiedAtTime` fields based on the current values in this item (assuming you've mapped them to a field using `fromMetadata`). Without this, those fields are always ignored and the server sets them to the appropriate times. This option can be useful when migrating data from another system.
966
1070
  #
967
- # _@return_ — the id of the item
1071
+ # _@return_ — a generated IDs for the item, if that item had an ID generated
1072
+ # for its "initialValue" field. Otherwise the value is None. This
1073
+ # value can be used in subsequent puts to reference newly created
1074
+ # items.
968
1075
  #
969
1076
  # ```ruby
970
1077
  # results = client.data.transaction do |txn|
@@ -974,19 +1081,27 @@ module StatelyDB
974
1081
  sig { params(item: StatelyDB::Item, must_not_exist: T::Boolean, overwrite_metadata_timestamps: T::Boolean).returns(T.any(String, Integer)) }
975
1082
  def put(item, must_not_exist: false, overwrite_metadata_timestamps: false); end
976
1083
 
977
- # Put a batch of up to 50 Items into a StatelyDB Store. Results are not
978
- # returned until the transaction is committed and will be available in the
979
- # Result object returned by commit. A list of identifiers for the items
980
- # will be returned while inside the transaction block.
1084
+ # put_batch adds multiple Items to the Store, or replaces Items if they
1085
+ # already exist at that path. You can put items of different types in a
1086
+ # single put_batch. Unlike the put_batch method outside of a transaction,
1087
+ # this only returns the generated IDs of the items, and then only if the
1088
+ # item was newly created and has an `initialValue` field in its key. The
1089
+ # IDs are returned in the same order as the inputs. This is so you can use
1090
+ # that ID in subsequent puts to reference newly created items. The final
1091
+ # put items will not be returned until the transaction is committed, in
1092
+ # which case they will be included in the `StatelyDB::Transaction::Transaction::Result.puts` list.
981
1093
  #
982
- # 50 items.
983
1094
  # results.puts.each do |result|
984
1095
  # puts result.key_path
985
1096
  # end
986
1097
  #
987
- # _@param_ `items` — the items to store. Max
1098
+ # _@param_ `items` — the items to put
988
1099
  #
989
- # _@return_ — the ids of the items
1100
+ # _@return_ — an array of
1101
+ # generated IDs for each item, if that item had an ID generated for its
1102
+ # "initialValue" field. Otherwise the value is None.
1103
+ # These are returned in the same order as the input items. This value
1104
+ # can be used in subsequent puts to reference newly created items.
990
1105
  #
991
1106
  # ```ruby
992
1107
  # results = client.data.transaction do |txn|
@@ -996,44 +1111,88 @@ module StatelyDB
996
1111
  sig { params(items: T.any(StatelyDB::Item, T::Array[StatelyDB::Item])).returns(T::Array[T.any(StatelyDB::UUID, String, Integer, NilClass)]) }
997
1112
  def put_batch(*items); end
998
1113
 
999
- # Delete up to 50 Items from a StatelyDB Store at the given key_paths. Results are not returned until the transaction is
1000
- # committed and will be available in the Result object returned by commit.
1114
+ # delete removes one or more items from the Store by their full key paths.
1115
+ # delete succeeds even if there isn't an item at that key path.
1001
1116
  #
1002
1117
  # Example:
1003
1118
  # client.data.transaction do |txn|
1004
1119
  # txn.delete("/ItemType-identifier", "/ItemType-identifier2")
1005
1120
  # end
1006
1121
  #
1007
- # _@param_ `key_paths` — the paths to the items. Max 50 key paths.
1122
+ # _@param_ `key_paths` — The full key paths of the items
1008
1123
  #
1009
1124
  # _@return_ — nil
1010
1125
  sig { params(key_paths: T.any(StatelyDB::KeyPath, String, T::Array[T.any(StatelyDB::KeyPath, String)])).void }
1011
1126
  def delete(*key_paths); end
1012
1127
 
1128
+ # begin_list retrieves Items that start with a specified key_path_prefix
1129
+ # from a single Group. Because it can only list items from a single Group,
1130
+ # the key path prefix must at least start with a full Group Key (a single
1131
+ # key segment with a namespace and an ID, e.g. `/user-1234`).
1132
+ #
1133
+ # begin_list will return an empty result set if there are no items
1134
+ # matching that key prefix. This API returns a token that you can pass to
1135
+ # continue_list to expand the result set.
1136
+ #
1137
+ # You can list items of different types in a single begin_list, and you
1138
+ # can check the class of each result to handle different item types.
1139
+ #
1013
1140
  # Example:
1014
1141
  # client.data.transaction do |txn|
1015
1142
  # (items, token) = txn.begin_list("/ItemType-identifier")
1016
1143
  # (items, token) = txn.continue_list(token)
1017
1144
  # end
1018
1145
  #
1146
+ # _@param_ `prefix` — the key path prefix to query for. It must be at least a full Group Key (e.g. `/user-1234`).
1147
+ #
1148
+ # _@param_ `limit` — the max number of Items to retrieve. Defaults to 0 which fetches all Items.
1149
+ #
1150
+ # _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
1151
+ #
1152
+ # _@param_ `item_types` — the item types to filter by. The returned items will be instances of one of these types.
1153
+ #
1154
+ # _@param_ `cel_filters` — ] An optional list of item_type, cel_expression tuples that represent CEL expressions to filter the results set by. Use the cel_filter helper function to build these expressions. CEL expressions are only evaluated for the item type they are defined for, and do not affect other item types in the result set. This means if an item type has no CEL filter and there are no item_type filters constraints, it will be included in the result set. In the context of a CEL expression, the key-word `this` refers to the item being evaluated, and property properties should be accessed by the names as they appear in schema -- not necessarily as they appear in the generated code for a particular language. For example, if you have a `Movie` item type with the property `rating`, you could write a CEL expression like `this.rating == 'R'` to return only movies that are rated `R`. Find the full CEL language definition here: https://github.com/google/cel-spec/blob/master/doc/langdef.md
1155
+ #
1156
+ # _@param_ `gt` — filters results to only include items with a key greater than the specified value based on lexicographic ordering.
1157
+ #
1158
+ # _@param_ `gte` — filters results to only include items with a key greater than or equal to the specified value based on lexicographic ordering.
1159
+ #
1160
+ # _@param_ `lt` — filters results to only include items with a key less than the specified value based on lexicographic ordering.
1161
+ #
1162
+ # _@param_ `lte` — filters results to only include items with a key less than or equal to the specified value based on lexicographic ordering.
1163
+ #
1019
1164
  # _@return_ — the list of Items and the token
1020
1165
  sig do
1021
1166
  params(
1022
- prefix: T.untyped,
1023
- limit: T.untyped,
1024
- sort_property: T.untyped,
1025
- sort_direction: T.untyped,
1026
- item_types: T.untyped,
1027
- cel_filters: T.untyped,
1028
- gt: T.untyped,
1029
- gte: T.untyped,
1030
- lt: T.untyped,
1031
- lte: T.untyped
1167
+ prefix: T.any(StatelyDB::KeyPath, String),
1168
+ limit: Integer,
1169
+ sort_direction: Symbol,
1170
+ item_types: T::Array[T.any(StatelyDB::Item, String)],
1171
+ cel_filters: T::Array[T.any(T::Array[T.any(T::Class[T.anything], String)], String)],
1172
+ gt: T.nilable(T.any(StatelyDB::KeyPath, String)),
1173
+ gte: T.nilable(T.any(StatelyDB::KeyPath, String)),
1174
+ lt: T.nilable(T.any(StatelyDB::KeyPath, String)),
1175
+ lte: T.nilable(T.any(StatelyDB::KeyPath, String))
1032
1176
  ).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken])
1033
1177
  end
1034
- def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], cel_filters: [], gt: nil, gte: nil, lt: nil, lte: nil); end
1035
-
1036
- # Continue listing Items from a StatelyDB Store using a token.
1178
+ def begin_list(prefix, limit: 100, sort_direction: :ascending, item_types: [], cel_filters: [], gt: nil, gte: nil, lt: nil, lte: nil); end
1179
+
1180
+ # continue_list takes the token from a begin_list call and returns the
1181
+ # next "page" of results based on the original query parameters and
1182
+ # pagination options. It doesn't have options because it is a continuation
1183
+ # of a previous list operation. It will return a new token which can be
1184
+ # used for another continue_list call, and so on. The token is the same
1185
+ # one used by sync_list - each time you call either continue_list or
1186
+ # sync_list, you should pass the latest version of the token, and the
1187
+ # result will include a new version of the token to use in subsequent
1188
+ # calls. You may interleave continue_list and sync_list calls however you
1189
+ # like, but it does not make sense to make both calls in parallel. Calls
1190
+ # to continue_list are tied to the authorization of the original
1191
+ # begin_list call, so if the original begin_list call was allowed,
1192
+ # continue_list with its token should also be allowed.
1193
+ #
1194
+ # You can list items of different types in a single continueList, and you can
1195
+ # check the class of each result to handle different item types.
1037
1196
  #
1038
1197
  # Example:
1039
1198
  # client.data.transaction do |txn|
@@ -1041,7 +1200,7 @@ module StatelyDB
1041
1200
  # (items, token) = txn.continue_list(token)
1042
1201
  # end
1043
1202
  #
1044
- # _@param_ `token` — the token to continue from
1203
+ # _@param_ `token` — the token from the previous list operation
1045
1204
  #
1046
1205
  # _@param_ `continue_direction` — the direction to continue by (:forward or :backward)
1047
1206
  #