@lunora/config 1.0.0-alpha.149 → 1.0.0-alpha.150

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.
@@ -0,0 +1 @@
1
+ const n=t=>Array.isArray(t)?t[0]:t,o=(t,e,d,a)=>{if(e.setHeader("Cache-Control","no-cache"),a===void 0)return!1;const r=`W/"${d}-${String(a)}"`;return e.setHeader("ETag",r),n(t.headers?.["if-none-match"])!==r?!1:(e.statusCode=304,e.end(),!0)},c=(t,e)=>{t.statusCode=200,t.setHeader("Cache-Control","no-store"),t.setHeader("Content-Type","text/html; charset=utf-8"),t.end(e)};export{o as applyStudioAssetCache,c as sendStudioDocument};
@@ -1,5 +1,5 @@
1
- import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-fV3db0S_.mjs";
2
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-fV3db0S_.mjs";
3
3
  /**
4
4
  * Parse a single `KEY=value` (optionally quoted) out of a `.dev.vars` body,
5
5
  * returning `undefined` when the key is absent or its value is empty. A thin
@@ -16,6 +16,30 @@ declare const parseDevVariable: (contents: string, key: string) => string | unde
16
16
  * verifies. Returns `undefined` when neither is set (the studio then prompts).
17
17
  */
18
18
  declare const resolveAdminToken: (root: string) => string | undefined;
19
+ /**
20
+ * Set the asset cache headers, answering `304` when the request already holds
21
+ * this version. Returns true when the response is finished, false when the
22
+ * caller should go on to write the body.
23
+ *
24
+ * `no-cache` forces revalidation on every load: an unchanged asset costs a
25
+ * cheap `304`, a rebuild (new stamp, new chunk names) is always fetched fresh.
26
+ * The ETag is keyed on the requested file (not just its kind) so each chunk
27
+ * revalidates independently, while the rebuild stamp busts them all at once. No
28
+ * stamp (the studio isn't resolvable) means no ETag and no `304` — `no-cache`
29
+ * alone.
30
+ *
31
+ * `If-None-Match` is compared byte-for-byte, per RFC 7232: entity tags are
32
+ * case-sensitive, and these are keyed on file names that can differ only in
33
+ * case (base64url chunk names), so a case-insensitive compare would cross-match
34
+ * two distinct chunks into a wrong `304`.
35
+ */
36
+ declare const applyStudioAssetCache: (request: IncomingMessage, response: ServerResponse, fileName: string, stamp: number | undefined) => boolean;
37
+ /**
38
+ * Send the studio's SPA document. It embeds the admin token, so it is
39
+ * `no-store` — not merely revalidated — and carries no ETag: a cached `304` for
40
+ * a token-bearing document would be its own bug.
41
+ */
42
+ declare const sendStudioDocument: (response: ServerResponse, body: Buffer | string) => void;
19
43
  /** Config injected into the studio document before the bundle loads. */
