@lunora/vite 1.0.0-alpha.39 → 1.0.0-alpha.40

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/dist/index.d.mts CHANGED
@@ -14,6 +14,15 @@ type CloudflarePluginOptions = Record<string, unknown>;
14
14
  */
15
15
  type OverlayPluginOptions = NonNullable<Parameters<typeof errorOverlayPlugin>[0]>;
16
16
  interface LunoraPluginOptions {
17
+ /**
18
+ * Allow a client-named NON-default shard / cross-shard fan-out WITHOUT an
19
+ * `authorizeShard`/`authorizeFanOut` callback. The auto-composed class-A worker
20
+ * (`virtual:lunora/worker`) default-denies such access (403 `FORBIDDEN_SHARD`);
21
+ * set this `true` to opt into open access — only safe when every table is
22
+ * protected by per-row RLS. A production sharded app should configure
23
+ * `authorizeShard` instead (via a hand-written class-B worker). Defaults to `false`.
24
+ */
25
+ allowUnauthenticatedShardAccess?: boolean;
17
26
  /**
18
27
  * Which machine-readable API spec(s) codegen emits into `_generated/`.
19
28
  * `"openapi"` (default) writes `openapi.json` (OpenAPI 3.1; RPC + REST),
@@ -43,6 +52,7 @@ interface LunoraPluginOptions {
43
52
  }
44
53
  /** Resolved options after merging defaults. */
45
54
  interface ResolvedLunoraPluginOptions {
55
+ allowUnauthenticatedShardAccess: boolean;
46
56
  apiSpec: NonNullable<CodegenOptions["apiSpec"]>;
47
57
  cloudflare: false | CloudflarePluginOptions;
48
58
  generatedDir: string;
@@ -222,7 +232,7 @@ declare const isAutoComposable: (context: LunoraPluginContext) => boolean;
222
232
  * virtual module id. Absolute paths are resolved correctly in all environments
223
233
  * (Vite 8 + rolldown 1.x confirmed).
224
234
  */
225
- declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean) => string;
235
+ declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean, allowUnauthenticatedShardAccess?: boolean) => string;
226
236
  /**
227
237
  * Vite plugin that auto-composes a detected class-A meta-framework's SSR
228
238
  * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
package/dist/index.d.ts CHANGED
@@ -14,6 +14,15 @@ type CloudflarePluginOptions = Record<string, unknown>;
14
14
  */
15
15
  type OverlayPluginOptions = NonNullable<Parameters<typeof errorOverlayPlugin>[0]>;
