@lenserfight/sdk 0.2.0-alpha.14 → 0.2.0-alpha.16

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.
Files changed (2) hide show
  1. package/README.md +23 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # @lenserfight/sdk
2
2
 
3
- > The public client SDK for LenserFight. Browse battles, render templates,
4
- > call public RPCs. Alpha — surface may shift before `1.0.0`.
3
+ The official client SDK for [LenserFight](https://lenserfight.com). Browse battles, render templates, and call public RPCs — from any JavaScript runtime.
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.
5
6
 
6
7
  ```bash
7
8
  npm install @lenserfight/sdk@alpha
@@ -11,33 +12,35 @@ pnpm add @lenserfight/sdk@alpha
11
12
 
12
13
  ## Quickstart
13
14
 
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
+
14
17
  ```ts
15
18
  import { createClient } from '@lenserfight/sdk'
16
19
 
17
20
  const lf = createClient({
18
- url: process.env.SUPABASE_URL!, // e.g. https://abc.supabase.co
19
- anonKey: process.env.SUPABASE_ANON_KEY!, // publishable / anon key only
21
+ url: process.env.LENSERFIGHT_URL!, // https://<ref>.supabase.co
22
+ anonKey: process.env.LENSERFIGHT_ANON_KEY!, // publishable anon key
20
23
  })
21
24
 
22
- const battles = await lf.battles.browse(
23
- { status: 'open' },
24
- undefined,
25
- 10,
26
- )
25
+ const battles = await lf.battles.browse({ status: 'open' }, undefined, 10)
27
26
  console.log(battles)
28
27
  ```
29
28
 
30
- ## What's on the surface
29
+ **Cloud users:** `LENSERFIGHT_URL` and `LENSERFIGHT_ANON_KEY` come from your Supabase project's _Settings API_ page.
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
31
34
 
32
35
  | Method | Description |
33
36
  |--------|-------------|
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. |
37
+ | `lf.battles.browse(filters?, cursor?, limit?)` | List public battles via `fn_browse_battles`. Keyset-paginated. `limit` clamped to [1, 100]. |
38
+ | `lf.templates.renderPrompt(templateId, variables)` | Render a template's `task_prompt` with `{{variable}}` substitution. |
39
+ | `lf.rpcCall(fn, params)` | Call any public RPC the anon key has `EXECUTE` on. |
37
40
 
38
- ## Bring your own RPC client
41
+ ## Bring your own Supabase client
39
42
 
40
- If your app already has a `@supabase/supabase-js` client, you can hand it to the SDK:
43
+ If your app already initialises a `@supabase/supabase-js` client, pass it directly:
41
44
 
42
45
  ```ts
43
46
  import { createClient as createSupabase } from '@supabase/supabase-js'
@@ -47,15 +50,12 @@ const supabase = createSupabase(url, anonKey)
47
50
  const lf = createClientFromRpc(supabase)
48
51
  ```
49
52
 
50
- Any client conforming to the `SupabaseLikeRpcClient` shape works.
51
-
52
- ## Stability
53
+ Any object conforming to the `SupabaseLikeRpcClient` interface works. This is useful for sharing auth state, retry logic, or telemetry with the rest of your app.
53
54
 
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.
55
+ ## Further reading
58
56
 
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).
57
+ - [SDK quickstart](https://docs.lenserfight.com/en/how-to/integrations/sdk-quickstart) full walkthrough from install to paginated results
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)
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.14",
3
+ "version": "0.2.0-alpha.16",
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",