@awsless/awsless 0.0.39 → 0.0.41
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.cjs +48 -34
- package/dist/bin.js +36 -22
- package/dist/index.cjs +26 -5
- package/dist/index.js +27 -6
- package/package.json +3 -3
package/dist/bin.cjs
CHANGED
|
@@ -1123,17 +1123,26 @@ var TypeGen = class {
|
|
|
1123
1123
|
if (this.types.size === 0) {
|
|
1124
1124
|
return;
|
|
1125
1125
|
}
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1126
|
+
const lines = [];
|
|
1127
|
+
if (this.imports.size > 0) {
|
|
1128
|
+
lines.push(...[
|
|
1129
|
+
"// Imports",
|
|
1130
|
+
...Array.from(this.imports.entries()).map(([varName, path]) => {
|
|
1131
|
+
return `import ${(0, import_change_case3.camelCase)(varName)} from '${path}'`;
|
|
1132
|
+
}),
|
|
1133
|
+
""
|
|
1134
|
+
]);
|
|
1135
|
+
}
|
|
1136
|
+
if (this.codes.size > 0) {
|
|
1137
|
+
lines.push(...[
|
|
1138
|
+
"// Types",
|
|
1139
|
+
...Array.from(this.codes).map((v) => v.trim()),
|
|
1140
|
+
""
|
|
1141
|
+
]);
|
|
1142
|
+
}
|
|
1129
1143
|
return [
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
"",
|
|
1133
|
-
"// Types",
|
|
1134
|
-
...Array.from(this.codes).map((v) => v.trim()),
|
|
1135
|
-
"",
|
|
1136
|
-
"// Module",
|
|
1144
|
+
...lines,
|
|
1145
|
+
"// Extend module",
|
|
1137
1146
|
`declare module '${this.module}' {`,
|
|
1138
1147
|
` interface ${this.interfaceName} {`,
|
|
1139
1148
|
...Array.from(this.types.entries()).map(([propName, type]) => {
|
|
@@ -1142,7 +1151,7 @@ var TypeGen = class {
|
|
|
1142
1151
|
` }`,
|
|
1143
1152
|
`}`,
|
|
1144
1153
|
"",
|
|
1145
|
-
"//
|
|
1154
|
+
"// Export fix",
|
|
1146
1155
|
`export {}`
|
|
1147
1156
|
].join("\n");
|
|
1148
1157
|
}
|
|
@@ -1308,6 +1317,7 @@ import { InvokeOptions } from '@awsless/lambda'
|
|
|
1308
1317
|
type Invoke<Name extends string, Func extends (...args: any[]) => any> = {
|
|
1309
1318
|
name: Name
|
|
1310
1319
|
(payload: Parameters<Func>[0], options?: Omit<InvokeOptions, 'name' | 'payload'>): ReturnType<Func>
|
|
1320
|
+
async: (payload: Parameters<Func>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => ReturnType<Func>
|
|
1311
1321
|
}`;
|
|
1312
1322
|
var functionPlugin = definePlugin({
|
|
1313
1323
|
name: "function",
|
|
@@ -1621,6 +1631,7 @@ var SqsEventSource = class extends Group {
|
|
|
1621
1631
|
};
|
|
1622
1632
|
|
|
1623
1633
|
// src/plugins/queue.ts
|
|
1634
|
+
var import_change_case6 = require("change-case");
|
|
1624
1635
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1625
1636
|
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1626
1637
|
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
@@ -1630,10 +1641,11 @@ var BatchSizeSchema = import_zod8.z.number().int().min(1, "Minimum batch size is
|
|
|
1630
1641
|
var MaxConcurrencySchema = import_zod8.z.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000");
|
|
1631
1642
|
var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)), "Maximum max batching window is 5 minutes");
|
|
1632
1643
|
var typeGenCode2 = `
|
|
1633
|
-
import { SendMessageOptions } from '@awsless/sqs'
|
|
1644
|
+
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
1634
1645
|
|
|
1635
1646
|
type Send<Name extends string> = {
|
|
1636
1647
|
name: Name
|
|
1648
|
+
batch(items:BatchItem[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1637
1649
|
(payload: unknown, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
|
|
1638
1650
|
}`;
|
|
1639
1651
|
var queuePlugin = definePlugin({
|
|
@@ -1767,6 +1779,7 @@ var queuePlugin = definePlugin({
|
|
|
1767
1779
|
stack.add(queue2, lambda, source);
|
|
1768
1780
|
bind((lambda2) => {
|
|
1769
1781
|
lambda2.addPermissions(queue2.permissions);
|
|
1782
|
+
lambda2.addEnvironment(`QUEUE_${(0, import_change_case6.constantCase)(stack.name)}_${(0, import_change_case6.constantCase)(id)}_URL`, queue2.url);
|
|
1770
1783
|
});
|
|
1771
1784
|
}
|
|
1772
1785
|
}
|
|
@@ -1776,7 +1789,7 @@ var queuePlugin = definePlugin({
|
|
|
1776
1789
|
var import_zod9 = require("zod");
|
|
1777
1790
|
|
|
1778
1791
|
// src/formation/resource/dynamodb/table.ts
|
|
1779
|
-
var
|
|
1792
|
+
var import_change_case7 = require("change-case");
|
|
1780
1793
|
var Table = class extends Resource {
|
|
1781
1794
|
constructor(logicalId, props) {
|
|
1782
1795
|
super("AWS::DynamoDB::Table", logicalId);
|
|
@@ -1849,7 +1862,7 @@ var Table = class extends Resource {
|
|
|
1849
1862
|
return {
|
|
1850
1863
|
TableName: this.name,
|
|
1851
1864
|
BillingMode: "PAY_PER_REQUEST",
|
|
1852
|
-
TableClass: (0,
|
|
1865
|
+
TableClass: (0, import_change_case7.constantCase)(this.props.class || "standard"),
|
|
1853
1866
|
PointInTimeRecoverySpecification: {
|
|
1854
1867
|
PointInTimeRecoveryEnabled: this.props.pointInTimeRecovery || false
|
|
1855
1868
|
},
|
|
@@ -1860,7 +1873,7 @@ var Table = class extends Resource {
|
|
|
1860
1873
|
AttributeDefinitions: this.attributeDefinitions(),
|
|
1861
1874
|
...this.props.stream ? {
|
|
1862
1875
|
StreamSpecification: {
|
|
1863
|
-
StreamViewType: (0,
|
|
1876
|
+
StreamViewType: (0, import_change_case7.constantCase)(this.props.stream)
|
|
1864
1877
|
}
|
|
1865
1878
|
} : {},
|
|
1866
1879
|
...this.props.timeToLiveAttribute ? {
|
|
@@ -1877,7 +1890,7 @@ var Table = class extends Resource {
|
|
|
1877
1890
|
...props.sort ? [{ KeyType: "RANGE", AttributeName: props.sort }] : []
|
|
1878
1891
|
],
|
|
1879
1892
|
Projection: {
|
|
1880
|
-
ProjectionType: (0,
|
|
1893
|
+
ProjectionType: (0, import_change_case7.constantCase)(props.projection || "all")
|
|
1881
1894
|
}
|
|
1882
1895
|
}))
|
|
1883
1896
|
} : {}
|
|
@@ -2062,7 +2075,7 @@ var tablePlugin = definePlugin({
|
|
|
2062
2075
|
var import_zod10 = require("zod");
|
|
2063
2076
|
|
|
2064
2077
|
// src/formation/resource/s3/bucket.ts
|
|
2065
|
-
var
|
|
2078
|
+
var import_change_case8 = require("change-case");
|
|
2066
2079
|
var Bucket = class extends Resource {
|
|
2067
2080
|
constructor(logicalId, props = {}) {
|
|
2068
2081
|
super("AWS::S3::Bucket", logicalId);
|
|
@@ -2097,7 +2110,7 @@ var Bucket = class extends Resource {
|
|
|
2097
2110
|
properties() {
|
|
2098
2111
|
return {
|
|
2099
2112
|
BucketName: this.name,
|
|
2100
|
-
AccessControl: (0,
|
|
2113
|
+
AccessControl: (0, import_change_case8.pascalCase)(this.props.accessControl ?? "private"),
|
|
2101
2114
|
...this.props.versioned ? {
|
|
2102
2115
|
VersioningConfiguration: {
|
|
2103
2116
|
Status: "Enabled"
|
|
@@ -2308,12 +2321,12 @@ var extendPlugin = definePlugin({
|
|
|
2308
2321
|
var import_zod13 = require("zod");
|
|
2309
2322
|
|
|
2310
2323
|
// src/formation/resource/iot/topic-rule.ts
|
|
2311
|
-
var
|
|
2324
|
+
var import_change_case9 = require("change-case");
|
|
2312
2325
|
var TopicRule = class extends Resource {
|
|
2313
2326
|
constructor(logicalId, props) {
|
|
2314
2327
|
super("AWS::IoT::TopicRule", logicalId);
|
|
2315
2328
|
this.props = props;
|
|
2316
|
-
this.name = (0,
|
|
2329
|
+
this.name = (0, import_change_case9.snakeCase)(this.props.name || logicalId);
|
|
2317
2330
|
}
|
|
2318
2331
|
name;
|
|
2319
2332
|
get arn() {
|
|
@@ -2413,10 +2426,10 @@ var toArray = (value) => {
|
|
|
2413
2426
|
};
|
|
2414
2427
|
|
|
2415
2428
|
// src/plugins/graphql.ts
|
|
2416
|
-
var
|
|
2429
|
+
var import_change_case13 = require("change-case");
|
|
2417
2430
|
|
|
2418
2431
|
// src/formation/resource/appsync/graphql-api.ts
|
|
2419
|
-
var
|
|
2432
|
+
var import_change_case10 = require("change-case");
|
|
2420
2433
|
var GraphQLApi = class extends Resource {
|
|
2421
2434
|
constructor(logicalId, props) {
|
|
2422
2435
|
super("AWS::AppSync::GraphQLApi", logicalId);
|
|
@@ -2448,7 +2461,7 @@ var GraphQLApi = class extends Resource {
|
|
|
2448
2461
|
properties() {
|
|
2449
2462
|
return {
|
|
2450
2463
|
Name: this.name,
|
|
2451
|
-
AuthenticationType: (0,
|
|
2464
|
+
AuthenticationType: (0, import_change_case10.constantCase)(this.props.authenticationType || "api-key"),
|
|
2452
2465
|
AdditionalAuthenticationProviders: this.lambdaAuthProviders.map((provider) => ({
|
|
2453
2466
|
AuthenticationType: "AWS_LAMBDA",
|
|
2454
2467
|
LambdaAuthorizerConfig: {
|
|
@@ -2575,12 +2588,12 @@ var FileCode2 = class extends Asset {
|
|
|
2575
2588
|
};
|
|
2576
2589
|
|
|
2577
2590
|
// src/formation/resource/appsync/data-source.ts
|
|
2578
|
-
var
|
|
2591
|
+
var import_change_case11 = require("change-case");
|
|
2579
2592
|
var DataSource = class extends Resource {
|
|
2580
2593
|
constructor(logicalId, props) {
|
|
2581
2594
|
super("AWS::AppSync::DataSource", logicalId);
|
|
2582
2595
|
this.props = props;
|
|
2583
|
-
this.name = (0,
|
|
2596
|
+
this.name = (0, import_change_case11.snakeCase)(this.props.name || logicalId);
|
|
2584
2597
|
}
|
|
2585
2598
|
static fromLambda(logicalId, apiId, props) {
|
|
2586
2599
|
return new DataSource(logicalId, {
|
|
@@ -2620,14 +2633,14 @@ var DataSource = class extends Resource {
|
|
|
2620
2633
|
};
|
|
2621
2634
|
|
|
2622
2635
|
// src/formation/resource/appsync/function-configuration.ts
|
|
2623
|
-
var
|
|
2636
|
+
var import_change_case12 = require("change-case");
|
|
2624
2637
|
var FunctionConfiguration = class extends Resource {
|
|
2625
2638
|
constructor(logicalId, props) {
|
|
2626
2639
|
super("AWS::AppSync::FunctionConfiguration", logicalId, [
|
|
2627
2640
|
props.code
|
|
2628
2641
|
]);
|
|
2629
2642
|
this.props = props;
|
|
2630
|
-
this.name = (0,
|
|
2643
|
+
this.name = (0, import_change_case12.snakeCase)(this.props.name || logicalId);
|
|
2631
2644
|
}
|
|
2632
2645
|
name;
|
|
2633
2646
|
get id() {
|
|
@@ -2846,7 +2859,7 @@ var graphqlPlugin = definePlugin({
|
|
|
2846
2859
|
const apiId = bootstrap2.import(`graphql-${id}`);
|
|
2847
2860
|
for (const [typeAndField, functionProps] of Object.entries(props.resolvers || {})) {
|
|
2848
2861
|
const [typeName, fieldName] = typeAndField.split(/[\s]+/g);
|
|
2849
|
-
const entryId = (0,
|
|
2862
|
+
const entryId = (0, import_change_case13.paramCase)(`${id}-${typeName}-${fieldName}`);
|
|
2850
2863
|
const lambda = toLambdaFunction(ctx, `graphql-${entryId}`, functionProps);
|
|
2851
2864
|
const source = new AppsyncEventSource(entryId, lambda, {
|
|
2852
2865
|
apiId,
|
|
@@ -3530,7 +3543,7 @@ var LoadBalancer = class extends Resource {
|
|
|
3530
3543
|
};
|
|
3531
3544
|
|
|
3532
3545
|
// src/formation/resource/elb/listener.ts
|
|
3533
|
-
var
|
|
3546
|
+
var import_change_case14 = require("change-case");
|
|
3534
3547
|
var Listener = class extends Resource {
|
|
3535
3548
|
constructor(logicalId, props) {
|
|
3536
3549
|
super("AWS::ElasticLoadBalancingV2::Listener", logicalId);
|
|
@@ -3546,7 +3559,7 @@ var Listener = class extends Resource {
|
|
|
3546
3559
|
return {
|
|
3547
3560
|
LoadBalancerArn: this.props.loadBalancerArn,
|
|
3548
3561
|
Port: this.props.port,
|
|
3549
|
-
Protocol: (0,
|
|
3562
|
+
Protocol: (0, import_change_case14.constantCase)(this.props.protocol),
|
|
3550
3563
|
Certificates: this.props.certificates.map((arn) => ({
|
|
3551
3564
|
CertificateArn: arn
|
|
3552
3565
|
})),
|
|
@@ -3985,6 +3998,7 @@ var SubnetGroup = class extends Resource {
|
|
|
3985
3998
|
};
|
|
3986
3999
|
|
|
3987
4000
|
// src/plugins/cache.ts
|
|
4001
|
+
var import_change_case15 = require("change-case");
|
|
3988
4002
|
var TypeSchema = import_zod19.z.enum([
|
|
3989
4003
|
"t4g.small",
|
|
3990
4004
|
"t4g.medium",
|
|
@@ -4037,7 +4051,7 @@ var cachePlugin = definePlugin({
|
|
|
4037
4051
|
for (const stack of config.stacks) {
|
|
4038
4052
|
const list3 = new TypeObject();
|
|
4039
4053
|
for (const name of Object.keys(stack.caches || {})) {
|
|
4040
|
-
list3.addType(name, `{ host: string, port:number }`);
|
|
4054
|
+
list3.addType(name, `{ host: string, port: number }`);
|
|
4041
4055
|
}
|
|
4042
4056
|
gen.addType(stack.name, list3.toString());
|
|
4043
4057
|
}
|
|
@@ -4070,7 +4084,7 @@ var cachePlugin = definePlugin({
|
|
|
4070
4084
|
}).dependsOn(subnetGroup, securityGroup);
|
|
4071
4085
|
stack.add(subnetGroup, securityGroup, cluster);
|
|
4072
4086
|
bind((lambda) => {
|
|
4073
|
-
lambda.addEnvironment(`CACHE_${stack.name}_${id}_HOST`, cluster.address).addEnvironment(`CACHE_${stack.name}_${id}_PORT`, props.port.toString());
|
|
4087
|
+
lambda.addEnvironment(`CACHE_${(0, import_change_case15.constantCase)(stack.name)}_${(0, import_change_case15.constantCase)(id)}_HOST`, cluster.address).addEnvironment(`CACHE_${(0, import_change_case15.constantCase)(stack.name)}_${(0, import_change_case15.constantCase)(id)}_PORT`, props.port.toString());
|
|
4074
4088
|
});
|
|
4075
4089
|
}
|
|
4076
4090
|
}
|
|
@@ -5246,7 +5260,7 @@ var shouldDeployBootstrap = async (client, stack) => {
|
|
|
5246
5260
|
// src/formation/client.ts
|
|
5247
5261
|
var import_client_cloudformation = require("@aws-sdk/client-cloudformation");
|
|
5248
5262
|
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
5249
|
-
var
|
|
5263
|
+
var import_change_case16 = require("change-case");
|
|
5250
5264
|
var StackClient = class {
|
|
5251
5265
|
constructor(app, account, region, credentials) {
|
|
5252
5266
|
this.app = app;
|
|
@@ -5279,7 +5293,7 @@ var StackClient = class {
|
|
|
5279
5293
|
};
|
|
5280
5294
|
}
|
|
5281
5295
|
stackName(stackName) {
|
|
5282
|
-
return (0,
|
|
5296
|
+
return (0, import_change_case16.paramCase)(`${this.app.name}-${stackName}`);
|
|
5283
5297
|
}
|
|
5284
5298
|
tags(stack) {
|
|
5285
5299
|
const tags = [];
|
package/dist/bin.js
CHANGED
|
@@ -1100,17 +1100,26 @@ var TypeGen = class {
|
|
|
1100
1100
|
if (this.types.size === 0) {
|
|
1101
1101
|
return;
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
|
|
1103
|
+
const lines = [];
|
|
1104
|
+
if (this.imports.size > 0) {
|
|
1105
|
+
lines.push(...[
|
|
1106
|
+
"// Imports",
|
|
1107
|
+
...Array.from(this.imports.entries()).map(([varName, path]) => {
|
|
1108
|
+
return `import ${camelCase(varName)} from '${path}'`;
|
|
1109
|
+
}),
|
|
1110
|
+
""
|
|
1111
|
+
]);
|
|
1112
|
+
}
|
|
1113
|
+
if (this.codes.size > 0) {
|
|
1114
|
+
lines.push(...[
|
|
1115
|
+
"// Types",
|
|
1116
|
+
...Array.from(this.codes).map((v) => v.trim()),
|
|
1117
|
+
""
|
|
1118
|
+
]);
|
|
1119
|
+
}
|
|
1106
1120
|
return [
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
"",
|
|
1110
|
-
"// Types",
|
|
1111
|
-
...Array.from(this.codes).map((v) => v.trim()),
|
|
1112
|
-
"",
|
|
1113
|
-
"// Module",
|
|
1121
|
+
...lines,
|
|
1122
|
+
"// Extend module",
|
|
1114
1123
|
`declare module '${this.module}' {`,
|
|
1115
1124
|
` interface ${this.interfaceName} {`,
|
|
1116
1125
|
...Array.from(this.types.entries()).map(([propName, type]) => {
|
|
@@ -1119,7 +1128,7 @@ var TypeGen = class {
|
|
|
1119
1128
|
` }`,
|
|
1120
1129
|
`}`,
|
|
1121
1130
|
"",
|
|
1122
|
-
"//
|
|
1131
|
+
"// Export fix",
|
|
1123
1132
|
`export {}`
|
|
1124
1133
|
].join("\n");
|
|
1125
1134
|
}
|
|
@@ -1285,6 +1294,7 @@ import { InvokeOptions } from '@awsless/lambda'
|
|
|
1285
1294
|
type Invoke<Name extends string, Func extends (...args: any[]) => any> = {
|
|
1286
1295
|
name: Name
|
|
1287
1296
|
(payload: Parameters<Func>[0], options?: Omit<InvokeOptions, 'name' | 'payload'>): ReturnType<Func>
|
|
1297
|
+
async: (payload: Parameters<Func>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => ReturnType<Func>
|
|
1288
1298
|
}`;
|
|
1289
1299
|
var functionPlugin = definePlugin({
|
|
1290
1300
|
name: "function",
|
|
@@ -1598,6 +1608,7 @@ var SqsEventSource = class extends Group {
|
|
|
1598
1608
|
};
|
|
1599
1609
|
|
|
1600
1610
|
// src/plugins/queue.ts
|
|
1611
|
+
import { constantCase as constantCase2 } from "change-case";
|
|
1601
1612
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1602
1613
|
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1603
1614
|
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
@@ -1607,10 +1618,11 @@ var BatchSizeSchema = z8.number().int().min(1, "Minimum batch size is 1").max(1e
|
|
|
1607
1618
|
var MaxConcurrencySchema = z8.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000");
|
|
1608
1619
|
var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)), "Maximum max batching window is 5 minutes");
|
|
1609
1620
|
var typeGenCode2 = `
|
|
1610
|
-
import { SendMessageOptions } from '@awsless/sqs'
|
|
1621
|
+
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
1611
1622
|
|
|
1612
1623
|
type Send<Name extends string> = {
|
|
1613
1624
|
name: Name
|
|
1625
|
+
batch(items:BatchItem[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1614
1626
|
(payload: unknown, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
|
|
1615
1627
|
}`;
|
|
1616
1628
|
var queuePlugin = definePlugin({
|
|
@@ -1744,6 +1756,7 @@ var queuePlugin = definePlugin({
|
|
|
1744
1756
|
stack.add(queue2, lambda, source);
|
|
1745
1757
|
bind((lambda2) => {
|
|
1746
1758
|
lambda2.addPermissions(queue2.permissions);
|
|
1759
|
+
lambda2.addEnvironment(`QUEUE_${constantCase2(stack.name)}_${constantCase2(id)}_URL`, queue2.url);
|
|
1747
1760
|
});
|
|
1748
1761
|
}
|
|
1749
1762
|
}
|
|
@@ -1753,7 +1766,7 @@ var queuePlugin = definePlugin({
|
|
|
1753
1766
|
import { z as z9 } from "zod";
|
|
1754
1767
|
|
|
1755
1768
|
// src/formation/resource/dynamodb/table.ts
|
|
1756
|
-
import { constantCase as
|
|
1769
|
+
import { constantCase as constantCase3 } from "change-case";
|
|
1757
1770
|
var Table = class extends Resource {
|
|
1758
1771
|
constructor(logicalId, props) {
|
|
1759
1772
|
super("AWS::DynamoDB::Table", logicalId);
|
|
@@ -1826,7 +1839,7 @@ var Table = class extends Resource {
|
|
|
1826
1839
|
return {
|
|
1827
1840
|
TableName: this.name,
|
|
1828
1841
|
BillingMode: "PAY_PER_REQUEST",
|
|
1829
|
-
TableClass:
|
|
1842
|
+
TableClass: constantCase3(this.props.class || "standard"),
|
|
1830
1843
|
PointInTimeRecoverySpecification: {
|
|
1831
1844
|
PointInTimeRecoveryEnabled: this.props.pointInTimeRecovery || false
|
|
1832
1845
|
},
|
|
@@ -1837,7 +1850,7 @@ var Table = class extends Resource {
|
|
|
1837
1850
|
AttributeDefinitions: this.attributeDefinitions(),
|
|
1838
1851
|
...this.props.stream ? {
|
|
1839
1852
|
StreamSpecification: {
|
|
1840
|
-
StreamViewType:
|
|
1853
|
+
StreamViewType: constantCase3(this.props.stream)
|
|
1841
1854
|
}
|
|
1842
1855
|
} : {},
|
|
1843
1856
|
...this.props.timeToLiveAttribute ? {
|
|
@@ -1854,7 +1867,7 @@ var Table = class extends Resource {
|
|
|
1854
1867
|
...props.sort ? [{ KeyType: "RANGE", AttributeName: props.sort }] : []
|
|
1855
1868
|
],
|
|
1856
1869
|
Projection: {
|
|
1857
|
-
ProjectionType:
|
|
1870
|
+
ProjectionType: constantCase3(props.projection || "all")
|
|
1858
1871
|
}
|
|
1859
1872
|
}))
|
|
1860
1873
|
} : {}
|
|
@@ -2393,7 +2406,7 @@ var toArray = (value) => {
|
|
|
2393
2406
|
import { paramCase as paramCase3 } from "change-case";
|
|
2394
2407
|
|
|
2395
2408
|
// src/formation/resource/appsync/graphql-api.ts
|
|
2396
|
-
import { constantCase as
|
|
2409
|
+
import { constantCase as constantCase4 } from "change-case";
|
|
2397
2410
|
var GraphQLApi = class extends Resource {
|
|
2398
2411
|
constructor(logicalId, props) {
|
|
2399
2412
|
super("AWS::AppSync::GraphQLApi", logicalId);
|
|
@@ -2425,7 +2438,7 @@ var GraphQLApi = class extends Resource {
|
|
|
2425
2438
|
properties() {
|
|
2426
2439
|
return {
|
|
2427
2440
|
Name: this.name,
|
|
2428
|
-
AuthenticationType:
|
|
2441
|
+
AuthenticationType: constantCase4(this.props.authenticationType || "api-key"),
|
|
2429
2442
|
AdditionalAuthenticationProviders: this.lambdaAuthProviders.map((provider) => ({
|
|
2430
2443
|
AuthenticationType: "AWS_LAMBDA",
|
|
2431
2444
|
LambdaAuthorizerConfig: {
|
|
@@ -3507,7 +3520,7 @@ var LoadBalancer = class extends Resource {
|
|
|
3507
3520
|
};
|
|
3508
3521
|
|
|
3509
3522
|
// src/formation/resource/elb/listener.ts
|
|
3510
|
-
import { constantCase as
|
|
3523
|
+
import { constantCase as constantCase5 } from "change-case";
|
|
3511
3524
|
var Listener = class extends Resource {
|
|
3512
3525
|
constructor(logicalId, props) {
|
|
3513
3526
|
super("AWS::ElasticLoadBalancingV2::Listener", logicalId);
|
|
@@ -3523,7 +3536,7 @@ var Listener = class extends Resource {
|
|
|
3523
3536
|
return {
|
|
3524
3537
|
LoadBalancerArn: this.props.loadBalancerArn,
|
|
3525
3538
|
Port: this.props.port,
|
|
3526
|
-
Protocol:
|
|
3539
|
+
Protocol: constantCase5(this.props.protocol),
|
|
3527
3540
|
Certificates: this.props.certificates.map((arn) => ({
|
|
3528
3541
|
CertificateArn: arn
|
|
3529
3542
|
})),
|
|
@@ -3962,6 +3975,7 @@ var SubnetGroup = class extends Resource {
|
|
|
3962
3975
|
};
|
|
3963
3976
|
|
|
3964
3977
|
// src/plugins/cache.ts
|
|
3978
|
+
import { constantCase as constantCase6 } from "change-case";
|
|
3965
3979
|
var TypeSchema = z19.enum([
|
|
3966
3980
|
"t4g.small",
|
|
3967
3981
|
"t4g.medium",
|
|
@@ -4014,7 +4028,7 @@ var cachePlugin = definePlugin({
|
|
|
4014
4028
|
for (const stack of config.stacks) {
|
|
4015
4029
|
const list3 = new TypeObject();
|
|
4016
4030
|
for (const name of Object.keys(stack.caches || {})) {
|
|
4017
|
-
list3.addType(name, `{ host: string, port:number }`);
|
|
4031
|
+
list3.addType(name, `{ host: string, port: number }`);
|
|
4018
4032
|
}
|
|
4019
4033
|
gen.addType(stack.name, list3.toString());
|
|
4020
4034
|
}
|
|
@@ -4047,7 +4061,7 @@ var cachePlugin = definePlugin({
|
|
|
4047
4061
|
}).dependsOn(subnetGroup, securityGroup);
|
|
4048
4062
|
stack.add(subnetGroup, securityGroup, cluster);
|
|
4049
4063
|
bind((lambda) => {
|
|
4050
|
-
lambda.addEnvironment(`CACHE_${stack.name}_${id}_HOST`, cluster.address).addEnvironment(`CACHE_${stack.name}_${id}_PORT`, props.port.toString());
|
|
4064
|
+
lambda.addEnvironment(`CACHE_${constantCase6(stack.name)}_${constantCase6(id)}_HOST`, cluster.address).addEnvironment(`CACHE_${constantCase6(stack.name)}_${constantCase6(id)}_PORT`, props.port.toString());
|
|
4051
4065
|
});
|
|
4052
4066
|
}
|
|
4053
4067
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,14 @@ var Function = createProxy((stackName) => {
|
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
call.name = name;
|
|
96
|
+
call.async = (payload, options = {}) => {
|
|
97
|
+
return (0, import_lambda.invoke)({
|
|
98
|
+
...options,
|
|
99
|
+
type: "Event",
|
|
100
|
+
name,
|
|
101
|
+
payload
|
|
102
|
+
});
|
|
103
|
+
};
|
|
96
104
|
return call;
|
|
97
105
|
});
|
|
98
106
|
});
|
|
@@ -125,25 +133,38 @@ var Topic = createProxy((topic) => {
|
|
|
125
133
|
|
|
126
134
|
// src/node/queue.ts
|
|
127
135
|
var import_sqs = require("@awsless/sqs");
|
|
136
|
+
var import_change_case2 = require("change-case");
|
|
128
137
|
var getQueueName = getLocalResourceName;
|
|
138
|
+
var getQueueUrl = (name, stack = STACK) => {
|
|
139
|
+
return process.env[`QUEUE_${(0, import_change_case2.constantCase)(stack)}_${(0, import_change_case2.constantCase)(name)}_URL`];
|
|
140
|
+
};
|
|
129
141
|
var Queue = createProxy((stack) => {
|
|
130
142
|
return createProxy((queue) => {
|
|
131
|
-
const
|
|
132
|
-
const send = (payload, options) => {
|
|
143
|
+
const url = getQueueUrl(queue, stack);
|
|
144
|
+
const send = (payload, options = {}) => {
|
|
133
145
|
return (0, import_sqs.sendMessage)({
|
|
134
146
|
...options,
|
|
135
|
-
queue:
|
|
147
|
+
queue: url,
|
|
136
148
|
payload
|
|
137
149
|
});
|
|
138
150
|
};
|
|
139
|
-
send.
|
|
151
|
+
send.url = url;
|
|
152
|
+
send.name = getQueueName(queue, stack);
|
|
153
|
+
send.batch = (items, options = {}) => {
|
|
154
|
+
return (0, import_sqs.sendMessageBatch)({
|
|
155
|
+
...options,
|
|
156
|
+
queue: url,
|
|
157
|
+
items
|
|
158
|
+
});
|
|
159
|
+
};
|
|
140
160
|
return send;
|
|
141
161
|
});
|
|
142
162
|
});
|
|
143
163
|
|
|
144
164
|
// src/node/cache.ts
|
|
165
|
+
var import_change_case3 = require("change-case");
|
|
145
166
|
var getCacheProps = (name, stack = STACK) => {
|
|
146
|
-
const prefix = `CACHE_${stack}_${name}`;
|
|
167
|
+
const prefix = `CACHE_${(0, import_change_case3.constantCase)(stack)}_${(0, import_change_case3.constantCase)(name)}`;
|
|
147
168
|
return {
|
|
148
169
|
host: process.env[`${prefix}_HOST`],
|
|
149
170
|
port: parseInt(process.env[`${prefix}_PORT`], 10)
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,14 @@ var Function = createProxy((stackName) => {
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
call.name = name;
|
|
50
|
+
call.async = (payload, options = {}) => {
|
|
51
|
+
return invoke({
|
|
52
|
+
...options,
|
|
53
|
+
type: "Event",
|
|
54
|
+
name,
|
|
55
|
+
payload
|
|
56
|
+
});
|
|
57
|
+
};
|
|
50
58
|
return call;
|
|
51
59
|
});
|
|
52
60
|
});
|
|
@@ -78,26 +86,39 @@ var Topic = createProxy((topic) => {
|
|
|
78
86
|
});
|
|
79
87
|
|
|
80
88
|
// src/node/queue.ts
|
|
81
|
-
import { sendMessage } from "@awsless/sqs";
|
|
89
|
+
import { sendMessage, sendMessageBatch } from "@awsless/sqs";
|
|
90
|
+
import { constantCase } from "change-case";
|
|
82
91
|
var getQueueName = getLocalResourceName;
|
|
92
|
+
var getQueueUrl = (name, stack = STACK) => {
|
|
93
|
+
return process.env[`QUEUE_${constantCase(stack)}_${constantCase(name)}_URL`];
|
|
94
|
+
};
|
|
83
95
|
var Queue = createProxy((stack) => {
|
|
84
96
|
return createProxy((queue) => {
|
|
85
|
-
const
|
|
86
|
-
const send = (payload, options) => {
|
|
97
|
+
const url = getQueueUrl(queue, stack);
|
|
98
|
+
const send = (payload, options = {}) => {
|
|
87
99
|
return sendMessage({
|
|
88
100
|
...options,
|
|
89
|
-
queue:
|
|
101
|
+
queue: url,
|
|
90
102
|
payload
|
|
91
103
|
});
|
|
92
104
|
};
|
|
93
|
-
send.
|
|
105
|
+
send.url = url;
|
|
106
|
+
send.name = getQueueName(queue, stack);
|
|
107
|
+
send.batch = (items, options = {}) => {
|
|
108
|
+
return sendMessageBatch({
|
|
109
|
+
...options,
|
|
110
|
+
queue: url,
|
|
111
|
+
items
|
|
112
|
+
});
|
|
113
|
+
};
|
|
94
114
|
return send;
|
|
95
115
|
});
|
|
96
116
|
});
|
|
97
117
|
|
|
98
118
|
// src/node/cache.ts
|
|
119
|
+
import { constantCase as constantCase2 } from "change-case";
|
|
99
120
|
var getCacheProps = (name, stack = STACK) => {
|
|
100
|
-
const prefix = `CACHE_${stack}_${name}`;
|
|
121
|
+
const prefix = `CACHE_${constantCase2(stack)}_${constantCase2(name)}`;
|
|
101
122
|
return {
|
|
102
123
|
host: process.env[`${prefix}_HOST`],
|
|
103
124
|
port: parseInt(process.env[`${prefix}_PORT`], 10)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@awsless/lambda": "^0.0.5",
|
|
29
|
-
"@awsless/
|
|
30
|
-
"@awsless/
|
|
29
|
+
"@awsless/sqs": "^0.0.5",
|
|
30
|
+
"@awsless/sns": "^0.0.5"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|