edgebase_admin 0.1.4
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/LICENSE +21 -0
- data/README.md +176 -0
- data/lib/edgebase_admin/admin_auth.rb +98 -0
- data/lib/edgebase_admin/admin_client.rb +135 -0
- data/lib/edgebase_admin/analytics_client.rb +61 -0
- data/lib/edgebase_admin/d1_client.rb +26 -0
- data/lib/edgebase_admin/functions_client.rb +46 -0
- data/lib/edgebase_admin/generated/admin_api_core.rb +503 -0
- data/lib/edgebase_admin/kv_client.rb +44 -0
- data/lib/edgebase_admin/push_client.rb +58 -0
- data/lib/edgebase_admin/vectorize_client.rb +58 -0
- data/lib/edgebase_admin.rb +5 -0
- data/llms.txt +117 -0
- metadata +75 -0
data/llms.txt
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# EdgeBase Ruby Admin SDK
|
|
2
|
+
|
|
3
|
+
Use this file as a quick-reference contract for AI coding assistants working with `edgebase_admin`.
|
|
4
|
+
|
|
5
|
+
## Package Boundary
|
|
6
|
+
|
|
7
|
+
Use `edgebase_admin` only in trusted server-side Ruby environments.
|
|
8
|
+
|
|
9
|
+
Do not ship this package to browser code, untrusted jobs, or client-side Ruby runtimes. It is meant for backend apps, scripts, cron jobs, and other places where a Service Key can stay private.
|
|
10
|
+
|
|
11
|
+
## Source Of Truth
|
|
12
|
+
|
|
13
|
+
- Package README: https://github.com/edge-base/edgebase/blob/main/packages/sdk/ruby/packages/admin/README.md
|
|
14
|
+
- Database Admin SDK: https://edgebase.fun/docs/database/admin-sdk
|
|
15
|
+
- Admin users: https://edgebase.fun/docs/authentication/admin-users
|
|
16
|
+
- Storage: https://edgebase.fun/docs/storage/upload-download
|
|
17
|
+
- Push Admin SDK: https://edgebase.fun/docs/push/admin-sdk
|
|
18
|
+
- Analytics Admin SDK: https://edgebase.fun/docs/analytics/admin-sdk
|
|
19
|
+
- Admin SDK reference: https://edgebase.fun/docs/admin-sdk/reference
|
|
20
|
+
|
|
21
|
+
If docs, examples, and assumptions disagree, prefer the current package API and the official docs over guessed patterns.
|
|
22
|
+
|
|
23
|
+
## Canonical Examples
|
|
24
|
+
|
|
25
|
+
### Create an admin client
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
require "edgebase_admin"
|
|
29
|
+
|
|
30
|
+
admin = EdgebaseAdmin::AdminClient.new(
|
|
31
|
+
"https://your-project.edgebase.fun",
|
|
32
|
+
service_key: ENV.fetch("EDGEBASE_SERVICE_KEY")
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Query a table
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
posts = admin.db("app").table("posts")
|
|
40
|
+
rows = posts.where("status", "==", "published").get
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Manage users
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
created = admin.admin_auth.create_user(
|
|
47
|
+
email: "june@example.com",
|
|
48
|
+
password: "pass1234",
|
|
49
|
+
data: { "displayName" => "June" }
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
admin.admin_auth.set_custom_claims(created["id"], {
|
|
53
|
+
"role" => "moderator"
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Execute SQL
|
|
58
|
+
|
|
59
|
+
```ruby
|
|
60
|
+
rows = admin.sql(
|
|
61
|
+
"workspace",
|
|
62
|
+
"SELECT * FROM documents WHERE status = ?",
|
|
63
|
+
["published"],
|
|
64
|
+
instance_id: "ws-1"
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Send push and query analytics
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
admin.push.send("user-123", {
|
|
72
|
+
"title" => "Hello",
|
|
73
|
+
"body" => "From the admin SDK"
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
overview = admin.analytics.overview("range" => "7d")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Hard Rules
|
|
80
|
+
|
|
81
|
+
- keep Service Keys on trusted servers only
|
|
82
|
+
- all Ruby admin methods are synchronous
|
|
83
|
+
- `admin.admin_auth` is canonical; `admin.auth` is an alias
|
|
84
|
+
- `admin.sql(namespace, query, params = nil, instance_id: nil)` uses a keyword `instance_id:` for dynamic DOs
|
|
85
|
+
- `admin.admin_auth.create_user()` accepts a hash or keyword arguments, but hash payloads are safest for docs and agents
|
|
86
|
+
- `admin.storage` returns `EdgebaseCore::StorageClient`
|
|
87
|
+
- `admin.functions` exposes `call()`, `get()`, `post()`, `put()`, `patch()`, and `delete()`
|
|
88
|
+
- `admin.push` exposes `send()`, `send_many()`, `send_to_token()`, `get_tokens()`, `get_logs()`, `send_to_topic()`, and `broadcast()`
|
|
89
|
+
- `admin.broadcast(channel, event, payload = {})` is server-side broadcast
|
|
90
|
+
- `admin.destroy` is a no-op cleanup hook
|
|
91
|
+
|
|
92
|
+
## Common Mistakes
|
|
93
|
+
|
|
94
|
+
- do not use `edgebase_admin` in client-side Ruby code
|
|
95
|
+
- do not copy JavaScript promise-based examples into Ruby
|
|
96
|
+
- do not call `sql("SELECT ...")` without a namespace
|
|
97
|
+
- do not pass the instance id positionally to `sql`; use `instance_id:`
|
|
98
|
+
- do not expect `admin_auth` to return a promise or future
|
|
99
|
+
|
|
100
|
+
## Quick Reference
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
EdgebaseAdmin::AdminClient.new(url, service_key:) -> AdminClient
|
|
104
|
+
admin.db(namespace = "shared", instance_id = nil) -> DbRef
|
|
105
|
+
admin.admin_auth -> AdminAuthClient
|
|
106
|
+
admin.auth -> AdminAuthClient
|
|
107
|
+
admin.sql(namespace, query, params = nil, instance_id: nil) -> Array or raw payload
|
|
108
|
+
admin.storage -> EdgebaseCore::StorageClient
|
|
109
|
+
admin.push -> PushClient
|
|
110
|
+
admin.functions -> FunctionsClient
|
|
111
|
+
admin.analytics -> AnalyticsClient
|
|
112
|
+
admin.kv(namespace) -> KvClient
|
|
113
|
+
admin.d1(database) -> D1Client
|
|
114
|
+
admin.vector(index) -> VectorizeClient
|
|
115
|
+
admin.broadcast(channel, event, payload = {}) -> nil
|
|
116
|
+
admin.destroy -> nil
|
|
117
|
+
```
|
metadata
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: edgebase_admin
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- EdgeBase
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: edgebase_core
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.1.4
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.1.4
|
|
27
|
+
description: Admin module for EdgeBase Ruby SDK. Provides AdminClient, AdminAuthClient,
|
|
28
|
+
KvClient, D1Client, VectorizeClient, PushClient via Service Key auth.
|
|
29
|
+
email:
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- LICENSE
|
|
35
|
+
- README.md
|
|
36
|
+
- lib/edgebase_admin.rb
|
|
37
|
+
- lib/edgebase_admin/admin_auth.rb
|
|
38
|
+
- lib/edgebase_admin/admin_client.rb
|
|
39
|
+
- lib/edgebase_admin/analytics_client.rb
|
|
40
|
+
- lib/edgebase_admin/d1_client.rb
|
|
41
|
+
- lib/edgebase_admin/functions_client.rb
|
|
42
|
+
- lib/edgebase_admin/generated/admin_api_core.rb
|
|
43
|
+
- lib/edgebase_admin/kv_client.rb
|
|
44
|
+
- lib/edgebase_admin/push_client.rb
|
|
45
|
+
- lib/edgebase_admin/vectorize_client.rb
|
|
46
|
+
- llms.txt
|
|
47
|
+
homepage: https://edgebase.fun/docs/admin-sdk/reference
|
|
48
|
+
licenses:
|
|
49
|
+
- MIT
|
|
50
|
+
metadata:
|
|
51
|
+
allowed_push_host: https://rubygems.org
|
|
52
|
+
homepage_uri: https://edgebase.fun/docs/admin-sdk/reference
|
|
53
|
+
bug_tracker_uri: https://github.com/edge-base/edgebase/issues
|
|
54
|
+
source_code_uri: https://github.com/edge-base/edgebase/tree/main/packages/sdk/ruby/packages/admin
|
|
55
|
+
documentation_uri: https://edgebase.fun/docs/admin-sdk/reference
|
|
56
|
+
post_install_message:
|
|
57
|
+
rdoc_options: []
|
|
58
|
+
require_paths:
|
|
59
|
+
- lib
|
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '3.0'
|
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
requirements: []
|
|
71
|
+
rubygems_version: 3.0.3.1
|
|
72
|
+
signing_key:
|
|
73
|
+
specification_version: 4
|
|
74
|
+
summary: EdgeBase Admin SDK for Ruby — server-side admin operations.
|
|
75
|
+
test_files: []
|