statelydb 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9da53da8635a6ab8f8e30bf199d0b4fe353319888398d8ec524e3b3d7384eae5
4
- data.tar.gz: c09b521842ffaa90a6f441328ac470af5ae8f11579058fa88d09f32fd32186fc
3
+ metadata.gz: 0eb53c16c6251cf93076f780e932541700ccb6f023b98062441d8e6b2befebe1
4
+ data.tar.gz: 1cc3cde2aeceb6bb8a63e69289edea027e14870b4d53bad321ca40994c7d61e3
5
5
  SHA512:
6
- metadata.gz: fe2629a952686bc0ef0b7e46f8f826430411f8ea6569c454afd702805e53424c15b456ccb5783cdb1691a196b88f488ccde4489f04fdaaa26f1dee24f4eb1bb0
7
- data.tar.gz: c43a2b8013e2756b3605511dca167b0197b8cea5bbf83c0ef63b2ca6fbaa99ed07c1c54a5f4b48e20fc3c126d91d57c041508bd51c67ccc717299c3d8f59556f
6
+ metadata.gz: d6854cd8d7f966eb921edb9ab13202ca886e4e28a17c6d02cf0ac1bc9958491bb2d85a8e67a7a6e05b0bdc352135776ec9d371b98cce8ec570bf36ff7678c757
7
+ data.tar.gz: 5665372c41462b6cea5fe2a830f7a22150010a42754a0ad06dc2848de06c397b2a901e703305a3644b70608d17e619876f2b133141aefd3cc0c53d89e4f732c5
data/README.md CHANGED
@@ -29,7 +29,7 @@ gem install statelydb
29
29
  Create an authenticated client, then import your item types from your generated schema module and use the client!
30
30
 
31
31
  ```ruby
32
- require 'statelydb'
32
+ require_relative 'schema/stately.item_types'
33
33
 
34
34
  def put_my_item
35
35
  # Create a client. This will use the environment variables
@@ -47,5 +47,5 @@ def put_my_item
47
47
 
48
48
  ---
49
49
 
50
- [Getting Started Guide]: https://preview-docs.stately.cloud/guides/getting-started/
51
- [Defining Schema]: https://preview-docs.stately.cloud/guides/defining-schema/
50
+ [Getting Started Guide]: https://docs.stately.cloud/guides/getting-started/
51
+ [Defining Schema]: https://docs.stately.cloud/guides/schema/
@@ -40,12 +40,12 @@ module Stately
40
40
  # always applied atomically; all will fail or all will succeed.
41
41
  rpc :Delete, ::Stately::Db::DeleteRequest, ::Stately::Db::DeleteResponse
42
42
  # BeginList retrieves Items that start with a specified key path prefix. The
43
- # key path prefix must minimally contain a Group Key (an item type and an
44
- # item ID). BeginList will return an empty result set if there are no items
45
- # matching that key prefix. This API returns a token that you can pass to
46
- # ContinueList to expand the result set, or to SyncList to get updates within
47
- # the result set. This can fail if the caller does not have permission to
48
- # read Items.
43
+ # key path prefix must minimally contain a Group Key (a single key segment
44
+ # with a namespace and an ID). BeginList will return an empty result set if
45
+ # there are no items matching that key prefix. This API returns a token that
46
+ # you can pass to ContinueList to expand the result set, or to SyncList to
47
+ # get updates within the result set. This can fail if the caller does not
48
+ # have permission to read Items.
49
49
  # buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
50
50
  rpc :BeginList, ::Stately::Db::BeginListRequest, stream(::Stately::Db::ListResponse)
51
51
  # ContinueList takes the token from a BeginList call and returns more results
@@ -5,7 +5,7 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x1a\x65rrors/error_details.proto\x12\x0estately.errors\"y\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\rupstreamCauseB\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"
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
10
  pool = Google::Protobuf::DescriptorPool.generated_pool
11
11
  pool.add_serialized_file(descriptor_data)
data/lib/statelydb.rb CHANGED
@@ -22,25 +22,24 @@ require "token"
22
22
  require "uuid"
23
23
 
24
24
  module StatelyDB
25
- # Client is a client for interacting with the Stately Cloud API.
26
- class Client
27
- # Initialize a new StatelyDB Client
25
+ # CoreClient is a low level client for interacting with the Stately Cloud API.
26
+ # This client shouldn't be used directly in most cases. Instead, use the generated
27
+ # client for your schema.
28
+ class CoreClient
29
+ # Initialize a new StatelyDB CoreClient
28
30
  #
29
31
  # @param store_id [Integer] the StatelyDB to use for all operations with this client.
30
- # @param schema [Module] the schema module to use for mapping StatelyDB Items.
32
+ # @param schema [Module] the generated Schema module to use for mapping StatelyDB Items.
31
33
  # @param token_provider [Common::Auth::TokenProvider] the token provider to use for authentication.
32
34
  # @param endpoint [String] the endpoint to connect to.
33
35
  # @param region [String] the region to connect to.
34
- def initialize(store_id: nil,
35
- schema: StatelyDB::Types,
36
+ def initialize(store_id:,
37
+ schema:,
36
38
  token_provider: Common::Auth::Auth0TokenProvider.new,
37
39
  endpoint: nil,
38
40
  region: nil)
39
- raise "store_id is required" if store_id.nil?
40
- raise "schema is required" if schema.nil?
41
41
 
42
42
  endpoint = self.class.make_endpoint(endpoint:, region:)
43
-
44
43
  channel = Common::Net.new_channel(endpoint:)
45
44
 
46
45
  auth_interceptor = Common::Auth::Interceptor.new(token_provider:)
@@ -56,7 +55,7 @@ module StatelyDB
56
55
  # Set whether to allow stale results for all operations with this client. This produces a new client
57
56
  # with the allow_stale flag set.
58
57
  # @param allow_stale [Boolean] whether to allow stale results
59
- # @return [StatelyDB::Client] a new client with the allow_stale flag set
58
+ # @return [self] a new client with the allow_stale flag set
60
59
  # @example
61
60
  # client.with_allow_stale(true).get("/ItemType-identifier")
62
61
  def with_allow_stale(allow_stale)
@@ -3,7 +3,7 @@
3
3
  module StatelyDB
4
4
  module Transaction
5
5
  # Transaction coordinates sending requests and waiting for responses. Consumers should not need
6
- # to interact with this class directly, but instead use the methods provided by the StatelyDB::Client.
6
+ # to interact with this class directly, but instead use the methods provided by the StatelyDB::CoreClient.
7
7
  #
8
8
  # The example below demonstrates using a transaction, which accepts a block. The lines in the block
9
9
  # are executed within the context of the transaction. The transaction is committed when the block
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.0
4
+ version: 0.6.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: 2024-10-16 00:00:00.000000000 Z
11
+ date: 2024-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async