@awsless/awsless 0.0.623 → 0.0.625
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 +231 -50
- 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 +17 -17
package/dist/bin.js
CHANGED
|
@@ -168,8 +168,15 @@ import { log as log2, prompt as prompt2 } from "@awsless/clui";
|
|
|
168
168
|
|
|
169
169
|
// src/util/workspace.ts
|
|
170
170
|
import { aws } from "@terraforge/aws";
|
|
171
|
-
import {
|
|
171
|
+
import {
|
|
172
|
+
DynamoActivityLogBackend,
|
|
173
|
+
DynamoLockBackend,
|
|
174
|
+
enableDebug,
|
|
175
|
+
S3StateBackend,
|
|
176
|
+
WorkSpace
|
|
177
|
+
} from "@terraforge/core";
|
|
172
178
|
import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
179
|
+
import { userInfo } from "node:os";
|
|
173
180
|
import { dirname, join as join2 } from "path";
|
|
174
181
|
|
|
175
182
|
// src/formation/cloudfront-kvs.ts
|
|
@@ -346,35 +353,112 @@ var Invalidation = createCustomResourceClass2(
|
|
|
346
353
|
"invalidation"
|
|
347
354
|
);
|
|
348
355
|
var createCloudFrontProvider = (props) => {
|
|
356
|
+
const client = new CloudFrontClient(props);
|
|
349
357
|
return createCustomProvider2("cloudfront", {
|
|
358
|
+
// distribution: {
|
|
359
|
+
// async createResource(input) {
|
|
360
|
+
// // tags: {
|
|
361
|
+
// // name,
|
|
362
|
+
// // },
|
|
363
|
+
// // comment: name,
|
|
364
|
+
// // enabled: true,
|
|
365
|
+
// // viewerCertificate: [{ cloudfrontDefaultCertificate: true }],
|
|
366
|
+
// // origin: [
|
|
367
|
+
// // {
|
|
368
|
+
// // id: 'default',
|
|
369
|
+
// // domainName: 'placeholder.awsless.dev',
|
|
370
|
+
// // customOriginConfig: [
|
|
371
|
+
// // {
|
|
372
|
+
// // httpPort: 80,
|
|
373
|
+
// // httpsPort: 443,
|
|
374
|
+
// // originProtocolPolicy: 'http-only',
|
|
375
|
+
// // originReadTimeout: 20,
|
|
376
|
+
// // originSslProtocols: ['TLSv1.2'],
|
|
377
|
+
// // },
|
|
378
|
+
// // ],
|
|
379
|
+
// // },
|
|
380
|
+
// // ],
|
|
381
|
+
// // customErrorResponse: Object.entries(props.errors ?? {}).map(([errorCode, item]) => {
|
|
382
|
+
// // if (typeof item === 'string') {
|
|
383
|
+
// // return {
|
|
384
|
+
// // errorCode: Number(errorCode),
|
|
385
|
+
// // responseCode: errorCode,
|
|
386
|
+
// // responsePagePath: item,
|
|
387
|
+
// // }
|
|
388
|
+
// // }
|
|
389
|
+
// // return {
|
|
390
|
+
// // errorCode: Number(errorCode),
|
|
391
|
+
// // errorCachingMinTtl: item.minTTL ? toSeconds(item.minTTL) : undefined,
|
|
392
|
+
// // responseCode: item.statusCode?.toString() ?? errorCode,
|
|
393
|
+
// // responsePagePath: item.path,
|
|
394
|
+
// // }
|
|
395
|
+
// // }),
|
|
396
|
+
// // restrictions: [
|
|
397
|
+
// // {
|
|
398
|
+
// // geoRestriction: [
|
|
399
|
+
// // {
|
|
400
|
+
// // restrictionType: props.geoRestrictions.length > 0 ? 'blacklist' : 'none',
|
|
401
|
+
// // items: props.geoRestrictions,
|
|
402
|
+
// // },
|
|
403
|
+
// // ],
|
|
404
|
+
// // },
|
|
405
|
+
// // ],
|
|
406
|
+
// // defaultCacheBehavior: [
|
|
407
|
+
// // {
|
|
408
|
+
// // compress: true,
|
|
409
|
+
// // targetOriginId: 'default',
|
|
410
|
+
// // functionAssociation: [
|
|
411
|
+
// // {
|
|
412
|
+
// // eventType: 'viewer-request',
|
|
413
|
+
// // functionArn: viewerRequest.arn,
|
|
414
|
+
// // },
|
|
415
|
+
// // ],
|
|
416
|
+
// // originRequestPolicyId: originRequest.id,
|
|
417
|
+
// // cachePolicyId: cache.id,
|
|
418
|
+
// // responseHeadersPolicyId: responseHeaders.id,
|
|
419
|
+
// // viewerProtocolPolicy: 'redirect-to-https',
|
|
420
|
+
// // allowedMethods: [
|
|
421
|
+
// // {
|
|
422
|
+
// // items: ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'],
|
|
423
|
+
// // cachedMethods: ['GET', 'HEAD'],
|
|
424
|
+
// // },
|
|
425
|
+
// // ],
|
|
426
|
+
// // },
|
|
427
|
+
// // ],
|
|
428
|
+
// // webAclId: waf?.arn,
|
|
429
|
+
// // client.send(
|
|
430
|
+
// // new CreateDistributionCommand({
|
|
431
|
+
// // DistributionConfig: {
|
|
432
|
+
// // Enabled: true,
|
|
433
|
+
// // ConnectionMode: 'tenant-only',
|
|
434
|
+
// // ''
|
|
435
|
+
// // },
|
|
436
|
+
// // })
|
|
437
|
+
// // )
|
|
438
|
+
// // new UpdateDistributionCommand({
|
|
439
|
+
// // 'Id'
|
|
440
|
+
// // })
|
|
441
|
+
// },
|
|
442
|
+
// },
|
|
350
443
|
invalidation: {
|
|
351
444
|
async updateResource(input) {
|
|
352
445
|
const state2 = z2.object({
|
|
353
446
|
distributionId: z2.string(),
|
|
354
447
|
paths: z2.string().array().min(1)
|
|
355
448
|
}).parse(input.proposedState);
|
|
356
|
-
await createInvalidationForDistributionTenants(
|
|
357
|
-
...props,
|
|
358
|
-
...state2
|
|
359
|
-
});
|
|
449
|
+
await createInvalidationForDistributionTenants(client, state2);
|
|
360
450
|
return {};
|
|
361
451
|
}
|
|
362
452
|
}
|
|
363
453
|
});
|
|
364
454
|
};
|
|
365
|
-
var createInvalidationForDistributionTenants = async ({
|
|
366
|
-
distributionId,
|
|
367
|
-
credentials,
|
|
368
|
-
region,
|
|
369
|
-
paths
|
|
370
|
-
}) => {
|
|
371
|
-
const client = new CloudFrontClient({ credentials, region });
|
|
455
|
+
var createInvalidationForDistributionTenants = async (client, props) => {
|
|
372
456
|
let cursor;
|
|
373
457
|
do {
|
|
374
458
|
const result = await client.send(
|
|
375
459
|
new ListDistributionTenantsCommand({
|
|
376
460
|
AssociationFilter: {
|
|
377
|
-
DistributionId: distributionId
|
|
461
|
+
DistributionId: props.distributionId
|
|
378
462
|
},
|
|
379
463
|
MaxItems: 10,
|
|
380
464
|
Marker: cursor
|
|
@@ -387,8 +471,8 @@ var createInvalidationForDistributionTenants = async ({
|
|
|
387
471
|
Id: tenant.Id,
|
|
388
472
|
InvalidationBatch: {
|
|
389
473
|
Paths: {
|
|
390
|
-
Quantity: paths.length,
|
|
391
|
-
Items: paths
|
|
474
|
+
Quantity: props.paths.length,
|
|
475
|
+
Items: props.paths
|
|
392
476
|
},
|
|
393
477
|
CallerReference: randomUUID()
|
|
394
478
|
}
|
|
@@ -585,6 +669,11 @@ var createWorkSpace = async (props) => {
|
|
|
585
669
|
...props,
|
|
586
670
|
bucket: getStateBucketName(props.region, props.accountId)
|
|
587
671
|
});
|
|
672
|
+
const activityLog = new DynamoActivityLogBackend({
|
|
673
|
+
...props,
|
|
674
|
+
tableName: "awsless-logs",
|
|
675
|
+
user: userInfo().username
|
|
676
|
+
});
|
|
588
677
|
if (process.env.VERBOSE) {
|
|
589
678
|
enableDebug();
|
|
590
679
|
}
|
|
@@ -625,12 +714,14 @@ var createWorkSpace = async (props) => {
|
|
|
625
714
|
],
|
|
626
715
|
concurrency: 15,
|
|
627
716
|
backend: {
|
|
717
|
+
activityLog,
|
|
628
718
|
state: state2,
|
|
629
719
|
lock
|
|
630
720
|
}
|
|
631
721
|
});
|
|
632
722
|
return {
|
|
633
723
|
workspace,
|
|
724
|
+
activityLog,
|
|
634
725
|
lock,
|
|
635
726
|
state: state2
|
|
636
727
|
};
|
|
@@ -671,6 +762,21 @@ var hasLockTable = async (client) => {
|
|
|
671
762
|
throw error;
|
|
672
763
|
}
|
|
673
764
|
};
|
|
765
|
+
var hasActivityLogTable = async (client) => {
|
|
766
|
+
try {
|
|
767
|
+
const result = await client.send(
|
|
768
|
+
new DescribeTableCommand({
|
|
769
|
+
TableName: "awsless-logs"
|
|
770
|
+
})
|
|
771
|
+
);
|
|
772
|
+
return !!result.Table;
|
|
773
|
+
} catch (error) {
|
|
774
|
+
if (error instanceof ResourceNotFoundException) {
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
throw error;
|
|
778
|
+
}
|
|
779
|
+
};
|
|
674
780
|
var hasStateBucket = async (client, region, accountId) => {
|
|
675
781
|
try {
|
|
676
782
|
const result = await client.send(
|
|
@@ -708,6 +814,34 @@ var createLockTable = (client) => {
|
|
|
708
814
|
})
|
|
709
815
|
);
|
|
710
816
|
};
|
|
817
|
+
var createActivityLogTable = (client) => {
|
|
818
|
+
return client.send(
|
|
819
|
+
new CreateTableCommand({
|
|
820
|
+
TableName: "awsless-logs",
|
|
821
|
+
BillingMode: BillingMode.PAY_PER_REQUEST,
|
|
822
|
+
KeySchema: [
|
|
823
|
+
{
|
|
824
|
+
AttributeName: "urn",
|
|
825
|
+
KeyType: KeyType.HASH
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
AttributeName: "date",
|
|
829
|
+
KeyType: KeyType.RANGE
|
|
830
|
+
}
|
|
831
|
+
],
|
|
832
|
+
AttributeDefinitions: [
|
|
833
|
+
{
|
|
834
|
+
AttributeName: "urn",
|
|
835
|
+
AttributeType: ScalarAttributeType.S
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
AttributeName: "date",
|
|
839
|
+
AttributeType: ScalarAttributeType.N
|
|
840
|
+
}
|
|
841
|
+
]
|
|
842
|
+
})
|
|
843
|
+
);
|
|
844
|
+
};
|
|
711
845
|
var createStateBucket = async (client, region, accountId) => {
|
|
712
846
|
const name = getStateBucketName(region, accountId);
|
|
713
847
|
await client.send(
|
|
@@ -743,12 +877,13 @@ var createStateBucket = async (client, region, accountId) => {
|
|
|
743
877
|
var bootstrapAwsless = async (props) => {
|
|
744
878
|
const dynamo = new DynamoDB(props);
|
|
745
879
|
const s3 = new S3Client(props);
|
|
746
|
-
const [
|
|
880
|
+
const [lockTable, logTable, stateBucket] = await Promise.all([
|
|
747
881
|
//
|
|
748
882
|
hasLockTable(dynamo),
|
|
883
|
+
hasActivityLogTable(dynamo),
|
|
749
884
|
hasStateBucket(s3, props.region, props.accountId)
|
|
750
885
|
]);
|
|
751
|
-
if (!
|
|
886
|
+
if (!lockTable || !stateBucket || !logTable) {
|
|
752
887
|
log2.warning(`Awsless hasn't been bootstrapped yet.`);
|
|
753
888
|
if (!process.env.SKIP_PROMPT) {
|
|
754
889
|
const confirmed = await prompt2.confirm({
|
|
@@ -763,10 +898,13 @@ var bootstrapAwsless = async (props) => {
|
|
|
763
898
|
successMessage: "Done deploying the bootstrap stack.",
|
|
764
899
|
errorMessage: "Failed to bootstrap Awsless.",
|
|
765
900
|
async task() {
|
|
766
|
-
if (!
|
|
901
|
+
if (!lockTable) {
|
|
767
902
|
await createLockTable(dynamo);
|
|
768
903
|
}
|
|
769
|
-
if (!
|
|
904
|
+
if (!logTable) {
|
|
905
|
+
await createActivityLogTable(dynamo);
|
|
906
|
+
}
|
|
907
|
+
if (!stateBucket) {
|
|
770
908
|
await createStateBucket(s3, props.region, props.accountId);
|
|
771
909
|
}
|
|
772
910
|
}
|
|
@@ -1120,11 +1258,11 @@ var FunctionDefaultSchema = z15.object({
|
|
|
1120
1258
|
// container
|
|
1121
1259
|
warm: WarmSchema.default(0),
|
|
1122
1260
|
vpc: VPCSchema.default(false),
|
|
1123
|
-
log: LogSchema.default(true).transform((
|
|
1124
|
-
retention:
|
|
1125
|
-
level: "level" in
|
|
1126
|
-
system: "system" in
|
|
1127
|
-
format: "format" in
|
|
1261
|
+
log: LogSchema.default(true).transform((log32) => ({
|
|
1262
|
+
retention: log32.retention ?? days(7),
|
|
1263
|
+
level: "level" in log32 ? log32.level : "error",
|
|
1264
|
+
system: "system" in log32 ? log32.system : "warn",
|
|
1265
|
+
format: "format" in log32 ? log32.format : "json"
|
|
1128
1266
|
})),
|
|
1129
1267
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
1130
1268
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1652,8 +1790,8 @@ var InstanceDefaultSchema = z25.object({
|
|
|
1652
1790
|
permissions: PermissionsSchema2.optional(),
|
|
1653
1791
|
healthCheck: HealthCheckSchema.optional(),
|
|
1654
1792
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1655
|
-
log: LogSchema2.default(true).transform((
|
|
1656
|
-
retention:
|
|
1793
|
+
log: LogSchema2.default(true).transform((log32) => ({
|
|
1794
|
+
retention: log32.retention ?? days4(7)
|
|
1657
1795
|
}))
|
|
1658
1796
|
}).default({});
|
|
1659
1797
|
|
|
@@ -3321,7 +3459,7 @@ import { createHash as createHash2 } from "crypto";
|
|
|
3321
3459
|
import { rolldown } from "rolldown";
|
|
3322
3460
|
import { importAsString } from "rollup-plugin-string-import";
|
|
3323
3461
|
var bundleTypeScriptWithRolldown = async ({
|
|
3324
|
-
format:
|
|
3462
|
+
format: format3 = "esm",
|
|
3325
3463
|
minify = true,
|
|
3326
3464
|
file,
|
|
3327
3465
|
nativeDir,
|
|
@@ -3354,9 +3492,9 @@ var bundleTypeScriptWithRolldown = async ({
|
|
|
3354
3492
|
}) : void 0
|
|
3355
3493
|
]
|
|
3356
3494
|
});
|
|
3357
|
-
const ext =
|
|
3495
|
+
const ext = format3 === "esm" ? "mjs" : "js";
|
|
3358
3496
|
const result = await bundle.generate({
|
|
3359
|
-
format:
|
|
3497
|
+
format: format3,
|
|
3360
3498
|
sourcemap: "hidden",
|
|
3361
3499
|
exports: "auto",
|
|
3362
3500
|
entryFileNames: `index.${ext}`,
|
|
@@ -5173,7 +5311,8 @@ var siteFeature = defineFeature({
|
|
|
5173
5311
|
}
|
|
5174
5312
|
const instance = Bun.spawn(buildProps.command.split(" "), {
|
|
5175
5313
|
cwd,
|
|
5176
|
-
env
|
|
5314
|
+
env,
|
|
5315
|
+
stdout: "ignore"
|
|
5177
5316
|
// stdout: 'inherit',
|
|
5178
5317
|
// stderr: 'inherit',
|
|
5179
5318
|
});
|
|
@@ -6574,7 +6713,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
|
|
|
6574
6713
|
}
|
|
6575
6714
|
if (!result.success) {
|
|
6576
6715
|
throw new ExpectedError(`Executable build failed:
|
|
6577
|
-
${result.logs?.map((
|
|
6716
|
+
${result.logs?.map((log32) => log32.message).join("\n")}`);
|
|
6578
6717
|
}
|
|
6579
6718
|
const file = await readFile4(filePath);
|
|
6580
6719
|
return {
|
|
@@ -8074,7 +8213,7 @@ var createApp = (props) => {
|
|
|
8074
8213
|
region: props.appConfig.region,
|
|
8075
8214
|
appName: props.appConfig.name
|
|
8076
8215
|
});
|
|
8077
|
-
const
|
|
8216
|
+
const commands11 = [];
|
|
8078
8217
|
const configs = /* @__PURE__ */ new Set();
|
|
8079
8218
|
const functionsByConfig = {};
|
|
8080
8219
|
const tests = [];
|
|
@@ -8142,7 +8281,7 @@ var createApp = (props) => {
|
|
|
8142
8281
|
});
|
|
8143
8282
|
},
|
|
8144
8283
|
registerCommand(command) {
|
|
8145
|
-
|
|
8284
|
+
commands11.push(command);
|
|
8146
8285
|
},
|
|
8147
8286
|
registerDomainZone(zone) {
|
|
8148
8287
|
domainZones.push(zone);
|
|
@@ -8243,7 +8382,7 @@ var createApp = (props) => {
|
|
|
8243
8382
|
configs.add(name);
|
|
8244
8383
|
},
|
|
8245
8384
|
registerCommand(command) {
|
|
8246
|
-
|
|
8385
|
+
commands11.push(command);
|
|
8247
8386
|
},
|
|
8248
8387
|
registerDomainZone(zone) {
|
|
8249
8388
|
domainZones.push(zone);
|
|
@@ -8339,7 +8478,7 @@ var createApp = (props) => {
|
|
|
8339
8478
|
functionsByConfig,
|
|
8340
8479
|
warnings,
|
|
8341
8480
|
builders,
|
|
8342
|
-
commands:
|
|
8481
|
+
commands: commands11
|
|
8343
8482
|
// deploymentLine,
|
|
8344
8483
|
};
|
|
8345
8484
|
};
|
|
@@ -8802,10 +8941,10 @@ var startTest = async (props) => {
|
|
|
8802
8941
|
tests.push(entry);
|
|
8803
8942
|
if ("task" in test2) {
|
|
8804
8943
|
const task2 = test2.task;
|
|
8805
|
-
for (const
|
|
8944
|
+
for (const log32 of task2.logs ?? []) {
|
|
8806
8945
|
entry.logs.push({
|
|
8807
|
-
time:
|
|
8808
|
-
text:
|
|
8946
|
+
time: log32.time,
|
|
8947
|
+
text: log32.content
|
|
8809
8948
|
});
|
|
8810
8949
|
}
|
|
8811
8950
|
}
|
|
@@ -8873,7 +9012,7 @@ var logTestLogs = (event) => {
|
|
|
8873
9012
|
].join(" "),
|
|
8874
9013
|
color.line(icon.dot)
|
|
8875
9014
|
);
|
|
8876
|
-
log16.message(test2.logs.map((
|
|
9015
|
+
log16.message(test2.logs.map((log32) => log32.text).join("\n"));
|
|
8877
9016
|
}
|
|
8878
9017
|
}
|
|
8879
9018
|
};
|
|
@@ -9514,7 +9653,7 @@ import { log as log22 } from "@awsless/clui";
|
|
|
9514
9653
|
import chalk4 from "chalk";
|
|
9515
9654
|
import { constantCase as constantCase15 } from "change-case";
|
|
9516
9655
|
var bind = (program2) => {
|
|
9517
|
-
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 (
|
|
9656
|
+
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 (commands11 = [], opts) => {
|
|
9518
9657
|
await layout("bind", async ({ appConfig, stackConfigs }) => {
|
|
9519
9658
|
const region = appConfig.region;
|
|
9520
9659
|
const profile = appConfig.profile;
|
|
@@ -9544,14 +9683,14 @@ var bind = (program2) => {
|
|
|
9544
9683
|
if (configList.length ?? 0 > 0) {
|
|
9545
9684
|
log22.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
|
|
9546
9685
|
}
|
|
9547
|
-
if (
|
|
9686
|
+
if (commands11.length === 0) {
|
|
9548
9687
|
return "No command to execute.";
|
|
9549
9688
|
}
|
|
9550
9689
|
const freshCred = await credentials();
|
|
9551
9690
|
console.log(chalk4.black(`\u2502`));
|
|
9552
|
-
console.log(chalk4.black(`\u2514 ${chalk4.yellow(
|
|
9691
|
+
console.log(chalk4.black(`\u2514 ${chalk4.yellow(commands11.join(" "))}`));
|
|
9553
9692
|
console.log("");
|
|
9554
|
-
const instance = Bun.spawn(
|
|
9693
|
+
const instance = Bun.spawn(commands11, {
|
|
9555
9694
|
// cwd: process.cwd(),
|
|
9556
9695
|
env: {
|
|
9557
9696
|
// Pass the process env vars
|
|
@@ -9741,17 +9880,17 @@ var run = (program2) => {
|
|
|
9741
9880
|
const region = appConfig.region;
|
|
9742
9881
|
const credentials = await getCredentials(appConfig.profile);
|
|
9743
9882
|
const accountId = await getAccountId(credentials, region);
|
|
9744
|
-
const { commands:
|
|
9883
|
+
const { commands: commands11, appId } = createApp({ appConfig, stackConfigs, accountId });
|
|
9745
9884
|
let command;
|
|
9746
9885
|
if (selected) {
|
|
9747
|
-
command =
|
|
9886
|
+
command = commands11.find((cmd) => {
|
|
9748
9887
|
return cmd.name === selected;
|
|
9749
9888
|
});
|
|
9750
9889
|
} else {
|
|
9751
9890
|
command = await prompt11.select({
|
|
9752
9891
|
message: "Pick the command you want to run:",
|
|
9753
|
-
initialValue:
|
|
9754
|
-
options:
|
|
9892
|
+
initialValue: commands11[0],
|
|
9893
|
+
options: commands11.map((cmd) => ({
|
|
9755
9894
|
value: cmd,
|
|
9756
9895
|
label: cmd.name,
|
|
9757
9896
|
hint: cmd.description
|
|
@@ -9808,7 +9947,7 @@ var push = (program2) => {
|
|
|
9808
9947
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
9809
9948
|
const region = appConfig.region;
|
|
9810
9949
|
const profile = appConfig.profile;
|
|
9811
|
-
const credentials = await getCredentials(
|
|
9950
|
+
const credentials = await getCredentials(profile);
|
|
9812
9951
|
const accountId = await getAccountId(credentials, region);
|
|
9813
9952
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9814
9953
|
const { state: state2 } = await createWorkSpace({ credentials, region, accountId });
|
|
@@ -10441,8 +10580,49 @@ var cron = (program2) => {
|
|
|
10441
10580
|
commands8.forEach((cb) => cb(command));
|
|
10442
10581
|
};
|
|
10443
10582
|
|
|
10583
|
+
// src/cli/command/activity/logs.ts
|
|
10584
|
+
import { log as log31 } from "@awsless/clui";
|
|
10585
|
+
import { format as format2 } from "date-fns";
|
|
10586
|
+
var logs2 = (program2) => {
|
|
10587
|
+
program2.command("logs").option("--limit <number>", "The size limit of logs to tail", "10").description("Tail the activity logs").action(async (options) => {
|
|
10588
|
+
await layout("activity logs", async ({ appConfig, stackConfigs }) => {
|
|
10589
|
+
const region = appConfig.region;
|
|
10590
|
+
const profile = appConfig.profile;
|
|
10591
|
+
const credentials = await getCredentials(profile);
|
|
10592
|
+
const accountId = await getAccountId(credentials, region);
|
|
10593
|
+
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
10594
|
+
const { activityLog } = await createWorkSpace({ credentials, region, accountId });
|
|
10595
|
+
const limit = parseInt(options.limit, 10) ?? 10;
|
|
10596
|
+
const logs3 = await activityLog.tail(app.urn, limit);
|
|
10597
|
+
for (const item of logs3) {
|
|
10598
|
+
log31.info(
|
|
10599
|
+
[
|
|
10600
|
+
//
|
|
10601
|
+
[
|
|
10602
|
+
color.line(format2(new Date(item.date), "yyyy-MM-dd HH:mm:ss")),
|
|
10603
|
+
color.line.dim(icon.arrow.right),
|
|
10604
|
+
color.warning(item.user)
|
|
10605
|
+
].join(" "),
|
|
10606
|
+
[
|
|
10607
|
+
item.action === "deploy" ? color.success("deploy") : color.error("delete"),
|
|
10608
|
+
...item.filters?.map((f) => color.info(f)) ?? []
|
|
10609
|
+
].join(" ")
|
|
10610
|
+
].join("\n")
|
|
10611
|
+
);
|
|
10612
|
+
}
|
|
10613
|
+
});
|
|
10614
|
+
});
|
|
10615
|
+
};
|
|
10616
|
+
|
|
10617
|
+
// src/cli/command/activity/index.ts
|
|
10618
|
+
var commands9 = [logs2];
|
|
10619
|
+
var activity = (program2) => {
|
|
10620
|
+
const command = program2.command("activity").description(`Manage activity logs`);
|
|
10621
|
+
commands9.forEach((cb) => cb(command));
|
|
10622
|
+
};
|
|
10623
|
+
|
|
10444
10624
|
// src/cli/command/index.ts
|
|
10445
|
-
var
|
|
10625
|
+
var commands10 = [
|
|
10446
10626
|
bootstrap,
|
|
10447
10627
|
types,
|
|
10448
10628
|
build2,
|
|
@@ -10453,6 +10633,7 @@ var commands9 = [
|
|
|
10453
10633
|
bind,
|
|
10454
10634
|
run,
|
|
10455
10635
|
logs,
|
|
10636
|
+
activity,
|
|
10456
10637
|
auth,
|
|
10457
10638
|
domain,
|
|
10458
10639
|
state,
|
|
@@ -10484,7 +10665,7 @@ program.on("option:skip-prompt", () => {
|
|
|
10484
10665
|
program.on("option:no-cache", () => {
|
|
10485
10666
|
process.env.NO_CACHE = program.opts().cache === false ? "1" : void 0;
|
|
10486
10667
|
});
|
|
10487
|
-
|
|
10668
|
+
commands10.forEach((fn) => fn(program));
|
|
10488
10669
|
|
|
10489
10670
|
// src/bin.ts
|
|
10490
10671
|
program.parse(process.argv);
|
|
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.625",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.5",
|
|
37
|
-
"@awsless/clui": "^0.0.8",
|
|
38
|
-
"@awsless/json": "^0.0.11",
|
|
39
37
|
"@awsless/cloudwatch": "^0.0.1",
|
|
38
|
+
"@awsless/clui": "^0.0.8",
|
|
40
39
|
"@awsless/dynamodb": "^0.3.14",
|
|
41
|
-
"@awsless/
|
|
40
|
+
"@awsless/duration": "^0.0.4",
|
|
41
|
+
"@awsless/json": "^0.0.11",
|
|
42
42
|
"@awsless/lambda": "^0.0.36",
|
|
43
|
+
"@awsless/mqtt": "^0.0.2",
|
|
44
|
+
"@awsless/iot": "^0.0.3",
|
|
45
|
+
"@awsless/redis": "^0.0.14",
|
|
43
46
|
"@awsless/open-search": "^0.0.21",
|
|
44
47
|
"@awsless/s3": "^0.0.21",
|
|
45
|
-
"@awsless/sns": "^0.0.10",
|
|
46
48
|
"@awsless/sqs": "^0.0.16",
|
|
47
|
-
"@awsless/
|
|
49
|
+
"@awsless/sns": "^0.0.10",
|
|
48
50
|
"@awsless/ssm": "^0.0.7",
|
|
49
|
-
"@awsless/
|
|
50
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
51
|
-
"@awsless/mqtt": "^0.0.2",
|
|
52
|
-
"@awsless/redis": "^0.0.14"
|
|
51
|
+
"@awsless/validate": "^0.1.5",
|
|
52
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
76
76
|
"@swc/core": "^1.3.70",
|
|
77
77
|
"@terraforge/aws": "^6.28.0",
|
|
78
|
-
"@terraforge/core": "^0.0.
|
|
78
|
+
"@terraforge/core": "^0.0.21",
|
|
79
79
|
"@terraforge/terraform": "^0.0.14",
|
|
80
80
|
"@types/aws-lambda": "^8.10.110",
|
|
81
81
|
"@types/bun": "1.3.9",
|
|
@@ -139,16 +139,16 @@
|
|
|
139
139
|
"zip-a-folder": "^3.1.6",
|
|
140
140
|
"zod": "^3.24.2",
|
|
141
141
|
"zod-to-json-schema": "^3.24.3",
|
|
142
|
-
"@awsless/cloudwatch": "^0.0.1",
|
|
143
|
-
"@awsless/json": "^0.0.11",
|
|
144
142
|
"@awsless/big-float": "^0.1.5",
|
|
143
|
+
"@awsless/clui": "^0.0.8",
|
|
144
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
145
145
|
"@awsless/duration": "^0.0.4",
|
|
146
|
-
"@awsless/size": "^0.0.2",
|
|
147
146
|
"@awsless/graphql": "^0.0.9",
|
|
148
|
-
"@awsless/
|
|
147
|
+
"@awsless/json": "^0.0.11",
|
|
149
148
|
"@awsless/scheduler": "^0.0.4",
|
|
150
|
-
"@awsless/
|
|
151
|
-
"@awsless/
|
|
149
|
+
"@awsless/size": "^0.0.2",
|
|
150
|
+
"@awsless/validate": "^0.1.5",
|
|
151
|
+
"@awsless/ts-file-cache": "^0.0.12"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
154
|
"@hono/node-server": "1.19.9",
|