@lunora/config 1.0.0-alpha.27 → 1.0.0-alpha.271
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/LICENSE.md +135 -0
- package/README.md +3 -3
- package/dist/cloudflare/index.d.mts +969 -0
- package/dist/cloudflare/index.d.ts +969 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +864 -921
- package/dist/index.d.ts +864 -921
- package/dist/index.mjs +1 -23
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-B8dwEKLn.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-Ci9oJMYb.mjs +1 -0
- package/dist/packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Bj793dir.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +6 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs +1 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-BHABA9u-.mjs +19 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-De7gLGIy.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-0QiGKazX.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D-edJjVY.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-SdRHaUwh.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Dbt0faMd.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-2B56PN_H.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +1 -0
- package/dist/packem_shared/addArgsFor-CWb4cPij.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs +6 -0
- package/dist/packem_shared/applyStudioAssetCache-DHQEJuuv.mjs +1 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs +19 -0
- package/dist/packem_shared/classifyPolicyEdit-D8NwrHxR.mjs +24 -0
- package/dist/packem_shared/collectExportGaps-BJw9LdRV.mjs +2 -0
- package/dist/packem_shared/collectWranglerSecretVariables-D-usPfT8.mjs +1 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/describePreservedCrons-Ci5r2aph.mjs +1 -0
- package/dist/packem_shared/detectFramework-CUiVEHDQ.mjs +1 -0
- package/dist/packem_shared/discover-info-Vj9d4qYt.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-CTdCSfYM.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-EhZtEBQs.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-DJvevsCm.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs +1 -0
- package/dist/packem_shared/interpretRemote-CQ06qpjM.mjs +1 -0
- package/dist/packem_shared/jsonc-edit-BZgQIdAH.mjs +1 -0
- package/dist/packem_shared/lunora-manifest-V77OcyFC.mjs +6 -0
- package/dist/packem_shared/package-secrets-registry-DvtTiK4b.mjs +1 -0
- package/dist/packem_shared/parseDevVariable-teAAahVD.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-7OO_xaKR.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +15 -0
- package/dist/packem_shared/runPostCodegenHook-CVrOTiGB.mjs +1 -0
- package/dist/packem_shared/schema-info.d-DvKkJ7HJ.d.mts +331 -0
- package/dist/packem_shared/schema-info.d-DvKkJ7HJ.d.ts +331 -0
- package/dist/packem_shared/serveJsonHandler-Dv0EdCb9.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/wranglerToAlchemy-SDoS_XY0.mjs +6 -0
- package/dist/packem_shared/write-atomic-9d9xs5ON.mjs +1 -0
- package/dist/studio-host/index.d.mts +250 -95
- package/dist/studio-host/index.d.ts +250 -95
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +15 -7
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs +0 -103
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/buildPackageSecretsBlock-DWDKHViT.mjs +0 -243
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as n}from"node:fs";import{join as s}from"node:path";import{parseDevVariableEntries as i}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";const a=(o,r)=>{const e=i(o).find(t=>t.key===r);return e===void 0||e.value===""?void 0:e.value},d=o=>{let r;try{r=a(n(s(o,".dev.vars"),"utf8"),"LUNORA_ADMIN_TOKEN")}catch{r=void 0}const e=process.env.LUNORA_ADMIN_TOKEN;return typeof e=="string"&&e!==""&&e!==r&&console.warn("[lunora] LUNORA_ADMIN_TOKEN is exported in this shell but differs from .dev.vars — the local worker only verifies the .dev.vars token, so the studio uses that one."),r};export{a as parseDevVariable,d as resolveAdminToken};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Project as m,SyntaxKind as n}from"ts-morph";const f=/^v\s*\.\s*optional\s*\(/u,x=/\.shardBy\(\s*["']([^"']+)["']\s*\)/u,T=/\.global\(\s*(?:\{[^{}]*\}\s*)?\)/u,p=/["']/gu,u=e=>{const t=e.getDescendantsOfKind(n.CallExpression);return e.getKind()===n.CallExpression&&t.push(e.asKindOrThrow(n.CallExpression)),t},A=e=>f.test(e.trim()),h=e=>e?.getKind()!==n.ArrayLiteralExpression?[]:e.asKindOrThrow(n.ArrayLiteralExpression).getElements().filter(t=>t.getKind()===n.StringLiteral).map(t=>t.asKindOrThrow(n.StringLiteral).getLiteralText()),E=e=>{if(e?.getKind()!==n.ObjectLiteralExpression)return!1;const t=e.asKindOrThrow(n.ObjectLiteralExpression).getProperty("unique");return t?.getKind()===n.PropertyAssignment&&t.getInitializer()?.getText()==="true"},K=e=>{const t=e.getExpression();if(t.getKind()!==n.PropertyAccessExpression||t.asKindOrThrow(n.PropertyAccessExpression).getName()!=="index")return;const[r,a,s]=e.getArguments();if(r?.getKind()===n.StringLiteral)return{fields:h(a),name:r.asKindOrThrow(n.StringLiteral).getLiteralText(),unique:E(s)}},O=e=>{const t=e.getInitializer();if(t===void 0)return[];const r=[];for(const a of u(t)){const s=K(a);s!==void 0&&r.push(s)}return r},y=e=>{const t=[],r=e.getInitializer(),s=(r===void 0?void 0:u(r).find(l=>l.getExpression().getText()==="defineTable"))?.getArguments()[0];if(s?.getKind()!==n.ObjectLiteralExpression)return t;for(const l of s.getProperties()){if(l.getKind()!==n.PropertyAssignment)continue;const i=l,o=i.getName().replaceAll(p,""),c=i.getInitializer()?.getText()??"";t.push({name:o,optional:A(c),validator:c})}return t},P=e=>{const r=new m({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",e,{overwrite:!0}),a=r.getDescendantsOfKind(n.CallExpression).find(i=>i.getExpression().getText()==="defineSchema");if(a===void 0)return{ok:!1,reason:r.getImportDeclarations().some(o=>o.getNamedImports().some(c=>c.getName()==="defineSchema"&&c.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const s=a.getArguments()[0];if(s?.getKind()!==n.ObjectLiteralExpression)return{ok:!1,reason:"non-object-argument"};const l=[];for(const i of s.getProperties()){if(i.getKind()!==n.PropertyAssignment)continue;const o=i,c=o.getName().replaceAll(p,""),g=o.getInitializer()?.getText()??"",d=x.exec(g);l.push({columns:y(o),global:T.test(g),indexes:O(o),name:c,...d?.[1]===void 0?{}:{shardBy:d[1]}})}return{ok:!0,tables:l}};export{u as collectCalls,P as parseSchema};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server-module specifier to scaffold into a project's own source:
|
|
3
|
+
* `lunorash/server` when the project depends on the umbrella, `@lunora/server`
|
|
4
|
+
* when it installs the granular packages. Same detection codegen and the Vite
|
|
5
|
+
* compose plugin use, so a scaffolded file imports what the emitted code does.
|
|
6
|
+
*/
|
|
7
|
+
declare const resolveServerModule: (projectRoot: string) => string;
|
|
8
|
+
/** Scaffold a new policy/role/permission stub file under `lunora/`. */
|
|
9
|
+
interface ScaffoldPolicyEdit {
|
|
10
|
+
readonly kind: "scaffoldPolicy";
|
|
11
|
+
/**
|
|
12
|
+
* Base name for the generated file and its exported policy-set identifier,
|
|
13
|
+
* e.g. `invoices` → `lunora/invoices.policies.ts` exporting `invoicesPolicies`.
|
|
14
|
+
*/
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Logical table the scaffolded policy guards (used in the stub body). */
|
|
17
|
+
readonly table: string;
|
|
18
|
+
}
|
|
19
|
+
/** Append `.use(rls(<policies>))` to an existing procedure's builder chain. */
|
|
20
|
+
interface WireRlsEdit {
|
|
21
|
+
/** Exported procedure name to wire, e.g. `listInvoices`. */
|
|
22
|
+
readonly exportName: string;
|
|
23
|
+
readonly kind: "wireRls";
|
|
24
|
+
/** Identifier of the policy set passed to `rls(...)`, e.g. `invoicesPolicies`. */
|
|
25
|
+
readonly policies: string;
|
|
26
|
+
}
|
|
27
|
+
/** Additive scaffolder edits — the only requests the scaffolder applies. */
|
|
28
|
+
type AdditivePolicyEdit = ScaffoldPolicyEdit | WireRlsEdit;
|
|
29
|
+
/**
|
|
30
|
+
* Destructive scaffolder requests — never applied. Rewriting an existing `when`
|
|
31
|
+
* body changes evaluation semantics silently, so it is refused (STOP condition
|
|
32
|
+
* in plan 025); carried as data so the editor can describe the request.
|
|
33
|
+
*/
|
|
34
|
+
interface DestructivePolicyEdit {
|
|
35
|
+
readonly exportName?: string;
|
|
36
|
+
readonly kind: "rewritePolicyWhen";
|
|
37
|
+
readonly table?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Any request the scaffolder can receive. */
|
|
40
|
+
type PolicyEdit = AdditivePolicyEdit | DestructivePolicyEdit;
|
|
41
|
+
/**
|
|
42
|
+
* Classify a scaffolder request. Additive requests ({@link AdditivePolicyEdit})
|
|
43
|
+
* apply directly; everything else (rewriting an existing predicate) changes
|
|
44
|
+
* evaluation semantics and is destructive.
|
|
45
|
+
*/
|
|
46
|
+
declare const classifyPolicyEdit: (edit: PolicyEdit) => "additive" | "destructive";
|
|
47
|
+
/** Failure reasons a scaffolder request can report. */
|
|
48
|
+
type PolicyScaffoldFailureReason = "already-wired" | "destructive" | "invalid-identifier" | "unknown-procedure" | "unsupported-procedure-shape";
|
|
49
|
+
/** Tagged result of generating a stub file. */
|
|
50
|
+
type ScaffoldFileResult = {
|
|
51
|
+
fileName: string;
|
|
52
|
+
ok: true;
|
|
53
|
+
source: string;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
reason: PolicyScaffoldFailureReason;
|
|
57
|
+
};
|
|
58
|
+
/** Tagged result of wiring a procedure. */
|
|
59
|
+
type WireResult = {
|
|
60
|
+
ok: false;
|
|
61
|
+
reason: PolicyScaffoldFailureReason;
|
|
62
|
+
} | {
|
|
63
|
+
ok: true;
|
|
64
|
+
text: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Generate the source of a new policy/role/permission stub file. The `when`
|
|
68
|
+
* predicate is a `() => false` skeleton with a TODO — the scaffolder never
|
|
69
|
+
* authors real logic, the developer fills it in. Pure (no I/O); the handler
|
|
70
|
+
* writes the returned source and refuses to overwrite an existing file.
|
|
71
|
+
*
|
|
72
|
+
* `serverModule` is the specifier the PROJECT can resolve the builders from
|
|
73
|
+
* (see {@link resolveServerModule}) — an umbrella-only install has no
|
|
74
|
+
* `@lunora/server` on disk, so hard-coding it would scaffold a file that
|
|
75
|
+
* cannot be bundled.
|
|
76
|
+
*/
|
|
77
|
+
declare const scaffoldPolicyFile: (edit: ScaffoldPolicyEdit, serverModule: string) => ScaffoldFileResult;
|
|
78
|
+
/**
|
|
79
|
+
* Append `.use(rls(<policies>))` to a procedure's builder chain, preserving the
|
|
80
|
+
* terminal `.query(handler)` (and its handler body) byte-for-byte. Only the
|
|
81
|
+
* **builder** form can be wired; the bare-factory form (`query({ handler })`)
|
|
82
|
+
* has no chain and is reported `unsupported-procedure-shape` so the editor can
|
|
83
|
+
* tell the developer to convert it rather than silently rewriting their code.
|
|
84
|
+
*/
|
|
85
|
+
declare const wireRlsIntoProcedure: (source: string, edit: WireRlsEdit, serverModule: string) => WireResult;
|
|
86
|
+
export { AdditivePolicyEdit as A, DestructivePolicyEdit as D, PolicyEdit as P, ScaffoldPolicyEdit as S, WireRlsEdit as W, PolicyScaffoldFailureReason as a, ScaffoldFileResult as b, WireResult as c, classifyPolicyEdit as d, resolveServerModule as r, scaffoldPolicyFile as s, wireRlsIntoProcedure as w };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server-module specifier to scaffold into a project's own source:
|
|
3
|
+
* `lunorash/server` when the project depends on the umbrella, `@lunora/server`
|
|
4
|
+
* when it installs the granular packages. Same detection codegen and the Vite
|
|
5
|
+
* compose plugin use, so a scaffolded file imports what the emitted code does.
|
|
6
|
+
*/
|
|
7
|
+
declare const resolveServerModule: (projectRoot: string) => string;
|
|
8
|
+
/** Scaffold a new policy/role/permission stub file under `lunora/`. */
|
|
9
|
+
interface ScaffoldPolicyEdit {
|
|
10
|
+
readonly kind: "scaffoldPolicy";
|
|
11
|
+
/**
|
|
12
|
+
* Base name for the generated file and its exported policy-set identifier,
|
|
13
|
+
* e.g. `invoices` → `lunora/invoices.policies.ts` exporting `invoicesPolicies`.
|
|
14
|
+
*/
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Logical table the scaffolded policy guards (used in the stub body). */
|
|
17
|
+
readonly table: string;
|
|
18
|
+
}
|
|
19
|
+
/** Append `.use(rls(<policies>))` to an existing procedure's builder chain. */
|
|
20
|
+
interface WireRlsEdit {
|
|
21
|
+
/** Exported procedure name to wire, e.g. `listInvoices`. */
|
|
22
|
+
readonly exportName: string;
|
|
23
|
+
readonly kind: "wireRls";
|
|
24
|
+
/** Identifier of the policy set passed to `rls(...)`, e.g. `invoicesPolicies`. */
|
|
25
|
+
readonly policies: string;
|
|
26
|
+
}
|
|
27
|
+
/** Additive scaffolder edits — the only requests the scaffolder applies. */
|
|
28
|
+
type AdditivePolicyEdit = ScaffoldPolicyEdit | WireRlsEdit;
|
|
29
|
+
/**
|
|
30
|
+
* Destructive scaffolder requests — never applied. Rewriting an existing `when`
|
|
31
|
+
* body changes evaluation semantics silently, so it is refused (STOP condition
|
|
32
|
+
* in plan 025); carried as data so the editor can describe the request.
|
|
33
|
+
*/
|
|
34
|
+
interface DestructivePolicyEdit {
|
|
35
|
+
readonly exportName?: string;
|
|
36
|
+
readonly kind: "rewritePolicyWhen";
|
|
37
|
+
readonly table?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Any request the scaffolder can receive. */
|
|
40
|
+
type PolicyEdit = AdditivePolicyEdit | DestructivePolicyEdit;
|
|
41
|
+
/**
|
|
42
|
+
* Classify a scaffolder request. Additive requests ({@link AdditivePolicyEdit})
|
|
43
|
+
* apply directly; everything else (rewriting an existing predicate) changes
|
|
44
|
+
* evaluation semantics and is destructive.
|
|
45
|
+
*/
|
|
46
|
+
declare const classifyPolicyEdit: (edit: PolicyEdit) => "additive" | "destructive";
|
|
47
|
+
/** Failure reasons a scaffolder request can report. */
|
|
48
|
+
type PolicyScaffoldFailureReason = "already-wired" | "destructive" | "invalid-identifier" | "unknown-procedure" | "unsupported-procedure-shape";
|
|
49
|
+
/** Tagged result of generating a stub file. */
|
|
50
|
+
type ScaffoldFileResult = {
|
|
51
|
+
fileName: string;
|
|
52
|
+
ok: true;
|
|
53
|
+
source: string;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
reason: PolicyScaffoldFailureReason;
|
|
57
|
+
};
|
|
58
|
+
/** Tagged result of wiring a procedure. */
|
|
59
|
+
type WireResult = {
|
|
60
|
+
ok: false;
|
|
61
|
+
reason: PolicyScaffoldFailureReason;
|
|
62
|
+
} | {
|
|
63
|
+
ok: true;
|
|
64
|
+
text: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Generate the source of a new policy/role/permission stub file. The `when`
|
|
68
|
+
* predicate is a `() => false` skeleton with a TODO — the scaffolder never
|
|
69
|
+
* authors real logic, the developer fills it in. Pure (no I/O); the handler
|
|
70
|
+
* writes the returned source and refuses to overwrite an existing file.
|
|
71
|
+
*
|
|
72
|
+
* `serverModule` is the specifier the PROJECT can resolve the builders from
|
|
73
|
+
* (see {@link resolveServerModule}) — an umbrella-only install has no
|
|
74
|
+
* `@lunora/server` on disk, so hard-coding it would scaffold a file that
|
|
75
|
+
* cannot be bundled.
|
|
76
|
+
*/
|
|
77
|
+
declare const scaffoldPolicyFile: (edit: ScaffoldPolicyEdit, serverModule: string) => ScaffoldFileResult;
|
|
78
|
+
/**
|
|
79
|
+
* Append `.use(rls(<policies>))` to a procedure's builder chain, preserving the
|
|
80
|
+
* terminal `.query(handler)` (and its handler body) byte-for-byte. Only the
|
|
81
|
+
* **builder** form can be wired; the bare-factory form (`query({ handler })`)
|
|
82
|
+
* has no chain and is reported `unsupported-procedure-shape` so the editor can
|
|
83
|
+
* tell the developer to convert it rather than silently rewriting their code.
|
|
84
|
+
*/
|
|
85
|
+
declare const wireRlsIntoProcedure: (source: string, edit: WireRlsEdit, serverModule: string) => WireResult;
|
|
86
|
+
export { AdditivePolicyEdit as A, DestructivePolicyEdit as D, PolicyEdit as P, ScaffoldPolicyEdit as S, WireRlsEdit as W, PolicyScaffoldFailureReason as a, ScaffoldFileResult as b, WireResult as c, classifyPolicyEdit as d, resolveServerModule as r, scaffoldPolicyFile as s, wireRlsIntoProcedure as w };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as d}from"node:fs";import{modify as c,applyEdits as s}from"jsonc-parser";import{F as l}from"./jsonc-edit-BZgQIdAH.mjs";import{isCacheEnabled as f,WORKERS_CACHE_MIN_DATE as a}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{findWranglerFile as m,readWranglerJsonc as p}from"./WRANGLER_FILES-UNW-xY5u.mjs";const _=i=>{const e=m(i);if(!e)return{changed:!1,date:void 0,reason:"wrangler.jsonc not found"};const{parsed:r,text:n}=p(e);if(r===void 0)return{changed:!1,date:void 0,reason:`failed to parse ${e} as JSONC`,wranglerPath:e};const t=r.compatibility_date??"";if(!f(r))return{changed:!1,date:t||void 0,reason:"cache not enabled",wranglerPath:e};if(t>=a)return{changed:!1,date:t,reason:`compatibility_date already >= ${a}`,wranglerPath:e};const o=c(n,["compatibility_date"],a,l);return o.length===0?{changed:!1,date:t||void 0,reason:"no structural edit produced",wranglerPath:e}:(d(e,s(n,o),"utf8"),{changed:!0,date:a,wranglerPath:e})};export{_ as reconcileWranglerCompatibilityDate};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const r=t=>JSON.stringify(t).replaceAll("<",String.raw`\u003c`),i=t=>t.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<"),_=t=>{const e=[`window.__LUNORA_BASE_PATH__=${r(t.basePath)};`];return t.adminToken!==void 0&&t.adminToken!==""&&e.push(`window.__LUNORA_ADMIN_TOKEN__=${r(t.adminToken)};`),t.dataEditable===!0&&e.push("window.__LUNORA_DATA_EDITABLE__=true;"),t.runAsIdentity===!0&&e.push("window.__LUNORA_RUN_AS_IDENTITY__=true;"),t.schemaEditable===!0&&e.push("window.__LUNORA_SCHEMA_EDITABLE__=true;"),t.rulesInstalled===!1&&e.push("window.__LUNORA_RULES_INSTALLED__=false;"),`<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Lunora Studio</title>
|
|
7
|
+
<script>${e.join("")}<\/script>
|
|
8
|
+
<link rel="stylesheet" href="${i(t.styleHref)}" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="${i(t.scriptSrc)}"><\/script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
15
|
+
`};export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as i}from"node:child_process";import{existsSync as d,readFileSync as u}from"node:fs";import{join as f}from"node:path";import{runScriptArgsFor as g,detectPackageManager as m}from"./addArgsFor-CWb4cPij.mjs";const o="postcodegen",l=r=>new Promise((n,s)=>{const e=i(r.command,[...r.args],{cwd:r.cwd??process.cwd(),shell:process.platform==="win32",stdio:["inherit",r.stdoutToStderr===!0?2:"inherit","inherit"]});e.on("error",s),e.on("close",a=>{n({code:a??1})})}),p=r=>{const n=f(r,"package.json");if(!d(n))return!1;try{const e=JSON.parse(u(n,"utf8"))?.scripts;return typeof e?.[o]=="string"&&e[o]!==""}catch{return!1}},P=async r=>{const{cwd:n,logger:s}=r;if(!p(n))return{ran:!1};const e=t=>(s.error(t),{error:t,ran:!0});let a;try{a=g(m(n),o)}catch(t){return e(`cannot run \`${o}\`: ${t instanceof Error?t.message:String(t)}`)}s.info(`running \`${o}\``);let c;try{c=await(r.spawner??l)({args:a.args,command:a.command,cwd:n,stdoutToStderr:r.stdoutToStderr})}catch(t){return e(`\`${o}\` failed to start: ${t instanceof Error?t.message:String(t)}`)}return c.code!==0?e(`\`${o}\` exited ${String(c.code)}`):{ran:!0}};export{P as runPostCodegenHook};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { AgentIR, ContainerIR, QueueIR, WorkflowIR } from '@lunora/codegen';
|
|
2
|
+
/**
|
|
3
|
+
* `DeployDriver` — the provider-neutral seam between a Lunora command and the
|
|
4
|
+
* host CLI that carries it out (plan 114, §5.3).
|
|
5
|
+
*
|
|
6
|
+
* The seam is the **toolchain surface**: which command a host runs to deploy,
|
|
7
|
+
* serve, tail, or set a secret. A driver only *describes* that command
|
|
8
|
+
* ({@link ToolchainCommand}); it never spawns. The CLI keeps ownership of
|
|
9
|
+
* running it — package-manager resolution (`pnpm exec` / `npx --` / `bun x`)
|
|
10
|
+
* and the injected spawner its tests substitute — so the driver stays free of
|
|
11
|
+
* process concerns and remains trivially testable as a pure function.
|
|
12
|
+
*
|
|
13
|
+
* Each request type below is deliberately neutral: `preview`, `environment`,
|
|
14
|
+
* `temporary` are concepts, not wrangler flags. A second host maps the same
|
|
15
|
+
* request onto its own CLI without the caller changing.
|
|
16
|
+
*
|
|
17
|
+
* Two drivers are registered: Cloudflare (`cloudflare/cloudflare-driver.ts`),
|
|
18
|
+
* which is the only one with a toolchain, and Node (`node/node-driver.ts`),
|
|
19
|
+
* which has none — it is a codegen target, and `lunora deploy` / `lunora dev`
|
|
20
|
+
* refuse it at selection.
|
|
21
|
+
*
|
|
22
|
+
* **What this seam deliberately does NOT carry: configuration inference.** It
|
|
23
|
+
* used to, through an `infer`/`provision` pair over a provider-neutral
|
|
24
|
+
* `ResourceGraph`. Nothing ever called either one — every consumer reads
|
|
25
|
+
* `.toolchain` or just validates the target — and the arm rotted in place: the
|
|
26
|
+
* Node driver was *only* `infer` + `provision`, so its report of what that
|
|
27
|
+
* target cannot serve (containers, undispatched crons) could not reach an
|
|
28
|
+
* operator however wrong the app was. The reason it never got wired is worth
|
|
29
|
+
* keeping: writing real host configuration needs the host's own encodings —
|
|
30
|
+
* binding names, DO class wiring, migration tags — which a neutral graph
|
|
31
|
+
* necessarily discards, so `provision` re-derived them anyway and the graph was
|
|
32
|
+
* decorative. A second target that needs to share inference should grow the
|
|
33
|
+
* seam back with a caller attached, and with an encoding escape hatch.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* A host CLI invocation, described but not run.
|
|
37
|
+
*
|
|
38
|
+
* `tool` is the binary name only (`"wrangler"`); the caller resolves how to
|
|
39
|
+
* execute it through the project's package manager. Keeping that split means a
|
|
40
|
+
* driver never has to know whether the project uses pnpm, npm, yarn, or bun.
|
|
41
|
+
*/
|
|
42
|
+
interface ToolchainCommand {
|
|
43
|
+
/** Arguments for {@link ToolchainCommand.tool}. */
|
|
44
|
+
args: ReadonlyArray<string>;
|
|
45
|
+
/** The host CLI binary, e.g. `"wrangler"`. */
|
|
46
|
+
tool: string;
|
|
47
|
+
}
|
|
48
|
+
/** Neutral options for a deploy. */
|
|
49
|
+
interface DeployRequest {
|
|
50
|
+
/** Validate and bundle without publishing — nothing ships. */
|
|
51
|
+
dryRun?: boolean;
|
|
52
|
+
/** Deploy this entry file instead of the host config's default (framework composition). */
|
|
53
|
+
entry?: string;
|
|
54
|
+
/** Named deployment environment, when the host supports them. */
|
|
55
|
+
environment?: string;
|
|
56
|
+
/** Write the built bundle (and any build metadata) to this directory. */
|
|
57
|
+
outDir?: string;
|
|
58
|
+
/** Upload a preview/versioned artifact instead of taking production traffic. */
|
|
59
|
+
preview?: boolean;
|
|
60
|
+
/** Deploy to a short-lived, unauthenticated account where the host offers one. */
|
|
61
|
+
temporary?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Neutral options for a local dev server. */
|
|
64
|
+
interface DevRequest {
|
|
65
|
+
/** Host config file to run against, when the flow uses a generated one. */
|
|
66
|
+
configPath?: string;
|
|
67
|
+
/** Named environment. */
|
|
68
|
+
environment?: string;
|
|
69
|
+
/** Extra host-specific flags the caller has already resolved. */
|
|
70
|
+
extraArgs?: ReadonlyArray<string>;
|
|
71
|
+
}
|
|
72
|
+
/** Neutral options for tailing live logs. */
|
|
73
|
+
interface TailRequest {
|
|
74
|
+
/** Named environment. */
|
|
75
|
+
environment?: string;
|
|
76
|
+
/** Output format the host tail supports (`"json"`, `"pretty"`, …). */
|
|
77
|
+
format?: string;
|
|
78
|
+
/** Free-text filter. */
|
|
79
|
+
search?: string;
|
|
80
|
+
/** Status filter (`"error"`, `"ok"`, …). */
|
|
81
|
+
status?: string;
|
|
82
|
+
/** Tail a short-lived account's deployment. */
|
|
83
|
+
temporary?: boolean;
|
|
84
|
+
/** Tail a specific deployed worker/service by name, when the host addresses them individually. */
|
|
85
|
+
worker?: string;
|
|
86
|
+
}
|
|
87
|
+
/** Neutral options for reading or writing deployment secrets. */
|
|
88
|
+
interface SecretRequest {
|
|
89
|
+
/** Named environment. */
|
|
90
|
+
environment?: string;
|
|
91
|
+
/** The secret's name — required for `put`, unused for `list`. */
|
|
92
|
+
key?: string;
|
|
93
|
+
/** Operate against a short-lived account. */
|
|
94
|
+
temporary?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The host's command-line surface. Optional as a whole: a host with no vendor
|
|
98
|
+
* CLI (the Node target; a hypothetical API-driven one) declares none, and
|
|
99
|
+
* `isRunnableTarget` refuses it for the commands that would have to shell out.
|
|
100
|
+
*/
|
|
101
|
+
interface DriverToolchain {
|
|
102
|
+
/** The command that deploys the app. */
|
|
103
|
+
deploy: (request: DeployRequest) => ToolchainCommand;
|
|
104
|
+
/** The command that runs a local dev server. */
|
|
105
|
+
dev: (request: DevRequest) => ToolchainCommand;
|
|
106
|
+
/** The command that lists remote secret names. */
|
|
107
|
+
secretList: (request: SecretRequest) => ToolchainCommand;
|
|
108
|
+
/** The command that writes one secret. Its value is passed on stdin, never argv. */
|
|
109
|
+
secretPut: (request: SecretRequest) => ToolchainCommand;
|
|
110
|
+
/** The command that tails live logs. */
|
|
111
|
+
tail: (request: TailRequest) => ToolchainCommand;
|
|
112
|
+
}
|
|
113
|
+
/** A deploy target's implementation: an identity the registry resolves, and the host CLI surface (if any) behind it. */
|
|
114
|
+
interface DeployDriver {
|
|
115
|
+
/** The target id this driver serves (`"cloudflare"`, …) — matches codegen's `target`. */
|
|
116
|
+
readonly id: string;
|
|
117
|
+
/** Human-readable target name, for logs. */
|
|
118
|
+
readonly name: string;
|
|
119
|
+
/**
|
|
120
|
+
* The host's command-line surface, or `undefined` for a host that has none.
|
|
121
|
+
* Pure: these build argv, they never spawn.
|
|
122
|
+
*/
|
|
123
|
+
readonly toolchain?: DriverToolchain;
|
|
124
|
+
}
|
|
125
|
+
interface DurableObjectSpec {
|
|
126
|
+
binding: string;
|
|
127
|
+
className: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A `defineContainer` declaration plus whether its generated DO class is
|
|
131
|
+
* exported by the worker entry. Only exported containers are safe to
|
|
132
|
+
* provision — wrangler rejects a `containers[].class_name` (and its Durable
|
|
133
|
+
* Object binding) that the worker doesn't export.
|
|
134
|
+
*/
|
|
135
|
+
interface InferredContainer extends ContainerIR {
|
|
136
|
+
exported: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A `defineWorkflow` declaration plus whether its generated
|
|
140
|
+
* `WorkflowEntrypoint` class is exported by the worker entry. Only exported
|
|
141
|
+
* workflows are safe to provision — wrangler rejects a `workflows[].class_name`
|
|
142
|
+
* the worker doesn't export. Workflows are NOT Durable Objects, so this never
|
|
143
|
+
* implies a `durable_objects` binding or migration.
|
|
144
|
+
*/
|
|
145
|
+
interface InferredWorkflow extends WorkflowIR {
|
|
146
|
+
exported: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A `defineAgent` declaration plus whether its generated agent
|
|
150
|
+
* `WorkflowEntrypoint` class (e.g. `SupportAgentWorkflow`) is exported by the
|
|
151
|
+
* worker entry. An agent compiles onto a Cloudflare Workflow, so — exactly like
|
|
152
|
+
* {@link InferredWorkflow} — only exported agents are safe to provision
|
|
153
|
+
* (wrangler rejects a `workflows[].class_name` the worker doesn't export), and
|
|
154
|
+
* an agent is NOT a Durable Object (no `durable_objects` binding or migration).
|
|
155
|
+
*/
|
|
156
|
+
interface InferredAgent extends AgentIR {
|
|
157
|
+
exported: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A queue declared in `lunora/queues.ts`. Unlike workflows, a queue needs no
|
|
161
|
+
* worker-entry class export (its `queue()` handler rides `createWorker`), so
|
|
162
|
+
* there is no `exported` flag — every declared queue is reconcilable into the
|
|
163
|
+
* wrangler `queues.producers[]` / `queues.consumers[]`.
|
|
164
|
+
*/
|
|
165
|
+
type InferredQueue = QueueIR;
|
|
166
|
+
interface InferredBindings {
|
|
167
|
+
/** Agents declared in `lunora/agents.ts` (exported or not — see {@link InferredAgent.exported}); reconciled into `workflows[]`. */
|
|
168
|
+
agents: InferredAgent[];
|
|
169
|
+
/** Containers declared in `lunora/containers.ts` (exported or not — see {@link InferredContainer.exported}). */
|
|
170
|
+
containers: InferredContainer[];
|
|
171
|
+
/** Durable Objects the worker entry exports → safe to bind. */
|
|
172
|
+
durableObjects: DurableObjectSpec[];
|
|
173
|
+
/**
|
|
174
|
+
* The wrangler `flagship[].binding` name implied by `lunora/flags.ts` when it
|
|
175
|
+
* uses the Flagship provider in binding mode — `undefined` for HTTP-mode
|
|
176
|
+
* Flagship, a custom OpenFeature provider, or no flags. The binding needs an
|
|
177
|
+
* un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
|
|
178
|
+
*/
|
|
179
|
+
flagshipBinding?: string;
|
|
180
|
+
/** Schema declares a `.global()` table → needs the `DB` D1 binding. */
|
|
181
|
+
needsD1: boolean;
|
|
182
|
+
/** Queues declared in `lunora/queues.ts` → reconciled into `queues.producers[]` / `queues.consumers[]`. */
|
|
183
|
+
queues: InferredQueue[];
|
|
184
|
+
/** Human-readable provenance for each inferred binding / hint, for logging. */
|
|
185
|
+
signals: string[];
|
|
186
|
+
/** `@lunora/ai` is imported or `env.AI` is used → needs the `ai` Workers AI binding. */
|
|
187
|
+
usesAi: boolean;
|
|
188
|
+
/** `@lunora/bindings/analytics` is imported → self-describing `analytics_engine_datasets` binding (auto-writeable). */
|
|
189
|
+
usesAnalytics: boolean;
|
|
190
|
+
/** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
|
|
191
|
+
usesAuth: boolean;
|
|
192
|
+
/** `@lunora/browser` is imported → self-describing `browser` binding (auto-writeable). */
|
|
193
|
+
usesBrowser: boolean;
|
|
194
|
+
/** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
|
|
195
|
+
usesFlags: boolean;
|
|
196
|
+
/** `@lunora/hyperdrive` is imported (binding needs an un-mintable remote `id`; hint-only). */
|
|
197
|
+
usesHyperdrive: boolean;
|
|
198
|
+
/** `@lunora/bindings/images` is imported → self-describing `images` binding (auto-writeable). */
|
|
199
|
+
usesImages: boolean;
|
|
200
|
+
/** `@lunora/bindings/kv` is imported (namespace binding name + id are user-defined; hint-only). */
|
|
201
|
+
usesKv: boolean;
|
|
202
|
+
/** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). */
|
|
203
|
+
usesMail: boolean;
|
|
204
|
+
/** `@lunora/notify` is imported (Web Push needs VAPID/FCM secrets in `.dev.vars`; no binding). */
|
|
205
|
+
usesNotify: boolean;
|
|
206
|
+
/** `@lunora/payment` is imported (provider secrets must be set in `.dev.vars`; no binding). */
|
|
207
|
+
usesPayment: boolean;
|
|
208
|
+
/** `ctx.pipelines` is used (binding needs an un-mintable remote pipeline name; hint-only). */
|
|
209
|
+
usesPipelines: boolean;
|
|
210
|
+
/** `ctx.r2sql` is used (needs the `R2_SQL_*` secrets in `.dev.vars`; no binding). */
|
|
211
|
+
usesR2sql: boolean;
|
|
212
|
+
/** `@lunora/scheduler` is imported. */
|
|
213
|
+
usesScheduler: boolean;
|
|
214
|
+
/** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
|
|
215
|
+
usesStorage: boolean;
|
|
216
|
+
/** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
|
|
217
|
+
usesX402Charge: boolean;
|
|
218
|
+
/** `@lunora/x402/pay` is imported — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
|
|
219
|
+
usesX402Pay: boolean;
|
|
220
|
+
/** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
|
|
221
|
+
workflows: InferredWorkflow[];
|
|
222
|
+
}
|
|
223
|
+
interface InferOptions {
|
|
224
|
+
projectRoot: string;
|
|
225
|
+
/** Directories (relative to root) to scan. Defaults to `lunora` + `src`. */
|
|
226
|
+
scanDirs?: ReadonlyArray<string>;
|
|
227
|
+
/** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
|
|
228
|
+
schemaDir?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The `_generated/` modules that hold a generated Durable Object / Workflow
|
|
232
|
+
* class — one per class kind a project can declare. wrangler validates every
|
|
233
|
+
* `class_name` against the worker's exports, so this is the set a worker entry
|
|
234
|
+
* re-exports (and the set the composed class-A entry star-re-exports for the
|
|
235
|
+
* kinds the project has).
|
|
236
|
+
*
|
|
237
|
+
* Owned here because four places need it and they must not drift:
|
|
238
|
+
* `@lunora/vite` emits one star re-export per entry, the wrangler validator
|
|
239
|
+
* DECIDES the composed entry's exports from it, `reconcile-bindings` types its
|
|
240
|
+
* export-gap `module` field on it, and this module's own `detectClassExports`
|
|
241
|
+
* probes the same names.
|
|
242
|
+
*
|
|
243
|
+
* `scheduler` carries no `define*` declarations of its own — codegen writes it
|
|
244
|
+
* off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
|
|
245
|
+
* to forward. Its presence is therefore the ONLY signal the plugin and the
|
|
246
|
+
* validator need, and it is the same signal that decides whether the builder
|
|
247
|
+
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
248
|
+
* owning it is the direction the dependency graph allows.
|
|
249
|
+
*/
|
|
250
|
+
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
|
|
251
|
+
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
252
|
+
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
253
|
+
/**
|
|
254
|
+
* The class-B composed entry. `lunora deploy` passes this file to wrangler as
|
|
255
|
+
* the positional script whenever it exists, overriding `wrangler.main` — so it
|
|
256
|
+
* is what actually gets bundled and what wrangler checks its DO/Workflow
|
|
257
|
+
* bindings against. `main` in a class-B project names the framework adapter's
|
|
258
|
+
* build output (`.svelte-kit/cloudflare/_worker.js`, `dist/_worker.js`), which
|
|
259
|
+
* exists after `vite build` and exports only the SSR fetch handler. Lexing that
|
|
260
|
+
* instead read every declared class as unexported: nothing provisioned, plus a
|
|
261
|
+
* "add `export * from …`" warning the user cannot silence.
|
|
262
|
+
*
|
|
263
|
+
* Exported, not documented-as-duplicated: the CLI's `resolveComposedWorkerEntry`
|
|
264
|
+
* imports this constant, so the deploy's positional entry and the file this
|
|
265
|
+
* module lexes for exported classes cannot drift apart.
|
|
266
|
+
*/
|
|
267
|
+
declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
268
|
+
/**
|
|
269
|
+
* Scan a Lunora project and report which Cloudflare bindings its code implies.
|
|
270
|
+
* Read-only: performs no writes. Binding provisioning is driven by the worker
|
|
271
|
+
* entry's Durable Object exports plus the schema's D1 need; capability imports
|
|
272
|
+
* surface as hints.
|
|
273
|
+
*/
|
|
274
|
+
declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBindings>;
|
|
275
|
+
/**
|
|
276
|
+
* Derive the list of `@lunora/*` package names that are actively used by a
|
|
277
|
+
* project, based on its already-resolved {@link InferredBindings}.
|
|
278
|
+
*
|
|
279
|
+
* This is the canonical bridge between binding inference and the package-aware
|
|
280
|
+
* `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
|
|
281
|
+
* a stable, predictable slice of {@link CAPABILITY_SOURCES} source values,
|
|
282
|
+
* filtered to the flags that are `true` in `bindings` — in CAPABILITY_SOURCES
|
|
283
|
+
* declaration order.
|
|
284
|
+
*/
|
|
285
|
+
declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
|
|
286
|
+
/** One filterable Vectorize metadata property a schema declares. */
|
|
287
|
+
interface VectorMetadataDeclaration {
|
|
288
|
+
/** The vector index the property belongs to. */
|
|
289
|
+
index: string;
|
|
290
|
+
/**
|
|
291
|
+
* The validator kind behind the column, or `undefined` when the column
|
|
292
|
+
* isn't in the owning table's shape. Callers map it to the Vectorize
|
|
293
|
+
* metadata type; a kind that can't be filtered on is reported, not indexed.
|
|
294
|
+
*/
|
|
295
|
+
kind: string | undefined;
|
|
296
|
+
/** Column mirrored into vector metadata. */
|
|
297
|
+
property: string;
|
|
298
|
+
}
|
|
299
|
+
interface SchemaInfo {
|
|
300
|
+
/**
|
|
301
|
+
* Whether the schema declares a **D1-backed** `.global()` table — the only
|
|
302
|
+
* flavour that needs the `DB` binding and the app's `.global({ d1 })` chain.
|
|
303
|
+
* A `.global({ backend: "hyperdrive" })` table needs neither, and counting it
|
|
304
|
+
* here demanded a D1 database of a project that has none.
|
|
305
|
+
*/
|
|
306
|
+
hasD1GlobalTable: boolean;
|
|
307
|
+
/** Whether the schema declares a `.global({ backend: "hyperdrive" })` table — needs the app's `.hyperdriveGlobal(...)` chain instead. Required, not optional: the only producer always knows the answer, and `?` made every consumer read a two-valued fact as three-valued. */
|
|
308
|
+
hasHyperdriveGlobalTable: boolean;
|
|
309
|
+
/** Names of vector indexes declared via `.vectorize()` / `defineVectorIndex()`. */
|
|
310
|
+
vectorIndexNames?: ReadonlyArray<string>;
|
|
311
|
+
/**
|
|
312
|
+
* Metadata properties declared filterable on a vector index. Cloudflare
|
|
313
|
+
* needs an explicit metadata index per property before a `filter` can match
|
|
314
|
+
* anything, so deploy provisions these and doctor reports them.
|
|
315
|
+
*/
|
|
316
|
+
vectorMetadata?: ReadonlyArray<VectorMetadataDeclaration>;
|
|
317
|
+
}
|
|
318
|
+
interface DiscoverSchemaInfoResult {
|
|
319
|
+
/** Parse error message, when the schema exists but could not be analyzed. */
|
|
320
|
+
error?: string;
|
|
321
|
+
/** Schema facts, or `undefined` when no `schema.ts` exists or parsing failed. */
|
|
322
|
+
info: SchemaInfo | undefined;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Discover {@link SchemaInfo} for a project. Returns `{ info: undefined }` when
|
|
326
|
+
* the project declares no `schema.ts` (not an error), or `{ info: undefined,
|
|
327
|
+
* error }` when a present schema could not be parsed — callers decide whether a
|
|
328
|
+
* parse failure is a warning (validator) or simply ignorable (inference).
|
|
329
|
+
*/
|
|
330
|
+
declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
|
|
331
|
+
export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, SchemaInfo as S, TailRequest as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, SecretRequest as j, ToolchainCommand as k, discoverSchemaInfo as l, inferLunoraBindings as m, packageNamesFromBindings as p };
|