20
44
  interface StudioHtmlConfig {
21
45
  /** Admin token sent with admin requests; omitted (and not injected) when unset. */
@@ -298,7 +322,7 @@ declare const ALLOW_FORWARDED_ENV = "LUNORA_STUDIO_ALLOW_FORWARDED";
298
322
  * the dev server, not just as an opaque 403 in the browser.
299
323
  */
300
324
  declare const transportRejectionReason: (request: IncomingMessage, logger?: WarnLogger) => string | undefined;
301
- export { ALLOW_FORWARDED_ENV, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isStandaloneModulePath, loadStudioAssets,
325
+ export { ALLOW_FORWARDED_ENV, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, applyStudioAssetCache, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isStandaloneModulePath, loadStudioAssets,
302
326
  /**
303
327
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
304
328
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -328,4 +352,4 @@ parseDevVariable, readStandaloneAsset, renderStudioHtml,
328
352
  * config injected, resolve the admin token the same way the worker does, and
329
353
  * load the prebuilt asset bytes.
330
354
  */
331
- resolveAdminToken, resolveStandaloneDirectory, serveJsonHandler, studioAssetsStamp, transportRejectionReason };
355
+ resolveAdminToken, resolveStandaloneDirectory, sendStudioDocument, serveJsonHandler, studioAssetsStamp, transportRejectionReason };
@@ -1,5 +1,5 @@
1
- import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-fV3db0S_.js";
2
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-fV3db0S_.js";
3
3
  /**
4
4
  * Parse a single `KEY=value` (optionally quoted) out of a `.dev.vars` body,
5
5
  * returning `undefined` when the key is absent or its value is empty. A thin
@@ -16,6 +16,30 @@ declare const parseDevVariable: (contents: string, key: string) => string | unde
16
16
  * verifies. Returns `undefined` when neither is set (the studio then prompts).
17
17
  */
18
18
  declare const resolveAdminToken: (root: string) => string | undefined;
19
+ /**
20
+ * Set the asset cache headers, answering `304` when the request already holds
21
+ * this version. Returns true when the response is finished, false when the
22
+ * caller should go on to write the body.
23
+ *
24
+ * `no-cache` forces revalidation on every load: an unchanged asset costs a
25
+ * cheap `304`, a rebuild (new stamp, new chunk names) is always fetched fresh.
26
+ * The ETag is keyed on the requested file (not just its kind) so each chunk
27
+ * revalidates independently, while the rebuild stamp busts them all at once. No
28
+ * stamp (the studio isn't resolvable) means no ETag and no `304` — `no-cache`
29
+ * alone.
30
+ *
31
+ * `If-None-Match` is compared byte-for-byte, per RFC 7232: entity tags are
32
+ * case-sensitive, and these are keyed on file names that can differ only in
33
+ * case (base64url chunk names), so a case-insensitive compare would cross-match
34
+ * two distinct chunks into a wrong `304`.
35
+ */
36
+ declare const applyStudioAssetCache: (request: IncomingMessage, response: ServerResponse, fileName: string, stamp: number | undefined) => boolean;
37
+ /**
38
+ * Send the studio's SPA document. It embeds the admin token, so it is
39
+ * `no-store` — not merely revalidated — and carries no ETag: a cached `304` for
40
+ * a token-bearing document would be its own bug.
41
+ */
42
+ declare const sendStudioDocument: (response: ServerResponse, body: Buffer | string) => void;
19
43
  /** Config injected into the studio document before the bundle loads. */
20
44
  interface StudioHtmlConfig {
21
45
  /** Admin token sent with admin requests; omitted (and not injected) when unset. */
@@ -298,7 +322,7 @@ declare const ALLOW_FORWARDED_ENV = "LUNORA_STUDIO_ALLOW_FORWARDED";
298
322
  * the dev server, not just as an opaque 403 in the browser.
299
323
  */
300
324
  declare const transportRejectionReason: (request: IncomingMessage, logger?: WarnLogger) => string | undefined;
301
- export { ALLOW_FORWARDED_ENV, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isStandaloneModulePath, loadStudioAssets,
325
+ export { ALLOW_FORWARDED_ENV, type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, applyStudioAssetCache, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, headerValue, isLoopbackAddress, isStandaloneModulePath, loadStudioAssets,
302
326
  /**
303
327
  * `@lunora/config/studio-host` — internal, build-time-shared helpers for hosting
304
328
  * the prebuilt `@lunora/studio` SPA during local dev.
@@ -328,4 +352,4 @@ parseDevVariable, readStandaloneAsset, renderStudioHtml,
328
352
  * config injected, resolve the admin token the same way the worker does, and
329
353
  * load the prebuilt asset bytes.
330
354
  */
331
- resolveAdminToken, resolveStandaloneDirectory, serveJsonHandler, studioAssetsStamp, transportRejectionReason };
355
+ resolveAdminToken, resolveStandaloneDirectory, sendStudioDocument, serveJsonHandler, studioAssetsStamp, transportRejectionReason };
@@ -1 +1 @@
1
- import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-C0QlCXhO.mjs";import{assetContentType as s,isStandaloneModulePath as d,loadStudioAssets as n,readStandaloneAsset as l,resolveStandaloneDirectory as p,studioAssetsStamp as m}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{POLICY_SCAFFOLD_ENDPOINT as f,handlePolicyScaffoldRequest as i}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-C1gb9ykA.mjs";import{default as E}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as A,handleSchemaEditRequest as x}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CknH7oga.mjs";import{SEED_ENDPOINT as O,handleSeedRequest as R}from"../packem_shared/SEED_ENDPOINT-DVzCYp6l.mjs";import{serveJsonHandler as c}from"../packem_shared/serveJsonHandler-CB85A2S9.mjs";import{ALLOW_FORWARDED_ENV as P,headerValue as T,isLoopbackAddress as I,transportRejectionReason as L}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{P as ALLOW_FORWARDED_ENV,f as POLICY_SCAFFOLD_ENDPOINT,A as SCHEMA_EDIT_ENDPOINT,O as SEED_ENDPOINT,s as assetContentType,i as handlePolicyScaffoldRequest,x as handleSchemaEditRequest,R as handleSeedRequest,T as headerValue,I as isLoopbackAddress,d as isStandaloneModulePath,n as loadStudioAssets,t as parseDevVariable,l as readStandaloneAsset,E as renderStudioHtml,r as resolveAdminToken,p as resolveStandaloneDirectory,c as serveJsonHandler,m as studioAssetsStamp,L as transportRejectionReason};
1
+ import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-C0QlCXhO.mjs";import{applyStudioAssetCache as s,sendStudioDocument as d}from"../packem_shared/applyStudioAssetCache-DHQEJuuv.mjs";import{assetContentType as l,isStandaloneModulePath as p,loadStudioAssets as m,readStandaloneAsset as S,resolveStandaloneDirectory as i,studioAssetsStamp as f}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{POLICY_SCAFFOLD_ENDPOINT as D,handlePolicyScaffoldRequest as A}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-C1gb9ykA.mjs";import{default as x}from"../packem_shared/renderStudioHtml-ByowDtMl.mjs";import{SCHEMA_EDIT_ENDPOINT as h,handleSchemaEditRequest as N}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CknH7oga.mjs";import{SEED_ENDPOINT as R,handleSeedRequest as _}from"../packem_shared/SEED_ENDPOINT-DVzCYp6l.mjs";import{serveJsonHandler as T}from"../packem_shared/serveJsonHandler-CB85A2S9.mjs";import{ALLOW_FORWARDED_ENV as I,headerValue as L,isLoopbackAddress as v,transportRejectionReason as y}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{I as ALLOW_FORWARDED_ENV,D as POLICY_SCAFFOLD_ENDPOINT,h as SCHEMA_EDIT_ENDPOINT,R as SEED_ENDPOINT,s as applyStudioAssetCache,l as assetContentType,A as handlePolicyScaffoldRequest,N as handleSchemaEditRequest,_ as handleSeedRequest,L as headerValue,v as isLoopbackAddress,p as isStandaloneModulePath,m as loadStudioAssets,t as parseDevVariable,S as readStandaloneAsset,x as renderStudioHtml,r as resolveAdminToken,i as resolveStandaloneDirectory,d as sendStudioDocument,T as serveJsonHandler,f as studioAssetsStamp,y as transportRejectionReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.149",
3
+ "version": "1.0.0-alpha.150",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -54,10 +54,10 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/codegen": "1.0.0-alpha.118",
57
+ "@lunora/codegen": "1.0.0-alpha.119",
58
58
  "@lunora/container": "1.0.0-alpha.32",
59
59
  "@lunora/errors": "1.0.0-alpha.22",
60
- "@lunora/seed": "1.0.0-alpha.77",
60
+ "@lunora/seed": "1.0.0-alpha.78",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.1",
63
63
  "dockerode": "^5.0.1",