@lunora/codegen 1.0.0-alpha.243 → 1.0.0-alpha.244
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 +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{AGENTS_FILENAME-Bb2jxbOa.mjs → AGENTS_FILENAME-D8SgT3OR.mjs} +1 -1
- package/dist/packem_shared/{CONTAINERS_FILENAME-CGB4bqUr.mjs → CONTAINERS_FILENAME-CBCG6g9n.mjs} +1 -1
- package/dist/packem_shared/{DEFAULT_TARGET-wK6-Tado.mjs → DEFAULT_TARGET-BLYeFMMT.mjs} +1 -1
- package/dist/packem_shared/{FLAGS_FILENAME-BedPDCsR.mjs → FLAGS_FILENAME-W5XQz_Po.mjs} +1 -1
- package/dist/packem_shared/{MUTATORS_FILENAME-B6cKrN_m.mjs → MUTATORS_FILENAME-DqWOgC5Z.mjs} +1 -1
- package/dist/packem_shared/{NOTIFY_FILENAME-Cri3NT5U.mjs → NOTIFY_FILENAME-C1J_47et.mjs} +1 -1
- package/dist/packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs +3 -0
- package/dist/packem_shared/{QUEUES_FILENAME-BzOl92QK.mjs → QUEUES_FILENAME-RGwht3Xu.mjs} +1 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-D1zEPvOK.mjs +11 -0
- package/dist/packem_shared/{SHAPES_FILENAME-zJgzynXR.mjs → SHAPES_FILENAME-DRUFomCj.mjs} +1 -1
- package/dist/packem_shared/{WORKFLOWS_FILENAME-DNaUHGS8.mjs → WORKFLOWS_FILENAME-4-ib4HH-.mjs} +1 -1
- package/dist/packem_shared/buildOpenApiDocument-SxfElVzK.mjs +3 -0
- package/dist/packem_shared/chain-mte5djRJ.mjs +1 -0
- package/dist/packem_shared/{classify-procedure-call-BztLe76A.mjs → classify-procedure-call-CmcShAze.mjs} +1 -1
- package/dist/packem_shared/{context-property-calls-CjDzLU8p.mjs → context-property-calls-CWf9-6G5.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-FxrdBeVt.mjs → discoverAuthApiCalls-DoSN_yc3.mjs} +1 -1
- package/dist/packem_shared/{discoverCrons-0lNudk0S.mjs → discoverCrons-BEALHx1S.mjs} +1 -1
- package/dist/packem_shared/{discoverFunctions-BsmX-sEq.mjs → discoverFunctions-BcBzcG5x.mjs} +1 -1
- package/dist/packem_shared/{discoverHttpRoutes-BcXI9CNt.mjs → discoverHttpRoutes-CJHS4llq.mjs} +1 -1
- package/dist/packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs +1 -0
- package/dist/packem_shared/{discoverInserts-CFJ3IVeI.mjs → discoverInserts-DpuLYPPd.mjs} +1 -1
- package/dist/packem_shared/discoverMaskProcedures-B0w8gM0S.mjs +1 -0
- package/dist/packem_shared/{discoverMigrations-DbrHwcGE.mjs → discoverMigrations-Dt7ywfZv.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-CSQ_GDcA.mjs → discoverNondeterministicCalls-CNJV2BiP.mjs} +1 -1
- package/dist/packem_shared/discoverQueries-BcdqjYky.mjs +1 -0
- package/dist/packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs +1 -0
- package/dist/packem_shared/{discoverRlsMetadata-CPmAGL0W.mjs → discoverRlsMetadata-mXBmPOGj.mjs} +1 -1
- package/dist/packem_shared/{discoverRlsProcedures-BO4qC77y.mjs → discoverRlsProcedures-F4Cy-kSi.mjs} +1 -1
- package/dist/packem_shared/{discoverSandboxUsage-CrjZ6yNg.mjs → discoverSandboxUsage-DkbwwFvO.mjs} +1 -1
- package/dist/packem_shared/discoverSchema-D5R60b4F.mjs +1 -0
- package/dist/packem_shared/{discoverStorageRulesMetadata-D8VYflWt.mjs → discoverStorageRulesMetadata-D3Ot9g5f.mjs} +1 -1
- package/dist/packem_shared/{emitApp-D_9NVcvv.mjs → emitApp-Cu0w-3vl.mjs} +2 -2
- package/dist/packem_shared/{exported-procedure-chains-CmCDiPBV.mjs → exported-procedure-chains-D48EXUVQ.mjs} +1 -1
- package/dist/packem_shared/{fingerprintSchemaSources-L3nGKDQt.mjs → fingerprintSchemaSources-Cl1CJFeh.mjs} +1 -1
- package/dist/packem_shared/{index-BoaHhVtM.mjs → index-D7dKfGPh.mjs} +1 -1
- package/dist/packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs +1 -0
- package/dist/packem_shared/{loadProjectConfig-CKsFNgn3.mjs → loadProjectConfig-CktK_il-.mjs} +1 -1
- package/dist/packem_shared/modules-DyCocr1e.mjs +1 -0
- package/dist/packem_shared/{parse-validator-C94Yiabo.mjs → parse-validator-C6fHL7OS.mjs} +1 -1
- package/dist/packem_shared/{unwrap-handler-return-CoV_GK33.mjs → unwrap-handler-return-DVY_kFF7.mjs} +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/OPENRPC_VERSION-Cl6P9WGv.mjs +0 -3
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DX6sZtLG.mjs +0 -9
- package/dist/packem_shared/buildOpenApiDocument-nYvBhjxu.mjs +0 -3
- package/dist/packem_shared/chain-H2N_uKgj.mjs +0 -1
- package/dist/packem_shared/discoverHyperdriveCalls-D9qXqTq3.mjs +0 -1
- package/dist/packem_shared/discoverMaskProcedures-CV_Cc2_g.mjs +0 -1
- package/dist/packem_shared/discoverQueries-C7y8i_Ga.mjs +0 -1
- package/dist/packem_shared/discoverR2sqlCalls-fu7fC0i_.mjs +0 -1
- package/dist/packem_shared/discoverSchema-D8DBDHEg.mjs +0 -1
- package/dist/packem_shared/listLunoraSourceFiles-DP-5e-RE.mjs +0 -1
- package/dist/packem_shared/queries-B-f4jO-x.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -385,6 +385,12 @@ interface TableIR {
|
|
|
385
385
|
* called `.commitOrdered()` default it to `false`.
|
|
386
386
|
*/
|
|
387
387
|
commitOrdered?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* `true` when that extension was resolved from a package in `node_modules`
|
|
390
|
+
* rather than from source under `lunora/` (a registry copy-in). Decides
|
|
391
|
+
* whether the component's module owns a `lunora/<key>/` folder.
|
|
392
|
+
*/
|
|
393
|
+
extensionFromPackage?: true;
|
|
388
394
|
/**
|
|
389
395
|
* The `defineSchemaExtension` key that contributed this table, set when it
|
|
390
396
|
* arrived through `defineSchema(...).extend(...)`. Absent for a table the app
|
|
@@ -943,6 +949,31 @@ interface TopicIR {
|
|
|
943
949
|
/** The `lunora/queues.ts` export name, e.g. `signups`. */
|
|
944
950
|
exportName: string;
|
|
945
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* A module: a folder under `lunora/` whose `module.ts` default-exports
|
|
954
|
+
* `defineModule(...)`. Metadata for the Studio catalog, the architecture
|
|
955
|
+
* manifest and the `cross_module_table_write` lint — it changes no `api.*` path.
|
|
956
|
+
*/
|
|
957
|
+
interface ModuleIR {
|
|
958
|
+
/** One-line description from `defineModule({ description })`. */
|
|
959
|
+
description?: string;
|
|
960
|
+
/**
|
|
961
|
+
* `true` for an installed component (a `defineSchemaExtension` key merged with
|
|
962
|
+
* `.extend(...)`) treated as a module: it owns its prefixed tables and the
|
|
963
|
+
* `lunora/<key>/` folder its copy-in code lives in. Absent for a declared module.
|
|
964
|
+
*/
|
|
965
|
+
installed?: true;
|
|
966
|
+
/** The folder path relative to `lunora/`, e.g. `billing` — also the module's name. */
|
|
967
|
+
name: string;
|
|
968
|
+
/**
|
|
969
|
+
* `false` for an installed component shipped as a package: its code is in
|
|
970
|
+
* `node_modules`, so it owns its tables but no `lunora/<key>/` folder (an app
|
|
971
|
+
* folder of that name stays the app's). Absent means the module owns its folder.
|
|
972
|
+
*/
|
|
973
|
+
ownsFolder?: false;
|
|
974
|
+
/** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
|
|
975
|
+
tables: ReadonlyArray<string>;
|
|
976
|
+
}
|
|
946
977
|
/**
|
|
947
978
|
* The feature-flag provider declared by the default export of `lunora/flags.ts`
|
|
948
979
|
* (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
|
|
@@ -1045,6 +1076,24 @@ interface AuthApiCallIR {
|
|
|
1045
1076
|
/** The better-auth method invoked (e.g. `banUser`); empty when not statically known. */
|
|
1046
1077
|
method: string;
|
|
1047
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* A table write other than a plain `ctx.db.insert(...)` (see {@link InsertWriteIR}):
|
|
1081
|
+
* a by-id `patch`/`replace`/`delete`/`hardDelete`/`restore`, a batch write, or a
|
|
1082
|
+
* `ctx.db.<table>.*` facade write. Feeds the architecture manifest's `write`
|
|
1083
|
+
* edges and the `cross_module_table_write` lint.
|
|
1084
|
+
*/
|
|
1085
|
+
interface TableWriteIR {
|
|
1086
|
+
/** Export binding name of the function performing the write. */
|
|
1087
|
+
exportName: string;
|
|
1088
|
+
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
1089
|
+
file: string;
|
|
1090
|
+
/** 1-based line of the call. */
|
|
1091
|
+
line: number;
|
|
1092
|
+
/** The writer method called, e.g. `patch`, `deleteMany`, `upsert`. */
|
|
1093
|
+
method: string;
|
|
1094
|
+
/** Target table; `""` when it can't be read (an untyped id, a non-literal name). */
|
|
1095
|
+
table: string;
|
|
1096
|
+
}
|
|
1048
1097
|
/**
|
|
1049
1098
|
* A `ctx.db.insert("table", …)` write discovered in a function body, attributed
|
|
1050
1099
|
* to the exported function (and its file = api namespace) that performs it — the
|
|
@@ -2241,6 +2290,7 @@ interface LintSchemaOptions {
|
|
|
2241
2290
|
mailRecipientAccesses?: ReadonlyArray<MailRecipientAccessIR>;
|
|
2242
2291
|
maskProcedures?: ReadonlyArray<MaskProcedureIR>;
|
|
2243
2292
|
maskStrategies?: ReadonlyArray<MaskStrategyIR>;
|
|
2293
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
2244
2294
|
mutators?: ReadonlyArray<MutatorIR>;
|
|
2245
2295
|
mutatorWrites?: ReadonlyArray<MutatorWriteIR>;
|
|
2246
2296
|
nondeterministicCalls?: ReadonlyArray<NondeterministicCallIR>;
|
|
@@ -2266,6 +2316,7 @@ interface LintSchemaOptions {
|
|
|
2266
2316
|
staleMigrationImports?: ReadonlyArray<StaleMigrationImportIR>;
|
|
2267
2317
|
storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
|
|
2268
2318
|
storageUploads?: ReadonlyArray<StorageUploadIR>;
|
|
2319
|
+
tableWrites?: ReadonlyArray<TableWriteIR>;
|
|
2269
2320
|
unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
|
|
2270
2321
|
vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
|
|
2271
2322
|
workflowCalls?: ReadonlyArray<WorkflowCallIR>;
|
|
@@ -3540,6 +3591,8 @@ interface EmitAppOptions {
|
|
|
3540
3591
|
bindingName: string;
|
|
3541
3592
|
exportName: string;
|
|
3542
3593
|
}>;
|
|
3594
|
+
/** An architecture manifest is emitted (`architecture.ts`, the app declares a module) → wire `architecture` into the worker. */
|
|
3595
|
+
wantsArchitecture: boolean;
|
|
3543
3596
|
/** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
|
|
3544
3597
|
wantsOpenApi: boolean;
|
|
3545
3598
|
/** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
|
|
@@ -3593,6 +3646,8 @@ declare const isHyperdriveGlobalTable: (table: TableIR) => boolean;
|
|
|
3593
3646
|
interface OpenApiEmitInput {
|
|
3594
3647
|
functions: ReadonlyArray<FunctionIR>;
|
|
3595
3648
|
httpRoutes: ReadonlyArray<HttpRouteIR>;
|
|
3649
|
+
/** The app's modules, passed only once it declares one; an operation in a module folder is tagged with the module instead of its file namespace. */
|
|
3650
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
3596
3651
|
/** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
|
|
3597
3652
|
version?: string;
|
|
3598
3653
|
}
|
|
@@ -3608,7 +3663,8 @@ interface OpenApiEmitInput {
|
|
|
3608
3663
|
* requestBody pinning `functionPath` + typed `args`. `internal`/`stream`
|
|
3609
3664
|
* functions are excluded (unreachable / not invocable on the external RPC path).
|
|
3610
3665
|
*
|
|
3611
|
-
* Operations are grouped into `tags` by file
|
|
3666
|
+
* Operations are grouped into `tags` by module (when the file sits in a
|
|
3667
|
+
* `defineModule` folder) or else by file namespace, and every operation
|
|
3612
3668
|
* references a reusable `LunoraError` error-response component enumerating the
|
|
3613
3669
|
* standard error codes. Borrows oRPC's per-procedure-operation + tag-grouping +
|
|
3614
3670
|
* internal-filtering structure; the JSON Schema dialect matches `@lunora/values`
|
|
@@ -3637,6 +3693,8 @@ declare const OPENRPC_VERSION = "1.3.2";
|
|
|
3637
3693
|
/** Inputs the OpenRPC emitter needs from a codegen run. */
|
|
3638
3694
|
interface OpenRpcEmitInput {
|
|
3639
3695
|
functions: ReadonlyArray<FunctionIR>;
|
|
3696
|
+
/** The app's modules, passed only once it declares one; a method in a module folder is tagged with the module instead of its file namespace. */
|
|
3697
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
3640
3698
|
/** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
|
|
3641
3699
|
version?: string;
|
|
3642
3700
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -385,6 +385,12 @@ interface TableIR {
|
|
|
385
385
|
* called `.commitOrdered()` default it to `false`.
|
|
386
386
|
*/
|
|
387
387
|
commitOrdered?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* `true` when that extension was resolved from a package in `node_modules`
|
|
390
|
+
* rather than from source under `lunora/` (a registry copy-in). Decides
|
|
391
|
+
* whether the component's module owns a `lunora/<key>/` folder.
|
|
392
|
+
*/
|
|
393
|
+
extensionFromPackage?: true;
|
|
388
394
|
/**
|
|
389
395
|
* The `defineSchemaExtension` key that contributed this table, set when it
|
|
390
396
|
* arrived through `defineSchema(...).extend(...)`. Absent for a table the app
|
|
@@ -943,6 +949,31 @@ interface TopicIR {
|
|
|
943
949
|
/** The `lunora/queues.ts` export name, e.g. `signups`. */
|
|
944
950
|
exportName: string;
|
|
945
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* A module: a folder under `lunora/` whose `module.ts` default-exports
|
|
954
|
+
* `defineModule(...)`. Metadata for the Studio catalog, the architecture
|
|
955
|
+
* manifest and the `cross_module_table_write` lint — it changes no `api.*` path.
|
|
956
|
+
*/
|
|
957
|
+
interface ModuleIR {
|
|
958
|
+
/** One-line description from `defineModule({ description })`. */
|
|
959
|
+
description?: string;
|
|
960
|
+
/**
|
|
961
|
+
* `true` for an installed component (a `defineSchemaExtension` key merged with
|
|
962
|
+
* `.extend(...)`) treated as a module: it owns its prefixed tables and the
|
|
963
|
+
* `lunora/<key>/` folder its copy-in code lives in. Absent for a declared module.
|
|
964
|
+
*/
|
|
965
|
+
installed?: true;
|
|
966
|
+
/** The folder path relative to `lunora/`, e.g. `billing` — also the module's name. */
|
|
967
|
+
name: string;
|
|
968
|
+
/**
|
|
969
|
+
* `false` for an installed component shipped as a package: its code is in
|
|
970
|
+
* `node_modules`, so it owns its tables but no `lunora/<key>/` folder (an app
|
|
971
|
+
* folder of that name stays the app's). Absent means the module owns its folder.
|
|
972
|
+
*/
|
|
973
|
+
ownsFolder?: false;
|
|
974
|
+
/** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
|
|
975
|
+
tables: ReadonlyArray<string>;
|
|
976
|
+
}
|
|
946
977
|
/**
|
|
947
978
|
* The feature-flag provider declared by the default export of `lunora/flags.ts`
|
|
948
979
|
* (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
|
|
@@ -1045,6 +1076,24 @@ interface AuthApiCallIR {
|
|
|
1045
1076
|
/** The better-auth method invoked (e.g. `banUser`); empty when not statically known. */
|
|
1046
1077
|
method: string;
|
|
1047
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* A table write other than a plain `ctx.db.insert(...)` (see {@link InsertWriteIR}):
|
|
1081
|
+
* a by-id `patch`/`replace`/`delete`/`hardDelete`/`restore`, a batch write, or a
|
|
1082
|
+
* `ctx.db.<table>.*` facade write. Feeds the architecture manifest's `write`
|
|
1083
|
+
* edges and the `cross_module_table_write` lint.
|
|
1084
|
+
*/
|
|
1085
|
+
interface TableWriteIR {
|
|
1086
|
+
/** Export binding name of the function performing the write. */
|
|
1087
|
+
exportName: string;
|
|
1088
|
+
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
1089
|
+
file: string;
|
|
1090
|
+
/** 1-based line of the call. */
|
|
1091
|
+
line: number;
|
|
1092
|
+
/** The writer method called, e.g. `patch`, `deleteMany`, `upsert`. */
|
|
1093
|
+
method: string;
|
|
1094
|
+
/** Target table; `""` when it can't be read (an untyped id, a non-literal name). */
|
|
1095
|
+
table: string;
|
|
1096
|
+
}
|
|
1048
1097
|
/**
|
|
1049
1098
|
* A `ctx.db.insert("table", …)` write discovered in a function body, attributed
|
|
1050
1099
|
* to the exported function (and its file = api namespace) that performs it — the
|
|
@@ -2241,6 +2290,7 @@ interface LintSchemaOptions {
|
|
|
2241
2290
|
mailRecipientAccesses?: ReadonlyArray<MailRecipientAccessIR>;
|
|
2242
2291
|
maskProcedures?: ReadonlyArray<MaskProcedureIR>;
|
|
2243
2292
|
maskStrategies?: ReadonlyArray<MaskStrategyIR>;
|
|
2293
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
2244
2294
|
mutators?: ReadonlyArray<MutatorIR>;
|
|
2245
2295
|
mutatorWrites?: ReadonlyArray<MutatorWriteIR>;
|
|
2246
2296
|
nondeterministicCalls?: ReadonlyArray<NondeterministicCallIR>;
|
|
@@ -2266,6 +2316,7 @@ interface LintSchemaOptions {
|
|
|
2266
2316
|
staleMigrationImports?: ReadonlyArray<StaleMigrationImportIR>;
|
|
2267
2317
|
storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
|
|
2268
2318
|
storageUploads?: ReadonlyArray<StorageUploadIR>;
|
|
2319
|
+
tableWrites?: ReadonlyArray<TableWriteIR>;
|
|
2269
2320
|
unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
|
|
2270
2321
|
vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
|
|
2271
2322
|
workflowCalls?: ReadonlyArray<WorkflowCallIR>;
|
|
@@ -3540,6 +3591,8 @@ interface EmitAppOptions {
|
|
|
3540
3591
|
bindingName: string;
|
|
3541
3592
|
exportName: string;
|
|
3542
3593
|
}>;
|
|
3594
|
+
/** An architecture manifest is emitted (`architecture.ts`, the app declares a module) → wire `architecture` into the worker. */
|
|
3595
|
+
wantsArchitecture: boolean;
|
|
3543
3596
|
/** An OpenAPI spec is emitted (`openapi.ts`) → wire `openApiSpec` into the worker. */
|
|
3544
3597
|
wantsOpenApi: boolean;
|
|
3545
3598
|
/** An OpenRPC spec is emitted (`openrpc.ts`) → wire `openRpcSpec` into the worker. */
|
|
@@ -3593,6 +3646,8 @@ declare const isHyperdriveGlobalTable: (table: TableIR) => boolean;
|
|
|
3593
3646
|
interface OpenApiEmitInput {
|
|
3594
3647
|
functions: ReadonlyArray<FunctionIR>;
|
|
3595
3648
|
httpRoutes: ReadonlyArray<HttpRouteIR>;
|
|
3649
|
+
/** The app's modules, passed only once it declares one; an operation in a module folder is tagged with the module instead of its file namespace. */
|
|
3650
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
3596
3651
|
/** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
|
|
3597
3652
|
version?: string;
|
|
3598
3653
|
}
|
|
@@ -3608,7 +3663,8 @@ interface OpenApiEmitInput {
|
|
|
3608
3663
|
* requestBody pinning `functionPath` + typed `args`. `internal`/`stream`
|
|
3609
3664
|
* functions are excluded (unreachable / not invocable on the external RPC path).
|
|
3610
3665
|
*
|
|
3611
|
-
* Operations are grouped into `tags` by file
|
|
3666
|
+
* Operations are grouped into `tags` by module (when the file sits in a
|
|
3667
|
+
* `defineModule` folder) or else by file namespace, and every operation
|
|
3612
3668
|
* references a reusable `LunoraError` error-response component enumerating the
|
|
3613
3669
|
* standard error codes. Borrows oRPC's per-procedure-operation + tag-grouping +
|
|
3614
3670
|
* internal-filtering structure; the JSON Schema dialect matches `@lunora/values`
|
|
@@ -3637,6 +3693,8 @@ declare const OPENRPC_VERSION = "1.3.2";
|
|
|
3637
3693
|
/** Inputs the OpenRPC emitter needs from a codegen run. */
|
|
3638
3694
|
interface OpenRpcEmitInput {
|
|
3639
3695
|
functions: ReadonlyArray<FunctionIR>;
|
|
3696
|
+
/** The app's modules, passed only once it declares one; a method in a module folder is tagged with the module instead of its file namespace. */
|
|
3697
|
+
modules?: ReadonlyArray<ModuleIR>;
|
|
3640
3698
|
/** `info.version`; defaults to `"0.0.0"` with a TODO when the project version is unknown. */
|
|
3641
3699
|
version?: string;
|
|
3642
3700
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as l,errorPlatformDiagnosticNames as n,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CodegenDiagnosticError as E,diagnosticAt as u}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as v,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-D8SgT3OR.mjs";import{listLunoraSourceFiles as C}from"./packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-DoSN_yc3.mjs";import{CONTAINERS_FILENAME as T,discoverContainers as _}from"./packem_shared/CONTAINERS_FILENAME-CBCG6g9n.mjs";import{default as L}from"./packem_shared/discoverCrons-BEALHx1S.mjs";import{FLAGS_FILENAME as I,discoverFlags as P}from"./packem_shared/FLAGS_FILENAME-W5XQz_Po.mjs";import{default as G}from"./packem_shared/discoverFunctions-BcBzcG5x.mjs";import{default as b}from"./packem_shared/discoverHttpRoutes-CJHS4llq.mjs";import{default as y}from"./packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs";import{default as k}from"./packem_shared/discoverInserts-DpuLYPPd.mjs";import{d as K}from"./packem_shared/index-D7dKfGPh.mjs";import{default as z}from"./packem_shared/discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-DqWOgC5Z.mjs";import{default as J}from"./packem_shared/discoverNondeterministicCalls-CNJV2BiP.mjs";import{NOTIFY_FILENAME as X,discoverNotifyCalls as Z,discoverNotifyConfig as $}from"./packem_shared/NOTIFY_FILENAME-C1J_47et.mjs";import{default as re}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{default as te}from"./packem_shared/discoverQueries-BcdqjYky.mjs";import{QUEUES_FILENAME as ae,discoverQueues as ie}from"./packem_shared/QUEUES_FILENAME-RGwht3Xu.mjs";import{default as fe}from"./packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs";import{default as pe}from"./packem_shared/discoverRlsProcedures-F4Cy-kSi.mjs";import{default as le}from"./packem_shared/discoverRlsMetadata-mXBmPOGj.mjs";import{discoverSandboxUsage as xe}from"./packem_shared/discoverSandboxUsage-DkbwwFvO.mjs";import{default as Ee}from"./packem_shared/discoverSchema-D5R60b4F.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ve}from"./packem_shared/SHAPES_FILENAME-DRUFomCj.mjs";import{default as ge}from"./packem_shared/discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{WORKFLOWS_FILENAME as Oe,discoverWorkflows as Re}from"./packem_shared/WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{emitApp as Te}from"./packem_shared/emitApp-Cu0w-3vl.mjs";import{isD1GlobalTable as he,isHyperdriveGlobalTable as Le}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ie,emitOpenApi as Pe,emitOpenApiModule as De}from"./packem_shared/buildOpenApiDocument-SxfElVzK.mjs";import{OPENRPC_VERSION as Ue,buildOpenRpcDocument as be,emitOpenRpc as He,emitOpenRpcModule as ye}from"./packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs";import{DEFAULT_TARGET as ke,platformMatrixIds as We,readProjectTarget as Ke,resolveCodegenTarget as Ve}from"./packem_shared/DEFAULT_TARGET-BLYeFMMT.mjs";import{loadProjectConfig as Qe,readProjectConfigLiterals as qe}from"./packem_shared/loadProjectConfig-CktK_il-.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Be,createCodegenProject as Je,findTsconfig as Ye,refreshCodegenProject as Xe,runCodegen as Ze}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-D1zEPvOK.mjs";import{SchemaSnapshotParseError as er,buildSchemaSnapshot as rr,evaluateSchemaDrift as or,parseSchemaSnapshot as tr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as ar}from"./packem_shared/fingerprintSchemaSources-Cl1CJFeh.mjs";import{schemaFromIr as mr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as dr,validatorIrToJsonSchema as pr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as lr,SDK_TARGETS as nr,generateSdk as xr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as Er,secretKindOf as ur}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as vr}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as gr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as Or}from"./packem_shared/emitServer-pF_fhA82.mjs";import{e as Mr}from"./packem_shared/shard-BVzXMtWg.mjs";import{G as _r}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as Lr,findSolutionByMessage as Fr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Pr,findProjectConfigFile as Dr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{A as Ur,B as br,C as Hr}from"./packem_shared/shard-runtime-oIXHEMU7.mjs";import{emitApi as jr,emitCollections as kr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as Kr,emitScheduler as Vr,emitVectors as zr,emitWranglerCronTriggers as Qr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as wr}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as Jr}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{v as AGENTS_FILENAME,T as CONTAINERS_FILENAME,E as CodegenDiagnosticError,ke as DEFAULT_TARGET,I as FLAGS_FILENAME,_r as GENERATED_HEADER,dr as LUNORA_ERROR_CODES,Lr as LUNORA_SOLUTION_RULES,q as MUTATORS_FILENAME,X as NOTIFY_FILENAME,Ue as OPENRPC_VERSION,Pr as PROJECT_CONFIG_FILENAMES,ae as QUEUES_FILENAME,Be as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,lr as SDK_LANGUAGES,nr as SDK_TARGETS,Ae as SHAPES_FILENAME,er as SchemaSnapshotParseError,e as VERSION,Oe as WORKFLOWS_FILENAME,Ie as buildOpenApiDocument,be as buildOpenRpcDocument,rr as buildSchemaSnapshot,Je as createCodegenProject,c as describeErrorLevelFindings,u as diagnosticAt,s as diffSchemaSnapshots,N as discoverAgents,R as discoverAuthApiCalls,_ as discoverContainers,L as discoverCrons,P as discoverFlags,G as discoverFunctions,b as discoverHttpRoutes,y as discoverHyperdriveCalls,k as discoverInserts,K as discoverMaskProcedures,z as discoverMigrations,w as discoverMutators,J as discoverNondeterministicCalls,Z as discoverNotifyCalls,$ as discoverNotifyConfig,te as discoverQueries,ie as discoverQueues,fe as discoverR2sqlCalls,le as discoverRlsMetadata,pe as discoverRlsProcedures,xe as discoverSandboxUsage,Ee as discoverSchema,ve as discoverShapes,ge as discoverStorageRulesMetadata,Re as discoverWorkflows,Ur as emitAgents,jr as emitApi,Te as emitApp,kr as emitCollections,br as emitContainers,Kr as emitCrons,wr as emitDataModel,vr as emitDrizzleSchema,gr as emitFunctions,Pe as emitOpenApi,De as emitOpenApiModule,He as emitOpenRpc,ye as emitOpenRpcModule,Vr as emitScheduler,Or as emitServer,Mr as emitShard,zr as emitVectors,Hr as emitWorkflows,Qr as emitWranglerCronTriggers,l as errorAdvisoryNames,n as errorPlatformDiagnosticNames,or as evaluateSchemaDrift,Fr as findLunoraSolution,Dr as findProjectConfigFile,Ye as findTsconfig,ar as fingerprintSchemaSources,m as formatAdvisories,xr as generateSdk,he as isD1GlobalTable,Le as isHyperdriveGlobalTable,Jr as isTypedSchema,f as lintSchema,C as listLunoraSourceFiles,Qe as loadProjectConfig,tr as parseSchemaSnapshot,We as platformMatrixIds,re as readPackageDependencies,qe as readProjectConfigLiterals,Ke as readProjectTarget,Er as redact,Xe as refreshCodegenProject,Ve as resolveCodegenTarget,Ze as runCodegen,mr as schemaFromIr,ur as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,d as toAdvisorContext,pr 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 m}from"@lunora/errors";import{Node as s,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./listLunoraSourceFiles-
|
|
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 m}from"@lunora/errors";import{Node as s,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./listLunoraSourceFiles-CSlcBYlo.mjs";const h="agents.ts",E=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const t of n.getDeclarations())if(s.isImportSpecifier(t))return t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:t.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),v=(o,n,t)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${t}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},T=(o,n)=>{const t=o.getArguments()[0];if(!t||!s.isObjectLiteralExpression(t))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const e={className:b(n),exportName:n,name:d(n)},i=c(t,"name");i&&s.isPropertyAssignment(i)&&(e.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(t,"publicRun");r&&s.isPropertyAssignment(r)&&v(r.getInitializerOrThrow(),n,"publicRun")&&(e.publicRun=!0);const a=c(t,"voice");if(a&&s.isPropertyAssignment(a)){const g=a.getInitializerOrThrow();if(!s.isObjectLiteralExpression(g))throw l(g,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);e.voice=!0,e.voiceBindingName=N(n),e.voiceClassName=y(n)}return c(t,"onEmail")&&(e.onEmail=!0),e},I=o=>{const n=[];for(const t of o.getVariableDeclarations()){if(!t.isExported())continue;const e=A(t.getInitializer());if(!e)continue;const i=e.getExpression();if(!s.isIdentifier(i)||!E(i))continue;const r=t.getNameNode();if(!s.isIdentifier(r))throw l(r,"defineAgent exports must be plain named exports (no destructuring)");n.push(T(e,r.getText()))}return n},x=o=>{const n=new Map,t=new Map;for(const e of o){const i=n.get(e.name);if(i!==void 0)throw new m("DUPLICATE_AGENT_NAME",`Duplicate agent name "${e.name}": produced by both "${i}" and "${e.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(e.name,e.exportName);const r=t.get(e.className);if(r!==void 0)throw new m("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${e.className}": produced by both "${r}" and "${e.exportName}". Agent export names must yield unique generated class names.`,{status:500});t.set(e.className,e.exportName)}},O=(o,n)=>{const t=f(n,h);if(!p(t))return[];const e=o.getSourceFile(t)??o.addSourceFileAtPath(t),i=I(e);return i.sort((r,a)=>r.exportName.localeCompare(a.exportName)),x(i),i};export{h as AGENTS_FILENAME,O as discoverAgents};
|
package/dist/packem_shared/{CONTAINERS_FILENAME-CGB4bqUr.mjs → CONTAINERS_FILENAME-CBCG6g9n.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as $}from"node:fs";import{join as S}from"node:path";import{containerClassName as P,containerBindingName as T,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as A,isManagedImage as j,isCloudflareRegistryDigest as O,normalizeContainerImage as b}from"@lunora/container";import{SyntaxKind as d,Node as o}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{propertyKeyName as y,stringPropertyFor as I,findObjectProperty as p,symbolConstInitializer as k}from"./listLunoraSourceFiles-
|
|
1
|
+
import{existsSync as $}from"node:fs";import{join as S}from"node:path";import{containerClassName as P,containerBindingName as T,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as A,isManagedImage as j,isCloudflareRegistryDigest as O,normalizeContainerImage as b}from"@lunora/container";import{SyntaxKind as d,Node as o}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{propertyKeyName as y,stringPropertyFor as I,findObjectProperty as p,symbolConstInitializer as k}from"./listLunoraSourceFiles-CSlcBYlo.mjs";const C="containers.ts",D=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(o.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},f=I("container"),h=(t,e,r)=>{if(o.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`)},w=(t,e)=>{if(o.isStringLiteral(t)||o.isNoSubstitutionTemplateLiteral(t))return b(t.getLiteralValue());if(o.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&o.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return b({registry:f(i,e,"image.registry")})}const n=p(t,"build");if(n&&o.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return b({build:f(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},M=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","schedulingPolicy"]),_=new Set(["gracePeriodSeconds","stepPercentage"]),E=t=>{let e=t;for(;o.isAsExpression(e)||o.isSatisfiesExpression(e)||o.isTypeAssertion(e)||o.isParenthesizedExpression(e);)e=e.getExpression();return e},F=(t,e)=>{const r=i=>{let s=i;for(;o.isPropertyAccessExpression(s)||o.isElementAccessExpression(s)||o.isParenthesizedExpression(s);)s=s.getExpression();return s===i?void 0:s},n=i=>i!==void 0&&o.isIdentifier(i)&&i.getSymbol()===t;return e.getDescendants().some(i=>{if(o.isBinaryExpression(i)){const s=i.getOperatorToken().getKind();return s>=d.FirstAssignment&&s<=d.LastAssignment&&n(r(i.getLeft()))}if(o.isPrefixUnaryExpression(i)||o.isPostfixUnaryExpression(i)){const s=i.getOperatorToken();return(s===d.PlusPlusToken||s===d.MinusMinusToken)&&n(r(i.getOperand()))}return o.isDeleteExpression(i)?n(r(i.getExpression())):o.isCallExpression(i)&&i.getExpression().getText()==="Object.assign"&&n(i.getArguments()[0])})},B=16,v=(t,e,r,n)=>{let i={name:r,symbol:t},s;for(let l=0;l<B;l+=1){const c=k(i.symbol);if(c===void 0||!o.isExpression(c))return s;if(s=E(c),o.isObjectLiteralExpression(s)&&i.symbol!==void 0&&F(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(!o.isIdentifier(s))return s;i={name:s.getText(),symbol:s.getSymbol()}}return s},L=(t,e)=>{const r=E(t);return o.isIdentifier(r)?v(r.getSymbol(),r,r.getText(),e)??r:r},R=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},V=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(R(n))].filter(s=>e.has(s)).map(s=>`\`${s}\``);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.`)},z=(t,e,r)=>{const n=y(t),i=o.isShorthandPropertyAssignment(t)?v(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=[],s=new Set(n).add(t);for(const l of t.getProperties())if(o.isPropertyAssignment(l))i.push([y(l),L(l.getInitializerOrThrow(),r)]);else if(o.isSpreadAssignment(l))i.push(...K(l,e,r,s));else{const c=z(l,e,r);c!==void 0&&i.push(c)}return i},K=(t,e,r,n)=>{const i=L(t.getExpression(),r);if(!o.isObjectLiteralExpression(i))return V(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)},U=(t,e)=>{if(!o.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]=f(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},x=(t,e)=>{if(!o.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,_,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=h(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},N=t=>{if(o.isTrueLiteral(t))return!0;if(o.isFalseLiteral(t))return!1},Y=t=>{if(o.isStringLiteral(t)||o.isNoSubstitutionTemplateLiteral(t)||o.isNumericLiteral(t))return t.getLiteralValue()},q=(t,e)=>{if(o.isStringLiteral(t))return t.getLiteralValue();if(o.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!o.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=y(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=h(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},W=(t,e)=>{if(!o.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 s=w(i,e);if(s.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(s.kind==="registry"&&!O(s.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]=s}return r},G=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=f(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},H=(t,e,r,n)=>{if(r!==void 0&&A.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"`)},J=(t,e,r,n)=>{const{base:i,policy:s}=r;switch(t){case"buildArgs":{i.buildArgs=U(e,n);break}case"enableInternet":{i.enableInternet=N(e);break}case"image":{r.scheduled||(s.image=w(e,n));break}case"images":{s.images=W(e,n);break}case"instanceType":{i.instanceType=q(e,n);break}case"maxInstances":{s.maxInstances=h(e,n,"maxInstances");break}case"name":{i.name=f(e,n,"name");break}case"rollout":{s.rollout=x(e,n);break}case"sleepAfter":{i.sleepAfter=Y(e);break}}},X=(t,e,r)=>{const n=t.findLast(([s])=>s==="image")?.[1];if(n===void 0||!(o.isStringLiteral(n)||o.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!j(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},Q=(t,e)=>{const r=t.getArguments()[0];if(!r||!o.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,M,`container "${e}"`),i=G(n,e),s={base:{bindingName:T(e),className:P(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[u,g]of n)H(u,g,i,e),J(u,g,s,e);const{base:l,policy:c}=s;if(i==="durable_object")return X(n,c.images,e),{...l,...c.images===void 0?{}:{images:c.images},schedulingPolicy:i};if(c.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...l,image:c.image,...c.maxInstances===void 0?{}:{maxInstances:c.maxInstances},...c.rollout===void 0?{}:{rollout:c.rollout}}},Z=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){if(!n.isExported())continue;const i=n.getInitializer();if(i?.getKind()!==d.CallExpression)continue;const s=i,l=s.getExpression();if(!o.isIdentifier(l)||!D(l))continue;const c=n.getNameNode();if(!o.isIdentifier(c))throw a(c,"defineContainer exports must be plain named exports (no destructuring)");const u=Q(s,c.getText()),g=r.get(u.bindingName);if(g!==void 0)throw a(c,`containers "${g}" 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},oe=(t,e)=>{const r=S(e,C);if(!$(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=Z(n);return i.sort((s,l)=>s.exportName.localeCompare(l.exportName)),i};export{C as CONTAINERS_FILENAME,oe as discoverContainers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as v}from"@lunora/platform";import{readProjectConfigLiterals as m}from"./loadProjectConfig-
|
|
1
|
+
import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as v}from"@lunora/platform";import{readProjectConfigLiterals as m}from"./loadProjectConfig-CktK_il-.mjs";const c="cloudflare",b=t=>{const{target:e}=m(t);return e!==void 0&&e.length>0?e:void 0},L=(t,e)=>e??b(t)??c,x=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=m(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${c}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${c}" }\`), or pass \`--target\`.`,target:c}]},u={celld:v,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),w={access:null,ai:"ai",analytics:"analytics",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:null},S=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],g={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${g[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${g[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:d,target:i}=t;for(const s of S){if(d[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},d={...r},i=[],s=new Set;for(const[o,l]of Object.entries(w)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:d,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:d,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{w as CAPABILITY_TO_FEATURE,c as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,b as readProjectTarget,x as readTargetDiagnostics,L as resolveCodegenTarget,I as studioPlatformFor};
|
|
@@ -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"./listLunoraSourceFiles-
|
|
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"./listLunoraSourceFiles-CSlcBYlo.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-B6cKrN_m.mjs → MUTATORS_FILENAME-DqWOgC5Z.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as p}from"node:fs";import{join as l}from"node:path";import{Node as o,SyntaxKind as m}from"ts-morph";import{diagnosticAt as g}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as d}from"./module-specifiers-WF8iAydP.mjs";import{p as x}from"./parse-validator-
|
|
1
|
+
import{existsSync as p}from"node:fs";import{join as l}from"node:path";import{Node as o,SyntaxKind as m}from"ts-morph";import{diagnosticAt as g}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as d}from"./module-specifiers-WF8iAydP.mjs";import{p as x}from"./parse-validator-C6fHL7OS.mjs";import{findObjectProperty as c}from"./listLunoraSourceFiles-CSlcBYlo.mjs";import{u as M}from"./unwrap-handler-return-DVY_kFF7.mjs";const y="mutators.ts",f=d,S=r=>{const t=r.getSymbol();if(!t)return r.getText()==="defineMutator";for(const e of t.getDeclarations())if(o.isImportSpecifier(e))return f(e.getImportDeclaration().getModuleSpecifierValue())?e.getNameNode().getText()==="defineMutator":!1;return!1},N=r=>{const t=r.getSymbol();if(!t)return!1;for(const e of t.getDeclarations()){if(!o.isNamespaceImport(e))continue;const i=e.getFirstAncestorByKind(m.ImportDeclaration);return i!==void 0&&f(i.getModuleSpecifierValue())}return!1},I=r=>{if(o.isIdentifier(r))return S(r);if(o.isPropertyAccessExpression(r)){const t=r.getExpression();return r.getName()==="defineMutator"&&o.isIdentifier(t)&&N(t)}return!1},b=r=>{const t=r.getArguments()[0];return t&&o.isObjectLiteralExpression(t)?t:void 0},A=r=>{const t=c(r,"args");if(!t||!o.isPropertyAssignment(t))return{};const e=t.getInitializer();return e&&o.isObjectLiteralExpression(e)?x(e):{}},E=r=>{const t=c(r,"server");if(!t||!o.isPropertyAssignment(t))return"unknown";const e=t.getInitializer();return!e||!(o.isArrowFunction(e)||o.isFunctionExpression(e))?"unknown":M(e)},F=r=>{const t=c(r,"owner");if(!t||!o.isPropertyAssignment(t))return;const e=t.getInitializer();return e&&o.isStringLiteral(e)?e.getLiteralValue():void 0},P=r=>{const t=[];for(const e of r.getVariableDeclarations()){if(!e.isExported())continue;const i=e.getInitializer();if(i?.getKind()!==m.CallExpression)continue;const n=i,a=n.getExpression();if(!I(a))continue;const s=e.getNameNode();if(!o.isIdentifier(s))throw g(s,"defineMutator exports must be plain named exports (no destructuring)");const u=b(n);t.push({args:A(u),exportName:s.getText(),filePath:"mutators",line:n.getStartLineNumber(),owner:F(u),returnType:E(u)})}return t},O=(r,t)=>{const e=l(t,y);if(!p(e))return[];const i=r.getSourceFile(e)??r.addSourceFileAtPath(e),n=P(i);return n.sort((a,s)=>a.exportName.localeCompare(s.exportName)),n};export{y as MUTATORS_FILENAME,O as discoverMutators,I as isDefineMutatorCallee};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as x}from"node:fs";import{join as P}from"node:path";import{SyntaxKind as l,Node as c}from"ts-morph";import{listLunoraSourceFiles as p,lunoraRelativePath as g,defaultExportExpression as E,findObjectProperty as d,handlerOf as S}from"./listLunoraSourceFiles-
|
|
1
|
+
import{existsSync as x}from"node:fs";import{join as P}from"node:path";import{SyntaxKind as l,Node as c}from"ts-morph";import{listLunoraSourceFiles as p,lunoraRelativePath as g,defaultExportExpression as E,findObjectProperty as d,handlerOf as S}from"./listLunoraSourceFiles-CSlcBYlo.mjs";import{c as v}from"./classify-procedure-call-CmcShAze.mjs";const y="notify.ts",N=new Set(["chat","inApp","send","webhook"]),h=new Set(["broadcast","send"]),F=e=>{const t=e.getInitializer();if(!t||!c.isCallExpression(t))return;const o=v(t);if(!o)return;const s=S(t,o.receiver);return s?{exportName:e.getName(),handler:s,kind:o.kind}:void 0},m=e=>{const t=[];for(const o of e.getVariableStatements())if(o.isExported())for(const s of o.getDeclarations()){const r=F(s);r&&t.push(r)}return t},a=e=>{if(!c.isPropertyAccessExpression(e))return;const t=e.getName(),o=e.getExpression();if((t==="notify"||t==="push")&&c.isIdentifier(o)&&o.getText()==="ctx")return t;if(t==="push"&&a(o)==="notify")return"push"},A=e=>{if(!c.isPropertyAccessExpression(e))return;const t=e.getName(),o=a(e.getExpression());if(o==="notify"&&N.has(t))return`ctx.notify.${t}`;if(o==="push"&&h.has(t))return`ctx.push.${t}`},O=e=>c.isPropertyAccessExpression(e)?a(e.getExpression())==="push"&&h.has(e.getName()):!1,_=(e,t)=>{const o=[];for(const s of p(t)){const r=e.getSourceFile(s)??e.addSourceFileAtPath(s),f=g(t,s);for(const n of m(r))if(!(n.kind!=="query"&&n.kind!=="mutation"))for(const i of n.handler.getDescendantsOfKind(l.PropertyAccessExpression)){const u=A(i);u!==void 0&&o.push({callee:u,exportName:n.exportName,file:f,kind:n.kind,line:i.getStartLineNumber()})}}return o},b=(e,t)=>{for(const o of p(t)){const s=e.getSourceFile(o)??e.addSourceFileAtPath(o);for(const r of m(s))for(const f of r.handler.getDescendantsOfKind(l.PropertyAccessExpression))if(O(f))return!0}return!1},w=(e,t)=>{const o=P(t,y);if(!x(o))return;const s=e.getSourceFile(o)??e.addSourceFileAtPath(o),r=E(s);let f=!1,n=!1;if(r&&c.isCallExpression(r)){const i=r.getArguments()[0];i&&c.isObjectLiteralExpression(i)&&(f=d(i,"webPush")!==void 0,n=d(i,"fcm")!==void 0)}return{hasFcm:n,hasWebPush:f,usesPush:b(e,t)}};export{y as NOTIFY_FILENAME,_ as discoverNotifyCalls,w as discoverNotifyConfig};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{m}from"./modules-DyCocr1e.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{s as p}from"./paths-C-9fwEgQ.mjs";import{validatorIrToJsonSchema as l,objectSchema as d,LUNORA_ERROR_CODES as i}from"./LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{G as R}from"./shared-DjUziztz.mjs";const h="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},f=(e,n)=>{const t=`${p(e.filePath)}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${t}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${t}", "args": { … } }\`).`,errors:i.map((r,a)=>({code:-32e3-a,data:{code:r},message:r})),name:t,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:d(e.args)}],result:{name:"result",schema:e.output?l(e.output):g},summary:`${e.kind}: ${t}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},O=e=>{const n=e.version??"0.0.0",s=e.functions.filter(o=>o.visibility!=="internal"&&o.kind!=="stream"),t=e.modules??[],r=s.map(o=>f(o,m(t,o.filePath))).toSorted((o,c)=>o.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:n},methods:r,openrpc:h}},E=e=>`${JSON.stringify(O(e),void 0,2)}
|
|
2
|
+
`,b=e=>`${R}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
|
|
3
|
+
`;export{h as OPENRPC_VERSION,O as buildOpenRpcDocument,E as emitOpenRpc,b as emitOpenRpcModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as g}from"node:fs";import{join as b}from"node:path";import{LunoraError as f}from"@lunora/errors";import{queueDefaultName as y,queueBindingName as h}from"@lunora/queue";import{SyntaxKind as q,Node as a}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{findObjectProperty as d,stringPropertyFor as w}from"./listLunoraSourceFiles-
|
|
1
|
+
import{existsSync as g}from"node:fs";import{join as b}from"node:path";import{LunoraError as f}from"@lunora/errors";import{queueDefaultName as y,queueBindingName as h}from"@lunora/queue";import{SyntaxKind as q,Node as a}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{findObjectProperty as d,stringPropertyFor as w}from"./listLunoraSourceFiles-CSlcBYlo.mjs";const N="queues.ts",x=i=>{const t=e=>e==="defineQueue"||e==="defineSubscription"||e==="defineTopic",o=i.getSymbol();if(!o){const e=i.getText();return t(e)?e:void 0}for(const e of o.getDeclarations()){if(!a.isImportSpecifier(e))continue;if(e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/queue")return;const r=e.getNameNode().getText();return t(r)?r:void 0}},p=w("queue"),E=(i,t,o)=>{if(a.isNumericLiteral(i))return i.getLiteralValue();throw c(i,`queue "${t}": \`${o}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`)},S=(i,t)=>{const o=d(i,"name");if(!o||!a.isPropertyAssignment(o))return;const e=p(o.getInitializerOrThrow(),t,"name");if(e.length===0)throw c(o,`queue "${t}": \`name\` must be a non-empty string when provided`);return e},l=(i,t,o)=>{const e={bindingName:h(t),exportName:t,mode:"push",name:S(i,t)??y(t),...o===void 0?{}:{topic:o},tuning:{}},r=d(i,"mode");if(r&&a.isPropertyAssignment(r)){if(o!==void 0)throw c(r,`subscription "${t}": \`mode\` is not allowed — a subscription is always a push consumer`);const s=p(r.getInitializerOrThrow(),t,"mode");if(s!=="push"&&s!=="pull")throw c(r,`queue "${t}": \`mode\` must be "push" or "pull" (got ${JSON.stringify(s)})`);e.mode=s}const n=d(i,"deadLetterQueue");n&&a.isPropertyAssignment(n)&&(e.tuning.deadLetterQueue=p(n.getInitializerOrThrow(),t,"deadLetterQueue"));for(const s of["maxBatchSize","maxBatchTimeout","maxRetries","retryDelay"]){const u=d(i,s);u&&a.isPropertyAssignment(u)&&(e.tuning[s]=E(u.getInitializerOrThrow(),t,s))}return e},v=(i,t)=>{const o=i.getArguments()[0];if(!o||!a.isObjectLiteralExpression(o))throw c(i,`queue "${t}": defineQueue must be passed an inline object literal`);return l(o,t,void 0)},$=(i,t,o)=>{const[e,r]=i.getArguments();if(!e||!a.isIdentifier(e)||!o.has(e.getText()))throw c(e??i,`subscription "${t}": the first argument must name a \`defineTopic()\` export of lunora/queues.ts`);if(!r||!a.isObjectLiteralExpression(r))throw c(i,`subscription "${t}": defineSubscription must be passed an inline object literal`);return l(r,t,e.getText())},I=i=>{const t=[];for(const o of i.getVariableDeclarations()){if(!o.isExported())continue;const e=o.getInitializer();if(e?.getKind()!==q.CallExpression)continue;const r=e,n=r.getExpression(),s=a.isIdentifier(n)?x(n):void 0;if(s===void 0)continue;const u=o.getNameNode();if(!a.isIdentifier(u))throw c(u,`${s} exports must be plain named exports (no destructuring)`);t.push({call:r,exportName:u.getText(),factory:s})}return t},P=i=>{const t=I(i),o=new Set(t.filter(n=>n.factory==="defineTopic").map(n=>n.exportName)),e=[];for(const n of t)n.factory==="defineQueue"?e.push(v(n.call,n.exportName)):n.factory==="defineSubscription"&&e.push($(n.call,n.exportName,o));const r=[...o].map(n=>({exportName:n}));return{queues:e,topics:r}},T=i=>{const t=new Map,o=new Map;for(const e of i){const r=t.get(e.name);if(r!==void 0)throw new f("DUPLICATE_QUEUE_NAME",`Duplicate queue name "${e.name}": produced by both "${r}" and "${e.exportName}". Deployed queue names must be unique across the project.`,{status:500});t.set(e.name,e.exportName);const n=o.get(e.bindingName);if(n!==void 0)throw new f("DUPLICATE_QUEUE_BINDING",`Duplicate queue binding "${e.bindingName}": produced by both "${n}" and "${e.exportName}". Queue export names must yield unique binding names.`,{status:500});o.set(e.bindingName,e.exportName)}},A=(i,t)=>{const o=b(t,N);if(!g(o))return{queues:[],topics:[]};const e=i.getSourceFile(o)??i.addSourceFileAtPath(o),{queues:r,topics:n}=P(e),s=r.toSorted((u,m)=>u.exportName.localeCompare(m.exportName));return T(s),{queues:s,topics:n.toSorted((u,m)=>u.exportName.localeCompare(m.exportName))}},j=(i,t)=>A(i,t).queues;export{N as QUEUES_FILENAME,A as discoverQueueDeclarations,j as discoverQueues};
|