@lunora/codegen 1.0.0-alpha.412 → 1.0.0-alpha.414

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 (64) hide show
  1. package/dist/index.d.mts +55 -0
  2. package/dist/index.d.ts +55 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{AGENTS_FILENAME-QRUqRvf6.mjs → AGENTS_FILENAME-C4tHmiZZ.mjs} +1 -1
  5. package/dist/packem_shared/{ALL_NOTIFY_CHANNELS-B7iq8Uiy.mjs → ALL_NOTIFY_CHANNELS-uYuQQpdn.mjs} +1 -1
  6. package/dist/packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs +1 -0
  7. package/dist/packem_shared/{ENV_FILENAME-BoyByQTI.mjs → ENV_FILENAME-DJ11PXN5.mjs} +1 -1
  8. package/dist/packem_shared/{FLAGS_FILENAME-BB1QI_aN.mjs → FLAGS_FILENAME-DeSjFBWq.mjs} +1 -1
  9. package/dist/packem_shared/{MUTATORS_FILENAME-DkFBc4AU.mjs → MUTATORS_FILENAME-C0ZV0hh6.mjs} +1 -1
  10. package/dist/packem_shared/{OPENRPC_VERSION-47R9GrAx.mjs → OPENRPC_VERSION-BOBo0zdQ.mjs} +1 -1
  11. package/dist/packem_shared/QUEUES_FILENAME-DbuJZnrY.mjs +1 -0
  12. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DhpeJoSr.mjs +54 -0
  13. package/dist/packem_shared/SHAPES_FILENAME-BvRkrFtN.mjs +1 -0
  14. package/dist/packem_shared/WORKFLOWS_FILENAME-7FysJsMZ.mjs +1 -0
  15. package/dist/packem_shared/{attribution-C3R6vQrY.mjs → attribution-Cwt30DDJ.mjs} +1 -1
  16. package/dist/packem_shared/{buildOpenApiDocument-Bfgtz-IM.mjs → buildOpenApiDocument-DmV_PBFv.mjs} +1 -1
  17. package/dist/packem_shared/{capabilitiesUsedBy-Bx1C3HqI.mjs → capabilitiesUsedBy-BNvoiCu1.mjs} +1 -1
  18. package/dist/packem_shared/{classify-procedure-call-C6ajvyGA.mjs → classify-procedure-call-BmEirzc_.mjs} +1 -1
  19. package/dist/packem_shared/{context-property-calls-CCMzhSdz.mjs → context-property-calls-BQyyS_B0.mjs} +1 -1
  20. package/dist/packem_shared/{context-root-B5xiDINx.mjs → context-root-hthkpwQe.mjs} +1 -1
  21. package/dist/packem_shared/{createCodegenProject-CIWmoq01.mjs → createCodegenProject-dC6oJh5H.mjs} +1 -1
  22. package/dist/packem_shared/{database-calls-B8H7kkzY.mjs → database-calls-B8l9USAr.mjs} +1 -1
  23. package/dist/packem_shared/{discoverAuthApiCalls-Db2Px0BS.mjs → discoverAuthApiCalls-CuqaLRa0.mjs} +1 -1
  24. package/dist/packem_shared/discoverCrons-bT8F5GyL.mjs +1 -0
  25. package/dist/packem_shared/discoverFunctions-Dn6_nfhC.mjs +1 -0
  26. package/dist/packem_shared/{discoverHttpRoutes-1ebHL9DX.mjs → discoverHttpRoutes-CesuhqW1.mjs} +1 -1
  27. package/dist/packem_shared/discoverHyperdriveCalls-DoZqnpRp.mjs +1 -0
  28. package/dist/packem_shared/{discoverInserts-BXAKSCk0.mjs → discoverInserts-fL7eh_Q_.mjs} +1 -1
  29. package/dist/packem_shared/discoverMaskProcedures-0XApH-Nk.mjs +1 -0
  30. package/dist/packem_shared/{discoverMigrations-bY4FcGu3.mjs → discoverMigrations-C9AlZYFi.mjs} +1 -1
  31. package/dist/packem_shared/{discoverNondeterministicCalls-CSaz-HlP.mjs → discoverNondeterministicCalls-ZeZDQJAI.mjs} +1 -1
  32. package/dist/packem_shared/{discoverQueries-B53HkUIt.mjs → discoverQueries-DPqTWmBp.mjs} +1 -1
  33. package/dist/packem_shared/discoverR2sqlCalls-cS1hM24s.mjs +1 -0
  34. package/dist/packem_shared/{discoverRlsMetadata-x48NLw6f.mjs → discoverRlsMetadata-C0UkQkWd.mjs} +1 -1
  35. package/dist/packem_shared/discoverRlsProcedures-BY04NWTT.mjs +1 -0
  36. package/dist/packem_shared/{discoverSandboxUsage-BWV_Ebxg.mjs → discoverSandboxUsage-Dgvv6F_7.mjs} +1 -1
  37. package/dist/packem_shared/discoverSchema-BLTROO8Z.mjs +1 -0
  38. package/dist/packem_shared/{discoverStorageRulesMetadata-BYyL1oLc.mjs → discoverStorageRulesMetadata-DeBgC7po.mjs} +1 -1
  39. package/dist/packem_shared/{exported-procedure-chains-CHh7fXfL.mjs → exported-procedure-chains-CfH5jrzD.mjs} +1 -1
  40. package/dist/packem_shared/{fingerprintSchemaSources-BlBMjIrI.mjs → fingerprintSchemaSources-TN-rU6Of.mjs} +1 -1
  41. package/dist/packem_shared/formatAdvisories-Bue5tbp6.mjs +2 -0
  42. package/dist/packem_shared/{handler-reference-DOIBV2VQ.mjs → handler-reference-BkOkxxg8.mjs} +1 -1
  43. package/dist/packem_shared/{index-DTwKeiZr.mjs → index-BAkOcSfE.mjs} +1 -1
  44. package/dist/packem_shared/{index-D2i1mfys.mjs → index-s_NKnjVj.mjs} +1 -1
  45. package/dist/packem_shared/{ip-reads-DUVCi6k9.mjs → ip-reads-JFFYo4vb.mjs} +1 -1
  46. package/dist/packem_shared/isTestPath-Uwb5a6Kq.mjs +1 -0
  47. package/dist/packem_shared/{modules-5z0rLSZk.mjs → modules-DdOd-7Wp.mjs} +1 -1
  48. package/dist/packem_shared/{policies-DhRzjZZw.mjs → policies-Dn_tuTZd.mjs} +1 -1
  49. package/dist/packem_shared/{unwrap-handler-return-DhdSnAfS.mjs → unwrap-handler-return-DvbyiLjc.mjs} +1 -1
  50. package/package.json +3 -3
  51. package/dist/packem_shared/CONTAINERS_FILENAME-Cr7hB6eW.mjs +0 -1
  52. package/dist/packem_shared/QUEUES_FILENAME-g99T1hJ6.mjs +0 -1
  53. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-CKGYZChO.mjs +0 -54
  54. package/dist/packem_shared/SHAPES_FILENAME-C51eXfND.mjs +0 -1
  55. package/dist/packem_shared/WORKFLOWS_FILENAME-WcVbEHuM.mjs +0 -1
  56. package/dist/packem_shared/discoverCrons-DaBAMqU6.mjs +0 -1
  57. package/dist/packem_shared/discoverFunctions-DdR5Uh1X.mjs +0 -1
  58. package/dist/packem_shared/discoverHyperdriveCalls-BHtXShva.mjs +0 -1
  59. package/dist/packem_shared/discoverMaskProcedures-DhcC6cfM.mjs +0 -1
  60. package/dist/packem_shared/discoverR2sqlCalls-B8K69UVy.mjs +0 -1
  61. package/dist/packem_shared/discoverRlsProcedures-DDulecui.mjs +0 -1
  62. package/dist/packem_shared/discoverSchema-DJ-YxkP2.mjs +0 -1
  63. package/dist/packem_shared/formatAdvisories-BCVASH7N.mjs +0 -2
  64. package/dist/packem_shared/isTestPath-6GN3Bkus.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -1209,9 +1209,20 @@ interface ValidatorIR {
1209
1209
  unresolvedShape?: boolean;
1210
1210
  valueType?: ValidatorIR;
1211
1211
  }
1212
+ /**
1213
+ * Where a schema object is declared: the file relative to `lunora/` without its extension, and the 1-based start line of
1214
+ * the node (leading comments excluded). Absent for an object with no source under `lunora/`, such as one contributed by an
1215
+ * installed package's extension.
1216
+ */
1217
+ interface DeclarationSiteIR {
1218
+ file: string;
1219
+ line: number;
1220
+ }
1212
1221
  interface IndexIR {
1213
1222
  fields: ReadonlyArray<string>;
1214
1223
  name: string;
1224
+ /** Where the `.index(...)` call's method name is declared. */
1225
+ site?: DeclarationSiteIR;
1215
1226
  unique?: boolean;
1216
1227
  }
