@awsless/awsless 0.0.476 → 0.0.478
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 +133 -123
- package/dist/client.js +5 -4
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +11 -11
package/dist/bin.js
CHANGED
|
@@ -1393,9 +1393,9 @@ var SitesSchema = z29.record(
|
|
|
1393
1393
|
// src/feature/store/schema.ts
|
|
1394
1394
|
import { z as z30 } from "zod";
|
|
1395
1395
|
var StoresSchema = z30.union([
|
|
1396
|
-
z30.array(ResourceIdSchema).transform((
|
|
1396
|
+
z30.array(ResourceIdSchema).transform((list4) => {
|
|
1397
1397
|
const stores = {};
|
|
1398
|
-
for (const key of
|
|
1398
|
+
for (const key of list4) {
|
|
1399
1399
|
stores[key] = {};
|
|
1400
1400
|
}
|
|
1401
1401
|
return stores;
|
|
@@ -1854,11 +1854,11 @@ var authFeature = defineFeature({
|
|
|
1854
1854
|
name: "auth",
|
|
1855
1855
|
async onTypeGen(ctx) {
|
|
1856
1856
|
const gen = new TypeFile("@awsless/awsless");
|
|
1857
|
-
const
|
|
1857
|
+
const resources2 = new TypeObject(1);
|
|
1858
1858
|
for (const name of Object.keys(ctx.appConfig.defaults.auth)) {
|
|
1859
|
-
|
|
1859
|
+
resources2.addType(name, `{ readonly userPoolId: string, readonly clientId: string }`);
|
|
1860
1860
|
}
|
|
1861
|
-
gen.addInterface("AuthResources",
|
|
1861
|
+
gen.addInterface("AuthResources", resources2);
|
|
1862
1862
|
await ctx.write("auth.d.ts", gen, true);
|
|
1863
1863
|
},
|
|
1864
1864
|
// onStack(ctx) {
|
|
@@ -1988,7 +1988,7 @@ var authFeature = defineFeature({
|
|
|
1988
1988
|
deletionProtection: "ACTIVE"
|
|
1989
1989
|
},
|
|
1990
1990
|
{
|
|
1991
|
-
retainOnDelete:
|
|
1991
|
+
retainOnDelete: ctx.appConfig.removal === "retain",
|
|
1992
1992
|
import: ctx.import ? name : void 0
|
|
1993
1993
|
}
|
|
1994
1994
|
);
|
|
@@ -2037,16 +2037,16 @@ var cacheFeature = defineFeature({
|
|
|
2037
2037
|
name: "cache",
|
|
2038
2038
|
async onTypeGen(ctx) {
|
|
2039
2039
|
const gen = new TypeFile("@awsless/awsless");
|
|
2040
|
-
const
|
|
2040
|
+
const resources2 = new TypeObject(1);
|
|
2041
2041
|
for (const stack of ctx.stackConfigs) {
|
|
2042
|
-
const
|
|
2042
|
+
const resource = new TypeObject(2);
|
|
2043
2043
|
for (const name of Object.keys(stack.caches || {})) {
|
|
2044
|
-
|
|
2044
|
+
resource.addType(name, `Command`);
|
|
2045
2045
|
}
|
|
2046
|
-
|
|
2046
|
+
resources2.addType(stack.name, resource);
|
|
2047
2047
|
}
|
|
2048
2048
|
gen.addCode(typeGenCode);
|
|
2049
|
-
gen.addInterface("CacheResources",
|
|
2049
|
+
gen.addInterface("CacheResources", resources2);
|
|
2050
2050
|
await ctx.write("cache.d.ts", gen, true);
|
|
2051
2051
|
},
|
|
2052
2052
|
onStack(ctx) {
|
|
@@ -2281,13 +2281,13 @@ var configFeature = defineFeature({
|
|
|
2281
2281
|
name: "config",
|
|
2282
2282
|
async onTypeGen(ctx) {
|
|
2283
2283
|
const gen = new TypeFile("@awsless/awsless");
|
|
2284
|
-
const
|
|
2284
|
+
const resources2 = new TypeObject(0, false);
|
|
2285
2285
|
for (const stack of ctx.stackConfigs) {
|
|
2286
2286
|
for (const name of stack.configs ?? []) {
|
|
2287
|
-
|
|
2287
|
+
resources2.addConst(name, "string");
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
|
-
gen.addInterface("ConfigResources",
|
|
2290
|
+
gen.addInterface("ConfigResources", resources2.toString());
|
|
2291
2291
|
await ctx.write("config.d.ts", gen, true);
|
|
2292
2292
|
},
|
|
2293
2293
|
onApp(ctx) {
|
|
@@ -2541,9 +2541,9 @@ var createHashFromFile = (file) => {
|
|
|
2541
2541
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
2542
2542
|
});
|
|
2543
2543
|
};
|
|
2544
|
-
var listAllFiles = async (
|
|
2544
|
+
var listAllFiles = async (list4) => {
|
|
2545
2545
|
const files = [];
|
|
2546
|
-
for (const entry of
|
|
2546
|
+
for (const entry of list4) {
|
|
2547
2547
|
const stat5 = await lstat2(entry);
|
|
2548
2548
|
if (stat5.isDirectory()) {
|
|
2549
2549
|
const dirents = await readdir(entry, {
|
|
@@ -2602,11 +2602,11 @@ import { readdir as readdir3 } from "node:fs/promises";
|
|
|
2602
2602
|
import { join as join9, relative as relative2 } from "node:path";
|
|
2603
2603
|
var zipBundle = async ({ directory }) => {
|
|
2604
2604
|
const zip = new JSZip2();
|
|
2605
|
-
const
|
|
2605
|
+
const list4 = await readdir3(directory, {
|
|
2606
2606
|
recursive: true,
|
|
2607
2607
|
withFileTypes: true
|
|
2608
2608
|
});
|
|
2609
|
-
for (const file of
|
|
2609
|
+
for (const file of list4) {
|
|
2610
2610
|
if (file.isFile()) {
|
|
2611
2611
|
const path = join9(file.path, file.name);
|
|
2612
2612
|
const rel = relative2(directory, path);
|
|
@@ -2747,11 +2747,11 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
|
2747
2747
|
role: role.name,
|
|
2748
2748
|
name: "lambda-policy",
|
|
2749
2749
|
policy: new Future(async (resolve) => {
|
|
2750
|
-
const
|
|
2750
|
+
const list4 = await resolveInputs(statements);
|
|
2751
2751
|
resolve(
|
|
2752
2752
|
JSON.stringify({
|
|
2753
2753
|
Version: "2012-10-17",
|
|
2754
|
-
Statement:
|
|
2754
|
+
Statement: list4.map((statement) => ({
|
|
2755
2755
|
Effect: pascalCase(statement.effect ?? "allow"),
|
|
2756
2756
|
Action: statement.actions,
|
|
2757
2757
|
Resource: statement.resources
|
|
@@ -3196,11 +3196,11 @@ var functionFeature = defineFeature({
|
|
|
3196
3196
|
name: "function",
|
|
3197
3197
|
async onTypeGen(ctx) {
|
|
3198
3198
|
const types2 = new TypeFile("@awsless/awsless");
|
|
3199
|
-
const
|
|
3199
|
+
const resources2 = new TypeObject(1);
|
|
3200
3200
|
const mocks = new TypeObject(1);
|
|
3201
3201
|
const mockResponses = new TypeObject(1);
|
|
3202
3202
|
for (const stack of ctx.stackConfigs) {
|
|
3203
|
-
const
|
|
3203
|
+
const resource = new TypeObject(2);
|
|
3204
3204
|
const mock = new TypeObject(2);
|
|
3205
3205
|
const mockResponse = new TypeObject(2);
|
|
3206
3206
|
for (const [name, local] of Object.entries(stack.functions || {})) {
|
|
@@ -3215,23 +3215,23 @@ var functionFeature = defineFeature({
|
|
|
3215
3215
|
if ("file" in local.code) {
|
|
3216
3216
|
const relFile = relative3(directories.types, local.code.file);
|
|
3217
3217
|
if (props.runtime === "container") {
|
|
3218
|
-
|
|
3218
|
+
resource.addType(name, `Invoke<'${funcName}', Func>`);
|
|
3219
3219
|
mock.addType(name, `MockBuilder<Func>`);
|
|
3220
3220
|
mockResponse.addType(name, `MockObject<Func>`);
|
|
3221
3221
|
} else {
|
|
3222
3222
|
types2.addImport(varName, relFile);
|
|
3223
|
-
|
|
3223
|
+
resource.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
3224
3224
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
3225
3225
|
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
3226
3226
|
}
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
3229
3229
|
mocks.addType(stack.name, mock);
|
|
3230
|
-
|
|
3230
|
+
resources2.addType(stack.name, resource);
|
|
3231
3231
|
mockResponses.addType(stack.name, mockResponse);
|
|
3232
3232
|
}
|
|
3233
3233
|
types2.addCode(typeGenCode2);
|
|
3234
|
-
types2.addInterface("FunctionResources",
|
|
3234
|
+
types2.addInterface("FunctionResources", resources2);
|
|
3235
3235
|
types2.addInterface("FunctionMock", mocks);
|
|
3236
3236
|
types2.addInterface("FunctionMockResponse", mockResponses);
|
|
3237
3237
|
await ctx.write("function.d.ts", types2, true);
|
|
@@ -3508,11 +3508,11 @@ var queueFeature = defineFeature({
|
|
|
3508
3508
|
name: "queue",
|
|
3509
3509
|
async onTypeGen(ctx) {
|
|
3510
3510
|
const gen = new TypeFile("@awsless/awsless");
|
|
3511
|
-
const
|
|
3511
|
+
const resources2 = new TypeObject(1);
|
|
3512
3512
|
const mocks = new TypeObject(1);
|
|
3513
3513
|
const mockResponses = new TypeObject(1);
|
|
3514
3514
|
for (const stack of ctx.stackConfigs) {
|
|
3515
|
-
const
|
|
3515
|
+
const resource = new TypeObject(2);
|
|
3516
3516
|
const mock = new TypeObject(2);
|
|
3517
3517
|
const mockResponse = new TypeObject(2);
|
|
3518
3518
|
for (const [name, props] of Object.entries(stack.queues || {})) {
|
|
@@ -3527,16 +3527,16 @@ var queueFeature = defineFeature({
|
|
|
3527
3527
|
const relFile = relative4(directories.types, props.consumer.code.file);
|
|
3528
3528
|
gen.addImport(varName, relFile);
|
|
3529
3529
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
3530
|
-
|
|
3530
|
+
resource.addType(name, `Send<'${queueName}', typeof ${varName}>`);
|
|
3531
3531
|
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
3532
3532
|
}
|
|
3533
3533
|
}
|
|
3534
3534
|
mocks.addType(stack.name, mock);
|
|
3535
|
-
|
|
3535
|
+
resources2.addType(stack.name, resource);
|
|
3536
3536
|
mockResponses.addType(stack.name, mockResponse);
|
|
3537
3537
|
}
|
|
3538
3538
|
gen.addCode(typeGenCode3);
|
|
3539
|
-
gen.addInterface("QueueResources",
|
|
3539
|
+
gen.addInterface("QueueResources", resources2);
|
|
3540
3540
|
gen.addInterface("QueueMock", mocks);
|
|
3541
3541
|
gen.addInterface("QueueMockResponse", mockResponses);
|
|
3542
3542
|
await ctx.write("queue.d.ts", gen, true);
|
|
@@ -3784,11 +3784,11 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3784
3784
|
role: role.name,
|
|
3785
3785
|
name: "lambda-policy",
|
|
3786
3786
|
policy: new Future2(async (resolve) => {
|
|
3787
|
-
const
|
|
3787
|
+
const list4 = await resolveInputs2(statements);
|
|
3788
3788
|
resolve(
|
|
3789
3789
|
JSON.stringify({
|
|
3790
3790
|
Version: "2012-10-17",
|
|
3791
|
-
Statement:
|
|
3791
|
+
Statement: list4.map((statement) => ({
|
|
3792
3792
|
Effect: pascalCase2(statement.effect ?? "allow"),
|
|
3793
3793
|
Action: statement.actions,
|
|
3794
3794
|
Resource: statement.resources
|
|
@@ -3925,15 +3925,15 @@ var rpcFeature = defineFeature({
|
|
|
3925
3925
|
}
|
|
3926
3926
|
for (const stack of ctx.stackConfigs) {
|
|
3927
3927
|
for (const [id, queries] of Object.entries(stack.rpc ?? {})) {
|
|
3928
|
-
const
|
|
3929
|
-
if (!
|
|
3928
|
+
const list4 = names[id];
|
|
3929
|
+
if (!list4) {
|
|
3930
3930
|
throw new FileError(stack.file, `The RPC API for "${id}" isn't defined on app level.`);
|
|
3931
3931
|
}
|
|
3932
3932
|
for (const [name, props] of Object.entries(queries ?? {})) {
|
|
3933
|
-
if (
|
|
3933
|
+
if (list4.has(name)) {
|
|
3934
3934
|
throw new FileError(stack.file, `Duplicate RPC API function "${id}.${name}"`);
|
|
3935
3935
|
} else {
|
|
3936
|
-
|
|
3936
|
+
list4.add(name);
|
|
3937
3937
|
}
|
|
3938
3938
|
const timeout = toSeconds5(props.timeout ?? ctx.appConfig.defaults.function.timeout);
|
|
3939
3939
|
const maxTimeout = toSeconds5(ctx.appConfig.defaults.rpc[id].timeout) * 0.8;
|
|
@@ -4191,16 +4191,16 @@ var searchFeature = defineFeature({
|
|
|
4191
4191
|
name: "search",
|
|
4192
4192
|
async onTypeGen(ctx) {
|
|
4193
4193
|
const gen = new TypeFile("@awsless/awsless");
|
|
4194
|
-
const
|
|
4194
|
+
const resources2 = new TypeObject(1);
|
|
4195
4195
|
for (const stack of ctx.stackConfigs) {
|
|
4196
|
-
const
|
|
4196
|
+
const list4 = new TypeObject(2);
|
|
4197
4197
|
for (const id of Object.keys(stack.searchs ?? {})) {
|
|
4198
|
-
|
|
4198
|
+
list4.addType(id, `Search`);
|
|
4199
4199
|
}
|
|
4200
|
-
|
|
4200
|
+
resources2.addType(stack.name, list4);
|
|
4201
4201
|
}
|
|
4202
4202
|
gen.addCode(typeGenCode4);
|
|
4203
|
-
gen.addInterface("SearchResources",
|
|
4203
|
+
gen.addInterface("SearchResources", resources2);
|
|
4204
4204
|
await ctx.write("search.d.ts", gen, true);
|
|
4205
4205
|
},
|
|
4206
4206
|
onStack(ctx) {
|
|
@@ -4305,7 +4305,14 @@ var getForwardHostFunctionCode = () => {
|
|
|
4305
4305
|
|
|
4306
4306
|
// src/feature/site/index.ts
|
|
4307
4307
|
import { camelCase as camelCase6, constantCase as constantCase10 } from "change-case";
|
|
4308
|
+
|
|
4309
|
+
// src/util/exec.ts
|
|
4308
4310
|
import { exec } from "promisify-child-process";
|
|
4311
|
+
var execCommand = async ({ cwd, command }) => {
|
|
4312
|
+
await exec(command, { cwd });
|
|
4313
|
+
};
|
|
4314
|
+
|
|
4315
|
+
// src/feature/site/index.ts
|
|
4309
4316
|
var siteFeature = defineFeature({
|
|
4310
4317
|
name: "site",
|
|
4311
4318
|
onStack(ctx) {
|
|
@@ -4323,7 +4330,10 @@ var siteFeature = defineFeature({
|
|
|
4323
4330
|
const fingerprint = await generateCacheKey(buildProps.cacheKey);
|
|
4324
4331
|
return build3(fingerprint, async (write) => {
|
|
4325
4332
|
const cwd = join11(directories.root, dirname7(ctx.stackConfig.file));
|
|
4326
|
-
await
|
|
4333
|
+
await execCommand({
|
|
4334
|
+
cwd,
|
|
4335
|
+
command: buildProps.command
|
|
4336
|
+
});
|
|
4327
4337
|
await write("HASH", fingerprint);
|
|
4328
4338
|
return {
|
|
4329
4339
|
size: "n/a"
|
|
@@ -4418,24 +4428,26 @@ var siteFeature = defineFeature({
|
|
|
4418
4428
|
signingBehavior: "always",
|
|
4419
4429
|
signingProtocol: "sigv4"
|
|
4420
4430
|
});
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
for (const file of files) {
|
|
4427
|
-
const object = new $15.aws.s3.BucketObject(group, file, {
|
|
4428
|
-
bucket: bucket.bucket,
|
|
4429
|
-
key: file,
|
|
4430
|
-
cacheControl: getCacheControl(file),
|
|
4431
|
-
contentType: getContentType(file),
|
|
4432
|
-
source: join11(props.static, file),
|
|
4433
|
-
sourceHash: $hash(join11(props.static, file))
|
|
4431
|
+
ctx.onReady(() => {
|
|
4432
|
+
if (typeof props.static === "string") {
|
|
4433
|
+
const files = glob2.sync("**", {
|
|
4434
|
+
cwd: props.static,
|
|
4435
|
+
nodir: true
|
|
4434
4436
|
});
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
+
for (const file of files) {
|
|
4438
|
+
const object = new $15.aws.s3.BucketObject(group, file, {
|
|
4439
|
+
bucket: bucket.bucket,
|
|
4440
|
+
key: file,
|
|
4441
|
+
cacheControl: getCacheControl(file),
|
|
4442
|
+
contentType: getContentType(file),
|
|
4443
|
+
source: join11(props.static, file),
|
|
4444
|
+
sourceHash: $hash(join11(props.static, file))
|
|
4445
|
+
});
|
|
4446
|
+
versions.push(object.key);
|
|
4447
|
+
versions.push(object.etag);
|
|
4448
|
+
}
|
|
4437
4449
|
}
|
|
4438
|
-
}
|
|
4450
|
+
});
|
|
4439
4451
|
origins.push({
|
|
4440
4452
|
originId: "static",
|
|
4441
4453
|
domainName: bucket.bucketRegionalDomainName,
|
|
@@ -4678,9 +4690,9 @@ var storeFeature = defineFeature({
|
|
|
4678
4690
|
name: "store",
|
|
4679
4691
|
async onTypeGen(ctx) {
|
|
4680
4692
|
const gen = new TypeFile("@awsless/awsless");
|
|
4681
|
-
const
|
|
4693
|
+
const resources2 = new TypeObject(1);
|
|
4682
4694
|
for (const stack of ctx.stackConfigs) {
|
|
4683
|
-
const
|
|
4695
|
+
const list4 = new TypeObject(2);
|
|
4684
4696
|
for (const id of Object.keys(stack.stores ?? {})) {
|
|
4685
4697
|
const storeName = formatLocalResourceName({
|
|
4686
4698
|
appName: ctx.appConfig.name,
|
|
@@ -4688,12 +4700,12 @@ var storeFeature = defineFeature({
|
|
|
4688
4700
|
resourceType: "store",
|
|
4689
4701
|
resourceName: id
|
|
4690
4702
|
});
|
|
4691
|
-
|
|
4703
|
+
list4.addType(id, `Store<'${storeName}'>`);
|
|
4692
4704
|
}
|
|
4693
|
-
|
|
4705
|
+
resources2.addType(stack.name, list4);
|
|
4694
4706
|
}
|
|
4695
4707
|
gen.addCode(typeGenCode5);
|
|
4696
|
-
gen.addInterface("StoreResources",
|
|
4708
|
+
gen.addInterface("StoreResources", resources2);
|
|
4697
4709
|
await ctx.write("store.d.ts", gen, true);
|
|
4698
4710
|
},
|
|
4699
4711
|
onApp(ctx) {
|
|
@@ -4817,9 +4829,9 @@ var tableFeature = defineFeature({
|
|
|
4817
4829
|
name: "table",
|
|
4818
4830
|
async onTypeGen(ctx) {
|
|
4819
4831
|
const gen = new TypeFile("@awsless/awsless");
|
|
4820
|
-
const
|
|
4832
|
+
const resources2 = new TypeObject(1);
|
|
4821
4833
|
for (const stack of ctx.stackConfigs) {
|
|
4822
|
-
const
|
|
4834
|
+
const list4 = new TypeObject(2);
|
|
4823
4835
|
for (const name of Object.keys(stack.tables || {})) {
|
|
4824
4836
|
const tableName = formatLocalResourceName({
|
|
4825
4837
|
appName: ctx.appConfig.name,
|
|
@@ -4827,11 +4839,11 @@ var tableFeature = defineFeature({
|
|
|
4827
4839
|
resourceType: "table",
|
|
4828
4840
|
resourceName: name
|
|
4829
4841
|
});
|
|
4830
|
-
|
|
4842
|
+
list4.addType(name, `'${tableName}'`);
|
|
4831
4843
|
}
|
|
4832
|
-
|
|
4844
|
+
resources2.addType(stack.name, list4);
|
|
4833
4845
|
}
|
|
4834
|
-
gen.addInterface("TableResources",
|
|
4846
|
+
gen.addInterface("TableResources", resources2);
|
|
4835
4847
|
await ctx.write("table.d.ts", gen, true);
|
|
4836
4848
|
},
|
|
4837
4849
|
onApp(ctx) {
|
|
@@ -5016,11 +5028,11 @@ var taskFeature = defineFeature({
|
|
|
5016
5028
|
name: "task",
|
|
5017
5029
|
async onTypeGen(ctx) {
|
|
5018
5030
|
const types2 = new TypeFile("@awsless/awsless");
|
|
5019
|
-
const
|
|
5031
|
+
const resources2 = new TypeObject(1);
|
|
5020
5032
|
const mocks = new TypeObject(1);
|
|
5021
5033
|
const mockResponses = new TypeObject(1);
|
|
5022
5034
|
for (const stack of ctx.stackConfigs) {
|
|
5023
|
-
const
|
|
5035
|
+
const resource = new TypeObject(2);
|
|
5024
5036
|
const mock = new TypeObject(2);
|
|
5025
5037
|
const mockResponse = new TypeObject(2);
|
|
5026
5038
|
for (const [name, props] of Object.entries(stack.tasks || {})) {
|
|
@@ -5034,17 +5046,17 @@ var taskFeature = defineFeature({
|
|
|
5034
5046
|
if ("file" in props.consumer.code) {
|
|
5035
5047
|
const relFile = relative6(directories.types, props.consumer.code.file);
|
|
5036
5048
|
types2.addImport(varName, relFile);
|
|
5037
|
-
|
|
5049
|
+
resource.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
5038
5050
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
5039
5051
|
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
5040
5052
|
}
|
|
5041
5053
|
}
|
|
5042
5054
|
mocks.addType(stack.name, mock);
|
|
5043
|
-
|
|
5055
|
+
resources2.addType(stack.name, resource);
|
|
5044
5056
|
mockResponses.addType(stack.name, mockResponse);
|
|
5045
5057
|
}
|
|
5046
5058
|
types2.addCode(typeGenCode6);
|
|
5047
|
-
types2.addInterface("TaskResources",
|
|
5059
|
+
types2.addInterface("TaskResources", resources2);
|
|
5048
5060
|
types2.addInterface("TaskMock", mocks);
|
|
5049
5061
|
types2.addInterface("TaskMockResponse", mockResponses);
|
|
5050
5062
|
await ctx.write("task.d.ts", types2, true);
|
|
@@ -5084,7 +5096,7 @@ var topicFeature = defineFeature({
|
|
|
5084
5096
|
name: "topic",
|
|
5085
5097
|
async onTypeGen(ctx) {
|
|
5086
5098
|
const gen = new TypeFile("@awsless/awsless");
|
|
5087
|
-
const
|
|
5099
|
+
const resources2 = new TypeObject(1);
|
|
5088
5100
|
const mocks = new TypeObject(1);
|
|
5089
5101
|
const mockResponses = new TypeObject(1);
|
|
5090
5102
|
for (const stack of ctx.stackConfigs) {
|
|
@@ -5095,12 +5107,12 @@ var topicFeature = defineFeature({
|
|
|
5095
5107
|
resourceName: topic
|
|
5096
5108
|
});
|
|
5097
5109
|
mockResponses.addType(topic, "Mock");
|
|
5098
|
-
|
|
5110
|
+
resources2.addType(topic, `Publish<'${name}'>`);
|
|
5099
5111
|
mocks.addType(topic, `MockBuilder`);
|
|
5100
5112
|
}
|
|
5101
5113
|
}
|
|
5102
5114
|
gen.addCode(typeGenCode7);
|
|
5103
|
-
gen.addInterface("TopicResources",
|
|
5115
|
+
gen.addInterface("TopicResources", resources2);
|
|
5104
5116
|
gen.addInterface("TopicMock", mocks);
|
|
5105
5117
|
gen.addInterface("TopicMockResponse", mockResponses);
|
|
5106
5118
|
await ctx.write("topic.d.ts", gen, true);
|
|
@@ -5270,7 +5282,7 @@ var alertFeature = defineFeature({
|
|
|
5270
5282
|
name: "alert",
|
|
5271
5283
|
async onTypeGen(ctx) {
|
|
5272
5284
|
const gen = new TypeFile("@awsless/awsless");
|
|
5273
|
-
const
|
|
5285
|
+
const resources2 = new TypeObject(1);
|
|
5274
5286
|
const mocks = new TypeObject(1);
|
|
5275
5287
|
const mockResponses = new TypeObject(1);
|
|
5276
5288
|
for (const alert of Object.keys(ctx.appConfig.defaults.alerts ?? {})) {
|
|
@@ -5279,12 +5291,12 @@ var alertFeature = defineFeature({
|
|
|
5279
5291
|
resourceType: "alert",
|
|
5280
5292
|
resourceName: alert
|
|
5281
5293
|
});
|
|
5282
|
-
|
|
5294
|
+
resources2.addType(alert, `Alert<'${name}'>`);
|
|
5283
5295
|
mockResponses.addType(alert, "Mock");
|
|
5284
5296
|
mocks.addType(alert, `MockBuilder`);
|
|
5285
5297
|
}
|
|
5286
5298
|
gen.addCode(typeGenCode8);
|
|
5287
|
-
gen.addInterface("AlertResources",
|
|
5299
|
+
gen.addInterface("AlertResources", resources2);
|
|
5288
5300
|
gen.addInterface("AlertMock", mocks);
|
|
5289
5301
|
gen.addInterface("AlertMockResponse", mockResponses);
|
|
5290
5302
|
await ctx.write("alert.d.ts", gen, true);
|
|
@@ -5789,7 +5801,7 @@ var createApp = (props) => {
|
|
|
5789
5801
|
region: props.appConfig.region,
|
|
5790
5802
|
appName: props.appConfig.name
|
|
5791
5803
|
});
|
|
5792
|
-
const
|
|
5804
|
+
const commands7 = [];
|
|
5793
5805
|
const configs = /* @__PURE__ */ new Set();
|
|
5794
5806
|
const tests = [];
|
|
5795
5807
|
const builders = [];
|
|
@@ -5849,7 +5861,7 @@ var createApp = (props) => {
|
|
|
5849
5861
|
});
|
|
5850
5862
|
},
|
|
5851
5863
|
registerCommand(command) {
|
|
5852
|
-
|
|
5864
|
+
commands7.push(command);
|
|
5853
5865
|
},
|
|
5854
5866
|
registerDomainZone(zone) {
|
|
5855
5867
|
domainZones.push(zone);
|
|
@@ -5941,7 +5953,7 @@ var createApp = (props) => {
|
|
|
5941
5953
|
configs.add(name);
|
|
5942
5954
|
},
|
|
5943
5955
|
registerCommand(command) {
|
|
5944
|
-
|
|
5956
|
+
commands7.push(command);
|
|
5945
5957
|
},
|
|
5946
5958
|
registerDomainZone(zone) {
|
|
5947
5959
|
domainZones.push(zone);
|
|
@@ -6013,20 +6025,23 @@ var createApp = (props) => {
|
|
|
6013
6025
|
}
|
|
6014
6026
|
}
|
|
6015
6027
|
}
|
|
6016
|
-
|
|
6017
|
-
listener
|
|
6018
|
-
|
|
6028
|
+
const ready = () => {
|
|
6029
|
+
for (const listener of readyListeners) {
|
|
6030
|
+
listener();
|
|
6031
|
+
}
|
|
6032
|
+
};
|
|
6019
6033
|
return {
|
|
6020
6034
|
app,
|
|
6021
6035
|
base,
|
|
6022
6036
|
zones,
|
|
6037
|
+
ready,
|
|
6023
6038
|
domainZones,
|
|
6024
6039
|
tests,
|
|
6025
6040
|
binds,
|
|
6026
6041
|
shared,
|
|
6027
6042
|
configs,
|
|
6028
6043
|
builders,
|
|
6029
|
-
commands:
|
|
6044
|
+
commands: commands7
|
|
6030
6045
|
// deploymentLine,
|
|
6031
6046
|
};
|
|
6032
6047
|
};
|
|
@@ -6239,7 +6254,8 @@ var del2 = (program2) => {
|
|
|
6239
6254
|
const profile = appConfig.profile;
|
|
6240
6255
|
const credentials = getCredentials(profile);
|
|
6241
6256
|
const accountId = await getAccountId(credentials, region);
|
|
6242
|
-
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
6257
|
+
const { app, ready } = createApp({ appConfig, stackConfigs, accountId });
|
|
6258
|
+
ready();
|
|
6243
6259
|
const stackNames = app.stacks.filter((stack) => {
|
|
6244
6260
|
return !!filters.find((f) => wildstring2.match(f, stack.name));
|
|
6245
6261
|
}).map((s) => s.name);
|
|
@@ -6621,7 +6637,7 @@ var deploy = (program2) => {
|
|
|
6621
6637
|
const credentials = getCredentials(profile);
|
|
6622
6638
|
const accountId = await getAccountId(credentials, region);
|
|
6623
6639
|
await bootstrapAwsless({ credentials, region, accountId });
|
|
6624
|
-
const { app, tests, builders } = createApp({
|
|
6640
|
+
const { app, tests, builders, ready } = createApp({
|
|
6625
6641
|
appConfig,
|
|
6626
6642
|
stackConfigs,
|
|
6627
6643
|
accountId,
|
|
@@ -6649,6 +6665,7 @@ var deploy = (program2) => {
|
|
|
6649
6665
|
}
|
|
6650
6666
|
}
|
|
6651
6667
|
await buildAssets(builders, filters);
|
|
6668
|
+
ready();
|
|
6652
6669
|
const { workspace, state: state2 } = await createWorkSpace({
|
|
6653
6670
|
credentials,
|
|
6654
6671
|
accountId,
|
|
@@ -6781,7 +6798,7 @@ import { log as log10, note as note3 } from "@clack/prompts";
|
|
|
6781
6798
|
import { constantCase as constantCase12 } from "change-case";
|
|
6782
6799
|
import { spawn } from "child_process";
|
|
6783
6800
|
var bind = (program2) => {
|
|
6784
|
-
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 (
|
|
6801
|
+
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 (commands7 = [], opts) => {
|
|
6785
6802
|
await layout("bind", async ({ appConfig, stackConfigs }) => {
|
|
6786
6803
|
const region = appConfig.region;
|
|
6787
6804
|
const profile = appConfig.profile;
|
|
@@ -6812,10 +6829,10 @@ var bind = (program2) => {
|
|
|
6812
6829
|
if (configList.length ?? 0 > 0) {
|
|
6813
6830
|
note3(wrap(configList.map((v) => color.label(constantCase12(v)))), "Bind Config");
|
|
6814
6831
|
}
|
|
6815
|
-
if (
|
|
6832
|
+
if (commands7.length === 0) {
|
|
6816
6833
|
return "No command to execute.";
|
|
6817
6834
|
}
|
|
6818
|
-
const command =
|
|
6835
|
+
const command = commands7.join(" ");
|
|
6819
6836
|
const freshCred = await credentials();
|
|
6820
6837
|
spawn(command, {
|
|
6821
6838
|
env: {
|
|
@@ -6926,13 +6943,13 @@ var dev = (program2) => {
|
|
|
6926
6943
|
});
|
|
6927
6944
|
};
|
|
6928
6945
|
|
|
6929
|
-
// src/cli/command/
|
|
6946
|
+
// src/cli/command/resources.ts
|
|
6930
6947
|
import { log as log12 } from "@clack/prompts";
|
|
6931
6948
|
import chalk6 from "chalk";
|
|
6932
6949
|
import wildstring5 from "wildstring";
|
|
6933
|
-
var
|
|
6934
|
-
program2.command("
|
|
6935
|
-
await layout("
|
|
6950
|
+
var resources = (program2) => {
|
|
6951
|
+
program2.command("resources").argument("[stacks...]", "Optionally filter stack resources to list").description(`List all defined resources in your app`).action(async (filters) => {
|
|
6952
|
+
await layout("resources", async ({ appConfig, stackConfigs }) => {
|
|
6936
6953
|
const region = appConfig.region;
|
|
6937
6954
|
const credentials = getCredentials(appConfig.profile);
|
|
6938
6955
|
const accountId = await getAccountId(credentials, region);
|
|
@@ -6951,21 +6968,14 @@ var list3 = (program2) => {
|
|
|
6951
6968
|
}
|
|
6952
6969
|
log12.step(chalk6.magenta(stack.name));
|
|
6953
6970
|
line("");
|
|
6954
|
-
for (const
|
|
6955
|
-
line(formatResource(stack,
|
|
6971
|
+
for (const resource of stack.resources) {
|
|
6972
|
+
line(formatResource(stack, resource.$.urn));
|
|
6956
6973
|
}
|
|
6957
6974
|
}
|
|
6958
6975
|
});
|
|
6959
6976
|
});
|
|
6960
6977
|
};
|
|
6961
6978
|
|
|
6962
|
-
// src/cli/command/resource/index.ts
|
|
6963
|
-
var commands4 = [list3];
|
|
6964
|
-
var resource = (program2) => {
|
|
6965
|
-
const command = program2.command("resource").description(`Manage app resources`);
|
|
6966
|
-
commands4.forEach((cb) => cb(command));
|
|
6967
|
-
};
|
|
6968
|
-
|
|
6969
6979
|
// src/cli/command/run.ts
|
|
6970
6980
|
import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
|
|
6971
6981
|
import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
|
|
@@ -6981,17 +6991,17 @@ var run = (program2) => {
|
|
|
6981
6991
|
const region = appConfig.region;
|
|
6982
6992
|
const credentials = getCredentials(appConfig.profile);
|
|
6983
6993
|
const accountId = await getAccountId(credentials, region);
|
|
6984
|
-
const { commands:
|
|
6994
|
+
const { commands: commands7 } = createApp({ appConfig, stackConfigs, accountId });
|
|
6985
6995
|
let command;
|
|
6986
6996
|
if (selected) {
|
|
6987
|
-
command =
|
|
6997
|
+
command = commands7.find((cmd) => {
|
|
6988
6998
|
return cmd.name === selected;
|
|
6989
6999
|
});
|
|
6990
7000
|
} else {
|
|
6991
7001
|
const selected2 = await select2({
|
|
6992
7002
|
message: "Pick the command you want to run:",
|
|
6993
|
-
initialValue:
|
|
6994
|
-
options:
|
|
7003
|
+
initialValue: commands7[0],
|
|
7004
|
+
options: commands7.map((cmd) => ({
|
|
6995
7005
|
value: cmd,
|
|
6996
7006
|
label: cmd.name,
|
|
6997
7007
|
hint: cmd.description
|
|
@@ -7104,10 +7114,10 @@ var unlock = (program2) => {
|
|
|
7104
7114
|
};
|
|
7105
7115
|
|
|
7106
7116
|
// src/cli/command/state/index.ts
|
|
7107
|
-
var
|
|
7117
|
+
var commands4 = [pull, push, unlock];
|
|
7108
7118
|
var state = (program2) => {
|
|
7109
7119
|
const command = program2.command("state").description(`Manage app state`);
|
|
7110
|
-
|
|
7120
|
+
commands4.forEach((cb) => cb(command));
|
|
7111
7121
|
};
|
|
7112
7122
|
|
|
7113
7123
|
// src/cli/command/test.ts
|
|
@@ -7139,7 +7149,7 @@ var types = (program2) => {
|
|
|
7139
7149
|
|
|
7140
7150
|
// src/cli/command/domain/list.ts
|
|
7141
7151
|
import { log as log13 } from "@clack/prompts";
|
|
7142
|
-
var
|
|
7152
|
+
var list3 = (program2) => {
|
|
7143
7153
|
program2.command("list").description("List all domains").action(async () => {
|
|
7144
7154
|
await layout("domain list", async ({ appConfig, stackConfigs }) => {
|
|
7145
7155
|
const region = appConfig.region;
|
|
@@ -7215,14 +7225,14 @@ var deploy2 = (program2) => {
|
|
|
7215
7225
|
};
|
|
7216
7226
|
|
|
7217
7227
|
// src/cli/command/domain/index.ts
|
|
7218
|
-
var
|
|
7228
|
+
var commands5 = [
|
|
7219
7229
|
//
|
|
7220
7230
|
deploy2,
|
|
7221
|
-
|
|
7231
|
+
list3
|
|
7222
7232
|
];
|
|
7223
7233
|
var domain = (program2) => {
|
|
7224
7234
|
const command = program2.command("domain").description(`Manage domains`);
|
|
7225
|
-
|
|
7235
|
+
commands5.forEach((cb) => cb(command));
|
|
7226
7236
|
};
|
|
7227
7237
|
|
|
7228
7238
|
// src/cli/command/logs.ts
|
|
@@ -7250,9 +7260,9 @@ var logs = (program2) => {
|
|
|
7250
7260
|
const logGroupArns = [];
|
|
7251
7261
|
for (const stack of app.stacks) {
|
|
7252
7262
|
if (filters.find((f) => wildstring6.match(f, stack.name))) {
|
|
7253
|
-
for (const
|
|
7254
|
-
if (
|
|
7255
|
-
const logGroup =
|
|
7263
|
+
for (const resource of stack.resources) {
|
|
7264
|
+
if (resource.$.type === "aws_cloudwatch_log_group") {
|
|
7265
|
+
const logGroup = resource;
|
|
7256
7266
|
logGroupArns.push(await logGroup.arn);
|
|
7257
7267
|
}
|
|
7258
7268
|
}
|
|
@@ -7343,10 +7353,10 @@ var parseJsonLog = (message) => {
|
|
|
7343
7353
|
json3 = JSON.parse(message);
|
|
7344
7354
|
} catch (error) {
|
|
7345
7355
|
}
|
|
7346
|
-
if ("level" in json3 && typeof json3.level === "string" && "
|
|
7356
|
+
if ("level" in json3 && typeof json3.level === "string" && "timestamp" in json3 && typeof json3.timestamp === "string" && "message" in json3) {
|
|
7347
7357
|
return {
|
|
7348
7358
|
level: json3.level,
|
|
7349
|
-
message: json3.message,
|
|
7359
|
+
message: typeof json3.message === "string" ? json3.message : JSON.stringify(json3.message, void 0, 2),
|
|
7350
7360
|
date: new Date(json3.timestamp)
|
|
7351
7361
|
};
|
|
7352
7362
|
}
|
|
@@ -7364,7 +7374,7 @@ var parseJsonLog = (message) => {
|
|
|
7364
7374
|
};
|
|
7365
7375
|
|
|
7366
7376
|
// src/cli/command/index.ts
|
|
7367
|
-
var
|
|
7377
|
+
var commands6 = [
|
|
7368
7378
|
bootstrap,
|
|
7369
7379
|
types,
|
|
7370
7380
|
build2,
|
|
@@ -7378,7 +7388,7 @@ var commands7 = [
|
|
|
7378
7388
|
auth,
|
|
7379
7389
|
domain,
|
|
7380
7390
|
state,
|
|
7381
|
-
|
|
7391
|
+
resources,
|
|
7382
7392
|
config,
|
|
7383
7393
|
test
|
|
7384
7394
|
];
|
|
@@ -7403,7 +7413,7 @@ program.on("option:skip-prompt", () => {
|
|
|
7403
7413
|
program.on("option:no-cache", () => {
|
|
7404
7414
|
process.env.NO_CACHE = program.opts().noCache ? "1" : void 0;
|
|
7405
7415
|
});
|
|
7406
|
-
|
|
7416
|
+
commands6.forEach((fn) => fn(program));
|
|
7407
7417
|
|
|
7408
7418
|
// src/bin.ts
|
|
7409
7419
|
program.parse(process.argv);
|
package/dist/client.js
CHANGED
|
@@ -89,13 +89,14 @@ var createPubSubClient = (app, props) => {
|
|
|
89
89
|
password: config.token
|
|
90
90
|
};
|
|
91
91
|
});
|
|
92
|
+
const getApp = () => {
|
|
93
|
+
return typeof app === "string" ? app : app();
|
|
94
|
+
};
|
|
92
95
|
const getPubSubTopic = (name) => {
|
|
93
|
-
|
|
94
|
-
return `${appName}/pubsub/${name}`;
|
|
96
|
+
return `${getApp()}/pubsub/${name}`;
|
|
95
97
|
};
|
|
96
98
|
const fromPubSubTopic = (name) => {
|
|
97
|
-
|
|
98
|
-
return name.replace(`${appName}/pubsub/`, "");
|
|
99
|
+
return name.replace(`${getApp()}/pubsub/`, "");
|
|
99
100
|
};
|
|
100
101
|
return {
|
|
101
102
|
...mqtt,
|
|
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.478",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@awsless/json": "^0.0.8",
|
|
32
|
-
"@awsless/iot": "^0.0.3",
|
|
33
31
|
"@awsless/dynamodb": "^0.1.5",
|
|
32
|
+
"@awsless/iot": "^0.0.3",
|
|
33
|
+
"@awsless/json": "^0.0.8",
|
|
34
34
|
"@awsless/lambda": "^0.0.32",
|
|
35
|
-
"@awsless/redis": "^0.0.14",
|
|
36
|
-
"@awsless/s3": "^0.0.20",
|
|
37
35
|
"@awsless/open-search": "^0.0.17",
|
|
38
|
-
"@awsless/
|
|
39
|
-
"@awsless/validate": "^0.0.19",
|
|
36
|
+
"@awsless/redis": "^0.0.14",
|
|
40
37
|
"@awsless/mqtt": "^0.0.2",
|
|
38
|
+
"@awsless/validate": "^0.0.19",
|
|
39
|
+
"@awsless/sns": "^0.0.10",
|
|
40
|
+
"@awsless/sqs": "^0.0.8",
|
|
41
41
|
"@awsless/ssm": "^0.0.7",
|
|
42
|
-
"@awsless/
|
|
43
|
-
"@awsless/
|
|
42
|
+
"@awsless/s3": "^0.0.20",
|
|
43
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
"zod": "^3.24.2",
|
|
121
121
|
"zod-to-json-schema": "^3.24.3",
|
|
122
122
|
"@awsless/code": "^0.0.10",
|
|
123
|
+
"@awsless/json": "^0.0.8",
|
|
123
124
|
"@awsless/formation": "^0.0.73",
|
|
124
125
|
"@awsless/duration": "^0.0.3",
|
|
125
|
-
"@awsless/size": "^0.0.2",
|
|
126
126
|
"@awsless/graphql": "^0.0.9",
|
|
127
|
-
"@awsless/
|
|
127
|
+
"@awsless/size": "^0.0.2",
|
|
128
128
|
"@awsless/ts-file-cache": "^0.0.12",
|
|
129
129
|
"@awsless/validate": "^0.0.19"
|
|
130
130
|
},
|