@awsless/awsless 0.0.154 → 0.0.155

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 CHANGED
@@ -138,19 +138,25 @@ var formatName = (name) => {
138
138
  return paramCase2(name);
139
139
  };
140
140
  var formatArn = (props) => {
141
+ const regionPart = props.includeRegion === false ? "" : "${AWS::Region}";
142
+ const globalPart = "arn:${AWS::Partition}:${service}:" + regionPart + ":${AWS::AccountId}";
141
143
  if (!props.resource) {
142
- return sub("arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}", props);
144
+ return sub(globalPart, {
145
+ service: props.service
146
+ });
143
147
  }
144
148
  if (!props.resourceName) {
145
- return sub("arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}:${resource}", props);
149
+ return sub(globalPart + ":${resource}", {
150
+ service: props.service,
151
+ resource: props.resource
152
+ });
146
153
  }
147
- return sub(
148
- "arn:${AWS::Partition}:${service}:${AWS::Region}:${AWS::AccountId}:${resource}${seperator}${resourceName}",
149
- {
150
- seperator: "/",
151
- ...props
152
- }
153
- );
154
+ return sub(globalPart + ":${resource}${seperator}${resourceName}", {
155
+ service: props.service,
156
+ resource: props.resource,
157
+ seperator: props.seperator ?? "/",
158
+ resourceName: props.resourceName
159
+ });
154
160
  };
155
161
 
156
162
  // src/formation/resource.ts
@@ -243,7 +249,7 @@ var LogGroup = class extends Resource {
243
249
  this.props = props;
244
250
  }
245
251
  get arn() {
246
- return getAtt(this.logicalId, "Arn");
252
+ return this.getAtt("Arn");
247
253
  }