16
16
  interface LunoraPluginOptions {
17
+ /**
18
+ * Allow a client-named NON-default shard / cross-shard fan-out WITHOUT an
19
+ * `authorizeShard`/`authorizeFanOut` callback. The auto-composed class-A worker
20
+ * (`virtual:lunora/worker`) default-denies such access (403 `FORBIDDEN_SHARD`);
21
+ * set this `true` to opt into open access — only safe when every table is
22
+ * protected by per-row RLS. A production sharded app should configure
23
+ * `authorizeShard` instead (via a hand-written class-B worker). Defaults to `false`.
24
+ */
25
+ allowUnauthenticatedShardAccess?: boolean;
17
26
  /**
18
27
  * Which machine-readable API spec(s) codegen emits into `_generated/`.
19
28
  * `"openapi"` (default) writes `openapi.json` (OpenAPI 3.1; RPC + REST),
@@ -43,6 +52,7 @@ interface LunoraPluginOptions {
43
52
  }
44
53
  /** Resolved options after merging defaults. */
45
54
  interface ResolvedLunoraPluginOptions {
55
+ allowUnauthenticatedShardAccess: boolean;
46
56
  apiSpec: NonNullable<CodegenOptions["apiSpec"]>;
47
57
  cloudflare: false | CloudflarePluginOptions;
48
58
  generatedDir: string;
@@ -222,7 +232,7 @@ declare const isAutoComposable: (context: LunoraPluginContext) => boolean;
222
232
  * virtual module id. Absolute paths are resolved correctly in all environments
223
233
  * (Vite 8 + rolldown 1.x confirmed).
224
234
  */
225
- declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean) => string;
235
+ declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean, allowUnauthenticatedShardAccess?: boolean) => string;
226
236
  /**
227
237
  * Vite plugin that auto-composes a detected class-A meta-framework's SSR
228
238
  * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
package/dist/index.mjs CHANGED
@@ -8,8 +8,8 @@ import containerLogsPlugin from './packem_shared/containerLogsPlugin-DMssU3wb.mj
8
8
  import devVariablesPlugin from './packem_shared/devVariablesPlugin-CDNSnvOP.mjs';
9
9
  import { createCommandProbe, withDevWorkerEnv } from './packem_shared/DEV_WORKER_ENV_VALUE-Coo6bgVz.mjs';
10
10
  export { DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR } from './packem_shared/DEV_WORKER_ENV_VALUE-Coo6bgVz.mjs';
11
- import { frameworkComposePlugin } from './packem_shared/CLASS_A_WIRING-DpX_WcOK.mjs';
12
- export { CLASS_A_WIRING, LUNORA_WORKER_VIRTUAL_ID, buildWorkerEntrySource, isAutoComposable } from './packem_shared/CLASS_A_WIRING-DpX_WcOK.mjs';
11
+ import { frameworkComposePlugin } from './packem_shared/CLASS_A_WIRING-DWYL4g1x.mjs';
12
+ export { CLASS_A_WIRING, LUNORA_WORKER_VIRTUAL_ID, buildWorkerEntrySource, isAutoComposable } from './packem_shared/CLASS_A_WIRING-DWYL4g1x.mjs';
13
13
  import logStreamPlugin from './packem_shared/logStreamPlugin-CqvZ17kd.mjs';
14
14
  import { planViteRemoteBindings, remoteBindingsCleanupPlugin, withRemoteBindings } from './packem_shared/planViteRemoteBindings-QN5ncUS1.mjs';
15
15
  import { lunoraSolutionFinders } from './packem_shared/lunoraSolutionFinder-BKEAiUJP.mjs';
@@ -109,6 +109,7 @@ const resolveOptions = (options) => {
109
109
  cloudflareOption = input.cloudflare;
110
110
  }
111
111
  return {
112
+ allowUnauthenticatedShardAccess: input.allowUnauthenticatedShardAccess ?? false,
112
113
  apiSpec: input.apiSpec ?? "openapi",
113
114
  cloudflare: cloudflareOption,
114
115
  studio: input.studio ?? true,
@@ -47,7 +47,7 @@ const projectUsesUmbrella = (projectRoot) => {
47
47
  return false;
48
48
  }
49
49
  };
50
- const buildWorkerEntrySource = (framework, generatedImportBase, hasContainers = false, useUmbrella = false) => {
50
+ const buildWorkerEntrySource = (framework, generatedImportBase, hasContainers = false, useUmbrella = false, allowUnauthenticatedShardAccess = false) => {
51
51
  const wiring = CLASS_A_WIRING[framework];
52
52
  if (wiring === void 0) {
53
53
  throw new Error(`[lunora] no class-A worker wiring for framework "${framework}"`);
@@ -72,7 +72,7 @@ let worker;
72
72
 
73
73
  export default {
74
74
  async fetch(request, env, context) {
75
- worker ??= composeWorker({
75
+ worker ??= composeWorker({${allowUnauthenticatedShardAccess ? "\n allowUnauthenticatedShardAccess: true," : ""}
76
76
  functions: LUNORA_FUNCTIONS,
77
77
  httpRouter: ${wiring.handler},
78
78
  openApiSpec,
@@ -95,7 +95,13 @@ const frameworkComposePlugin = (options, context) => {
95
95
  return CLIENT_WORKER_STUB;
96
96
  }
97
97
  const hasContainers = existsSync(join(generatedImportBase, "containers.ts"));
98
- return buildWorkerEntrySource(context.framework.framework, generatedImportBase, hasContainers, useUmbrella);
98
+ return buildWorkerEntrySource(
99
+ context.framework.framework,
100
+ generatedImportBase,
101
+ hasContainers,
102
+ useUmbrella,
103
+ options.allowUnauthenticatedShardAccess
104
+ );
99
105
  }
100
106
  return void 0;
101
107
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vite",
3
- "version": "1.0.0-alpha.39",
3
+ "version": "1.0.0-alpha.40",
4
4
  "description": "The Lunora Vite plugin: codegen, type sync, wrangler validation, and an error overlay over @cloudflare/vite-plugin",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,14 +46,14 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@cloudflare/vite-plugin": "1.42.3",
49
- "@lunora/codegen": "1.0.0-alpha.24",
50
- "@lunora/config": "1.0.0-alpha.39",
49
+ "@lunora/codegen": "1.0.0-alpha.25",
50
+ "@lunora/config": "1.0.0-alpha.40",
51
51
  "@visulima/vite-overlay": "2.0.0-alpha.35",
52
52
  "jsonc-parser": "^3.3.1",
53
53
  "ts-morph": "^28.0.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@lunora/studio": "1.0.0-alpha.25",
56
+ "@lunora/studio": "1.0.0-alpha.26",
57
57
  "vite": "^8.1.0"
58
58
  },
59
59
  "peerDependenciesMeta": {