1217
1228
  interface SearchIndexIR {
@@ -1222,6 +1233,8 @@ interface SearchIndexIR {
1222
1233
  /** Text-analysis profile (accent folding + that language's stopwords). */
1223
1234
  language?: string;
1224
1235
  name: string;
1236
+ /** Where the `.searchIndex(...)` call's method name is declared. */
1237
+ site?: DeclarationSiteIR;
1225
1238
  /** Skip the migration-time backfill of the search companion (large tables index out-of-band). */
1226
1239
  staged?: boolean;
1227
1240
  /** `"native"` opts into the engine's own full-text index where it has one (Postgres). */
@@ -1234,6 +1247,8 @@ interface GeoIndexIR {
1234
1247
  name: string;
1235
1248
  /** Geohash precision (characters) maintained on the companion; omitted ⇒ the runtime default. */
1236
1249
  precision?: number;
1250
+ /** Where the `.geoIndex(...)` call's method name is declared. */
1251
+ site?: DeclarationSiteIR;
1237
1252
  }
1238
1253
  /** A `.ttl(field, { after? })` declaration — declarative table-level auto-expiry. */
1239
1254
  interface TtlIR {
@@ -1250,6 +1265,8 @@ interface VectorIndexIR {
1250
1265
  metadata?: ReadonlyArray<string>;
1251
1266
  metric?: "cosine" | "dot-product" | "euclidean";
1252
1267
  name: string;
1268
+ /** Where the inline `.vectorize(...)` call's method name, or a standalone (Shape B) `defineVectorIndex(...)` call, is declared. */
1269
+ site?: DeclarationSiteIR;
1253
1270
  /** Owning table the vectors are sourced from. */
1254
1271
  table: string;
1255
1272
  }
@@ -1271,6 +1288,8 @@ interface RankIndexIR {
1271
1288
  name: string;
1272
1289
  /** Columns scoping each ranking; omitted ⇒ one global rank over the table. */
1273
1290
  partitionBy?: ReadonlyArray<string>;
1291
+ /** Where the `.rankIndex(...)` call's method name is declared. */
1292
+ site?: DeclarationSiteIR;
1274
1293
  /** Ordered sort keys driving the rank. */
1275
1294
  sortBy: ReadonlyArray<RankSortKeyIR>;
1276
1295
  }
@@ -1285,6 +1304,8 @@ interface KeyedRelationIR {
1285
1304
  onDelete?: "cascade" | "restrict" | "set null";
1286
1305
  /** Referenced column (defaults to `_id`). */
1287
1306
  references: string;
1307
+ /** Where the relation's property in the `.relations(...)` object is declared. */
1308
+ site?: DeclarationSiteIR;
1288
1309
  /** Target table name. */
1289
1310
  table: string;
1290
1311
  through?: never;
@@ -1294,6 +1315,8 @@ interface ThroughRelationIR {
1294
1315
  kind: "many";
1295
1316
  /** Accessor name the relation is loaded under (the `with` key). */
1296
1317
  name: string;
1318
+ /** Where the relation's property in the `.relations(...)` object is declared. */
1319
+ site?: DeclarationSiteIR;
1297
1320
  /** Target table name. */
1298
1321
  table: string;
1299
1322
  /** The join table and its two keys: `from` points at the declaring table, `to` at `table`. */
@@ -1419,6 +1442,11 @@ interface TableIR {
1419
1442
  field: string;
1420
1443
  kind: "shardBy";
1421
1444
  };
1445
+ /**
1446
+ * Where the table is declared: its `defineTable(...)` call, or the `defineSchema({...})` property when the table is
1447
+ * not written as a `defineTable` chain. Absent for a table whose declaration is not under `lunora/`.
1448
+ */
1449
+ site?: DeclarationSiteIR;
1422
1450
  /** Set when the chain carried `.softDelete()` — the marker column's name (default `deletedAt`). The column is injected into `shape` so `Doc_*` carries it. */
1423
1451
  softDelete?: {
1424
1452
  field: string;
@@ -1704,6 +1732,8 @@ interface ShapeIR {
1704
1732
  exportName: string;
1705
1733
  /** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
1706
1734
  filePath: string;
1735
+ /** 1-based start line of the `export const` declaring the shape, without leading comments. */
1736
+ line?: number;
1707
1737
  /**
1708
1738
  * The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
1709
1739
  * so the shard never resumes it warm.
@@ -1897,6 +1927,8 @@ interface ProcedureMiddlewareIR {
1897
1927
  */
1898
1928
  hasEmailArg?: boolean;
1899
1929
  kind: "action" | "mutation" | "query";
1930
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
1931
+ line?: number;
1900
1932
  /** `true` when the handler reaches an outbound surface (`ctx.fetch`, mail, queues, storage, sql, ai, …) that can fail. */
1901
1933
  reachesOutbound?: boolean;
1902
1934
  /** `true` when the handler runs any AI generation, bounded or not. */
@@ -2052,8 +2084,12 @@ interface CronJobIR {
2052
2084
  args: Record<string, unknown>;
2053
2085
  /** Compiled standard cron expression, e.g. `"0 9 * * *"`. */
2054
2086
  cron: string;
2087
+ /** Lunora-relative module of the `cronJobs()` registration, without extension. */
2088
+ file?: string;
2055
2089
  /** Target function ref `namespace:fn`. Present for a function target; absent when {@link CronJobIR.workflow} is set. */
2056
2090
  functionPath?: string;
2091
+ /** 1-based start line of the statement registering the job, without leading comments. */
2092
+ line?: number;
2057
2093
  /** Unique, human-readable job name. */
2058
2094
  name: string;
2059
2095
  /**
@@ -2100,6 +2136,8 @@ interface ContainerIRBase {
2100
2136
  enableInternet?: boolean;
2101
2137
  /** The `lunora/containers.ts` export name, e.g. `transcoder`. */
2102
2138
  exportName: string;
2139
+ /** Lunora-relative module of the declaration, without extension: always `containers`. */
2140
+ file?: string;
2103
2141
  /**
2104
2142
  * The static `hardTimeout` value, when it was a literal. It caps total lifetime,
2105
2143
  * so it also bounds how long an idle instance can run. Lifted for the advisor.
@@ -2111,6 +2149,8 @@ interface ContainerIRBase {
2111
2149
  memoryMib?: number;
2112
2150
  vcpu?: number;
2113
2151
  };
2152
+ /** 1-based start line of the `export const` declaring the container, without leading comments. */
2153
+ line?: number;
2114
2154
  /** Static wrangler `containers[].name` override, when declared. */
2115
2155
  name?: string;
2116
2156
  /**
@@ -2183,6 +2223,8 @@ interface WorkflowIR {
2183
2223
  };
2184
2224
  /** The `lunora/workflows.ts` export name, e.g. `orderPipeline`. */
2185
2225
  exportName: string;
2226
+ /** Lunora-relative module of the `defineWorkflow()` export, without extension. */
2227
+ file?: string;
2186
2228
  /**
2187
2229
  * The file declaring the `handler:` when it is a function passed by reference
2188
2230
  * and declared in another file — the file {@link WorkflowIR.steps}' lines are
@@ -2195,6 +2237,8 @@ interface WorkflowIR {
2195
2237
  limits?: {
2196
2238
  steps?: number;
2197
2239
  };
2240
+ /** 1-based start line of the `export const` declaring the workflow, without leading comments. */
2241
+ line?: number;
2198
2242
  /**
2199
2243
  * The stable wrangler `exports.<Class>.name`. Defaults to the kebab-cased export
2200
2244
  * name (`orderPipeline` → `order-pipeline`); a static `name:` literal in the
@@ -2301,6 +2345,8 @@ interface QueueIR {
2301
2345
  filePath: string;
2302
2346
  /** See {@link HandlerSiteIR}. */
2303
2347
  handlerSite?: HandlerSiteIR;
2348
+ /** 1-based start line of the `export const` declaring the queue or subscription, without leading comments. */
2349
+ line?: number;
2304
2350
  /** How the queue is consumed: `"push"` (a worker `queue()` handler) or `"pull"` (external HTTP). */
2305
2351
  mode: "pull" | "push";
2306
2352
  /**
@@ -2335,6 +2381,8 @@ interface TopicIR {
2335
2381
  exportName: string;
2336
2382
  /** The declaring file, as {@link QueueIR.filePath}. */
2337
2383
  filePath: string;
2384
+ /** 1-based start line of the `defineTopic(...)` statement, when recorded. */
2385
+ line?: number;
2338
2386
  }
2339
2387
  /**
2340
2388
  * A module: a folder under `lunora/` whose `module.ts` default-exports
@@ -2534,6 +2582,8 @@ interface AdminRouteIR {
2534
2582
  exportName: string;
2535
2583
  /** Source file relative to `<projectRoot>/lunora/`, without extension. */
2536
2584
  file: string;
2585
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
2586
+ line?: number;
2537
2587
  /** HTTP verb the route binds to (uppercased), e.g. `"POST"`. */
2538
2588
  method: string;
2539
2589
  /** The route path, e.g. `/admin/users`. */
@@ -2557,6 +2607,8 @@ interface WranglerVariableIR {
2557
2607
  key: string;
2558
2608
  /** Heuristic that matched, e.g. `stripe_live_key` / `private_key` / `secret_named_var`. */
2559
2609
  kind: string;
2610
+ /** 1-based line of the key inside the `wrangler.jsonc` file, when the reader could locate it. */
2611
+ line?: number;
2560
2612
  /** Redacted preview of the value (first few chars + length) for the finding detail — never the full secret. */
2561
2613
  preview: string;
2562
2614
  }
@@ -2623,6 +2675,8 @@ interface RlsProcedureIR {
2623
2675
  exportName: string;
2624
2676
  /** Source file relative to `<projectRoot>/lunora/`, without extension. */
2625
2677
  file: string;
2678
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
2679
+ line?: number;
2626
2680
  /**
2627
2681
  * Table names extracted from the `rls(policies)` array literal. Empty when the
2628
2682
  * policies argument is not a statically-readable array literal.
@@ -2877,6 +2931,7 @@ interface LintSchemaOptions {
2877
2931
  storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
2878
2932
  storageUploads?: ReadonlyArray<StorageUploadIR>;
2879
2933
  tableWrites?: ReadonlyArray<TableWriteIR>;
2934
+ topics?: ReadonlyArray<TopicIR>;
2880
2935
  unboundedLoops?: ReadonlyArray<UnboundedLoopIR>;
2881
2936
  unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
2882
2937
  vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
package/dist/index.d.ts CHANGED
@@ -1209,9 +1209,20 @@ interface ValidatorIR {
1209
1209
  unresolvedShape?: boolean;
1210
1210
  valueType?: ValidatorIR;
1211
1211
  }
1212
+ /**
1213
+ * Where a schema object is declared: the file relative to `lunora/` without its extension, and the 1-based start line of
1214
+ * the node (leading comments excluded). Absent for an object with no source under `lunora/`, such as one contributed by an
1215
+ * installed package's extension.
1216
+ */
1217
+ interface DeclarationSiteIR {
1218
+ file: string;
1219
+ line: number;
1220
+ }
1212
1221
  interface IndexIR {
1213
1222
  fields: ReadonlyArray<string>;
1214
1223
  name: string;
1224
+ /** Where the `.index(...)` call's method name is declared. */
1225
+ site?: DeclarationSiteIR;
1215
1226
  unique?: boolean;
1216
1227
  }
1217
1228
  interface SearchIndexIR {
@@ -1222,6 +1233,8 @@ interface SearchIndexIR {
1222
1233
  /** Text-analysis profile (accent folding + that language's stopwords). */
1223
1234
  language?: string;
1224
1235
  name: string;
1236
+ /** Where the `.searchIndex(...)` call's method name is declared. */
1237
+ site?: DeclarationSiteIR;
1225
1238
  /** Skip the migration-time backfill of the search companion (large tables index out-of-band). */
1226
1239
  staged?: boolean;
1227
1240
  /** `"native"` opts into the engine's own full-text index where it has one (Postgres). */
@@ -1234,6 +1247,8 @@ interface GeoIndexIR {
1234
1247
  name: string;
1235
1248
  /** Geohash precision (characters) maintained on the companion; omitted ⇒ the runtime default. */
1236
1249
  precision?: number;
1250
+ /** Where the `.geoIndex(...)` call's method name is declared. */
1251
+ site?: DeclarationSiteIR;
1237
1252
  }
1238
1253
  /** A `.ttl(field, { after? })` declaration — declarative table-level auto-expiry. */
1239
1254
  interface TtlIR {
@@ -1250,6 +1265,8 @@ interface VectorIndexIR {
1250
1265
  metadata?: ReadonlyArray<string>;
1251
1266
  metric?: "cosine" | "dot-product" | "euclidean";
1252
1267
  name: string;
1268
+ /** Where the inline `.vectorize(...)` call's method name, or a standalone (Shape B) `defineVectorIndex(...)` call, is declared. */
1269
+ site?: DeclarationSiteIR;
1253
1270
  /** Owning table the vectors are sourced from. */
1254
1271
  table: string;
1255
1272
  }
@@ -1271,6 +1288,8 @@ interface RankIndexIR {
1271
1288
  name: string;
1272
1289
  /** Columns scoping each ranking; omitted ⇒ one global rank over the table. */
1273
1290
  partitionBy?: ReadonlyArray<string>;
1291
+ /** Where the `.rankIndex(...)` call's method name is declared. */
1292
+ site?: DeclarationSiteIR;
1274
1293
  /** Ordered sort keys driving the rank. */
1275
1294
  sortBy: ReadonlyArray<RankSortKeyIR>;
1276
1295
  }
@@ -1285,6 +1304,8 @@ interface KeyedRelationIR {
1285
1304
  onDelete?: "cascade" | "restrict" | "set null";
1286
1305
  /** Referenced column (defaults to `_id`). */
1287
1306
  references: string;
1307
+ /** Where the relation's property in the `.relations(...)` object is declared. */
1308
+ site?: DeclarationSiteIR;
1288
1309
  /** Target table name. */
1289
1310
  table: string;
1290
1311
  through?: never;
@@ -1294,6 +1315,8 @@ interface ThroughRelationIR {
1294
1315
  kind: "many";
1295
1316
  /** Accessor name the relation is loaded under (the `with` key). */
1296
1317
  name: string;
1318
+ /** Where the relation's property in the `.relations(...)` object is declared. */
1319
+ site?: DeclarationSiteIR;
1297
1320
  /** Target table name. */
1298
1321
  table: string;
1299
1322
  /** The join table and its two keys: `from` points at the declaring table, `to` at `table`. */
@@ -1419,6 +1442,11 @@ interface TableIR {
1419
1442
  field: string;
1420
1443
  kind: "shardBy";
1421
1444
  };
1445
+ /**
1446
+ * Where the table is declared: its `defineTable(...)` call, or the `defineSchema({...})` property when the table is
1447
+ * not written as a `defineTable` chain. Absent for a table whose declaration is not under `lunora/`.
1448
+ */
1449
+ site?: DeclarationSiteIR;
1422
1450
  /** Set when the chain carried `.softDelete()` — the marker column's name (default `deletedAt`). The column is injected into `shape` so `Doc_*` carries it. */
1423
1451
  softDelete?: {
1424
1452
  field: string;
@@ -1704,6 +1732,8 @@ interface ShapeIR {
1704
1732
  exportName: string;
1705
1733
  /** Path relative to `<projectRoot>/lunora/` without extension — always `"shapes"`. */
1706
1734
  filePath: string;
1735
+ /** 1-based start line of the `export const` declaring the shape, without leading comments. */
1736
+ line?: number;
1707
1737
  /**
1708
1738
  * The shape's `where` may read `ctx.ip`, decided statically and failing closed (same rule as {@link FunctionIR.readsIp}),
1709
1739
  * so the shard never resumes it warm.
@@ -1897,6 +1927,8 @@ interface ProcedureMiddlewareIR {
1897
1927
  */
1898
1928
  hasEmailArg?: boolean;
1899
1929
  kind: "action" | "mutation" | "query";
1930
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
1931
+ line?: number;
1900
1932
  /** `true` when the handler reaches an outbound surface (`ctx.fetch`, mail, queues, storage, sql, ai, …) that can fail. */
1901
1933
  reachesOutbound?: boolean;
1902
1934
  /** `true` when the handler runs any AI generation, bounded or not. */
@@ -2052,8 +2084,12 @@ interface CronJobIR {
2052
2084
  args: Record<string, unknown>;
2053
2085
  /** Compiled standard cron expression, e.g. `"0 9 * * *"`. */
2054
2086
  cron: string;
2087
+ /** Lunora-relative module of the `cronJobs()` registration, without extension. */
2088
+ file?: string;
2055
2089
  /** Target function ref `namespace:fn`. Present for a function target; absent when {@link CronJobIR.workflow} is set. */
2056
2090
  functionPath?: string;
2091
+ /** 1-based start line of the statement registering the job, without leading comments. */
2092
+ line?: number;
2057
2093
  /** Unique, human-readable job name. */
2058
2094
  name: string;
2059
2095
  /**
@@ -2100,6 +2136,8 @@ interface ContainerIRBase {
2100
2136
  enableInternet?: boolean;
2101
2137
  /** The `lunora/containers.ts` export name, e.g. `transcoder`. */
2102
2138
  exportName: string;
2139
+ /** Lunora-relative module of the declaration, without extension: always `containers`. */
2140
+ file?: string;
2103
2141
  /**
2104
2142
  * The static `hardTimeout` value, when it was a literal. It caps total lifetime,
2105
2143
  * so it also bounds how long an idle instance can run. Lifted for the advisor.
@@ -2111,6 +2149,8 @@ interface ContainerIRBase {
2111
2149
  memoryMib?: number;
2112
2150
  vcpu?: number;
2113
2151
  };
2152
+ /** 1-based start line of the `export const` declaring the container, without leading comments. */
2153
+ line?: number;
2114
2154
  /** Static wrangler `containers[].name` override, when declared. */
2115
2155
  name?: string;
2116
2156
  /**
@@ -2183,6 +2223,8 @@ interface WorkflowIR {
2183
2223
  };
2184
2224
  /** The `lunora/workflows.ts` export name, e.g. `orderPipeline`. */
2185
2225
  exportName: string;
2226
+ /** Lunora-relative module of the `defineWorkflow()` export, without extension. */
2227
+ file?: string;
2186
2228
  /**
2187
2229
  * The file declaring the `handler:` when it is a function passed by reference
2188
2230
  * and declared in another file — the file {@link WorkflowIR.steps}' lines are
@@ -2195,6 +2237,8 @@ interface WorkflowIR {
2195
2237
  limits?: {
2196
2238
  steps?: number;
2197
2239
  };
2240
+ /** 1-based start line of the `export const` declaring the workflow, without leading comments. */
2241
+ line?: number;
2198
2242
  /**
2199
2243
  * The stable wrangler `exports.<Class>.name`. Defaults to the kebab-cased export
2200
2244
  * name (`orderPipeline` → `order-pipeline`); a static `name:` literal in the
@@ -2301,6 +2345,8 @@ interface QueueIR {
2301
2345
  filePath: string;
2302
2346
  /** See {@link HandlerSiteIR}. */
2303
2347
  handlerSite?: HandlerSiteIR;
2348
+ /** 1-based start line of the `export const` declaring the queue or subscription, without leading comments. */
2349
+ line?: number;
2304
2350
  /** How the queue is consumed: `"push"` (a worker `queue()` handler) or `"pull"` (external HTTP). */
2305
2351
  mode: "pull" | "push";
2306
2352
  /**
@@ -2335,6 +2381,8 @@ interface TopicIR {
2335
2381
  exportName: string;
2336
2382
  /** The declaring file, as {@link QueueIR.filePath}. */
2337
2383
  filePath: string;
2384
+ /** 1-based start line of the `defineTopic(...)` statement, when recorded. */
2385
+ line?: number;
2338
2386
  }
2339
2387
  /**
2340
2388
  * A module: a folder under `lunora/` whose `module.ts` default-exports
@@ -2534,6 +2582,8 @@ interface AdminRouteIR {
2534
2582
  exportName: string;
2535
2583
  /** Source file relative to `<projectRoot>/lunora/`, without extension. */
2536
2584
  file: string;
2585
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
2586
+ line?: number;
2537
2587
  /** HTTP verb the route binds to (uppercased), e.g. `"POST"`. */
2538
2588
  method: string;
2539
2589
  /** The route path, e.g. `/admin/users`. */
@@ -2557,6 +2607,8 @@ interface WranglerVariableIR {
2557
2607
  key: string;
2558
2608
  /** Heuristic that matched, e.g. `stripe_live_key` / `private_key` / `secret_named_var`. */
2559
2609
  kind: string;
2610
+ /** 1-based line of the key inside the `wrangler.jsonc` file, when the reader could locate it. */
2611
+ line?: number;
2560
2612
  /** Redacted preview of the value (first few chars + length) for the finding detail — never the full secret. */
2561
2613
  preview: string;
2562
2614
  }
@@ -2623,6 +2675,8 @@ interface RlsProcedureIR {
2623
2675
  exportName: string;
2624
2676
  /** Source file relative to `<projectRoot>/lunora/`, without extension. */
2625
2677
  file: string;
2678
+ /** 1-based start line of the declaring statement (the `export const`), without leading comments. */
2679
+ line?: number;
2626
2680
  /**
2627
2681
  * Table names extracted from the `rls(policies)` array literal. Empty when the
2628
2682
  * policies argument is not a statically-readable array literal.
@@ -2877,6 +2931,7 @@ interface LintSchemaOptions {
2877
2931
  storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
2878
2932
  storageUploads?: ReadonlyArray<StorageUploadIR>;
2879
2933
  tableWrites?: ReadonlyArray<TableWriteIR>;
2934
+ topics?: ReadonlyArray<TopicIR>;
2880
2935
  unboundedLoops?: ReadonlyArray<UnboundedLoopIR>;
2881
2936
  unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
2882
2937
  vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-QRUqRvf6.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-6GN3Bkus.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-Db2Px0BS.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-Cr7hB6eW.mjs";import{default as b}from"./packem_shared/discoverCrons-DaBAMqU6.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-BoyByQTI.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-Bx1C3HqI.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-BB1QI_aN.mjs";import{d as q}from"./packem_shared/index-D2i1mfys.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-1ebHL9DX.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-BHtXShva.mjs";import{default as ee}from"./packem_shared/discoverInserts-BXAKSCk0.mjs";import{d as oe}from"./packem_shared/index-DTwKeiZr.mjs";import{default as ie}from"./packem_shared/discoverMigrations-bY4FcGu3.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-DkFBc4AU.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-CSaz-HlP.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-B7iq8Uiy.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-B53HkUIt.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-g99T1hJ6.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-B8K69UVy.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-DDulecui.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-x48NLw6f.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-BWV_Ebxg.mjs";import{default as Pe}from"./packem_shared/discoverSchema-DJ-YxkP2.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-C51eXfND.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-BYyL1oLc.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-WcVbEHuM.mjs";import{emitApp as qe}from"./packem_shared/emitApp-CBE_wZAT.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-Bfgtz-IM.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-47R9GrAx.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CKGYZChO.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-BlBMjIrI.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-CWAD5mYy.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-CIWmoq01.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DCzOjTN7.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-C4tHmiZZ.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-Uwb5a6Kq.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-CuqaLRa0.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-d3XTFcqV.mjs";import{default as b}from"./packem_shared/discoverCrons-bT8F5GyL.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-DJ11PXN5.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BNvoiCu1.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-DeSjFBWq.mjs";import{d as q}from"./packem_shared/index-s_NKnjVj.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-CesuhqW1.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-DoZqnpRp.mjs";import{default as ee}from"./packem_shared/discoverInserts-fL7eh_Q_.mjs";import{d as oe}from"./packem_shared/index-BAkOcSfE.mjs";import{default as ie}from"./packem_shared/discoverMigrations-C9AlZYFi.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-C0ZV0hh6.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-ZeZDQJAI.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-uYuQQpdn.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-DPqTWmBp.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-DbuJZnrY.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-cS1hM24s.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-BY04NWTT.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-C0UkQkWd.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-Dgvv6F_7.mjs";import{default as Pe}from"./packem_shared/discoverSchema-BLTROO8Z.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-BvRkrFtN.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-DeBgC7po.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-7FysJsMZ.mjs";import{emitApp as qe}from"./packem_shared/emitApp-CBE_wZAT.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-DmV_PBFv.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-BOBo0zdQ.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DhpeJoSr.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-TN-rU6Of.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-Dfxmm5Zw.mjs";import{e as Jr}from"./packem_shared/shard-CWAD5mYy.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-dC6oJh5H.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-G5mZQjY0.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
@@ -1 +1 @@
1
- import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as E}from"./isTestPath-6GN3Bkus.mjs";import{a as w}from"./attribution-C3R6vQrY.mjs";const h=new Set(["@lunora/agent","@lunora/agent/core"]),v="agents.ts",P=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return h.has(e.getImportDeclaration().getModuleSpecifierValue())?e.getNameNode().getText()==="defineAgent":!1;return!1},S=E("agent"),D=(o,n,e)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${e}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},I=(o,n)=>{const e=o.getArguments()[0];if(!e||!a.isObjectLiteralExpression(e))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const t={className:b(n),exportName:n,name:d(n)},r=c(e,"name");r&&a.isPropertyAssignment(r)&&(t.name=S(r.getInitializerOrThrow(),n,"name"));const i=c(e,"publicRun");i&&a.isPropertyAssignment(i)&&D(i.getInitializerOrThrow(),n,"publicRun")&&(t.publicRun=!0);const s=c(e,"voice");if(s&&a.isPropertyAssignment(s)){const m=s.getInitializerOrThrow();if(!a.isObjectLiteralExpression(m))throw l(m,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);t.voice=!0,t.voiceBindingName=N(n),t.voiceClassName=y(n)}return c(e,"onEmail")&&(t.onEmail=!0),t},T=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const r=t.getExpression();if(!a.isIdentifier(r)||!P(r))continue;const i=e.getNameNode();if(!a.isIdentifier(i)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(i,"defineAgent exports must be plain named exports (no destructuring)")}const s=w(e,"binding");s!==void 0&&n.push(I(t,s))}return n},x=o=>{const n=new Map,e=new Map;for(const t of o){const r=n.get(t.name);if(r!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${r}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const i=e.get(t.className);if(i!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${i}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},M=(o,n)=>{const e=f(n,v);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),r=T(t);return r.sort((i,s)=>i.exportName.localeCompare(s.exportName)),x(r),r};export{v as AGENTS_FILENAME,M as discoverAgents};
1
+ import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as E}from"./isTestPath-Uwb5a6Kq.mjs";import{a as w}from"./attribution-Cwt30DDJ.mjs";const h=new Set(["@lunora/agent","@lunora/agent/core"]),v="agents.ts",P=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return h.has(e.getImportDeclaration().getModuleSpecifierValue())?e.getNameNode().getText()==="defineAgent":!1;return!1},S=E("agent"),D=(o,n,e)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${e}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},I=(o,n)=>{const e=o.getArguments()[0];if(!e||!a.isObjectLiteralExpression(e))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const t={className:b(n),exportName:n,name:d(n)},r=c(e,"name");r&&a.isPropertyAssignment(r)&&(t.name=S(r.getInitializerOrThrow(),n,"name"));const i=c(e,"publicRun");i&&a.isPropertyAssignment(i)&&D(i.getInitializerOrThrow(),n,"publicRun")&&(t.publicRun=!0);const s=c(e,"voice");if(s&&a.isPropertyAssignment(s)){const m=s.getInitializerOrThrow();if(!a.isObjectLiteralExpression(m))throw l(m,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);t.voice=!0,t.voiceBindingName=N(n),t.voiceClassName=y(n)}return c(e,"onEmail")&&(t.onEmail=!0),t},T=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const r=t.getExpression();if(!a.isIdentifier(r)||!P(r))continue;const i=e.getNameNode();if(!a.isIdentifier(i)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(i,"defineAgent exports must be plain named exports (no destructuring)")}const s=w(e,"binding");s!==void 0&&n.push(I(t,s))}return n},x=o=>{const n=new Map,e=new Map;for(const t of o){const r=n.get(t.name);if(r!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${r}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const i=e.get(t.className);if(i!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${i}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},M=(o,n)=>{const e=f(n,v);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),r=T(t);return r.sort((i,s)=>i.exportName.localeCompare(s.exportName)),x(r),r};export{v as AGENTS_FILENAME,M as discoverAgents};
@@ -1 +1 @@
1
- import{existsSync as I}from"node:fs";import{join as D}from"node:path";import{SyntaxKind as l,Node as r,VariableDeclarationKind as L}from"ts-morph";import{listLunoraSourceFiles as E,lunoraRelativePath as C,descendantsOfKind as v,findObjectProperty as d,defaultExportExpression as k,propertyInitializer as m,handlerOf as w,unwrapExpression as u}from"./isTestPath-6GN3Bkus.mjs";import{j as M,h as _}from"./attribution-C3R6vQrY.mjs";import{a as p}from"./context-root-B5xiDINx.mjs";import{c as j}from"./classify-procedure-call-C6ajvyGA.mjs";import{s as R}from"./property-name-7cBlgK_O.mjs";const z="notify.ts",W=new Set(["chat","inApp","send","webhook"]),S=new Set(["broadcast","send","sendToCondition","sendToTopic"]),H=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=j(s);if(!t)return;const i=w(s,t.receiver);return i?{exportName:_(e)??e.getName(),handler:i,kind:t.kind}:void 0},P=e=>{const s=[];for(const t of M(e)){const i=H(t);i&&s.push(i)}return s},b=e=>p(e,["notify"])?"notify":p(e,["push"])||p(e,["notify","push"])?"push":void 0,U=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=b(e.getExpression());if(t==="notify"&&W.has(s))return`ctx.notify.${s}`;if(t==="push"&&S.has(s))return`ctx.push.${s}`},V=e=>r.isPropertyAccessExpression(e)?b(e.getExpression())==="push"&&S.has(e.getName()):!1,de=(e,s)=>{const t=[];for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i),c=C(s,i);for(const o of P(n))if(!(o.kind!=="query"&&o.kind!=="mutation"))for(const a of v(o.handler,l.PropertyAccessExpression)){const f=U(a);f!==void 0&&t.push({callee:f,exportName:o.exportName,file:c,kind:o.kind,line:a.getStartLineNumber()})}}return t},B=(e,s)=>{const t=new Set;for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i);for(const c of P(n))for(const o of v(c.handler,l.PropertyAccessExpression))V(o)&&t.add(o.getName())}return t},y={fcm:"env",hasWebPush:!0},K=new Set(["@lunora/notify"]),O=(e,s)=>{const t=e.getSymbol();if(!t)return e.getText()===s;for(const i of t.getDeclarations())if(r.isImportSpecifier(i))return K.has(i.getImportDeclaration().getModuleSpecifierValue())?i.getNameNode().getText()===s:!1;return!1},A=(e,s=new Set)=>{const t=k(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const n=i.getAliasedSymbol();if(!n)return t;const c=n.getDeclarations().find(a=>r.isExportAssignment(a));if(!c)return t;const o=c.getSourceFile();if(!s.has(o.getFilePath()))return A(o,s.add(o.getFilePath()))},Y=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),x=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},N=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return N(e.getExpression())},g=(e,s)=>{const t=N(e);return t!==void 0&&x(t)===s},$=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),n=t.getExpression(),c=r.isIdentifier(n)?n.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&c==="Object"||i==="set"&&c==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&x(a)===s},q=(e,s)=>{if(r.isBinaryExpression(e))return Y.has(e.getOperatorToken().getText())&&g(e.getLeft(),s);if(r.isDeleteExpression(e))return g(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===l.PlusPlusToken||t===l.MinusMinusToken)&&g(e.getOperand(),s)}return r.isCallExpression(e)?$(e,s):!1},G=(e,s)=>{const t=x(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(n=>q(n,t)))},J=e=>{if(r.isObjectLiteralExpression(e))return e;if(!r.isIdentifier(e))return;const s=e.getSymbol(),t=s?.getAliasedSymbol()?.getDeclarations()??s?.getDeclarations()??[];for(const i of t){if(!r.isVariableDeclaration(i))continue;const n=i.getInitializer();if(!n||!r.isObjectLiteralExpression(n))continue;const c=i.getParent();if(!r.isVariableDeclarationList(c)||c.getDeclarationKind()!==L.Const)continue;const o=[i.getSourceFile(),e.getSourceFile()].filter((a,f,T)=>T.findIndex(F=>F.getFilePath()===a.getFilePath())===f);if(!G(e,o))return n}},Q=e=>r.isArrowFunction(e)||r.isFunctionExpression(e)||r.isMethodDeclaration(e),X=e=>{const s=e.getBody();if(!r.isBlock(s))return s;const[t,...i]=s.getStatements();return i.length===0&&r.isReturnStatement(t)?t.getExpression():void 0},Z=e=>{const s=u(e),t=u(s!==void 0&&Q(s)?X(s):s);if(t!==void 0&&r.isCallExpression(t)){const i=t.getExpression(),n=u(t.getArguments()[1]);return r.isIdentifier(i)&&O(i,"fcmFromEnv")&&n!==void 0&&r.isObjectLiteralExpression(n)?n:void 0}return t!==void 0&&r.isObjectLiteralExpression(t)?t:void 0},h=(e,s)=>{const t=d(e,s),i=e.getProperties();return t!==void 0&&!i.slice(i.indexOf(t)+1).some(n=>{if(r.isSpreadAssignment(n))return!0;const c=R(n.getNameNode());return c===void 0||c===s})},ee=e=>{const s=d(e,"getAccessToken");if(s===void 0||!h(e,"getAccessToken"))return!1;if(r.isShorthandPropertyAssignment(s)||r.isMethodDeclaration(s))return!0;const t=u(m(e,"getAccessToken"));return t!==void 0&&(r.isArrowFunction(t)||r.isFunctionExpression(t)||r.isCallExpression(t)||r.isPropertyAccessExpression(t)||r.isIdentifier(t)&&t.getText()!=="undefined")},te=e=>{const s=u(m(e,"projectId"));return h(e,"projectId")&&s!==void 0&&(r.isStringLiteral(s)||r.isNoSubstitutionTemplateLiteral(s))&&s.getLiteralText()!==""},se=(e,s)=>{const t=d(e,"fcm");if(t===void 0)return"absent";if(!s||!h(e,"fcm"))return"env";const i=r.isMethodDeclaration(t)?t:m(e,"fcm"),n=i===void 0?void 0:Z(i);return n===void 0||!ee(n)?"env":te(n)?"ownCredentials":"ownToken"},ie=(e,s)=>{const t=D(s,z);if(!I(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),n=A(i);if(!n||!r.isCallExpression(n))return y;const c=n.getExpression(),o=r.isIdentifier(c)&&O(c,"defineNotify")?n.getArguments()[0]:void 0,a=o===void 0?void 0:J(o);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?y:{fcm:se(a,r.isObjectLiteralExpression(o)),hasWebPush:d(a,"webPush")!==void 0}},pe=(e,s)=>{const t=ie(e,s);if(t===void 0)return;const i=B(e,s);return{hasFcm:t.fcm!=="absent",hasWebPush:t.hasWebPush,usesFcmOnlySend:i.has("sendToTopic")||i.has("sendToCondition"),usesPush:i.size>0}};export{y as ALL_NOTIFY_CHANNELS,z as NOTIFY_FILENAME,de as discoverNotifyCalls,ie as discoverNotifyChannels,pe as discoverNotifyConfig};
1
+ import{existsSync as I}from"node:fs";import{join as D}from"node:path";import{SyntaxKind as l,Node as r,VariableDeclarationKind as L}from"ts-morph";import{listLunoraSourceFiles as E,lunoraRelativePath as C,descendantsOfKind as v,findObjectProperty as d,defaultExportExpression as k,propertyInitializer as m,handlerOf as w,unwrapExpression as u}from"./isTestPath-Uwb5a6Kq.mjs";import{j as M,h as _}from"./attribution-Cwt30DDJ.mjs";import{a as p}from"./context-root-hthkpwQe.mjs";import{c as j}from"./classify-procedure-call-BmEirzc_.mjs";import{s as R}from"./property-name-7cBlgK_O.mjs";const z="notify.ts",W=new Set(["chat","inApp","send","webhook"]),S=new Set(["broadcast","send","sendToCondition","sendToTopic"]),H=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=j(s);if(!t)return;const i=w(s,t.receiver);return i?{exportName:_(e)??e.getName(),handler:i,kind:t.kind}:void 0},P=e=>{const s=[];for(const t of M(e)){const i=H(t);i&&s.push(i)}return s},b=e=>p(e,["notify"])?"notify":p(e,["push"])||p(e,["notify","push"])?"push":void 0,U=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=b(e.getExpression());if(t==="notify"&&W.has(s))return`ctx.notify.${s}`;if(t==="push"&&S.has(s))return`ctx.push.${s}`},V=e=>r.isPropertyAccessExpression(e)?b(e.getExpression())==="push"&&S.has(e.getName()):!1,de=(e,s)=>{const t=[];for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i),c=C(s,i);for(const o of P(n))if(!(o.kind!=="query"&&o.kind!=="mutation"))for(const a of v(o.handler,l.PropertyAccessExpression)){const f=U(a);f!==void 0&&t.push({callee:f,exportName:o.exportName,file:c,kind:o.kind,line:a.getStartLineNumber()})}}return t},B=(e,s)=>{const t=new Set;for(const i of E(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i);for(const c of P(n))for(const o of v(c.handler,l.PropertyAccessExpression))V(o)&&t.add(o.getName())}return t},y={fcm:"env",hasWebPush:!0},K=new Set(["@lunora/notify"]),O=(e,s)=>{const t=e.getSymbol();if(!t)return e.getText()===s;for(const i of t.getDeclarations())if(r.isImportSpecifier(i))return K.has(i.getImportDeclaration().getModuleSpecifierValue())?i.getNameNode().getText()===s:!1;return!1},A=(e,s=new Set)=>{const t=k(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const n=i.getAliasedSymbol();if(!n)return t;const c=n.getDeclarations().find(a=>r.isExportAssignment(a));if(!c)return t;const o=c.getSourceFile();if(!s.has(o.getFilePath()))return A(o,s.add(o.getFilePath()))},Y=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),x=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},N=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return N(e.getExpression())},g=(e,s)=>{const t=N(e);return t!==void 0&&x(t)===s},$=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),n=t.getExpression(),c=r.isIdentifier(n)?n.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&c==="Object"||i==="set"&&c==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&x(a)===s},q=(e,s)=>{if(r.isBinaryExpression(e))return Y.has(e.getOperatorToken().getText())&&g(e.getLeft(),s);if(r.isDeleteExpression(e))return g(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===l.PlusPlusToken||t===l.MinusMinusToken)&&g(e.getOperand(),s)}return r.isCallExpression(e)?$(e,s):!1},G=(e,s)=>{const t=x(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(n=>q(n,t)))},J=e=>{if(r.isObjectLiteralExpression(e))return e;if(!r.isIdentifier(e))return;const s=e.getSymbol(),t=s?.getAliasedSymbol()?.getDeclarations()??s?.getDeclarations()??[];for(const i of t){if(!r.isVariableDeclaration(i))continue;const n=i.getInitializer();if(!n||!r.isObjectLiteralExpression(n))continue;const c=i.getParent();if(!r.isVariableDeclarationList(c)||c.getDeclarationKind()!==L.Const)continue;const o=[i.getSourceFile(),e.getSourceFile()].filter((a,f,T)=>T.findIndex(F=>F.getFilePath()===a.getFilePath())===f);if(!G(e,o))return n}},Q=e=>r.isArrowFunction(e)||r.isFunctionExpression(e)||r.isMethodDeclaration(e),X=e=>{const s=e.getBody();if(!r.isBlock(s))return s;const[t,...i]=s.getStatements();return i.length===0&&r.isReturnStatement(t)?t.getExpression():void 0},Z=e=>{const s=u(e),t=u(s!==void 0&&Q(s)?X(s):s);if(t!==void 0&&r.isCallExpression(t)){const i=t.getExpression(),n=u(t.getArguments()[1]);return r.isIdentifier(i)&&O(i,"fcmFromEnv")&&n!==void 0&&r.isObjectLiteralExpression(n)?n:void 0}return t!==void 0&&r.isObjectLiteralExpression(t)?t:void 0},h=(e,s)=>{const t=d(e,s),i=e.getProperties();return t!==void 0&&!i.slice(i.indexOf(t)+1).some(n=>{if(r.isSpreadAssignment(n))return!0;const c=R(n.getNameNode());return c===void 0||c===s})},ee=e=>{const s=d(e,"getAccessToken");if(s===void 0||!h(e,"getAccessToken"))return!1;if(r.isShorthandPropertyAssignment(s)||r.isMethodDeclaration(s))return!0;const t=u(m(e,"getAccessToken"));return t!==void 0&&(r.isArrowFunction(t)||r.isFunctionExpression(t)||r.isCallExpression(t)||r.isPropertyAccessExpression(t)||r.isIdentifier(t)&&t.getText()!=="undefined")},te=e=>{const s=u(m(e,"projectId"));return h(e,"projectId")&&s!==void 0&&(r.isStringLiteral(s)||r.isNoSubstitutionTemplateLiteral(s))&&s.getLiteralText()!==""},se=(e,s)=>{const t=d(e,"fcm");if(t===void 0)return"absent";if(!s||!h(e,"fcm"))return"env";const i=r.isMethodDeclaration(t)?t:m(e,"fcm"),n=i===void 0?void 0:Z(i);return n===void 0||!ee(n)?"env":te(n)?"ownCredentials":"ownToken"},ie=(e,s)=>{const t=D(s,z);if(!I(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),n=A(i);if(!n||!r.isCallExpression(n))return y;const c=n.getExpression(),o=r.isIdentifier(c)&&O(c,"defineNotify")?n.getArguments()[0]:void 0,a=o===void 0?void 0:J(o);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?y:{fcm:se(a,r.isObjectLiteralExpression(o)),hasWebPush:d(a,"webPush")!==void 0}},pe=(e,s)=>{const t=ie(e,s);if(t===void 0)return;const i=B(e,s);return{hasFcm:t.fcm!=="absent",hasWebPush:t.hasWebPush,usesFcmOnlySend:i.has("sendToTopic")||i.has("sendToCondition"),usesPush:i.size>0}};export{y as ALL_NOTIFY_CHANNELS,z as NOTIFY_FILENAME,de as discoverNotifyCalls,ie as discoverNotifyChannels,pe as discoverNotifyConfig};
@@ -0,0 +1 @@
1
+ import{existsSync as O}from"node:fs";import{join as j}from"node:path";import{containerClassName as A,containerBindingName as k,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as C,isManagedImage as _,isCloudflareRegistryDigest as D,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{declarationLineOf as M,stringPropertyFor as F,findObjectProperty as p,symbolConstInitializer as V,descendantsOfKind as K,outermostValueWrapper as w,isWriteTarget as R}from"./isTestPath-Uwb5a6Kq.mjs";import{a as B}from"./attribution-Cwt30DDJ.mjs";import{a as b}from"./property-name-7cBlgK_O.mjs";const E="containers.ts",N=E.replace(/\.ts$/u,""),U=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(s.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},d=F("container"),y=(t,e,r)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${r}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},L=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&s.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return f({registry:d(i,e,"image.registry")})}const n=p(t,"build");if(n&&s.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return f({build:d(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},Y=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),z=new Set(["gracePeriodSeconds","stepPercentage"]),T=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},W=(t,e)=>K(e,$.Identifier).some(r=>{if(r.getSymbol()!==t)return!1;let n=w(r),i=n.getParent();if(s.isCallExpression(i)&&i.getExpression().getText()==="Object.assign")return i.getArguments()[0]===n;for(;(s.isPropertyAccessExpression(i)||s.isElementAccessExpression(i))&&i.getExpression()===n;){if(R(i))return!0;n=w(i),i=n.getParent()}return!1}),q=16,P=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<q;c+=1){const l=V(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=T(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&W(i.symbol,e.getSourceFile()))throw a(e,`${n}: \`${i.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;i={name:o.getText(),symbol:o.getSymbol()}}return o},I=(t,e)=>{const r=T(t);return s.isIdentifier(r)?P(r.getSymbol(),r,r.getText(),e)??r:r},x=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},H=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(x(n))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(i.length>0)throw a(t,`${r}: this spread can set ${i.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},J=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?P(t.getValueSymbol(),t,n,r):void 0;if(i!==void 0)return[n,i];if(e==="every"||e.has(n))throw a(t,`${r}: \`${n}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,r,n=new Set)=>{const i=[],o=new Set(n).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))i.push([b(c),I(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...X(c,e,r,o));else{const l=J(c,e,r);l!==void 0&&i.push(l)}return i},X=(t,e,r,n)=>{const i=I(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return H(t,e,r),[];if(n.has(i))throw a(t,`${r}: this spread refers back to an object it is part of, so it has no static value.`);return m(i,e,r,n)},G=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" buildArgs`))r[n]=d(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},Q=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,z,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=y(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},S=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},Z=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!s.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=b(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=y(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},ee=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`images\` must be a static object literal — codegen writes it into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" images`)){const o=L(i,e);if(o.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!D(o.reference))throw a(i,`container "${e}": \`images["${n}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);r[n]=o}return r},te=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=d(r[1],e,"schedulingPolicy");if(n!=="default"&&n!=="durable_object")throw a(r[1],`container "${e}": unknown \`schedulingPolicy\` "${n}" — use "default" or "durable_object"`);return n==="durable_object"?n:void 0},ne=(t,e,r,n)=>{if(r!==void 0&&C.includes(t))throw a(e,`container "${n}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(r===void 0&&t==="images")throw a(e,`container "${n}": \`images\` needs schedulingPolicy "durable_object"`)},ie=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=G(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=L(e,n));break}case"images":{o.images=ee(e,n);break}case"instanceType":{i.instanceType=Z(e,n);break}case"maxInstances":{o.maxInstances=y(e,n,"maxInstances");break}case"name":{i.name=d(e,n,"name");break}case"rollout":{o.rollout=Q(e,n);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${n}": \`sandbox\` must be a static true/false literal`);i.sandbox=c;break}case"sleepAfter":{i.sleepAfter=S(e);break}}},re=(t,e,r)=>{const n=t.findLast(([o])=>o==="image")?.[1];if(n===void 0||!(s.isStringLiteral(n)||s.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!_(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},se=(t,e)=>{const r=t.getArguments()[0];if(!r||!s.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,Y,`container "${e}"`),i=te(n,e),o={base:{bindingName:k(e),className:A(e),exportName:e,file:N,line:M(t)},policy:{},scheduled:i!==void 0};for(const[g,u]of n)ne(g,u,i,e),ie(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return re(n,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:i};if(l.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},oe=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){const i=n.getInitializer();if(i?.getKind()!==$.CallExpression)continue;const o=i,c=o.getExpression();if(!s.isIdentifier(c)||!U(c))continue;const l=n.getNameNode();if(!s.isIdentifier(l)){if(n.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=B(n,"binding");if(g===void 0)continue;const u=se(o,g),h=r.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);r.set(u.bindingName,u.exportName),e.push(u)}return e},be=(t,e)=>{const r=j(e,E);if(!O(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=oe(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{E as CONTAINERS_FILENAME,be as discoverContainers};
@@ -1 +1 @@
1
- import{existsSync as l}from"node:fs";import{join as d}from"node:path";import{SyntaxKind as c,Node as i}from"ts-morph";import{diagnosticAt as f}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as m}from"./module-specifiers-BctA0m_p.mjs";import{a as u}from"./attribution-C3R6vQrY.mjs";const p="env.ts",g=e=>{const n=e.getSymbol();if(!n)return e.getText()==="defineEnv";for(const t of n.getDeclarations())if(i.isImportSpecifier(t))return m(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineEnv":!1;return!1},v=e=>{const n=e.getSymbol();if(!n)return!1;for(const t of n.getDeclarations()){if(!i.isNamespaceImport(t))continue;const o=t.getFirstAncestorByKind(c.ImportDeclaration);return o!==void 0&&m(o.getModuleSpecifierValue())}return!1},E=e=>{if(i.isIdentifier(e))return g(e);if(i.isPropertyAccessExpression(e)){const n=e.getExpression();return e.getName()==="defineEnv"&&i.isIdentifier(n)&&v(n)}return!1},x=e=>{const n=[];for(const t of e.getVariableDeclarations()){const o=t.getInitializer();if(o?.getKind()!==c.CallExpression||!E(o.getExpression()))continue;const s=t.getNameNode();if(!i.isIdentifier(s)){if(t.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw f(s,"defineEnv exports must be plain named exports (no destructuring)")}const a=u(t,"member");a!==void 0&&n.push({exportName:a})}return n},D=(e,n)=>{const t=d(n,p);if(!l(t))return;const o=e.getSourceFile(t)??e.addSourceFileAtPath(t),r=x(o);if(r.length!==0){if(r.length>1)throw f(o,`lunora/env.ts declares ${r.length.toString()} defineEnv() contracts (${r.map(s=>s.exportName).join(", ")}); exactly one is allowed`);return r[0]}};export{p as ENV_FILENAME,D as discoverEnv};
1
+ import{existsSync as l}from"node:fs";import{join as d}from"node:path";import{SyntaxKind as c,Node as i}from"ts-morph";import{diagnosticAt as f}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as m}from"./module-specifiers-BctA0m_p.mjs";import{a as u}from"./attribution-Cwt30DDJ.mjs";const p="env.ts",g=e=>{const n=e.getSymbol();if(!n)return e.getText()==="defineEnv";for(const t of n.getDeclarations())if(i.isImportSpecifier(t))return m(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineEnv":!1;return!1},v=e=>{const n=e.getSymbol();if(!n)return!1;for(const t of n.getDeclarations()){if(!i.isNamespaceImport(t))continue;const o=t.getFirstAncestorByKind(c.ImportDeclaration);return o!==void 0&&m(o.getModuleSpecifierValue())}return!1},E=e=>{if(i.isIdentifier(e))return g(e);if(i.isPropertyAccessExpression(e)){const n=e.getExpression();return e.getName()==="defineEnv"&&i.isIdentifier(n)&&v(n)}return!1},x=e=>{const n=[];for(const t of e.getVariableDeclarations()){const o=t.getInitializer();if(o?.getKind()!==c.CallExpression||!E(o.getExpression()))continue;const s=t.getNameNode();if(!i.isIdentifier(s)){if(t.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw f(s,"defineEnv exports must be plain named exports (no destructuring)")}const a=u(t,"member");a!==void 0&&n.push({exportName:a})}return n},D=(e,n)=>{const t=d(n,p);if(!l(t))return;const o=e.getSourceFile(t)??e.addSourceFileAtPath(t),r=x(o);if(r.length!==0){if(r.length>1)throw f(o,`lunora/env.ts declares ${r.length.toString()} defineEnv() contracts (${r.map(s=>s.exportName).join(", ")}); exactly one is allowed`);return r[0]}};export{p as ENV_FILENAME,D as discoverEnv};
@@ -1 +1 @@
1
- import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-6GN3Bkus.mjs";const d="flags.ts",u=new Set(["@lunora/flags/providers/flagship","lunorash/flags/flagship"]),m=e=>{const i=e.getSymbol();if(!i)return e.getText()==="flagshipProvider";for(const r of i.getDeclarations())if(t.isImportSpecifier(r))return u.has(r.getImportDeclaration().getModuleSpecifierValue())?r.getNameNode().getText()==="flagshipProvider":!1;return!1},v=(e,i)=>{const r=c(e,i);if(!r||!t.isPropertyAssignment(r))return;const o=r.getInitializerOrThrow();if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()},h=e=>{const i=e.getArguments()[0];if(i&&t.isObjectLiteralExpression(i)){const r=v(i,"binding");if(r!==void 0&&r.length>0)return{bindingName:r,mode:"binding",provider:"flagship"}}return{mode:"http",provider:"flagship"}},S=e=>f(e.getArguments()[0],"provider"),b=(e,i)=>{const r=p(i,d);if(!l(r))return;const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=g(o);if(!n||!t.isCallExpression(n))return{provider:"custom"};const s=S(n);if(s&&t.isCallExpression(s)){const a=s.getExpression();if(t.isIdentifier(a)&&m(a))return h(s)}return{provider:"custom"}};export{d as FLAGS_FILENAME,b as discoverFlags};
1
+ import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-Uwb5a6Kq.mjs";const d="flags.ts",u=new Set(["@lunora/flags/providers/flagship","lunorash/flags/flagship"]),m=e=>{const i=e.getSymbol();if(!i)return e.getText()==="flagshipProvider";for(const r of i.getDeclarations())if(t.isImportSpecifier(r))return u.has(r.getImportDeclaration().getModuleSpecifierValue())?r.getNameNode().getText()==="flagshipProvider":!1;return!1},v=(e,i)=>{const r=c(e,i);if(!r||!t.isPropertyAssignment(r))return;const o=r.getInitializerOrThrow();if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()},h=e=>{const i=e.getArguments()[0];if(i&&t.isObjectLiteralExpression(i)){const r=v(i,"binding");if(r!==void 0&&r.length>0)return{bindingName:r,mode:"binding",provider:"flagship"}}return{mode:"http",provider:"flagship"}},S=e=>f(e.getArguments()[0],"provider"),b=(e,i)=>{const r=p(i,d);if(!l(r))return;const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=g(o);if(!n||!t.isCallExpression(n))return{provider:"custom"};const s=S(n);if(s&&t.isCallExpression(s)){const a=s.getExpression();if(t.isIdentifier(a)&&m(a))return h(s)}return{provider:"custom"}};export{d as FLAGS_FILENAME,b as discoverFlags};
@@ -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-6GN3Bkus.mjs";import{g as b,i as D,d as g,h as O}from"./attribution-C3R6vQrY.mjs";import{u as h}from"./unwrap-handler-return-DhdSnAfS.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
+ import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as M}from"./module-specifiers-BctA0m_p.mjs";import{p as A}from"./parse-validator-BisfC8bR.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-Uwb5a6Kq.mjs";import{g as b,i as D,d as g,h as O}from"./attribution-Cwt30DDJ.mjs";import{u as h}from"./unwrap-handler-return-DvbyiLjc.mjs";const w="mutators.ts",x=M,z=r=>{const e=r.getSymbol();if(!e)return r.getText()==="defineMutator";for(const t of e.getDeclarations())if(o.isImportSpecifier(t))return x(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineMutator":!1;return!1},C=r=>{const e=r.getSymbol();if(!e)return!1;for(const t of e.getDeclarations()){if(!o.isNamespaceImport(t))continue;const i=t.getFirstAncestorByKind(l.ImportDeclaration);return i!==void 0&&x(i.getModuleSpecifierValue())}return!1},N=r=>{if(o.isIdentifier(r))return z(r);if(o.isPropertyAccessExpression(r)){const e=r.getExpression();return r.getName()==="defineMutator"&&o.isIdentifier(e)&&C(e)}return!1},S=r=>{const e=r.getArguments()[0];return e&&o.isObjectLiteralExpression(e)?e:void 0},m=new WeakMap,p=r=>{let e=m.get(r.compilerNode);if(e===void 0){const t=r.getNameNode(),i=t?.getText();e=r.getSourceFile().getDescendantsOfKind(l.Identifier).filter(s=>s!==t&&s.getText()===i&&g(s)?.compilerNode===r.compilerNode).length===1&&O(r)===void 0,m.set(r.compilerNode,e)}return e},f=r=>{const e=o.isIdentifier(r)?g(r):void 0,t=o.isSourceFile(e?.getParent())||o.isSourceFile(e?.getParent()?.getParent()?.getParent());if(e===void 0||e.getSourceFile()!==r?.getSourceFile()||!t)return;if(o.isFunctionDeclaration(e))return e.hasBody()&&p(e)?e:void 0;const i=P(e)?d(e.getInitializer()):void 0;return(o.isArrowFunction(i)||o.isFunctionExpression(i))&&o.isVariableDeclaration(e)&&p(e)?i:void 0},G=r=>{const e=r.getInitializer();if(!o.isCallExpression(e)||!N(e.getExpression()))return;const t=c(S(e),"server");if(o.isMethodDeclaration(t))return t;if(o.isShorthandPropertyAssignment(t))return f(t.getNameNode());const i=o.isPropertyAssignment(t)?d(t.getInitializer()):void 0;return o.isArrowFunction(i)||o.isFunctionExpression(i)?i:f(i)},T=r=>{const e=c(r,"args");if(!e||!o.isPropertyAssignment(e))return{};const t=e.getInitializer();return t&&o.isObjectLiteralExpression(t)?A(t):{}},L=r=>{const e=c(r,"server");if(!e||!o.isPropertyAssignment(e))return"unknown";const t=e.getInitializer();return!t||!(o.isArrowFunction(t)||o.isFunctionExpression(t))?"unknown":h(t)},j=r=>{const e=c(r,"owner");if(!e||!o.isPropertyAssignment(e))return;const t=e.getInitializer();return t&&o.isStringLiteral(t)?t.getLiteralValue():void 0},R=r=>{const e=[];for(const t of r.getVariableDeclarations()){if(!t.isExported())continue;const i=t.getInitializer();if(i?.getKind()!==l.CallExpression)continue;const n=i,s=n.getExpression();if(!N(s))continue;const a=t.getNameNode();if(!o.isIdentifier(a))throw I(a,"defineMutator exports must be plain named exports (no destructuring)");const u=S(n);for(const v of b(t).filter(F=>D(F)))e.push({args:T(u),exportName:v,filePath:"mutators",line:n.getStartLineNumber(),owner:j(u),returnType:L(u)})}return e},J=(r,e)=>{const t=y(e,w);if(!E(t))return[];const i=r.getSourceFile(t)??r.addSourceFileAtPath(t),n=R(i);return n.sort((s,a)=>s.exportName.localeCompare(a.exportName)),n};export{w as MUTATORS_FILENAME,J as discoverMutators,N as isDefineMutatorCallee,S as mutatorLiteral,G as mutatorServerImplOf};
@@ -1,3 +1,3 @@
1
- import{m}from"./modules-5z0rLSZk.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{validatorIrToJsonSchema as p,objectSchema as l,LUNORA_ERROR_CODES as d}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{G as h}from"./shared-Cn7dMQ_u.mjs";import{s as i}from"./dispatch-namespace-DwTjD7BU.mjs";const R="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},O=(e,r)=>e==="stream"?`Open the \`stream\` \`${r}\` over the Lunora WebSocket. It yields chunks rather than one result, so its \`result\` schema is a placeholder.`:`Invoke the \`${e}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${r}", "args": { … } }\`).`,S=(e,r)=>{const o=`${i(e.filePath)}:${e.exportName}`;return{description:O(e.kind,o),errors:d.map((s,a)=>({code:-32e3-a,data:{code:s},message:s})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:l(e.args)}],result:{name:"result",schema:e.output&&e.kind!=="stream"?p(e.output):g},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,...e.description?{"x-lunora-description":e.description}:{},"x-tags":[{name:r}]}},v=e=>{const r=e.version??"0.0.0",n=e.functions.filter(t=>t.visibility!=="internal"),o=e.modules??[],s=n.map(t=>S(t,m(o,t.filePath))).toSorted((t,c)=>t.name.localeCompare(c.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:r},methods:s,openrpc:R}},E=e=>`${JSON.stringify(v(e),void 0,2)}
1
+ import{m}from"./modules-DdOd-7Wp.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{validatorIrToJsonSchema as p,objectSchema as l,LUNORA_ERROR_CODES as d}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{G as h}from"./shared-Cn7dMQ_u.mjs";import{s as i}from"./dispatch-namespace-DwTjD7BU.mjs";const R="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},O=(e,r)=>e==="stream"?`Open the \`stream\` \`${r}\` over the Lunora WebSocket. It yields chunks rather than one result, so its \`result\` schema is a placeholder.`:`Invoke the \`${e}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${r}", "args": { … } }\`).`,S=(e,r)=>{const o=`${i(e.filePath)}:${e.exportName}`;return{description:O(e.kind,o),errors:d.map((s,a)=>({code:-32e3-a,data:{code:s},message:s})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:l(e.args)}],result:{name:"result",schema:e.output&&e.kind!=="stream"?p(e.output):g},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,...e.description?{"x-lunora-description":e.description}:{},"x-tags":[{name:r}]}},v=e=>{const r=e.version??"0.0.0",n=e.functions.filter(t=>t.visibility!=="internal"),o=e.modules??[],s=n.map(t=>S(t,m(o,t.filePath))).toSorted((t,c)=>t.name.localeCompare(c.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:r},methods:s,openrpc:R}},E=e=>`${JSON.stringify(v(e),void 0,2)}
2
2
  `,N=e=>`${h}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
3
3
  `;export{R as OPENRPC_VERSION,v as buildOpenRpcDocument,E as emitOpenRpc,N as emitOpenRpcModule};
@@ -0,0 +1 @@
1
+ import{existsSync as q}from"node:fs";import{join as f}from"node:path";import{LunoraError as b}from"@lunora/errors";import{queueDefaultName as y,queueBindingName as S}from"@lunora/queue";import{SyntaxKind as w,Node as u}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{declarationLineOf as N,lunoraRelativePath as g,findObjectProperty as l,stringPropertyFor as v}from"./isTestPath-Uwb5a6Kq.mjs";import{a as $}from"./attribution-Cwt30DDJ.mjs";import{r as F}from"./handler-reference-BkOkxxg8.mjs";import{d as P}from"./modules-DdOd-7Wp.mjs";const h="queues.ts",E=o=>{const e=t=>t==="defineQueue"||t==="defineSubscription"||t==="defineTopic",i=o.getSymbol();if(!i){const t=o.getText();return e(t)?t:void 0}for(const t of i.getDeclarations()){if(!u.isImportSpecifier(t))continue;if(t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/queue")return;const n=t.getNameNode().getText();return e(n)?n:void 0}},d=v("queue"),I=(o,e,i)=>{if(u.isNumericLiteral(o))return o.getLiteralValue();throw c(o,`queue "${e}": \`${i}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`)},A={maxBatchSize:{integer:!0,max:100,min:1},maxBatchTimeout:{integer:!1,max:60,min:0},maxConcurrency:{integer:!0,max:250,min:1},maxRetries:{integer:!0,max:100,min:0},retryDelay:{integer:!0,max:86400,min:0}},T=(o,e)=>{const i={};for(const[t,n]of Object.entries(A)){const s=l(o,t);if(s&&u.isPropertyAssignment(s)){const a=I(s.getInitializerOrThrow(),e,t);if(a<n.min||a>n.max||n.integer&&!Number.isInteger(a))throw c(s,`queue "${e}": \`${t}\` must be ${n.integer?"an integer":"a number"} from ${n.min.toString()} to ${n.max.toString()} (got ${a.toString()})`);i[t]=a}}return i},O=(o,e)=>{const i=l(o,"name");if(!i||!u.isPropertyAssignment(i))return;const t=d(i.getInitializerOrThrow(),e,"name");if(t.length===0)throw c(i,`queue "${e}": \`name\` must be a non-empty string when provided`);return t},x=(o,e,i,t)=>{const n=F(l(o,"handler"),t)?.site,s={bindingName:S(e),exportName:e,filePath:g(t,o.getSourceFile().getFilePath()),line:N(o),mode:"push",name:O(o,e)??y(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)})`);s.mode=m}const r=l(o,"deadLetterQueue");return r&&u.isPropertyAssignment(r)&&(s.tuning.deadLetterQueue=d(r.getInitializerOrThrow(),e,"deadLetterQueue")),Object.assign(s.tuning,T(o,e)),s},Q=(o,e,i)=>{const t=o.getArguments()[0];if(!t||!u.isObjectLiteralExpression(t))throw c(o,`queue "${e}": defineQueue must be passed an inline object literal`);return x(t,e,void 0,i)},p=(o,e)=>`${o}:${e}`,L=o=>{const e=o.getSymbol(),i=(e?.isAlias()===!0?e.getAliasedSymbol():e)?.getDeclarations()[0];return i!==void 0&&u.isVariableDeclaration(i)?p(i.getSourceFile().getFilePath(),i.getName()):p(o.getSourceFile().getFilePath(),o.getText())},U=(o,e,i,t)=>{const[n,s]=o.getArguments(),a=n!==void 0&&u.isIdentifier(n)?i.get(L(n)):void 0;if(a===void 0)throw c(n??o,`subscription "${e}": the first argument must name a \`defineTopic()\` export of lunora/queues.ts or a module's queues.ts`);if(!s||!u.isObjectLiteralExpression(s))throw c(o,`subscription "${e}": defineSubscription must be passed an inline object literal`);return x(s,e,a,t)},C=o=>{const e=[];for(const i of o.getVariableDeclarations()){const t=i.getInitializer();if(t?.getKind()!==w.CallExpression)continue;const n=t,s=n.getExpression(),a=u.isIdentifier(s)?E(s):void 0;if(a===void 0)continue;const r=i.getNameNode();if(!u.isIdentifier(r)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw c(r,`${a} exports must be plain named exports (no destructuring)`)}const m=$(i,"binding");m!==void 0&&e.push({call:n,exportName:m,factory:a,localName:r.getText()})}return e},M=(o,e)=>{const i=new Map;for(const t of o){const n=g(e,t.call.getSourceFile().getFilePath()),s=i.get(t.exportName);if(s!==void 0)throw c(t.call,`"${t.exportName}" is exported by both lunora/${s}.ts and lunora/${n}.ts — queue and topic export names must be unique across the app`);i.set(t.exportName,n)}},j=(o,e)=>{const i=o.flatMap(r=>C(r));M(i,e);const t=i.filter(r=>r.factory==="defineTopic"),n=new Map(t.map(r=>[p(r.call.getSourceFile().getFilePath(),r.localName),r.exportName])),s=[];for(const r of i)r.factory==="defineQueue"?s.push(Q(r.call,r.exportName,e)):r.factory==="defineSubscription"&&s.push(U(r.call,r.exportName,n,e));const a=t.map(r=>({exportName:r.exportName,filePath:g(e,r.call.getSourceFile().getFilePath()),line:N(r.call)}));return{queues:s,topics:a}},z=(o,e)=>[f(e,h),...P(o,e).map(i=>f(e,i.name,h))].filter(i=>q(i)),D=o=>{const e=new Map,i=new Map;for(const t of o){const n=e.get(t.name);if(n!==void 0)throw new b("DUPLICATE_QUEUE_NAME",`Duplicate queue name "${t.name}": produced by both "${n}" and "${t.exportName}". Deployed queue names must be unique across the project.`,{status:500});e.set(t.name,t.exportName);const s=i.get(t.bindingName);if(s!==void 0)throw new b("DUPLICATE_QUEUE_BINDING",`Duplicate queue binding "${t.bindingName}": produced by both "${s}" and "${t.exportName}". Queue export names must yield unique binding names.`,{status:500});i.set(t.bindingName,t.exportName)}},B=(o,e)=>{const i=z(o,e).map(a=>o.getSourceFile(a)??o.addSourceFileAtPath(a)),{queues:t,topics:n}=j(i,e),s=t.toSorted((a,r)=>a.exportName.localeCompare(r.exportName));return D(s),{queues:s,topics:n.toSorted((a,r)=>a.exportName.localeCompare(r.exportName))}},Y=(o,e)=>B(o,e).queues;export{h as QUEUES_FILENAME,B as discoverQueueDeclarations,Y as discoverQueues};