@lunora/codegen 1.0.0-alpha.383 → 1.0.0-alpha.385

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.
Files changed (67) hide show
  1. package/dist/index.d.mts +43 -5
  2. package/dist/index.d.ts +43 -5
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{AGENTS_FILENAME-BedyJsOT.mjs → AGENTS_FILENAME-5mDMAMWy.mjs} +1 -1
  5. package/dist/packem_shared/{CONTAINERS_FILENAME-T1v8pyHN.mjs → CONTAINERS_FILENAME-BJYrxnq2.mjs} +1 -1
  6. package/dist/packem_shared/{GENERATED_HEADER-Bzf6ZJ9r.mjs → GENERATED_HEADER-B-tYRlRG.mjs} +1 -1
  7. package/dist/packem_shared/{MUTATORS_FILENAME-BGvYo46g.mjs → MUTATORS_FILENAME-D9WbOFm7.mjs} +1 -1
  8. package/dist/packem_shared/{NOTIFY_FILENAME-BJJObZHG.mjs → NOTIFY_FILENAME-CRU_TEKs.mjs} +1 -1
  9. package/dist/packem_shared/{OPENRPC_VERSION-CSjT8wJW.mjs → OPENRPC_VERSION-CT_E2DcI.mjs} +1 -1
  10. package/dist/packem_shared/{QUEUES_FILENAME-Dt5RG_P0.mjs → QUEUES_FILENAME-BeGwgqcw.mjs} +1 -1
  11. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DXilYf6b.mjs +31 -0
  12. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs +2 -0
  13. package/dist/packem_shared/SHAPES_FILENAME-D9beIrs1.mjs +1 -0
  14. package/dist/packem_shared/{SchemaSnapshotParseError-ycDz8gOB.mjs → SchemaSnapshotParseError-DnAuFdpl.mjs} +8 -8
  15. package/dist/packem_shared/{WORKFLOWS_FILENAME-VAXgqqP-.mjs → WORKFLOWS_FILENAME--RWiu_Vy.mjs} +1 -1
  16. package/dist/packem_shared/{attribution-DUbGYT4N.mjs → attribution-CTMkuBkn.mjs} +1 -1
  17. package/dist/packem_shared/{buildOpenApiDocument-afHH7rN5.mjs → buildOpenApiDocument-67-fasdW.mjs} +1 -1
  18. package/dist/packem_shared/{context-property-calls-B75cjwpy.mjs → context-property-calls-ZK1UcTQR.mjs} +1 -1
  19. package/dist/packem_shared/{context-root-D4Njep-A.mjs → context-root-DtpwprsY.mjs} +1 -1
  20. package/dist/packem_shared/{database-calls-aAjZJdma.mjs → database-calls-Cn47SfSU.mjs} +1 -1
  21. package/dist/packem_shared/{discoverAuthApiCalls-Ce3BdKQr.mjs → discoverAuthApiCalls-DZMYREsq.mjs} +1 -1
  22. package/dist/packem_shared/discoverFunctions-DU5ylqVC.mjs +1 -0
  23. package/dist/packem_shared/{discoverHttpRoutes-BQM2CPSF.mjs → discoverHttpRoutes-D9Q0lBBb.mjs} +1 -1
  24. package/dist/packem_shared/discoverHyperdriveCalls-DlyCZKX3.mjs +1 -0
  25. package/dist/packem_shared/{discoverInserts-DldQpEfF.mjs → discoverInserts-7Xdawmuk.mjs} +1 -1
  26. package/dist/packem_shared/discoverMaskProcedures-D6kAKDZG.mjs +1 -0
  27. package/dist/packem_shared/{discoverMigrations-E9k4Ykku.mjs → discoverMigrations-C649uAWL.mjs} +1 -1
  28. package/dist/packem_shared/{discoverNondeterministicCalls-DZ_kIie5.mjs → discoverNondeterministicCalls-DQgVTcLv.mjs} +1 -1
  29. package/dist/packem_shared/{discoverQueries-Bq2hqYHP.mjs → discoverQueries-C75OdGHl.mjs} +1 -1
  30. package/dist/packem_shared/discoverR2sqlCalls-BrDIti5c.mjs +1 -0
  31. package/dist/packem_shared/{discoverRlsMetadata-Dq6iSXnC.mjs → discoverRlsMetadata-DqZpiGts.mjs} +1 -1
  32. package/dist/packem_shared/discoverRlsProcedures-BiyDg2ej.mjs +1 -0
  33. package/dist/packem_shared/discoverSchema-Bs5JUiOE.mjs +1 -0
  34. package/dist/packem_shared/{discoverStorageRulesMetadata-CJ7h6SPK.mjs → discoverStorageRulesMetadata-H3RJzkH_.mjs} +1 -1
  35. package/dist/packem_shared/{emitAgents-BeM6PZv4.mjs → emitAgents-iTKWSKan.mjs} +1 -1
  36. package/dist/packem_shared/{emitApi-GFmStqmq.mjs → emitApi-DWJW8Vu9.mjs} +1 -1
  37. package/dist/packem_shared/{emitApp-D-6FIpYb.mjs → emitApp-L7PnfjJK.mjs} +1 -1
  38. package/dist/packem_shared/{emitCrons-Drdn8Mjn.mjs → emitCrons-BvqxeNRr.mjs} +1 -1
  39. package/dist/packem_shared/{emitDataModel-LTnwnhV6.mjs → emitDataModel-MjAOi3KM.mjs} +1 -1
  40. package/dist/packem_shared/{emitDrizzleSchema-CM9jh_F0.mjs → emitDrizzleSchema-Dszoyymv.mjs} +1 -1
  41. package/dist/packem_shared/{emitFunctions-CfSXBV_A.mjs → emitFunctions-CvMrX_cX.mjs} +100 -93
  42. package/dist/packem_shared/{emitServer-4l7MPmK0.mjs → emitServer-BgI9yXW1.mjs} +1 -1
  43. package/dist/packem_shared/emitShard-D4sAFu7Z.mjs +1 -0
  44. package/dist/packem_shared/{exported-procedure-chains-BaCIhnJ7.mjs → exported-procedure-chains-CRM-MVfP.mjs} +1 -1
  45. package/dist/packem_shared/handler-reference-90LXJART.mjs +1 -0
  46. package/dist/packem_shared/{index-11LAY5JO.mjs → index-CNI4vSyc.mjs} +1 -1
  47. package/dist/packem_shared/index-o449rQLQ.mjs +1 -0
  48. package/dist/packem_shared/ip-reads-Dotjify6.mjs +1 -0
  49. package/dist/packem_shared/{qualifiers-D1Q_3wo2.mjs → qualifiers-ClaCHu0X.mjs} +1 -1
  50. package/dist/packem_shared/{server-D69SOfX8.mjs → server-qWq5nN-R.mjs} +1 -1
  51. package/dist/packem_shared/{shard-CB0Ospyw.mjs → shard-BqfSKnmG.mjs} +94 -91
  52. package/dist/packem_shared/{shard-runtime-lkQU8trx.mjs → shard-runtime-C1P_uVye.mjs} +1 -1
  53. package/dist/packem_shared/{shared-A1XHcT4t.mjs → shared-DhqnD5R3.mjs} +6 -6
  54. package/dist/packem_shared/static-literal-BwDHHjEJ.mjs +1 -0
  55. package/dist/packem_shared/{unwrap-handler-return-eQRIZSOX.mjs → unwrap-handler-return-c2s2-nk9.mjs} +1 -1
  56. package/package.json +8 -8
  57. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-kN0pgKNu.mjs +0 -31
  58. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-BdxZuSxk.mjs +0 -2
  59. package/dist/packem_shared/SHAPES_FILENAME-KyidzoqS.mjs +0 -1
  60. package/dist/packem_shared/discoverFunctions-CoQM_L6f.mjs +0 -1
  61. package/dist/packem_shared/discoverHyperdriveCalls-PUg-BESh.mjs +0 -1
  62. package/dist/packem_shared/discoverMaskProcedures-_Ey4eJLn.mjs +0 -1
  63. package/dist/packem_shared/discoverR2sqlCalls-CeNnalpk.mjs +0 -1
  64. package/dist/packem_shared/discoverRlsProcedures-MboagP9z.mjs +0 -1
  65. package/dist/packem_shared/discoverSchema-Cycd1-H0.mjs +0 -1
  66. package/dist/packem_shared/emitShard-B4fVJcJA.mjs +0 -1
  67. package/dist/packem_shared/handler-reference-D1wpw_qR.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -163,6 +163,13 @@ interface TableSnapshot {
163
163
  * Always written by a current snapshot; see {@link recordsTableModifiers}.
164
164
  */
165
165
  memory?: boolean;
166
+ /**
167
+ * `true` on a table a package extension contributes, from a format that
168
+ * records its columns' refinements. Codegen once read such a table from the
169
+ * package at runtime and dropped every `.min()`/`.max()`, so a baseline without
170
+ * this marker never recorded them — see {@link recordsPackageRefinements}.
171
+ */
172
+ refinementsRecorded?: true;
166
173
  /** Relation accessor name → {@link RelationSnapshot}. */
167
174
  relations: Record<string, RelationSnapshot>;
168
175
  /**
@@ -1613,6 +1620,20 @@ interface FunctionIR {
1613
1620
  * functions.
1614
1621
  */
1615
1622
  lifecycle?: "connect" | "disconnect" | "init" | "reactor" | "socket" | "whisper";
1623
+ /**
1624
+ * The chain's merged `.meta(...)`, read only for the lazy registry: its stub
1625
+ * stands in for the function until the module loads, so it carries the
1626
+ * declaration `procedureMeta(fn)` reads. `"unloaded"` when the declaration is
1627
+ * not a literal codegen can copy. Absent on eager builds — the registry holds
1628
+ * the real function there.
1629
+ */
1630
+ meta?: Record<string, unknown> | "unloaded";
1631
+ /**
1632
+ * Serialized TS source for the handler's return type, with `Promise<T>`
1633
+ * unwrapped so callers see `T` directly. Defaults to `"unknown"` when
1634
+ * ts-morph cannot resolve the type (typically because the consuming
1635
+ * project lacks a tsconfig that can reach `@lunora/server`).
1636
+ */
1616
1637
  /**
1617
1638
  * The `.output(validator)` declaration, when the chain has one.
1618
1639
  *
@@ -1623,11 +1644,10 @@ interface FunctionIR {
1623
1644
  */
1624
1645
  output?: ValidatorIR;
1625
1646
  /**
1626
- * Serialized TS source for the handler's return type, with `Promise<T>`
1627
- * unwrapped so callers see `T` directly. Defaults to `"unknown"` when
1628
- * ts-morph cannot resolve the type (typically because the consuming
1629
- * project lacks a tsconfig that can reach `@lunora/server`).
1647
+ * Set on a query that may read `ctx.ip`, decided statically and failing closed: the shard never resumes it
1648
+ * warm, whatever fingerprint a client presents, because its rows can depend on the address the cursor was read at.
1630
1649
  */
1650
+ readsIp?: true;
1631
1651
  returnType: string;
1632
1652
  /**
1633
1653
  * A `defineWebSocket` route: the literal URL `path` it serves and whether it requires a session (`auth`). Read at
@@ -1639,6 +1659,17 @@ interface FunctionIR {
1639
1659
  origin?: string;
1640
1660
  path: string;
1641
1661
  };
1662
+ /**
1663
+ * Set when `args` was read off a declaration-file type (a function re-exported
1664
+ * from a published component) rather than from `.input(...)`. The types are
1665
+ * exact, but bounds and refinements (`.max()`, `.check()`) are not in a type,
1666
+ * so no AOT validator may be compiled from them: the runtime parses through
1667
+ * the function's own `args`. Nor does the type say whether the function is
1668
+ * paid, what its `.meta()` is, or which args are `v.sensitive`, so its module
1669
+ * is loaded eagerly under lazy functions and its client reference is marked
1670
+ * sensitive.
1671
+ */
1672
+ typeDerivedArgs?: true;
1642
1673
  /**
1643
1674
  * Call surface the function is exposed on. Absent (or `"public"`) means it
1644
1675
  * lands in the generated `api`; `"internal"` routes it to the separate
@@ -1673,6 +1704,11 @@ interface ShapeIR {
1673
1704
  exportName: string;
1674
1705
  /** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
1675
1706
  filePath: string;
1707
+ /**
1708
+ * The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
1709
+ * so the shard never resumes it warm.
1710
+ */
1711
+ readsIp?: true;
1676
1712
  /**
1677
1713
  * The `table` string literal from the `defineShape({ table })` call, lifted
1678
1714
  * only for static advisor lints (the runtime object stays authoritative).
@@ -4316,6 +4352,8 @@ interface EmitShardOptions {
4316
4352
  }>;
4317
4353
  /** The project declares `lunora/flags.ts` — wires `ctx.flags` (OpenFeature) onto every ctx. */
4318
4354
  hasFlags?: boolean;
4355
+ /** Whether some query may read `ctx.ip` (see `LUNORA_IP_READER_PATHS`), so the shard seeds its address-keyed set from it. */
4356
+ hasIpReaders?: boolean;
4319
4357
  /** The project declares `lunora/notify.ts` — wires `ctx.notify` + its `ctx.push` alias (`@lunora/notify`) onto every ctx. */
4320
4358
  hasNotify?: boolean;
4321
4359
  /** The project declares at least one `defineRoom` — wires the `LUNORA_ROOMS` topic→path resolution in the `roomHandlerPath` override. */
@@ -4381,7 +4419,7 @@ interface EmitShardOptions {
4381
4419
  workflowEvents?: ReadonlyArray<WorkflowEventIR>;
4382
4420
  workflows?: ReadonlyArray<WorkflowIR>;
4383
4421
  }
4384
- declare const emitShard: ({ advisories, advisorProcedures, agents, capabilities, containers, env, flagKeys, hasFlags, hasNotify, hasRooms, hasSecretValues, hasSensitiveArgs, hasSockets, lazyFunctions, hasVectors, liveStreamDeclarations, liveStreams, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflowEvents, workflows }: EmitShardOptions) => string;
4422
+ declare const emitShard: ({ advisories, advisorProcedures, agents, capabilities, containers, env, flagKeys, hasFlags, hasNotify, hasRooms, hasSecretValues, hasSensitiveArgs, hasSockets, lazyFunctions, hasVectors, liveStreamDeclarations, liveStreams, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, hasIpReaders, services, topics, useUmbrella, workflowEvents, workflows }: EmitShardOptions) => string;
4385
4423
  /**
4386
4424
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
4387
4425
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
package/dist/index.d.ts CHANGED
@@ -163,6 +163,13 @@ interface TableSnapshot {
163
163
  * Always written by a current snapshot; see {@link recordsTableModifiers}.
164
164
  */
165
165
  memory?: boolean;
166
+ /**
167
+ * `true` on a table a package extension contributes, from a format that
168
+ * records its columns' refinements. Codegen once read such a table from the
169
+ * package at runtime and dropped every `.min()`/`.max()`, so a baseline without
170
+ * this marker never recorded them — see {@link recordsPackageRefinements}.
171
+ */
172
+ refinementsRecorded?: true;
166
173
  /** Relation accessor name → {@link RelationSnapshot}. */
167
174
  relations: Record<string, RelationSnapshot>;
168
175
  /**
@@ -1613,6 +1620,20 @@ interface FunctionIR {
1613
1620
  * functions.
1614
1621
  */
1615
1622
  lifecycle?: "connect" | "disconnect" | "init" | "reactor" | "socket" | "whisper";
1623
+ /**
1624
+ * The chain's merged `.meta(...)`, read only for the lazy registry: its stub
1625
+ * stands in for the function until the module loads, so it carries the
1626
+ * declaration `procedureMeta(fn)` reads. `"unloaded"` when the declaration is
1627
+ * not a literal codegen can copy. Absent on eager builds — the registry holds
1628
+ * the real function there.
1629
+ */
1630
+ meta?: Record<string, unknown> | "unloaded";
1631
+ /**
1632
+ * Serialized TS source for the handler's return type, with `Promise<T>`
1633
+ * unwrapped so callers see `T` directly. Defaults to `"unknown"` when
1634
+ * ts-morph cannot resolve the type (typically because the consuming
1635
+ * project lacks a tsconfig that can reach `@lunora/server`).
1636
+ */
1616
1637
  /**
1617
1638
  * The `.output(validator)` declaration, when the chain has one.
1618
1639
  *
@@ -1623,11 +1644,10 @@ interface FunctionIR {
1623
1644
  */
1624
1645
  output?: ValidatorIR;
1625
1646
  /**
1626
- * Serialized TS source for the handler's return type, with `Promise<T>`
1627
- * unwrapped so callers see `T` directly. Defaults to `"unknown"` when
1628
- * ts-morph cannot resolve the type (typically because the consuming
1629
- * project lacks a tsconfig that can reach `@lunora/server`).
1647
+ * Set on a query that may read `ctx.ip`, decided statically and failing closed: the shard never resumes it
1648
+ * warm, whatever fingerprint a client presents, because its rows can depend on the address the cursor was read at.
1630
1649
  */
1650
+ readsIp?: true;
1631
1651
  returnType: string;
1632
1652
  /**
1633
1653
  * A `defineWebSocket` route: the literal URL `path` it serves and whether it requires a session (`auth`). Read at
@@ -1639,6 +1659,17 @@ interface FunctionIR {
1639
1659
  origin?: string;
1640
1660
  path: string;
1641
1661
  };
1662
+ /**
1663
+ * Set when `args` was read off a declaration-file type (a function re-exported
1664
+ * from a published component) rather than from `.input(...)`. The types are
1665
+ * exact, but bounds and refinements (`.max()`, `.check()`) are not in a type,
1666
+ * so no AOT validator may be compiled from them: the runtime parses through
1667
+ * the function's own `args`. Nor does the type say whether the function is
1668
+ * paid, what its `.meta()` is, or which args are `v.sensitive`, so its module
1669
+ * is loaded eagerly under lazy functions and its client reference is marked
1670
+ * sensitive.
1671
+ */
1672
+ typeDerivedArgs?: true;
1642
1673
  /**
1643
1674
  * Call surface the function is exposed on. Absent (or `"public"`) means it
1644
1675
  * lands in the generated `api`; `"internal"` routes it to the separate
@@ -1673,6 +1704,11 @@ interface ShapeIR {
1673
1704
  exportName: string;
1674
1705
  /** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
1675
1706
  filePath: string;
1707
+ /**
1708
+ * The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
1709
+ * so the shard never resumes it warm.
1710
+ */
1711
+ readsIp?: true;
1676
1712
  /**
1677
1713
  * The `table` string literal from the `defineShape({ table })` call, lifted
1678
1714
  * only for static advisor lints (the runtime object stays authoritative).
@@ -4316,6 +4352,8 @@ interface EmitShardOptions {
4316
4352
  }>;
4317
4353
  /** The project declares `lunora/flags.ts` — wires `ctx.flags` (OpenFeature) onto every ctx. */
4318
4354
  hasFlags?: boolean;
4355
+ /** Whether some query may read `ctx.ip` (see `LUNORA_IP_READER_PATHS`), so the shard seeds its address-keyed set from it. */
4356
+ hasIpReaders?: boolean;
4319
4357
  /** The project declares `lunora/notify.ts` — wires `ctx.notify` + its `ctx.push` alias (`@lunora/notify`) onto every ctx. */
4320
4358
  hasNotify?: boolean;
4321
4359
  /** The project declares at least one `defineRoom` — wires the `LUNORA_ROOMS` topic→path resolution in the `roomHandlerPath` override. */
@@ -4381,7 +4419,7 @@ interface EmitShardOptions {
4381
4419
  workflowEvents?: ReadonlyArray<WorkflowEventIR>;
4382
4420
  workflows?: ReadonlyArray<WorkflowIR>;
4383
4421
  }
4384
- declare const emitShard: ({ advisories, advisorProcedures, agents, capabilities, containers, env, flagKeys, hasFlags, hasNotify, hasRooms, hasSecretValues, hasSensitiveArgs, hasSockets, lazyFunctions, hasVectors, liveStreamDeclarations, liveStreams, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflowEvents, workflows }: EmitShardOptions) => string;
4422
+ declare const emitShard: ({ advisories, advisorProcedures, agents, capabilities, containers, env, flagKeys, hasFlags, hasNotify, hasRooms, hasSecretValues, hasSensitiveArgs, hasSockets, lazyFunctions, hasVectors, liveStreamDeclarations, liveStreams, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, hasIpReaders, services, topics, useUmbrella, workflowEvents, workflows }: EmitShardOptions) => string;
4385
4423
  /**
4386
4424
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
4387
4425
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as i}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-BdxZuSxk.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DKYJ2K4t.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-BedyJsOT.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-JdN4KXhV.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-Ce3BdKQr.mjs";import{CONTAINERS_FILENAME as F,discoverContainers as L}from"./packem_shared/CONTAINERS_FILENAME-T1v8pyHN.mjs";import{default as P}from"./packem_shared/discoverCrons-D-vJXsgx.mjs";import{capabilitiesUsedBy as b,createTargetScope as y,foldCapabilitySignals as U,mayReadCapabilityContext as G,sourceCapabilitySignals as H}from"./packem_shared/capabilitiesUsedBy-CN8HACEL.mjs";import{FLAGS_FILENAME as B,discoverFlags as k}from"./packem_shared/FLAGS_FILENAME-BEMyglH0.mjs";import{default as K}from"./packem_shared/discoverFunctions-CoQM_L6f.mjs";import{default as z}from"./packem_shared/discoverHttpRoutes-BQM2CPSF.mjs";import{default as q}from"./packem_shared/discoverHyperdriveCalls-PUg-BESh.mjs";import{default as J}from"./packem_shared/discoverInserts-DldQpEfF.mjs";import{d as X}from"./packem_shared/index-11LAY5JO.mjs";import{default as $}from"./packem_shared/discoverMigrations-E9k4Ykku.mjs";import{MUTATORS_FILENAME as re,discoverMutators as oe}from"./packem_shared/MUTATORS_FILENAME-BGvYo46g.mjs";import{default as ae}from"./packem_shared/discoverNondeterministicCalls-DZ_kIie5.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as fe,discoverNotifyChannels as me,discoverNotifyConfig as de}from"./packem_shared/NOTIFY_FILENAME-BJJObZHG.mjs";import{default as ne}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-Bq2hqYHP.mjs";import{QUEUES_FILENAME as Se,discoverQueues as Ee}from"./packem_shared/QUEUES_FILENAME-Dt5RG_P0.mjs";import{default as Ae}from"./packem_shared/discoverR2sqlCalls-CeNnalpk.mjs";import{default as ge}from"./packem_shared/discoverRlsProcedures-MboagP9z.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-Dq6iSXnC.mjs";import{discoverSandboxUsage as Re}from"./packem_shared/discoverSandboxUsage-CdGRnVU2.mjs";import{default as he}from"./packem_shared/discoverSchema-Cycd1-H0.mjs";import{readServiceBindings as _e,resolveServiceBindings as Fe}from"./packem_shared/readServiceBindings-BA49C6aN.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Pe}from"./packem_shared/SHAPES_FILENAME-KyidzoqS.mjs";import{default as be}from"./packem_shared/discoverStorageRulesMetadata-CJ7h6SPK.mjs";import{WORKFLOWS_FILENAME as Ue,discoverWorkflows as Ge}from"./packem_shared/WORKFLOWS_FILENAME-VAXgqqP-.mjs";import{emitApp as je}from"./packem_shared/emitApp-D-6FIpYb.mjs";import{isD1GlobalTable as ke,isHyperdriveGlobalTable as We}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ve,emitOpenApi as ze,emitOpenApiModule as Qe}from"./packem_shared/buildOpenApiDocument-afHH7rN5.mjs";import{OPENRPC_VERSION as we,buildOpenRpcDocument as Je,emitOpenRpc as Ye,emitOpenRpcModule as Xe}from"./packem_shared/OPENRPC_VERSION-CSjT8wJW.mjs";import{DEFAULT_TARGET as $e,platformMatrixIds as er,readProjectTarget as rr,resolveCodegenTarget as or}from"./packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs";import{loadProjectConfig as ar,readProjectConfigLiterals as ir}from"./packem_shared/loadProjectConfig-B7RmxIeD.mjs";import{PROJECT_CONFIG_FILENAMES as fr,findCodegenConfigFile as mr,findProjectConfigFile as dr,projectConfigCandidatePaths as pr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as cr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-kN0pgKNu.mjs";import{SchemaSnapshotParseError as Sr,buildSchemaSnapshot as Er,evaluateSchemaDrift as ur,indexReferencesOf as Ar,parseSchemaSnapshot as vr}from"./packem_shared/SchemaSnapshotParseError-ycDz8gOB.mjs";import{default as Cr}from"./packem_shared/fingerprintSchemaSources-DIYx5eO0.mjs";import{schemaFromIr as Or}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Tr,validatorIrToJsonSchema as hr}from"./packem_shared/LUNORA_ERROR_CODES-CjACC-MQ.mjs";import{SDK_LANGUAGES as _r,SDK_TARGETS as Fr,generateSdk as Lr}from"./sdk/index.mjs";import{redact as Pr,secretKindOf as Dr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as yr}from"./packem_shared/emitDrizzleSchema-CM9jh_F0.mjs";import{e as Gr}from"./packem_shared/server-D69SOfX8.mjs";import{e as jr}from"./packem_shared/shard-CB0Ospyw.mjs";import{G as kr}from"./packem_shared/shared-A1XHcT4t.mjs";import{MESSAGE_SOLUTIONS as Kr,findSolutionByMessage as Vr}from"@lunora/errors";import{createCodegenProject as Qr,findTsconfig as qr,refreshCodegenProject as wr,tsconfigFingerprint as Jr}from"./packem_shared/createCodegenProject-DmXl8m_P.mjs";import{t as Xr,u as Zr,v as $r}from"./packem_shared/shard-runtime-lkQU8trx.mjs";import{emitApi as ro,emitCollections as oo,emitInternalApi as to}from"./packem_shared/emitApi-GFmStqmq.mjs";import{emitCrons as io,emitScheduler as so,emitVectors as fo,emitWranglerCronTriggers as mo}from"./packem_shared/emitCrons-Drdn8Mjn.mjs";import{emitDataModel as no}from"./packem_shared/emitDataModel-LTnwnhV6.mjs";import{emitFunctions as lo}from"./packem_shared/emitFunctions-CfSXBV_A.mjs";import{isTypedSchema as So}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,F as CONTAINERS_FILENAME,A as CodegenDiagnosticError,$e as DEFAULT_TARGET,B as FLAGS_FILENAME,kr as GENERATED_HEADER,Tr as LUNORA_ERROR_CODES,Kr as LUNORA_SOLUTION_RULES,re as MUTATORS_FILENAME,se as NOTIFY_FILENAME,we as OPENRPC_VERSION,fr as PROJECT_CONFIG_FILENAMES,Se as QUEUES_FILENAME,cr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,_r as SDK_LANGUAGES,Fr as SDK_TARGETS,Me as SHAPES_FILENAME,Sr as SchemaSnapshotParseError,e as VERSION,Ue as WORKFLOWS_FILENAME,Ve as buildOpenApiDocument,Je as buildOpenRpcDocument,Er as buildSchemaSnapshot,b as capabilitiesUsedBy,Qr as createCodegenProject,y as createTargetScope,n as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,I as discoverAuthApiCalls,L as discoverContainers,P as discoverCrons,k as discoverFlags,K as discoverFunctions,z as discoverHttpRoutes,q as discoverHyperdriveCalls,J as discoverInserts,X as discoverMaskProcedures,$ as discoverMigrations,oe as discoverMutators,ae as discoverNondeterministicCalls,fe as discoverNotifyCalls,me as discoverNotifyChannels,de as discoverNotifyConfig,le as discoverQueries,Ee as discoverQueues,Ae as discoverR2sqlCalls,Ne as discoverRlsMetadata,ge as discoverRlsProcedures,Re as discoverSandboxUsage,he as discoverSchema,Pe as discoverShapes,be as discoverStorageRulesMetadata,Ge as discoverWorkflows,Xr as emitAgents,ro as emitApi,je as emitApp,oo as emitCollections,Zr as emitContainers,io as emitCrons,no as emitDataModel,yr as emitDrizzleSchema,lo as emitFunctions,to as emitInternalApi,ze as emitOpenApi,Qe as emitOpenApiModule,Ye as emitOpenRpc,Xe as emitOpenRpcModule,so as emitScheduler,Gr as emitServer,jr as emitShard,fo as emitVectors,$r as emitWorkflows,mo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,ur as evaluateSchemaDrift,mr as findCodegenConfigFile,Vr as findLunoraSolution,dr as findProjectConfigFile,qr as findTsconfig,Cr as fingerprintSchemaSources,U as foldCapabilitySignals,f as formatAdvisories,Lr as generateSdk,Ar as indexReferencesOf,ke as isD1GlobalTable,We as isHyperdriveGlobalTable,R as isTestPath,So as isTypedSchema,m as lintSchema,T as listLunoraSourceFiles,ar as loadProjectConfig,G as mayReadCapabilityContext,vr as parseSchemaSnapshot,er as platformMatrixIds,pr as projectConfigCandidatePaths,ne as readPackageDependencies,ir as readProjectConfigLiterals,rr as readProjectTarget,_e as readServiceBindings,Pr as redact,wr as refreshCodegenProject,or as resolveCodegenTarget,Fe as resolveServiceBindings,lr as runCodegen,Or as schemaFromIr,Dr as secretKindOf,i as serializeSchemaSnapshot,x as sortedUniqueNames,H as sourceCapabilitySignals,d as toAdvisorContext,Jr as tsconfigFingerprint,hr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DKYJ2K4t.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-5mDMAMWy.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-JdN4KXhV.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-DZMYREsq.mjs";import{CONTAINERS_FILENAME as F,discoverContainers as L}from"./packem_shared/CONTAINERS_FILENAME-BJYrxnq2.mjs";import{default as P}from"./packem_shared/discoverCrons-D-vJXsgx.mjs";import{capabilitiesUsedBy as b,createTargetScope as y,foldCapabilitySignals as U,mayReadCapabilityContext as G,sourceCapabilitySignals as H}from"./packem_shared/capabilitiesUsedBy-CN8HACEL.mjs";import{FLAGS_FILENAME as B,discoverFlags as k}from"./packem_shared/FLAGS_FILENAME-BEMyglH0.mjs";import{d as K}from"./packem_shared/index-o449rQLQ.mjs";import{default as z}from"./packem_shared/discoverHttpRoutes-D9Q0lBBb.mjs";import{default as q}from"./packem_shared/discoverHyperdriveCalls-DlyCZKX3.mjs";import{default as J}from"./packem_shared/discoverInserts-7Xdawmuk.mjs";import{d as X}from"./packem_shared/index-CNI4vSyc.mjs";import{default as $}from"./packem_shared/discoverMigrations-C649uAWL.mjs";import{MUTATORS_FILENAME as re,discoverMutators as oe}from"./packem_shared/MUTATORS_FILENAME-D9WbOFm7.mjs";import{default as ie}from"./packem_shared/discoverNondeterministicCalls-DQgVTcLv.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as fe,discoverNotifyChannels as me,discoverNotifyConfig as de}from"./packem_shared/NOTIFY_FILENAME-CRU_TEKs.mjs";import{default as ne}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-C75OdGHl.mjs";import{QUEUES_FILENAME as Se,discoverQueues as Ee}from"./packem_shared/QUEUES_FILENAME-BeGwgqcw.mjs";import{default as Ae}from"./packem_shared/discoverR2sqlCalls-BrDIti5c.mjs";import{default as ge}from"./packem_shared/discoverRlsProcedures-BiyDg2ej.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-DqZpiGts.mjs";import{discoverSandboxUsage as Re}from"./packem_shared/discoverSandboxUsage-CdGRnVU2.mjs";import{default as he}from"./packem_shared/discoverSchema-Bs5JUiOE.mjs";import{readServiceBindings as _e,resolveServiceBindings as Fe}from"./packem_shared/readServiceBindings-BA49C6aN.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Pe}from"./packem_shared/SHAPES_FILENAME-D9beIrs1.mjs";import{default as be}from"./packem_shared/discoverStorageRulesMetadata-H3RJzkH_.mjs";import{WORKFLOWS_FILENAME as Ue,discoverWorkflows as Ge}from"./packem_shared/WORKFLOWS_FILENAME--RWiu_Vy.mjs";import{emitApp as je}from"./packem_shared/emitApp-L7PnfjJK.mjs";import{isD1GlobalTable as ke,isHyperdriveGlobalTable as We}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ve,emitOpenApi as ze,emitOpenApiModule as Qe}from"./packem_shared/buildOpenApiDocument-67-fasdW.mjs";import{OPENRPC_VERSION as we,buildOpenRpcDocument as Je,emitOpenRpc as Ye,emitOpenRpcModule as Xe}from"./packem_shared/OPENRPC_VERSION-CT_E2DcI.mjs";import{DEFAULT_TARGET as $e,platformMatrixIds as er,readProjectTarget as rr,resolveCodegenTarget as or}from"./packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs";import{loadProjectConfig as ir,readProjectConfigLiterals as ar}from"./packem_shared/loadProjectConfig-B7RmxIeD.mjs";import{PROJECT_CONFIG_FILENAMES as fr,findCodegenConfigFile as mr,findProjectConfigFile as dr,projectConfigCandidatePaths as pr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as cr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DXilYf6b.mjs";import{SchemaSnapshotParseError as Sr,buildSchemaSnapshot as Er,evaluateSchemaDrift as ur,indexReferencesOf as Ar,parseSchemaSnapshot as vr}from"./packem_shared/SchemaSnapshotParseError-DnAuFdpl.mjs";import{default as Cr}from"./packem_shared/fingerprintSchemaSources-DIYx5eO0.mjs";import{schemaFromIr as Or}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Tr,validatorIrToJsonSchema as hr}from"./packem_shared/LUNORA_ERROR_CODES-CjACC-MQ.mjs";import{SDK_LANGUAGES as _r,SDK_TARGETS as Fr,generateSdk as Lr}from"./sdk/index.mjs";import{redact as Pr,secretKindOf as Dr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as yr}from"./packem_shared/emitDrizzleSchema-Dszoyymv.mjs";import{e as Gr}from"./packem_shared/server-qWq5nN-R.mjs";import{e as jr}from"./packem_shared/shard-BqfSKnmG.mjs";import{G as kr}from"./packem_shared/shared-DhqnD5R3.mjs";import{MESSAGE_SOLUTIONS as Kr,findSolutionByMessage as Vr}from"@lunora/errors";import{createCodegenProject as Qr,findTsconfig as qr,refreshCodegenProject as wr,tsconfigFingerprint as Jr}from"./packem_shared/createCodegenProject-DmXl8m_P.mjs";import{t as Xr,u as Zr,v as $r}from"./packem_shared/shard-runtime-C1P_uVye.mjs";import{emitApi as ro,emitCollections as oo,emitInternalApi as to}from"./packem_shared/emitApi-DWJW8Vu9.mjs";import{emitCrons as ao,emitScheduler as so,emitVectors as fo,emitWranglerCronTriggers as mo}from"./packem_shared/emitCrons-BvqxeNRr.mjs";import{emitDataModel as no}from"./packem_shared/emitDataModel-MjAOi3KM.mjs";import{emitFunctions as lo}from"./packem_shared/emitFunctions-CvMrX_cX.mjs";import{isTypedSchema as So}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,F as CONTAINERS_FILENAME,A as CodegenDiagnosticError,$e as DEFAULT_TARGET,B as FLAGS_FILENAME,kr as GENERATED_HEADER,Tr as LUNORA_ERROR_CODES,Kr as LUNORA_SOLUTION_RULES,re as MUTATORS_FILENAME,se as NOTIFY_FILENAME,we as OPENRPC_VERSION,fr as PROJECT_CONFIG_FILENAMES,Se as QUEUES_FILENAME,cr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,_r as SDK_LANGUAGES,Fr as SDK_TARGETS,Me as SHAPES_FILENAME,Sr as SchemaSnapshotParseError,e as VERSION,Ue as WORKFLOWS_FILENAME,Ve as buildOpenApiDocument,Je as buildOpenRpcDocument,Er as buildSchemaSnapshot,b as capabilitiesUsedBy,Qr as createCodegenProject,y as createTargetScope,n as describeErrorLevelFindings,v as diagnosticAt,i as diffSchemaSnapshots,N as discoverAgents,I as discoverAuthApiCalls,L as discoverContainers,P as discoverCrons,k as discoverFlags,K as discoverFunctions,z as discoverHttpRoutes,q as discoverHyperdriveCalls,J as discoverInserts,X as discoverMaskProcedures,$ as discoverMigrations,oe as discoverMutators,ie as discoverNondeterministicCalls,fe as discoverNotifyCalls,me as discoverNotifyChannels,de as discoverNotifyConfig,le as discoverQueries,Ee as discoverQueues,Ae as discoverR2sqlCalls,Ne as discoverRlsMetadata,ge as discoverRlsProcedures,Re as discoverSandboxUsage,he as discoverSchema,Pe as discoverShapes,be as discoverStorageRulesMetadata,Ge as discoverWorkflows,Xr as emitAgents,ro as emitApi,je as emitApp,oo as emitCollections,Zr as emitContainers,ao as emitCrons,no as emitDataModel,yr as emitDrizzleSchema,lo as emitFunctions,to as emitInternalApi,ze as emitOpenApi,Qe as emitOpenApiModule,Ye as emitOpenRpc,Xe as emitOpenRpcModule,so as emitScheduler,Gr as emitServer,jr as emitShard,fo as emitVectors,$r as emitWorkflows,mo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,ur as evaluateSchemaDrift,mr as findCodegenConfigFile,Vr as findLunoraSolution,dr as findProjectConfigFile,qr as findTsconfig,Cr as fingerprintSchemaSources,U as foldCapabilitySignals,f as formatAdvisories,Lr as generateSdk,Ar as indexReferencesOf,ke as isD1GlobalTable,We as isHyperdriveGlobalTable,R as isTestPath,So as isTypedSchema,m as lintSchema,T as listLunoraSourceFiles,ir as loadProjectConfig,G as mayReadCapabilityContext,vr as parseSchemaSnapshot,er as platformMatrixIds,pr as projectConfigCandidatePaths,ne as readPackageDependencies,ar as readProjectConfigLiterals,rr as readProjectTarget,_e as readServiceBindings,Pr as redact,wr as refreshCodegenProject,or as resolveCodegenTarget,Fe as resolveServiceBindings,lr as runCodegen,Or as schemaFromIr,Dr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,H as sourceCapabilitySignals,d as toAdvisorContext,Jr as tsconfigFingerprint,hr 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 w}from"./isTestPath-JdN4KXhV.mjs";import{a as h}from"./attribution-DUbGYT4N.mjs";const E="agents.ts",v=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:e.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),x=(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)},i=c(e,"name");i&&a.isPropertyAssignment(i)&&(t.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(e,"publicRun");r&&a.isPropertyAssignment(r)&&x(r.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},S=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const i=t.getExpression();if(!a.isIdentifier(i)||!v(i))continue;const r=e.getNameNode();if(!a.isIdentifier(r)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(r,"defineAgent exports must be plain named exports (no destructuring)")}const s=h(e,"binding");s!==void 0&&n.push(I(t,s))}return n},T=o=>{const n=new Map,e=new Map;for(const t of o){const i=n.get(t.name);if(i!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${i}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const r=e.get(t.className);if(r!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${r}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},z=(o,n)=>{const e=f(n,E);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),i=S(t);return i.sort((r,s)=>r.exportName.localeCompare(s.exportName)),T(i),i};export{E as AGENTS_FILENAME,z as discoverAgents};
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 w}from"./isTestPath-JdN4KXhV.mjs";import{a as h}from"./attribution-CTMkuBkn.mjs";const E="agents.ts",v=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:e.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),x=(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)},i=c(e,"name");i&&a.isPropertyAssignment(i)&&(t.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(e,"publicRun");r&&a.isPropertyAssignment(r)&&x(r.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},S=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const i=t.getExpression();if(!a.isIdentifier(i)||!v(i))continue;const r=e.getNameNode();if(!a.isIdentifier(r)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(r,"defineAgent exports must be plain named exports (no destructuring)")}const s=h(e,"binding");s!==void 0&&n.push(I(t,s))}return n},T=o=>{const n=new Map,e=new Map;for(const t of o){const i=n.get(t.name);if(i!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${i}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const r=e.get(t.className);if(r!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${r}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},z=(o,n)=>{const e=f(n,E);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),i=S(t);return i.sort((r,s)=>r.exportName.localeCompare(s.exportName)),T(i),i};export{E as AGENTS_FILENAME,z as discoverAgents};
@@ -1 +1 @@
1
- import{existsSync as j}from"node:fs";import{join as I}from"node:path";import{containerClassName as A,containerBindingName as O,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as k,isManagedImage as C,isCloudflareRegistryDigest as _,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as D,findObjectProperty as p,symbolConstInitializer as M,descendantsOfKind as F,outermostValueWrapper as w,isWriteTarget as V}from"./isTestPath-JdN4KXhV.mjs";import{a as K}from"./attribution-DUbGYT4N.mjs";import{a as b}from"./property-name-7cBlgK_O.mjs";const B="containers.ts",R=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=D("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`)},E=(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`)},U=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),N=new Set(["gracePeriodSeconds","stepPercentage"]),L=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},Y=(t,e)=>F(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(V(i))return!0;n=w(i),i=n.getParent()}return!1}),z=16,T=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<z;c+=1){const l=M(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=L(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&Y(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},P=(t,e)=>{const r=L(t);return s.isIdentifier(r)?T(r.getSymbol(),r,r.getText(),e)??r:r},W=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},q=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(W(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.`)},x=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?T(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),P(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...H(c,e,r,o));else{const l=x(c,e,r);l!==void 0&&i.push(l)}return i},H=(t,e,r,n)=>{const i=P(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return q(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)},J=(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},X=(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,N,`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()},G=(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`)},Q=(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=E(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"&&!_(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},Z=(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},ee=(t,e,r,n)=>{if(r!==void 0&&k.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"`)},te=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=J(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=E(e,n));break}case"images":{o.images=Q(e,n);break}case"instanceType":{i.instanceType=G(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=X(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}}},ne=(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)&&!C(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(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,U,`container "${e}"`),i=Z(n,e),o={base:{bindingName:O(e),className:A(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[g,u]of n)ee(g,u,i,e),te(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return ne(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}}},re=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)||!R(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=K(n,"binding");if(g===void 0)continue;const u=ie(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},me=(t,e)=>{const r=I(e,B);if(!j(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=re(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{B as CONTAINERS_FILENAME,me as discoverContainers};
1
+ import{existsSync as j}from"node:fs";import{join as I}from"node:path";import{containerClassName as A,containerBindingName as O,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as k,isManagedImage as C,isCloudflareRegistryDigest as _,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as D,findObjectProperty as p,symbolConstInitializer as M,descendantsOfKind as F,outermostValueWrapper as w,isWriteTarget as V}from"./isTestPath-JdN4KXhV.mjs";import{a as K}from"./attribution-CTMkuBkn.mjs";import{a as b}from"./property-name-7cBlgK_O.mjs";const B="containers.ts",R=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=D("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`)},E=(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`)},U=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),N=new Set(["gracePeriodSeconds","stepPercentage"]),L=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},Y=(t,e)=>F(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(V(i))return!0;n=w(i),i=n.getParent()}return!1}),z=16,T=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<z;c+=1){const l=M(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=L(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&Y(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},P=(t,e)=>{const r=L(t);return s.isIdentifier(r)?T(r.getSymbol(),r,r.getText(),e)??r:r},W=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},q=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(W(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.`)},x=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?T(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),P(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...H(c,e,r,o));else{const l=x(c,e,r);l!==void 0&&i.push(l)}return i},H=(t,e,r,n)=>{const i=P(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return q(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)},J=(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},X=(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,N,`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()},G=(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`)},Q=(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=E(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"&&!_(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},Z=(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},ee=(t,e,r,n)=>{if(r!==void 0&&k.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"`)},te=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=J(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=E(e,n));break}case"images":{o.images=Q(e,n);break}case"instanceType":{i.instanceType=G(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=X(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}}},ne=(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)&&!C(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(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,U,`container "${e}"`),i=Z(n,e),o={base:{bindingName:O(e),className:A(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[g,u]of n)ee(g,u,i,e),te(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return ne(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}}},re=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)||!R(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=K(n,"binding");if(g===void 0)continue;const u=ie(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},me=(t,e)=>{const r=I(e,B);if(!j(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=re(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{B as CONTAINERS_FILENAME,me as discoverContainers};
@@ -1 +1 @@
1
- import{G as n,I as p,a as o,g as d,d as c,h as f,i as m,p as I,r as T,f as y,b as E,c as O,e as A,s as l,u as v,v as P}from"./shared-A1XHcT4t.mjs";import"./parse-validator-BisfC8bR.mjs";import"./reserved-words-CW1QFbTd.mjs";import"./LUNORA_ERROR_CODES-CjACC-MQ.mjs";import"./dispatch-namespace-DwTjD7BU.mjs";export{n as GENERATED_HEADER,p as IMPORT_PATH_RE,o as assertIdentifier,d as assertPropertyIdentifier,c as baseSpecifiers,f as isOptionalOnInsert,m as isSensitiveFunction,I as pascalCase,T as renderArgsType,y as renderInsertInterface,E as renderNamespaceTree,O as renderObjectKey,A as renderPropertyKey,l as sensitiveArgNamesOf,v as unwrapOptional,P as validatorToType};
1
+ import{G as n,I as p,a as o,g as d,d as c,h as f,i as m,p as I,r as T,f as y,b as E,c as O,e as A,s as l,u as v,v as P}from"./shared-DhqnD5R3.mjs";import"./parse-validator-BisfC8bR.mjs";import"./reserved-words-CW1QFbTd.mjs";import"./LUNORA_ERROR_CODES-CjACC-MQ.mjs";import"./dispatch-namespace-DwTjD7BU.mjs";export{n as GENERATED_HEADER,p as IMPORT_PATH_RE,o as assertIdentifier,d as assertPropertyIdentifier,c as baseSpecifiers,f as isOptionalOnInsert,m as isSensitiveFunction,I as pascalCase,T as renderArgsType,y as renderInsertInterface,E as renderNamespaceTree,O as renderObjectKey,A as renderPropertyKey,l as sensitiveArgNamesOf,v as unwrapOptional,P as validatorToType};
@@ -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-JdN4KXhV.mjs";import{j as b,i as D,f as g,d as O}from"./attribution-DUbGYT4N.mjs";import{u as w}from"./unwrap-handler-return-eQRIZSOX.mjs";const z="mutators.ts",x=M,h=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 h(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":w(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,z);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{z as MUTATORS_FILENAME,J as discoverMutators,N as isDefineMutatorCallee,S as mutatorLiteral,G as mutatorServerImplOf};
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-JdN4KXhV.mjs";import{g as b,i as D,d as g,h as O}from"./attribution-CTMkuBkn.mjs";import{u as h}from"./unwrap-handler-return-c2s2-nk9.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 +1 @@
1
- import{existsSync as N}from"node:fs";import{join as F}from"node:path";import{SyntaxKind as u,Node as r,VariableDeclarationKind as O}from"ts-morph";import{listLunoraSourceFiles as m,lunoraRelativePath as A,descendantsOfKind as h,findObjectProperty as g,defaultExportExpression as D,handlerOf as I}from"./isTestPath-JdN4KXhV.mjs";import{b as T,d as C}from"./attribution-DUbGYT4N.mjs";import{i as l}from"./context-root-D4Njep-A.mjs";import{c as k}from"./classify-procedure-call-DtqiTjPg.mjs";const L="notify.ts",M=new Set(["chat","inApp","send","webhook"]),x=new Set(["broadcast","send"]),w=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=k(s);if(!t)return;const i=I(s,t.receiver);return i?{exportName:C(e)??e.getName(),handler:i,kind:t.kind}:void 0},y=e=>{const s=[];for(const t of T(e)){const i=w(t);i&&s.push(i)}return s},E=e=>l(e,["notify"])?"notify":l(e,["push"])||l(e,["notify","push"])?"push":void 0,_=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=E(e.getExpression());if(t==="notify"&&M.has(s))return`ctx.notify.${s}`;if(t==="push"&&x.has(s))return`ctx.push.${s}`},R=e=>r.isPropertyAccessExpression(e)?E(e.getExpression())==="push"&&x.has(e.getName()):!1,ee=(e,s)=>{const t=[];for(const i of m(s)){const o=e.getSourceFile(i)??e.addSourceFileAtPath(i),n=A(s,i);for(const c of y(o))if(!(c.kind!=="query"&&c.kind!=="mutation"))for(const a of h(c.handler,u.PropertyAccessExpression)){const f=_(a);f!==void 0&&t.push({callee:f,exportName:c.exportName,file:n,kind:c.kind,line:a.getStartLineNumber()})}}return t},U=(e,s)=>{for(const t of m(s)){const i=e.getSourceFile(t)??e.addSourceFileAtPath(t);for(const o of y(i))for(const n of h(o.handler,u.PropertyAccessExpression))if(R(n))return!0}return!1},V=new Set(["@lunora/notify"]),j=e=>{const s=e.getSymbol();if(!s)return e.getText()==="defineNotify";for(const t of s.getDeclarations())if(r.isImportSpecifier(t))return V.has(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineNotify":!1;return!1},P=(e,s=new Set)=>{const t=D(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const o=i.getAliasedSymbol();if(!o)return t;const n=o.getDeclarations().find(a=>r.isExportAssignment(a));if(!n)return t;const c=n.getSourceFile();if(!s.has(c.getFilePath()))return P(c,s.add(c.getFilePath()))},z=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),p=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},S=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return S(e.getExpression())},d=(e,s)=>{const t=S(e);return t!==void 0&&p(t)===s},H=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),o=t.getExpression(),n=r.isIdentifier(o)?o.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&n==="Object"||i==="set"&&n==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&p(a)===s},K=(e,s)=>{if(r.isBinaryExpression(e))return z.has(e.getOperatorToken().getText())&&d(e.getLeft(),s);if(r.isDeleteExpression(e))return d(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===u.PlusPlusToken||t===u.MinusMinusToken)&&d(e.getOperand(),s)}return r.isCallExpression(e)?H(e,s):!1},W=(e,s)=>{const t=p(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(o=>K(o,t)))},Y=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 o=i.getInitializer();if(!o||!r.isObjectLiteralExpression(o))continue;const n=i.getParent();if(!r.isVariableDeclarationList(n)||n.getDeclarationKind()!==O.Const)continue;const c=[i.getSourceFile(),e.getSourceFile()].filter((a,f,b)=>b.findIndex(v=>v.getFilePath()===a.getFilePath())===f);if(!W(e,c))return o}},B=(e,s)=>{const t=F(s,L);if(!N(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),o=P(i);if(!o||!r.isCallExpression(o))return{hasFcm:!0,hasWebPush:!0};const n=o.getExpression(),c=r.isIdentifier(n)&&j(n)?o.getArguments()[0]:void 0,a=c===void 0?void 0:Y(c);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?{hasFcm:!0,hasWebPush:!0}:{hasFcm:g(a,"fcm")!==void 0,hasWebPush:g(a,"webPush")!==void 0}},te=(e,s)=>{const t=B(e,s);return t===void 0?void 0:{...t,usesPush:U(e,s)}};export{L as NOTIFY_FILENAME,ee as discoverNotifyCalls,B as discoverNotifyChannels,te as discoverNotifyConfig};
1
+ import{existsSync as N}from"node:fs";import{join as F}from"node:path";import{SyntaxKind as u,Node as r,VariableDeclarationKind as O}from"ts-morph";import{listLunoraSourceFiles as m,lunoraRelativePath as A,descendantsOfKind as h,findObjectProperty as g,defaultExportExpression as D,handlerOf as I}from"./isTestPath-JdN4KXhV.mjs";import{j as T,h as C}from"./attribution-CTMkuBkn.mjs";import{a as l}from"./context-root-DtpwprsY.mjs";import{c as k}from"./classify-procedure-call-DtqiTjPg.mjs";const L="notify.ts",M=new Set(["chat","inApp","send","webhook"]),x=new Set(["broadcast","send"]),w=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=k(s);if(!t)return;const i=I(s,t.receiver);return i?{exportName:C(e)??e.getName(),handler:i,kind:t.kind}:void 0},y=e=>{const s=[];for(const t of T(e)){const i=w(t);i&&s.push(i)}return s},E=e=>l(e,["notify"])?"notify":l(e,["push"])||l(e,["notify","push"])?"push":void 0,_=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=E(e.getExpression());if(t==="notify"&&M.has(s))return`ctx.notify.${s}`;if(t==="push"&&x.has(s))return`ctx.push.${s}`},j=e=>r.isPropertyAccessExpression(e)?E(e.getExpression())==="push"&&x.has(e.getName()):!1,ee=(e,s)=>{const t=[];for(const i of m(s)){const o=e.getSourceFile(i)??e.addSourceFileAtPath(i),n=A(s,i);for(const c of y(o))if(!(c.kind!=="query"&&c.kind!=="mutation"))for(const a of h(c.handler,u.PropertyAccessExpression)){const f=_(a);f!==void 0&&t.push({callee:f,exportName:c.exportName,file:n,kind:c.kind,line:a.getStartLineNumber()})}}return t},R=(e,s)=>{for(const t of m(s)){const i=e.getSourceFile(t)??e.addSourceFileAtPath(t);for(const o of y(i))for(const n of h(o.handler,u.PropertyAccessExpression))if(j(n))return!0}return!1},U=new Set(["@lunora/notify"]),V=e=>{const s=e.getSymbol();if(!s)return e.getText()==="defineNotify";for(const t of s.getDeclarations())if(r.isImportSpecifier(t))return U.has(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineNotify":!1;return!1},P=(e,s=new Set)=>{const t=D(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const o=i.getAliasedSymbol();if(!o)return t;const n=o.getDeclarations().find(a=>r.isExportAssignment(a));if(!n)return t;const c=n.getSourceFile();if(!s.has(c.getFilePath()))return P(c,s.add(c.getFilePath()))},z=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),p=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},S=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return S(e.getExpression())},d=(e,s)=>{const t=S(e);return t!==void 0&&p(t)===s},H=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),o=t.getExpression(),n=r.isIdentifier(o)?o.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&n==="Object"||i==="set"&&n==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&p(a)===s},K=(e,s)=>{if(r.isBinaryExpression(e))return z.has(e.getOperatorToken().getText())&&d(e.getLeft(),s);if(r.isDeleteExpression(e))return d(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===u.PlusPlusToken||t===u.MinusMinusToken)&&d(e.getOperand(),s)}return r.isCallExpression(e)?H(e,s):!1},W=(e,s)=>{const t=p(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(o=>K(o,t)))},Y=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 o=i.getInitializer();if(!o||!r.isObjectLiteralExpression(o))continue;const n=i.getParent();if(!r.isVariableDeclarationList(n)||n.getDeclarationKind()!==O.Const)continue;const c=[i.getSourceFile(),e.getSourceFile()].filter((a,f,b)=>b.findIndex(v=>v.getFilePath()===a.getFilePath())===f);if(!W(e,c))return o}},B=(e,s)=>{const t=F(s,L);if(!N(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),o=P(i);if(!o||!r.isCallExpression(o))return{hasFcm:!0,hasWebPush:!0};const n=o.getExpression(),c=r.isIdentifier(n)&&V(n)?o.getArguments()[0]:void 0,a=c===void 0?void 0:Y(c);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?{hasFcm:!0,hasWebPush:!0}:{hasFcm:g(a,"fcm")!==void 0,hasWebPush:g(a,"webPush")!==void 0}},te=(e,s)=>{const t=B(e,s);return t===void 0?void 0:{...t,usesPush:R(e,s)}};export{L as NOTIFY_FILENAME,ee as discoverNotifyCalls,B as discoverNotifyChannels,te as discoverNotifyConfig};
@@ -1,3 +1,3 @@
1
- import{m}from"./modules-DEBCI7Gm.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-CjACC-MQ.mjs";import{G as h}from"./shared-A1XHcT4t.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)}
1
+ import{m}from"./modules-DEBCI7Gm.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-CjACC-MQ.mjs";import{G as h}from"./shared-DhqnD5R3.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};
@@ -1 +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,stringPropertyFor as w}from"./isTestPath-JdN4KXhV.mjs";import{a as v}from"./attribution-DUbGYT4N.mjs";import{r as $}from"./handler-reference-D1wpw_qR.mjs";import{d as F}from"./modules-DEBCI7Gm.mjs";const h="queues.ts",P=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=w("queue"),E=(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`)},I={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}},A=(o,e)=>{const i={};for(const[t,n]of Object.entries(I)){const r=l(o,t);if(r&&u.isPropertyAssignment(r)){const a=E(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},T=(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=$(l(o,"handler"),t)?.site,r={bindingName:y(e),exportName:e,filePath:g(t,o.getSourceFile().getFilePath()),mode:"push",name:T(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,A(o,e)),r},O=(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}`,Q=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())},L=(o,e,i,t)=>{const[n,r]=o.getArguments(),a=n!==void 0&&u.isIdentifier(n)?i.get(Q(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)},U=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)?P(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=v(i,"binding");m!==void 0&&e.push({call:n,exportName:m,factory:a,localName:s.getText()})}return e},C=(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)}},M=(o,e)=>{const i=o.flatMap(s=>U(s));C(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(O(s.call,s.exportName,e)):s.factory==="defineSubscription"&&r.push(L(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}},j=(o,e)=>[f(e,h),...F(o,e).map(i=>f(e,i.name,h))].filter(i=>x(i)),z=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)}},D=(o,e)=>{const i=j(o,e).map(a=>o.getSourceFile(a)??o.addSourceFileAtPath(a)),{queues:t,topics:n}=M(i,e),r=t.toSorted((a,s)=>a.exportName.localeCompare(s.exportName));return z(r),{queues:r,topics:n.toSorted((a,s)=>a.exportName.localeCompare(s.exportName))}},X=(o,e)=>D(o,e).queues;export{h as QUEUES_FILENAME,D as discoverQueueDeclarations,X as discoverQueues};
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,stringPropertyFor as w}from"./isTestPath-JdN4KXhV.mjs";import{a as v}from"./attribution-CTMkuBkn.mjs";import{r as $}from"./handler-reference-90LXJART.mjs";import{d as F}from"./modules-DEBCI7Gm.mjs";const h="queues.ts",P=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=w("queue"),E=(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`)},I={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}},A=(o,e)=>{const i={};for(const[t,n]of Object.entries(I)){const r=l(o,t);if(r&&u.isPropertyAssignment(r)){const a=E(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},T=(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=$(l(o,"handler"),t)?.site,r={bindingName:y(e),exportName:e,filePath:g(t,o.getSourceFile().getFilePath()),mode:"push",name:T(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,A(o,e)),r},O=(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}`,Q=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())},L=(o,e,i,t)=>{const[n,r]=o.getArguments(),a=n!==void 0&&u.isIdentifier(n)?i.get(Q(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)},U=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)?P(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=v(i,"binding");m!==void 0&&e.push({call:n,exportName:m,factory:a,localName:s.getText()})}return e},C=(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)}},M=(o,e)=>{const i=o.flatMap(s=>U(s));C(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(O(s.call,s.exportName,e)):s.factory==="defineSubscription"&&r.push(L(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}},j=(o,e)=>[f(e,h),...F(o,e).map(i=>f(e,i.name,h))].filter(i=>x(i)),z=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)}},D=(o,e)=>{const i=j(o,e).map(a=>o.getSourceFile(a)??o.addSourceFileAtPath(a)),{queues:t,topics:n}=M(i,e),r=t.toSorted((a,s)=>a.exportName.localeCompare(s.exportName));return z(r),{queues:r,topics:n.toSorted((a,s)=>a.exportName.localeCompare(s.exportName))}},X=(o,e)=>D(o,e).queues;export{h as QUEUES_FILENAME,D as discoverQueueDeclarations,X as discoverQueues};