@lunora/codegen 1.0.0-alpha.413 → 1.0.0-alpha.415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/QUEUES_FILENAME-DbuJZnrY.mjs +1 -0
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-B5SiBRC5.mjs +56 -0
- package/dist/packem_shared/describeErrorLevelFindings-DlkgCw8a.mjs +1 -0
- package/dist/packem_shared/{discoverMaskProcedures-0XApH-Nk.mjs → discoverMaskProcedures-BP5xoh6C.mjs} +1 -1
- package/dist/packem_shared/discoverSchema-BLTROO8Z.mjs +1 -0
- package/dist/packem_shared/formatAdvisories-Bue5tbp6.mjs +2 -0
- package/dist/packem_shared/index-yvrCfBqR.mjs +1 -0
- package/package.json +2 -2
- package/dist/packem_shared/QUEUES_FILENAME-_Efg09WH.mjs +0 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME--_3sHRKX.mjs +0 -54
- package/dist/packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs +0 -1
- package/dist/packem_shared/discoverSchema-QwVC9oua.mjs +0 -1
- package/dist/packem_shared/formatAdvisories-MxBW1MCl.mjs +0 -2
- package/dist/packem_shared/index-BAkOcSfE.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;
|
|
@@ -2353,6 +2381,8 @@ interface TopicIR {
|
|
|
2353
2381
|
exportName: string;
|
|
2354
2382
|
/** The declaring file, as {@link QueueIR.filePath}. */
|
|
2355
2383
|
filePath: string;
|
|
2384
|
+
/** 1-based start line of the `defineTopic(...)` statement, when recorded. */
|
|
2385
|
+
line?: number;
|
|
2356
2386
|
}
|
|
2357
2387
|
/**
|
|
2358
2388
|
* A module: a folder under `lunora/` whose `module.ts` default-exports
|
|
@@ -2577,6 +2607,8 @@ interface WranglerVariableIR {
|
|
|
2577
2607
|
key: string;
|
|
2578
2608
|
/** Heuristic that matched, e.g. `stripe_live_key` / `private_key` / `secret_named_var`. */
|
|
2579
2609
|
kind: string;
|
|
2610
|
+
/** 1-based line of the key inside the `wrangler.jsonc` file, when the reader could locate it. */
|
|
2611
|
+
line?: number;
|
|
2580
2612
|
/** Redacted preview of the value (first few chars + length) for the finding detail — never the full secret. */
|
|
2581
2613
|
preview: string;
|
|
2582
2614
|
}
|
|
@@ -2671,6 +2703,8 @@ interface MaskProcedureIR {
|
|
|
2671
2703
|
exportName: string;
|
|
2672
2704
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2673
2705
|
file: string;
|
|
2706
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2707
|
+
line?: number;
|
|
2674
2708
|
/**
|
|
2675
2709
|
* `(table, column)` pairs this procedure's `mask(policies)` object literal
|
|
2676
2710
|
* declares. Empty when the policies argument is not a statically-readable
|
|
@@ -2899,6 +2933,7 @@ interface LintSchemaOptions {
|
|
|
2899
2933
|
storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
|
|
2900
2934
|
storageUploads?: ReadonlyArray<StorageUploadIR>;
|
|
2901
2935
|
tableWrites?: ReadonlyArray<TableWriteIR>;
|
|
2936
|
+
topics?: ReadonlyArray<TopicIR>;
|
|
2902
2937
|
unboundedLoops?: ReadonlyArray<UnboundedLoopIR>;
|
|
2903
2938
|
unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
|
|
2904
2939
|
vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
|
|
@@ -3841,7 +3876,7 @@ declare const SCHEMA_SNAPSHOT_FILENAME = ".lunora-schema.json";
|
|
|
3841
3876
|
declare const runCodegen: (options: CodegenOptions) => CodegenResult;
|
|
3842
3877
|
declare const sortedUniqueNames: (names: Iterable<string>) => ReadonlyArray<string>;
|
|
3843
3878
|
/** Deduplicated, sorted names of every ERROR-level advisory in `advisories`. */
|
|
3844
|
-
declare const errorAdvisoryNames: (advisories: ReadonlyArray<Pick<Finding, "level" | "name">>) => ReadonlyArray<string>;
|
|
3879
|
+
declare const errorAdvisoryNames: (advisories: ReadonlyArray<Pick<Finding, "level" | "name" | "suppressed">>) => ReadonlyArray<string>;
|
|
3845
3880
|
/** Deduplicated, sorted names of every error-level platform diagnostic in `platformDiagnostics`. */
|
|
3846
3881
|
declare const errorPlatformDiagnosticNames: (platformDiagnostics: ReadonlyArray<Pick<PlatformDiagnostic, "level" | "name">>) => ReadonlyArray<string>;
|
|
3847
3882
|
/**
|
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;
|
|
@@ -2353,6 +2381,8 @@ interface TopicIR {
|
|
|
2353
2381
|
exportName: string;
|
|
2354
2382
|
/** The declaring file, as {@link QueueIR.filePath}. */
|
|
2355
2383
|
filePath: string;
|
|
2384
|
+
/** 1-based start line of the `defineTopic(...)` statement, when recorded. */
|
|
2385
|
+
line?: number;
|
|
2356
2386
|
}
|
|
2357
2387
|
/**
|
|
2358
2388
|
* A module: a folder under `lunora/` whose `module.ts` default-exports
|
|
@@ -2577,6 +2607,8 @@ interface WranglerVariableIR {
|
|
|
2577
2607
|
key: string;
|
|
2578
2608
|
/** Heuristic that matched, e.g. `stripe_live_key` / `private_key` / `secret_named_var`. */
|
|
2579
2609
|
kind: string;
|
|
2610
|
+
/** 1-based line of the key inside the `wrangler.jsonc` file, when the reader could locate it. */
|
|
2611
|
+
line?: number;
|
|
2580
2612
|
/** Redacted preview of the value (first few chars + length) for the finding detail — never the full secret. */
|
|
2581
2613
|
preview: string;
|
|
2582
2614
|
}
|
|
@@ -2671,6 +2703,8 @@ interface MaskProcedureIR {
|
|
|
2671
2703
|
exportName: string;
|
|
2672
2704
|
/** Source file relative to `<projectRoot>/lunora/`, without extension. */
|
|
2673
2705
|
file: string;
|
|
2706
|
+
/** 1-based start line of the declaring statement (the `export const`), without leading comments. */
|
|
2707
|
+
line?: number;
|
|
2674
2708
|
/**
|
|
2675
2709
|
* `(table, column)` pairs this procedure's `mask(policies)` object literal
|
|
2676
2710
|
* declares. Empty when the policies argument is not a statically-readable
|
|
@@ -2899,6 +2933,7 @@ interface LintSchemaOptions {
|
|
|
2899
2933
|
storageKeyAccesses?: ReadonlyArray<StorageKeyAccessIR>;
|
|
2900
2934
|
storageUploads?: ReadonlyArray<StorageUploadIR>;
|
|
2901
2935
|
tableWrites?: ReadonlyArray<TableWriteIR>;
|
|
2936
|
+
topics?: ReadonlyArray<TopicIR>;
|
|
2902
2937
|
unboundedLoops?: ReadonlyArray<UnboundedLoopIR>;
|
|
2903
2938
|
unrestrictedWhereBranches?: ReadonlyArray<UnrestrictedWhereBranchIR>;
|
|
2904
2939
|
vectorNamespaceAccesses?: ReadonlyArray<VectorNamespaceAccessIR>;
|
|
@@ -3841,7 +3876,7 @@ declare const SCHEMA_SNAPSHOT_FILENAME = ".lunora-schema.json";
|
|
|
3841
3876
|
declare const runCodegen: (options: CodegenOptions) => CodegenResult;
|
|
3842
3877
|
declare const sortedUniqueNames: (names: Iterable<string>) => ReadonlyArray<string>;
|
|
3843
3878
|
/** Deduplicated, sorted names of every ERROR-level advisory in `advisories`. */
|
|
3844
|
-
declare const errorAdvisoryNames: (advisories: ReadonlyArray<Pick<Finding, "level" | "name">>) => ReadonlyArray<string>;
|
|
3879
|
+
declare const errorAdvisoryNames: (advisories: ReadonlyArray<Pick<Finding, "level" | "name" | "suppressed">>) => ReadonlyArray<string>;
|
|
3845
3880
|
/** Deduplicated, sorted names of every error-level platform diagnostic in `platformDiagnostics`. */
|
|
3846
3881
|
declare const errorPlatformDiagnosticNames: (platformDiagnostics: ReadonlyArray<Pick<PlatformDiagnostic, "level" | "name">>) => ReadonlyArray<string>;
|
|
3847
3882
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-Bue5tbp6.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-DlkgCw8a.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-yvrCfBqR.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-B5SiBRC5.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};
|
|
@@ -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};
|