@wraps.dev/cli 0.1.2 → 0.1.3
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.js +28 -13
- package/dist/cli.js.map +1 -1
- package/dist/lambda/event-processor/.bundled +1 -0
- package/dist/lambda/event-processor/index.mjs +1 -0
- package/package.json +4 -2
- package/dist/lambda/event-processor/__tests__/index.test.ts +0 -932
- package/dist/lambda/event-processor/index.ts +0 -165
- package/dist/lambda/event-processor/package.json +0 -13
package/dist/cli.js
CHANGED
|
@@ -9,11 +9,11 @@ var __export = (target, all3) => {
|
|
|
9
9
|
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
|
|
12
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
|
|
13
13
|
import path from "path";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
15
|
var init_esm_shims = __esm({
|
|
16
|
-
"../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
16
|
+
"../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
17
17
|
"use strict";
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -78,17 +78,16 @@ function calculateDynamoDBCost(config, emailsPerMonth) {
|
|
|
78
78
|
const storageCost = Math.max(0, storageGB - FREE_TIER.DYNAMODB_STORAGE_GB) * AWS_PRICING.DYNAMODB_STORAGE_PER_GB;
|
|
79
79
|
return {
|
|
80
80
|
monthly: writeCost + storageCost,
|
|
81
|
-
description: `Email history (${retention}, ~${storageGB.toFixed(
|
|
81
|
+
description: `Email history (${retention}, ~${storageGB.toFixed(2)} GB at steady-state, ${numEventTypes} event types)`
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
function calculateTrackingCost(config) {
|
|
85
85
|
if (!config.tracking?.enabled) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
const cost = config.tracking.customRedirectDomain ? 0.5 : 0;
|
|
89
88
|
return {
|
|
90
|
-
monthly:
|
|
91
|
-
description:
|
|
89
|
+
monthly: 0,
|
|
90
|
+
description: "Open/click tracking (no additional cost)"
|
|
92
91
|
};
|
|
93
92
|
}
|
|
94
93
|
function calculateReputationMetricsCost(config) {
|
|
@@ -1387,14 +1386,33 @@ function getPackageRoot() {
|
|
|
1387
1386
|
}
|
|
1388
1387
|
throw new Error("Could not find package.json");
|
|
1389
1388
|
}
|
|
1390
|
-
async function
|
|
1389
|
+
async function getLambdaCode(functionName) {
|
|
1390
|
+
const packageRoot = getPackageRoot();
|
|
1391
|
+
const distLambdaPath = join(packageRoot, "dist", "lambda", functionName);
|
|
1392
|
+
const distBundleMarker = join(distLambdaPath, ".bundled");
|
|
1393
|
+
if (existsSync(distBundleMarker)) {
|
|
1394
|
+
return distLambdaPath;
|
|
1395
|
+
}
|
|
1396
|
+
const lambdaPath = join(packageRoot, "lambda", functionName);
|
|
1397
|
+
const lambdaBundleMarker = join(lambdaPath, ".bundled");
|
|
1398
|
+
if (existsSync(lambdaBundleMarker)) {
|
|
1399
|
+
return lambdaPath;
|
|
1400
|
+
}
|
|
1401
|
+
const sourcePath = join(lambdaPath, "index.ts");
|
|
1402
|
+
if (!existsSync(sourcePath)) {
|
|
1403
|
+
throw new Error(
|
|
1404
|
+
`Lambda source not found: ${sourcePath}
|
|
1405
|
+
This usually means the build process didn't complete successfully.
|
|
1406
|
+
Try running: pnpm build`
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1391
1409
|
const buildId = randomBytes(8).toString("hex");
|
|
1392
1410
|
const outdir = join(tmpdir(), `wraps-lambda-${buildId}`);
|
|
1393
1411
|
if (!existsSync(outdir)) {
|
|
1394
1412
|
mkdirSync(outdir, { recursive: true });
|
|
1395
1413
|
}
|
|
1396
1414
|
await build({
|
|
1397
|
-
entryPoints: [
|
|
1415
|
+
entryPoints: [sourcePath],
|
|
1398
1416
|
bundle: true,
|
|
1399
1417
|
platform: "node",
|
|
1400
1418
|
target: "node20",
|
|
@@ -1408,10 +1426,7 @@ async function bundleLambda(functionPath) {
|
|
|
1408
1426
|
return outdir;
|
|
1409
1427
|
}
|
|
1410
1428
|
async function deployLambdaFunctions(config) {
|
|
1411
|
-
const
|
|
1412
|
-
const lambdaDir = join(packageRoot, "lambda");
|
|
1413
|
-
const eventProcessorPath = join(lambdaDir, "event-processor", "index.ts");
|
|
1414
|
-
const eventProcessorBundle = await bundleLambda(eventProcessorPath);
|
|
1429
|
+
const eventProcessorCode = await getLambdaCode("event-processor");
|
|
1415
1430
|
const lambdaRole = new aws4.iam.Role("wraps-email-lambda-role", {
|
|
1416
1431
|
assumeRolePolicy: JSON.stringify({
|
|
1417
1432
|
Version: "2012-10-17",
|
|
@@ -1473,7 +1488,7 @@ async function deployLambdaFunctions(config) {
|
|
|
1473
1488
|
runtime: aws4.lambda.Runtime.NodeJS20dX,
|
|
1474
1489
|
handler: "index.handler",
|
|
1475
1490
|
role: lambdaRole.arn,
|
|
1476
|
-
code: new pulumi3.asset.FileArchive(
|
|
1491
|
+
code: new pulumi3.asset.FileArchive(eventProcessorCode),
|
|
1477
1492
|
timeout: 300,
|
|
1478
1493
|
// 5 minutes (matches SQS visibility timeout)
|
|
1479
1494
|
memorySize: 512,
|