248
254
  properties() {
249
255
  return {
@@ -292,7 +298,7 @@ var Role = class extends Resource {
292
298
  inlinePolicies = /* @__PURE__ */ new Set();
293
299
  managedPolicies = /* @__PURE__ */ new Set();
294
300
  get arn() {
295
- return getAtt(this.logicalId, "Arn");
301
+ return this.getAtt("Arn");
296
302
  }
297
303
  addManagedPolicy(...policies) {
298
304
  for (const policy of policies) {
@@ -337,10 +343,10 @@ var Rule = class extends Resource {
337
343
  }
338
344
  name;
339
345
  get id() {
340
- return ref(this.logicalId);
346
+ return this.ref();
341
347
  }
342
348
  get arn() {
343
- return getAtt(this.logicalId, "Arn");
349
+ return this.getAtt("Arn");
344
350
  }
345
351
  properties() {
346
352
  return {
@@ -410,7 +416,7 @@ var Url = class extends Resource {
410
416
  this.props = props;
411
417
  }
412
418
  get url() {
413
- return getAtt(this.logicalId, "FunctionUrl");
419
+ return this.getAtt("FunctionUrl");
414
420
  }
415
421
  properties() {
416
422
  return {
@@ -982,7 +988,7 @@ var rollupBundle = ({
982
988
  },
983
989
  plugins: [
984
990
  // @ts-ignore
985
- commonjs({ sourceMap: true }),
991
+ commonjs({ sourceMap: true, ignoreDynamicRequires: true }),
986
992
  // @ts-ignore
987
993
  nodeResolve({ preferBuiltins: true }),
988
994
  swc({
@@ -1479,7 +1485,7 @@ var UserPoolClient = class extends Resource {
1479
1485
  }
1480
1486
  name;
1481
1487
  get id() {
1482
- return ref(this.logicalId);
1488
+ return this.ref();
1483
1489
  }
1484
1490
  formatAuthFlows() {
1485
1491
  const authFlows = [];
@@ -1559,10 +1565,10 @@ var UserPoolDomain = class extends Resource {
1559
1565
  this.props = props;
1560
1566
  }
1561
1567
  get domain() {
1562
- return ref(this.logicalId);
1568
+ return this.ref();
1563
1569
  }
1564
1570
  get cloudFrontDistribution() {
1565
- return getAtt(this.logicalId, "CloudFrontDistribution");
1571
+ return this.getAtt("CloudFrontDistribution");
1566
1572
  }
1567
1573
  properties() {
1568
1574
  return {
@@ -1581,16 +1587,16 @@ var UserPool = class extends Resource {
1581
1587
  }
1582
1588
  name;
1583
1589
  get id() {
1584
- return ref(this.logicalId);
1590
+ return this.ref();
1585
1591
  }
1586
1592
  get arn() {
1587
- return getAtt(this.logicalId, "Arn");
1593
+ return this.getAtt("Arn");
1588
1594
  }
1589
1595
  get providerName() {
1590
- return getAtt(this.logicalId, "ProviderName");
1596
+ return this.getAtt("ProviderName");
1591
1597
  }
1592
1598
  get providerUrl() {
1593
- return getAtt(this.logicalId, "ProviderURL");
1599
+ return this.getAtt("ProviderURL");
1594
1600
  }
1595
1601
  addDomain(props) {
1596
1602
  const domain = new UserPoolDomain(this.logicalId, {
@@ -1725,7 +1731,7 @@ var CustomResource = class extends Resource {
1725
1731
  this.props = props;
1726
1732
  }
1727
1733
  getAtt(name) {
1728
- return getAtt(this.logicalId, name);
1734
+ return super.getAtt(name);
1729
1735
  }
1730
1736
  properties() {
1731
1737
  return {
@@ -1938,7 +1944,7 @@ var SecurityGroup = class extends Resource {
1938
1944
  ingress = [];
1939
1945
  egress = [];
1940
1946
  get id() {
1941
- return ref(this.logicalId);
1947
+ return this.ref();
1942
1948
  }
1943
1949
  addIngressRule(peer, port, description) {
1944
1950
  this.ingress.push({
@@ -1984,7 +1990,7 @@ var SubnetGroup = class extends Resource {
1984
1990
  }
1985
1991
  name;
1986
1992
  get arn() {
1987
- return getAtt(this.logicalId, "Arn");
1993
+ return this.getAtt("Arn");
1988
1994
  }
1989
1995
  properties() {
1990
1996
  return {
@@ -2306,7 +2312,7 @@ var HostedZone = class extends Resource {
2306
2312
  this.props = props;
2307
2313
  }
2308
2314
  get id() {
2309
- return ref(this.logicalId);
2315
+ return this.ref();
2310
2316
  }
2311
2317
  properties() {
2312
2318
  return {
@@ -2322,7 +2328,7 @@ var Certificate = class extends Resource {
2322
2328
  this.props = props;
2323
2329
  }
2324
2330
  get arn() {
2325
- return ref(this.logicalId);
2331
+ return this.ref();
2326
2332
  }
2327
2333
  properties() {
2328
2334
  return {
@@ -2658,16 +2664,16 @@ var GraphQLApi = class extends Resource {
2658
2664
  name;
2659
2665
  defaultAuthorization;
2660
2666
  get arn() {
2661
- return ref(this.logicalId);
2667
+ return this.ref();
2662
2668
  }
2663
2669
  get id() {
2664
- return getAtt(this.logicalId, "ApiId");
2670
+ return this.getAtt("ApiId");
2665
2671
  }
2666
2672
  get url() {
2667
- return getAtt(this.logicalId, "GraphQLUrl");
2673
+ return this.getAtt("GraphQLUrl");
2668
2674
  }
2669
2675
  get dns() {
2670
- return getAtt(this.logicalId, "GraphQLDns");
2676
+ return this.getAtt("GraphQLDns");
2671
2677
  }
2672
2678
  setDefaultAuthorization(auth) {
2673
2679
  this.defaultAuthorization = auth;
@@ -2946,7 +2952,7 @@ var DataSource = class _DataSource extends Resource {
2946
2952
  }
2947
2953
  name;
2948
2954
  get arn() {
2949
- return ref(this.logicalId);
2955
+ return this.ref();
2950
2956
  }
2951
2957
  properties() {
2952
2958
  return {
@@ -2973,10 +2979,10 @@ var FunctionConfiguration = class extends Resource {
2973
2979
  }
2974
2980
  name;
2975
2981
  get id() {
2976
- return getAtt(this.logicalId, "FunctionId");
2982
+ return this.getAtt("FunctionId");
2977
2983
  }
2978
2984
  get arn() {
2979
- return ref(this.logicalId);
2985
+ return this.ref();
2980
2986
  }
2981
2987
  properties() {
2982
2988
  return {
@@ -3057,13 +3063,13 @@ var DomainName = class extends Resource {
3057
3063
  this.props = props;
3058
3064
  }
3059
3065
  get appSyncDomainName() {
3060
- return getAtt(this.logicalId, "AppSyncDomainName");
3066
+ return this.getAtt("AppSyncDomainName");
3061
3067
  }
3062
3068
  get domainName() {
3063
- return getAtt(this.logicalId, "DomainName");
3069
+ return this.getAtt("DomainName");
3064
3070
  }
3065
3071
  get hostedZoneId() {
3066
- return getAtt(this.logicalId, "HostedZoneId");
3072
+ return this.getAtt("HostedZoneId");
3067
3073
  }
3068
3074
  properties() {
3069
3075
  return {
@@ -3293,13 +3299,13 @@ var LoadBalancer = class extends Resource {
3293
3299
  }
3294
3300
  name;
3295
3301
  get arn() {
3296
- return ref(this.logicalId);
3302
+ return this.ref();
3297
3303
  }
3298
3304
  get dnsName() {
3299
- return getAtt(this.logicalId, "DNSName");
3305
+ return this.getAtt("DNSName");
3300
3306
  }
3301
3307
  get hostedZoneId() {
3302
- return getAtt(this.logicalId, "CanonicalHostedZoneID");
3308
+ return this.getAtt("CanonicalHostedZoneID");
3303
3309
  }
3304
3310
  properties() {
3305
3311
  return {
@@ -3320,10 +3326,10 @@ var Listener = class extends Resource {
3320
3326
  this.props = props;
3321
3327
  }
3322
3328
  get id() {
3323
- return ref(this.logicalId);
3329
+ return this.ref();
3324
3330
  }
3325
3331
  get arn() {
3326
- return getAtt(this.logicalId, "ListenerArn");
3332
+ return this.getAtt("ListenerArn");
3327
3333
  }
3328
3334
  properties() {
3329
3335
  return {
@@ -3419,10 +3425,10 @@ var ListenerRule = class extends Resource {
3419
3425
  this.props = props;
3420
3426
  }
3421
3427
  get id() {
3422
- return ref(this.logicalId);
3428
+ return this.ref();
3423
3429
  }
3424
3430
  get arn() {
3425
- return getAtt(this.logicalId, "ListenerArn");
3431
+ return this.getAtt("ListenerArn");
3426
3432
  }
3427
3433
  properties() {
3428
3434
  return {
@@ -3481,10 +3487,10 @@ var TargetGroup = class extends Resource {
3481
3487
  }
3482
3488
  name;
3483
3489
  get arn() {
3484
- return ref(this.logicalId);
3490
+ return this.ref();
3485
3491
  }
3486
3492
  get fullName() {
3487
- return getAtt(this.logicalId, "TargetGroupFullName");
3493
+ return this.getAtt("TargetGroupFullName");
3488
3494
  }
3489
3495
  properties() {
3490
3496
  return {
@@ -3764,10 +3770,10 @@ var Queue = class extends Resource {
3764
3770
  return this;
3765
3771
  }
3766
3772
  get arn() {
3767
- return getAtt(this.logicalId, "Arn");
3773
+ return this.getAtt("Arn");
3768
3774
  }
3769
3775
  get url() {
3770
- return getAtt(this.logicalId, "QueueUrl");
3776
+ return this.getAtt("QueueUrl");
3771
3777
  }
3772
3778
  get permissions() {
3773
3779
  return {
@@ -3839,7 +3845,7 @@ var TopicRule = class extends Resource {
3839
3845
  }
3840
3846
  name;
3841
3847
  get arn() {
3842
- return getAtt(this.logicalId, "Arn");
3848
+ return this.getAtt("Arn");
3843
3849
  }
3844
3850
  properties() {
3845
3851
  return {
@@ -3985,10 +3991,10 @@ var Api = class extends Resource {
3985
3991
  }
3986
3992
  name;
3987
3993
  get endpoint() {
3988
- return getAtt(this.logicalId, "ApiEndpoint");
3994
+ return this.getAtt("ApiEndpoint");
3989
3995
  }
3990
3996
  get id() {
3991
- return getAtt(this.logicalId, "ApiId");
3997
+ return this.getAtt("ApiId");
3992
3998
  }
3993
3999
  properties() {
3994
4000
  return {
@@ -4014,7 +4020,7 @@ var Integration = class extends Resource {
4014
4020
  this.props = props;
4015
4021
  }
4016
4022
  get id() {
4017
- return ref(this.logicalId);
4023
+ return this.ref();
4018
4024
  }
4019
4025
  properties() {
4020
4026
  return {
@@ -4035,7 +4041,7 @@ var Route = class extends Resource {
4035
4041
  this.props = props;
4036
4042
  }
4037
4043
  get id() {
4038
- return getAtt(this.logicalId, "RouteId");
4044
+ return this.getAtt("RouteId");
4039
4045
  }
4040
4046
  properties() {
4041
4047
  return {
@@ -4081,13 +4087,13 @@ var DomainName2 = class extends Resource {
4081
4087
  this.props = props;
4082
4088
  }
4083
4089
  get name() {
4084
- return ref(this.logicalId);
4090
+ return this.ref();
4085
4091
  }
4086
4092
  get regionalDomainName() {
4087
- return getAtt(this.logicalId, "RegionalDomainName");
4093
+ return this.getAtt("RegionalDomainName");
4088
4094
  }
4089
4095
  get regionalHostedZoneId() {
4090
- return getAtt(this.logicalId, "RegionalHostedZoneId");
4096
+ return this.getAtt("RegionalHostedZoneId");
4091
4097
  }
4092
4098
  properties() {
4093
4099
  return {
@@ -4127,7 +4133,7 @@ var ApiMapping = class extends Resource {
4127
4133
  this.props = props;
4128
4134
  }
4129
4135
  get id() {
4130
- return getAtt(this.logicalId, "ApiMappingId");
4136
+ return this.getAtt("ApiMappingId");
4131
4137
  }
4132
4138
  properties() {
4133
4139
  return {
@@ -4204,13 +4210,13 @@ var Collection = class extends Resource {
4204
4210
  }
4205
4211
  name;
4206
4212
  get id() {
4207
- return ref(this.logicalId);
4213
+ return this.ref();
4208
4214
  }
4209
4215
  get arn() {
4210
- return getAtt(this.logicalId, "Arn");
4216
+ return this.getAtt("Arn");
4211
4217
  }
4212
4218
  get endpoint() {
4213
- return getAtt(this.logicalId, "CollectionEndpoint");
4219
+ return this.getAtt("CollectionEndpoint");
4214
4220
  }
4215
4221
  get permissions() {
4216
4222
  return {
@@ -4273,7 +4279,7 @@ var Distribution = class extends Resource {
4273
4279
  }
4274
4280
  name;
4275
4281
  get id() {
4276
- return getAtt(this.logicalId, "Id");
4282
+ return this.getAtt("Id");
4277
4283
  }
4278
4284
  get arn() {
4279
4285
  return sub("arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:distribution/${id}", {
@@ -4400,19 +4406,19 @@ var Bucket = class extends Resource {
4400
4406
  }
4401
4407
  name;
4402
4408
  get arn() {
4403
- return getAtt(this.logicalId, "Arn");
4409
+ return this.getAtt("Arn");
4404
4410
  }
4405
4411
  get domainName() {
4406
- return getAtt(this.logicalId, "DomainName");
4412
+ return this.getAtt("DomainName");
4407
4413
  }
4408
4414
  get dealStackDomainName() {
4409
- return getAtt(this.logicalId, "DualStackDomainName");
4415
+ return this.getAtt("DualStackDomainName");
4410
4416
  }
4411
4417
  get regionalDomainName() {
4412
- return getAtt(this.logicalId, "RegionalDomainName");
4418
+ return this.getAtt("RegionalDomainName");
4413
4419
  }
4414
4420
  get url() {
4415
- return getAtt(this.logicalId, "WebsiteURL");
4421
+ return this.getAtt("WebsiteURL");
4416
4422
  }
4417
4423
  get permissions() {
4418
4424
  return {
@@ -4460,7 +4466,7 @@ var OriginRequestPolicy = class extends Resource {
4460
4466
  }
4461
4467
  name;
4462
4468
  get id() {
4463
- return getAtt(this.logicalId, "Id");
4469
+ return this.getAtt("Id");
4464
4470
  }
4465
4471
  properties() {
4466
4472
  return {
@@ -4492,7 +4498,7 @@ var CachePolicy = class extends Resource {
4492
4498
  }
4493
4499
  name;
4494
4500
  get id() {
4495
- return getAtt(this.logicalId, "Id");
4501
+ return this.getAtt("Id");
4496
4502
  }
4497
4503
  properties() {
4498
4504
  return {
@@ -4625,7 +4631,7 @@ var OriginAccessControl = class extends Resource {
4625
4631
  }
4626
4632
  name;
4627
4633
  get id() {
4628
- return getAtt(this.logicalId, "Id");
4634
+ return this.getAtt("Id");
4629
4635
  }
4630
4636
  properties() {
4631
4637
  return {
@@ -4648,7 +4654,7 @@ var ResponseHeadersPolicy = class extends Resource {
4648
4654
  }
4649
4655
  name;
4650
4656
  get id() {
4651
- return getAtt(this.logicalId, "Id");
4657
+ return this.getAtt("Id");
4652
4658
  }
4653
4659
  properties() {
4654
4660
  return {
@@ -4954,13 +4960,13 @@ var Table = class extends Resource {
4954
4960
  this.indexes[name] = props;
4955
4961
  }
4956
4962
  get id() {
4957
- return ref(this.logicalId);
4963
+ return this.ref();
4958
4964
  }
4959
4965
  get arn() {
4960
- return getAtt(this.logicalId, "Arn");
4966
+ return this.getAtt("Arn");
4961
4967
  }
4962
4968
  get streamArn() {
4963
- return getAtt(this.logicalId, "StreamArn");
4969
+ return this.getAtt("StreamArn");
4964
4970
  }
4965
4971
  get permissions() {
4966
4972
  const permissions = [
@@ -5160,7 +5166,7 @@ var Topic = class extends Resource {
5160
5166
  }
5161
5167
  name;
5162
5168
  get arn() {
5163
- return ref(this.logicalId);
5169
+ return this.ref();
5164
5170
  }
5165
5171
  get permissions() {
5166
5172
  return {
@@ -5309,13 +5315,13 @@ var Vpc = class extends Resource {
5309
5315
  this.tag("Name", props.name);
5310
5316
  }
5311
5317
  get id() {
5312
- return ref(this.logicalId);
5318
+ return this.ref();
5313
5319
  }
5314
5320
  get defaultNetworkAcl() {
5315
- return getAtt(this.logicalId, "DefaultNetworkAcl");
5321
+ return this.getAtt("DefaultNetworkAcl");
5316
5322
  }
5317
5323
  get defaultSecurityGroup() {
5318
- return getAtt(this.logicalId, "DefaultSecurityGroup");
5324
+ return this.getAtt("DefaultSecurityGroup");
5319
5325
  }
5320
5326
  properties() {
5321
5327
  return {
@@ -5332,7 +5338,7 @@ var RouteTable = class extends Resource {
5332
5338
  }
5333
5339
  name;
5334
5340
  get id() {
5335
- return ref(this.logicalId);
5341
+ return this.ref();
5336
5342
  }
5337
5343
  properties() {
5338
5344
  return {
@@ -5345,7 +5351,7 @@ var InternetGateway = class extends Resource {
5345
5351
  super("AWS::EC2::InternetGateway", logicalId);
5346
5352
  }
5347
5353
  get id() {
5348
- return ref(this.logicalId);
5354
+ return this.ref();
5349
5355
  }
5350
5356
  properties() {
5351
5357
  return {};
@@ -5357,7 +5363,7 @@ var VPCGatewayAttachment = class extends Resource {
5357
5363
  this.props = props;
5358
5364
  }
5359
5365
  get id() {
5360
- return ref(this.logicalId);
5366
+ return this.ref();
5361
5367
  }
5362
5368
  properties() {
5363
5369
  return {
@@ -5372,7 +5378,7 @@ var Route2 = class extends Resource {
5372
5378
  this.props = props;
5373
5379
  }
5374
5380
  get id() {
5375
- return ref(this.logicalId);
5381
+ return this.ref();
5376
5382
  }
5377
5383
  properties() {
5378
5384
  return {
@@ -5388,7 +5394,7 @@ var Subnet = class extends Resource {
5388
5394
  this.props = props;
5389
5395
  }
5390
5396
  get id() {
5391
- return ref(this.logicalId);
5397
+ return this.ref();
5392
5398
  }
5393
5399
  properties() {
5394
5400
  return {
@@ -5404,7 +5410,7 @@ var SubnetRouteTableAssociation = class extends Resource {
5404
5410
  this.props = props;
5405
5411
  }
5406
5412
  get id() {
5407
- return ref(this.logicalId);
5413
+ return this.ref();
5408
5414
  }
5409
5415
  properties() {
5410
5416
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.154",
3
+ "version": "0.0.155",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,