@effortless-aws/cli 0.9.4 → 0.10.1
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 +83 -40
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -3951,16 +3951,8 @@ var cleanupOrphanedFunctions = (project, stage) => Effect21.gen(function* () {
|
|
|
3951
3951
|
|
|
3952
3952
|
// src/aws/sqs.ts
|
|
3953
3953
|
import { Effect as Effect22 } from "effect";
|
|
3954
|
-
var
|
|
3955
|
-
const {
|
|
3956
|
-
name,
|
|
3957
|
-
visibilityTimeout = 30,
|
|
3958
|
-
retentionPeriod = 345600,
|
|
3959
|
-
delay = 0,
|
|
3960
|
-
contentBasedDeduplication = true,
|
|
3961
|
-
tags
|
|
3962
|
-
} = input;
|
|
3963
|
-
const queueName = `${name}.fifo`;
|
|
3954
|
+
var ensureSingleFifoQueue = (opts) => Effect22.gen(function* () {
|
|
3955
|
+
const { queueName, attributes, tags } = opts;
|
|
3964
3956
|
const existingUrl = yield* sqs_exports.make("get_queue_url", {
|
|
3965
3957
|
QueueName: queueName
|
|
3966
3958
|
}).pipe(
|
|
@@ -3975,13 +3967,7 @@ var ensureFifoQueue = (input) => Effect22.gen(function* () {
|
|
|
3975
3967
|
yield* Effect22.logDebug(`Creating FIFO queue ${queueName}...`);
|
|
3976
3968
|
const result = yield* sqs_exports.make("create_queue", {
|
|
3977
3969
|
QueueName: queueName,
|
|
3978
|
-
Attributes:
|
|
3979
|
-
FifoQueue: "true",
|
|
3980
|
-
ContentBasedDeduplication: String(contentBasedDeduplication),
|
|
3981
|
-
VisibilityTimeout: String(visibilityTimeout),
|
|
3982
|
-
MessageRetentionPeriod: String(retentionPeriod),
|
|
3983
|
-
DelaySeconds: String(delay)
|
|
3984
|
-
},
|
|
3970
|
+
Attributes: attributes,
|
|
3985
3971
|
...tags ? { tags } : {}
|
|
3986
3972
|
});
|
|
3987
3973
|
queueUrl = result.QueueUrl;
|
|
@@ -3990,12 +3976,7 @@ var ensureFifoQueue = (input) => Effect22.gen(function* () {
|
|
|
3990
3976
|
queueUrl = existingUrl;
|
|
3991
3977
|
yield* sqs_exports.make("set_queue_attributes", {
|
|
3992
3978
|
QueueUrl: queueUrl,
|
|
3993
|
-
Attributes:
|
|
3994
|
-
ContentBasedDeduplication: String(contentBasedDeduplication),
|
|
3995
|
-
VisibilityTimeout: String(visibilityTimeout),
|
|
3996
|
-
MessageRetentionPeriod: String(retentionPeriod),
|
|
3997
|
-
DelaySeconds: String(delay)
|
|
3998
|
-
}
|
|
3979
|
+
Attributes: attributes
|
|
3999
3980
|
});
|
|
4000
3981
|
if (tags) {
|
|
4001
3982
|
yield* sqs_exports.make("tag_queue", {
|
|
@@ -4014,6 +3995,44 @@ var ensureFifoQueue = (input) => Effect22.gen(function* () {
|
|
|
4014
3995
|
}
|
|
4015
3996
|
return { queueUrl, queueArn };
|
|
4016
3997
|
});
|
|
3998
|
+
var ensureFifoQueue = (input) => Effect22.gen(function* () {
|
|
3999
|
+
const {
|
|
4000
|
+
name,
|
|
4001
|
+
visibilityTimeout = 30,
|
|
4002
|
+
retentionPeriod = 345600,
|
|
4003
|
+
delay = 0,
|
|
4004
|
+
contentBasedDeduplication = true,
|
|
4005
|
+
maxReceiveCount = 3,
|
|
4006
|
+
tags
|
|
4007
|
+
} = input;
|
|
4008
|
+
const dlqName = `${name}-dlq.fifo`;
|
|
4009
|
+
const { queueUrl: dlqUrl, queueArn: dlqArn } = yield* ensureSingleFifoQueue({
|
|
4010
|
+
queueName: dlqName,
|
|
4011
|
+
attributes: {
|
|
4012
|
+
FifoQueue: "true",
|
|
4013
|
+
ContentBasedDeduplication: String(contentBasedDeduplication),
|
|
4014
|
+
MessageRetentionPeriod: String(retentionPeriod)
|
|
4015
|
+
},
|
|
4016
|
+
tags
|
|
4017
|
+
});
|
|
4018
|
+
const queueName = `${name}.fifo`;
|
|
4019
|
+
const { queueUrl, queueArn } = yield* ensureSingleFifoQueue({
|
|
4020
|
+
queueName,
|
|
4021
|
+
attributes: {
|
|
4022
|
+
FifoQueue: "true",
|
|
4023
|
+
ContentBasedDeduplication: String(contentBasedDeduplication),
|
|
4024
|
+
VisibilityTimeout: String(visibilityTimeout),
|
|
4025
|
+
MessageRetentionPeriod: String(retentionPeriod),
|
|
4026
|
+
DelaySeconds: String(delay),
|
|
4027
|
+
RedrivePolicy: JSON.stringify({
|
|
4028
|
+
deadLetterTargetArn: dlqArn,
|
|
4029
|
+
maxReceiveCount
|
|
4030
|
+
})
|
|
4031
|
+
},
|
|
4032
|
+
tags
|
|
4033
|
+
});
|
|
4034
|
+
return { queueUrl, queueArn, dlqUrl, dlqArn };
|
|
4035
|
+
});
|
|
4017
4036
|
var ensureSqsEventSourceMapping = (input) => Effect22.gen(function* () {
|
|
4018
4037
|
const { functionArn, queueArn, batchSize = 10, batchWindow } = input;
|
|
4019
4038
|
const existingMappings = yield* lambda_exports.make("list_event_source_mappings", {
|
|
@@ -4044,8 +4063,7 @@ var ensureSqsEventSourceMapping = (input) => Effect22.gen(function* () {
|
|
|
4044
4063
|
});
|
|
4045
4064
|
return result.UUID;
|
|
4046
4065
|
});
|
|
4047
|
-
var
|
|
4048
|
-
const name = queueName.endsWith(".fifo") ? queueName : `${queueName}.fifo`;
|
|
4066
|
+
var deleteSingleQueue = (name) => Effect22.gen(function* () {
|
|
4049
4067
|
yield* Effect22.logDebug(`Deleting SQS queue: ${name}`);
|
|
4050
4068
|
const urlResult = yield* sqs_exports.make("get_queue_url", {
|
|
4051
4069
|
QueueName: name
|
|
@@ -4064,6 +4082,11 @@ var deleteFifoQueue = (queueName) => Effect22.gen(function* () {
|
|
|
4064
4082
|
});
|
|
4065
4083
|
}
|
|
4066
4084
|
});
|
|
4085
|
+
var deleteFifoQueue = (queueName) => Effect22.gen(function* () {
|
|
4086
|
+
const baseName = queueName.endsWith(".fifo") ? queueName.slice(0, -5) : queueName;
|
|
4087
|
+
yield* deleteSingleQueue(`${baseName}.fifo`);
|
|
4088
|
+
yield* deleteSingleQueue(`${baseName}-dlq.fifo`);
|
|
4089
|
+
});
|
|
4067
4090
|
|
|
4068
4091
|
// src/aws/ses.ts
|
|
4069
4092
|
import { Effect as Effect23 } from "effect";
|
|
@@ -5738,12 +5761,13 @@ var deployFifoQueueFunction = ({ input, fn: fn13, layerArn, external, depsEnv, d
|
|
|
5738
5761
|
yield* Effect32.logDebug("Creating SQS FIFO queue...");
|
|
5739
5762
|
const queueName = `${input.project}-${tagCtx.stage}-${handlerName}`;
|
|
5740
5763
|
const timeout = toSeconds4(config.lambda?.timeout ?? 30);
|
|
5741
|
-
const { queueUrl, queueArn } = yield* ensureFifoQueue({
|
|
5764
|
+
const { queueUrl, queueArn, dlqUrl, dlqArn } = yield* ensureFifoQueue({
|
|
5742
5765
|
name: queueName,
|
|
5743
5766
|
visibilityTimeout: Math.max(config.visibilityTimeout ? toSeconds4(config.visibilityTimeout) : timeout, timeout),
|
|
5744
5767
|
retentionPeriod: config.retentionPeriod ? toSeconds4(config.retentionPeriod) : void 0,
|
|
5745
5768
|
delay: config.delay ? toSeconds4(config.delay) : void 0,
|
|
5746
5769
|
contentBasedDeduplication: config.contentBasedDeduplication ?? true,
|
|
5770
|
+
maxReceiveCount: config.maxReceiveCount,
|
|
5747
5771
|
tags: makeTags(tagCtx, "sqs")
|
|
5748
5772
|
});
|
|
5749
5773
|
const queueEnv = {
|
|
@@ -5780,7 +5804,9 @@ var deployFifoQueueFunction = ({ input, fn: fn13, layerArn, external, depsEnv, d
|
|
|
5780
5804
|
status,
|
|
5781
5805
|
bundleSize,
|
|
5782
5806
|
queueUrl,
|
|
5783
|
-
queueArn
|
|
5807
|
+
queueArn,
|
|
5808
|
+
dlqUrl,
|
|
5809
|
+
dlqArn
|
|
5784
5810
|
};
|
|
5785
5811
|
});
|
|
5786
5812
|
|
|
@@ -7676,6 +7702,12 @@ To inspect: ls ${layerDir}`);
|
|
|
7676
7702
|
import { Args as Args3, Command as Command6 } from "@effect/cli";
|
|
7677
7703
|
import { Prompt } from "@effect/cli";
|
|
7678
7704
|
import { Effect as Effect44, Console as Console8, Logger as Logger5, LogLevel as LogLevel5, Option as Option5 } from "effect";
|
|
7705
|
+
var ssmTags = (project, stage, handlerName) => toAwsTagList({
|
|
7706
|
+
"effortless:project": project,
|
|
7707
|
+
"effortless:stage": stage,
|
|
7708
|
+
"effortless:handler": handlerName,
|
|
7709
|
+
"effortless:type": "ssm-parameter"
|
|
7710
|
+
});
|
|
7679
7711
|
var loadRequiredParams = (projectOpt, stage, region) => Effect44.gen(function* () {
|
|
7680
7712
|
const { config, projectDir } = yield* ProjectConfig;
|
|
7681
7713
|
const project = Option5.getOrElse(projectOpt, () => config?.name ?? "");
|
|
@@ -7741,26 +7773,36 @@ var setCommand = Command6.make(
|
|
|
7741
7773
|
"set",
|
|
7742
7774
|
{ key: setKeyArg, project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
|
|
7743
7775
|
({ key, project: projectOpt, stage, region, verbose }) => Effect44.gen(function* () {
|
|
7744
|
-
const
|
|
7745
|
-
const
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7776
|
+
const ctx = yield* loadRequiredParams(projectOpt, stage, region);
|
|
7777
|
+
const { params } = ctx;
|
|
7778
|
+
const match = params.find((p) => p.ssmKey === key);
|
|
7779
|
+
if (!match) {
|
|
7780
|
+
const available = [...new Set(params.map((p) => p.ssmKey))].sort();
|
|
7781
|
+
yield* Console8.error(`Error: "${key}" is not declared in any handler.`);
|
|
7782
|
+
if (available.length > 0) {
|
|
7783
|
+
yield* Console8.error(`
|
|
7784
|
+
Available keys:
|
|
7785
|
+
${available.map((k) => ` - ${k}`).join("\n")}`);
|
|
7786
|
+
}
|
|
7787
|
+
return yield* Effect44.fail(new Error(`Unknown config key: ${key}`));
|
|
7749
7788
|
}
|
|
7750
|
-
const finalStage = config?.stage ?? stage;
|
|
7751
|
-
const finalRegion = config?.region ?? region;
|
|
7752
|
-
const ssmPath = `/${project}/${finalStage}/${key}`;
|
|
7753
7789
|
const value = yield* Prompt.text({
|
|
7754
|
-
message: `Value for ${c.cyan(ssmPath)}`
|
|
7790
|
+
message: `Value for ${c.cyan(match.ssmPath)}`
|
|
7755
7791
|
});
|
|
7792
|
+
const ssmLayer = clients_exports.makeClients({ ssm: { region: ctx.region } });
|
|
7756
7793
|
yield* ssm_exports.make("put_parameter", {
|
|
7757
|
-
Name: ssmPath,
|
|
7794
|
+
Name: match.ssmPath,
|
|
7758
7795
|
Value: value,
|
|
7759
7796
|
Type: "SecureString",
|
|
7760
7797
|
Overwrite: true
|
|
7761
|
-
}).pipe(Effect44.provide(
|
|
7798
|
+
}).pipe(Effect44.provide(ssmLayer));
|
|
7799
|
+
yield* ssm_exports.make("add_tags_to_resource", {
|
|
7800
|
+
ResourceType: "Parameter",
|
|
7801
|
+
ResourceId: match.ssmPath,
|
|
7802
|
+
Tags: ssmTags(ctx.project, ctx.stage, match.handlerName)
|
|
7803
|
+
}).pipe(Effect44.provide(ssmLayer));
|
|
7762
7804
|
yield* Console8.log(`
|
|
7763
|
-
${c.green("\u2713")} ${c.cyan(ssmPath)} ${c.dim("(SecureString)")}`);
|
|
7805
|
+
${c.green("\u2713")} ${c.cyan(match.ssmPath)} ${c.dim("(SecureString)")}`);
|
|
7764
7806
|
}).pipe(
|
|
7765
7807
|
Effect44.provide(ProjectConfig.Live),
|
|
7766
7808
|
Logger5.withMinimumLogLevel(LogLevel5.Warning)
|
|
@@ -7801,7 +7843,8 @@ ${c.bold("Missing parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
|
|
|
7801
7843
|
Name: p.ssmPath,
|
|
7802
7844
|
Value: value,
|
|
7803
7845
|
Type: "SecureString",
|
|
7804
|
-
Overwrite: false
|
|
7846
|
+
Overwrite: false,
|
|
7847
|
+
Tags: ssmTags(ctx.project, ctx.stage, p.handlerName)
|
|
7805
7848
|
}).pipe(Effect44.provide(clients_exports.makeClients({ ssm: { region: ctx.region } })));
|
|
7806
7849
|
yield* Console8.log(` ${c.green("\u2713")} created`);
|
|
7807
7850
|
created++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effortless-aws/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "CLI and deploy tooling for effortless-aws",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"esbuild": "^0.25.0",
|
|
40
40
|
"glob": "^13.0.0",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
|
-
"effortless-aws": "0.
|
|
42
|
+
"effortless-aws": "0.27.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@effect-ak/aws-sdk": "1.0.0-rc.3",
|