@awsless/awsless 0.0.616 → 0.0.618
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 +71 -70
- 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 +15 -15
package/dist/bin.js
CHANGED
|
@@ -333,45 +333,70 @@ var createCloudFrontKvsProvider = ({ credentials, region }) => {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
// src/formation/cloudfront.ts
|
|
336
|
-
import {
|
|
336
|
+
import {
|
|
337
|
+
CloudFrontClient,
|
|
338
|
+
CreateInvalidationForDistributionTenantCommand,
|
|
339
|
+
ListDistributionTenantsCommand
|
|
340
|
+
} from "@aws-sdk/client-cloudfront";
|
|
337
341
|
import { createCustomProvider as createCustomProvider2, createCustomResourceClass as createCustomResourceClass2 } from "@terraforge/core";
|
|
342
|
+
import { randomUUID } from "crypto";
|
|
338
343
|
import { z as z2 } from "zod";
|
|
339
344
|
var Invalidation = createCustomResourceClass2(
|
|
340
345
|
"cloudfront",
|
|
341
346
|
"invalidation"
|
|
342
347
|
);
|
|
343
|
-
var createCloudFrontProvider = (
|
|
344
|
-
const cloudFront = new CloudFrontClient({ credentials, region });
|
|
348
|
+
var createCloudFrontProvider = (props) => {
|
|
345
349
|
return createCustomProvider2("cloudfront", {
|
|
346
350
|
invalidation: {
|
|
347
|
-
async updateResource(
|
|
351
|
+
async updateResource(input) {
|
|
348
352
|
const state2 = z2.object({
|
|
349
353
|
distributionId: z2.string(),
|
|
350
354
|
paths: z2.string().array().min(1)
|
|
351
|
-
}).parse(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
DistributionId: state2.distributionId,
|
|
358
|
-
InvalidationBatch: {
|
|
359
|
-
Paths: {
|
|
360
|
-
Quantity: state2.paths.length,
|
|
361
|
-
Items: state2.paths
|
|
362
|
-
},
|
|
363
|
-
CallerReference: props.idempotantToken
|
|
364
|
-
}
|
|
365
|
-
})
|
|
366
|
-
);
|
|
367
|
-
return {
|
|
368
|
-
...state2,
|
|
369
|
-
id: result.Invalidation?.Id
|
|
370
|
-
};
|
|
355
|
+
}).parse(input.proposedState);
|
|
356
|
+
await createInvalidationForDistributionTenants({
|
|
357
|
+
...props,
|
|
358
|
+
...state2
|
|
359
|
+
});
|
|
360
|
+
return {};
|
|
371
361
|
}
|
|
372
362
|
}
|
|
373
363
|
});
|
|
374
364
|
};
|
|
365
|
+
var createInvalidationForDistributionTenants = async ({
|
|
366
|
+
distributionId,
|
|
367
|
+
credentials,
|
|
368
|
+
region,
|
|
369
|
+
paths
|
|
370
|
+
}) => {
|
|
371
|
+
const client = new CloudFrontClient({ credentials, region });
|
|
372
|
+
let cursor;
|
|
373
|
+
do {
|
|
374
|
+
const result = await client.send(
|
|
375
|
+
new ListDistributionTenantsCommand({
|
|
376
|
+
AssociationFilter: {
|
|
377
|
+
DistributionId: distributionId
|
|
378
|
+
},
|
|
379
|
+
MaxItems: 10,
|
|
380
|
+
Marker: cursor
|
|
381
|
+
})
|
|
382
|
+
);
|
|
383
|
+
cursor = result.NextMarker;
|
|
384
|
+
for (const tenant of result.DistributionTenantList ?? []) {
|
|
385
|
+
await client.send(
|
|
386
|
+
new CreateInvalidationForDistributionTenantCommand({
|
|
387
|
+
Id: tenant.Id,
|
|
388
|
+
InvalidationBatch: {
|
|
389
|
+
Paths: {
|
|
390
|
+
Quantity: paths.length,
|
|
391
|
+
Items: paths
|
|
392
|
+
},
|
|
393
|
+
CallerReference: randomUUID()
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
} while (cursor);
|
|
399
|
+
};
|
|
375
400
|
|
|
376
401
|
// src/formation/lambda.ts
|
|
377
402
|
import { LambdaClient, UpdateFunctionCodeCommand } from "@aws-sdk/client-lambda";
|
|
@@ -3089,7 +3114,7 @@ import { aws as aws5 } from "@terraforge/aws";
|
|
|
3089
3114
|
// src/feature/function/util.ts
|
|
3090
3115
|
import { generateFileHash } from "@awsless/ts-file-cache";
|
|
3091
3116
|
import { aws as aws4 } from "@terraforge/aws";
|
|
3092
|
-
import { findInputDeps, Group as Group3, Output as
|
|
3117
|
+
import { findInputDeps, Group as Group3, Output as Output3, resolveInputs } from "@terraforge/core";
|
|
3093
3118
|
import deepmerge from "deepmerge";
|
|
3094
3119
|
import { basename as basename3 } from "path";
|
|
3095
3120
|
|
|
@@ -3483,7 +3508,7 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3483
3508
|
const policy = new aws4.iam.RolePolicy(group, "policy", {
|
|
3484
3509
|
role: role.name,
|
|
3485
3510
|
name: "lambda-policy",
|
|
3486
|
-
policy: new
|
|
3511
|
+
policy: new Output3(statementDeps, async (resolve) => {
|
|
3487
3512
|
const list3 = await resolveInputs(statements);
|
|
3488
3513
|
resolve(
|
|
3489
3514
|
JSON.stringify({
|
|
@@ -4570,7 +4595,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4570
4595
|
import { days as days6, seconds as seconds6, toDays as toDays5, toSeconds as toSeconds5 } from "@awsless/duration";
|
|
4571
4596
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes3 } from "@awsless/size";
|
|
4572
4597
|
import { aws as aws13 } from "@terraforge/aws";
|
|
4573
|
-
import { Output as
|
|
4598
|
+
import { Output as Output4, findInputDeps as findInputDeps2, resolveInputs as resolveInputs2 } from "@terraforge/core";
|
|
4574
4599
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
4575
4600
|
var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
4576
4601
|
let name;
|
|
@@ -4638,7 +4663,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4638
4663
|
const policy = new aws13.iam.RolePolicy(group, "policy", {
|
|
4639
4664
|
role: role.name,
|
|
4640
4665
|
name: "lambda-policy",
|
|
4641
|
-
policy: new
|
|
4666
|
+
policy: new Output4(statementDeps, async (resolve) => {
|
|
4642
4667
|
const list3 = await resolveInputs2(statements);
|
|
4643
4668
|
resolve(
|
|
4644
4669
|
JSON.stringify({
|
|
@@ -5148,9 +5173,9 @@ var siteFeature = defineFeature({
|
|
|
5148
5173
|
}
|
|
5149
5174
|
const instance = Bun.spawn(buildProps.command.split(" "), {
|
|
5150
5175
|
cwd,
|
|
5151
|
-
env
|
|
5152
|
-
stdout:
|
|
5153
|
-
stderr:
|
|
5176
|
+
env
|
|
5177
|
+
// stdout: 'inherit',
|
|
5178
|
+
// stderr: 'inherit',
|
|
5154
5179
|
});
|
|
5155
5180
|
await instance.exited;
|
|
5156
5181
|
if (instance.exitCode !== null && instance.exitCode > 0) {
|
|
@@ -6520,7 +6545,7 @@ import { toDays as toDays8, toSeconds as toSeconds8 } from "@awsless/duration";
|
|
|
6520
6545
|
import { toMebibytes as toMebibytes4 } from "@awsless/size";
|
|
6521
6546
|
import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
|
|
6522
6547
|
import { aws as aws26 } from "@terraforge/aws";
|
|
6523
|
-
import { Group as Group25, Output as
|
|
6548
|
+
import { Group as Group25, Output as Output6, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
|
|
6524
6549
|
import { constantCase as constantCase12, pascalCase as pascalCase3 } from "change-case";
|
|
6525
6550
|
import deepmerge4 from "deepmerge";
|
|
6526
6551
|
import { join as join16 } from "path";
|
|
@@ -6654,7 +6679,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6654
6679
|
const policy = new aws26.iam.RolePolicy(group, "policy", {
|
|
6655
6680
|
role: role.name,
|
|
6656
6681
|
name: "task-policy",
|
|
6657
|
-
policy: new
|
|
6682
|
+
policy: new Output6(statementDeps, async (resolve) => {
|
|
6658
6683
|
const list3 = await resolveInputs3(statements);
|
|
6659
6684
|
resolve(
|
|
6660
6685
|
JSON.stringify({
|
|
@@ -6718,7 +6743,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6718
6743
|
operatingSystemFamily: "LINUX"
|
|
6719
6744
|
},
|
|
6720
6745
|
trackLatest: true,
|
|
6721
|
-
containerDefinitions: new
|
|
6746
|
+
containerDefinitions: new Output6(variableDeps, async (resolve) => {
|
|
6722
6747
|
const data = await resolveInputs3(variables);
|
|
6723
6748
|
const { s3Bucket, s3Key } = await resolveInputs3({
|
|
6724
6749
|
s3Bucket: code.bucket,
|
|
@@ -10093,10 +10118,8 @@ var parseJsonLog = (message) => {
|
|
|
10093
10118
|
};
|
|
10094
10119
|
|
|
10095
10120
|
// src/cli/command/image/clear-cache.ts
|
|
10096
|
-
import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
|
|
10097
10121
|
import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
10098
10122
|
import { Cancelled as Cancelled3, log as log28, prompt as prompt14 } from "@awsless/clui";
|
|
10099
|
-
import { randomUUID } from "crypto";
|
|
10100
10123
|
var clearCache = (program2) => {
|
|
10101
10124
|
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) => {
|
|
10102
10125
|
await layout("image clear-cache", async ({ appConfig, stackConfigs }) => {
|
|
@@ -10161,10 +10184,6 @@ var clearCache = (program2) => {
|
|
|
10161
10184
|
credentials,
|
|
10162
10185
|
region
|
|
10163
10186
|
});
|
|
10164
|
-
const cloudFrontClient = new CloudFrontClient2({
|
|
10165
|
-
credentials,
|
|
10166
|
-
region: "us-east-1"
|
|
10167
|
-
});
|
|
10168
10187
|
let totalDeleted = 0;
|
|
10169
10188
|
await log28.task({
|
|
10170
10189
|
initialMessage: "Clearing cache...",
|
|
@@ -10199,18 +10218,12 @@ var clearCache = (program2) => {
|
|
|
10199
10218
|
break;
|
|
10200
10219
|
}
|
|
10201
10220
|
}
|
|
10202
|
-
await
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
Quantity: 1,
|
|
10209
|
-
Items: [shared.entry("image", "path", name)]
|
|
10210
|
-
}
|
|
10211
|
-
}
|
|
10212
|
-
})
|
|
10213
|
-
);
|
|
10221
|
+
await createInvalidationForDistributionTenants({
|
|
10222
|
+
credentials,
|
|
10223
|
+
region,
|
|
10224
|
+
distributionId,
|
|
10225
|
+
paths: [shared.entry("image", "path", name)]
|
|
10226
|
+
});
|
|
10214
10227
|
}
|
|
10215
10228
|
});
|
|
10216
10229
|
return `${totalDeleted} objects deleted from cache.`;
|
|
@@ -10226,10 +10239,8 @@ var image = (program2) => {
|
|
|
10226
10239
|
};
|
|
10227
10240
|
|
|
10228
10241
|
// src/cli/command/icon/clear-cache.ts
|
|
10229
|
-
import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
|
|
10230
10242
|
import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
|
|
10231
10243
|
import { Cancelled as Cancelled4, log as log29, prompt as prompt15 } from "@awsless/clui";
|
|
10232
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
10233
10244
|
var clearCache2 = (program2) => {
|
|
10234
10245
|
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) => {
|
|
10235
10246
|
await layout("icon clear-cache", async ({ appConfig, stackConfigs }) => {
|
|
@@ -10294,10 +10305,6 @@ var clearCache2 = (program2) => {
|
|
|
10294
10305
|
credentials,
|
|
10295
10306
|
region
|
|
10296
10307
|
});
|
|
10297
|
-
const cloudFrontClient = new CloudFrontClient3({
|
|
10298
|
-
credentials,
|
|
10299
|
-
region: "us-east-1"
|
|
10300
|
-
});
|
|
10301
10308
|
let totalDeleted = 0;
|
|
10302
10309
|
await log29.task({
|
|
10303
10310
|
initialMessage: "Clearing cache...",
|
|
@@ -10332,18 +10339,12 @@ var clearCache2 = (program2) => {
|
|
|
10332
10339
|
break;
|
|
10333
10340
|
}
|
|
10334
10341
|
}
|
|
10335
|
-
await
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
Quantity: 1,
|
|
10342
|
-
Items: [shared.entry("icon", "path", name)]
|
|
10343
|
-
}
|
|
10344
|
-
}
|
|
10345
|
-
})
|
|
10346
|
-
);
|
|
10342
|
+
await createInvalidationForDistributionTenants({
|
|
10343
|
+
credentials,
|
|
10344
|
+
region,
|
|
10345
|
+
distributionId,
|
|
10346
|
+
paths: [shared.entry("icon", "path", name)]
|
|
10347
|
+
});
|
|
10347
10348
|
}
|
|
10348
10349
|
});
|
|
10349
10350
|
return `${totalDeleted} objects deleted from cache.`;
|
|
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.618",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,28 +34,28 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.5",
|
|
37
|
-
"@awsless/clui": "^0.0.8",
|
|
38
37
|
"@awsless/cloudwatch": "^0.0.1",
|
|
38
|
+
"@awsless/clui": "^0.0.8",
|
|
39
39
|
"@awsless/duration": "^0.0.4",
|
|
40
40
|
"@awsless/dynamodb": "^0.3.8",
|
|
41
|
-
"@awsless/json": "^0.0.10",
|
|
42
41
|
"@awsless/iot": "^0.0.3",
|
|
43
|
-
"@awsless/
|
|
44
|
-
"@awsless/mqtt": "^0.0.2",
|
|
42
|
+
"@awsless/json": "^0.0.10",
|
|
45
43
|
"@awsless/open-search": "^0.0.21",
|
|
44
|
+
"@awsless/mqtt": "^0.0.2",
|
|
46
45
|
"@awsless/redis": "^0.0.14",
|
|
47
|
-
"@awsless/
|
|
46
|
+
"@awsless/lambda": "^0.0.35",
|
|
48
47
|
"@awsless/sns": "^0.0.10",
|
|
49
|
-
"@awsless/
|
|
50
|
-
"@awsless/ssm": "^0.0.7",
|
|
48
|
+
"@awsless/s3": "^0.0.21",
|
|
51
49
|
"@awsless/sqs": "^0.0.16",
|
|
52
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
50
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
51
|
+
"@awsless/validate": "^0.1.3",
|
|
52
|
+
"@awsless/ssm": "^0.0.7"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
56
56
|
"@aws-appsync/utils": "^1.5.0",
|
|
57
57
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|
|
58
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
58
|
+
"@aws-sdk/client-cloudfront": "^3.991.0",
|
|
59
59
|
"@aws-sdk/client-cloudfront-keyvaluestore": "^3.817.0",
|
|
60
60
|
"@aws-sdk/client-cloudwatch-logs": "^3.806.0",
|
|
61
61
|
"@aws-sdk/client-cognito-identity-provider": "^3.840.0",
|
|
@@ -140,14 +140,14 @@
|
|
|
140
140
|
"zod": "^3.24.2",
|
|
141
141
|
"zod-to-json-schema": "^3.24.3",
|
|
142
142
|
"@awsless/big-float": "^0.1.5",
|
|
143
|
+
"@awsless/clui": "^0.0.8",
|
|
144
|
+
"@awsless/duration": "^0.0.4",
|
|
145
|
+
"@awsless/graphql": "^0.0.9",
|
|
143
146
|
"@awsless/cloudwatch": "^0.0.1",
|
|
144
|
-
"@awsless/json": "^0.0.10",
|
|
145
147
|
"@awsless/scheduler": "^0.0.4",
|
|
146
|
-
"@awsless/
|
|
147
|
-
"@awsless/size": "^0.0.2",
|
|
148
|
+
"@awsless/json": "^0.0.10",
|
|
148
149
|
"@awsless/validate": "^0.1.3",
|
|
149
|
-
"@awsless/
|
|
150
|
-
"@awsless/clui": "^0.0.8",
|
|
150
|
+
"@awsless/size": "^0.0.2",
|
|
151
151
|
"@awsless/ts-file-cache": "^0.0.12"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|