@rivetkit/supabase 0.0.0-0-0-0-preview-guard-stops.9d82529

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 ADDED
@@ -0,0 +1,41 @@
1
+ # @rivetkit/supabase
2
+
3
+ Supabase Edge Functions integration for [RivetKit](https://rivet.dev) actors.
4
+
5
+ Host Rivet Actors in a Supabase Edge Function (Deno) with a single import. The
6
+ wasm runtime and wasm binary loading are wired automatically.
7
+
8
+ ```ts
9
+ import { actor } from "rivetkit";
10
+ import { serve } from "@rivetkit/supabase";
11
+
12
+ const counter = actor({
13
+ state: { count: 0 },
14
+ actions: {
15
+ increment: (c, amount = 1) => (c.state.count += amount),
16
+ getCount: (c) => c.state.count,
17
+ },
18
+ });
19
+
20
+ await serve({ use: { counter } });
21
+ ```
22
+
23
+ Set `RIVET_ENDPOINT` as a function secret (namespace and token may be embedded
24
+ in the URL as `https://namespace:token@host`).
25
+
26
+ ## Mounting your own routes
27
+
28
+ Pass `fetch` to handle everything outside the Rivet manager API path:
29
+
30
+ ```ts
31
+ await serve({ use: { counter } }, {
32
+ fetch: (request) => {
33
+ if (new URL(request.url).pathname.endsWith("/health")) {
34
+ return new Response("ok");
35
+ }
36
+ return new Response("not found", { status: 404 });
37
+ },
38
+ });
39
+ ```
40
+
41
+ Learn more at https://rivet.dev/docs.
package/dist/mod.d.mts ADDED
@@ -0,0 +1,34 @@
1
+ import { RegistryActors, RegistryConfigInput, Registry } from 'rivetkit';
2
+ export * from 'rivetkit';
3
+
4
+ /** Config passed to `setup` / `serve`. The wasm runtime is wired automatically. */
5
+ type SupabaseSetupConfig<A extends RegistryActors> = Omit<RegistryConfigInput<A>, "runtime" | "wasm">;
6
+ /**
7
+ * Wraps rivetkit's `setup` with the Supabase Edge Functions WebAssembly runtime
8
+ * wired in. Returns a typed `Registry`, so you can derive a typed client with
9
+ * `createClient<typeof registry>(...)` and pass the same registry to `serve`.
10
+ *
11
+ * The wasm binary is loaded by `serve` (Deno reads it asynchronously), so this
12
+ * stays synchronous.
13
+ */
14
+ declare function setup<A extends RegistryActors>(config: SupabaseSetupConfig<A>): Registry<A>;
15
+ interface ServeOptions {
16
+ /** Path the Rivet manager API is mounted at. Defaults to `/api/rivet`. */
17
+ managerPath?: string;
18
+ /** Handler for requests that fall outside the Rivet manager API path. */
19
+ fetch?: (request: Request) => Response | Promise<Response>;
20
+ }
21
+ /**
22
+ * Serves Rivet Actors from a Supabase Edge Function (Deno) on the wasm runtime.
23
+ * Accepts either a registry from this package's `setup` or a setup config (which
24
+ * is wired through `setup` for you).
25
+ *
26
+ * The Rivet manager API is mounted at the configured `serverless.basePath`
27
+ * (or `managerPath`, default `/api/rivet`). Requests outside that path are
28
+ * routed to `options.fetch` if provided. The engine endpoint is read from
29
+ * `RIVET_ENDPOINT` (with `RIVET_NAMESPACE`, `RIVET_TOKEN`, `RIVET_POOL` optional)
30
+ * unless set in the config.
31
+ */
32
+ declare function serve<A extends RegistryActors>(registryOrConfig: Registry<A> | SupabaseSetupConfig<A>, options?: ServeOptions): Promise<void>;
33
+
34
+ export { type ServeOptions, type SupabaseSetupConfig, serve, setup };
package/dist/mod.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { RegistryActors, RegistryConfigInput, Registry } from 'rivetkit';
2
+ export * from 'rivetkit';
3
+
4
+ /** Config passed to `setup` / `serve`. The wasm runtime is wired automatically. */
5
+ type SupabaseSetupConfig<A extends RegistryActors> = Omit<RegistryConfigInput<A>, "runtime" | "wasm">;
6
+ /**
7
+ * Wraps rivetkit's `setup` with the Supabase Edge Functions WebAssembly runtime
8
+ * wired in. Returns a typed `Registry`, so you can derive a typed client with
9
+ * `createClient<typeof registry>(...)` and pass the same registry to `serve`.
10
+ *
11
+ * The wasm binary is loaded by `serve` (Deno reads it asynchronously), so this
12
+ * stays synchronous.
13
+ */
14
+ declare function setup<A extends RegistryActors>(config: SupabaseSetupConfig<A>): Registry<A>;
15
+ interface ServeOptions {
16
+ /** Path the Rivet manager API is mounted at. Defaults to `/api/rivet`. */
17
+ managerPath?: string;
18
+ /** Handler for requests that fall outside the Rivet manager API path. */
19
+ fetch?: (request: Request) => Response | Promise<Response>;
20
+ }
21
+ /**
22
+ * Serves Rivet Actors from a Supabase Edge Function (Deno) on the wasm runtime.
23
+ * Accepts either a registry from this package's `setup` or a setup config (which
24
+ * is wired through `setup` for you).
25
+ *
26
+ * The Rivet manager API is mounted at the configured `serverless.basePath`
27
+ * (or `managerPath`, default `/api/rivet`). Requests outside that path are
28
+ * routed to `options.fetch` if provided. The engine endpoint is read from
29
+ * `RIVET_ENDPOINT` (with `RIVET_NAMESPACE`, `RIVET_TOKEN`, `RIVET_POOL` optional)
30
+ * unless set in the config.
31
+ */
32
+ declare function serve<A extends RegistryActors>(registryOrConfig: Registry<A> | SupabaseSetupConfig<A>, options?: ServeOptions): Promise<void>;
33
+
34
+ export { type ServeOptions, type SupabaseSetupConfig, serve, setup };