@awsless/awsless 0.0.321 → 0.0.323
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 +73 -61
- package/dist/build-json-schema.js +11 -1
- package/package.json +7 -7
package/dist/bin.js
CHANGED
|
@@ -10,48 +10,6 @@ import {
|
|
|
10
10
|
// src/cli/program.ts
|
|
11
11
|
import { Command as Command2 } from "commander";
|
|
12
12
|
|
|
13
|
-
// src/cli/ui/style.ts
|
|
14
|
-
import chalk from "chalk";
|
|
15
|
-
var icon = {
|
|
16
|
-
// info: 'ℹ',
|
|
17
|
-
// success: '✓',
|
|
18
|
-
// warning: '⚠',
|
|
19
|
-
// question: '?',
|
|
20
|
-
error: "\xD7",
|
|
21
|
-
dot: "\xB7",
|
|
22
|
-
// line: '─',
|
|
23
|
-
// ellipsis: '…',
|
|
24
|
-
arrow: {
|
|
25
|
-
top: "^",
|
|
26
|
-
right: "\u203A"
|
|
27
|
-
}
|
|
28
|
-
// pointer: '❯',
|
|
29
|
-
};
|
|
30
|
-
var color = {
|
|
31
|
-
primary: chalk.bold.hex("#FF9000"),
|
|
32
|
-
// primary: chalk.bold.magentaBright,
|
|
33
|
-
// title: chalk.white,
|
|
34
|
-
// normal: chalk.white,
|
|
35
|
-
label: chalk.reset.white.bold,
|
|
36
|
-
dim: chalk.dim,
|
|
37
|
-
line: chalk.black,
|
|
38
|
-
// link: chalk.cyan,
|
|
39
|
-
info: chalk.blue,
|
|
40
|
-
success: chalk.green,
|
|
41
|
-
warning: chalk.yellow,
|
|
42
|
-
error: chalk.red,
|
|
43
|
-
attr: chalk.yellow
|
|
44
|
-
// cursor: chalk.bgWhite.blackBright,
|
|
45
|
-
};
|
|
46
|
-
var char = {
|
|
47
|
-
br: "\n"
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// src/cli/ui/logo.ts
|
|
51
|
-
var logo = () => {
|
|
52
|
-
return `${color.primary`AWS`}${color.primary.dim`LESS`}`;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
13
|
// src/util/aws.ts
|
|
56
14
|
import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
57
15
|
import { fromIni } from "@aws-sdk/credential-providers";
|
|
@@ -186,6 +144,45 @@ var pushRemoteState = async (app, stateProvider) => {
|
|
|
186
144
|
|
|
187
145
|
// src/cli/ui/util.ts
|
|
188
146
|
import wrapAnsi from "wrap-ansi";
|
|
147
|
+
|
|
148
|
+
// src/cli/ui/style.ts
|
|
149
|
+
import chalk from "chalk";
|
|
150
|
+
var icon = {
|
|
151
|
+
// info: 'ℹ',
|
|
152
|
+
// success: '✓',
|
|
153
|
+
// warning: '⚠',
|
|
154
|
+
// question: '?',
|
|
155
|
+
error: "\xD7",
|
|
156
|
+
dot: "\xB7",
|
|
157
|
+
// line: '─',
|
|
158
|
+
// ellipsis: '…',
|
|
159
|
+
arrow: {
|
|
160
|
+
top: "^",
|
|
161
|
+
right: "\u203A"
|
|
162
|
+
}
|
|
163
|
+
// pointer: '❯',
|
|
164
|
+
};
|
|
165
|
+
var color = {
|
|
166
|
+
primary: chalk.bold.hex("#FF9000"),
|
|
167
|
+
// primary: chalk.bold.magentaBright,
|
|
168
|
+
// title: chalk.white,
|
|
169
|
+
// normal: chalk.white,
|
|
170
|
+
label: chalk.reset.white.bold,
|
|
171
|
+
dim: chalk.dim,
|
|
172
|
+
line: chalk.black,
|
|
173
|
+
// link: chalk.cyan,
|
|
174
|
+
info: chalk.blue,
|
|
175
|
+
success: chalk.green,
|
|
176
|
+
warning: chalk.yellow,
|
|
177
|
+
error: chalk.red,
|
|
178
|
+
attr: chalk.yellow
|
|
179
|
+
// cursor: chalk.bgWhite.blackBright,
|
|
180
|
+
};
|
|
181
|
+
var char = {
|
|
182
|
+
br: "\n"
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/cli/ui/util.ts
|
|
189
186
|
import Table from "cli-table3";
|
|
190
187
|
import { capitalCase } from "change-case";
|
|
191
188
|
import { spinner } from "@clack/prompts";
|
|
@@ -352,6 +349,7 @@ var bootstrapAwsless = async (props) => {
|
|
|
352
349
|
import { intro, outro } from "@clack/prompts";
|
|
353
350
|
|
|
354
351
|
// src/config/load/load.ts
|
|
352
|
+
import { glob } from "glob";
|
|
355
353
|
import { basename as basename2, dirname as dirname3, join as join5 } from "path";
|
|
356
354
|
|
|
357
355
|
// src/cli/debug.ts
|
|
@@ -383,7 +381,7 @@ import { z } from "zod";
|
|
|
383
381
|
var ResourceIdSchema = z.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase(value));
|
|
384
382
|
|
|
385
383
|
// src/feature/function/schema.ts
|
|
386
|
-
import { days, minutes as minutes2, seconds } from "@awsless/duration";
|
|
384
|
+
import { days, minutes as minutes2, seconds, toDays } from "@awsless/duration";
|
|
387
385
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
388
386
|
import { z as z5 } from "zod";
|
|
389
387
|
|
|
@@ -478,9 +476,19 @@ var MinifySchema = z5.boolean().describe("Minify the function code.");
|
|
|
478
476
|
var HandlerSchema = z5.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
479
477
|
var FileSchema = LocalFileSchema.describe("The file path of the function code.");
|
|
480
478
|
var DescriptionSchema = z5.string().describe("A description of the function.");
|
|
479
|
+
var validLogRetentionDays = [
|
|
480
|
+
...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
|
|
481
|
+
...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
|
|
482
|
+
...[2557n, 2922n, 3288n, 3653n]
|
|
483
|
+
];
|
|
481
484
|
var LogRetentionSchema = DurationSchema.refine(
|
|
482
485
|
durationMin(days(0)),
|
|
483
486
|
"Minimum log retention is 0 day, which will disable logging."
|
|
487
|
+
).refine(
|
|
488
|
+
(duration) => {
|
|
489
|
+
return validLogRetentionDays.includes(toDays(duration));
|
|
490
|
+
},
|
|
491
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days5) => `${days5}`).join(", ")}`
|
|
484
492
|
).describe("The log retention duration.");
|
|
485
493
|
var LogSchema = z5.union([
|
|
486
494
|
z5.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
@@ -963,9 +971,6 @@ var AppSchema = z18.object({
|
|
|
963
971
|
}).default({}).describe("Default properties")
|
|
964
972
|
});
|
|
965
973
|
|
|
966
|
-
// src/config/load/load.ts
|
|
967
|
-
import { glob } from "glob";
|
|
968
|
-
|
|
969
974
|
// src/config/stack.ts
|
|
970
975
|
import { z as z32 } from "zod";
|
|
971
976
|
|
|
@@ -1483,10 +1488,10 @@ var StackSchema = z32.object({
|
|
|
1483
1488
|
});
|
|
1484
1489
|
|
|
1485
1490
|
// src/config/load/read.ts
|
|
1486
|
-
import
|
|
1491
|
+
import merge from "deepmerge";
|
|
1487
1492
|
import { readFile as readFile2 } from "fs/promises";
|
|
1488
1493
|
import JSON5 from "json5";
|
|
1489
|
-
import
|
|
1494
|
+
import { basename, dirname as dirname2, extname, join as join4 } from "path";
|
|
1490
1495
|
var readConfig = async (file) => {
|
|
1491
1496
|
try {
|
|
1492
1497
|
const json4 = await readFile2(file, "utf8");
|
|
@@ -1501,6 +1506,9 @@ var readConfig = async (file) => {
|
|
|
1501
1506
|
};
|
|
1502
1507
|
var readConfigWithStage = async (file, stage) => {
|
|
1503
1508
|
const config2 = await readConfig(file);
|
|
1509
|
+
if (!stage) {
|
|
1510
|
+
return config2;
|
|
1511
|
+
}
|
|
1504
1512
|
const ext = extname(file);
|
|
1505
1513
|
const stageFileName = basename(file, ext) + "." + stage + ext;
|
|
1506
1514
|
const stageFile = join4(dirname2(file), stageFileName);
|
|
@@ -1569,17 +1577,16 @@ var loadStackConfigs = async (options) => {
|
|
|
1569
1577
|
|
|
1570
1578
|
// src/cli/ui/app.ts
|
|
1571
1579
|
import { note } from "@clack/prompts";
|
|
1572
|
-
var logApp = (app) => {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
);
|
|
1580
|
+
var logApp = (app, opt) => {
|
|
1581
|
+
const data = {
|
|
1582
|
+
App: app.name,
|
|
1583
|
+
Region: app.region,
|
|
1584
|
+
Profile: app.profile
|
|
1585
|
+
};
|
|
1586
|
+
if (opt.stage) {
|
|
1587
|
+
data.Stage = color.warning(opt.stage);
|
|
1588
|
+
}
|
|
1589
|
+
note(wrap(list(data)), "App Config");
|
|
1583
1590
|
};
|
|
1584
1591
|
|
|
1585
1592
|
// src/cli/ui/error/error.ts
|
|
@@ -1790,6 +1797,11 @@ var logError = (error) => {
|
|
|
1790
1797
|
}
|
|
1791
1798
|
};
|
|
1792
1799
|
|
|
1800
|
+
// src/cli/ui/logo.ts
|
|
1801
|
+
var logo = () => {
|
|
1802
|
+
return `${color.primary`AWS`}${color.primary.dim`LESS`}`;
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1793
1805
|
// src/cli/ui/complex/layout.ts
|
|
1794
1806
|
var layout = async (command, cb) => {
|
|
1795
1807
|
console.log();
|
|
@@ -1797,7 +1809,7 @@ var layout = async (command, cb) => {
|
|
|
1797
1809
|
try {
|
|
1798
1810
|
const options = program.optsWithGlobals();
|
|
1799
1811
|
const appConfig = await loadAppConfig(options);
|
|
1800
|
-
logApp(appConfig);
|
|
1812
|
+
logApp(appConfig, options);
|
|
1801
1813
|
const stackConfigs = await loadStackConfigs(options);
|
|
1802
1814
|
const result = await cb({
|
|
1803
1815
|
options,
|
|
@@ -5886,7 +5898,7 @@ var commands6 = [
|
|
|
5886
5898
|
var program = new Command2();
|
|
5887
5899
|
program.name(logo());
|
|
5888
5900
|
program.option("--config-file <string>", "The app config file location");
|
|
5889
|
-
program.option("--stage <string>", "The stage to use
|
|
5901
|
+
program.option("--stage <string>", "The stage to use");
|
|
5890
5902
|
program.option("-c --no-cache", "Always build & test without the cache");
|
|
5891
5903
|
program.option("-s --skip-prompt", "Skip prompts");
|
|
5892
5904
|
program.option("-v --verbose", "Print verbose logs");
|
|
@@ -13,7 +13,7 @@ import { z } from "zod";
|
|
|
13
13
|
var ResourceIdSchema = z.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Invalid resource ID").transform((value) => paramCase(value));
|
|
14
14
|
|
|
15
15
|
// src/feature/function/schema.ts
|
|
16
|
-
import { days, minutes, seconds } from "@awsless/duration";
|
|
16
|
+
import { days, minutes, seconds, toDays } from "@awsless/duration";
|
|
17
17
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
18
18
|
import { z as z5 } from "zod";
|
|
19
19
|
|
|
@@ -135,9 +135,19 @@ var MinifySchema = z5.boolean().describe("Minify the function code.");
|
|
|
135
135
|
var HandlerSchema = z5.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
136
136
|
var FileSchema = LocalFileSchema.describe("The file path of the function code.");
|
|
137
137
|
var DescriptionSchema = z5.string().describe("A description of the function.");
|
|
138
|
+
var validLogRetentionDays = [
|
|
139
|
+
...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
|
|
140
|
+
...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
|
|
141
|
+
...[2557n, 2922n, 3288n, 3653n]
|
|
142
|
+
];
|
|
138
143
|
var LogRetentionSchema = DurationSchema.refine(
|
|
139
144
|
durationMin(days(0)),
|
|
140
145
|
"Minimum log retention is 0 day, which will disable logging."
|
|
146
|
+
).refine(
|
|
147
|
+
(duration) => {
|
|
148
|
+
return validLogRetentionDays.includes(toDays(duration));
|
|
149
|
+
},
|
|
150
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
|
|
141
151
|
).describe("The log retention duration.");
|
|
142
152
|
var LogSchema = z5.union([
|
|
143
153
|
z5.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.323",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@awsless/lambda": "^0.0.26",
|
|
31
32
|
"@awsless/s3": "^0.0.18",
|
|
32
33
|
"@awsless/open-search": "^0.0.15",
|
|
33
|
-
"@awsless/
|
|
34
|
+
"@awsless/sns": "^0.0.7",
|
|
34
35
|
"@awsless/validate": "^0.0.14",
|
|
35
|
-
"@awsless/redis": "^0.0.12",
|
|
36
36
|
"@awsless/iot": "^0.0.2",
|
|
37
|
-
"@awsless/sns": "^0.0.7",
|
|
38
37
|
"@awsless/sqs": "^0.0.7",
|
|
38
|
+
"@awsless/redis": "^0.0.12",
|
|
39
39
|
"@awsless/ssm": "^0.0.7",
|
|
40
40
|
"@awsless/weak-cache": "^0.0.1"
|
|
41
41
|
},
|
|
@@ -107,12 +107,12 @@
|
|
|
107
107
|
"zod": "^3.21.4",
|
|
108
108
|
"zod-to-json-schema": "^3.22.3",
|
|
109
109
|
"@awsless/duration": "^0.0.1",
|
|
110
|
-
"@awsless/graphql": "^0.0.9",
|
|
111
110
|
"@awsless/formation": "^0.0.45",
|
|
112
|
-
"@awsless/code": "^0.0.10",
|
|
113
111
|
"@awsless/size": "^0.0.1",
|
|
112
|
+
"@awsless/graphql": "^0.0.9",
|
|
114
113
|
"@awsless/validate": "^0.0.14",
|
|
115
|
-
"@awsless/ts-file-cache": "^0.0.1"
|
|
114
|
+
"@awsless/ts-file-cache": "^0.0.1",
|
|
115
|
+
"@awsless/code": "^0.0.10"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
118
118
|
"test": "pnpm code test",
|