effortless-aws 0.10.1 → 0.11.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.
- package/dist/cli/index.js +47 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -72516,7 +72516,7 @@ var parseSource = (source) => {
|
|
|
72516
72516
|
const project2 = new Project({ useInMemoryFileSystem: true });
|
|
72517
72517
|
return project2.createSourceFile("input.ts", source);
|
|
72518
72518
|
};
|
|
72519
|
-
var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "onMessage", "setup", "schema", "onError", "deps", "config", "static", "middleware"];
|
|
72519
|
+
var RUNTIME_PROPS = ["name", "onRequest", "onRecord", "onBatchComplete", "onBatch", "onMessage", "setup", "schema", "onError", "deps", "config", "static", "middleware"];
|
|
72520
72520
|
var buildConfigWithoutRuntime = (obj) => {
|
|
72521
72521
|
const props = obj.getProperties().filter((p3) => {
|
|
72522
72522
|
if (p3.getKind() === SyntaxKind.PropertyAssignment) {
|
|
@@ -72656,12 +72656,12 @@ var extractHandlerConfigs = (source, type2) => {
|
|
|
72656
72656
|
if (firstArg && firstArg.getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
72657
72657
|
const objLiteral = firstArg;
|
|
72658
72658
|
const configText = buildConfigWithoutRuntime(objLiteral);
|
|
72659
|
-
const
|
|
72659
|
+
const config2 = new Function(`return ${configText}`)();
|
|
72660
72660
|
const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
|
|
72661
72661
|
const depsKeys = extractDepsKeys(objLiteral);
|
|
72662
72662
|
const paramEntries = extractParamEntries(objLiteral);
|
|
72663
72663
|
const staticGlobs = extractStaticGlobs(objLiteral);
|
|
72664
|
-
results.push({ exportName: "default", config:
|
|
72664
|
+
results.push({ exportName: "default", name: "default", config: config2, hasHandler, depsKeys, paramEntries, staticGlobs });
|
|
72665
72665
|
}
|
|
72666
72666
|
}
|
|
72667
72667
|
}
|
|
@@ -72678,12 +72678,13 @@ var extractHandlerConfigs = (source, type2) => {
|
|
|
72678
72678
|
if (firstArg && firstArg.getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
72679
72679
|
const objLiteral = firstArg;
|
|
72680
72680
|
const configText = buildConfigWithoutRuntime(objLiteral);
|
|
72681
|
-
const
|
|
72681
|
+
const exportName = decl.getName();
|
|
72682
|
+
const config2 = new Function(`return ${configText}`)();
|
|
72682
72683
|
const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
|
|
72683
72684
|
const depsKeys = extractDepsKeys(objLiteral);
|
|
72684
72685
|
const paramEntries = extractParamEntries(objLiteral);
|
|
72685
72686
|
const staticGlobs = extractStaticGlobs(objLiteral);
|
|
72686
|
-
results.push({ exportName:
|
|
72687
|
+
results.push({ exportName, name: exportName, config: config2, hasHandler, depsKeys, paramEntries, staticGlobs });
|
|
72687
72688
|
}
|
|
72688
72689
|
});
|
|
72689
72690
|
});
|
|
@@ -72812,7 +72813,7 @@ var collectRequiredParams = (handlers, project2, stage) => {
|
|
|
72812
72813
|
ssmPath,
|
|
72813
72814
|
propName,
|
|
72814
72815
|
ssmKey,
|
|
72815
|
-
handlerName: fn2.
|
|
72816
|
+
handlerName: fn2.name
|
|
72816
72817
|
});
|
|
72817
72818
|
}
|
|
72818
72819
|
}
|
|
@@ -72944,8 +72945,7 @@ var deployCoreLambda = ({
|
|
|
72944
72945
|
|
|
72945
72946
|
// src/deploy/deploy-http.ts
|
|
72946
72947
|
var deployLambda = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect_exports.gen(function* () {
|
|
72947
|
-
const { exportName, config: config2 } = fn2;
|
|
72948
|
-
const handlerName = config2.name ?? exportName;
|
|
72948
|
+
const { exportName, name: handlerName, config: config2 } = fn2;
|
|
72949
72949
|
const { functionArn, status: status2 } = yield* deployCoreLambda({
|
|
72950
72950
|
input,
|
|
72951
72951
|
exportName,
|
|
@@ -72971,7 +72971,7 @@ var deploy = (input) => Effect_exports.gen(function* () {
|
|
|
72971
72971
|
const targetExport = input.exportName ?? "default";
|
|
72972
72972
|
const fn2 = configs.find((c2) => c2.exportName === targetExport) ?? configs[0];
|
|
72973
72973
|
const config2 = fn2.config;
|
|
72974
|
-
const handlerName =
|
|
72974
|
+
const handlerName = fn2.name;
|
|
72975
72975
|
const tagCtx = {
|
|
72976
72976
|
project: input.project,
|
|
72977
72977
|
stage: resolveStage(input.stage),
|
|
@@ -73048,7 +73048,7 @@ var deployAll = (input) => Effect_exports.gen(function* () {
|
|
|
73048
73048
|
const results = [];
|
|
73049
73049
|
const activeRouteKeys = /* @__PURE__ */ new Set();
|
|
73050
73050
|
for (const fn2 of functions) {
|
|
73051
|
-
const { exportName, functionArn, config: config2 } = yield* deployLambda({
|
|
73051
|
+
const { exportName, functionArn, config: config2, handlerName: fnName } = yield* deployLambda({
|
|
73052
73052
|
input,
|
|
73053
73053
|
fn: fn2,
|
|
73054
73054
|
...layerArn ? { layerArn } : {},
|
|
@@ -73064,7 +73064,7 @@ var deployAll = (input) => Effect_exports.gen(function* () {
|
|
|
73064
73064
|
path: config2.path
|
|
73065
73065
|
});
|
|
73066
73066
|
results.push({ exportName, url: handlerUrl, functionArn });
|
|
73067
|
-
yield* Effect_exports.logDebug(` ${config2.method} ${config2.path} \u2192 ${
|
|
73067
|
+
yield* Effect_exports.logDebug(` ${config2.method} ${config2.path} \u2192 ${fnName}`);
|
|
73068
73068
|
}
|
|
73069
73069
|
yield* removeStaleRoutes(apiId, activeRouteKeys);
|
|
73070
73070
|
yield* Effect_exports.logDebug(`Deployment complete! API: ${apiUrl}`);
|
|
@@ -73086,8 +73086,7 @@ var deployAll = (input) => Effect_exports.gen(function* () {
|
|
|
73086
73086
|
// src/deploy/deploy-table.ts
|
|
73087
73087
|
var TABLE_DEFAULT_PERMISSIONS = ["dynamodb:*", "logs:*"];
|
|
73088
73088
|
var deployTableFunction = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect_exports.gen(function* () {
|
|
73089
|
-
const { exportName, config: config2 } = fn2;
|
|
73090
|
-
const handlerName = config2.name ?? exportName;
|
|
73089
|
+
const { exportName, name: handlerName, config: config2 } = fn2;
|
|
73091
73090
|
const tagCtx = {
|
|
73092
73091
|
project: input.project,
|
|
73093
73092
|
stage: resolveStage(input.stage),
|
|
@@ -73201,8 +73200,7 @@ var deployAllTables = (input) => Effect_exports.gen(function* () {
|
|
|
73201
73200
|
// src/deploy/deploy-app.ts
|
|
73202
73201
|
import { execSync } from "child_process";
|
|
73203
73202
|
var deployAppLambda = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions }) => Effect_exports.gen(function* () {
|
|
73204
|
-
const { exportName, config: config2 } = fn2;
|
|
73205
|
-
const handlerName = config2.name ?? exportName;
|
|
73203
|
+
const { exportName, name: handlerName, config: config2 } = fn2;
|
|
73206
73204
|
if (config2.build) {
|
|
73207
73205
|
yield* Effect_exports.logDebug(`Building site: ${config2.build}`);
|
|
73208
73206
|
yield* Effect_exports.try({
|
|
@@ -73272,9 +73270,8 @@ var deployMiddlewareLambda = (input) => Effect_exports.gen(function* () {
|
|
|
73272
73270
|
});
|
|
73273
73271
|
var deployStaticSite = (input) => Effect_exports.gen(function* () {
|
|
73274
73272
|
const { projectDir, project: project2, region, fn: fn2 } = input;
|
|
73275
|
-
const { exportName, config: config2 } = fn2;
|
|
73273
|
+
const { exportName, name: handlerName, config: config2 } = fn2;
|
|
73276
73274
|
const stage = resolveStage(input.stage);
|
|
73277
|
-
const handlerName = config2.name ?? exportName;
|
|
73278
73275
|
const hasMiddleware = fn2.hasHandler;
|
|
73279
73276
|
const tagCtx = { project: project2, stage, handler: handlerName };
|
|
73280
73277
|
if (config2.build) {
|
|
@@ -73374,8 +73371,7 @@ var deployStaticSite = (input) => Effect_exports.gen(function* () {
|
|
|
73374
73371
|
// src/deploy/deploy-fifo-queue.ts
|
|
73375
73372
|
var FIFO_QUEUE_DEFAULT_PERMISSIONS = ["sqs:*", "logs:*"];
|
|
73376
73373
|
var deployFifoQueueFunction = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect_exports.gen(function* () {
|
|
73377
|
-
const { exportName, config: config2 } = fn2;
|
|
73378
|
-
const handlerName = config2.name ?? exportName;
|
|
73374
|
+
const { exportName, name: handlerName, config: config2 } = fn2;
|
|
73379
73375
|
const tagCtx = {
|
|
73380
73376
|
project: input.project,
|
|
73381
73377
|
stage: resolveStage(input.stage),
|
|
@@ -73530,8 +73526,7 @@ var buildTableNameMap = (tableHandlers, project2, stage) => {
|
|
|
73530
73526
|
const map37 = /* @__PURE__ */ new Map();
|
|
73531
73527
|
for (const { exports } of tableHandlers) {
|
|
73532
73528
|
for (const fn2 of exports) {
|
|
73533
|
-
|
|
73534
|
-
map37.set(fn2.exportName, `${project2}-${stage}-${handlerName}`);
|
|
73529
|
+
map37.set(fn2.exportName, `${project2}-${stage}-${fn2.name}`);
|
|
73535
73530
|
}
|
|
73536
73531
|
}
|
|
73537
73532
|
return map37;
|
|
@@ -73592,7 +73587,7 @@ var buildHttpTasks = (ctx, handlers, apiId, results) => {
|
|
|
73592
73587
|
tasks.push(
|
|
73593
73588
|
Effect_exports.gen(function* () {
|
|
73594
73589
|
const env2 = resolveHandlerEnv(fn2.depsKeys, fn2.paramEntries, ctx);
|
|
73595
|
-
const { exportName, functionArn, status: status2, config: config2 } = yield* deployLambda({
|
|
73590
|
+
const { exportName, functionArn, status: status2, config: config2, handlerName } = yield* deployLambda({
|
|
73596
73591
|
input: makeDeployInput(ctx, file7),
|
|
73597
73592
|
fn: fn2,
|
|
73598
73593
|
...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
|
|
@@ -73609,7 +73604,7 @@ var buildHttpTasks = (ctx, handlers, apiId, results) => {
|
|
|
73609
73604
|
path: config2.path
|
|
73610
73605
|
}).pipe(Effect_exports.provide(clients_exports.makeClients({ lambda: { region }, apigatewayv2: { region } })));
|
|
73611
73606
|
results.push({ exportName, url: handlerUrl, functionArn });
|
|
73612
|
-
yield* ctx.logComplete(
|
|
73607
|
+
yield* ctx.logComplete(handlerName, "http", status2);
|
|
73613
73608
|
})
|
|
73614
73609
|
);
|
|
73615
73610
|
}
|
|
@@ -73634,7 +73629,7 @@ var buildTableTasks = (ctx, handlers, results) => {
|
|
|
73634
73629
|
...fn2.staticGlobs.length > 0 ? { staticGlobs: fn2.staticGlobs } : {}
|
|
73635
73630
|
}).pipe(Effect_exports.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, dynamodb: { region } })));
|
|
73636
73631
|
results.push(result);
|
|
73637
|
-
yield* ctx.logComplete(fn2.
|
|
73632
|
+
yield* ctx.logComplete(fn2.name, "table", result.status);
|
|
73638
73633
|
})
|
|
73639
73634
|
);
|
|
73640
73635
|
}
|
|
@@ -73702,7 +73697,7 @@ var buildStaticSiteTasks = (ctx, handlers, results) => {
|
|
|
73702
73697
|
acm: { region: "us-east-1" }
|
|
73703
73698
|
})));
|
|
73704
73699
|
results.push(result);
|
|
73705
|
-
yield* ctx.logComplete(fn2.
|
|
73700
|
+
yield* ctx.logComplete(fn2.name, "site", "updated");
|
|
73706
73701
|
})
|
|
73707
73702
|
);
|
|
73708
73703
|
}
|
|
@@ -73727,7 +73722,7 @@ var buildFifoQueueTasks = (ctx, handlers, results) => {
|
|
|
73727
73722
|
...fn2.staticGlobs.length > 0 ? { staticGlobs: fn2.staticGlobs } : {}
|
|
73728
73723
|
}).pipe(Effect_exports.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, sqs: { region } })));
|
|
73729
73724
|
results.push(result);
|
|
73730
|
-
yield* ctx.logComplete(fn2.
|
|
73725
|
+
yield* ctx.logComplete(fn2.name, "queue", result.status);
|
|
73731
73726
|
})
|
|
73732
73727
|
);
|
|
73733
73728
|
}
|
|
@@ -73815,15 +73810,15 @@ var deployProject = (input) => Effect_exports.gen(function* () {
|
|
|
73815
73810
|
yield* Console_exports.log("");
|
|
73816
73811
|
const manifest = [];
|
|
73817
73812
|
for (const { exports } of httpHandlers)
|
|
73818
|
-
for (const fn2 of exports) manifest.push({ name: fn2.
|
|
73813
|
+
for (const fn2 of exports) manifest.push({ name: fn2.name, type: "http" });
|
|
73819
73814
|
for (const { exports } of tableHandlers)
|
|
73820
|
-
for (const fn2 of exports) manifest.push({ name: fn2.
|
|
73815
|
+
for (const fn2 of exports) manifest.push({ name: fn2.name, type: "table" });
|
|
73821
73816
|
for (const { exports } of appHandlers)
|
|
73822
|
-
for (const fn2 of exports) manifest.push({ name: fn2.
|
|
73817
|
+
for (const fn2 of exports) manifest.push({ name: fn2.name, type: "app" });
|
|
73823
73818
|
for (const { exports } of staticSiteHandlers)
|
|
73824
|
-
for (const fn2 of exports) manifest.push({ name: fn2.
|
|
73819
|
+
for (const fn2 of exports) manifest.push({ name: fn2.name, type: "site" });
|
|
73825
73820
|
for (const { exports } of fifoQueueHandlers)
|
|
73826
|
-
for (const fn2 of exports) manifest.push({ name: fn2.
|
|
73821
|
+
for (const fn2 of exports) manifest.push({ name: fn2.name, type: "queue" });
|
|
73827
73822
|
manifest.sort((a, b) => a.name.localeCompare(b.name));
|
|
73828
73823
|
const logComplete = createLiveProgress(manifest);
|
|
73829
73824
|
const ctx = {
|
|
@@ -74086,8 +74081,8 @@ Deployed ${tableResults.length} table handler(s):`));
|
|
|
74086
74081
|
let foundExport = null;
|
|
74087
74082
|
let handlerType = "http";
|
|
74088
74083
|
for (const { file: file7, exports } of discovered.httpHandlers) {
|
|
74089
|
-
for (const { exportName,
|
|
74090
|
-
if (
|
|
74084
|
+
for (const { exportName, name } of exports) {
|
|
74085
|
+
if (name === targetValue) {
|
|
74091
74086
|
foundFile = file7;
|
|
74092
74087
|
foundExport = exportName;
|
|
74093
74088
|
break;
|
|
@@ -74097,8 +74092,8 @@ Deployed ${tableResults.length} table handler(s):`));
|
|
|
74097
74092
|
}
|
|
74098
74093
|
if (!foundFile) {
|
|
74099
74094
|
for (const { file: file7, exports } of discovered.tableHandlers) {
|
|
74100
|
-
for (const { exportName,
|
|
74101
|
-
if (
|
|
74095
|
+
for (const { exportName, name } of exports) {
|
|
74096
|
+
if (name === targetValue) {
|
|
74102
74097
|
foundFile = file7;
|
|
74103
74098
|
foundExport = exportName;
|
|
74104
74099
|
handlerType = "table";
|
|
@@ -74110,8 +74105,8 @@ Deployed ${tableResults.length} table handler(s):`));
|
|
|
74110
74105
|
}
|
|
74111
74106
|
if (!foundFile) {
|
|
74112
74107
|
for (const { file: file7, exports } of discovered.appHandlers) {
|
|
74113
|
-
for (const { exportName,
|
|
74114
|
-
if (
|
|
74108
|
+
for (const { exportName, name } of exports) {
|
|
74109
|
+
if (name === targetValue) {
|
|
74115
74110
|
foundFile = file7;
|
|
74116
74111
|
foundExport = exportName;
|
|
74117
74112
|
handlerType = "app";
|
|
@@ -74125,18 +74120,18 @@ Deployed ${tableResults.length} table handler(s):`));
|
|
|
74125
74120
|
yield* Console_exports.error(`Error: Handler "${targetValue}" not found`);
|
|
74126
74121
|
yield* Console_exports.log("\nAvailable handlers:");
|
|
74127
74122
|
for (const { exports } of discovered.httpHandlers) {
|
|
74128
|
-
for (const {
|
|
74129
|
-
yield* Console_exports.log(` ${c.cyan("[http]")} ${
|
|
74123
|
+
for (const { name } of exports) {
|
|
74124
|
+
yield* Console_exports.log(` ${c.cyan("[http]")} ${name}`);
|
|
74130
74125
|
}
|
|
74131
74126
|
}
|
|
74132
74127
|
for (const { exports } of discovered.tableHandlers) {
|
|
74133
|
-
for (const {
|
|
74134
|
-
yield* Console_exports.log(` ${c.cyan("[table]")} ${
|
|
74128
|
+
for (const { name } of exports) {
|
|
74129
|
+
yield* Console_exports.log(` ${c.cyan("[table]")} ${name}`);
|
|
74135
74130
|
}
|
|
74136
74131
|
}
|
|
74137
74132
|
for (const { exports } of discovered.appHandlers) {
|
|
74138
|
-
for (const {
|
|
74139
|
-
yield* Console_exports.log(` ${c.cyan("[app]")} ${
|
|
74133
|
+
for (const { name } of exports) {
|
|
74134
|
+
yield* Console_exports.log(` ${c.cyan("[app]")} ${name}`);
|
|
74140
74135
|
}
|
|
74141
74136
|
}
|
|
74142
74137
|
return;
|
|
@@ -74218,7 +74213,7 @@ var discoverCodeHandlers = (projectDir, patterns) => {
|
|
|
74218
74213
|
for (const { exports } of discovered.httpHandlers) {
|
|
74219
74214
|
for (const fn2 of exports) {
|
|
74220
74215
|
handlers.push({
|
|
74221
|
-
name: fn2.
|
|
74216
|
+
name: fn2.name,
|
|
74222
74217
|
type: "http",
|
|
74223
74218
|
method: fn2.config.method,
|
|
74224
74219
|
path: fn2.config.path
|
|
@@ -74228,7 +74223,7 @@ var discoverCodeHandlers = (projectDir, patterns) => {
|
|
|
74228
74223
|
for (const { exports } of discovered.tableHandlers) {
|
|
74229
74224
|
for (const fn2 of exports) {
|
|
74230
74225
|
handlers.push({
|
|
74231
|
-
name: fn2.
|
|
74226
|
+
name: fn2.name,
|
|
74232
74227
|
type: "table"
|
|
74233
74228
|
});
|
|
74234
74229
|
}
|
|
@@ -74236,7 +74231,7 @@ var discoverCodeHandlers = (projectDir, patterns) => {
|
|
|
74236
74231
|
for (const { exports } of discovered.appHandlers) {
|
|
74237
74232
|
for (const fn2 of exports) {
|
|
74238
74233
|
handlers.push({
|
|
74239
|
-
name: fn2.
|
|
74234
|
+
name: fn2.name,
|
|
74240
74235
|
type: "app",
|
|
74241
74236
|
path: fn2.config.path
|
|
74242
74237
|
});
|
|
@@ -74245,7 +74240,7 @@ var discoverCodeHandlers = (projectDir, patterns) => {
|
|
|
74245
74240
|
for (const { exports } of discovered.staticSiteHandlers) {
|
|
74246
74241
|
for (const fn2 of exports) {
|
|
74247
74242
|
handlers.push({
|
|
74248
|
-
name: fn2.
|
|
74243
|
+
name: fn2.name,
|
|
74249
74244
|
type: "site"
|
|
74250
74245
|
});
|
|
74251
74246
|
}
|
|
@@ -74253,7 +74248,7 @@ var discoverCodeHandlers = (projectDir, patterns) => {
|
|
|
74253
74248
|
for (const { exports } of discovered.fifoQueueHandlers) {
|
|
74254
74249
|
for (const fn2 of exports) {
|
|
74255
74250
|
handlers.push({
|
|
74256
|
-
name: fn2.
|
|
74251
|
+
name: fn2.name,
|
|
74257
74252
|
type: "queue"
|
|
74258
74253
|
});
|
|
74259
74254
|
}
|
|
@@ -74843,10 +74838,10 @@ var logsCommand = Command_exports.make(
|
|
|
74843
74838
|
const files = findHandlerFiles(patterns, projectDir);
|
|
74844
74839
|
const discovered = discoverHandlers(files);
|
|
74845
74840
|
const allHandlerNames = [
|
|
74846
|
-
...discovered.httpHandlers.flatMap((h) => h.exports.map((e) => e.
|
|
74847
|
-
...discovered.tableHandlers.flatMap((h) => h.exports.map((e) => e.
|
|
74848
|
-
...discovered.appHandlers.flatMap((h) => h.exports.map((e) => e.
|
|
74849
|
-
...discovered.fifoQueueHandlers.flatMap((h) => h.exports.map((e) => e.
|
|
74841
|
+
...discovered.httpHandlers.flatMap((h) => h.exports.map((e) => e.name)),
|
|
74842
|
+
...discovered.tableHandlers.flatMap((h) => h.exports.map((e) => e.name)),
|
|
74843
|
+
...discovered.appHandlers.flatMap((h) => h.exports.map((e) => e.name)),
|
|
74844
|
+
...discovered.fifoQueueHandlers.flatMap((h) => h.exports.map((e) => e.name))
|
|
74850
74845
|
];
|
|
74851
74846
|
if (!allHandlerNames.includes(handlerName)) {
|
|
74852
74847
|
yield* Console_exports.error(`Handler "${handlerName}" not found in code.`);
|