@actuallyjamez/elysian 0.8.0 → 0.9.0
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.
|
@@ -65,7 +65,7 @@ export const buildCommand = defineCommand({
|
|
|
65
65
|
// Generate OpenAPI aggregator if enabled
|
|
66
66
|
if (shouldGenerateOpenApi(config)) {
|
|
67
67
|
await writeOpenApiLambda(lambdaFiles, lambdasDir, config, tempDir);
|
|
68
|
-
lambdaFiles.push("
|
|
68
|
+
lambdaFiles.push("openapi.ts");
|
|
69
69
|
}
|
|
70
70
|
// Build phase
|
|
71
71
|
ui.success(`Compiling ${lambdaFiles.length} lambdas...`);
|
|
@@ -74,7 +74,7 @@ export const buildCommand = defineCommand({
|
|
|
74
74
|
const lambdaName = file.replace(/\.ts$/, "");
|
|
75
75
|
const bundleName = getLambdaBundleName(name, lambdaName);
|
|
76
76
|
// For OpenAPI, the source is in tempDir; for regular lambdas, it's in lambdasDir
|
|
77
|
-
const inputPath = file === "
|
|
77
|
+
const inputPath = file === "openapi.ts"
|
|
78
78
|
? join(tempDir, file)
|
|
79
79
|
: join(lambdasDir, file);
|
|
80
80
|
// Create wrapper entry that imports the original and exports handler
|
package/dist/cli/commands/dev.js
CHANGED
|
@@ -162,6 +162,16 @@ export const devCommand = defineCommand({
|
|
|
162
162
|
function listLambdaFiles() {
|
|
163
163
|
return readdirSync(lambdasDir).filter((f) => f.endsWith(".ts") && !f.startsWith("__"));
|
|
164
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all lambda bundle names including the openapi lambda if enabled
|
|
167
|
+
*/
|
|
168
|
+
function getAllLambdaNames() {
|
|
169
|
+
const names = lambdaFiles.map((file) => getLambdaBundleName(name, file.replace(/\.ts$/, "")));
|
|
170
|
+
if (shouldGenerateOpenApi(config)) {
|
|
171
|
+
names.push(getLambdaBundleName(name, "openapi"));
|
|
172
|
+
}
|
|
173
|
+
return names;
|
|
174
|
+
}
|
|
165
175
|
async function ensureInfrastructure(spinnerLabel = "Initializing...") {
|
|
166
176
|
const spinner = spinnerLabel ? createSpinner(spinnerLabel).start() : null;
|
|
167
177
|
const applyResult = usingLocalStack
|
|
@@ -190,7 +200,7 @@ export const devCommand = defineCommand({
|
|
|
190
200
|
httpEndpoint: config.appSyncHttpEndpoint,
|
|
191
201
|
realtimeEndpoint: config.appSyncRealtimeEndpoint,
|
|
192
202
|
apiKey: config.appSyncApiKey,
|
|
193
|
-
lambdaNames:
|
|
203
|
+
lambdaNames: getAllLambdaNames(),
|
|
194
204
|
onInvoke: async (request) => {
|
|
195
205
|
log(`Received invoke: ${request.lambdaName} (${request.requestId})`);
|
|
196
206
|
const response = await runner.invoke(request);
|
|
@@ -245,7 +255,7 @@ export const devCommand = defineCommand({
|
|
|
245
255
|
routes: manifestResult.routes,
|
|
246
256
|
duration: Date.now() - start,
|
|
247
257
|
};
|
|
248
|
-
await appsyncClient.updateLambdas(
|
|
258
|
+
await appsyncClient.updateLambdas(getAllLambdaNames());
|
|
249
259
|
await workerRunner?.reloadAll();
|
|
250
260
|
showReadyScreen(trigger);
|
|
251
261
|
}
|
|
@@ -286,7 +296,7 @@ export const devCommand = defineCommand({
|
|
|
286
296
|
duration: Date.now() - start,
|
|
287
297
|
};
|
|
288
298
|
// Update subscriptions if lambda list changed
|
|
289
|
-
await appsyncClient.updateLambdas(
|
|
299
|
+
await appsyncClient.updateLambdas(getAllLambdaNames());
|
|
290
300
|
// Reload workers to pick up new code
|
|
291
301
|
await workerRunner?.reloadAll();
|
|
292
302
|
showReadyScreen(trigger);
|
|
@@ -296,7 +306,7 @@ export const devCommand = defineCommand({
|
|
|
296
306
|
const filesToBuild = [...lambdaFiles];
|
|
297
307
|
if (shouldGenerateOpenApi(config)) {
|
|
298
308
|
await writeOpenApiLambda(lambdaFiles, lambdasDir, config, tempDir);
|
|
299
|
-
filesToBuild.push("
|
|
309
|
+
filesToBuild.push("openapi.ts");
|
|
300
310
|
}
|
|
301
311
|
await ensureStubBundled();
|
|
302
312
|
for (const file of filesToBuild) {
|
|
@@ -314,7 +324,7 @@ export const devCommand = defineCommand({
|
|
|
314
324
|
async function bundleSingle(filename) {
|
|
315
325
|
const lambdaName = filename.replace(/\.ts$/, "");
|
|
316
326
|
const bundleName = getLambdaBundleName(name, lambdaName);
|
|
317
|
-
const sourcePath = filename === "
|
|
327
|
+
const sourcePath = filename === "openapi.ts"
|
|
318
328
|
? join(tempDir, filename)
|
|
319
329
|
: join(lambdasDir, filename);
|
|
320
330
|
const wrapperPath = join(tempDir, `${lambdaName}-wrapper.ts`);
|
|
@@ -348,7 +358,7 @@ export const devCommand = defineCommand({
|
|
|
348
358
|
try {
|
|
349
359
|
const filesToManifest = [...lambdaFiles];
|
|
350
360
|
if (shouldGenerateOpenApi(config)) {
|
|
351
|
-
filesToManifest.push("
|
|
361
|
+
filesToManifest.push("openapi.ts");
|
|
352
362
|
}
|
|
353
363
|
const manifest = await generateManifest(filesToManifest, outputDir, config.openapi.enabled, name);
|
|
354
364
|
const manifestPath = join(outputDir, "manifest.json");
|
|
@@ -398,6 +408,10 @@ export const devCommand = defineCommand({
|
|
|
398
408
|
if (!filename || !filename.endsWith(".tf")) {
|
|
399
409
|
return;
|
|
400
410
|
}
|
|
411
|
+
// Ignore temp files created during terraform apply
|
|
412
|
+
if (filename === "localstack_providers_override.tf") {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
401
415
|
scheduleBuild(filename, "terraform");
|
|
402
416
|
});
|
|
403
417
|
}
|
package/dist/core/manifest.js
CHANGED
|
@@ -71,11 +71,11 @@ export async function generateManifest(lambdaFiles, outputDir, openapiEnabled =
|
|
|
71
71
|
});
|
|
72
72
|
// Determine which lambda should handle this route
|
|
73
73
|
let targetLambda = bundleName;
|
|
74
|
-
// OpenAPI routes always go to
|
|
74
|
+
// OpenAPI routes always go to openapi lambda if enabled
|
|
75
75
|
if (openapiEnabled && path.startsWith("/openapi")) {
|
|
76
|
-
targetLambda = name ? getLambdaBundleName(name, "
|
|
76
|
+
targetLambda = name ? getLambdaBundleName(name, "openapi") : "openapi";
|
|
77
77
|
}
|
|
78
|
-
else if (originalName === "
|
|
78
|
+
else if (originalName === "openapi") {
|
|
79
79
|
// Skip non-openapi routes from openapi aggregator lambda
|
|
80
80
|
continue;
|
|
81
81
|
}
|
package/dist/core/openapi.js
CHANGED
|
@@ -74,7 +74,7 @@ export const handler = handle(api);
|
|
|
74
74
|
*/
|
|
75
75
|
export async function writeOpenApiLambda(lambdaFiles, lambdasDir, config, tempDir) {
|
|
76
76
|
const source = generateOpenApiLambdaSource(lambdaFiles, lambdasDir, config);
|
|
77
|
-
const outputPath = join(tempDir, "
|
|
77
|
+
const outputPath = join(tempDir, "openapi.ts");
|
|
78
78
|
await Bun.write(outputPath, source);
|
|
79
79
|
return outputPath;
|
|
80
80
|
}
|
|
@@ -88,7 +88,7 @@ export function shouldGenerateOpenApi(config) {
|
|
|
88
88
|
* Clean up the generated OpenAPI lambda file
|
|
89
89
|
*/
|
|
90
90
|
export async function cleanupOpenApiLambda(tempDir) {
|
|
91
|
-
const openApiPath = join(tempDir, "
|
|
91
|
+
const openApiPath = join(tempDir, "openapi.ts");
|
|
92
92
|
try {
|
|
93
93
|
const file = Bun.file(openApiPath);
|
|
94
94
|
if (await file.exists()) {
|
package/dist/core/terraform.js
CHANGED
|
@@ -7,7 +7,7 @@ import { generateRouteName } from "./manifest";
|
|
|
7
7
|
* Generate Terraform tfvars content from manifest
|
|
8
8
|
*/
|
|
9
9
|
export function generateTerraformVars(manifest, config) {
|
|
10
|
-
// Get unique lambda names from routes
|
|
10
|
+
// Get unique lambda names from routes
|
|
11
11
|
const lambdaNames = [...new Set(manifest.routes.map((r) => r.lambda))];
|
|
12
12
|
const routeEntries = manifest.routes.map((route) => {
|
|
13
13
|
const routeName = generateRouteName(route.lambda, route.method, route.path);
|