@raybase/create 0.3.5 → 0.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raybase/create",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Scaffold secure internal apps powered by Raybase.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -128,9 +128,14 @@ Notes:
128
128
  `raybase build` builds the app without touching Cloudflare: it declares the
129
129
  secrets the app needs in the built Wrangler config (`secrets.required`) and
130
130
  writes `raybase.requirements.json` beside it, the plain list of bindings,
131
- triggers, vars and secrets. `raybase secrets list` explains each secret and
132
- `raybase secrets new` prints fresh values as JSON for `wrangler deploy
133
- --secrets-file`. `wrangler deploy` of the build then works on any account.
131
+ triggers, vars and secrets. It needs none of those secrets on the machine: a
132
+ fresh clone with no `.raybase/` or `.dev.vars` builds, since the host
133
+ supplies them at upload; `raybase deploy` still needs them locally. Each
134
+ secret in the list has a `kind` (`random-32`, `ec-p256-jwk`,
135
+ `retained-keys`, `provider-api-key` or `app-defined`). `raybase secrets
136
+ list` explains each secret and `raybase secrets new` prints fresh values, by
137
+ kind, as JSON for `wrangler deploy --secrets-file`. `wrangler deploy` of the
138
+ build then works on any account.
134
139
  The app applies its own database changes on first use. See the hosting
135
140
  guide (`docs/hosting.md` on the Raybase site) for the full contract.
136
141
 
@@ -1,6 +1,6 @@
1
1
  import { env } from "cloudflare:workers";
2
2
  import { actionRoute } from "@raybase/core";
3
- import { createRaybaseApp } from "@raybase/core/worker";
3
+ import { createRaybaseApp, raybaseExecutionContext } from "@raybase/core/worker";
4
4
  import type { RaybaseEnv } from "@raybase/core/worker";
5
5
  import { docsModule } from "@raybase/docs";
6
6
  import { appMigrations } from "./db/migrations.gen";
