statelydb 0.25.1 → 0.28.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 +4 -4
- data/README.md +1 -6
- data/lib/api/auth/get_auth_token_pb.rb +1 -1
- data/lib/api/auth/service_pb.rb +1 -1
- data/lib/api/db/continue_list_pb.rb +1 -1
- data/lib/api/db/continue_scan_pb.rb +1 -1
- data/lib/api/db/delete_pb.rb +1 -1
- data/lib/api/db/get_pb.rb +1 -1
- data/lib/api/db/item_pb.rb +1 -1
- data/lib/api/db/item_property_pb.rb +1 -1
- data/lib/api/db/list_filters_pb.rb +17 -0
- data/lib/api/db/list_pb.rb +5 -2
- data/lib/api/db/list_token_pb.rb +1 -1
- data/lib/api/db/put_pb.rb +1 -1
- data/lib/api/db/scan_pb.rb +4 -3
- data/lib/api/db/service_pb.rb +1 -1
- data/lib/api/db/sync_list_pb.rb +1 -1
- data/lib/api/db/transaction_pb.rb +3 -2
- data/lib/api/errors/error_details_pb.rb +1 -1
- data/lib/common/auth/auth_token_provider.rb +25 -7
- data/lib/common/auth/interceptor.rb +3 -2
- data/lib/common/auth/token_provider.rb +7 -0
- data/lib/statelydb.rb +6 -4
- data/lib/version.rb +5 -0
- data/rbi/db/delete_pb.rbi +3 -3
- data/rbi/db/get_pb.rbi +3 -3
- data/rbi/db/list_filters_pb.rbi +69 -0
- data/rbi/db/list_pb.rbi +263 -2
- data/rbi/db/put_pb.rbi +3 -3
- data/rbi/db/scan_pb.rbi +0 -66
- data/rbi/db/transaction_pb.rbi +34 -11
- data/rbi/statelydb.rbi +18 -8
- data/sig/statelydb.rbs +20 -8
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b94f8450c52c3516c73d06b1a031eda14b971cc357c8a8dcd5194864ecfdf89
|
4
|
+
data.tar.gz: 33ed8865a216af57d1ea99ffe9c24cd37a078e2ba555d3a04b654e8f25f9fdb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e163f64ad570dff9ace904d59137e2134a215d28da6540422943ba6b9b4ea2c23b95863aa6195e84ec06e617a3b494f487851174fe6bf6e05eb5bb09d9a3f88
|
7
|
+
data.tar.gz: bc39bdaa7a57f7e7610cfdbd3b0bc088086d166f122f7355cc57db01c6cfd8d119a2a470a4ff103f38aefa3f43b1493958e39be0d3f6b342fb97c1d99df0ae23
|
data/README.md
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# StatelyDB SDK for Ruby
|
2
2
|
|
3
|
-
This is the Ruby SDK for [StatelyDB](https://stately.cloud).
|
3
|
+
This is the Ruby SDK for [StatelyDB](https://stately.cloud). StatelyDB is a document database built on top of DynamoDB. It uses Elastic Schema to allow you to update your data model at any time, with automatic backwards and forwards compatibility.
|
4
4
|
|
5
5
|
### Getting started:
|
6
6
|
|
7
|
-
##### Disclaimer:
|
8
|
-
|
9
|
-
We're still in an invite-only preview mode - if you're interested, please reach out to [preview@stately.cloud](mailto:preview@stately.cloud?subject=Early%20Access%20Program).
|
10
|
-
|
11
7
|
Begin by following our [Getting Started Guide] which will help you define, generate, and publish a DB schema so that it can be used.
|
12
8
|
|
13
9
|
##### Install the SDK
|
@@ -16,7 +12,6 @@ Begin by following our [Getting Started Guide] which will help you define, gener
|
|
16
12
|
gem install statelydb
|
17
13
|
```
|
18
14
|
|
19
|
-
|
20
15
|
### Usage:
|
21
16
|
|
22
17
|
Create an authenticated client, then import your item types from your generated schema module and use the client!
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x19\x61uth/get_auth_token.proto\x12\x0cstately.auth\"B\n\x13GetAuthTokenRequest\x12\x1f\n\naccess_key\x18\x01 \x01(\tH\x00R\taccessKeyB\n\n\x08identity\"W\n\x14GetAuthTokenResponse\x12\x1d\n\nauth_token\x18\x01 \x01(\tR\tauthToken\x12 \n\x0c\x65xpires_in_s\x18\x02 \x01(\x04R\nexpiresInSBv\n\x10\x63om.stately.authB\x11GetAuthTokenProtoP\x01\xa2\x02\x03SAX\xaa\x02\x0cStately.Auth\xca\x02\x0cStately\\Auth\xe2\x02\x18Stately\\Auth\\GPBMetadata\xea\x02\rStately::Authb\x06proto3"
|
9
9
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/auth/service_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/auth/get_auth_token_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x12\x61uth/service.proto\x12\x0cstately.auth\x1a\x19\x61uth/get_auth_token.proto2i\n\x0b\x41uthService\x12Z\n\x0cGetAuthToken\x12!.stately.auth.GetAuthTokenRequest\x1a\".stately.auth.GetAuthTokenResponse\"\x03\x90\x02\x01\x42q\n\x10\x63om.stately.authB\x0cServiceProtoP\x01\xa2\x02\x03SAX\xaa\x02\x0cStately.Auth\xca\x02\x0cStately\\Auth\xe2\x02\x18Stately\\Auth\\GPBMetadata\xea\x02\rStately::Authb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/continue_list.proto\x12\nstately.db\"\xbe\x01\n\x13\x43ontinueListRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x02 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId*N\n\x15\x43ontinueListDirection\x12\x19\n\x15\x43ONTINUE_LIST_FORWARD\x10\x00\x12\x1a\n\x16\x43ONTINUE_LIST_BACKWARD\x10\x01\x42l\n\x0e\x63om.stately.dbB\x11\x43ontinueListProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/continue_scan.proto\x12\nstately.db\"}\n\x13\x43ontinueScanRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaIdBl\n\x0e\x63om.stately.dbB\x11\x43ontinueScanProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/delete_pb.rb
CHANGED
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x0f\x64\x62/delete.proto\x12\nstately.db\"\xab\x01\n\rDeleteRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x30\n\x07\x64\x65letes\x18\x03 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaIdJ\x04\x08\x04\x10\x05\"\'\n\nDeleteItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\"/\n\x0c\x44\x65leteResult\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPathJ\x04\x08\x02\x10\x03\"D\n\x0e\x44\x65leteResponse\x12\x32\n\x07results\x18\x01 \x03(\x0b\x32\x18.stately.db.DeleteResultR\x07resultsBf\n\x0e\x63om.stately.dbB\x0b\x44\x65leteProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/get_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/db/item_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/get.proto\x12\nstately.db\x1a\rdb/item.proto\"\xc0\x01\n\nGetRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\'\n\x04gets\x18\x02 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\x12\x1f\n\x0b\x61llow_stale\x18\x03 \x01(\x08R\nallowStale\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaIdJ\x04\x08\x04\x10\x05\"$\n\x07GetItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\"5\n\x0bGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05itemsBc\n\x0e\x63om.stately.dbB\x08GetProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
data/lib/api/db/item_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'google/protobuf/struct_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\rdb/item.proto\x12\nstately.db\x1a\x1cgoogle/protobuf/struct.proto\"u\n\x04Item\x12\x1b\n\titem_type\x18\x01 \x01(\tR\x08itemType\x12\x16\n\x05proto\x18\x02 \x01(\x0cH\x00R\x05proto\x12-\n\x04json\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructH\x00R\x04jsonB\t\n\x07payloadBd\n\x0e\x63om.stately.dbB\tItemProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/item_property.proto\x12\nstately.db*\x8b\x02\n\x10SortableProperty\x12\x1e\n\x1aSORTABLE_PROPERTY_KEY_PATH\x10\x00\x12+\n\'SORTABLE_PROPERTY_LAST_MODIFIED_VERSION\x10\x01\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_1\x10\x08\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_2\x10\t\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_3\x10\n\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_4\x10\x0b\x42l\n\x0e\x63om.stately.dbB\x11ItemPropertyProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: db/list_filters.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
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"
|
9
|
+
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
12
|
+
|
13
|
+
module Stately
|
14
|
+
module Db
|
15
|
+
FilterCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.FilterCondition").msgclass
|
16
|
+
end
|
17
|
+
end
|
data/lib/api/db/list_pb.rb
CHANGED
@@ -6,12 +6,13 @@ require 'google/protobuf'
|
|
6
6
|
|
7
7
|
require 'api/db/item_pb'
|
8
8
|
require 'api/db/item_property_pb'
|
9
|
+
require 'api/db/list_filters_pb'
|
9
10
|
require 'api/db/list_token_pb'
|
10
11
|
|
11
12
|
|
12
|
-
descriptor_data = "\n\rdb/list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\x13\x64\x62/list_token.proto\"\
|
13
|
+
descriptor_data = "\n\rdb/list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x13\x64\x62/list_token.proto\"\xe5\x03\n\x10\x42\x65ginListRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12&\n\x0fkey_path_prefix\x18\x02 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12\x1f\n\x0b\x61llow_stale\x18\x04 \x01(\x08R\nallowStale\x12\x41\n\rsort_property\x18\x05 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x06 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12*\n\x11schema_version_id\x18\x07 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x08 \x01(\x04R\x08schemaId\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\"\x8b\x01\n\x0cListResponse\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\";\n\x11ListPartialResult\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\";\n\x0cListFinished\x12+\n\x05token\x18\x01 \x01(\x0b\x32\x15.stately.db.ListTokenR\x05token\"[\n\x0cKeyCondition\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\x12\x30\n\x08operator\x18\x02 \x01(\x0e\x32\x14.stately.db.OperatorR\x08operator*8\n\rSortDirection\x12\x12\n\x0eSORT_ASCENDING\x10\x00\x12\x13\n\x0fSORT_DESCENDING\x10\x01*\x9c\x01\n\x08Operator\x12\x18\n\x14OPERATOR_UNSPECIFIED\x10\x00\x12\x19\n\x15OPERATOR_GREATER_THAN\x10\x04\x12\"\n\x1eOPERATOR_GREATER_THAN_OR_EQUAL\x10\x05\x12\x16\n\x12OPERATOR_LESS_THAN\x10\x06\x12\x1f\n\x1bOPERATOR_LESS_THAN_OR_EQUAL\x10\x07\x42\x64\n\x0e\x63om.stately.dbB\tListProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
13
14
|
|
14
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
15
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
15
16
|
pool.add_serialized_file(descriptor_data)
|
16
17
|
|
17
18
|
module Stately
|
@@ -20,6 +21,8 @@ module Stately
|
|
20
21
|
ListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListResponse").msgclass
|
21
22
|
ListPartialResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListPartialResult").msgclass
|
22
23
|
ListFinished = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListFinished").msgclass
|
24
|
+
KeyCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.KeyCondition").msgclass
|
23
25
|
SortDirection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.SortDirection").enummodule
|
26
|
+
Operator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.Operator").enummodule
|
24
27
|
end
|
25
28
|
end
|
data/lib/api/db/list_token_pb.rb
CHANGED
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x13\x64\x62/list_token.proto\x12\nstately.db\"\x94\x01\n\tListToken\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12!\n\x0c\x63\x61n_continue\x18\x02 \x01(\x08R\x0b\x63\x61nContinue\x12\x19\n\x08\x63\x61n_sync\x18\x03 \x01(\x08R\x07\x63\x61nSync\x12*\n\x11schema_version_id\x18\x04 \x01(\rR\x0fschemaVersionIdBi\n\x0e\x63om.stately.dbB\x0eListTokenProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/put_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/db/item_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/put.proto\x12\nstately.db\x1a\rdb/item.proto\"\x99\x01\n\nPutRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\'\n\x04puts\x18\x02 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\x12*\n\x11schema_version_id\x18\x03 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x04 \x01(\x04R\x08schemaId\"\x99\x01\n\x07PutItem\x12$\n\x04item\x18\x01 \x01(\x0b\x32\x10.stately.db.ItemR\x04item\x12\x42\n\x1doverwrite_metadata_timestamps\x18\x02 \x01(\x08R\x1boverwriteMetadataTimestamps\x12$\n\x0emust_not_exist\x18\x03 \x01(\x08R\x0cmustNotExist\"5\n\x0bPutResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05itemsBc\n\x0e\x63om.stately.dbB\x08PutProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
data/lib/api/db/scan_pb.rb
CHANGED
@@ -4,15 +4,16 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
+
require 'api/db/list_filters_pb'
|
7
8
|
|
8
|
-
descriptor_data = "\n\rdb/scan.proto\x12\nstately.db\"9\n\x0f\x46ilterCondition\x12\x1d\n\titem_type\x18\x01 \x01(\tH\x00R\x08itemTypeB\x07\n\x05value\"\xa5\x02\n\x10\x42\x65ginScanRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x46\n\x10\x66ilter_condition\x18\x02 \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x0f\x66ilterCondition\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12O\n\x13segmentation_params\x18\x04 \x01(\x0b\x32\x1e.stately.db.SegmentationParamsR\x12segmentationParams\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"`\n\x12SegmentationParams\x12%\n\x0etotal_segments\x18\x05 \x01(\rR\rtotalSegments\x12#\n\rsegment_index\x18\x06 \x01(\rR\x0csegmentIndexBd\n\x0e\x63om.stately.dbB\tScanProtoP\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
|
+
descriptor_data = "\n\rdb/scan.proto\x12\nstately.db\x1a\x15\x64\x62/list_filters.proto\"\xa5\x02\n\x10\x42\x65ginScanRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x46\n\x10\x66ilter_condition\x18\x02 \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x0f\x66ilterCondition\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12O\n\x13segmentation_params\x18\x04 \x01(\x0b\x32\x1e.stately.db.SegmentationParamsR\x12segmentationParams\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"`\n\x12SegmentationParams\x12%\n\x0etotal_segments\x18\x05 \x01(\rR\rtotalSegments\x12#\n\rsegment_index\x18\x06 \x01(\rR\x0csegmentIndexBd\n\x0e\x63om.stately.dbB\tScanProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
|
+
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
13
|
pool.add_serialized_file(descriptor_data)
|
12
14
|
|
13
15
|
module Stately
|
14
16
|
module Db
|
15
|
-
FilterCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.FilterCondition").msgclass
|
16
17
|
BeginScanRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.BeginScanRequest").msgclass
|
17
18
|
SegmentationParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.SegmentationParams").msgclass
|
18
19
|
end
|
data/lib/api/db/service_pb.rb
CHANGED
@@ -17,7 +17,7 @@ require 'api/db/transaction_pb'
|
|
17
17
|
|
18
18
|
descriptor_data = "\n\x10\x64\x62/service.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x16\x64\x62/continue_scan.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/list.proto\x1a\x0c\x64\x62/put.proto\x1a\rdb/scan.proto\x1a\x12\x64\x62/sync_list.proto\x1a\x14\x64\x62/transaction.proto2\xb1\x05\n\x0f\x44\x61tabaseService\x12;\n\x03Put\x12\x16.stately.db.PutRequest\x1a\x17.stately.db.PutResponse\"\x03\x90\x02\x02\x12;\n\x03Get\x12\x16.stately.db.GetRequest\x1a\x17.stately.db.GetResponse\"\x03\x90\x02\x01\x12\x44\n\x06\x44\x65lete\x12\x19.stately.db.DeleteRequest\x1a\x1a.stately.db.DeleteResponse\"\x03\x90\x02\x02\x12J\n\tBeginList\x12\x1c.stately.db.BeginListRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12P\n\x0c\x43ontinueList\x12\x1f.stately.db.ContinueListRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12J\n\tBeginScan\x12\x1c.stately.db.BeginScanRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12P\n\x0c\x43ontinueScan\x12\x1f.stately.db.ContinueScanRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12L\n\x08SyncList\x12\x1b.stately.db.SyncListRequest\x1a\x1c.stately.db.SyncListResponse\"\x03\x90\x02\x01\x30\x01\x12T\n\x0bTransaction\x12\x1e.stately.db.TransactionRequest\x1a\x1f.stately.db.TransactionResponse\"\x00(\x01\x30\x01\x42g\n\x0e\x63om.stately.dbB\x0cServiceProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
20
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
21
21
|
pool.add_serialized_file(descriptor_data)
|
22
22
|
|
23
23
|
module Stately
|
data/lib/api/db/sync_list_pb.rb
CHANGED
@@ -10,7 +10,7 @@ require 'api/db/list_pb'
|
|
10
10
|
|
11
11
|
descriptor_data = "\n\x12\x64\x62/sync_list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\rdb/list.proto\"y\n\x0fSyncListRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"\xc8\x01\n\x10SyncListResponse\x12\x31\n\x05reset\x18\x01 \x01(\x0b\x32\x19.stately.db.SyncListResetH\x00R\x05reset\x12=\n\x06result\x18\x02 \x01(\x0b\x32#.stately.db.SyncListPartialResponseH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x03 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\"\x0f\n\rSyncListReset\"\xdf\x01\n\x17SyncListPartialResponse\x12\x35\n\rchanged_items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x0c\x63hangedItems\x12<\n\rdeleted_items\x18\x02 \x03(\x0b\x32\x17.stately.db.DeletedItemR\x0c\x64\x65letedItems\x12O\n%updated_item_keys_outside_list_window\x18\x03 \x03(\tR updatedItemKeysOutsideListWindow\"(\n\x0b\x44\x65letedItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPathBh\n\x0e\x63om.stately.dbB\rSyncListProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
12
12
|
|
13
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
13
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
15
15
|
|
16
16
|
module Stately
|
@@ -10,13 +10,14 @@ require 'api/db/get_pb'
|
|
10
10
|
require 'api/db/item_pb'
|
11
11
|
require 'api/db/item_property_pb'
|
12
12
|
require 'api/db/list_pb'
|
13
|
+
require 'api/db/list_filters_pb'
|
13
14
|
require 'api/db/put_pb'
|
14
15
|
require 'google/protobuf/empty_pb'
|
15
16
|
|
16
17
|
|
17
|
-
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\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\"\
|
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
19
|
|
19
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
20
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
20
21
|
pool.add_serialized_file(descriptor_data)
|
21
22
|
|
22
23
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x1a\x65rrors/error_details.proto\x12\x0estately.errors\"\x8d\x01\n\x13StatelyErrorDetails\x12!\n\x0cstately_code\x18\x01 \x01(\tR\x0bstatelyCode\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12%\n\x0eupstream_cause\x18\x03 \x01(\tR\rupstreamCause\x12\x12\n\x04\x63ode\x18\x04 \x01(\rR\x04\x63odeB\x80\x01\n\x12\x63om.stately.errorsB\x11\x45rrorDetailsProtoP\x01\xa2\x02\x03SEX\xaa\x02\x0eStately.Errors\xca\x02\x0eStately\\Errors\xe2\x02\x1aStately\\Errors\\GPBMetadata\xea\x02\x0fStately::Errorsb\x06proto3"
|
9
9
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -24,31 +24,49 @@ module StatelyDB
|
|
24
24
|
# It will default to using the value of `STATELY_ACCESS_KEY` if
|
25
25
|
# no credentials are explicitly passed and will throw an error if no credentials are found.
|
26
26
|
class AuthTokenProvider < TokenProvider
|
27
|
-
# @param [String] endpoint The endpoint of the auth server
|
28
27
|
# @param [String] access_key The StatelyDB access key credential
|
29
28
|
# @param [Float] base_retry_backoff_secs The base retry backoff in seconds
|
30
29
|
def initialize(
|
31
|
-
endpoint: "https://api.stately.cloud",
|
32
30
|
access_key: ENV.fetch("STATELY_ACCESS_KEY", nil),
|
33
31
|
base_retry_backoff_secs: 1
|
34
32
|
)
|
35
33
|
super()
|
36
|
-
@
|
34
|
+
@access_key = access_key
|
35
|
+
@base_retry_backoff_secs = base_retry_backoff_secs
|
36
|
+
end
|
37
|
+
|
38
|
+
# Start the token provider. Starting multiple times is a no-op.
|
39
|
+
def start(
|
40
|
+
endpoint: "https://api.stately.cloud"
|
41
|
+
)
|
42
|
+
# If the actor is already started, do nothing
|
43
|
+
return unless @actor.nil?
|
44
|
+
|
45
|
+
@actor = Async::Actor.new(Actor.new(endpoint:, access_key: @access_key,
|
46
|
+
base_retry_backoff_secs: @base_retry_backoff_secs))
|
37
47
|
# this initialization cannot happen in the constructor because it is async and must run on the event loop
|
38
48
|
# which is not available in the constructor
|
39
|
-
@actor.
|
49
|
+
@actor.start
|
40
50
|
end
|
41
51
|
|
42
52
|
# Close the token provider and kill any background operations
|
43
53
|
# This just invokes the close method on the actor which should do the cleanup
|
44
54
|
# @return [void]
|
45
55
|
def close
|
46
|
-
@actor.close
|
56
|
+
@actor.close unless @actor.nil?
|
57
|
+
@actor = nil
|
47
58
|
end
|
48
59
|
|
49
60
|
# Get the current access token
|
50
61
|
# @return [String] The current access token
|
51
62
|
def get_token(force: false)
|
63
|
+
if @actor.nil?
|
64
|
+
raise StatelyDB::Error.new(
|
65
|
+
"Token provider has not been started. Call start() before get_token().",
|
66
|
+
code: GRPC::Core::StatusCodes::FAILED_PRECONDITION,
|
67
|
+
stately_code: "FailedPrecondition"
|
68
|
+
)
|
69
|
+
end
|
52
70
|
@actor.get_token(force: force)
|
53
71
|
end
|
54
72
|
|
@@ -80,10 +98,10 @@ module StatelyDB
|
|
80
98
|
@pending_refresh = nil
|
81
99
|
end
|
82
100
|
|
83
|
-
#
|
101
|
+
# Start the actor. This runs on the actor thread which means
|
84
102
|
# we can dispatch async operations here.
|
85
103
|
# @return [void]
|
86
|
-
def
|
104
|
+
def start
|
87
105
|
# disable the async lib logger. We do our own error handling and propagation
|
88
106
|
Console.logger.disable(Async::Task)
|
89
107
|
refresh_token
|
@@ -9,9 +9,10 @@ module StatelyDB
|
|
9
9
|
module Auth
|
10
10
|
# GRPC interceptor to authenticate against Stately and append bearer tokens to outgoing requests
|
11
11
|
class Interceptor < GRPC::ClientInterceptor
|
12
|
-
# @param [StatelyDB::Common::Auth::TokenProvider] token_provider The token provider to use for authentication
|
12
|
+
# @param [StatelyDB::Common::Auth::TokenProvider] token_provider The token provider to use for authentication.
|
13
|
+
# This must have been started already.
|
13
14
|
def initialize(
|
14
|
-
token_provider:
|
15
|
+
token_provider:
|
15
16
|
)
|
16
17
|
super()
|
17
18
|
@token_provider = token_provider
|
@@ -7,6 +7,13 @@ module StatelyDB
|
|
7
7
|
# TokenProvider is an abstract base class that should be extended
|
8
8
|
# for individual token provider implementations
|
9
9
|
class TokenProvider
|
10
|
+
# Start the token provider. Starting multiple times should be a no-op.
|
11
|
+
# @param [String] endpoint The endpoint to connect to
|
12
|
+
# @return [void]
|
13
|
+
def start(endpoint: "https://api.stately.cloud") # rubocop:disable Lint/UnusedMethodArgument
|
14
|
+
raise "Not Implemented"
|
15
|
+
end
|
16
|
+
|
10
17
|
# Get the current access token
|
11
18
|
# @param [Boolean] force Whether to force a refresh of the token
|
12
19
|
# @return [String] The current access token
|
data/lib/statelydb.rb
CHANGED
@@ -49,11 +49,13 @@ module StatelyDB
|
|
49
49
|
|
50
50
|
endpoint = self.class.make_endpoint(endpoint:, region:)
|
51
51
|
@channel = Common::Net.new_channel(endpoint:)
|
52
|
-
# Make sure to use the correct endpoint for the default token provider
|
53
|
-
@token_provider = token_provider || Common::Auth::AuthTokenProvider.new(endpoint:)
|
54
|
-
|
55
52
|
interceptors = [Common::ErrorInterceptor.new]
|
56
|
-
|
53
|
+
# Make sure to use the correct endpoint for the default token provider
|
54
|
+
unless no_auth
|
55
|
+
@token_provider = token_provider || Common::Auth::AuthTokenProvider.new
|
56
|
+
@token_provider.start(endpoint: endpoint)
|
57
|
+
interceptors << Common::Auth::Interceptor.new(token_provider: @token_provider)
|
58
|
+
end
|
57
59
|
|
58
60
|
@stub = Stately::Db::DatabaseService::Stub.new(nil, nil,
|
59
61
|
channel_override: @channel, interceptors:)
|
data/lib/version.rb
ADDED
data/rbi/db/delete_pb.rbi
CHANGED
@@ -40,17 +40,17 @@ class Stately::Db::DeleteRequest
|
|
40
40
|
def clear_store_id
|
41
41
|
end
|
42
42
|
|
43
|
-
#
|
43
|
+
# key paths of items to delete.
|
44
44
|
sig { returns(T::Array[T.nilable(Stately::Db::DeleteItem)]) }
|
45
45
|
def deletes
|
46
46
|
end
|
47
47
|
|
48
|
-
#
|
48
|
+
# key paths of items to delete.
|
49
49
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
50
50
|
def deletes=(value)
|
51
51
|
end
|
52
52
|
|
53
|
-
#
|
53
|
+
# key paths of items to delete.
|
54
54
|
sig { void }
|
55
55
|
def clear_deletes
|
56
56
|
end
|
data/rbi/db/get_pb.rbi
CHANGED
@@ -42,17 +42,17 @@ class Stately::Db::GetRequest
|
|
42
42
|
def clear_store_id
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
45
|
+
# key paths to of each item to get.
|
46
46
|
sig { returns(T::Array[T.nilable(Stately::Db::GetItem)]) }
|
47
47
|
def gets
|
48
48
|
end
|
49
49
|
|
50
|
-
#
|
50
|
+
# key paths to of each item to get.
|
51
51
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
52
52
|
def gets=(value)
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# key paths to of each item to get.
|
56
56
|
sig { void }
|
57
57
|
def clear_gets
|
58
58
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Code generated by protoc-gen-rbi. DO NOT EDIT.
|
2
|
+
# source: db/list_filters.proto
|
3
|
+
# typed: strict
|
4
|
+
|
5
|
+
class Stately::Db::FilterCondition
|
6
|
+
include ::Google::Protobuf::MessageExts
|
7
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
8
|
+
|
9
|
+
sig do
|
10
|
+
params(
|
11
|
+
item_type: T.nilable(String)
|
12
|
+
).void
|
13
|
+
end
|
14
|
+
def initialize(
|
15
|
+
item_type: ""
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
# item_type is the type of item to filter by.
|
20
|
+
sig { returns(String) }
|
21
|
+
def item_type
|
22
|
+
end
|
23
|
+
|
24
|
+
# item_type is the type of item to filter by.
|
25
|
+
sig { params(value: String).void }
|
26
|
+
def item_type=(value)
|
27
|
+
end
|
28
|
+
|
29
|
+
# item_type is the type of item to filter by.
|
30
|
+
sig { void }
|
31
|
+
def clear_item_type
|
32
|
+
end
|
33
|
+
|
34
|
+
sig { returns(T.nilable(Symbol)) }
|
35
|
+
def value
|
36
|
+
end
|
37
|
+
|
38
|
+
sig { params(field: String).returns(T.untyped) }
|
39
|
+
def [](field)
|
40
|
+
end
|
41
|
+
|
42
|
+
sig { params(field: String, value: T.untyped).void }
|
43
|
+
def []=(field, value)
|
44
|
+
end
|
45
|
+
|
46
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
47
|
+
def to_h
|
48
|
+
end
|
49
|
+
|
50
|
+
sig { params(str: String).returns(Stately::Db::FilterCondition) }
|
51
|
+
def self.decode(str)
|
52
|
+
end
|
53
|
+
|
54
|
+
sig { params(msg: Stately::Db::FilterCondition).returns(String) }
|
55
|
+
def self.encode(msg)
|
56
|
+
end
|
57
|
+
|
58
|
+
sig { params(str: String, kw: T.untyped).returns(Stately::Db::FilterCondition) }
|
59
|
+
def self.decode_json(str, **kw)
|
60
|
+
end
|
61
|
+
|
62
|
+
sig { params(msg: Stately::Db::FilterCondition, kw: T.untyped).returns(String) }
|
63
|
+
def self.encode_json(msg, **kw)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig { returns(::Google::Protobuf::Descriptor) }
|
67
|
+
def self.descriptor
|
68
|
+
end
|
69
|
+
end
|
data/rbi/db/list_pb.rbi
CHANGED
@@ -15,7 +15,9 @@ class Stately::Db::BeginListRequest
|
|
15
15
|
sort_property: T.nilable(T.any(Symbol, String, Integer)),
|
16
16
|
sort_direction: T.nilable(T.any(Symbol, String, Integer)),
|
17
17
|
schema_version_id: T.nilable(Integer),
|
18
|
-
schema_id: T.nilable(Integer)
|
18
|
+
schema_id: T.nilable(Integer),
|
19
|
+
filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)]),
|
20
|
+
key_conditions: T.nilable(T::Array[T.nilable(Stately::Db::KeyCondition)])
|
19
21
|
).void
|
20
22
|
end
|
21
23
|
def initialize(
|
@@ -26,7 +28,9 @@ class Stately::Db::BeginListRequest
|
|
26
28
|
sort_property: :SORTABLE_PROPERTY_KEY_PATH,
|
27
29
|
sort_direction: :SORT_ASCENDING,
|
28
30
|
schema_version_id: 0,
|
29
|
-
schema_id: 0
|
31
|
+
schema_id: 0,
|
32
|
+
filter_conditions: [],
|
33
|
+
key_conditions: []
|
30
34
|
)
|
31
35
|
end
|
32
36
|
|
@@ -198,6 +202,123 @@ class Stately::Db::BeginListRequest
|
|
198
202
|
def clear_schema_id
|
199
203
|
end
|
200
204
|
|
205
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
206
|
+
# If no conditions are provided, all items in the store will be returned.
|
207
|
+
# Filter conditions are combined with OR.
|
208
|
+
sig { returns(T::Array[T.nilable(Stately::Db::FilterCondition)]) }
|
209
|
+
def filter_conditions
|
210
|
+
end
|
211
|
+
|
212
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
213
|
+
# If no conditions are provided, all items in the store will be returned.
|
214
|
+
# Filter conditions are combined with OR.
|
215
|
+
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
216
|
+
def filter_conditions=(value)
|
217
|
+
end
|
218
|
+
|
219
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
220
|
+
# If no conditions are provided, all items in the store will be returned.
|
221
|
+
# Filter conditions are combined with OR.
|
222
|
+
sig { void }
|
223
|
+
def clear_filter_conditions
|
224
|
+
end
|
225
|
+
|
226
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
227
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
228
|
+
# to optimize the list operation cost.
|
229
|
+
#
|
230
|
+
# A maximum of two key conditions are allowed: one with a GREATER_THAN (or equal to)
|
231
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
232
|
+
# a "between" condition on the key path.
|
233
|
+
#
|
234
|
+
# If these conditions are provided they must share the same prefix as the
|
235
|
+
# key_path_prefix. For example, the following is valid:
|
236
|
+
#
|
237
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
238
|
+
# key_conditions:
|
239
|
+
# - key_path: "/group-:groupID/namespace-44"
|
240
|
+
# operator: GREATER_THAN_OR_EQUAL
|
241
|
+
# - key_path: "/group-:groupID/namespace-100"
|
242
|
+
# operator: LESS_THAN_OR_EQUAL
|
243
|
+
#
|
244
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
245
|
+
# with the key conditions.
|
246
|
+
#
|
247
|
+
# The following is NOT valid because the key_path_prefix does not
|
248
|
+
# share the same prefix as the key conditions:
|
249
|
+
#
|
250
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
251
|
+
# key_conditions:
|
252
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
253
|
+
# operator: GREATER_THAN_OR_EQUAL
|
254
|
+
sig { returns(T::Array[T.nilable(Stately::Db::KeyCondition)]) }
|
255
|
+
def key_conditions
|
256
|
+
end
|
257
|
+
|
258
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
259
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
260
|
+
# to optimize the list operation cost.
|
261
|
+
#
|
262
|
+
# A maximum of two key conditions are allowed: one with a GREATER_THAN (or equal to)
|
263
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
264
|
+
# a "between" condition on the key path.
|
265
|
+
#
|
266
|
+
# If these conditions are provided they must share the same prefix as the
|
267
|
+
# key_path_prefix. For example, the following is valid:
|
268
|
+
#
|
269
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
270
|
+
# key_conditions:
|
271
|
+
# - key_path: "/group-:groupID/namespace-44"
|
272
|
+
# operator: GREATER_THAN_OR_EQUAL
|
273
|
+
# - key_path: "/group-:groupID/namespace-100"
|
274
|
+
# operator: LESS_THAN_OR_EQUAL
|
275
|
+
#
|
276
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
277
|
+
# with the key conditions.
|
278
|
+
#
|
279
|
+
# The following is NOT valid because the key_path_prefix does not
|
280
|
+
# share the same prefix as the key conditions:
|
281
|
+
#
|
282
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
283
|
+
# key_conditions:
|
284
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
285
|
+
# operator: GREATER_THAN_OR_EQUAL
|
286
|
+
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
287
|
+
def key_conditions=(value)
|
288
|
+
end
|
289
|
+
|
290
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
291
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
292
|
+
# to optimize the list operation cost.
|
293
|
+
#
|
294
|
+
# A maximum of two key conditions are allowed: one with a GREATER_THAN (or equal to)
|
295
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
296
|
+
# a "between" condition on the key path.
|
297
|
+
#
|
298
|
+
# If these conditions are provided they must share the same prefix as the
|
299
|
+
# key_path_prefix. For example, the following is valid:
|
300
|
+
#
|
301
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
302
|
+
# key_conditions:
|
303
|
+
# - key_path: "/group-:groupID/namespace-44"
|
304
|
+
# operator: GREATER_THAN_OR_EQUAL
|
305
|
+
# - key_path: "/group-:groupID/namespace-100"
|
306
|
+
# operator: LESS_THAN_OR_EQUAL
|
307
|
+
#
|
308
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
309
|
+
# with the key conditions.
|
310
|
+
#
|
311
|
+
# The following is NOT valid because the key_path_prefix does not
|
312
|
+
# share the same prefix as the key conditions:
|
313
|
+
#
|
314
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
315
|
+
# key_conditions:
|
316
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
317
|
+
# operator: GREATER_THAN_OR_EQUAL
|
318
|
+
sig { void }
|
319
|
+
def clear_key_conditions
|
320
|
+
end
|
321
|
+
|
201
322
|
sig { params(field: String).returns(T.untyped) }
|
202
323
|
def [](field)
|
203
324
|
end
|
@@ -448,6 +569,126 @@ class Stately::Db::ListFinished
|
|
448
569
|
end
|
449
570
|
end
|
450
571
|
|
572
|
+
# A KeyCondition is an additional constraint to be applied to the list
|
573
|
+
# operation. It is used to filter the results based on a specific key path
|
574
|
+
# and an operator.
|
575
|
+
# Wherever possible, stately will apply these key conditions at the DB layer
|
576
|
+
# to optimize the list operation latency and cost.
|
577
|
+
# Key conditions may be combined with a key_path_prefix to further
|
578
|
+
# optimize the list operation. HOWEVER Key conditions must share the
|
579
|
+
# same prefix as the key_path_prefix.
|
580
|
+
class Stately::Db::KeyCondition
|
581
|
+
include ::Google::Protobuf::MessageExts
|
582
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
583
|
+
|
584
|
+
sig do
|
585
|
+
params(
|
586
|
+
key_path: T.nilable(String),
|
587
|
+
operator: T.nilable(T.any(Symbol, String, Integer))
|
588
|
+
).void
|
589
|
+
end
|
590
|
+
def initialize(
|
591
|
+
key_path: "",
|
592
|
+
operator: :OPERATOR_UNSPECIFIED
|
593
|
+
)
|
594
|
+
end
|
595
|
+
|
596
|
+
# key_path is a valid key prefix (or full key) used to filter or optimize the list
|
597
|
+
# operation based on the operator specified below.
|
598
|
+
sig { returns(String) }
|
599
|
+
def key_path
|
600
|
+
end
|
601
|
+
|
602
|
+
# key_path is a valid key prefix (or full key) used to filter or optimize the list
|
603
|
+
# operation based on the operator specified below.
|
604
|
+
sig { params(value: String).void }
|
605
|
+
def key_path=(value)
|
606
|
+
end
|
607
|
+
|
608
|
+
# key_path is a valid key prefix (or full key) used to filter or optimize the list
|
609
|
+
# operation based on the operator specified below.
|
610
|
+
sig { void }
|
611
|
+
def clear_key_path
|
612
|
+
end
|
613
|
+
|
614
|
+
# Operator indicates how to apply key_path condition to the list operation.
|
615
|
+
# Valid options are:
|
616
|
+
# - GREATER_THAN: key_path must be greater than the specified value
|
617
|
+
# - GREATER_THAN_OR_EQUAL: key_path must be greater than or equal to the specified value
|
618
|
+
# - LESS_THAN: key_path must be less than the specified value
|
619
|
+
# - LESS_THAN_OR_EQUAL: key_path must be less than or equal to the specified value
|
620
|
+
#
|
621
|
+
# Note: Operators are strictly evaluated they do not change meaning based on sort direction.
|
622
|
+
# For example, regardless of sort direction, a GREATER_THAN operator
|
623
|
+
# will still mean that a key_path must be greater than the specified value in order
|
624
|
+
# to be included in the result set.
|
625
|
+
sig { returns(T.any(Symbol, Integer)) }
|
626
|
+
def operator
|
627
|
+
end
|
628
|
+
|
629
|
+
# Operator indicates how to apply key_path condition to the list operation.
|
630
|
+
# Valid options are:
|
631
|
+
# - GREATER_THAN: key_path must be greater than the specified value
|
632
|
+
# - GREATER_THAN_OR_EQUAL: key_path must be greater than or equal to the specified value
|
633
|
+
# - LESS_THAN: key_path must be less than the specified value
|
634
|
+
# - LESS_THAN_OR_EQUAL: key_path must be less than or equal to the specified value
|
635
|
+
#
|
636
|
+
# Note: Operators are strictly evaluated they do not change meaning based on sort direction.
|
637
|
+
# For example, regardless of sort direction, a GREATER_THAN operator
|
638
|
+
# will still mean that a key_path must be greater than the specified value in order
|
639
|
+
# to be included in the result set.
|
640
|
+
sig { params(value: T.any(Symbol, String, Integer)).void }
|
641
|
+
def operator=(value)
|
642
|
+
end
|
643
|
+
|
644
|
+
# Operator indicates how to apply key_path condition to the list operation.
|
645
|
+
# Valid options are:
|
646
|
+
# - GREATER_THAN: key_path must be greater than the specified value
|
647
|
+
# - GREATER_THAN_OR_EQUAL: key_path must be greater than or equal to the specified value
|
648
|
+
# - LESS_THAN: key_path must be less than the specified value
|
649
|
+
# - LESS_THAN_OR_EQUAL: key_path must be less than or equal to the specified value
|
650
|
+
#
|
651
|
+
# Note: Operators are strictly evaluated they do not change meaning based on sort direction.
|
652
|
+
# For example, regardless of sort direction, a GREATER_THAN operator
|
653
|
+
# will still mean that a key_path must be greater than the specified value in order
|
654
|
+
# to be included in the result set.
|
655
|
+
sig { void }
|
656
|
+
def clear_operator
|
657
|
+
end
|
658
|
+
|
659
|
+
sig { params(field: String).returns(T.untyped) }
|
660
|
+
def [](field)
|
661
|
+
end
|
662
|
+
|
663
|
+
sig { params(field: String, value: T.untyped).void }
|
664
|
+
def []=(field, value)
|
665
|
+
end
|
666
|
+
|
667
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
668
|
+
def to_h
|
669
|
+
end
|
670
|
+
|
671
|
+
sig { params(str: String).returns(Stately::Db::KeyCondition) }
|
672
|
+
def self.decode(str)
|
673
|
+
end
|
674
|
+
|
675
|
+
sig { params(msg: Stately::Db::KeyCondition).returns(String) }
|
676
|
+
def self.encode(msg)
|
677
|
+
end
|
678
|
+
|
679
|
+
sig { params(str: String, kw: T.untyped).returns(Stately::Db::KeyCondition) }
|
680
|
+
def self.decode_json(str, **kw)
|
681
|
+
end
|
682
|
+
|
683
|
+
sig { params(msg: Stately::Db::KeyCondition, kw: T.untyped).returns(String) }
|
684
|
+
def self.encode_json(msg, **kw)
|
685
|
+
end
|
686
|
+
|
687
|
+
sig { returns(::Google::Protobuf::Descriptor) }
|
688
|
+
def self.descriptor
|
689
|
+
end
|
690
|
+
end
|
691
|
+
|
451
692
|
module Stately::Db::SortDirection
|
452
693
|
self::SORT_ASCENDING = T.let(0, Integer)
|
453
694
|
self::SORT_DESCENDING = T.let(1, Integer)
|
@@ -464,3 +705,23 @@ module Stately::Db::SortDirection
|
|
464
705
|
def self.descriptor
|
465
706
|
end
|
466
707
|
end
|
708
|
+
|
709
|
+
module Stately::Db::Operator
|
710
|
+
self::OPERATOR_UNSPECIFIED = T.let(0, Integer)
|
711
|
+
self::OPERATOR_GREATER_THAN = T.let(4, Integer)
|
712
|
+
self::OPERATOR_GREATER_THAN_OR_EQUAL = T.let(5, Integer)
|
713
|
+
self::OPERATOR_LESS_THAN = T.let(6, Integer)
|
714
|
+
self::OPERATOR_LESS_THAN_OR_EQUAL = T.let(7, Integer)
|
715
|
+
|
716
|
+
sig { params(value: Integer).returns(T.nilable(Symbol)) }
|
717
|
+
def self.lookup(value)
|
718
|
+
end
|
719
|
+
|
720
|
+
sig { params(value: Symbol).returns(T.nilable(Integer)) }
|
721
|
+
def self.resolve(value)
|
722
|
+
end
|
723
|
+
|
724
|
+
sig { returns(::Google::Protobuf::EnumDescriptor) }
|
725
|
+
def self.descriptor
|
726
|
+
end
|
727
|
+
end
|
data/rbi/db/put_pb.rbi
CHANGED
@@ -40,17 +40,17 @@ class Stately::Db::PutRequest
|
|
40
40
|
def clear_store_id
|
41
41
|
end
|
42
42
|
|
43
|
-
#
|
43
|
+
# items to put into the store.
|
44
44
|
sig { returns(T::Array[T.nilable(Stately::Db::PutItem)]) }
|
45
45
|
def puts
|
46
46
|
end
|
47
47
|
|
48
|
-
#
|
48
|
+
# items to put into the store.
|
49
49
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
50
50
|
def puts=(value)
|
51
51
|
end
|
52
52
|
|
53
|
-
#
|
53
|
+
# items to put into the store.
|
54
54
|
sig { void }
|
55
55
|
def clear_puts
|
56
56
|
end
|
data/rbi/db/scan_pb.rbi
CHANGED
@@ -2,72 +2,6 @@
|
|
2
2
|
# source: db/scan.proto
|
3
3
|
# typed: strict
|
4
4
|
|
5
|
-
class Stately::Db::FilterCondition
|
6
|
-
include ::Google::Protobuf::MessageExts
|
7
|
-
extend ::Google::Protobuf::MessageExts::ClassMethods
|
8
|
-
|
9
|
-
sig do
|
10
|
-
params(
|
11
|
-
item_type: T.nilable(String)
|
12
|
-
).void
|
13
|
-
end
|
14
|
-
def initialize(
|
15
|
-
item_type: ""
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
# item_type is the type of item to filter by.
|
20
|
-
sig { returns(String) }
|
21
|
-
def item_type
|
22
|
-
end
|
23
|
-
|
24
|
-
# item_type is the type of item to filter by.
|
25
|
-
sig { params(value: String).void }
|
26
|
-
def item_type=(value)
|
27
|
-
end
|
28
|
-
|
29
|
-
# item_type is the type of item to filter by.
|
30
|
-
sig { void }
|
31
|
-
def clear_item_type
|
32
|
-
end
|
33
|
-
|
34
|
-
sig { returns(T.nilable(Symbol)) }
|
35
|
-
def value
|
36
|
-
end
|
37
|
-
|
38
|
-
sig { params(field: String).returns(T.untyped) }
|
39
|
-
def [](field)
|
40
|
-
end
|
41
|
-
|
42
|
-
sig { params(field: String, value: T.untyped).void }
|
43
|
-
def []=(field, value)
|
44
|
-
end
|
45
|
-
|
46
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
47
|
-
def to_h
|
48
|
-
end
|
49
|
-
|
50
|
-
sig { params(str: String).returns(Stately::Db::FilterCondition) }
|
51
|
-
def self.decode(str)
|
52
|
-
end
|
53
|
-
|
54
|
-
sig { params(msg: Stately::Db::FilterCondition).returns(String) }
|
55
|
-
def self.encode(msg)
|
56
|
-
end
|
57
|
-
|
58
|
-
sig { params(str: String, kw: T.untyped).returns(Stately::Db::FilterCondition) }
|
59
|
-
def self.decode_json(str, **kw)
|
60
|
-
end
|
61
|
-
|
62
|
-
sig { params(msg: Stately::Db::FilterCondition, kw: T.untyped).returns(String) }
|
63
|
-
def self.encode_json(msg, **kw)
|
64
|
-
end
|
65
|
-
|
66
|
-
sig { returns(::Google::Protobuf::Descriptor) }
|
67
|
-
def self.descriptor
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
5
|
class Stately::Db::BeginScanRequest
|
72
6
|
include ::Google::Protobuf::MessageExts
|
73
7
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
data/rbi/db/transaction_pb.rbi
CHANGED
@@ -559,17 +559,17 @@ class Stately::Db::TransactionGet
|
|
559
559
|
)
|
560
560
|
end
|
561
561
|
|
562
|
-
#
|
562
|
+
# key paths to of each item to get.
|
563
563
|
sig { returns(T::Array[T.nilable(Stately::Db::GetItem)]) }
|
564
564
|
def gets
|
565
565
|
end
|
566
566
|
|
567
|
-
#
|
567
|
+
# key paths to of each item to get.
|
568
568
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
569
569
|
def gets=(value)
|
570
570
|
end
|
571
571
|
|
572
|
-
#
|
572
|
+
# key paths to of each item to get.
|
573
573
|
sig { void }
|
574
574
|
def clear_gets
|
575
575
|
end
|
@@ -618,14 +618,16 @@ class Stately::Db::TransactionBeginList
|
|
618
618
|
key_path_prefix: T.nilable(String),
|
619
619
|
limit: T.nilable(Integer),
|
620
620
|
sort_property: T.nilable(T.any(Symbol, String, Integer)),
|
621
|
-
sort_direction: T.nilable(T.any(Symbol, String, Integer))
|
621
|
+
sort_direction: T.nilable(T.any(Symbol, String, Integer)),
|
622
|
+
filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)])
|
622
623
|
).void
|
623
624
|
end
|
624
625
|
def initialize(
|
625
626
|
key_path_prefix: "",
|
626
627
|
limit: 0,
|
627
628
|
sort_property: :SORTABLE_PROPERTY_KEY_PATH,
|
628
|
-
sort_direction: :SORT_ASCENDING
|
629
|
+
sort_direction: :SORT_ASCENDING,
|
630
|
+
filter_conditions: []
|
629
631
|
)
|
630
632
|
end
|
631
633
|
|
@@ -707,6 +709,27 @@ class Stately::Db::TransactionBeginList
|
|
707
709
|
def clear_sort_direction
|
708
710
|
end
|
709
711
|
|
712
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
713
|
+
# If no conditions are provided, all items in the store will be returned.
|
714
|
+
# Filter conditions are combined with OR.
|
715
|
+
sig { returns(T::Array[T.nilable(Stately::Db::FilterCondition)]) }
|
716
|
+
def filter_conditions
|
717
|
+
end
|
718
|
+
|
719
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
720
|
+
# If no conditions are provided, all items in the store will be returned.
|
721
|
+
# Filter conditions are combined with OR.
|
722
|
+
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
723
|
+
def filter_conditions=(value)
|
724
|
+
end
|
725
|
+
|
726
|
+
# filter_conditions are a set of conditions to filter the list result by.
|
727
|
+
# If no conditions are provided, all items in the store will be returned.
|
728
|
+
# Filter conditions are combined with OR.
|
729
|
+
sig { void }
|
730
|
+
def clear_filter_conditions
|
731
|
+
end
|
732
|
+
|
710
733
|
sig { params(field: String).returns(T.untyped) }
|
711
734
|
def [](field)
|
712
735
|
end
|
@@ -845,17 +868,17 @@ class Stately::Db::TransactionPut
|
|
845
868
|
)
|
846
869
|
end
|
847
870
|
|
848
|
-
#
|
871
|
+
# items to put into the store.
|
849
872
|
sig { returns(T::Array[T.nilable(Stately::Db::PutItem)]) }
|
850
873
|
def puts
|
851
874
|
end
|
852
875
|
|
853
|
-
#
|
876
|
+
# items to put into the store.
|
854
877
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
855
878
|
def puts=(value)
|
856
879
|
end
|
857
880
|
|
858
|
-
#
|
881
|
+
# items to put into the store.
|
859
882
|
sig { void }
|
860
883
|
def clear_puts
|
861
884
|
end
|
@@ -910,17 +933,17 @@ class Stately::Db::TransactionDelete
|
|
910
933
|
)
|
911
934
|
end
|
912
935
|
|
913
|
-
#
|
936
|
+
# key paths of items to delete.
|
914
937
|
sig { returns(T::Array[T.nilable(Stately::Db::DeleteItem)]) }
|
915
938
|
def deletes
|
916
939
|
end
|
917
940
|
|
918
|
-
#
|
941
|
+
# key paths of items to delete.
|
919
942
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
920
943
|
def deletes=(value)
|
921
944
|
end
|
922
945
|
|
923
|
-
#
|
946
|
+
# key paths of items to delete.
|
924
947
|
sig { void }
|
925
948
|
def clear_deletes
|
926
949
|
end
|
data/rbi/statelydb.rbi
CHANGED
@@ -529,9 +529,11 @@ module StatelyDB
|
|
529
529
|
module Auth
|
530
530
|
# GRPC interceptor to authenticate against Stately and append bearer tokens to outgoing requests
|
531
531
|
class Interceptor < GRPC::ClientInterceptor
|
532
|
-
#
|
532
|
+
# This must have been started already.
|
533
|
+
#
|
534
|
+
# _@param_ `token_provider` — The token provider to use for authentication.
|
533
535
|
sig { params(token_provider: StatelyDB::Common::Auth::TokenProvider).void }
|
534
|
-
def initialize(token_provider:
|
536
|
+
def initialize(token_provider:); end
|
535
537
|
|
536
538
|
# gRPC client unary interceptor
|
537
539
|
#
|
@@ -694,6 +696,12 @@ module StatelyDB
|
|
694
696
|
# TokenProvider is an abstract base class that should be extended
|
695
697
|
# for individual token provider implementations
|
696
698
|
class TokenProvider
|
699
|
+
# Start the token provider. Starting multiple times should be a no-op.
|
700
|
+
#
|
701
|
+
# _@param_ `endpoint` — The endpoint to connect to
|
702
|
+
sig { params(endpoint: String).void }
|
703
|
+
def start(endpoint: "https://api.stately.cloud"); end
|
704
|
+
|
697
705
|
# Get the current access token
|
698
706
|
#
|
699
707
|
# _@param_ `force` — Whether to force a refresh of the token
|
@@ -712,13 +720,15 @@ module StatelyDB
|
|
712
720
|
# It will default to using the value of `STATELY_ACCESS_KEY` if
|
713
721
|
# no credentials are explicitly passed and will throw an error if no credentials are found.
|
714
722
|
class AuthTokenProvider < StatelyDB::Common::Auth::TokenProvider
|
715
|
-
# _@param_ `endpoint` — The endpoint of the auth server
|
716
|
-
#
|
717
723
|
# _@param_ `access_key` — The StatelyDB access key credential
|
718
724
|
#
|
719
725
|
# _@param_ `base_retry_backoff_secs` — The base retry backoff in seconds
|
720
|
-
sig { params(
|
721
|
-
def initialize(
|
726
|
+
sig { params(access_key: String, base_retry_backoff_secs: Float).void }
|
727
|
+
def initialize(access_key: ENV.fetch("STATELY_ACCESS_KEY", nil), base_retry_backoff_secs: 1); end
|
728
|
+
|
729
|
+
# Start the token provider. Starting multiple times is a no-op.
|
730
|
+
sig { params(endpoint: String).void }
|
731
|
+
def start(endpoint: "https://api.stately.cloud"); end
|
722
732
|
|
723
733
|
# Close the token provider and kill any background operations
|
724
734
|
# This just invokes the close method on the actor which should do the cleanup
|
@@ -742,10 +752,10 @@ module StatelyDB
|
|
742
752
|
sig { params(endpoint: String, access_key: String, base_retry_backoff_secs: Float).void }
|
743
753
|
def initialize(endpoint:, access_key:, base_retry_backoff_secs:); end
|
744
754
|
|
745
|
-
#
|
755
|
+
# Start the actor. This runs on the actor thread which means
|
746
756
|
# we can dispatch async operations here.
|
747
757
|
sig { void }
|
748
|
-
def
|
758
|
+
def start; end
|
749
759
|
|
750
760
|
# Close the token provider and kill any background operations
|
751
761
|
sig { void }
|
data/sig/statelydb.rbs
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# A module for Stately Cloud auth code
|
2
2
|
module StatelyDB
|
3
|
+
VERSION: untyped
|
4
|
+
|
3
5
|
# UUID is a helper class for working with UUIDs in StatelyDB. The ruby version of a StatelyDB is a binary string,
|
4
6
|
# and this class provides convenience methods for converting to the base16 representation specified in RFC 9562.
|
5
7
|
# Internally this class uses the byte_string attribute to store the UUID as a string with the Encoding::ASCII_8BIT
|
@@ -463,8 +465,10 @@ module StatelyDB
|
|
463
465
|
module Auth
|
464
466
|
# GRPC interceptor to authenticate against Stately and append bearer tokens to outgoing requests
|
465
467
|
class Interceptor < GRPC::ClientInterceptor
|
466
|
-
#
|
467
|
-
|
468
|
+
# This must have been started already.
|
469
|
+
#
|
470
|
+
# _@param_ `token_provider` — The token provider to use for authentication.
|
471
|
+
def initialize: (token_provider: StatelyDB::Common::Auth::TokenProvider) -> void
|
468
472
|
|
469
473
|
# gRPC client unary interceptor
|
470
474
|
#
|
@@ -608,6 +612,11 @@ module StatelyDB
|
|
608
612
|
# TokenProvider is an abstract base class that should be extended
|
609
613
|
# for individual token provider implementations
|
610
614
|
class TokenProvider
|
615
|
+
# Start the token provider. Starting multiple times should be a no-op.
|
616
|
+
#
|
617
|
+
# _@param_ `endpoint` — The endpoint to connect to
|
618
|
+
def start: (?endpoint: String) -> void
|
619
|
+
|
611
620
|
# Get the current access token
|
612
621
|
#
|
613
622
|
# _@param_ `force` — Whether to force a refresh of the token
|
@@ -624,12 +633,13 @@ module StatelyDB
|
|
624
633
|
# It will default to using the value of `STATELY_ACCESS_KEY` if
|
625
634
|
# no credentials are explicitly passed and will throw an error if no credentials are found.
|
626
635
|
class AuthTokenProvider < StatelyDB::Common::Auth::TokenProvider
|
627
|
-
# _@param_ `endpoint` — The endpoint of the auth server
|
628
|
-
#
|
629
636
|
# _@param_ `access_key` — The StatelyDB access key credential
|
630
637
|
#
|
631
638
|
# _@param_ `base_retry_backoff_secs` — The base retry backoff in seconds
|
632
|
-
def initialize: (?
|
639
|
+
def initialize: (?access_key: String, ?base_retry_backoff_secs: Float) -> void
|
640
|
+
|
641
|
+
# Start the token provider. Starting multiple times is a no-op.
|
642
|
+
def start: (?endpoint: String) -> void
|
633
643
|
|
634
644
|
# Close the token provider and kill any background operations
|
635
645
|
# This just invokes the close method on the actor which should do the cleanup
|
@@ -650,9 +660,9 @@ module StatelyDB
|
|
650
660
|
# _@param_ `base_retry_backoff_secs` — The base retry backoff in seconds
|
651
661
|
def initialize: (endpoint: String, access_key: String, base_retry_backoff_secs: Float) -> void
|
652
662
|
|
653
|
-
#
|
663
|
+
# Start the actor. This runs on the actor thread which means
|
654
664
|
# we can dispatch async operations here.
|
655
|
-
def
|
665
|
+
def start: () -> void
|
656
666
|
|
657
667
|
# Close the token provider and kill any background operations
|
658
668
|
def close: () -> void
|
@@ -978,8 +988,9 @@ module Stately
|
|
978
988
|
ListResponse: untyped
|
979
989
|
ListPartialResult: untyped
|
980
990
|
ListFinished: untyped
|
991
|
+
KeyCondition: untyped
|
981
992
|
SortDirection: untyped
|
982
|
-
|
993
|
+
Operator: untyped
|
983
994
|
BeginScanRequest: untyped
|
984
995
|
SegmentationParams: untyped
|
985
996
|
DeleteRequest: untyped
|
@@ -1005,6 +1016,7 @@ module Stately
|
|
1005
1016
|
TransactionPutAck: untyped
|
1006
1017
|
TransactionListResponse: untyped
|
1007
1018
|
TransactionFinished: untyped
|
1019
|
+
FilterCondition: untyped
|
1008
1020
|
ContinueListRequest: untyped
|
1009
1021
|
ContinueListDirection: untyped
|
1010
1022
|
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.
|
4
|
+
version: 0.28.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-
|
11
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -66,7 +66,9 @@ dependencies:
|
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.64.3
|
69
|
-
description:
|
69
|
+
description: Client for StatelyDB, a document database built on top of DynamoDB with
|
70
|
+
Elastic Schema that allows you to change your data model any time with automatic
|
71
|
+
backwards compatibility.
|
70
72
|
email: support@stately.cloud
|
71
73
|
executables: []
|
72
74
|
extensions: []
|
@@ -83,6 +85,7 @@ files:
|
|
83
85
|
- lib/api/db/get_pb.rb
|
84
86
|
- lib/api/db/item_pb.rb
|
85
87
|
- lib/api/db/item_property_pb.rb
|
88
|
+
- lib/api/db/list_filters_pb.rb
|
86
89
|
- lib/api/db/list_pb.rb
|
87
90
|
- lib/api/db/list_token_pb.rb
|
88
91
|
- lib/api/db/put_pb.rb
|
@@ -106,6 +109,7 @@ files:
|
|
106
109
|
- lib/transaction/queue.rb
|
107
110
|
- lib/transaction/transaction.rb
|
108
111
|
- lib/uuid.rb
|
112
|
+
- lib/version.rb
|
109
113
|
- rbi/auth/get_auth_token_pb.rbi
|
110
114
|
- rbi/auth/service_pb.rbi
|
111
115
|
- rbi/auth/service_services_pb.rbi
|
@@ -115,6 +119,7 @@ files:
|
|
115
119
|
- rbi/db/get_pb.rbi
|
116
120
|
- rbi/db/item_pb.rbi
|
117
121
|
- rbi/db/item_property_pb.rbi
|
122
|
+
- rbi/db/list_filters_pb.rbi
|
118
123
|
- rbi/db/list_pb.rbi
|
119
124
|
- rbi/db/list_token_pb.rbi
|
120
125
|
- rbi/db/put_pb.rbi
|
@@ -140,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
145
|
requirements:
|
141
146
|
- - ">="
|
142
147
|
- !ruby/object:Gem::Version
|
143
|
-
version: 3.
|
148
|
+
version: 3.2.0
|
144
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
150
|
requirements:
|
146
151
|
- - ">="
|
147
152
|
- !ruby/object:Gem::Version
|
148
153
|
version: '0'
|
149
154
|
requirements: []
|
150
|
-
rubygems_version: 3.5.
|
155
|
+
rubygems_version: 3.5.22
|
151
156
|
signing_key:
|
152
157
|
specification_version: 4
|
153
158
|
summary: A library for interacting with StatelyDB
|