@awsless/awsless 0.0.551 → 0.0.552
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 +95 -54
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.js +15 -11
- package/package.json +11 -11
package/dist/bin.js
CHANGED
|
@@ -922,11 +922,11 @@ var FunctionDefaultSchema = z14.object({
|
|
|
922
922
|
// container
|
|
923
923
|
warm: WarmSchema.default(0),
|
|
924
924
|
vpc: VPCSchema.default(false),
|
|
925
|
-
log: LogSchema.default(true).transform((
|
|
926
|
-
retention:
|
|
927
|
-
level: "level" in
|
|
928
|
-
system: "system" in
|
|
929
|
-
format: "format" in
|
|
925
|
+
log: LogSchema.default(true).transform((log26) => ({
|
|
926
|
+
retention: log26.retention ?? days(7),
|
|
927
|
+
level: "level" in log26 ? log26.level : "error",
|
|
928
|
+
system: "system" in log26 ? log26.system : "warn",
|
|
929
|
+
format: "format" in log26 ? log26.format : "json"
|
|
930
930
|
})),
|
|
931
931
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
932
932
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1286,8 +1286,8 @@ var InstanceDefaultSchema = z23.object({
|
|
|
1286
1286
|
permissions: PermissionsSchema2.optional(),
|
|
1287
1287
|
healthCheck: HealthCheckSchema.optional(),
|
|
1288
1288
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1289
|
-
log: LogSchema2.default(true).transform((
|
|
1290
|
-
retention:
|
|
1289
|
+
log: LogSchema2.default(true).transform((log26) => ({
|
|
1290
|
+
retention: log26.retention ?? days3(7)
|
|
1291
1291
|
}))
|
|
1292
1292
|
}).default({});
|
|
1293
1293
|
|
|
@@ -5936,6 +5936,10 @@ var testFeature = defineFeature({
|
|
|
5936
5936
|
onStack(ctx) {
|
|
5937
5937
|
if (ctx.stackConfig.tests) {
|
|
5938
5938
|
ctx.registerTest(ctx.stackConfig.name, ctx.stackConfig.tests);
|
|
5939
|
+
} else {
|
|
5940
|
+
ctx.addWarning({
|
|
5941
|
+
message: `Stack ${color.info(ctx.stack.name)} has no tests defined. Consider adding test cases to ensure stability.`
|
|
5942
|
+
});
|
|
5939
5943
|
}
|
|
5940
5944
|
}
|
|
5941
5945
|
});
|
|
@@ -7270,6 +7274,8 @@ import { kebabCase as kebabCase8, constantCase as constantCase15 } from "change-
|
|
|
7270
7274
|
import { toSeconds as toSeconds11 } from "@awsless/duration";
|
|
7271
7275
|
var typeGenCode9 = `
|
|
7272
7276
|
import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
|
|
7277
|
+
import { type Duration } from '@awsless/duration'
|
|
7278
|
+
import { type Size } from '@awsless/size'
|
|
7273
7279
|
|
|
7274
7280
|
type PutResponse = ReturnType<typeof putData>
|
|
7275
7281
|
type Batch = typeof batchPutData
|
|
@@ -7774,6 +7780,7 @@ var createApp = (props) => {
|
|
|
7774
7780
|
const commands9 = [];
|
|
7775
7781
|
const configs = /* @__PURE__ */ new Set();
|
|
7776
7782
|
const tests = [];
|
|
7783
|
+
const warnings = [];
|
|
7777
7784
|
const builders = [];
|
|
7778
7785
|
const domainZones = [];
|
|
7779
7786
|
const readyListeners = [];
|
|
@@ -7800,7 +7807,10 @@ var createApp = (props) => {
|
|
|
7800
7807
|
appId,
|
|
7801
7808
|
base,
|
|
7802
7809
|
zones,
|
|
7803
|
-
shared
|
|
7810
|
+
shared,
|
|
7811
|
+
addWarning(props2) {
|
|
7812
|
+
warnings.push(props2);
|
|
7813
|
+
}
|
|
7804
7814
|
});
|
|
7805
7815
|
}
|
|
7806
7816
|
for (const feature of features) {
|
|
@@ -7822,6 +7832,9 @@ var createApp = (props) => {
|
|
|
7822
7832
|
addAppPermission(permission) {
|
|
7823
7833
|
appPermissions.push(permission);
|
|
7824
7834
|
},
|
|
7835
|
+
addWarning(props2) {
|
|
7836
|
+
warnings.push(props2);
|
|
7837
|
+
},
|
|
7825
7838
|
registerBuild(type, name, builder) {
|
|
7826
7839
|
builders.push({
|
|
7827
7840
|
stackName: base.name,
|
|
@@ -7887,6 +7900,9 @@ var createApp = (props) => {
|
|
|
7887
7900
|
addStackPermission(permission) {
|
|
7888
7901
|
stackPermissions.push(permission);
|
|
7889
7902
|
},
|
|
7903
|
+
addWarning(props2) {
|
|
7904
|
+
warnings.push(props2);
|
|
7905
|
+
},
|
|
7890
7906
|
// onGlobalPolicy(callback) {
|
|
7891
7907
|
// globalPoliciesListeners.push(callback)
|
|
7892
7908
|
// },
|
|
@@ -8015,6 +8031,7 @@ var createApp = (props) => {
|
|
|
8015
8031
|
binds,
|
|
8016
8032
|
shared,
|
|
8017
8033
|
configs,
|
|
8034
|
+
warnings,
|
|
8018
8035
|
builders,
|
|
8019
8036
|
commands: commands9
|
|
8020
8037
|
// deploymentLine,
|
|
@@ -8283,7 +8300,7 @@ var del2 = (program2) => {
|
|
|
8283
8300
|
};
|
|
8284
8301
|
|
|
8285
8302
|
// src/cli/command/deploy.ts
|
|
8286
|
-
import { log as
|
|
8303
|
+
import { log as log17, prompt as prompt6 } from "@awsless/clui";
|
|
8287
8304
|
import wildstring4 from "wildstring";
|
|
8288
8305
|
|
|
8289
8306
|
// src/cli/ui/complex/run-tests.ts
|
|
@@ -8410,8 +8427,8 @@ var CustomReporter = class {
|
|
|
8410
8427
|
this.cache = cache;
|
|
8411
8428
|
}
|
|
8412
8429
|
}
|
|
8413
|
-
onUserConsoleLog(
|
|
8414
|
-
this.logs.push(
|
|
8430
|
+
onUserConsoleLog(log26) {
|
|
8431
|
+
this.logs.push(log26.content.trimEnd());
|
|
8415
8432
|
}
|
|
8416
8433
|
runningTask(tasks) {
|
|
8417
8434
|
return tasks.find((t) => t.result?.state === "run");
|
|
@@ -8513,7 +8530,7 @@ var formatResult = (props) => {
|
|
|
8513
8530
|
var logTestLogs = (event) => {
|
|
8514
8531
|
if (event.logs.length > 0) {
|
|
8515
8532
|
log15.message(color.info.bold.inverse(" LOGS "), color.dim(icon.dot));
|
|
8516
|
-
log15.message(event.logs.map((
|
|
8533
|
+
log15.message(event.logs.map((log26) => wrap(log26, { hard: true })).join("\n"));
|
|
8517
8534
|
}
|
|
8518
8535
|
};
|
|
8519
8536
|
var logTestErrors = (event) => {
|
|
@@ -8620,6 +8637,29 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
|
|
|
8620
8637
|
return true;
|
|
8621
8638
|
};
|
|
8622
8639
|
|
|
8640
|
+
// src/cli/ui/complex/show-warnings.ts
|
|
8641
|
+
import { log as log16, prompt as prompt5 } from "@awsless/clui";
|
|
8642
|
+
var showWarnings = async (warnings) => {
|
|
8643
|
+
for (const warning of warnings) {
|
|
8644
|
+
log16.warning(
|
|
8645
|
+
[
|
|
8646
|
+
//
|
|
8647
|
+
color.warning("Warning!"),
|
|
8648
|
+
warning.message
|
|
8649
|
+
].join("\n")
|
|
8650
|
+
);
|
|
8651
|
+
}
|
|
8652
|
+
if (warnings.length > 0) {
|
|
8653
|
+
const result = await prompt5.confirm({
|
|
8654
|
+
initialValue: false,
|
|
8655
|
+
message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
|
|
8656
|
+
});
|
|
8657
|
+
if (!result) {
|
|
8658
|
+
throw new Cancelled();
|
|
8659
|
+
}
|
|
8660
|
+
}
|
|
8661
|
+
};
|
|
8662
|
+
|
|
8623
8663
|
// src/cli/command/deploy.ts
|
|
8624
8664
|
var deploy = (program2) => {
|
|
8625
8665
|
program2.command("deploy").argument("[stacks...]", "Optionally filter stacks to deploy").option("--skip-tests", "Skip tests").option("--import", "Import already existing resources").description("Deploy your app to AWS").action(async (filters, options) => {
|
|
@@ -8629,12 +8669,13 @@ var deploy = (program2) => {
|
|
|
8629
8669
|
const credentials = getCredentials(profile);
|
|
8630
8670
|
const accountId = await getAccountId(credentials, region);
|
|
8631
8671
|
await bootstrapAwsless({ credentials, region, accountId });
|
|
8632
|
-
const { app, tests, builders, ready } = createApp({
|
|
8672
|
+
const { app, tests, warnings, builders, ready } = createApp({
|
|
8633
8673
|
appConfig,
|
|
8634
8674
|
stackConfigs,
|
|
8635
8675
|
accountId,
|
|
8636
8676
|
import: options.import
|
|
8637
8677
|
});
|
|
8678
|
+
await showWarnings(warnings);
|
|
8638
8679
|
const stackNames = app.stacks.filter((stack) => {
|
|
8639
8680
|
return !!filters.find((f) => wildstring4.match(f, stack.name));
|
|
8640
8681
|
}).map((s) => s.name);
|
|
@@ -8646,7 +8687,7 @@ var deploy = (program2) => {
|
|
|
8646
8687
|
if (!process.env.SKIP_PROMPT) {
|
|
8647
8688
|
const deployAll = filters.length === 0;
|
|
8648
8689
|
const deploySingle = filters.length === 1;
|
|
8649
|
-
const ok = await
|
|
8690
|
+
const ok = await prompt6.confirm({
|
|
8650
8691
|
message: deployAll ? `Are you sure you want to deploy ${color.warning("all")} stacks?` : deploySingle ? `Are you sure you want to deploy the ${formattedFilter} stack?` : `Are you sure you want to deploy the [ ${formattedFilter} ] stacks?`
|
|
8651
8692
|
});
|
|
8652
8693
|
if (!ok) {
|
|
@@ -8669,7 +8710,7 @@ var deploy = (program2) => {
|
|
|
8669
8710
|
profile,
|
|
8670
8711
|
region
|
|
8671
8712
|
});
|
|
8672
|
-
await
|
|
8713
|
+
await log17.task({
|
|
8673
8714
|
initialMessage: "Deploying the stacks to AWS",
|
|
8674
8715
|
successMessage: "Done deploying the stacks to AWS.",
|
|
8675
8716
|
async task() {
|
|
@@ -8691,7 +8732,7 @@ import {
|
|
|
8691
8732
|
AdminSetUserPasswordCommand,
|
|
8692
8733
|
CognitoIdentityProviderClient
|
|
8693
8734
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
8694
|
-
import { prompt as
|
|
8735
|
+
import { prompt as prompt7 } from "@awsless/clui";
|
|
8695
8736
|
var create = (program2) => {
|
|
8696
8737
|
program2.command("create").argument("[name]", "The name of the auth instance").description("Create an user for your userpool").action(async (name) => {
|
|
8697
8738
|
await layout("auth user create", async ({ appConfig, stackConfigs }) => {
|
|
@@ -8703,7 +8744,7 @@ var create = (program2) => {
|
|
|
8703
8744
|
throw new ExpectedError("No auth resources are defined.");
|
|
8704
8745
|
}
|
|
8705
8746
|
if (!name) {
|
|
8706
|
-
name = await
|
|
8747
|
+
name = await prompt7.select({
|
|
8707
8748
|
message: "Select the auth userpool:",
|
|
8708
8749
|
initialValue: Object.keys(appConfig.defaults.auth).at(0),
|
|
8709
8750
|
options: Object.keys(appConfig.defaults.auth).map((name2) => ({
|
|
@@ -8729,7 +8770,7 @@ var create = (program2) => {
|
|
|
8729
8770
|
} catch (_) {
|
|
8730
8771
|
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
8731
8772
|
}
|
|
8732
|
-
const user2 = await
|
|
8773
|
+
const user2 = await prompt7.text({
|
|
8733
8774
|
message: "Username:",
|
|
8734
8775
|
validate(value) {
|
|
8735
8776
|
if (!value) {
|
|
@@ -8738,7 +8779,7 @@ var create = (program2) => {
|
|
|
8738
8779
|
return;
|
|
8739
8780
|
}
|
|
8740
8781
|
});
|
|
8741
|
-
const pass = await
|
|
8782
|
+
const pass = await prompt7.password({
|
|
8742
8783
|
message: "Password:",
|
|
8743
8784
|
validate(value) {
|
|
8744
8785
|
if (!value) {
|
|
@@ -8786,7 +8827,7 @@ var auth = (program2) => {
|
|
|
8786
8827
|
};
|
|
8787
8828
|
|
|
8788
8829
|
// src/cli/command/bind.ts
|
|
8789
|
-
import { log as
|
|
8830
|
+
import { log as log18 } from "@awsless/clui";
|
|
8790
8831
|
import { constantCase as constantCase16 } from "change-case";
|
|
8791
8832
|
import { spawn } from "child_process";
|
|
8792
8833
|
var bind = (program2) => {
|
|
@@ -8809,9 +8850,9 @@ var bind = (program2) => {
|
|
|
8809
8850
|
env[name] = await value;
|
|
8810
8851
|
}
|
|
8811
8852
|
if (Object.keys(env).length > 0) {
|
|
8812
|
-
|
|
8853
|
+
log18.list("Bind Env", env);
|
|
8813
8854
|
} else {
|
|
8814
|
-
|
|
8855
|
+
log18.warning("No bindings available.");
|
|
8815
8856
|
}
|
|
8816
8857
|
const configList = opts.config ?? [];
|
|
8817
8858
|
const configs = {};
|
|
@@ -8819,7 +8860,7 @@ var bind = (program2) => {
|
|
|
8819
8860
|
configs[`CONFIG_${constantCase16(name)}`] = name;
|
|
8820
8861
|
}
|
|
8821
8862
|
if (configList.length ?? 0 > 0) {
|
|
8822
|
-
|
|
8863
|
+
log18.note("Bind Config", configList.map((v) => color.label(constantCase16(v))).join("\n"));
|
|
8823
8864
|
}
|
|
8824
8865
|
if (commands9.length === 0) {
|
|
8825
8866
|
return "No command to execute.";
|
|
@@ -8878,7 +8919,7 @@ var watchConfig = async (options, resolve, reject) => {
|
|
|
8878
8919
|
};
|
|
8879
8920
|
|
|
8880
8921
|
// src/cli/ui/complex/build-types.ts
|
|
8881
|
-
import { log as
|
|
8922
|
+
import { log as log19 } from "@awsless/clui";
|
|
8882
8923
|
|
|
8883
8924
|
// src/type-gen/generate.ts
|
|
8884
8925
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -8912,7 +8953,7 @@ var generateTypes = async (props) => {
|
|
|
8912
8953
|
// src/cli/ui/complex/build-types.ts
|
|
8913
8954
|
var buildTypes = async (props) => {
|
|
8914
8955
|
await generateTypes(props);
|
|
8915
|
-
|
|
8956
|
+
log19.step("Done generating type definition files.");
|
|
8916
8957
|
};
|
|
8917
8958
|
|
|
8918
8959
|
// src/cli/command/dev.ts
|
|
@@ -8936,7 +8977,7 @@ var dev = (program2) => {
|
|
|
8936
8977
|
};
|
|
8937
8978
|
|
|
8938
8979
|
// src/cli/command/resources.ts
|
|
8939
|
-
import { log as
|
|
8980
|
+
import { log as log20 } from "@awsless/clui";
|
|
8940
8981
|
import chalk5 from "chalk";
|
|
8941
8982
|
import wildstring5 from "wildstring";
|
|
8942
8983
|
var resources = (program2) => {
|
|
@@ -8958,15 +8999,15 @@ var resources = (program2) => {
|
|
|
8958
8999
|
continue;
|
|
8959
9000
|
}
|
|
8960
9001
|
}
|
|
8961
|
-
|
|
8962
|
-
|
|
9002
|
+
log20.step(chalk5.magenta(stack.name));
|
|
9003
|
+
log20.message(stack.resources.map((resource) => formatResource(stack, resource.$.urn)).join("\n"));
|
|
8963
9004
|
}
|
|
8964
9005
|
});
|
|
8965
9006
|
});
|
|
8966
9007
|
};
|
|
8967
9008
|
|
|
8968
9009
|
// src/cli/command/run.ts
|
|
8969
|
-
import { prompt as
|
|
9010
|
+
import { prompt as prompt8 } from "@awsless/clui";
|
|
8970
9011
|
import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
|
|
8971
9012
|
import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
|
|
8972
9013
|
import { LambdaClient as LambdaClient2, lambdaClient } from "@awsless/lambda";
|
|
@@ -8987,7 +9028,7 @@ var run = (program2) => {
|
|
|
8987
9028
|
return cmd.name === selected;
|
|
8988
9029
|
});
|
|
8989
9030
|
} else {
|
|
8990
|
-
command = await
|
|
9031
|
+
command = await prompt8.select({
|
|
8991
9032
|
message: "Pick the command you want to run:",
|
|
8992
9033
|
initialValue: commands9[0],
|
|
8993
9034
|
options: commands9.map((cmd) => ({
|
|
@@ -9043,7 +9084,7 @@ var pull = (program2) => {
|
|
|
9043
9084
|
};
|
|
9044
9085
|
|
|
9045
9086
|
// src/cli/command/state/push.ts
|
|
9046
|
-
import { prompt as
|
|
9087
|
+
import { prompt as prompt9 } from "@awsless/clui";
|
|
9047
9088
|
var push = (program2) => {
|
|
9048
9089
|
program2.command("push").description("Push the local state to the remote server").action(async () => {
|
|
9049
9090
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9053,7 +9094,7 @@ var push = (program2) => {
|
|
|
9053
9094
|
const accountId = await getAccountId(credentials, region);
|
|
9054
9095
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9055
9096
|
const { state: state2 } = await createWorkSpace({ credentials, region, accountId, profile });
|
|
9056
|
-
const ok = await
|
|
9097
|
+
const ok = await prompt9.confirm({
|
|
9057
9098
|
message: "Pushing up the local state might corrupt your remote state. Are you sure?",
|
|
9058
9099
|
initialValue: false
|
|
9059
9100
|
});
|
|
@@ -9067,7 +9108,7 @@ var push = (program2) => {
|
|
|
9067
9108
|
};
|
|
9068
9109
|
|
|
9069
9110
|
// src/cli/command/state/unlock.ts
|
|
9070
|
-
import { prompt as
|
|
9111
|
+
import { prompt as prompt10 } from "@awsless/clui";
|
|
9071
9112
|
var unlock = (program2) => {
|
|
9072
9113
|
program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
|
|
9073
9114
|
await layout("state unlock", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9081,7 +9122,7 @@ var unlock = (program2) => {
|
|
|
9081
9122
|
if (!isLocked) {
|
|
9082
9123
|
return "No lock is exists.";
|
|
9083
9124
|
}
|
|
9084
|
-
const ok = await
|
|
9125
|
+
const ok = await prompt10.confirm({
|
|
9085
9126
|
message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
|
|
9086
9127
|
initialValue: false
|
|
9087
9128
|
});
|
|
@@ -9131,7 +9172,7 @@ var types = (program2) => {
|
|
|
9131
9172
|
};
|
|
9132
9173
|
|
|
9133
9174
|
// src/cli/command/domain/list.ts
|
|
9134
|
-
import { log as
|
|
9175
|
+
import { log as log21 } from "@awsless/clui";
|
|
9135
9176
|
var list2 = (program2) => {
|
|
9136
9177
|
program2.command("list").description("List all domains").action(async () => {
|
|
9137
9178
|
await layout("domain list", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9153,7 +9194,7 @@ var list2 = (program2) => {
|
|
|
9153
9194
|
});
|
|
9154
9195
|
await workspace.hydrate(app);
|
|
9155
9196
|
for (const zone of domainZones) {
|
|
9156
|
-
|
|
9197
|
+
log21.step(
|
|
9157
9198
|
[
|
|
9158
9199
|
//
|
|
9159
9200
|
color.label.green(await zone.name),
|
|
@@ -9161,14 +9202,14 @@ var list2 = (program2) => {
|
|
|
9161
9202
|
color.dim(await zone.id)
|
|
9162
9203
|
].join(" ")
|
|
9163
9204
|
);
|
|
9164
|
-
|
|
9205
|
+
log21.message((await zone.nameServers).join("\n"));
|
|
9165
9206
|
}
|
|
9166
9207
|
});
|
|
9167
9208
|
});
|
|
9168
9209
|
};
|
|
9169
9210
|
|
|
9170
9211
|
// src/cli/command/domain/deploy.ts
|
|
9171
|
-
import { log as
|
|
9212
|
+
import { log as log22 } from "@awsless/clui";
|
|
9172
9213
|
var deploy2 = (program2) => {
|
|
9173
9214
|
program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
|
|
9174
9215
|
await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9188,7 +9229,7 @@ var deploy2 = (program2) => {
|
|
|
9188
9229
|
profile,
|
|
9189
9230
|
region
|
|
9190
9231
|
});
|
|
9191
|
-
await
|
|
9232
|
+
await log22.task({
|
|
9192
9233
|
initialMessage: "Deploying the domain zones to AWS...",
|
|
9193
9234
|
successMessage: "Done deploying the domain zones to AWS.",
|
|
9194
9235
|
errorMessage: "Failed deploying the domain zones to AWS.",
|
|
@@ -9197,7 +9238,7 @@ var deploy2 = (program2) => {
|
|
|
9197
9238
|
}
|
|
9198
9239
|
});
|
|
9199
9240
|
for (const zone of domainZones) {
|
|
9200
|
-
|
|
9241
|
+
log22.step(
|
|
9201
9242
|
[
|
|
9202
9243
|
//
|
|
9203
9244
|
color.label.green(await zone.name),
|
|
@@ -9205,7 +9246,7 @@ var deploy2 = (program2) => {
|
|
|
9205
9246
|
color.dim(await zone.id)
|
|
9206
9247
|
].join(" ")
|
|
9207
9248
|
);
|
|
9208
|
-
|
|
9249
|
+
log22.message((await zone.nameServers).join("\n"));
|
|
9209
9250
|
}
|
|
9210
9251
|
});
|
|
9211
9252
|
});
|
|
@@ -9224,7 +9265,7 @@ var domain = (program2) => {
|
|
|
9224
9265
|
|
|
9225
9266
|
// src/cli/command/logs.ts
|
|
9226
9267
|
import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
9227
|
-
import { log as
|
|
9268
|
+
import { log as log23 } from "@awsless/clui";
|
|
9228
9269
|
import chalk6 from "chalk";
|
|
9229
9270
|
import chunk2 from "chunk";
|
|
9230
9271
|
import { formatDate } from "date-fns";
|
|
@@ -9266,7 +9307,7 @@ var logs = (program2) => {
|
|
|
9266
9307
|
process.once("SIGINT", () => {
|
|
9267
9308
|
abort.abort();
|
|
9268
9309
|
});
|
|
9269
|
-
const streams = await
|
|
9310
|
+
const streams = await log23.task({
|
|
9270
9311
|
initialMessage: "Connecting to the log stream...",
|
|
9271
9312
|
errorMessage: "Failed to connect to the log stream.",
|
|
9272
9313
|
async task(update) {
|
|
@@ -9323,7 +9364,7 @@ var formatLog = (level, date, group, message) => {
|
|
|
9323
9364
|
SYSTEM: chalk6.blue
|
|
9324
9365
|
};
|
|
9325
9366
|
const levelColor = levels[level] ?? chalk6.cyan;
|
|
9326
|
-
|
|
9367
|
+
log23.message(
|
|
9327
9368
|
[
|
|
9328
9369
|
[
|
|
9329
9370
|
//
|
|
@@ -9365,7 +9406,7 @@ var parseJsonLog = (message) => {
|
|
|
9365
9406
|
// src/cli/command/image/clear-cache.ts
|
|
9366
9407
|
import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
|
|
9367
9408
|
import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
9368
|
-
import { Cancelled as Cancelled2, log as
|
|
9409
|
+
import { Cancelled as Cancelled2, log as log24, prompt as prompt11 } from "@awsless/clui";
|
|
9369
9410
|
import { randomUUID } from "crypto";
|
|
9370
9411
|
var clearCache = (program2) => {
|
|
9371
9412
|
program2.command("cache-clear").argument("[stack]", "The stack name of the image proxy").argument("[name]", "The name of the image proxy").description("Clears the cache of the image proxy").action(async (stack, name) => {
|
|
@@ -9381,7 +9422,7 @@ var clearCache = (program2) => {
|
|
|
9381
9422
|
}
|
|
9382
9423
|
return;
|
|
9383
9424
|
});
|
|
9384
|
-
stack = await
|
|
9425
|
+
stack = await prompt11.select({
|
|
9385
9426
|
message: "Select the stack:",
|
|
9386
9427
|
options: imageStacks.map((stack2) => ({
|
|
9387
9428
|
label: stack2.name,
|
|
@@ -9398,7 +9439,7 @@ var clearCache = (program2) => {
|
|
|
9398
9439
|
if (!names) {
|
|
9399
9440
|
throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
|
|
9400
9441
|
}
|
|
9401
|
-
name = await
|
|
9442
|
+
name = await prompt11.select({
|
|
9402
9443
|
message: "Select the image resource:",
|
|
9403
9444
|
options: names.map((name2) => ({
|
|
9404
9445
|
label: name2,
|
|
@@ -9406,7 +9447,7 @@ var clearCache = (program2) => {
|
|
|
9406
9447
|
}))
|
|
9407
9448
|
});
|
|
9408
9449
|
}
|
|
9409
|
-
const ok = await
|
|
9450
|
+
const ok = await prompt11.confirm({
|
|
9410
9451
|
message: `Are you sure you want to clear the cache`
|
|
9411
9452
|
});
|
|
9412
9453
|
if (!ok) {
|
|
@@ -9437,7 +9478,7 @@ var clearCache = (program2) => {
|
|
|
9437
9478
|
region: "us-east-1"
|
|
9438
9479
|
});
|
|
9439
9480
|
let totalDeleted = 0;
|
|
9440
|
-
await
|
|
9481
|
+
await log24.task({
|
|
9441
9482
|
initialMessage: "Clearing cache...",
|
|
9442
9483
|
successMessage: "Cache successfully cleared.",
|
|
9443
9484
|
task: async () => {
|
|
@@ -9499,7 +9540,7 @@ var image = (program2) => {
|
|
|
9499
9540
|
// src/cli/command/icon/clear-cache.ts
|
|
9500
9541
|
import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
|
|
9501
9542
|
import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
|
|
9502
|
-
import { Cancelled as Cancelled3, log as
|
|
9543
|
+
import { Cancelled as Cancelled3, log as log25, prompt as prompt12 } from "@awsless/clui";
|
|
9503
9544
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9504
9545
|
var clearCache2 = (program2) => {
|
|
9505
9546
|
program2.command("cache-clear").argument("[stack]", "The stack name of the icon proxy").argument("[name]", "The name of the icon proxy").description("Clears the cache of the icon proxy").action(async (stack, name) => {
|
|
@@ -9515,7 +9556,7 @@ var clearCache2 = (program2) => {
|
|
|
9515
9556
|
}
|
|
9516
9557
|
return;
|
|
9517
9558
|
});
|
|
9518
|
-
stack = await
|
|
9559
|
+
stack = await prompt12.select({
|
|
9519
9560
|
message: "Select the stack:",
|
|
9520
9561
|
options: iconStacks.map((stack2) => ({
|
|
9521
9562
|
label: stack2.name,
|
|
@@ -9532,7 +9573,7 @@ var clearCache2 = (program2) => {
|
|
|
9532
9573
|
if (!names) {
|
|
9533
9574
|
throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
|
|
9534
9575
|
}
|
|
9535
|
-
name = await
|
|
9576
|
+
name = await prompt12.select({
|
|
9536
9577
|
message: "Select the icon resource:",
|
|
9537
9578
|
options: names.map((name2) => ({
|
|
9538
9579
|
label: name2,
|
|
@@ -9540,7 +9581,7 @@ var clearCache2 = (program2) => {
|
|
|
9540
9581
|
}))
|
|
9541
9582
|
});
|
|
9542
9583
|
}
|
|
9543
|
-
const ok = await
|
|
9584
|
+
const ok = await prompt12.confirm({
|
|
9544
9585
|
message: `Are you sure you want to clear the cache`
|
|
9545
9586
|
});
|
|
9546
9587
|
if (!ok) {
|
|
@@ -9571,7 +9612,7 @@ var clearCache2 = (program2) => {
|
|
|
9571
9612
|
region: "us-east-1"
|
|
9572
9613
|
});
|
|
9573
9614
|
let totalDeleted = 0;
|
|
9574
|
-
await
|
|
9615
|
+
await log25.task({
|
|
9575
9616
|
initialMessage: "Clearing cache...",
|
|
9576
9617
|
successMessage: "Cache successfully cleared.",
|
|
9577
9618
|
task: async () => {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/server.js
CHANGED
|
@@ -16,6 +16,7 @@ import { publish } from "@awsless/sns";
|
|
|
16
16
|
import { kebabCase } from "change-case";
|
|
17
17
|
var APP = process.env.APP ?? "app";
|
|
18
18
|
var STACK = process.env.STACK ?? "stack";
|
|
19
|
+
var IS_TEST = process.env.NODE_ENV === "test";
|
|
19
20
|
var build = (opt) => {
|
|
20
21
|
return [
|
|
21
22
|
//
|
|
@@ -396,7 +397,6 @@ import { kebabCase as kebabCase2 } from "change-case";
|
|
|
396
397
|
var getConfigName = (name) => {
|
|
397
398
|
return `/.awsless/${APP}/${name}`;
|
|
398
399
|
};
|
|
399
|
-
var IS_TEST = process.env.NODE_ENV === "test";
|
|
400
400
|
var loadConfigData = /* @__NO_SIDE_EFFECTS__ */ async () => {
|
|
401
401
|
if (!IS_TEST) {
|
|
402
402
|
const keys = [];
|
|
@@ -473,18 +473,22 @@ var Metric = /* @__PURE__ */ createProxy((stack) => {
|
|
|
473
473
|
const name = getMetricName(metricName);
|
|
474
474
|
const namespace = getMetricNamespace(stack);
|
|
475
475
|
const unit = process.env[`METRIC_${constantCase4(metricName)}`];
|
|
476
|
-
|
|
476
|
+
let metric;
|
|
477
|
+
if (!unit && !IS_TEST) {
|
|
477
478
|
throw new TypeError(`Metric "${name}" isn't defined in your stack.`);
|
|
479
|
+
} else if (!unit) {
|
|
480
|
+
metric = createMetric({ name, namespace });
|
|
481
|
+
} else {
|
|
482
|
+
const factories = {
|
|
483
|
+
number: createMetric,
|
|
484
|
+
size: createSizeMetric,
|
|
485
|
+
duration: createDurationMetric
|
|
486
|
+
};
|
|
487
|
+
metric = factories[unit]({
|
|
488
|
+
name,
|
|
489
|
+
namespace
|
|
490
|
+
});
|
|
478
491
|
}
|
|
479
|
-
const factories = {
|
|
480
|
-
number: createMetric,
|
|
481
|
-
size: createSizeMetric,
|
|
482
|
-
duration: createDurationMetric
|
|
483
|
-
};
|
|
484
|
-
const metric = factories[unit]({
|
|
485
|
-
name,
|
|
486
|
-
namespace
|
|
487
|
-
});
|
|
488
492
|
return {
|
|
489
493
|
name,
|
|
490
494
|
namespace,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.552",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"@awsless/clui": "^0.0.7",
|
|
38
38
|
"@awsless/duration": "^0.0.3",
|
|
39
39
|
"@awsless/json": "^0.0.10",
|
|
40
|
-
"@awsless/dynamodb": "^0.2.6",
|
|
41
40
|
"@awsless/iot": "^0.0.3",
|
|
41
|
+
"@awsless/dynamodb": "^0.2.6",
|
|
42
42
|
"@awsless/lambda": "^0.0.33",
|
|
43
|
-
"@awsless/mqtt": "^0.0.2",
|
|
44
43
|
"@awsless/open-search": "^0.0.21",
|
|
44
|
+
"@awsless/mqtt": "^0.0.2",
|
|
45
45
|
"@awsless/redis": "^0.0.14",
|
|
46
|
-
"@awsless/ssm": "^0.0.7",
|
|
47
|
-
"@awsless/validate": "^0.0.19",
|
|
48
46
|
"@awsless/sns": "^0.0.10",
|
|
49
47
|
"@awsless/sqs": "^0.0.8",
|
|
50
|
-
"@awsless/
|
|
48
|
+
"@awsless/s3": "^0.0.21",
|
|
49
|
+
"@awsless/validate": "^0.0.19",
|
|
51
50
|
"@awsless/cloudwatch": "^0.0.1",
|
|
52
|
-
"@awsless/
|
|
51
|
+
"@awsless/ssm": "^0.0.7",
|
|
52
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -132,16 +132,16 @@
|
|
|
132
132
|
"zip-a-folder": "^3.1.6",
|
|
133
133
|
"zod": "^3.24.2",
|
|
134
134
|
"zod-to-json-schema": "^3.24.3",
|
|
135
|
-
"@awsless/big-float": "^0.1.3",
|
|
136
|
-
"@awsless/duration": "^0.0.3",
|
|
137
|
-
"@awsless/formation": "^0.0.79",
|
|
138
135
|
"@awsless/clui": "^0.0.7",
|
|
136
|
+
"@awsless/duration": "^0.0.3",
|
|
139
137
|
"@awsless/graphql": "^0.0.9",
|
|
138
|
+
"@awsless/formation": "^0.0.79",
|
|
140
139
|
"@awsless/json": "^0.0.10",
|
|
141
140
|
"@awsless/scheduler": "^0.0.4",
|
|
141
|
+
"@awsless/big-float": "^0.1.3",
|
|
142
142
|
"@awsless/size": "^0.0.2",
|
|
143
|
-
"@awsless/validate": "^0.0.19",
|
|
144
143
|
"@awsless/ts-file-cache": "^0.0.12",
|
|
144
|
+
"@awsless/validate": "^0.0.19",
|
|
145
145
|
"@awsless/cloudwatch": "^0.0.1"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|