@@ -44,13 +44,11 @@ const raybase = createRaybaseApp({
44
44
  export const raybaseHandler = raybase.handler;
45
45
  export class RaybaseAIChatAgentObject extends raybase.RaybaseAIChatAgentObject {}
46
46
 
47
- const executionContext = {
48
- waitUntil() {},
49
- passThroughOnException() {},
50
- props: {}
51
- } as unknown as ExecutionContext;
52
-
47
+ // The app's routes hand requests to Raybase here (routes/api/$.ts,
48
+ // routes/admin/$.ts, page loaders). They run with the request's own
49
+ // ExecutionContext, which src/worker-entry.ts sets for every request, so the
50
+ // work Raybase does after answering (ctx.waitUntil) runs too.
53
51
  export async function handleRaybaseRequest(request: Request): Promise<Response> {
54
52
  if (!raybaseHandler.fetch) throw new Error("Raybase handler is not fetch-compatible");
55
- return raybaseHandler.fetch(request as never, env as never, executionContext as never);
53
+ return raybaseHandler.fetch(request as never, env as never, raybaseExecutionContext() as never);
56
54
  }
@@ -1,5 +1,5 @@
1
1
  import serverEntry from "@tanstack/react-start/server-entry";
2
- import { isRaybaseAdminPanelRequestDisabled, isRaybaseConnectorRequest, withRaybaseLocalDevChrome, type RaybaseEnv } from "@raybase/core/worker";
2
+ import { isRaybaseAdminPanelRequestDisabled, isRaybaseConnectorRequest, withRaybaseExecutionContext, withRaybaseLocalDevChrome, type RaybaseEnv } from "@raybase/core/worker";
3
3
  import { appConfig } from "./raybase.config";
4
4
  import { raybaseHandler } from "./raybase.server";
5
5
 
@@ -16,7 +16,11 @@ export default {
16
16
  return raybaseHandler.fetch(request as never, env as never, ctx as never);
17
17
  }
18
18
 
19
- const response = await (serverEntry as unknown as { fetch: (request: Request, env: RaybaseEnv, ctx: ExecutionContext) => Promise<Response> }).fetch(request, env, ctx);
19
+ // Every route runs with this request's own context, which
20
+ // handleRaybaseRequest (raybase.server.ts) hands to Raybase.
21
+ const response = await withRaybaseExecutionContext(ctx, () =>
22
+ (serverEntry as unknown as { fetch: (request: Request, env: RaybaseEnv, ctx: ExecutionContext) => Promise<Response> }).fetch(request, env, ctx)
23
+ );
20
24
  return withRaybaseLocalDevChrome({
21
25
  request,
22
26
  env,
@@ -1,6 +1,6 @@
1
1
  import { env } from "cloudflare:workers";
2
2
  import { actionRoute, mcpToolFromAction, rowAuthorization, withMcpAppUi } from "@raybase/core";
3
- import { createRaybaseApp } from "@raybase/core/worker";
3
+ import { createRaybaseApp, raybaseExecutionContext } from "@raybase/core/worker";
4
4
  import type { RaybaseEnv } from "@raybase/core/worker";
5
5
  import { docsModule } from "@raybase/docs";
6
6
  import { appMigrations } from "./db/migrations.gen";
@@ -143,13 +143,11 @@ const raybase = createRaybaseApp({
143
143
  export const raybaseHandler = raybase.handler;
144
144
  export class RaybaseAIChatAgentObject extends raybase.RaybaseAIChatAgentObject {}
145
145
 
146
- const executionContext = {
147
- waitUntil() {},
148
- passThroughOnException() {},
149
- props: {}
150
- } as unknown as ExecutionContext;
151
-
146
+ // The app's routes hand requests to Raybase here (routes/api/$.ts,
147
+ // routes/admin/$.ts, page loaders). They run with the request's own
148
+ // ExecutionContext, which src/worker-entry.ts sets for every request, so the
149
+ // work Raybase does after answering (ctx.waitUntil) runs too.
152
150
  export async function handleRaybaseRequest(request: Request): Promise<Response> {
153
151
  if (!raybaseHandler.fetch) throw new Error("Raybase handler is not fetch-compatible");
154
- return raybaseHandler.fetch(request as never, env as never, executionContext as never);
152
+ return raybaseHandler.fetch(request as never, env as never, raybaseExecutionContext() as never);
155
153
  }
@@ -1,5 +1,5 @@
1
1
  import serverEntry from "@tanstack/react-start/server-entry";
2
- import { isRaybaseAdminPanelRequestDisabled, isRaybaseConnectorRequest, withRaybaseLocalDevChrome, type RaybaseEnv } from "@raybase/core/worker";
2
+ import { isRaybaseAdminPanelRequestDisabled, isRaybaseConnectorRequest, withRaybaseExecutionContext, withRaybaseLocalDevChrome, type RaybaseEnv } from "@raybase/core/worker";
3
3
  import { appConfig } from "./raybase.config";
4
4
  import { raybaseHandler } from "./raybase.server";
5
5
 
@@ -15,7 +15,11 @@ export default {
15
15
  if (!raybaseHandler.fetch) throw new Error("Raybase handler is not fetch-compatible");
16
16
  return raybaseHandler.fetch(request as never, env as never, ctx as never);
17
17
  }
18
- const response = await (serverEntry as unknown as { fetch: (request: Request, env: RaybaseEnv, ctx: ExecutionContext) => Promise<Response> }).fetch(request, env, ctx);
18
+ // Every route runs with this request's own context, which
19
+ // handleRaybaseRequest (raybase.server.ts) hands to Raybase.
20
+ const response = await withRaybaseExecutionContext(ctx, () =>
21
+ (serverEntry as unknown as { fetch: (request: Request, env: RaybaseEnv, ctx: ExecutionContext) => Promise<Response> }).fetch(request, env, ctx)
22
+ );
19
23
  return withRaybaseLocalDevChrome({
20
24
  request,
21
25
  env,