supabase-rb 2.0.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 +7 -0
- data/lib/supabase/README.md +90 -0
- data/lib/supabase/auth/README.md +172 -0
- data/lib/supabase/auth/admin_api.rb +218 -0
- data/lib/supabase/auth/admin_oauth_api.rb +51 -0
- data/lib/supabase/auth/api.rb +125 -0
- data/lib/supabase/auth/async/admin_api.rb +36 -0
- data/lib/supabase/auth/async/admin_oauth_api.rb +15 -0
- data/lib/supabase/auth/async/api.rb +32 -0
- data/lib/supabase/auth/async/client.rb +33 -0
- data/lib/supabase/auth/async.rb +14 -0
- data/lib/supabase/auth/client.rb +1217 -0
- data/lib/supabase/auth/constants.rb +32 -0
- data/lib/supabase/auth/errors.rb +207 -0
- data/lib/supabase/auth/helpers.rb +222 -0
- data/lib/supabase/auth/memory_storage.rb +25 -0
- data/lib/supabase/auth/storage.rb +19 -0
- data/lib/supabase/auth/timer.rb +40 -0
- data/lib/supabase/auth/types.rb +517 -0
- data/lib/supabase/auth/version.rb +7 -0
- data/lib/supabase/auth.rb +19 -0
- data/lib/supabase/client.rb +200 -0
- data/lib/supabase/client_options.rb +82 -0
- data/lib/supabase/functions/README.md +71 -0
- data/lib/supabase/functions/async/client.rb +45 -0
- data/lib/supabase/functions/async.rb +8 -0
- data/lib/supabase/functions/client.rb +174 -0
- data/lib/supabase/functions/errors.rb +38 -0
- data/lib/supabase/functions/types.rb +37 -0
- data/lib/supabase/functions/version.rb +7 -0
- data/lib/supabase/functions.rb +11 -0
- data/lib/supabase/postgrest/README.md +84 -0
- data/lib/supabase/postgrest/async/client.rb +50 -0
- data/lib/supabase/postgrest/async.rb +8 -0
- data/lib/supabase/postgrest/client.rb +136 -0
- data/lib/supabase/postgrest/errors.rb +49 -0
- data/lib/supabase/postgrest/request_builder.rb +657 -0
- data/lib/supabase/postgrest/types.rb +60 -0
- data/lib/supabase/postgrest/utils.rb +24 -0
- data/lib/supabase/postgrest/version.rb +7 -0
- data/lib/supabase/postgrest.rb +13 -0
- data/lib/supabase/realtime/README.md +90 -0
- data/lib/supabase/realtime/channel.rb +274 -0
- data/lib/supabase/realtime/client.rb +182 -0
- data/lib/supabase/realtime/errors.rb +19 -0
- data/lib/supabase/realtime/message.rb +38 -0
- data/lib/supabase/realtime/presence.rb +136 -0
- data/lib/supabase/realtime/push.rb +48 -0
- data/lib/supabase/realtime/socket.rb +40 -0
- data/lib/supabase/realtime/sockets/async_websocket.rb +175 -0
- data/lib/supabase/realtime/sockets/websocket_client_simple.rb +94 -0
- data/lib/supabase/realtime/test_socket.rb +65 -0
- data/lib/supabase/realtime/transformers.rb +26 -0
- data/lib/supabase/realtime/types.rb +70 -0
- data/lib/supabase/realtime/version.rb +7 -0
- data/lib/supabase/realtime.rb +18 -0
- data/lib/supabase/storage/README.md +108 -0
- data/lib/supabase/storage/analytics.rb +69 -0
- data/lib/supabase/storage/async/client.rb +52 -0
- data/lib/supabase/storage/async.rb +8 -0
- data/lib/supabase/storage/bucket_api.rb +65 -0
- data/lib/supabase/storage/client.rb +80 -0
- data/lib/supabase/storage/errors.rb +32 -0
- data/lib/supabase/storage/file_api.rb +281 -0
- data/lib/supabase/storage/request.rb +63 -0
- data/lib/supabase/storage/types.rb +236 -0
- data/lib/supabase/storage/utils.rb +35 -0
- data/lib/supabase/storage/vectors.rb +189 -0
- data/lib/supabase/storage/version.rb +7 -0
- data/lib/supabase/storage.rb +17 -0
- data/lib/supabase/version.rb +5 -0
- data/lib/supabase-auth.rb +3 -0
- data/lib/supabase.rb +63 -0
- metadata +272 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "async/http/faraday"
|
|
4
|
+
|
|
5
|
+
require_relative "admin_oauth_api"
|
|
6
|
+
|
|
7
|
+
module Supabase
|
|
8
|
+
module Auth
|
|
9
|
+
module Async
|
|
10
|
+
# Async counterpart to {Supabase::Auth::AdminApi}.
|
|
11
|
+
#
|
|
12
|
+
# Inherits all admin methods (user CRUD, generate_link, invite, MFA admin,
|
|
13
|
+
# OAuth admin) and only swaps the Faraday adapter to async-http-faraday.
|
|
14
|
+
# `admin.oauth` returns an {Async::AdminOAuthApi} for naming consistency.
|
|
15
|
+
class AdminApi < Supabase::Auth::AdminApi
|
|
16
|
+
def initialize(url:, headers: {}, http_client: nil, verify: true, proxy: nil, timeout: nil)
|
|
17
|
+
super
|
|
18
|
+
@oauth = AdminOAuthApi.new(self)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def build_connection
|
|
24
|
+
Faraday.new(url: @url, ssl: { verify: @verify }, proxy: @proxy) do |f|
|
|
25
|
+
f.response :raise_error
|
|
26
|
+
if @timeout
|
|
27
|
+
f.options.timeout = @timeout
|
|
28
|
+
f.options.open_timeout = @timeout
|
|
29
|
+
end
|
|
30
|
+
f.adapter :async_http
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Supabase
|
|
4
|
+
module Auth
|
|
5
|
+
module Async
|
|
6
|
+
# Async counterpart to {Supabase::Auth::AdminOAuthApi}.
|
|
7
|
+
#
|
|
8
|
+
# Behavior is identical — it delegates to the wrapped {AdminApi}'s
|
|
9
|
+
# underscored methods. The wrapped admin uses the async Faraday adapter,
|
|
10
|
+
# so calls inside `Async do ... end` yield to the reactor on I/O.
|
|
11
|
+
class AdminOAuthApi < Supabase::Auth::AdminOAuthApi
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "async/http/faraday"
|
|
4
|
+
|
|
5
|
+
module Supabase
|
|
6
|
+
module Auth
|
|
7
|
+
module Async
|
|
8
|
+
# Async counterpart to {Supabase::Auth::Api}.
|
|
9
|
+
#
|
|
10
|
+
# Inherits everything (request dispatch, header merging, error mapping, JSON
|
|
11
|
+
# parsing) and only swaps the Faraday adapter to async-http-faraday so HTTP
|
|
12
|
+
# I/O yields back to the {::Async} reactor instead of blocking the thread.
|
|
13
|
+
#
|
|
14
|
+
# Call sites must run inside an `Async do ... end` block; outside one, the
|
|
15
|
+
# adapter still works but loses the concurrency win.
|
|
16
|
+
class Api < Supabase::Auth::Api
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def build_connection
|
|
20
|
+
Faraday.new(url: @url, ssl: { verify: @verify }, proxy: @proxy) do |f|
|
|
21
|
+
f.response :raise_error
|
|
22
|
+
if @timeout
|
|
23
|
+
f.options.timeout = @timeout
|
|
24
|
+
f.options.open_timeout = @timeout
|
|
25
|
+
end
|
|
26
|
+
f.adapter :async_http
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "api"
|
|
4
|
+
require_relative "admin_api"
|
|
5
|
+
|
|
6
|
+
module Supabase
|
|
7
|
+
module Auth
|
|
8
|
+
module Async
|
|
9
|
+
# Async counterpart to {Supabase::Auth::Client}.
|
|
10
|
+
#
|
|
11
|
+
# Inherits the full public surface (sign_up, sign_in_with_password, get_user,
|
|
12
|
+
# set_session, refresh_session, MFA, identities, JWT claims, subscriptions,
|
|
13
|
+
# etc.) and rewires only the HTTP layer to use async-http-faraday:
|
|
14
|
+
#
|
|
15
|
+
# - `@api` is {Async::Api} instead of {::Supabase::Auth::Api}
|
|
16
|
+
# - `@admin` is {Async::AdminApi} instead of {::Supabase::Auth::AdminApi}
|
|
17
|
+
# - `@mfa` is unchanged — it dispatches through `@client._request`, which
|
|
18
|
+
# reaches the async `@api` via the parent's `_request` delegate
|
|
19
|
+
#
|
|
20
|
+
# Call sites must run inside an `Async do ... end` block (see docs/async_design.md
|
|
21
|
+
# §4 for usage examples and §6 for fiber/state semantics).
|
|
22
|
+
class Client < Supabase::Auth::Client
|
|
23
|
+
def initialize(url:, headers: {}, **options)
|
|
24
|
+
super
|
|
25
|
+
@api = Api.new(url: @url, headers: @headers, http_client: @http_client,
|
|
26
|
+
verify: @verify, proxy: @proxy, timeout: @timeout)
|
|
27
|
+
@admin = AdminApi.new(url: @url, headers: @headers, http_client: @http_client,
|
|
28
|
+
verify: @verify, proxy: @proxy, timeout: @timeout)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Convenience loader for the async variant. Production sync users do NOT need this —
|
|
4
|
+
# `require "supabase/auth"` ships zero async transitive deps. Users who want the
|
|
5
|
+
# async variant add `gem "async"` and `gem "async-http-faraday"` to their Gemfile,
|
|
6
|
+
# then `require "supabase/auth/async"`.
|
|
7
|
+
#
|
|
8
|
+
# See docs/async_design.md for the full architecture rationale.
|
|
9
|
+
|
|
10
|
+
require_relative "../auth"
|
|
11
|
+
require_relative "async/api"
|
|
12
|
+
require_relative "async/admin_oauth_api"
|
|
13
|
+
require_relative "async/admin_api"
|
|
14
|
+
require_relative "async/client"
|