@palbase/web 5.0.1 → 6.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.
package/README.md CHANGED
@@ -49,10 +49,10 @@ If you forget to import it, every `pb` call throws a guided `BackendError`
49
49
 
50
50
  ## Calling your backend
51
51
 
52
- Codegen turns each backend controller into a typed namespace on `pb`. A
53
- controller method `todos.create` becomes `pb.todos.create(input)`; a top-level
54
- endpoint `getHello` becomes `pb.getHello()`. Path params come first, the request
55
- body/query second:
52
+ Codegen turns each backend controller into a typed namespace on `pb`. The
53
+ operation id is `<controller>.<method>` `TodosController.create` becomes
54
+ `pb.todos.create(input)`, `HelloController.greet` becomes `pb.hello.greet()`.
55
+ Path params come first, the request body/query second:
56
56
 
57
57
  ```ts
58
58
  import { pb } from '@palbase/web';
@@ -206,8 +206,8 @@ specific failures a given endpoint documents.
206
206
  ## Next.js — `@palbase/web/next`
207
207
 
208
208
  The Next.js App Router adapter shares one session cookie between the browser and
209
- the server so Server Components, Route Handlers and middleware all see the same
210
- auth state.
209
+ the server so Server Components, Route Handlers and the proxy all see the same
210
+ auth state. Requires `next >= 16` (the `proxy` file convention).
211
211
 
212
212
  **1. Configure the browser client** (a client provider/component):
213
213
 
@@ -225,15 +225,15 @@ export function PalbeProvider({ children }: { children: React.ReactNode }) {
225
225
  `setupPalbeNext()` swaps in `cookieSessionStorage` so the session is written to a
226
226
  cookie the server can read.
227
227
 
228
- **2. Refresh the session in middleware** (required for session-bearing RSC apps):
228
+ **2. Refresh the session in the proxy** (required for session-bearing RSC apps):
229
229
 
230
230
  ```ts
231
- // middleware.ts
232
- import { palbeMiddleware } from '@palbase/web/next/middleware';
231
+ // proxy.ts
232
+ import { palbeProxy } from '@palbase/web/next/proxy';
233
233
  import type { NextRequest } from 'next/server';
234
234
 
235
- export function middleware(request: NextRequest) {
236
- return palbeMiddleware(request, {
235
+ export function proxy(request: NextRequest) {
236
+ return palbeProxy(request, {
237
237
  url: 'https://<environmentRef>.palbase.studio',
238
238
  apiKey: 'pb_<environmentRef>_c...',
239
239
  });
@@ -247,15 +247,15 @@ export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)
247
247
 
248
248
  Two rules the shape above encodes:
249
249
 
250
- - **Import `@palbase/web/next/middleware`, not `@palbase/web/next`.** Next
251
- compiles middleware into a separate Edge bundle, and the full adapter graph
252
- reaches `WebAssembly.compile`, which Next rejects there with a build error.
250
+ - **Import `@palbase/web/next/proxy`, not `@palbase/web/next`.** Next compiles
251
+ the proxy into its own bundle, and the full adapter graph reaches
252
+ `livekit-client` and the MLS WASM loader megabytes on every request path.
253
253
  This entry reaches none of it.
254
254
  - **Pass the config explicitly; do not `import './palbe.gen'` here.** That
255
255
  import would pull the same graph back in. It also means `config`/`matcher`
256
256
  must be declared in this file — Next reads `export const config` off this
257
257
  file's own AST, so a re-exported or imported one is silently ignored and the
258
- middleware degrades to matching every request.
258
+ proxy degrades to matching every request.
259
259
 
260
260
  **3. Read data in Server Components** with `pbServer()` — a per-request,
261
261
  session-isolated client:
@@ -8633,7 +8633,7 @@ function defaultSessionStorage(key) {
8633
8633
  }
8634
8634
 
8635
8635
  // src/version.ts
8636
- var VERSION = "5.0.1";
8636
+ var VERSION = "6.0.0";
8637
8637
 
8638
8638
  // src/runtime.ts
8639
8639
  function buildRuntime(config) {
@@ -9058,4 +9058,4 @@ export {
9058
9058
  pb,
9059
9059
  createBoundClient
9060
9060
  };
9061
- //# sourceMappingURL=chunk-QKFPPZLF.js.map
9061
+ //# sourceMappingURL=chunk-KOJ4OAAR.js.map