@lunora/codegen 1.0.0-alpha.411 → 1.0.0-alpha.413
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 +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{AGENTS_FILENAME-D0Y0_UgB.mjs → AGENTS_FILENAME-C4tHmiZZ.mjs} +1 -1
- package/dist/packem_shared/{ALL_NOTIFY_CHANNELS-D1LVGz6_.mjs → ALL_NOTIFY_CHANNELS-uYuQQpdn.mjs} +1 -1
- package/dist/packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs +1 -0
- package/dist/packem_shared/{ENV_FILENAME-COPIfgzp.mjs → ENV_FILENAME-DJ11PXN5.mjs} +1 -1
- package/dist/packem_shared/{FLAGS_FILENAME-6RzszxVW.mjs → FLAGS_FILENAME-DeSjFBWq.mjs} +1 -1
- package/dist/packem_shared/{MUTATORS_FILENAME-C3OImAxC.mjs → MUTATORS_FILENAME-C0ZV0hh6.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-UNYmA7Ty.mjs → OPENRPC_VERSION-BOBo0zdQ.mjs} +1 -1
- package/dist/packem_shared/QUEUES_FILENAME-_Efg09WH.mjs +1 -0
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME--_3sHRKX.mjs +54 -0
- package/dist/packem_shared/SHAPES_FILENAME-BvRkrFtN.mjs +1 -0
- package/dist/packem_shared/WORKFLOWS_FILENAME-7FysJsMZ.mjs +1 -0
- package/dist/packem_shared/{attribution-BhGR_h0Z.mjs → attribution-Cwt30DDJ.mjs} +1 -1
- package/dist/packem_shared/{buildOpenApiDocument-B8KEeeRr.mjs → buildOpenApiDocument-DmV_PBFv.mjs} +1 -1
- package/dist/packem_shared/{capabilitiesUsedBy-Dm4Of8Gw.mjs → capabilitiesUsedBy-BNvoiCu1.mjs} +1 -1
- package/dist/packem_shared/classify-procedure-call-BmEirzc_.mjs +1 -0
- package/dist/packem_shared/{context-property-calls-DXzNVV1P.mjs → context-property-calls-BQyyS_B0.mjs} +1 -1
- package/dist/packem_shared/context-root-hthkpwQe.mjs +1 -0
- package/dist/packem_shared/{createCodegenProject-Cfr1xHPC.mjs → createCodegenProject-dC6oJh5H.mjs} +1 -1
- package/dist/packem_shared/{database-calls-Do0YbPCL.mjs → database-calls-B8l9USAr.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-ENLGem4M.mjs → discoverAuthApiCalls-CuqaLRa0.mjs} +1 -1
- package/dist/packem_shared/discoverCrons-bT8F5GyL.mjs +1 -0
- package/dist/packem_shared/discoverFunctions-Dn6_nfhC.mjs +1 -0
- package/dist/packem_shared/{discoverHttpRoutes-CAoEemno.mjs → discoverHttpRoutes-CesuhqW1.mjs} +1 -1
- package/dist/packem_shared/discoverHyperdriveCalls-DoZqnpRp.mjs +1 -0
- package/dist/packem_shared/{discoverInserts-BtyJbg8A.mjs → discoverInserts-fL7eh_Q_.mjs} +1 -1
- package/dist/packem_shared/discoverMaskProcedures-0XApH-Nk.mjs +1 -0
- package/dist/packem_shared/{discoverMigrations-Duh6HVG3.mjs → discoverMigrations-C9AlZYFi.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-DR0S5Xb4.mjs → discoverNondeterministicCalls-ZeZDQJAI.mjs} +1 -1
- package/dist/packem_shared/{discoverQueries-BLyL2qzX.mjs → discoverQueries-DPqTWmBp.mjs} +1 -1
- package/dist/packem_shared/discoverR2sqlCalls-cS1hM24s.mjs +1 -0
- package/dist/packem_shared/discoverRlsMetadata-C0UkQkWd.mjs +1 -0
- package/dist/packem_shared/discoverRlsProcedures-BY04NWTT.mjs +1 -0
- package/dist/packem_shared/{discoverSandboxUsage-Ccy9n7G1.mjs → discoverSandboxUsage-Dgvv6F_7.mjs} +1 -1
- package/dist/packem_shared/discoverSchema-QwVC9oua.mjs +1 -0
- package/dist/packem_shared/{discoverStorageRulesMetadata-ZKW6DInk.mjs → discoverStorageRulesMetadata-DeBgC7po.mjs} +1 -1
- package/dist/packem_shared/{exported-procedure-chains-DomRzs5_.mjs → exported-procedure-chains-CfH5jrzD.mjs} +1 -1
- package/dist/packem_shared/{fingerprintSchemaSources-C8H1wOcH.mjs → fingerprintSchemaSources-TN-rU6Of.mjs} +1 -1
- package/dist/packem_shared/{formatAdvisories-BCVASH7N.mjs → formatAdvisories-MxBW1MCl.mjs} +1 -1
- package/dist/packem_shared/{handler-reference-DpIVI5BM.mjs → handler-reference-BkOkxxg8.mjs} +1 -1
- package/dist/packem_shared/{index-D03C6Kao.mjs → index-BAkOcSfE.mjs} +1 -1
- package/dist/packem_shared/{index-BH3e-J44.mjs → index-s_NKnjVj.mjs} +1 -1
- package/dist/packem_shared/{ip-reads-ByzaRhd2.mjs → ip-reads-JFFYo4vb.mjs} +1 -1
- package/dist/packem_shared/isTestPath-Uwb5a6Kq.mjs +1 -0
- package/dist/packem_shared/{modules-Qpm_zqz4.mjs → modules-DdOd-7Wp.mjs} +1 -1
- package/dist/packem_shared/policies-Dn_tuTZd.mjs +1 -0
- package/dist/packem_shared/{unwrap-handler-return-DUzluwPj.mjs → unwrap-handler-return-DvbyiLjc.mjs} +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/CONTAINERS_FILENAME-J-e3Vanb.mjs +0 -1
- package/dist/packem_shared/QUEUES_FILENAME-Ba-sK5Ek.mjs +0 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-Dmq3sFwb.mjs +0 -54
- package/dist/packem_shared/SHAPES_FILENAME-BYnZ1Xw-.mjs +0 -1
- package/dist/packem_shared/WORKFLOWS_FILENAME-DfVfBum_.mjs +0 -1
- package/dist/packem_shared/chain-CONXUmWW.mjs +0 -1
- package/dist/packem_shared/classify-procedure-call-n9urVsqb.mjs +0 -1
- package/dist/packem_shared/context-root-DP9WbBI_.mjs +0 -1
- package/dist/packem_shared/discoverCrons-DWVXmktw.mjs +0 -1
- package/dist/packem_shared/discoverFunctions-CeHY4_ii.mjs +0 -1
- package/dist/packem_shared/discoverHyperdriveCalls-W96s1VgA.mjs +0 -1
- package/dist/packem_shared/discoverMaskProcedures-BFm9rkZ7.mjs +0 -1
- package/dist/packem_shared/discoverR2sqlCalls-Cb4AmcY8.mjs +0 -1
- package/dist/packem_shared/discoverRlsMetadata-Cf4gZvxW.mjs +0 -1
- package/dist/packem_shared/discoverRlsProcedures-_Dh3Xb9Z.mjs +0 -1
- package/dist/packem_shared/discoverSchema-ynieYB0n.mjs +0 -1
- package/dist/packem_shared/isTestPath-DRIdZaij.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1704,6 +1704,8 @@ interface ShapeIR {
|
|
|
1704
1704
|
exportName: string;
|
|
1705
1705
|
/** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
|
|
1706
1706
|
filePath: string;
|
|
1707
|
+
/** 1-based start line of the `export const` declaring the shape, without leading comments. */
|
|
1708
|
+
line?: number;
|
|
1707
1709
|
/**
|
|
1708
1710
|
* The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
|
|
1709
1711
|
* so the shard never resumes it warm.
|
|
@@ -1897,6 +1899,8 @@ interface ProcedureMiddlewareIR {
|
|
|
1897
1899
|
*/
|
|
1898
1900
|
hasEmailArg?: boolean;
|
|
1899
1901
|
kind: "action" | "mutation" | "query";
|
|
1902
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
1903
|
+
line?: number;
|
|
1900
1904
|
/** `true` when the handler reaches an outbound surface (`ctx.fetch`, mail, queues, storage, sql, ai, …) that can fail. */
|
|
1901
1905
|
reachesOutbound?: boolean;
|
|
1902
1906
|
/** `true` when the handler runs any AI generation, bounded or not. */
|
|
@@ -2052,8 +2056,12 @@ interface CronJobIR {
|
|
|
2052
2056
|
args: Record<string, unknown>;
|
|
2053
2057
|
/** Compiled standard cron expression, e.g. `"0 9 * * *"`. */
|
|
2054
2058
|
cron: string;
|
|
2059
|
+
/** Lunora-relative module of the `cronJobs()` registration, without extension. */
|
|
2060
|
+
file?: string;
|
|
2055
2061
|
/** Target function ref `namespace:fn`. Present for a function target; absent when {@link CronJobIR.workflow} is set. */
|
|
2056
2062
|
functionPath?: string;
|
|
2063
|
+
/** 1-based start line of the statement registering the job, without leading comments. */
|
|
2064
|
+
line?: number;
|
|
2057
2065
|
/** Unique, human-readable job name. */
|
|
2058
2066
|
name: string;
|
|
2059
2067
|
/**
|
|
@@ -2100,6 +2108,8 @@ interface ContainerIRBase {
|
|
|
2100
2108
|
enableInternet?: boolean;
|
|
2101
2109
|
/** The `lunora/containers.ts` export name, e.g. `transcoder`. */
|
|
2102
2110
|
exportName: string;
|
|
2111
|
+
/** Lunora-relative module of the declaration, without extension: always `containers`. */
|
|
2112
|
+
file?: string;
|
|
2103
2113
|
/**
|
|
2104
2114
|
* The static `hardTimeout` value, when it was a literal. It caps total lifetime,
|
|
2105
2115
|
* so it also bounds how long an idle instance can run. Lifted for the advisor.
|
|
@@ -2111,6 +2121,8 @@ interface ContainerIRBase {
|
|
|
2111
2121
|
memoryMib?: number;
|
|
2112
2122
|
vcpu?: number;
|
|
2113
2123
|
};
|
|
2124
|
+
/** 1-based start line of the `export const` declaring the container, without leading comments. */
|
|
2125
|
+
line?: number;
|
|
2114
2126
|
/** Static wrangler `containers[].name` override, when declared. */
|
|
2115
2127
|
name?: string;
|
|
2116
2128
|
/**
|
|
@@ -2183,6 +2195,8 @@ interface WorkflowIR {
|
|
|
2183
2195
|
};
|
|
2184
2196
|
/** The `lunora/workflows.ts` export name, e.g. `orderPipeline`. */
|
|
2185
2197
|
exportName: string;
|
|
2198
|
+
/** Lunora-relative module of the `defineWorkflow()` export, without extension. */
|
|
2199
|
+
file?: string;
|
|
2186
2200
|
/**
|
|
2187
2201
|
* The file declaring the `handler:` when it is a function passed by reference
|
|
2188
2202
|
* and declared in another file — the file {@link WorkflowIR.steps}' lines are
|
|
@@ -2195,6 +2209,8 @@ interface WorkflowIR {
|
|
|
2195
2209
|
limits?: {
|
|
2196
2210
|
steps?: number;
|
|
2197
2211
|
};
|
|
2212
|
+
/** 1-based start line of the `export const` declaring the workflow, without leading comments. */
|
|
2213
|
+
line?: number;
|
|
2198
2214
|
/**
|
|
2199
2215
|
* The stable wrangler `exports.<Class>.name`. Defaults to the kebab-cased export
|
|
2200
2216
|
* name (`orderPipeline` → `order-pipeline`); a static `name:` literal in the
|
|
@@ -2301,6 +2317,8 @@ interface QueueIR {
|
|
|
2301
2317
|
filePath: string;
|
|
2302
2318
|
/** See {@link HandlerSiteIR}. */
|
|
2303
2319
|
handlerSite?: HandlerSiteIR;
|
|
2320
|
+
/** 1-based start line of the `export const` declaring the queue or subscription, without leading comments. */
|
|
2321
|
+
line?: number;
|
|
2304
2322
|
/** How the queue is consumed: `"push"` (a worker `queue()` handler) or `"pull"` (external HTTP). */
|
|
2305
2323
|
mode: "pull" | "push";
|
|
2306
2324
|
/**
|
|
@@ -2534,6 +2552,8 @@ interface AdminRouteIR {
|
|
|
2534
2552
|
exportName: string;
|
|
2535
2553
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2536
2554
|
file: string;
|
|
2555
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2556
|
+
line?: number;
|
|
2537
2557
|
/** HTTP verb the route binds to (uppercased), e.g. `"POST"`. */
|
|
2538
2558
|
method: string;
|
|
2539
2559
|
/** The route path, e.g. `/admin/users`. */
|
|
@@ -2623,6 +2643,8 @@ interface RlsProcedureIR {
|
|
|
2623
2643
|
exportName: string;
|
|
2624
2644
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2625
2645
|
file: string;
|
|
2646
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2647
|
+
line?: number;
|
|
2626
2648
|
/**
|
|
2627
2649
|
* Table names extracted from the `rls(policies)` array literal. Empty when the
|
|
2628
2650
|
* policies argument is not a statically-readable array literal.
|
package/dist/index.d.ts
CHANGED
|
@@ -1704,6 +1704,8 @@ interface ShapeIR {
|
|
|
1704
1704
|
exportName: string;
|
|
1705
1705
|
/** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
|
|
1706
1706
|
filePath: string;
|
|
1707
|
+
/** 1-based start line of the `export const` declaring the shape, without leading comments. */
|
|
1708
|
+
line?: number;
|
|
1707
1709
|
/**
|
|
1708
1710
|
* The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
|
|
1709
1711
|
* so the shard never resumes it warm.
|
|
@@ -1897,6 +1899,8 @@ interface ProcedureMiddlewareIR {
|
|
|
1897
1899
|
*/
|
|
1898
1900
|
hasEmailArg?: boolean;
|
|
1899
1901
|
kind: "action" | "mutation" | "query";
|
|
1902
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
1903
|
+
line?: number;
|
|
1900
1904
|
/** `true` when the handler reaches an outbound surface (`ctx.fetch`, mail, queues, storage, sql, ai, …) that can fail. */
|
|
1901
1905
|
reachesOutbound?: boolean;
|
|
1902
1906
|
/** `true` when the handler runs any AI generation, bounded or not. */
|
|
@@ -2052,8 +2056,12 @@ interface CronJobIR {
|
|
|
2052
2056
|
args: Record<string, unknown>;
|
|
2053
2057
|
/** Compiled standard cron expression, e.g. `"0 9 * * *"`. */
|
|
2054
2058
|
cron: string;
|
|
2059
|
+
/** Lunora-relative module of the `cronJobs()` registration, without extension. */
|
|
2060
|
+
file?: string;
|
|
2055
2061
|
/** Target function ref `namespace:fn`. Present for a function target; absent when {@link CronJobIR.workflow} is set. */
|
|
2056
2062
|
functionPath?: string;
|
|
2063
|
+
/** 1-based start line of the statement registering the job, without leading comments. */
|
|
2064
|
+
line?: number;
|
|
2057
2065
|
/** Unique, human-readable job name. */
|
|
2058
2066
|
name: string;
|
|
2059
2067
|
/**
|
|
@@ -2100,6 +2108,8 @@ interface ContainerIRBase {
|
|
|
2100
2108
|
enableInternet?: boolean;
|
|
2101
2109
|
/** The `lunora/containers.ts` export name, e.g. `transcoder`. */
|
|
2102
2110
|
exportName: string;
|
|
2111
|
+
/** Lunora-relative module of the declaration, without extension: always `containers`. */
|
|
2112
|
+
file?: string;
|
|
2103
2113
|
/**
|
|
2104
2114
|
* The static `hardTimeout` value, when it was a literal. It caps total lifetime,
|
|
2105
2115
|
* so it also bounds how long an idle instance can run. Lifted for the advisor.
|
|
@@ -2111,6 +2121,8 @@ interface ContainerIRBase {
|
|
|
2111
2121
|
memoryMib?: number;
|
|
2112
2122
|
vcpu?: number;
|
|
2113
2123
|
};
|
|
2124
|
+
/** 1-based start line of the `export const` declaring the container, without leading comments. */
|
|
2125
|
+
line?: number;
|
|
2114
2126
|
/** Static wrangler `containers[].name` override, when declared. */
|
|
2115
2127
|
name?: string;
|
|
2116
2128
|
/**
|
|
@@ -2183,6 +2195,8 @@ interface WorkflowIR {
|
|
|
2183
2195
|
};
|
|
2184
2196
|
/** The `lunora/workflows.ts` export name, e.g. `orderPipeline`. */
|
|
2185
2197
|
exportName: string;
|
|
2198
|
+
/** Lunora-relative module of the `defineWorkflow()` export, without extension. */
|
|
2199
|
+
file?: string;
|
|
2186
2200
|
/**
|
|
2187
2201
|
* The file declaring the `handler:` when it is a function passed by reference
|
|
2188
2202
|
* and declared in another file — the file {@link WorkflowIR.steps}' lines are
|
|
@@ -2195,6 +2209,8 @@ interface WorkflowIR {
|
|
|
2195
2209
|
limits?: {
|
|
2196
2210
|
steps?: number;
|
|
2197
2211
|
};
|
|
2212
|
+
/** 1-based start line of the `export const` declaring the workflow, without leading comments. */
|
|
2213
|
+
line?: number;
|
|
2198
2214
|
/**
|
|
2199
2215
|
* The stable wrangler `exports.<Class>.name`. Defaults to the kebab-cased export
|
|
2200
2216
|
* name (`orderPipeline` → `order-pipeline`); a static `name:` literal in the
|
|
@@ -2301,6 +2317,8 @@ interface QueueIR {
|
|
|
2301
2317
|
filePath: string;
|
|
2302
2318
|
/** See {@link HandlerSiteIR}. */
|
|
2303
2319
|
handlerSite?: HandlerSiteIR;
|
|
2320
|
+
/** 1-based start line of the `export const` declaring the queue or subscription, without leading comments. */
|
|
2321
|
+
line?: number;
|
|
2304
2322
|
/** How the queue is consumed: `"push"` (a worker `queue()` handler) or `"pull"` (external HTTP). */
|
|
2305
2323
|
mode: "pull" | "push";
|
|
2306
2324
|
/**
|
|
@@ -2534,6 +2552,8 @@ interface AdminRouteIR {
|
|
|
2534
2552
|
exportName: string;
|
|
2535
2553
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2536
2554
|
file: string;
|
|
2555
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2556
|
+
line?: number;
|
|
2537
2557
|
/** HTTP verb the route binds to (uppercased), e.g. `"POST"`. */
|
|
2538
2558
|
method: string;
|
|
2539
2559
|
/** The route path, e.g. `/admin/users`. */
|
|
@@ -2623,6 +2643,8 @@ interface RlsProcedureIR {
|
|
|
2623
2643
|
exportName: string;
|
|
2624
2644
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2625
2645
|
file: string;
|
|
2646
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2647
|
+
line?: number;
|
|
2626
2648
|
/**
|
|
2627
2649
|
* Table names extracted from the `rls(policies)` array literal. Empty when the
|
|
2628
2650
|
* policies argument is not a statically-readable array literal.
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-MxBW1MCl.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-C4tHmiZZ.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-Uwb5a6Kq.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-CuqaLRa0.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs";import{default as b}from"./packem_shared/discoverCrons-bT8F5GyL.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DJ11PXN5.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BNvoiCu1.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-DeSjFBWq.mjs";import{d as q}from"./packem_shared/index-s_NKnjVj.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-CesuhqW1.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-DoZqnpRp.mjs";import{default as ee}from"./packem_shared/discoverInserts-fL7eh_Q_.mjs";import{d as oe}from"./packem_shared/index-BAkOcSfE.mjs";import{default as ie}from"./packem_shared/discoverMigrations-C9AlZYFi.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-C0ZV0hh6.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-ZeZDQJAI.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-uYuQQpdn.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-DPqTWmBp.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-_Efg09WH.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-cS1hM24s.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-BY04NWTT.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-C0UkQkWd.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-Dgvv6F_7.mjs";import{default as Pe}from"./packem_shared/discoverSchema-QwVC9oua.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-BvRkrFtN.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-DeBgC7po.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-7FysJsMZ.mjs";import{emitApp as qe}from"./packem_shared/emitApp-CBE_wZAT.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-DmV_PBFv.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-BOBo0zdQ.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME--_3sHRKX.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-TN-rU6Of.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-CWAD5mYy.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-dC6oJh5H.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as E}from"./isTestPath-
|
|
1
|
+
import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as E}from"./isTestPath-Uwb5a6Kq.mjs";import{a as w}from"./attribution-Cwt30DDJ.mjs";const h=new Set(["@lunora/agent","@lunora/agent/core"]),v="agents.ts",P=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return h.has(e.getImportDeclaration().getModuleSpecifierValue())?e.getNameNode().getText()==="defineAgent":!1;return!1},S=E("agent"),D=(o,n,e)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${e}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},I=(o,n)=>{const e=o.getArguments()[0];if(!e||!a.isObjectLiteralExpression(e))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const t={className:b(n),exportName:n,name:d(n)},r=c(e,"name");r&&a.isPropertyAssignment(r)&&(t.name=S(r.getInitializerOrThrow(),n,"name"));const i=c(e,"publicRun");i&&a.isPropertyAssignment(i)&&D(i.getInitializerOrThrow(),n,"publicRun")&&(t.publicRun=!0);const s=c(e,"voice");if(s&&a.isPropertyAssignment(s)){const m=s.getInitializerOrThrow();if(!a.isObjectLiteralExpression(m))throw l(m,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);t.voice=!0,t.voiceBindingName=N(n),t.voiceClassName=y(n)}return c(e,"onEmail")&&(t.onEmail=!0),t},T=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const r=t.getExpression();if(!a.isIdentifier(r)||!P(r))continue;const i=e.getNameNode();if(!a.isIdentifier(i)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(i,"defineAgent exports must be plain named exports (no destructuring)")}const s=w(e,"binding");s!==void 0&&n.push(I(t,s))}return n},x=o=>{const n=new Map,e=new Map;for(const t of o){const r=n.get(t.name);if(r!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${r}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const i=e.get(t.className);if(i!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${i}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},M=(o,n)=>{const e=f(n,v);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),r=T(t);return r.sort((i,s)=>i.exportName.localeCompare(s.exportName)),x(r),r};export{v as AGENTS_FILENAME,M as discoverAgents};
|
package/dist/packem_shared/{ALL_NOTIFY_CHANNELS-D1LVGz6_.mjs → ALL_NOTIFY_CHANNELS-uYuQQpdn.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as I}from"node:fs";import{join as D}from"node:path";import{SyntaxKind as l,Node as r,VariableDeclarationKind as L}from"ts-morph";import{listLunoraSourceFiles as E,lunoraRelativePath as C,descendantsOfKind as v,findObjectProperty as d,defaultExportExpression as k,propertyInitializer as m,handlerOf as w,unwrapExpression as u}from"./isTestPath-
|
|
1
|
+
import{existsSync as I}from"node:fs";import{join as D}from"node:path";import{SyntaxKind as l,Node as r,VariableDeclarationKind as L}from"ts-morph";import{listLunoraSourceFiles as E,lunoraRelativePath as C,descendantsOfKind as v,findObjectProperty as d,defaultExportExpression as k,propertyInitializer as m,handlerOf as w,unwrapExpression as u}from"./isTestPath-Uwb5a6Kq.mjs";import{j as M,h as _}from"./attribution-Cwt30DDJ.mjs";import{a as p}from"./context-root-hthkpwQe.mjs";import{c as j}from"./classify-procedure-call-BmEirzc_.mjs";import{s as R}from"./property-name-7cBlgK_O.mjs";const z="notify.ts",W=new Set(["chat","inApp","send","webhook"]),S=new Set(["broadcast","send","sendToCondition","sendToTopic"]),H=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=j(s);if(!t)return;const i=w(s,t.receiver);return i?{exportName:_(e)??e.getName(),handler:i,kind:t.kind}:void 0},P=e=>{const s=[];for(const t of M(e)){const i=H(t);i&&s.push(i)}return s},b=e=>p(e,["notify"])?"notify":p(e,["push"])||p(e,["notify","push"])?"push":void 0,U=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=b(e.getExpression());if(t==="notify"&&W.has(s))return`ctx.notify.${s}`;if(t==="push"&&S.has(s))return`ctx.push.${s}`},V=e=>r.isPropertyAccessExpression(e)?b(e.getExpression())==="push"&&S.has(e.getName()):!1,de=(e,s)=>{const t=[];for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i),c=C(s,i);for(const o of P(n))if(!(o.kind!=="query"&&o.kind!=="mutation"))for(const a of v(o.handler,l.PropertyAccessExpression)){const f=U(a);f!==void 0&&t.push({callee:f,exportName:o.exportName,file:c,kind:o.kind,line:a.getStartLineNumber()})}}return t},B=(e,s)=>{const t=new Set;for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i);for(const c of P(n))for(const o of v(c.handler,l.PropertyAccessExpression))V(o)&&t.add(o.getName())}return t},y={fcm:"env",hasWebPush:!0},K=new Set(["@lunora/notify"]),O=(e,s)=>{const t=e.getSymbol();if(!t)return e.getText()===s;for(const i of t.getDeclarations())if(r.isImportSpecifier(i))return K.has(i.getImportDeclaration().getModuleSpecifierValue())?i.getNameNode().getText()===s:!1;return!1},A=(e,s=new Set)=>{const t=k(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const n=i.getAliasedSymbol();if(!n)return t;const c=n.getDeclarations().find(a=>r.isExportAssignment(a));if(!c)return t;const o=c.getSourceFile();if(!s.has(o.getFilePath()))return A(o,s.add(o.getFilePath()))},Y=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),x=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},N=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return N(e.getExpression())},g=(e,s)=>{const t=N(e);return t!==void 0&&x(t)===s},$=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),n=t.getExpression(),c=r.isIdentifier(n)?n.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&c==="Object"||i==="set"&&c==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&x(a)===s},q=(e,s)=>{if(r.isBinaryExpression(e))return Y.has(e.getOperatorToken().getText())&&g(e.getLeft(),s);if(r.isDeleteExpression(e))return g(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===l.PlusPlusToken||t===l.MinusMinusToken)&&g(e.getOperand(),s)}return r.isCallExpression(e)?$(e,s):!1},G=(e,s)=>{const t=x(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(n=>q(n,t)))},J=e=>{if(r.isObjectLiteralExpression(e))return e;if(!r.isIdentifier(e))return;const s=e.getSymbol(),t=s?.getAliasedSymbol()?.getDeclarations()??s?.getDeclarations()??[];for(const i of t){if(!r.isVariableDeclaration(i))continue;const n=i.getInitializer();if(!n||!r.isObjectLiteralExpression(n))continue;const c=i.getParent();if(!r.isVariableDeclarationList(c)||c.getDeclarationKind()!==L.Const)continue;const o=[i.getSourceFile(),e.getSourceFile()].filter((a,f,T)=>T.findIndex(F=>F.getFilePath()===a.getFilePath())===f);if(!G(e,o))return n}},Q=e=>r.isArrowFunction(e)||r.isFunctionExpression(e)||r.isMethodDeclaration(e),X=e=>{const s=e.getBody();if(!r.isBlock(s))return s;const[t,...i]=s.getStatements();return i.length===0&&r.isReturnStatement(t)?t.getExpression():void 0},Z=e=>{const s=u(e),t=u(s!==void 0&&Q(s)?X(s):s);if(t!==void 0&&r.isCallExpression(t)){const i=t.getExpression(),n=u(t.getArguments()[1]);return r.isIdentifier(i)&&O(i,"fcmFromEnv")&&n!==void 0&&r.isObjectLiteralExpression(n)?n:void 0}return t!==void 0&&r.isObjectLiteralExpression(t)?t:void 0},h=(e,s)=>{const t=d(e,s),i=e.getProperties();return t!==void 0&&!i.slice(i.indexOf(t)+1).some(n=>{if(r.isSpreadAssignment(n))return!0;const c=R(n.getNameNode());return c===void 0||c===s})},ee=e=>{const s=d(e,"getAccessToken");if(s===void 0||!h(e,"getAccessToken"))return!1;if(r.isShorthandPropertyAssignment(s)||r.isMethodDeclaration(s))return!0;const t=u(m(e,"getAccessToken"));return t!==void 0&&(r.isArrowFunction(t)||r.isFunctionExpression(t)||r.isCallExpression(t)||r.isPropertyAccessExpression(t)||r.isIdentifier(t)&&t.getText()!=="undefined")},te=e=>{const s=u(m(e,"projectId"));return h(e,"projectId")&&s!==void 0&&(r.isStringLiteral(s)||r.isNoSubstitutionTemplateLiteral(s))&&s.getLiteralText()!==""},se=(e,s)=>{const t=d(e,"fcm");if(t===void 0)return"absent";if(!s||!h(e,"fcm"))return"env";const i=r.isMethodDeclaration(t)?t:m(e,"fcm"),n=i===void 0?void 0:Z(i);return n===void 0||!ee(n)?"env":te(n)?"ownCredentials":"ownToken"},ie=(e,s)=>{const t=D(s,z);if(!I(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),n=A(i);if(!n||!r.isCallExpression(n))return y;const c=n.getExpression(),o=r.isIdentifier(c)&&O(c,"defineNotify")?n.getArguments()[0]:void 0,a=o===void 0?void 0:J(o);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?y:{fcm:se(a,r.isObjectLiteralExpression(o)),hasWebPush:d(a,"webPush")!==void 0}},pe=(e,s)=>{const t=ie(e,s);if(t===void 0)return;const i=B(e,s);return{hasFcm:t.fcm!=="absent",hasWebPush:t.hasWebPush,usesFcmOnlySend:i.has("sendToTopic")||i.has("sendToCondition"),usesPush:i.size>0}};export{y as ALL_NOTIFY_CHANNELS,z as NOTIFY_FILENAME,de as discoverNotifyCalls,ie as discoverNotifyChannels,pe as discoverNotifyConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as O}from"node:fs";import{join as j}from"node:path";import{containerClassName as A,containerBindingName as k,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as C,isManagedImage as _,isCloudflareRegistryDigest as D,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{declarationLineOf as M,stringPropertyFor as F,findObjectProperty as p,symbolConstInitializer as V,descendantsOfKind as K,outermostValueWrapper as w,isWriteTarget as R}from"./isTestPath-Uwb5a6Kq.mjs";import{a as B}from"./attribution-Cwt30DDJ.mjs";import{a as b}from"./property-name-7cBlgK_O.mjs";const E="containers.ts",N=E.replace(/\.ts$/u,""),U=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(s.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},d=F("container"),y=(t,e,r)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${r}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},L=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&s.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return f({registry:d(i,e,"image.registry")})}const n=p(t,"build");if(n&&s.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return f({build:d(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},Y=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),z=new Set(["gracePeriodSeconds","stepPercentage"]),T=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},W=(t,e)=>K(e,$.Identifier).some(r=>{if(r.getSymbol()!==t)return!1;let n=w(r),i=n.getParent();if(s.isCallExpression(i)&&i.getExpression().getText()==="Object.assign")return i.getArguments()[0]===n;for(;(s.isPropertyAccessExpression(i)||s.isElementAccessExpression(i))&&i.getExpression()===n;){if(R(i))return!0;n=w(i),i=n.getParent()}return!1}),q=16,P=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<q;c+=1){const l=V(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=T(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&W(i.symbol,e.getSourceFile()))throw a(e,`${n}: \`${i.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;i={name:o.getText(),symbol:o.getSymbol()}}return o},I=(t,e)=>{const r=T(t);return s.isIdentifier(r)?P(r.getSymbol(),r,r.getText(),e)??r:r},x=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},H=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(x(n))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(i.length>0)throw a(t,`${r}: this spread can set ${i.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},J=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?P(t.getValueSymbol(),t,n,r):void 0;if(i!==void 0)return[n,i];if(e==="every"||e.has(n))throw a(t,`${r}: \`${n}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,r,n=new Set)=>{const i=[],o=new Set(n).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))i.push([b(c),I(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...X(c,e,r,o));else{const l=J(c,e,r);l!==void 0&&i.push(l)}return i},X=(t,e,r,n)=>{const i=I(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return H(t,e,r),[];if(n.has(i))throw a(t,`${r}: this spread refers back to an object it is part of, so it has no static value.`);return m(i,e,r,n)},G=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" buildArgs`))r[n]=d(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},Q=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,z,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=y(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},S=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},Z=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!s.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=b(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=y(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},ee=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`images\` must be a static object literal — codegen writes it into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" images`)){const o=L(i,e);if(o.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!D(o.reference))throw a(i,`container "${e}": \`images["${n}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);r[n]=o}return r},te=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=d(r[1],e,"schedulingPolicy");if(n!=="default"&&n!=="durable_object")throw a(r[1],`container "${e}": unknown \`schedulingPolicy\` "${n}" — use "default" or "durable_object"`);return n==="durable_object"?n:void 0},ne=(t,e,r,n)=>{if(r!==void 0&&C.includes(t))throw a(e,`container "${n}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(r===void 0&&t==="images")throw a(e,`container "${n}": \`images\` needs schedulingPolicy "durable_object"`)},ie=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=G(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=L(e,n));break}case"images":{o.images=ee(e,n);break}case"instanceType":{i.instanceType=Z(e,n);break}case"maxInstances":{o.maxInstances=y(e,n,"maxInstances");break}case"name":{i.name=d(e,n,"name");break}case"rollout":{o.rollout=Q(e,n);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${n}": \`sandbox\` must be a static true/false literal`);i.sandbox=c;break}case"sleepAfter":{i.sleepAfter=S(e);break}}},re=(t,e,r)=>{const n=t.findLast(([o])=>o==="image")?.[1];if(n===void 0||!(s.isStringLiteral(n)||s.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!_(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},se=(t,e)=>{const r=t.getArguments()[0];if(!r||!s.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,Y,`container "${e}"`),i=te(n,e),o={base:{bindingName:k(e),className:A(e),exportName:e,file:N,line:M(t)},policy:{},scheduled:i!==void 0};for(const[g,u]of n)ne(g,u,i,e),ie(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return re(n,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:i};if(l.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},oe=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){const i=n.getInitializer();if(i?.getKind()!==$.CallExpression)continue;const o=i,c=o.getExpression();if(!s.isIdentifier(c)||!U(c))continue;const l=n.getNameNode();if(!s.isIdentifier(l)){if(n.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=B(n,"binding");if(g===void 0)continue;const u=se(o,g),h=r.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);r.set(u.bindingName,u.exportName),e.push(u)}return e},be=(t,e)=>{const r=j(e,E);if(!O(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=oe(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{E as CONTAINERS_FILENAME,be as discoverContainers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as l}from"node:fs";import{join as d}from"node:path";import{SyntaxKind as c,Node as i}from"ts-morph";import{diagnosticAt as f}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as m}from"./module-specifiers-BctA0m_p.mjs";import{a as u}from"./attribution-
|
|
1
|
+
import{existsSync as l}from"node:fs";import{join as d}from"node:path";import{SyntaxKind as c,Node as i}from"ts-morph";import{diagnosticAt as f}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as m}from"./module-specifiers-BctA0m_p.mjs";import{a as u}from"./attribution-Cwt30DDJ.mjs";const p="env.ts",g=e=>{const n=e.getSymbol();if(!n)return e.getText()==="defineEnv";for(const t of n.getDeclarations())if(i.isImportSpecifier(t))return m(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineEnv":!1;return!1},v=e=>{const n=e.getSymbol();if(!n)return!1;for(const t of n.getDeclarations()){if(!i.isNamespaceImport(t))continue;const o=t.getFirstAncestorByKind(c.ImportDeclaration);return o!==void 0&&m(o.getModuleSpecifierValue())}return!1},E=e=>{if(i.isIdentifier(e))return g(e);if(i.isPropertyAccessExpression(e)){const n=e.getExpression();return e.getName()==="defineEnv"&&i.isIdentifier(n)&&v(n)}return!1},x=e=>{const n=[];for(const t of e.getVariableDeclarations()){const o=t.getInitializer();if(o?.getKind()!==c.CallExpression||!E(o.getExpression()))continue;const s=t.getNameNode();if(!i.isIdentifier(s)){if(t.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw f(s,"defineEnv exports must be plain named exports (no destructuring)")}const a=u(t,"member");a!==void 0&&n.push({exportName:a})}return n},D=(e,n)=>{const t=d(n,p);if(!l(t))return;const o=e.getSourceFile(t)??e.addSourceFileAtPath(t),r=x(o);if(r.length!==0){if(r.length>1)throw f(o,`lunora/env.ts declares ${r.length.toString()} defineEnv() contracts (${r.map(s=>s.exportName).join(", ")}); exactly one is allowed`);return r[0]}};export{p as ENV_FILENAME,D as discoverEnv};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-
|
|
1
|
+
import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-Uwb5a6Kq.mjs";const d="flags.ts",u=new Set(["@lunora/flags/providers/flagship","lunorash/flags/flagship"]),m=e=>{const i=e.getSymbol();if(!i)return e.getText()==="flagshipProvider";for(const r of i.getDeclarations())if(t.isImportSpecifier(r))return u.has(r.getImportDeclaration().getModuleSpecifierValue())?r.getNameNode().getText()==="flagshipProvider":!1;return!1},v=(e,i)=>{const r=c(e,i);if(!r||!t.isPropertyAssignment(r))return;const o=r.getInitializerOrThrow();if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()},h=e=>{const i=e.getArguments()[0];if(i&&t.isObjectLiteralExpression(i)){const r=v(i,"binding");if(r!==void 0&&r.length>0)return{bindingName:r,mode:"binding",provider:"flagship"}}return{mode:"http",provider:"flagship"}},S=e=>f(e.getArguments()[0],"provider"),b=(e,i)=>{const r=p(i,d);if(!l(r))return;const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=g(o);if(!n||!t.isCallExpression(n))return{provider:"custom"};const s=S(n);if(s&&t.isCallExpression(s)){const a=s.getExpression();if(t.isIdentifier(a)&&m(a))return h(s)}return{provider:"custom"}};export{d as FLAGS_FILENAME,b as discoverFlags};
|
package/dist/packem_shared/{MUTATORS_FILENAME-C3OImAxC.mjs → MUTATORS_FILENAME-C0ZV0hh6.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as M}from"./module-specifiers-BctA0m_p.mjs";import{p as A}from"./parse-validator-BisfC8bR.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-
|
|
1
|
+
import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as M}from"./module-specifiers-BctA0m_p.mjs";import{p as A}from"./parse-validator-BisfC8bR.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-Uwb5a6Kq.mjs";import{g as b,i as D,d as g,h as O}from"./attribution-Cwt30DDJ.mjs";import{u as h}from"./unwrap-handler-return-DvbyiLjc.mjs";const w="mutators.ts",x=M,z=r=>{const e=r.getSymbol();if(!e)return r.getText()==="defineMutator";for(const t of e.getDeclarations())if(o.isImportSpecifier(t))return x(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineMutator":!1;return!1},C=r=>{const e=r.getSymbol();if(!e)return!1;for(const t of e.getDeclarations()){if(!o.isNamespaceImport(t))continue;const i=t.getFirstAncestorByKind(l.ImportDeclaration);return i!==void 0&&x(i.getModuleSpecifierValue())}return!1},N=r=>{if(o.isIdentifier(r))return z(r);if(o.isPropertyAccessExpression(r)){const e=r.getExpression();return r.getName()==="defineMutator"&&o.isIdentifier(e)&&C(e)}return!1},S=r=>{const e=r.getArguments()[0];return e&&o.isObjectLiteralExpression(e)?e:void 0},m=new WeakMap,p=r=>{let e=m.get(r.compilerNode);if(e===void 0){const t=r.getNameNode(),i=t?.getText();e=r.getSourceFile().getDescendantsOfKind(l.Identifier).filter(s=>s!==t&&s.getText()===i&&g(s)?.compilerNode===r.compilerNode).length===1&&O(r)===void 0,m.set(r.compilerNode,e)}return e},f=r=>{const e=o.isIdentifier(r)?g(r):void 0,t=o.isSourceFile(e?.getParent())||o.isSourceFile(e?.getParent()?.getParent()?.getParent());if(e===void 0||e.getSourceFile()!==r?.getSourceFile()||!t)return;if(o.isFunctionDeclaration(e))return e.hasBody()&&p(e)?e:void 0;const i=P(e)?d(e.getInitializer()):void 0;return(o.isArrowFunction(i)||o.isFunctionExpression(i))&&o.isVariableDeclaration(e)&&p(e)?i:void 0},G=r=>{const e=r.getInitializer();if(!o.isCallExpression(e)||!N(e.getExpression()))return;const t=c(S(e),"server");if(o.isMethodDeclaration(t))return t;if(o.isShorthandPropertyAssignment(t))return f(t.getNameNode());const i=o.isPropertyAssignment(t)?d(t.getInitializer()):void 0;return o.isArrowFunction(i)||o.isFunctionExpression(i)?i:f(i)},T=r=>{const e=c(r,"args");if(!e||!o.isPropertyAssignment(e))return{};const t=e.getInitializer();return t&&o.isObjectLiteralExpression(t)?A(t):{}},L=r=>{const e=c(r,"server");if(!e||!o.isPropertyAssignment(e))return"unknown";const t=e.getInitializer();return!t||!(o.isArrowFunction(t)||o.isFunctionExpression(t))?"unknown":h(t)},j=r=>{const e=c(r,"owner");if(!e||!o.isPropertyAssignment(e))return;const t=e.getInitializer();return t&&o.isStringLiteral(t)?t.getLiteralValue():void 0},R=r=>{const e=[];for(const t of r.getVariableDeclarations()){if(!t.isExported())continue;const i=t.getInitializer();if(i?.getKind()!==l.CallExpression)continue;const n=i,s=n.getExpression();if(!N(s))continue;const a=t.getNameNode();if(!o.isIdentifier(a))throw I(a,"defineMutator exports must be plain named exports (no destructuring)");const u=S(n);for(const v of b(t).filter(F=>D(F)))e.push({args:T(u),exportName:v,filePath:"mutators",line:n.getStartLineNumber(),owner:j(u),returnType:L(u)})}return e},J=(r,e)=>{const t=y(e,w);if(!E(t))return[];const i=r.getSourceFile(t)??r.addSourceFileAtPath(t),n=R(i);return n.sort((s,a)=>s.exportName.localeCompare(a.exportName)),n};export{w as MUTATORS_FILENAME,J as discoverMutators,N as isDefineMutatorCallee,S as mutatorLiteral,G as mutatorServerImplOf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m}from"./modules-
|
|
1
|
+
import{m}from"./modules-DdOd-7Wp.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{validatorIrToJsonSchema as p,objectSchema as l,LUNORA_ERROR_CODES as d}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{G as h}from"./shared-Cn7dMQ_u.mjs";import{s as i}from"./dispatch-namespace-DwTjD7BU.mjs";const R="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},O=(e,r)=>e==="stream"?`Open the \`stream\` \`${r}\` over the Lunora WebSocket. It yields chunks rather than one result, so its \`result\` schema is a placeholder.`:`Invoke the \`${e}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${r}", "args": { … } }\`).`,S=(e,r)=>{const o=`${i(e.filePath)}:${e.exportName}`;return{description:O(e.kind,o),errors:d.map((s,a)=>({code:-32e3-a,data:{code:s},message:s})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:l(e.args)}],result:{name:"result",schema:e.output&&e.kind!=="stream"?p(e.output):g},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,...e.description?{"x-lunora-description":e.description}:{},"x-tags":[{name:r}]}},v=e=>{const r=e.version??"0.0.0",n=e.functions.filter(t=>t.visibility!=="internal"),o=e.modules??[],s=n.map(t=>S(t,m(o,t.filePath))).toSorted((t,c)=>t.name.localeCompare(c.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:r},methods:s,openrpc:R}},E=e=>`${JSON.stringify(v(e),void 0,2)}
|
|
2
2
|
`,N=e=>`${h}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
|
|
3
3
|
`;export{R as OPENRPC_VERSION,v as buildOpenRpcDocument,E as emitOpenRpc,N as emitOpenRpcModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as x}from"node:fs";import{join as f}from"node:path";import{LunoraError as b}from"@lunora/errors";import{queueDefaultName as q,queueBindingName as y}from"@lunora/queue";import{SyntaxKind as S,Node as u}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{lunoraRelativePath as g,findObjectProperty as l,declarationLineOf as w,stringPropertyFor as v}from"./isTestPath-Uwb5a6Kq.mjs";import{a as $}from"./attribution-Cwt30DDJ.mjs";import{r as F}from"./handler-reference-BkOkxxg8.mjs";import{d as P}from"./modules-DdOd-7Wp.mjs";const h="queues.ts",E=o=>{const e=t=>t==="defineQueue"||t==="defineSubscription"||t==="defineTopic",i=o.getSymbol();if(!i){const t=o.getText();return e(t)?t:void 0}for(const t of i.getDeclarations()){if(!u.isImportSpecifier(t))continue;if(t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/queue")return;const n=t.getNameNode().getText();return e(n)?n:void 0}},d=v("queue"),I=(o,e,i)=>{if(u.isNumericLiteral(o))return o.getLiteralValue();throw c(o,`queue "${e}": \`${i}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`)},A={maxBatchSize:{integer:!0,max:100,min:1},maxBatchTimeout:{integer:!1,max:60,min:0},maxConcurrency:{integer:!0,max:250,min:1},maxRetries:{integer:!0,max:100,min:0},retryDelay:{integer:!0,max:86400,min:0}},T=(o,e)=>{const i={};for(const[t,n]of Object.entries(A)){const r=l(o,t);if(r&&u.isPropertyAssignment(r)){const a=I(r.getInitializerOrThrow(),e,t);if(a<n.min||a>n.max||n.integer&&!Number.isInteger(a))throw c(r,`queue "${e}": \`${t}\` must be ${n.integer?"an integer":"a number"} from ${n.min.toString()} to ${n.max.toString()} (got ${a.toString()})`);i[t]=a}}return i},O=(o,e)=>{const i=l(o,"name");if(!i||!u.isPropertyAssignment(i))return;const t=d(i.getInitializerOrThrow(),e,"name");if(t.length===0)throw c(i,`queue "${e}": \`name\` must be a non-empty string when provided`);return t},N=(o,e,i,t)=>{const n=F(l(o,"handler"),t)?.site,r={bindingName:y(e),exportName:e,filePath:g(t,o.getSourceFile().getFilePath()),line:w(o),mode:"push",name:O(o,e)??q(e),...i===void 0?{}:{topic:i},...n===void 0?{}:{handlerSite:n},tuning:{}},a=l(o,"mode");if(a&&u.isPropertyAssignment(a)){if(i!==void 0)throw c(a,`subscription "${e}": \`mode\` is not allowed — a subscription is always a push consumer`);const m=d(a.getInitializerOrThrow(),e,"mode");if(m!=="push"&&m!=="pull")throw c(a,`queue "${e}": \`mode\` must be "push" or "pull" (got ${JSON.stringify(m)})`);r.mode=m}const s=l(o,"deadLetterQueue");return s&&u.isPropertyAssignment(s)&&(r.tuning.deadLetterQueue=d(s.getInitializerOrThrow(),e,"deadLetterQueue")),Object.assign(r.tuning,T(o,e)),r},Q=(o,e,i)=>{const t=o.getArguments()[0];if(!t||!u.isObjectLiteralExpression(t))throw c(o,`queue "${e}": defineQueue must be passed an inline object literal`);return N(t,e,void 0,i)},p=(o,e)=>`${o}:${e}`,L=o=>{const e=o.getSymbol(),i=(e?.isAlias()===!0?e.getAliasedSymbol():e)?.getDeclarations()[0];return i!==void 0&&u.isVariableDeclaration(i)?p(i.getSourceFile().getFilePath(),i.getName()):p(o.getSourceFile().getFilePath(),o.getText())},U=(o,e,i,t)=>{const[n,r]=o.getArguments(),a=n!==void 0&&u.isIdentifier(n)?i.get(L(n)):void 0;if(a===void 0)throw c(n??o,`subscription "${e}": the first argument must name a \`defineTopic()\` export of lunora/queues.ts or a module's queues.ts`);if(!r||!u.isObjectLiteralExpression(r))throw c(o,`subscription "${e}": defineSubscription must be passed an inline object literal`);return N(r,e,a,t)},C=o=>{const e=[];for(const i of o.getVariableDeclarations()){const t=i.getInitializer();if(t?.getKind()!==S.CallExpression)continue;const n=t,r=n.getExpression(),a=u.isIdentifier(r)?E(r):void 0;if(a===void 0)continue;const s=i.getNameNode();if(!u.isIdentifier(s)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw c(s,`${a} exports must be plain named exports (no destructuring)`)}const m=$(i,"binding");m!==void 0&&e.push({call:n,exportName:m,factory:a,localName:s.getText()})}return e},M=(o,e)=>{const i=new Map;for(const t of o){const n=g(e,t.call.getSourceFile().getFilePath()),r=i.get(t.exportName);if(r!==void 0)throw c(t.call,`"${t.exportName}" is exported by both lunora/${r}.ts and lunora/${n}.ts — queue and topic export names must be unique across the app`);i.set(t.exportName,n)}},j=(o,e)=>{const i=o.flatMap(s=>C(s));M(i,e);const t=i.filter(s=>s.factory==="defineTopic"),n=new Map(t.map(s=>[p(s.call.getSourceFile().getFilePath(),s.localName),s.exportName])),r=[];for(const s of i)s.factory==="defineQueue"?r.push(Q(s.call,s.exportName,e)):s.factory==="defineSubscription"&&r.push(U(s.call,s.exportName,n,e));const a=t.map(s=>({exportName:s.exportName,filePath:g(e,s.call.getSourceFile().getFilePath())}));return{queues:r,topics:a}},z=(o,e)=>[f(e,h),...P(o,e).map(i=>f(e,i.name,h))].filter(i=>x(i)),D=o=>{const e=new Map,i=new Map;for(const t of o){const n=e.get(t.name);if(n!==void 0)throw new b("DUPLICATE_QUEUE_NAME",`Duplicate queue name "${t.name}": produced by both "${n}" and "${t.exportName}". Deployed queue names must be unique across the project.`,{status:500});e.set(t.name,t.exportName);const r=i.get(t.bindingName);if(r!==void 0)throw new b("DUPLICATE_QUEUE_BINDING",`Duplicate queue binding "${t.bindingName}": produced by both "${r}" and "${t.exportName}". Queue export names must yield unique binding names.`,{status:500});i.set(t.bindingName,t.exportName)}},B=(o,e)=>{const i=z(o,e).map(a=>o.getSourceFile(a)??o.addSourceFileAtPath(a)),{queues:t,topics:n}=j(i,e),r=t.toSorted((a,s)=>a.exportName.localeCompare(s.exportName));return D(r),{queues:r,topics:n.toSorted((a,s)=>a.exportName.localeCompare(s.exportName))}},Y=(o,e)=>B(o,e).queues;export{h as QUEUES_FILENAME,B as discoverQueueDeclarations,Y as discoverQueues};
|