@lenserfight/sdk 0.2.0-alpha.16 → 0.2.0-alpha.2
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.
- package/README.md +23 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# @lenserfight/sdk
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
> **Alpha:** The public surface may shift before `1.0.0`. Pin to a specific alpha tag and check the [CHANGELOG](https://github.com/conectlens/lenserfight/blob/main/CHANGELOG.md) before upgrading.
|
|
3
|
+
> The public client SDK for LenserFight. Browse battles, render templates,
|
|
4
|
+
> call public RPCs. Alpha — surface may shift before `1.0.0`.
|
|
6
5
|
|
|
7
6
|
```bash
|
|
8
7
|
npm install @lenserfight/sdk@alpha
|
|
@@ -12,35 +11,33 @@ pnpm add @lenserfight/sdk@alpha
|
|
|
12
11
|
|
|
13
12
|
## Quickstart
|
|
14
13
|
|
|
15
|
-
Point the SDK at your LenserFight Supabase project. Use the project's **API URL** and **anon (publishable) key** — never a service-role key.
|
|
16
|
-
|
|
17
14
|
```ts
|
|
18
15
|
import { createClient } from '@lenserfight/sdk'
|
|
19
16
|
|
|
20
17
|
const lf = createClient({
|
|
21
|
-
url: process.env.
|
|
22
|
-
anonKey: process.env.
|
|
18
|
+
url: process.env.SUPABASE_URL!, // e.g. https://abc.supabase.co
|
|
19
|
+
anonKey: process.env.SUPABASE_ANON_KEY!, // publishable / anon key only
|
|
23
20
|
})
|
|
24
21
|
|
|
25
|
-
const battles = await lf.battles.browse(
|
|
22
|
+
const battles = await lf.battles.browse(
|
|
23
|
+
{ status: 'open' },
|
|
24
|
+
undefined,
|
|
25
|
+
10,
|
|
26
|
+
)
|
|
26
27
|
console.log(battles)
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
**Local users:** See the [SDK quickstart](https://docs.lenserfight.com/en/how-to/integrations/sdk-quickstart) for how to spin up a local instance and capture its credentials.
|
|
32
|
-
|
|
33
|
-
## API surface
|
|
30
|
+
## What's on the surface
|
|
34
31
|
|
|
35
32
|
| Method | Description |
|
|
36
33
|
|--------|-------------|
|
|
37
|
-
| `lf.battles.browse(filters?, cursor?, limit?)` | List public battles via `fn_browse_battles
|
|
38
|
-
| `lf.templates.renderPrompt(templateId, variables)` | Render a template's `task_prompt` with `{{variable}}` substitution
|
|
39
|
-
| `lf.rpcCall(fn, params)` |
|
|
34
|
+
| `lf.battles.browse(filters?, cursor?, limit?)` | List public battles via `fn_browse_battles` (anon-readable). Keyset paginated. `limit` clamped to [1, 100]. |
|
|
35
|
+
| `lf.templates.renderPrompt(templateId, variables)` | Render a template's `task_prompt` with `{{variable}}` substitution via `fn_battles_render_prompt`. |
|
|
36
|
+
| `lf.rpcCall(fn, params)` | Escape hatch — call any RPC the anon key has EXECUTE on. |
|
|
40
37
|
|
|
41
|
-
## Bring your own
|
|
38
|
+
## Bring your own RPC client
|
|
42
39
|
|
|
43
|
-
If your app already
|
|
40
|
+
If your app already has a `@supabase/supabase-js` client, you can hand it to the SDK:
|
|
44
41
|
|
|
45
42
|
```ts
|
|
46
43
|
import { createClient as createSupabase } from '@supabase/supabase-js'
|
|
@@ -50,12 +47,15 @@ const supabase = createSupabase(url, anonKey)
|
|
|
50
47
|
const lf = createClientFromRpc(supabase)
|
|
51
48
|
```
|
|
52
49
|
|
|
53
|
-
Any
|
|
50
|
+
Any client conforming to the `SupabaseLikeRpcClient` shape works.
|
|
51
|
+
|
|
52
|
+
## Stability
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
This release is `0.1.0-alpha.1`. Surface changes are documented in the
|
|
55
|
+
[CHANGELOG](https://github.com/conectlens/lenserfight/blob/main/CHANGELOG.md).
|
|
56
|
+
The `1.0.0` line will follow once early-adopter feedback settles the public
|
|
57
|
+
surface.
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
- [SDK reference](https://docs.lenserfight.com/en/reference/sdk/) — method-by-method API docs
|
|
59
|
-
- [GitHub Discussions → SDK feedback](https://github.com/conectlens/lenserfight/discussions/categories/sdk)
|
|
59
|
+
For the deeper walkthrough see the [SDK quickstart](https://docs.lenserfight.com/how-to/integrations/sdk-quickstart) and the [reference docs](https://docs.lenserfight.com/reference/sdk).
|
|
60
60
|
|
|
61
61
|
Apache-2.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenserfight/sdk",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
4
|
"description": "LenserFight public client SDK — read battles, lenses, agents, protocols, and templates from any Supabase-backed deployment",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./index.cjs",
|