@awsless/awsless 0.0.598 → 0.0.600
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/app.json +1 -1
- package/dist/bin.js +178 -96
- package/dist/build-json-schema.js +1 -0
- 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/package.json +12 -12
package/dist/bin.js
CHANGED
|
@@ -826,6 +826,7 @@ var AuthDefaultSchema = z9.record(
|
|
|
826
826
|
// .optional()
|
|
827
827
|
// .describe('The email configuration for sending messages.'),
|
|
828
828
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
829
|
+
groups: z9.string().array().default([]).describe("Specifies a list of groups that a user can belong to."),
|
|
829
830
|
username: z9.object({
|
|
830
831
|
// emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
|
|
831
832
|
caseSensitive: z9.boolean().default(false).describe(
|
|
@@ -1084,11 +1085,11 @@ var FunctionDefaultSchema = z15.object({
|
|
|
1084
1085
|
// container
|
|
1085
1086
|
warm: WarmSchema.default(0),
|
|
1086
1087
|
vpc: VPCSchema.default(false),
|
|
1087
|
-
log: LogSchema.default(true).transform((
|
|
1088
|
-
retention:
|
|
1089
|
-
level: "level" in
|
|
1090
|
-
system: "system" in
|
|
1091
|
-
format: "format" in
|
|
1088
|
+
log: LogSchema.default(true).transform((log28) => ({
|
|
1089
|
+
retention: log28.retention ?? days(7),
|
|
1090
|
+
level: "level" in log28 ? log28.level : "error",
|
|
1091
|
+
system: "system" in log28 ? log28.system : "warn",
|
|
1092
|
+
format: "format" in log28 ? log28.format : "json"
|
|
1092
1093
|
})),
|
|
1093
1094
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
1094
1095
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1616,8 +1617,8 @@ var InstanceDefaultSchema = z25.object({
|
|
|
1616
1617
|
permissions: PermissionsSchema2.optional(),
|
|
1617
1618
|
healthCheck: HealthCheckSchema.optional(),
|
|
1618
1619
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1619
|
-
log: LogSchema2.default(true).transform((
|
|
1620
|
-
retention:
|
|
1620
|
+
log: LogSchema2.default(true).transform((log28) => ({
|
|
1621
|
+
retention: log28.retention ?? days4(7)
|
|
1621
1622
|
}))
|
|
1622
1623
|
}).default({});
|
|
1623
1624
|
|
|
@@ -2738,6 +2739,12 @@ var authFeature = defineFeature({
|
|
|
2738
2739
|
explicitAuthFlows: ["ALLOW_USER_SRP_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"],
|
|
2739
2740
|
preventUserExistenceErrors: "ENABLED"
|
|
2740
2741
|
});
|
|
2742
|
+
for (const name2 of props.groups) {
|
|
2743
|
+
new aws2.cognito.UserGroup(group, name2, {
|
|
2744
|
+
name: name2,
|
|
2745
|
+
userPoolId: userPool.id
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2741
2748
|
ctx.bind(`AUTH_${constantCase2(id)}_USER_POOL_ID`, userPool.id);
|
|
2742
2749
|
ctx.bind(`AUTH_${constantCase2(id)}_CLIENT_ID`, client.id);
|
|
2743
2750
|
ctx.shared.add("auth", "user-pool-arn", id, userPool.arn);
|
|
@@ -4543,7 +4550,7 @@ var restFeature = defineFeature({
|
|
|
4543
4550
|
});
|
|
4544
4551
|
|
|
4545
4552
|
// src/feature/rpc/index.ts
|
|
4546
|
-
import { camelCase as camelCase5, kebabCase as kebabCase6 } from "change-case";
|
|
4553
|
+
import { camelCase as camelCase5, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
4547
4554
|
import { Group as Group13 } from "@terraforge/core";
|
|
4548
4555
|
import { aws as aws14 } from "@terraforge/aws";
|
|
4549
4556
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
@@ -4860,6 +4867,12 @@ var rpcFeature = defineFeature({
|
|
|
4860
4867
|
const authGroup = new Group13(group, "auth", "authorizer");
|
|
4861
4868
|
const auth2 = createLambdaFunction(authGroup, ctx, "rpc", `${id}-auth`, props.auth);
|
|
4862
4869
|
result.setEnvironment("AUTH", auth2.name);
|
|
4870
|
+
for (const [authId, userPoolId] of ctx.shared.list("auth", "user-pool-id")) {
|
|
4871
|
+
auth2.setEnvironment(`AUTH_${constantCase8(authId.toString())}_USER_POOL_ID`, userPoolId);
|
|
4872
|
+
}
|
|
4873
|
+
for (const [authId, clientId] of ctx.shared.list("auth", "client-id")) {
|
|
4874
|
+
auth2.setEnvironment(`AUTH_${constantCase8(authId.toString())}_CLIENT_ID`, clientId);
|
|
4875
|
+
}
|
|
4863
4876
|
new UpdateFunctionCode(group, "update", {
|
|
4864
4877
|
version: auth2.code.sourceHash,
|
|
4865
4878
|
functionName: result.lambda.functionName,
|
|
@@ -4951,7 +4964,7 @@ var rpcFeature = defineFeature({
|
|
|
4951
4964
|
// src/feature/search/index.ts
|
|
4952
4965
|
import { Group as Group14 } from "@terraforge/core";
|
|
4953
4966
|
import { aws as aws15 } from "@terraforge/aws";
|
|
4954
|
-
import { constantCase as
|
|
4967
|
+
import { constantCase as constantCase9 } from "change-case";
|
|
4955
4968
|
import { toGibibytes as toGibibytes2 } from "@awsless/size";
|
|
4956
4969
|
var typeGenCode4 = `
|
|
4957
4970
|
import { AnyStruct, Table } from '@awsless/open-search'
|
|
@@ -5042,7 +5055,7 @@ var searchFeature = defineFeature({
|
|
|
5042
5055
|
retainOnDelete: ctx.appConfig.removal === "retain"
|
|
5043
5056
|
}
|
|
5044
5057
|
);
|
|
5045
|
-
ctx.addEnv(`SEARCH_${
|
|
5058
|
+
ctx.addEnv(`SEARCH_${constantCase9(ctx.stack.name)}_${constantCase9(id)}_DOMAIN`, openSearch.endpoint);
|
|
5046
5059
|
ctx.addStackPermission({
|
|
5047
5060
|
actions: ["es:ESHttp*"],
|
|
5048
5061
|
resources: [
|
|
@@ -5082,7 +5095,7 @@ var getContentType = (file) => {
|
|
|
5082
5095
|
};
|
|
5083
5096
|
|
|
5084
5097
|
// src/feature/site/index.ts
|
|
5085
|
-
import { constantCase as
|
|
5098
|
+
import { constantCase as constantCase10 } from "change-case";
|
|
5086
5099
|
|
|
5087
5100
|
// src/util/exec.ts
|
|
5088
5101
|
import { exec } from "promisify-child-process";
|
|
@@ -5132,7 +5145,7 @@ var siteFeature = defineFeature({
|
|
|
5132
5145
|
AWS_SESSION_TOKEN: credentials.sessionToken
|
|
5133
5146
|
};
|
|
5134
5147
|
for (const name2 of props.build?.configs ?? []) {
|
|
5135
|
-
env[`CONFIG_${
|
|
5148
|
+
env[`CONFIG_${constantCase10(name2)}`] = name2;
|
|
5136
5149
|
}
|
|
5137
5150
|
await execCommand({
|
|
5138
5151
|
cwd,
|
|
@@ -5475,7 +5488,7 @@ var storeFeature = defineFeature({
|
|
|
5475
5488
|
// src/feature/table/index.ts
|
|
5476
5489
|
import { Group as Group17 } from "@terraforge/core";
|
|
5477
5490
|
import { aws as aws18 } from "@terraforge/aws";
|
|
5478
|
-
import { constantCase as
|
|
5491
|
+
import { constantCase as constantCase11 } from "change-case";
|
|
5479
5492
|
import { toSeconds as toSeconds7 } from "@awsless/duration";
|
|
5480
5493
|
var tableFeature = defineFeature({
|
|
5481
5494
|
name: "table",
|
|
@@ -5557,8 +5570,8 @@ var tableFeature = defineFeature({
|
|
|
5557
5570
|
name,
|
|
5558
5571
|
billingMode: "PAY_PER_REQUEST",
|
|
5559
5572
|
streamEnabled: !!props.stream,
|
|
5560
|
-
streamViewType: props.stream &&
|
|
5561
|
-
tableClass:
|
|
5573
|
+
streamViewType: props.stream && constantCase11(props.stream?.type),
|
|
5574
|
+
tableClass: constantCase11(props.class),
|
|
5562
5575
|
hashKey: props.hash,
|
|
5563
5576
|
rangeKey: props.sort,
|
|
5564
5577
|
attribute: attributeDefinitions(),
|
|
@@ -5573,7 +5586,7 @@ var tableFeature = defineFeature({
|
|
|
5573
5586
|
name: name2,
|
|
5574
5587
|
hashKey: index.hash,
|
|
5575
5588
|
rangeKey: index.sort,
|
|
5576
|
-
projectionType:
|
|
5589
|
+
projectionType: constantCase11(index.projection)
|
|
5577
5590
|
})),
|
|
5578
5591
|
deletionProtectionEnabled: ctx.appConfig.removal === "retain"
|
|
5579
5592
|
},
|
|
@@ -6494,7 +6507,7 @@ import { toMebibytes as toMebibytes4 } from "@awsless/size";
|
|
|
6494
6507
|
import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
|
|
6495
6508
|
import { aws as aws26 } from "@terraforge/aws";
|
|
6496
6509
|
import { Group as Group25, Output as Output7, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
|
|
6497
|
-
import { constantCase as
|
|
6510
|
+
import { constantCase as constantCase12, pascalCase as pascalCase3 } from "change-case";
|
|
6498
6511
|
import deepmerge4 from "deepmerge";
|
|
6499
6512
|
import { join as join16 } from "path";
|
|
6500
6513
|
|
|
@@ -6522,7 +6535,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
|
|
|
6522
6535
|
}
|
|
6523
6536
|
if (!result.success) {
|
|
6524
6537
|
throw new ExpectedError(`Executable build failed:
|
|
6525
|
-
${result.logs?.map((
|
|
6538
|
+
${result.logs?.map((log28) => log28.message).join("\n")}`);
|
|
6526
6539
|
}
|
|
6527
6540
|
const file = await readFile4(filePath);
|
|
6528
6541
|
return {
|
|
@@ -6687,7 +6700,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6687
6700
|
executionRoleArn: executionRole.arn,
|
|
6688
6701
|
taskRoleArn: role.arn,
|
|
6689
6702
|
runtimePlatform: {
|
|
6690
|
-
cpuArchitecture:
|
|
6703
|
+
cpuArchitecture: constantCase12(props.architecture),
|
|
6691
6704
|
operatingSystemFamily: "LINUX"
|
|
6692
6705
|
},
|
|
6693
6706
|
trackLatest: true,
|
|
@@ -6895,7 +6908,7 @@ var instanceFeature = defineFeature({
|
|
|
6895
6908
|
// src/feature/metric/index.ts
|
|
6896
6909
|
import { Group as Group27 } from "@terraforge/core";
|
|
6897
6910
|
import { aws as aws28 } from "@terraforge/aws";
|
|
6898
|
-
import { kebabCase as kebabCase8, constantCase as
|
|
6911
|
+
import { kebabCase as kebabCase8, constantCase as constantCase13 } from "change-case";
|
|
6899
6912
|
import { toSeconds as toSeconds9 } from "@awsless/duration";
|
|
6900
6913
|
var typeGenCode9 = `
|
|
6901
6914
|
import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
|
|
@@ -6963,7 +6976,7 @@ var metricFeature = defineFeature({
|
|
|
6963
6976
|
});
|
|
6964
6977
|
for (const [id, props] of Object.entries(ctx.stackConfig.metrics ?? {})) {
|
|
6965
6978
|
const group = new Group27(ctx.stack, "metric", id);
|
|
6966
|
-
ctx.addEnv(`METRIC_${
|
|
6979
|
+
ctx.addEnv(`METRIC_${constantCase13(id)}`, props.type);
|
|
6967
6980
|
for (const alarmId in props.alarms ?? []) {
|
|
6968
6981
|
const alarmGroup = new Group27(group, "alarm", alarmId);
|
|
6969
6982
|
const alarmName = kebabCase8(`${id}-${alarmId}`);
|
|
@@ -7026,7 +7039,7 @@ var metricFeature = defineFeature({
|
|
|
7026
7039
|
import { days as days7, seconds as seconds9, toSeconds as toSeconds10, years } from "@awsless/duration";
|
|
7027
7040
|
import { Future, Group as Group28 } from "@terraforge/core";
|
|
7028
7041
|
import { aws as aws29 } from "@terraforge/aws";
|
|
7029
|
-
import { camelCase as camelCase7, constantCase as
|
|
7042
|
+
import { camelCase as camelCase7, constantCase as constantCase14 } from "change-case";
|
|
7030
7043
|
|
|
7031
7044
|
// src/feature/router/router-code.ts
|
|
7032
7045
|
var getViewerRequestFunctionCode = (props) => {
|
|
@@ -7618,7 +7631,7 @@ var routerFeature = defineFeature({
|
|
|
7618
7631
|
evaluateTargetHealth: false
|
|
7619
7632
|
}
|
|
7620
7633
|
});
|
|
7621
|
-
ctx.bind(`ROUTER_${
|
|
7634
|
+
ctx.bind(`ROUTER_${constantCase14(id)}_ENDPOINT`, domainName);
|
|
7622
7635
|
}
|
|
7623
7636
|
}
|
|
7624
7637
|
}
|
|
@@ -7963,16 +7976,13 @@ import { App as App2, Stack } from "@terraforge/core";
|
|
|
7963
7976
|
var SharedData = class {
|
|
7964
7977
|
data = /* @__PURE__ */ new Map();
|
|
7965
7978
|
entries = /* @__PURE__ */ new Map();
|
|
7966
|
-
|
|
7979
|
+
get(feature, name) {
|
|
7980
|
+
const key = `${feature}/${name.toString()}`;
|
|
7967
7981
|
if (!this.data.has(key)) {
|
|
7968
7982
|
throw new TypeError(`Shared data not found: ${key}`);
|
|
7969
7983
|
}
|
|
7970
7984
|
return this.data.get(key);
|
|
7971
7985
|
}
|
|
7972
|
-
get(feature, name) {
|
|
7973
|
-
const key = `${feature}/${name.toString()}`;
|
|
7974
|
-
return this.#get(key);
|
|
7975
|
-
}
|
|
7976
7986
|
has(feature, name) {
|
|
7977
7987
|
const key = `${feature}/${name.toString()}`;
|
|
7978
7988
|
return this.data.has(key);
|
|
@@ -7983,14 +7993,28 @@ var SharedData = class {
|
|
|
7983
7993
|
return this;
|
|
7984
7994
|
}
|
|
7985
7995
|
entry(feature, name, entry) {
|
|
7986
|
-
const key = `${feature}/${name.toString()}
|
|
7987
|
-
|
|
7996
|
+
const key = `${feature}/${name.toString()}`;
|
|
7997
|
+
const entries = this.entries.get(key);
|
|
7998
|
+
const value = entries?.get(entry);
|
|
7999
|
+
if (typeof value === "undefined") {
|
|
8000
|
+
throw new TypeError(`Shared data not found: ${key}`);
|
|
8001
|
+
}
|
|
8002
|
+
return value;
|
|
7988
8003
|
}
|
|
7989
8004
|
add(feature, name, entry, value) {
|
|
7990
|
-
const key = `${feature}/${name.toString()}
|
|
7991
|
-
this.
|
|
8005
|
+
const key = `${feature}/${name.toString()}`;
|
|
8006
|
+
if (!this.entries.has(key)) {
|
|
8007
|
+
this.entries.set(key, /* @__PURE__ */ new Map());
|
|
8008
|
+
}
|
|
8009
|
+
const entries = this.entries.get(key);
|
|
8010
|
+
entries.set(entry, value);
|
|
7992
8011
|
return this;
|
|
7993
8012
|
}
|
|
8013
|
+
list(feature, name) {
|
|
8014
|
+
const key = `${feature}/${name.toString()}`;
|
|
8015
|
+
const entries = this.entries.get(key) ?? /* @__PURE__ */ new Map();
|
|
8016
|
+
return entries.entries();
|
|
8017
|
+
}
|
|
7994
8018
|
};
|
|
7995
8019
|
|
|
7996
8020
|
// src/app.ts
|
|
@@ -8804,10 +8828,10 @@ var startTest = async (props) => {
|
|
|
8804
8828
|
tests.push(entry);
|
|
8805
8829
|
if ("task" in test2) {
|
|
8806
8830
|
const task2 = test2.task;
|
|
8807
|
-
for (const
|
|
8831
|
+
for (const log28 of task2.logs ?? []) {
|
|
8808
8832
|
entry.logs.push({
|
|
8809
|
-
time:
|
|
8810
|
-
text:
|
|
8833
|
+
time: log28.time,
|
|
8834
|
+
text: log28.content
|
|
8811
8835
|
});
|
|
8812
8836
|
}
|
|
8813
8837
|
}
|
|
@@ -8875,7 +8899,7 @@ var logTestLogs = (event) => {
|
|
|
8875
8899
|
].join(" "),
|
|
8876
8900
|
color.line(icon.dot)
|
|
8877
8901
|
);
|
|
8878
|
-
log16.message(test2.logs.map((
|
|
8902
|
+
log16.message(test2.logs.map((log28) => log28.text).join("\n"));
|
|
8879
8903
|
}
|
|
8880
8904
|
}
|
|
8881
8905
|
};
|
|
@@ -9092,11 +9116,13 @@ var deploy = (program2) => {
|
|
|
9092
9116
|
|
|
9093
9117
|
// src/cli/command/auth/user/create.ts
|
|
9094
9118
|
import {
|
|
9119
|
+
AdminAddUserToGroupCommand,
|
|
9095
9120
|
AdminCreateUserCommand,
|
|
9096
9121
|
AdminSetUserPasswordCommand,
|
|
9097
|
-
CognitoIdentityProviderClient
|
|
9122
|
+
CognitoIdentityProviderClient,
|
|
9123
|
+
UsernameExistsException
|
|
9098
9124
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9099
|
-
import { prompt as prompt8 } from "@awsless/clui";
|
|
9125
|
+
import { log as log19, prompt as prompt8 } from "@awsless/clui";
|
|
9100
9126
|
var create = (program2) => {
|
|
9101
9127
|
program2.command("create").argument("[name]", "The name of the auth instance").description("Create an user for your userpool").action(async (name) => {
|
|
9102
9128
|
await layout("auth user create", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9117,24 +9143,31 @@ var create = (program2) => {
|
|
|
9117
9143
|
}))
|
|
9118
9144
|
});
|
|
9119
9145
|
}
|
|
9120
|
-
|
|
9146
|
+
const props = appConfig.defaults.auth[name];
|
|
9147
|
+
if (!props) {
|
|
9121
9148
|
throw new ExpectedError(`Provided auth name doesn't exist inside your app config.`);
|
|
9122
9149
|
}
|
|
9123
|
-
const
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9150
|
+
const userPoolId = await log19.task({
|
|
9151
|
+
initialMessage: "Loading auth userpool...",
|
|
9152
|
+
successMessage: "Done loading auth userpool.",
|
|
9153
|
+
errorMessage: "Failed loading auth userpool.",
|
|
9154
|
+
async task() {
|
|
9155
|
+
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9156
|
+
const { workspace } = await createWorkSpace({
|
|
9157
|
+
credentials,
|
|
9158
|
+
accountId,
|
|
9159
|
+
profile,
|
|
9160
|
+
region
|
|
9161
|
+
});
|
|
9162
|
+
await workspace.hydrate(app);
|
|
9163
|
+
try {
|
|
9164
|
+
return await shared.entry("auth", `user-pool-id`, name);
|
|
9165
|
+
} catch (_) {
|
|
9166
|
+
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
9129
9169
|
});
|
|
9130
|
-
await
|
|
9131
|
-
let userPoolId;
|
|
9132
|
-
try {
|
|
9133
|
-
userPoolId = await shared.entry("auth", `user-pool-id`, name);
|
|
9134
|
-
} catch (_) {
|
|
9135
|
-
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9136
|
-
}
|
|
9137
|
-
const user2 = await prompt8.text({
|
|
9170
|
+
const username = await prompt8.text({
|
|
9138
9171
|
message: "Username:",
|
|
9139
9172
|
validate(value) {
|
|
9140
9173
|
if (!value) {
|
|
@@ -9143,35 +9176,84 @@ var create = (program2) => {
|
|
|
9143
9176
|
return;
|
|
9144
9177
|
}
|
|
9145
9178
|
});
|
|
9146
|
-
const
|
|
9179
|
+
const password = await prompt8.password({
|
|
9147
9180
|
message: "Password:",
|
|
9148
9181
|
validate(value) {
|
|
9149
9182
|
if (!value) {
|
|
9150
9183
|
return "Required";
|
|
9151
9184
|
}
|
|
9185
|
+
if (value.length < props.password.minLength) {
|
|
9186
|
+
return `Min length is ${props.password.minLength}`;
|
|
9187
|
+
}
|
|
9188
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
9189
|
+
return `Should include lowercase characters`;
|
|
9190
|
+
}
|
|
9191
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
9192
|
+
return `Should include uppercase characters`;
|
|
9193
|
+
}
|
|
9194
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
9195
|
+
return `Should include numbers`;
|
|
9196
|
+
}
|
|
9197
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
9198
|
+
return `Should include symbols`;
|
|
9199
|
+
}
|
|
9152
9200
|
return;
|
|
9153
9201
|
}
|
|
9154
9202
|
});
|
|
9203
|
+
let groups = [];
|
|
9204
|
+
if (props.groups.length > 0) {
|
|
9205
|
+
groups = await prompt8.multiSelect({
|
|
9206
|
+
message: "Groups:",
|
|
9207
|
+
required: false,
|
|
9208
|
+
options: props.groups.map((g) => ({
|
|
9209
|
+
value: g
|
|
9210
|
+
}))
|
|
9211
|
+
});
|
|
9212
|
+
}
|
|
9155
9213
|
const client = new CognitoIdentityProviderClient({
|
|
9156
9214
|
region,
|
|
9157
9215
|
credentials
|
|
9158
9216
|
});
|
|
9159
|
-
await
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9217
|
+
await log19.task({
|
|
9218
|
+
initialMessage: "Creating user...",
|
|
9219
|
+
successMessage: "User created.",
|
|
9220
|
+
errorMessage: "Failed creating user.",
|
|
9221
|
+
async task() {
|
|
9222
|
+
try {
|
|
9223
|
+
await client.send(
|
|
9224
|
+
new AdminCreateUserCommand({
|
|
9225
|
+
UserPoolId: userPoolId,
|
|
9226
|
+
Username: username,
|
|
9227
|
+
TemporaryPassword: password
|
|
9228
|
+
})
|
|
9229
|
+
);
|
|
9230
|
+
} catch (error) {
|
|
9231
|
+
if (error instanceof UsernameExistsException) {
|
|
9232
|
+
throw new ExpectedError("User already exists");
|
|
9233
|
+
}
|
|
9234
|
+
throw error;
|
|
9235
|
+
}
|
|
9236
|
+
await client.send(
|
|
9237
|
+
new AdminSetUserPasswordCommand({
|
|
9238
|
+
UserPoolId: userPoolId,
|
|
9239
|
+
Username: username,
|
|
9240
|
+
Password: password,
|
|
9241
|
+
Permanent: true
|
|
9242
|
+
})
|
|
9243
|
+
);
|
|
9244
|
+
if (groups.length > 0) {
|
|
9245
|
+
for (const group of groups) {
|
|
9246
|
+
await client.send(
|
|
9247
|
+
new AdminAddUserToGroupCommand({
|
|
9248
|
+
UserPoolId: userPoolId,
|
|
9249
|
+
Username: username,
|
|
9250
|
+
GroupName: group
|
|
9251
|
+
})
|
|
9252
|
+
);
|
|
9253
|
+
}
|
|
9254
|
+
}
|
|
9255
|
+
}
|
|
9256
|
+
});
|
|
9175
9257
|
});
|
|
9176
9258
|
});
|
|
9177
9259
|
};
|
|
@@ -9191,8 +9273,8 @@ var auth = (program2) => {
|
|
|
9191
9273
|
};
|
|
9192
9274
|
|
|
9193
9275
|
// src/cli/command/bind.ts
|
|
9194
|
-
import { log as
|
|
9195
|
-
import { constantCase as
|
|
9276
|
+
import { log as log20 } from "@awsless/clui";
|
|
9277
|
+
import { constantCase as constantCase15 } from "change-case";
|
|
9196
9278
|
import { spawn } from "child_process";
|
|
9197
9279
|
var bind = (program2) => {
|
|
9198
9280
|
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 (commands9 = [], opts) => {
|
|
@@ -9214,17 +9296,17 @@ var bind = (program2) => {
|
|
|
9214
9296
|
env[name] = await value;
|
|
9215
9297
|
}
|
|
9216
9298
|
if (Object.keys(env).length > 0) {
|
|
9217
|
-
|
|
9299
|
+
log20.list("Bind Env", env);
|
|
9218
9300
|
} else {
|
|
9219
|
-
|
|
9301
|
+
log20.warning("No bindings available.");
|
|
9220
9302
|
}
|
|
9221
9303
|
const configList = opts.config ?? [];
|
|
9222
9304
|
const configs = {};
|
|
9223
9305
|
for (const name of configList) {
|
|
9224
|
-
configs[`CONFIG_${
|
|
9306
|
+
configs[`CONFIG_${constantCase15(name)}`] = name;
|
|
9225
9307
|
}
|
|
9226
9308
|
if (configList.length ?? 0 > 0) {
|
|
9227
|
-
|
|
9309
|
+
log20.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
|
|
9228
9310
|
}
|
|
9229
9311
|
if (commands9.length === 0) {
|
|
9230
9312
|
return "No command to execute.";
|
|
@@ -9283,7 +9365,7 @@ var watchConfig = async (options, resolve, reject) => {
|
|
|
9283
9365
|
};
|
|
9284
9366
|
|
|
9285
9367
|
// src/cli/ui/complex/build-types.ts
|
|
9286
|
-
import { log as
|
|
9368
|
+
import { log as log21 } from "@awsless/clui";
|
|
9287
9369
|
|
|
9288
9370
|
// src/type-gen/generate.ts
|
|
9289
9371
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -9317,7 +9399,7 @@ var generateTypes = async (props) => {
|
|
|
9317
9399
|
// src/cli/ui/complex/build-types.ts
|
|
9318
9400
|
var buildTypes = async (props) => {
|
|
9319
9401
|
await generateTypes(props);
|
|
9320
|
-
|
|
9402
|
+
log21.step("Done generating type definition files.");
|
|
9321
9403
|
};
|
|
9322
9404
|
|
|
9323
9405
|
// src/cli/command/dev.ts
|
|
@@ -9341,7 +9423,7 @@ var dev = (program2) => {
|
|
|
9341
9423
|
};
|
|
9342
9424
|
|
|
9343
9425
|
// src/cli/command/resources.ts
|
|
9344
|
-
import { log as
|
|
9426
|
+
import { log as log22 } from "@awsless/clui";
|
|
9345
9427
|
import chalk4 from "chalk";
|
|
9346
9428
|
import wildstring5 from "wildstring";
|
|
9347
9429
|
var resources = (program2) => {
|
|
@@ -9384,9 +9466,9 @@ var resources = (program2) => {
|
|
|
9384
9466
|
continue;
|
|
9385
9467
|
}
|
|
9386
9468
|
}
|
|
9387
|
-
|
|
9469
|
+
log22.step(chalk4.magenta(stack.name));
|
|
9388
9470
|
if (stack.resources.length) {
|
|
9389
|
-
|
|
9471
|
+
log22.message(
|
|
9390
9472
|
stack.resources.map((r) => {
|
|
9391
9473
|
return [
|
|
9392
9474
|
//
|
|
@@ -9397,7 +9479,7 @@ var resources = (program2) => {
|
|
|
9397
9479
|
}).join("\n")
|
|
9398
9480
|
);
|
|
9399
9481
|
} else {
|
|
9400
|
-
|
|
9482
|
+
log22.message(color.line(`(empty)`));
|
|
9401
9483
|
}
|
|
9402
9484
|
}
|
|
9403
9485
|
});
|
|
@@ -9568,7 +9650,7 @@ var types = (program2) => {
|
|
|
9568
9650
|
};
|
|
9569
9651
|
|
|
9570
9652
|
// src/cli/command/domain/list.ts
|
|
9571
|
-
import { log as
|
|
9653
|
+
import { log as log23 } from "@awsless/clui";
|
|
9572
9654
|
var list2 = (program2) => {
|
|
9573
9655
|
program2.command("list").description("List all domains").action(async () => {
|
|
9574
9656
|
await layout("domain list", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9590,7 +9672,7 @@ var list2 = (program2) => {
|
|
|
9590
9672
|
});
|
|
9591
9673
|
await workspace.hydrate(app);
|
|
9592
9674
|
for (const zone of domainZones) {
|
|
9593
|
-
|
|
9675
|
+
log23.step(
|
|
9594
9676
|
[
|
|
9595
9677
|
//
|
|
9596
9678
|
color.label.green(await zone.name),
|
|
@@ -9598,14 +9680,14 @@ var list2 = (program2) => {
|
|
|
9598
9680
|
color.dim(await zone.id)
|
|
9599
9681
|
].join(" ")
|
|
9600
9682
|
);
|
|
9601
|
-
|
|
9683
|
+
log23.message((await zone.nameServers).join("\n"));
|
|
9602
9684
|
}
|
|
9603
9685
|
});
|
|
9604
9686
|
});
|
|
9605
9687
|
};
|
|
9606
9688
|
|
|
9607
9689
|
// src/cli/command/domain/deploy.ts
|
|
9608
|
-
import { log as
|
|
9690
|
+
import { log as log24 } from "@awsless/clui";
|
|
9609
9691
|
var deploy2 = (program2) => {
|
|
9610
9692
|
program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
|
|
9611
9693
|
await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9625,7 +9707,7 @@ var deploy2 = (program2) => {
|
|
|
9625
9707
|
profile,
|
|
9626
9708
|
region
|
|
9627
9709
|
});
|
|
9628
|
-
await
|
|
9710
|
+
await log24.task({
|
|
9629
9711
|
initialMessage: "Deploying the domain zones to AWS...",
|
|
9630
9712
|
successMessage: "Done deploying the domain zones to AWS.",
|
|
9631
9713
|
errorMessage: "Failed deploying the domain zones to AWS.",
|
|
@@ -9634,7 +9716,7 @@ var deploy2 = (program2) => {
|
|
|
9634
9716
|
}
|
|
9635
9717
|
});
|
|
9636
9718
|
for (const zone of domainZones) {
|
|
9637
|
-
|
|
9719
|
+
log24.step(
|
|
9638
9720
|
[
|
|
9639
9721
|
//
|
|
9640
9722
|
color.label.green(await zone.name),
|
|
@@ -9642,7 +9724,7 @@ var deploy2 = (program2) => {
|
|
|
9642
9724
|
color.dim(await zone.id)
|
|
9643
9725
|
].join(" ")
|
|
9644
9726
|
);
|
|
9645
|
-
|
|
9727
|
+
log24.message((await zone.nameServers).join("\n"));
|
|
9646
9728
|
}
|
|
9647
9729
|
});
|
|
9648
9730
|
});
|
|
@@ -9661,7 +9743,7 @@ var domain = (program2) => {
|
|
|
9661
9743
|
|
|
9662
9744
|
// src/cli/command/logs.ts
|
|
9663
9745
|
import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
9664
|
-
import { log as
|
|
9746
|
+
import { log as log25 } from "@awsless/clui";
|
|
9665
9747
|
import { aws as aws30 } from "@terraforge/aws";
|
|
9666
9748
|
import chalk5 from "chalk";
|
|
9667
9749
|
import chunk2 from "chunk";
|
|
@@ -9703,7 +9785,7 @@ var logs = (program2) => {
|
|
|
9703
9785
|
process.once("SIGINT", () => {
|
|
9704
9786
|
abort.abort();
|
|
9705
9787
|
});
|
|
9706
|
-
const streams = await
|
|
9788
|
+
const streams = await log25.task({
|
|
9707
9789
|
initialMessage: "Connecting to the log stream...",
|
|
9708
9790
|
errorMessage: "Failed to connect to the log stream.",
|
|
9709
9791
|
async task(ctx) {
|
|
@@ -9760,7 +9842,7 @@ var formatLog = (level, date, group, message) => {
|
|
|
9760
9842
|
SYSTEM: chalk5.blue
|
|
9761
9843
|
};
|
|
9762
9844
|
const levelColor = levels[level] ?? chalk5.cyan;
|
|
9763
|
-
|
|
9845
|
+
log25.message(
|
|
9764
9846
|
[
|
|
9765
9847
|
[
|
|
9766
9848
|
//
|
|
@@ -9802,7 +9884,7 @@ var parseJsonLog = (message) => {
|
|
|
9802
9884
|
// src/cli/command/image/clear-cache.ts
|
|
9803
9885
|
import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
|
|
9804
9886
|
import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
9805
|
-
import { Cancelled as Cancelled2, log as
|
|
9887
|
+
import { Cancelled as Cancelled2, log as log26, prompt as prompt12 } from "@awsless/clui";
|
|
9806
9888
|
import { randomUUID } from "crypto";
|
|
9807
9889
|
var clearCache = (program2) => {
|
|
9808
9890
|
program2.command("clear-cache").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) => {
|
|
@@ -9874,7 +9956,7 @@ var clearCache = (program2) => {
|
|
|
9874
9956
|
region: "us-east-1"
|
|
9875
9957
|
});
|
|
9876
9958
|
let totalDeleted = 0;
|
|
9877
|
-
await
|
|
9959
|
+
await log26.task({
|
|
9878
9960
|
initialMessage: "Clearing cache...",
|
|
9879
9961
|
successMessage: "Cache successfully cleared.",
|
|
9880
9962
|
task: async () => {
|
|
@@ -9936,7 +10018,7 @@ var image = (program2) => {
|
|
|
9936
10018
|
// src/cli/command/icon/clear-cache.ts
|
|
9937
10019
|
import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
|
|
9938
10020
|
import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
|
|
9939
|
-
import { Cancelled as Cancelled3, log as
|
|
10021
|
+
import { Cancelled as Cancelled3, log as log27, prompt as prompt13 } from "@awsless/clui";
|
|
9940
10022
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9941
10023
|
var clearCache2 = (program2) => {
|
|
9942
10024
|
program2.command("clear-cache").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) => {
|
|
@@ -10008,7 +10090,7 @@ var clearCache2 = (program2) => {
|
|
|
10008
10090
|
region: "us-east-1"
|
|
10009
10091
|
});
|
|
10010
10092
|
let totalDeleted = 0;
|
|
10011
|
-
await
|
|
10093
|
+
await log27.task({
|
|
10012
10094
|
initialMessage: "Clearing cache...",
|
|
10013
10095
|
successMessage: "Cache successfully cleared.",
|
|
10014
10096
|
task: async () => {
|
|
@@ -64,6 +64,7 @@ var AuthDefaultSchema = z5.record(
|
|
|
64
64
|
// .optional()
|
|
65
65
|
// .describe('The email configuration for sending messages.'),
|
|
66
66
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
67
|
+
groups: z5.string().array().default([]).describe("Specifies a list of groups that a user can belong to."),
|
|
67
68
|
username: z5.object({
|
|
68
69
|
// emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
|
|
69
70
|
caseSensitive: z5.boolean().default(false).describe(
|
|
Binary file
|
|
Binary file
|
|
Binary file
|