@awsless/awsless 0.0.618 → 0.0.620
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/bin.js +108 -26
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +14 -14
package/dist/bin.js
CHANGED
|
@@ -1120,11 +1120,11 @@ var FunctionDefaultSchema = z15.object({
|
|
|
1120
1120
|
// container
|
|
1121
1121
|
warm: WarmSchema.default(0),
|
|
1122
1122
|
vpc: VPCSchema.default(false),
|
|
1123
|
-
log: LogSchema.default(true).transform((
|
|
1124
|
-
retention:
|
|
1125
|
-
level: "level" in
|
|
1126
|
-
system: "system" in
|
|
1127
|
-
format: "format" in
|
|
1123
|
+
log: LogSchema.default(true).transform((log31) => ({
|
|
1124
|
+
retention: log31.retention ?? days(7),
|
|
1125
|
+
level: "level" in log31 ? log31.level : "error",
|
|
1126
|
+
system: "system" in log31 ? log31.system : "warn",
|
|
1127
|
+
format: "format" in log31 ? log31.format : "json"
|
|
1128
1128
|
})),
|
|
1129
1129
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
1130
1130
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1652,8 +1652,8 @@ var InstanceDefaultSchema = z25.object({
|
|
|
1652
1652
|
permissions: PermissionsSchema2.optional(),
|
|
1653
1653
|
healthCheck: HealthCheckSchema.optional(),
|
|
1654
1654
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1655
|
-
log: LogSchema2.default(true).transform((
|
|
1656
|
-
retention:
|
|
1655
|
+
log: LogSchema2.default(true).transform((log31) => ({
|
|
1656
|
+
retention: log31.retention ?? days4(7)
|
|
1657
1657
|
}))
|
|
1658
1658
|
}).default({});
|
|
1659
1659
|
|
|
@@ -6574,7 +6574,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
|
|
|
6574
6574
|
}
|
|
6575
6575
|
if (!result.success) {
|
|
6576
6576
|
throw new ExpectedError(`Executable build failed:
|
|
6577
|
-
${result.logs?.map((
|
|
6577
|
+
${result.logs?.map((log31) => log31.message).join("\n")}`);
|
|
6578
6578
|
}
|
|
6579
6579
|
const file = await readFile4(filePath);
|
|
6580
6580
|
return {
|
|
@@ -8074,7 +8074,7 @@ var createApp = (props) => {
|
|
|
8074
8074
|
region: props.appConfig.region,
|
|
8075
8075
|
appName: props.appConfig.name
|
|
8076
8076
|
});
|
|
8077
|
-
const
|
|
8077
|
+
const commands10 = [];
|
|
8078
8078
|
const configs = /* @__PURE__ */ new Set();
|
|
8079
8079
|
const functionsByConfig = {};
|
|
8080
8080
|
const tests = [];
|
|
@@ -8142,7 +8142,7 @@ var createApp = (props) => {
|
|
|
8142
8142
|
});
|
|
8143
8143
|
},
|
|
8144
8144
|
registerCommand(command) {
|
|
8145
|
-
|
|
8145
|
+
commands10.push(command);
|
|
8146
8146
|
},
|
|
8147
8147
|
registerDomainZone(zone) {
|
|
8148
8148
|
domainZones.push(zone);
|
|
@@ -8243,7 +8243,7 @@ var createApp = (props) => {
|
|
|
8243
8243
|
configs.add(name);
|
|
8244
8244
|
},
|
|
8245
8245
|
registerCommand(command) {
|
|
8246
|
-
|
|
8246
|
+
commands10.push(command);
|
|
8247
8247
|
},
|
|
8248
8248
|
registerDomainZone(zone) {
|
|
8249
8249
|
domainZones.push(zone);
|
|
@@ -8339,7 +8339,7 @@ var createApp = (props) => {
|
|
|
8339
8339
|
functionsByConfig,
|
|
8340
8340
|
warnings,
|
|
8341
8341
|
builders,
|
|
8342
|
-
commands:
|
|
8342
|
+
commands: commands10
|
|
8343
8343
|
// deploymentLine,
|
|
8344
8344
|
};
|
|
8345
8345
|
};
|
|
@@ -8801,10 +8801,10 @@ var startTest = async (props) => {
|
|
|
8801
8801
|
tests.push(entry);
|
|
8802
8802
|
if ("task" in test2) {
|
|
8803
8803
|
const task2 = test2.task;
|
|
8804
|
-
for (const
|
|
8804
|
+
for (const log31 of task2.logs ?? []) {
|
|
8805
8805
|
entry.logs.push({
|
|
8806
|
-
time:
|
|
8807
|
-
text:
|
|
8806
|
+
time: log31.time,
|
|
8807
|
+
text: log31.content
|
|
8808
8808
|
});
|
|
8809
8809
|
}
|
|
8810
8810
|
}
|
|
@@ -8872,7 +8872,7 @@ var logTestLogs = (event) => {
|
|
|
8872
8872
|
].join(" "),
|
|
8873
8873
|
color.line(icon.dot)
|
|
8874
8874
|
);
|
|
8875
|
-
log16.message(test2.logs.map((
|
|
8875
|
+
log16.message(test2.logs.map((log31) => log31.text).join("\n"));
|
|
8876
8876
|
}
|
|
8877
8877
|
}
|
|
8878
8878
|
};
|
|
@@ -9513,7 +9513,7 @@ import { log as log22 } from "@awsless/clui";
|
|
|
9513
9513
|
import chalk4 from "chalk";
|
|
9514
9514
|
import { constantCase as constantCase15 } from "change-case";
|
|
9515
9515
|
var bind = (program2) => {
|
|
9516
|
-
program2.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v) => v.split(",")).description(`Bind your site environment variables to a command`).action(async (
|
|
9516
|
+
program2.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v) => v.split(",")).description(`Bind your site environment variables to a command`).action(async (commands10 = [], opts) => {
|
|
9517
9517
|
await layout("bind", async ({ appConfig, stackConfigs }) => {
|
|
9518
9518
|
const region = appConfig.region;
|
|
9519
9519
|
const profile = appConfig.profile;
|
|
@@ -9543,14 +9543,14 @@ var bind = (program2) => {
|
|
|
9543
9543
|
if (configList.length ?? 0 > 0) {
|
|
9544
9544
|
log22.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
|
|
9545
9545
|
}
|
|
9546
|
-
if (
|
|
9546
|
+
if (commands10.length === 0) {
|
|
9547
9547
|
return "No command to execute.";
|
|
9548
9548
|
}
|
|
9549
9549
|
const freshCred = await credentials();
|
|
9550
9550
|
console.log(chalk4.black(`\u2502`));
|
|
9551
|
-
console.log(chalk4.black(`\u2514 ${chalk4.yellow(
|
|
9551
|
+
console.log(chalk4.black(`\u2514 ${chalk4.yellow(commands10.join(" "))}`));
|
|
9552
9552
|
console.log("");
|
|
9553
|
-
const instance = Bun.spawn(
|
|
9553
|
+
const instance = Bun.spawn(commands10, {
|
|
9554
9554
|
// cwd: process.cwd(),
|
|
9555
9555
|
env: {
|
|
9556
9556
|
// Pass the process env vars
|
|
@@ -9740,17 +9740,17 @@ var run = (program2) => {
|
|
|
9740
9740
|
const region = appConfig.region;
|
|
9741
9741
|
const credentials = await getCredentials(appConfig.profile);
|
|
9742
9742
|
const accountId = await getAccountId(credentials, region);
|
|
9743
|
-
const { commands:
|
|
9743
|
+
const { commands: commands10, appId } = createApp({ appConfig, stackConfigs, accountId });
|
|
9744
9744
|
let command;
|
|
9745
9745
|
if (selected) {
|
|
9746
|
-
command =
|
|
9746
|
+
command = commands10.find((cmd) => {
|
|
9747
9747
|
return cmd.name === selected;
|
|
9748
9748
|
});
|
|
9749
9749
|
} else {
|
|
9750
9750
|
command = await prompt11.select({
|
|
9751
9751
|
message: "Pick the command you want to run:",
|
|
9752
|
-
initialValue:
|
|
9753
|
-
options:
|
|
9752
|
+
initialValue: commands10[0],
|
|
9753
|
+
options: commands10.map((cmd) => ({
|
|
9754
9754
|
value: cmd,
|
|
9755
9755
|
label: cmd.name,
|
|
9756
9756
|
hint: cmd.description
|
|
@@ -10359,8 +10359,89 @@ var icon2 = (program2) => {
|
|
|
10359
10359
|
commands7.forEach((cb) => cb(command));
|
|
10360
10360
|
};
|
|
10361
10361
|
|
|
10362
|
-
// src/cli/command/
|
|
10362
|
+
// src/cli/command/cron/invoke.ts
|
|
10363
|
+
import { log as log30, prompt as prompt16 } from "@awsless/clui";
|
|
10364
|
+
import { invoke as invokeLambda, LambdaClient as LambdaClient4 } from "@awsless/lambda";
|
|
10365
|
+
var invoke = (program2) => {
|
|
10366
|
+
program2.command("invoke").description("Invoke a cronjob").argument("[stack]", "The stack name of the cronjob").argument("[name]", "The name of the cronjob").action(async (stack, name) => {
|
|
10367
|
+
await layout("cron invoke", async ({ appConfig, stackConfigs }) => {
|
|
10368
|
+
const region = appConfig.region;
|
|
10369
|
+
const profile = appConfig.profile;
|
|
10370
|
+
const credentials = await getCredentials(profile);
|
|
10371
|
+
if (!stack) {
|
|
10372
|
+
const cronStacks = stackConfigs.filter((stack2) => {
|
|
10373
|
+
if (Object.keys(stack2.crons ?? {}).length > 0) {
|
|
10374
|
+
return stack2;
|
|
10375
|
+
}
|
|
10376
|
+
return;
|
|
10377
|
+
});
|
|
10378
|
+
if (cronStacks.length === 0) {
|
|
10379
|
+
throw new ExpectedError("There are no crons defined inside your app.");
|
|
10380
|
+
}
|
|
10381
|
+
stack = await prompt16.select({
|
|
10382
|
+
message: "Select the stack:",
|
|
10383
|
+
options: cronStacks.map((stack2) => ({
|
|
10384
|
+
label: stack2.name,
|
|
10385
|
+
value: stack2.name
|
|
10386
|
+
}))
|
|
10387
|
+
});
|
|
10388
|
+
}
|
|
10389
|
+
const stackConfig = stackConfigs.find((s) => s.name === stack);
|
|
10390
|
+
if (!stackConfig) {
|
|
10391
|
+
throw new ExpectedError(`The stack "${stack}" doesn't exist.`);
|
|
10392
|
+
}
|
|
10393
|
+
const names = Object.keys(stackConfig.crons ?? {});
|
|
10394
|
+
if (!name) {
|
|
10395
|
+
name = await prompt16.select({
|
|
10396
|
+
message: "Select the cron:",
|
|
10397
|
+
options: names.map((name2) => ({
|
|
10398
|
+
label: name2,
|
|
10399
|
+
value: name2
|
|
10400
|
+
}))
|
|
10401
|
+
});
|
|
10402
|
+
}
|
|
10403
|
+
if (!names) {
|
|
10404
|
+
throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
|
|
10405
|
+
}
|
|
10406
|
+
const functionName = formatLocalResourceName({
|
|
10407
|
+
appName: appConfig.name,
|
|
10408
|
+
stackName: stackConfig.name,
|
|
10409
|
+
resourceType: "cron",
|
|
10410
|
+
resourceName: name
|
|
10411
|
+
});
|
|
10412
|
+
const payload = stackConfig.crons?.[name]?.payload ?? {};
|
|
10413
|
+
const response = await log30.task({
|
|
10414
|
+
initialMessage: "Invoking cron...",
|
|
10415
|
+
successMessage: "Done invoking cron.",
|
|
10416
|
+
errorMessage: "Failed invoking cron.",
|
|
10417
|
+
task() {
|
|
10418
|
+
return invokeLambda({
|
|
10419
|
+
name: functionName,
|
|
10420
|
+
payload,
|
|
10421
|
+
client: new LambdaClient4({
|
|
10422
|
+
credentials,
|
|
10423
|
+
region
|
|
10424
|
+
})
|
|
10425
|
+
});
|
|
10426
|
+
}
|
|
10427
|
+
});
|
|
10428
|
+
log30.note("Response", JSON.stringify(response, void 0, 4));
|
|
10429
|
+
});
|
|
10430
|
+
});
|
|
10431
|
+
};
|
|
10432
|
+
|
|
10433
|
+
// src/cli/command/cron/index.ts
|
|
10363
10434
|
var commands8 = [
|
|
10435
|
+
//
|
|
10436
|
+
invoke
|
|
10437
|
+
];
|
|
10438
|
+
var cron = (program2) => {
|
|
10439
|
+
const command = program2.command("cron").description(`Manage crons`);
|
|
10440
|
+
commands8.forEach((cb) => cb(command));
|
|
10441
|
+
};
|
|
10442
|
+
|
|
10443
|
+
// src/cli/command/index.ts
|
|
10444
|
+
var commands9 = [
|
|
10364
10445
|
bootstrap,
|
|
10365
10446
|
types,
|
|
10366
10447
|
build2,
|
|
@@ -10377,6 +10458,7 @@ var commands8 = [
|
|
|
10377
10458
|
resources,
|
|
10378
10459
|
config,
|
|
10379
10460
|
test,
|
|
10461
|
+
cron,
|
|
10380
10462
|
image,
|
|
10381
10463
|
icon2
|
|
10382
10464
|
];
|
|
@@ -10401,7 +10483,7 @@ program.on("option:skip-prompt", () => {
|
|
|
10401
10483
|
program.on("option:no-cache", () => {
|
|
10402
10484
|
process.env.NO_CACHE = program.opts().cache === false ? "1" : void 0;
|
|
10403
10485
|
});
|
|
10404
|
-
|
|
10486
|
+
commands9.forEach((fn) => fn(program));
|
|
10405
10487
|
|
|
10406
10488
|
// src/bin.ts
|
|
10407
10489
|
program.parse(process.argv);
|
|
Binary file
|
|
Binary file
|
package/dist/prebuild/rpc/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
29e42274e3589b52fe72c8c4bdca163acdcb3a97
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.620",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"@awsless/cloudwatch": "^0.0.1",
|
|
38
38
|
"@awsless/clui": "^0.0.8",
|
|
39
39
|
"@awsless/duration": "^0.0.4",
|
|
40
|
-
"@awsless/dynamodb": "^0.3.
|
|
41
|
-
"@awsless/iot": "^0.0.3",
|
|
40
|
+
"@awsless/dynamodb": "^0.3.11",
|
|
42
41
|
"@awsless/json": "^0.0.10",
|
|
43
|
-
"@awsless/
|
|
42
|
+
"@awsless/iot": "^0.0.3",
|
|
44
43
|
"@awsless/mqtt": "^0.0.2",
|
|
45
|
-
"@awsless/redis": "^0.0.14",
|
|
46
44
|
"@awsless/lambda": "^0.0.35",
|
|
47
|
-
"@awsless/
|
|
45
|
+
"@awsless/open-search": "^0.0.21",
|
|
46
|
+
"@awsless/redis": "^0.0.14",
|
|
48
47
|
"@awsless/s3": "^0.0.21",
|
|
48
|
+
"@awsless/ssm": "^0.0.7",
|
|
49
|
+
"@awsless/sns": "^0.0.10",
|
|
49
50
|
"@awsless/sqs": "^0.0.16",
|
|
50
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
51
51
|
"@awsless/validate": "^0.1.3",
|
|
52
|
-
"@awsless/
|
|
52
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -139,16 +139,16 @@
|
|
|
139
139
|
"zip-a-folder": "^3.1.6",
|
|
140
140
|
"zod": "^3.24.2",
|
|
141
141
|
"zod-to-json-schema": "^3.24.3",
|
|
142
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
142
143
|
"@awsless/big-float": "^0.1.5",
|
|
143
|
-
"@awsless/clui": "^0.0.8",
|
|
144
144
|
"@awsless/duration": "^0.0.4",
|
|
145
|
+
"@awsless/size": "^0.0.2",
|
|
145
146
|
"@awsless/graphql": "^0.0.9",
|
|
146
|
-
"@awsless/
|
|
147
|
-
"@awsless/scheduler": "^0.0.4",
|
|
148
|
-
"@awsless/json": "^0.0.10",
|
|
147
|
+
"@awsless/ts-file-cache": "^0.0.12",
|
|
149
148
|
"@awsless/validate": "^0.1.3",
|
|
150
|
-
"@awsless/
|
|
151
|
-
"@awsless/
|
|
149
|
+
"@awsless/json": "^0.0.10",
|
|
150
|
+
"@awsless/scheduler": "^0.0.4",
|
|
151
|
+
"@awsless/clui": "^0.0.8"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
154
|
"@hono/node-server": "1.19.9",
|