@awsless/awsless 0.0.128 → 0.0.129
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 +106 -88
- package/dist/features/cognito-client-secret/bundle.zip +0 -0
- package/dist/features/delete-bucket/bundle.zip +0 -0
- package/dist/features/delete-hosted-zone/bundle.zip +0 -0
- package/dist/features/global-exports/bundle.zip +0 -0
- package/dist/features/invalidate-cache/bundle.zip +0 -0
- package/dist/features/upload-bucket-asset/bundle.zip +0 -0
- package/package.json +8 -7
package/dist/bin.js
CHANGED
|
@@ -1044,8 +1044,8 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
1044
1044
|
var fingerprintFromFile = async (file) => {
|
|
1045
1045
|
const hashes = /* @__PURE__ */ new Map();
|
|
1046
1046
|
await generateFileHashes(file, hashes);
|
|
1047
|
-
const
|
|
1048
|
-
return createHash2("sha1").update(
|
|
1047
|
+
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
1048
|
+
return createHash2("sha1").update(merge2).digest("hex");
|
|
1049
1049
|
};
|
|
1050
1050
|
var fingerprintFromDirectory = async (dir) => {
|
|
1051
1051
|
const hashes = /* @__PURE__ */ new Map();
|
|
@@ -1055,8 +1055,8 @@ var fingerprintFromDirectory = async (dir) => {
|
|
|
1055
1055
|
await generateFileHashes(join3(dir, file), hashes);
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
const
|
|
1059
|
-
return createHash2("sha1").update(
|
|
1058
|
+
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
1059
|
+
return createHash2("sha1").update(merge2).digest("hex");
|
|
1060
1060
|
};
|
|
1061
1061
|
var readModuleFile = (file) => {
|
|
1062
1062
|
if (file.endsWith(".js")) {
|
|
@@ -3712,10 +3712,10 @@ var onFailurePlugin = definePlugin({
|
|
|
3712
3712
|
if (!hasOnFailure(config2)) {
|
|
3713
3713
|
return;
|
|
3714
3714
|
}
|
|
3715
|
-
const
|
|
3715
|
+
const queue2 = new Queue("on-failure", {
|
|
3716
3716
|
name: `${config2.app.name}-failure`
|
|
3717
3717
|
});
|
|
3718
|
-
bootstrap2.add(
|
|
3718
|
+
bootstrap2.add(queue2).export("on-failure-queue-arn", queue2.arn);
|
|
3719
3719
|
},
|
|
3720
3720
|
onStack(ctx) {
|
|
3721
3721
|
const { stack, stackConfig, bootstrap: bootstrap2 } = ctx;
|
|
@@ -3862,22 +3862,22 @@ var queuePlugin = definePlugin({
|
|
|
3862
3862
|
const { stack, config: config2, stackConfig, bind } = ctx;
|
|
3863
3863
|
for (const [id, functionOrProps] of Object.entries(stackConfig.queues || {})) {
|
|
3864
3864
|
const props = typeof functionOrProps === "string" ? { ...config2.app.defaults.queue, consumer: functionOrProps } : { ...config2.app.defaults.queue, ...functionOrProps };
|
|
3865
|
-
const
|
|
3865
|
+
const queue2 = new Queue(id, {
|
|
3866
3866
|
name: `${config2.app.name}-${stack.name}-${id}`,
|
|
3867
3867
|
deadLetterArn: getGlobalOnFailure(ctx),
|
|
3868
3868
|
...props
|
|
3869
3869
|
});
|
|
3870
3870
|
const lambda = toLambdaFunction(ctx, `queue-${id}`, props.consumer);
|
|
3871
3871
|
const source = new SqsEventSource(id, lambda, {
|
|
3872
|
-
queueArn:
|
|
3872
|
+
queueArn: queue2.arn,
|
|
3873
3873
|
batchSize: props.batchSize,
|
|
3874
3874
|
maxConcurrency: props.maxConcurrency,
|
|
3875
3875
|
maxBatchingWindow: props.maxBatchingWindow
|
|
3876
3876
|
});
|
|
3877
|
-
stack.add(
|
|
3877
|
+
stack.add(queue2, lambda, source);
|
|
3878
3878
|
bind((lambda2) => {
|
|
3879
|
-
lambda2.addPermissions(
|
|
3880
|
-
lambda2.addEnvironment(`QUEUE_${constantCase10(stack.name)}_${constantCase10(id)}_URL`,
|
|
3879
|
+
lambda2.addPermissions(queue2.permissions);
|
|
3880
|
+
lambda2.addEnvironment(`QUEUE_${constantCase10(stack.name)}_${constantCase10(id)}_URL`, queue2.url);
|
|
3881
3881
|
});
|
|
3882
3882
|
}
|
|
3883
3883
|
}
|
|
@@ -5498,7 +5498,7 @@ var toApp = async (config2, filters) => {
|
|
|
5498
5498
|
};
|
|
5499
5499
|
|
|
5500
5500
|
// src/config/load.ts
|
|
5501
|
-
import { dirname as dirname5, join as join7 } from "path";
|
|
5501
|
+
import { basename as basename3, dirname as dirname5, extname as extname2, join as join7 } from "path";
|
|
5502
5502
|
|
|
5503
5503
|
// src/util/account.ts
|
|
5504
5504
|
import { STSClient, GetCallerIdentityCommand } from "@aws-sdk/client-sts";
|
|
@@ -6317,6 +6317,7 @@ var Cancelled = class extends Error {
|
|
|
6317
6317
|
|
|
6318
6318
|
// src/config/load.ts
|
|
6319
6319
|
import JSON5 from "json5";
|
|
6320
|
+
import merge from "deepmerge";
|
|
6320
6321
|
var readConfig = async (file) => {
|
|
6321
6322
|
try {
|
|
6322
6323
|
const json4 = await readFile5(file, "utf8");
|
|
@@ -6329,6 +6330,19 @@ var readConfig = async (file) => {
|
|
|
6329
6330
|
throw error;
|
|
6330
6331
|
}
|
|
6331
6332
|
};
|
|
6333
|
+
var readConfigWithStage = async (file, stage) => {
|
|
6334
|
+
const config2 = await readConfig(file);
|
|
6335
|
+
const ext = extname2(file);
|
|
6336
|
+
const stageFileName = basename3(file, ext) + "." + stage + ext;
|
|
6337
|
+
const stageFile = join7(dirname5(file), stageFileName);
|
|
6338
|
+
const stageFileExists = await fileExist(stageFile);
|
|
6339
|
+
if (!stageFileExists) {
|
|
6340
|
+
return config2;
|
|
6341
|
+
}
|
|
6342
|
+
debug("Load env file:", style.info(stageFile));
|
|
6343
|
+
const stageConfig = await readConfig(stageFile);
|
|
6344
|
+
return merge(config2, stageConfig);
|
|
6345
|
+
};
|
|
6332
6346
|
var parseConfig = async (schema, file, data) => {
|
|
6333
6347
|
try {
|
|
6334
6348
|
const result = await schema.parseAsync(data);
|
|
@@ -6349,7 +6363,7 @@ var loadConfig = async (options) => {
|
|
|
6349
6363
|
debug("CWD:", style.info(root2));
|
|
6350
6364
|
debug("Load app config file");
|
|
6351
6365
|
const appFileName = join7(root2, configFile);
|
|
6352
|
-
const appConfig = await
|
|
6366
|
+
const appConfig = await readConfigWithStage(appFileName, options.stage);
|
|
6353
6367
|
debug("Validate app config file");
|
|
6354
6368
|
const app = await parseConfig(AppSchema, appFileName, appConfig);
|
|
6355
6369
|
debug("Load credentials", style.info(app.profile));
|
|
@@ -6365,8 +6379,8 @@ var loadConfig = async (options) => {
|
|
|
6365
6379
|
});
|
|
6366
6380
|
const stacks = [];
|
|
6367
6381
|
for (const file of stackFiles) {
|
|
6368
|
-
debug(
|
|
6369
|
-
const stackConfig = await
|
|
6382
|
+
debug("Load stack file:", style.info(file));
|
|
6383
|
+
const stackConfig = await readConfigWithStage(file, options.stage);
|
|
6370
6384
|
setLocalBasePath(join7(process.cwd(), dirname5(file)));
|
|
6371
6385
|
const stack = await parseConfig(StackSchema, file, stackConfig);
|
|
6372
6386
|
stacks.push(stack);
|
|
@@ -6988,7 +7002,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
6988
7002
|
|
|
6989
7003
|
// src/cli/ui/complex/builder.ts
|
|
6990
7004
|
import { dirname as dirname6, join as join8 } from "path";
|
|
6991
|
-
import
|
|
7005
|
+
import { promise } from "fastq";
|
|
6992
7006
|
var assetBuilder = (app) => {
|
|
6993
7007
|
return async (term) => {
|
|
6994
7008
|
const assets = [];
|
|
@@ -7013,7 +7027,7 @@ var assetBuilder = (app) => {
|
|
|
7013
7027
|
}
|
|
7014
7028
|
const stackNameSize = Math.max(...stacks.map((stack) => stack.name.length));
|
|
7015
7029
|
const assetTypeSize = Math.max(...assets.map((asset) => asset.type.length));
|
|
7016
|
-
const
|
|
7030
|
+
const queue2 = promise(async ({ stack, asset }) => {
|
|
7017
7031
|
if (!asset.build) {
|
|
7018
7032
|
return;
|
|
7019
7033
|
}
|
|
@@ -7110,7 +7124,7 @@ var assetBuilder = (app) => {
|
|
|
7110
7124
|
app.stacks.map(async (stack) => {
|
|
7111
7125
|
await Promise.all(
|
|
7112
7126
|
[...stack.assets].map(async (asset) => {
|
|
7113
|
-
await
|
|
7127
|
+
await queue2.push({ stack, asset });
|
|
7114
7128
|
})
|
|
7115
7129
|
);
|
|
7116
7130
|
})
|
|
@@ -7156,13 +7170,15 @@ import { join as join9 } from "path";
|
|
|
7156
7170
|
var templateBuilder = (app) => {
|
|
7157
7171
|
return async (term) => {
|
|
7158
7172
|
const done = term.out.write(loadingDialog("Building stack templates..."));
|
|
7159
|
-
await Promise.all(
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7173
|
+
await Promise.all(
|
|
7174
|
+
app.stacks.map(async (stack) => {
|
|
7175
|
+
const template = stack.toString(true);
|
|
7176
|
+
const path = join9(directories.template, app.name);
|
|
7177
|
+
const file = join9(path, `${stack.name}.json`);
|
|
7178
|
+
await mkdir4(path, { recursive: true });
|
|
7179
|
+
await writeFile3(file, template);
|
|
7180
|
+
})
|
|
7181
|
+
);
|
|
7166
7182
|
done("Done building stack templates");
|
|
7167
7183
|
};
|
|
7168
7184
|
};
|
|
@@ -7711,6 +7727,7 @@ var status = (program2) => {
|
|
|
7711
7727
|
import { readFile as readFile7 } from "fs/promises";
|
|
7712
7728
|
import { join as join10 } from "path";
|
|
7713
7729
|
import { GetObjectCommand, ObjectCannedACL as ObjectCannedACL2, PutObjectCommand as PutObjectCommand2, S3Client as S3Client2, StorageClass as StorageClass2 } from "@aws-sdk/client-s3";
|
|
7730
|
+
import { promise as promise2 } from "fastq";
|
|
7714
7731
|
var assetPublisher = (config2, app) => {
|
|
7715
7732
|
const client = new S3Client2({
|
|
7716
7733
|
credentials: config2.credentials,
|
|
@@ -7719,68 +7736,71 @@ var assetPublisher = (config2, app) => {
|
|
|
7719
7736
|
});
|
|
7720
7737
|
return async (term) => {
|
|
7721
7738
|
const done = term.out.write(loadingDialog("Publishing stack assets to AWS..."));
|
|
7739
|
+
const queue2 = promise2(async ({ stack, asset }) => {
|
|
7740
|
+
const getFullPath = (file) => {
|
|
7741
|
+
return join10(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
7742
|
+
};
|
|
7743
|
+
await asset.publish?.({
|
|
7744
|
+
async read(fingerprint, files) {
|
|
7745
|
+
const prev = await readFile7(getFullPath("FINGER_PRINT"), "utf8");
|
|
7746
|
+
if (prev !== fingerprint) {
|
|
7747
|
+
throw new TypeError(`Outdated fingerprint: ${fingerprint}`);
|
|
7748
|
+
}
|
|
7749
|
+
return Promise.all(
|
|
7750
|
+
files.map((file) => {
|
|
7751
|
+
return readFile7(getFullPath(file));
|
|
7752
|
+
})
|
|
7753
|
+
);
|
|
7754
|
+
},
|
|
7755
|
+
async publish(name, data, hash) {
|
|
7756
|
+
const key = `${app.name}/${stack.name}/${asset.type}/${name}`;
|
|
7757
|
+
const bucket = assetBucketName(config2.account, config2.app.region);
|
|
7758
|
+
let getResult;
|
|
7759
|
+
try {
|
|
7760
|
+
getResult = await client.send(
|
|
7761
|
+
new GetObjectCommand({
|
|
7762
|
+
Bucket: bucket,
|
|
7763
|
+
Key: key
|
|
7764
|
+
})
|
|
7765
|
+
);
|
|
7766
|
+
} catch (error) {
|
|
7767
|
+
if (error instanceof Error && error.name === "NoSuchKey") {
|
|
7768
|
+
} else {
|
|
7769
|
+
throw error;
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7772
|
+
if (getResult?.Metadata?.hash === hash) {
|
|
7773
|
+
return {
|
|
7774
|
+
bucket,
|
|
7775
|
+
key,
|
|
7776
|
+
version: getResult.VersionId
|
|
7777
|
+
};
|
|
7778
|
+
}
|
|
7779
|
+
const putResult = await client.send(
|
|
7780
|
+
new PutObjectCommand2({
|
|
7781
|
+
Bucket: bucket,
|
|
7782
|
+
Key: key,
|
|
7783
|
+
Body: data,
|
|
7784
|
+
ACL: ObjectCannedACL2.private,
|
|
7785
|
+
StorageClass: StorageClass2.STANDARD,
|
|
7786
|
+
Metadata: {
|
|
7787
|
+
hash: hash.toString("utf8")
|
|
7788
|
+
}
|
|
7789
|
+
})
|
|
7790
|
+
);
|
|
7791
|
+
return {
|
|
7792
|
+
bucket,
|
|
7793
|
+
key,
|
|
7794
|
+
version: putResult.VersionId
|
|
7795
|
+
};
|
|
7796
|
+
}
|
|
7797
|
+
});
|
|
7798
|
+
}, 5);
|
|
7722
7799
|
await Promise.all(
|
|
7723
7800
|
app.stacks.map(async (stack) => {
|
|
7724
7801
|
await Promise.all(
|
|
7725
7802
|
[...stack.assets].map(async (asset) => {
|
|
7726
|
-
|
|
7727
|
-
return join10(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
7728
|
-
};
|
|
7729
|
-
await asset.publish?.({
|
|
7730
|
-
async read(fingerprint, files) {
|
|
7731
|
-
const prev = await readFile7(getFullPath("FINGER_PRINT"), "utf8");
|
|
7732
|
-
if (prev !== fingerprint) {
|
|
7733
|
-
throw new TypeError(`Outdated fingerprint: ${fingerprint}`);
|
|
7734
|
-
}
|
|
7735
|
-
return Promise.all(
|
|
7736
|
-
files.map((file) => {
|
|
7737
|
-
return readFile7(getFullPath(file));
|
|
7738
|
-
})
|
|
7739
|
-
);
|
|
7740
|
-
},
|
|
7741
|
-
async publish(name, data, hash) {
|
|
7742
|
-
const key = `${app.name}/${stack.name}/${asset.type}/${name}`;
|
|
7743
|
-
const bucket = assetBucketName(config2.account, config2.app.region);
|
|
7744
|
-
let getResult;
|
|
7745
|
-
try {
|
|
7746
|
-
getResult = await client.send(
|
|
7747
|
-
new GetObjectCommand({
|
|
7748
|
-
Bucket: bucket,
|
|
7749
|
-
Key: key
|
|
7750
|
-
})
|
|
7751
|
-
);
|
|
7752
|
-
} catch (error) {
|
|
7753
|
-
if (error instanceof Error && error.name === "NoSuchKey") {
|
|
7754
|
-
} else {
|
|
7755
|
-
throw error;
|
|
7756
|
-
}
|
|
7757
|
-
}
|
|
7758
|
-
if (getResult?.Metadata?.hash === hash) {
|
|
7759
|
-
return {
|
|
7760
|
-
bucket,
|
|
7761
|
-
key,
|
|
7762
|
-
version: getResult.VersionId
|
|
7763
|
-
};
|
|
7764
|
-
}
|
|
7765
|
-
const putResult = await client.send(
|
|
7766
|
-
new PutObjectCommand2({
|
|
7767
|
-
Bucket: bucket,
|
|
7768
|
-
Key: key,
|
|
7769
|
-
Body: data,
|
|
7770
|
-
ACL: ObjectCannedACL2.private,
|
|
7771
|
-
StorageClass: StorageClass2.STANDARD,
|
|
7772
|
-
Metadata: {
|
|
7773
|
-
hash: hash.toString("utf8")
|
|
7774
|
-
}
|
|
7775
|
-
})
|
|
7776
|
-
);
|
|
7777
|
-
return {
|
|
7778
|
-
bucket,
|
|
7779
|
-
key,
|
|
7780
|
-
version: putResult.VersionId
|
|
7781
|
-
};
|
|
7782
|
-
}
|
|
7783
|
-
});
|
|
7803
|
+
await queue2.push({ stack, asset });
|
|
7784
7804
|
})
|
|
7785
7805
|
);
|
|
7786
7806
|
})
|
|
@@ -7796,7 +7816,7 @@ import commonjs3 from "@rollup/plugin-commonjs";
|
|
|
7796
7816
|
import nodeResolve3 from "@rollup/plugin-node-resolve";
|
|
7797
7817
|
import { swc as swc3 } from "rollup-plugin-swc3";
|
|
7798
7818
|
import { getSuites, getTests } from "@vitest/runner/utils";
|
|
7799
|
-
import { basename as
|
|
7819
|
+
import { basename as basename4, dirname as dirname7, extname as extname3, join as join11, relative as relative5 } from "path";
|
|
7800
7820
|
|
|
7801
7821
|
// src/cli/ui/layout/text-box.ts
|
|
7802
7822
|
import wrapAnsi3 from "wrap-ansi";
|
|
@@ -7884,11 +7904,11 @@ var singleTester = (stack, dir, filters) => {
|
|
|
7884
7904
|
}
|
|
7885
7905
|
const abs = join11(process.cwd(), path);
|
|
7886
7906
|
const rel = relative5(dir, abs);
|
|
7887
|
-
const ext =
|
|
7907
|
+
const ext = extname3(rel);
|
|
7888
7908
|
if (!ext) {
|
|
7889
7909
|
return path;
|
|
7890
7910
|
}
|
|
7891
|
-
const name =
|
|
7911
|
+
const name = basename4(rel, ext);
|
|
7892
7912
|
const base = dirname7(rel);
|
|
7893
7913
|
const start = base === "." ? "" : style.placeholder(base + "/");
|
|
7894
7914
|
return `${start}${name}${style.placeholder(ext)}`;
|
|
@@ -8436,8 +8456,6 @@ var program = new Command();
|
|
|
8436
8456
|
program.name(logo().join("").replace(/\s+/, ""));
|
|
8437
8457
|
program.option("--config-file <string>", "The app config file location");
|
|
8438
8458
|
program.option("--stage <string>", "The stage to use, defaults to prod stage", "prod");
|
|
8439
|
-
program.option("--profile <string>", "The AWS profile to use");
|
|
8440
|
-
program.option("--region <string>", "The AWS region to use");
|
|
8441
8459
|
program.option("-c --no-cache", "Always build & test without the cache");
|
|
8442
8460
|
program.option("-s --skip-prompt", "Skip prompts");
|
|
8443
8461
|
program.option("-v --verbose", "Print verbose logs");
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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.129",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/lambda": "^0.0.15",
|
|
32
|
-
"@awsless/sqs": "^0.0.7",
|
|
33
|
-
"@awsless/redis": "^0.0.10",
|
|
34
32
|
"@awsless/sns": "^0.0.7",
|
|
33
|
+
"@awsless/redis": "^0.0.10",
|
|
35
34
|
"@awsless/ssm": "^0.0.7",
|
|
36
|
-
"@awsless/
|
|
37
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
35
|
+
"@awsless/sqs": "^0.0.7",
|
|
36
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
37
|
+
"@awsless/validate": "^0.0.10"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@aws-appsync/utils": "^1.5.0",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"chunk": "^0.0.3",
|
|
67
67
|
"commander": "^9.4.1",
|
|
68
68
|
"decompress": "^4.2.1",
|
|
69
|
+
"deepmerge": "^4.3.1",
|
|
69
70
|
"event-iterator": "^2.0.0",
|
|
70
71
|
"fastq": "^1.16.0",
|
|
71
72
|
"filesize": "^10.0.7",
|
|
@@ -86,8 +87,8 @@
|
|
|
86
87
|
"wrap-ansi": "^8.1.0",
|
|
87
88
|
"zod": "^3.21.4",
|
|
88
89
|
"zod-to-json-schema": "^3.22.3",
|
|
89
|
-
"@awsless/
|
|
90
|
-
"@awsless/
|
|
90
|
+
"@awsless/graphql": "^0.0.6",
|
|
91
|
+
"@awsless/code": "^0.0.10"
|
|
91
92
|
},
|
|
92
93
|
"scripts": {
|
|
93
94
|
"test": "pnpm code test",
|