@intentius/chant-lexicon-aws 0.124.52 → 0.124.55

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.
Files changed (108) hide show
  1. package/dist/api/credential-chain.d.ts +3 -3
  2. package/dist/api/credential-chain.d.ts.map +1 -1
  3. package/dist/api/credential-chain.js +2 -2
  4. package/dist/api/read-client.d.ts +2 -2
  5. package/dist/api/read-client.d.ts.map +1 -1
  6. package/dist/api/read-client.js +2 -2
  7. package/dist/api/{sigv4.d.ts → signing.d.ts} +14 -34
  8. package/dist/api/signing.d.ts.map +1 -0
  9. package/dist/api/signing.js +95 -0
  10. package/dist/codegen/generate-lexicon.d.ts +2 -0
  11. package/dist/codegen/generate-lexicon.d.ts.map +1 -1
  12. package/dist/codegen/generate-lexicon.js +1 -0
  13. package/dist/components/__tests__/mock-cloud-executor.d.ts +4 -0
  14. package/dist/components/__tests__/mock-cloud-executor.d.ts.map +1 -1
  15. package/dist/components/__tests__/mock-cloud-executor.js +18 -1
  16. package/dist/components/apply.d.ts +46 -2
  17. package/dist/components/apply.d.ts.map +1 -1
  18. package/dist/components/apply.js +266 -30
  19. package/dist/components/cfn-adopt-run.d.ts +37 -0
  20. package/dist/components/cfn-adopt-run.d.ts.map +1 -0
  21. package/dist/components/cfn-adopt-run.js +104 -0
  22. package/dist/components/cfn-adopt.d.ts +99 -0
  23. package/dist/components/cfn-adopt.d.ts.map +1 -0
  24. package/dist/components/cfn-adopt.js +278 -0
  25. package/dist/components/cfn-imports.d.ts +84 -0
  26. package/dist/components/cfn-imports.d.ts.map +1 -0
  27. package/dist/components/cfn-imports.js +239 -0
  28. package/dist/components/cloud-executor.d.ts +38 -2
  29. package/dist/components/cloud-executor.d.ts.map +1 -1
  30. package/dist/components/cloud-executor.js +84 -2
  31. package/dist/health.js +1 -1
  32. package/dist/importable.d.ts +30 -0
  33. package/dist/importable.d.ts.map +1 -0
  34. package/dist/importable.js +72 -0
  35. package/dist/index-identity.d.ts +19 -0
  36. package/dist/index-identity.d.ts.map +1 -0
  37. package/dist/index-identity.js +79 -0
  38. package/dist/index-import.d.ts +25 -0
  39. package/dist/index-import.d.ts.map +1 -0
  40. package/dist/index-import.js +132 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/integrity.json +4 -4
  45. package/dist/listed-types.d.ts +11 -0
  46. package/dist/listed-types.d.ts.map +1 -0
  47. package/dist/listed-types.js +52 -0
  48. package/dist/manifest.json +1 -1
  49. package/dist/meta.json +13206 -1237
  50. package/dist/plugin.d.ts.map +1 -1
  51. package/dist/plugin.js +12 -3
  52. package/dist/reference-catalog.d.ts.map +1 -1
  53. package/dist/reference-catalog.js +62 -20
  54. package/dist/skills/chant-aws-carve-terraform.md +21 -14
  55. package/dist/spec/fetch.d.ts +5 -0
  56. package/dist/spec/fetch.d.ts.map +1 -1
  57. package/dist/spec/parse.d.ts +8 -0
  58. package/dist/spec/parse.d.ts.map +1 -1
  59. package/dist/spec/parse.js +3 -0
  60. package/package.json +2 -2
  61. package/src/api/credential-chain.ts +3 -3
  62. package/src/api/read-client.test.ts +2 -2
  63. package/src/api/read-client.ts +3 -3
  64. package/src/api/{sigv4.test.ts → signing.test.ts} +84 -96
  65. package/src/api/signing.ts +130 -0
  66. package/src/codegen/generate-lexicon.ts +3 -0
  67. package/src/components/__tests__/mock-cloud-executor.ts +20 -1
  68. package/src/components/apply.ts +288 -30
  69. package/src/components/cfn-adopt-run.test.ts +227 -0
  70. package/src/components/cfn-adopt-run.ts +141 -0
  71. package/src/components/cfn-adopt.test.ts +284 -0
  72. package/src/components/cfn-adopt.ts +340 -0
  73. package/src/components/cfn-exports-in-use.test.ts +146 -0
  74. package/src/components/cfn-imports-preview.test.ts +178 -0
  75. package/src/components/cfn-imports-three-stacks.test.ts +107 -0
  76. package/src/components/cfn-imports.test.ts +213 -0
  77. package/src/components/cfn-imports.ts +246 -0
  78. package/src/components/cfn-plan-shape-conformance.test.ts +83 -0
  79. package/src/components/cloud-executor.ts +127 -5
  80. package/src/components/demo-composed-stacks-floci.e2e.test.ts +235 -0
  81. package/src/derived-edges.test.ts +142 -0
  82. package/src/generated/lexicon-aws.json +13206 -1237
  83. package/src/health.ts +1 -1
  84. package/src/importable.test.ts +86 -0
  85. package/src/importable.ts +83 -0
  86. package/src/index-identity.test.ts +134 -0
  87. package/src/index-identity.ts +98 -0
  88. package/src/index-import.test.ts +257 -0
  89. package/src/index-import.ts +158 -0
  90. package/src/index-search.test.ts +87 -0
  91. package/src/index.ts +1 -1
  92. package/src/listed-types.test.ts +97 -0
  93. package/src/listed-types.ts +56 -0
  94. package/src/plugin.ts +13 -3
  95. package/src/reference-catalog.ts +63 -20
  96. package/src/skills/chant-aws-carve-terraform.md +21 -14
  97. package/src/spec/fetch.ts +5 -0
  98. package/src/spec/parse.test.ts +15 -0
  99. package/src/spec/parse.ts +12 -0
  100. package/src/testdata/indexed/identity.listing.json +65 -0
  101. package/src/testdata/indexed/import.listing.json +126 -0
  102. package/src/testdata/indexed/listing.json +69 -0
  103. package/src/testdata/indexed/topology.listing.json +350 -0
  104. package/src/testdata/three-cloud/dns.graph.json +336 -0
  105. package/src/three-cloud-parity.test.ts +49 -0
  106. package/dist/api/sigv4.d.ts.map +0 -1
  107. package/dist/api/sigv4.js +0 -185
  108. package/src/api/sigv4.ts +0 -243
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAqQ,MAAM,0BAA0B,CAAC;AAyCjU;yEACyE;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAiBnD,eAAO,MAAM,SAAS,EAAE,aA+kCvB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAqQ,MAAM,0BAA0B,CAAC;AAyCjU;yEACyE;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAiBnD,eAAO,MAAM,SAAS,EAAE,aAslCvB,CAAC"}
package/dist/plugin.js CHANGED
@@ -3,6 +3,9 @@ import { createRequire } from "module";
3
3
  import { awsBehaviourKinds } from "./behaviour-kinds.js";
4
4
  import { detectTemplate } from "./detect.js";
5
5
  import { awsCapabilityPack } from "./capabilities/pack.js";
6
+ import { awsListedTypes } from "./listed-types.js";
7
+ import { awsIndexIdentity } from "./index-identity.js";
8
+ import { awsIndexImport } from "./index-import.js";
6
9
  const require = createRequire(moduleSourceUrl(import.meta.url));
7
10
  import { discoverLintRules } from "@intentius/chant/lint/discover";
8
11
  import { postSynthChecks as postSynthCheckList } from "./lint/post-synth/index.js";
@@ -82,6 +85,12 @@ export const awsPlugin = {
82
85
  // Live edge reconstruction for `chant graph --live` (#778).
83
86
  referenceCatalog: awsReferenceCatalog,
84
87
  capabilityPack: awsCapabilityPack,
88
+ // Cloud inventory type names to kinds, for an indexed resource (#4521).
89
+ listedTypes: awsListedTypes,
90
+ // Declared entities to indexed resources by primaryIdentifier (#4523).
91
+ indexIdentity: awsIndexIdentity,
92
+ // Indexed resources as CloudFormation import IR, for `chant import --index` (#4524).
93
+ indexImport: awsIndexImport,
85
94
  lintRules() {
86
95
  const rulesDir = join(dirname(fileURLToPath(import.meta.url)), "lint", "rules");
87
96
  return discoverLintRules(rulesDir, import.meta.url);
@@ -546,7 +555,7 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
546
555
  {
547
556
  file: "chant-aws-carve-terraform.md",
548
557
  name: "chant-aws-carve-terraform",
549
- description: "Demo carving a resource out of Terraform into native chant — advise, emit, audit, bridge, apply — fully offline",
558
+ description: "Demo moving one Terraform resource to native CloudFormation, fully offline (advise, emit, audit, bridge, apply); Terraform keeps the rest",
550
559
  triggers: [
551
560
  { type: "context", value: "terraform" },
552
561
  { type: "context", value: "carve" },
@@ -570,12 +579,12 @@ aws cloudformation wait stack-update-complete --stack-name my-app-prod`,
570
579
  {
571
580
  title: "Run the offline demo",
572
581
  description: "Demo the full advise → emit → bridge → apply loop with no cloud",
573
- input: "Show me how chant carves a resource out of Terraform",
582
+ input: "Show me how chant moves one resource from Terraform to CloudFormation",
574
583
  output: "cd examples/terraform-carve-out && ./demo.sh",
575
584
  },
576
585
  {
577
586
  title: "Adopt a resource from state",
578
- description: "Emit native chant source for a Terraform-managed resource, offline",
587
+ description: "Emit chant source for the AWS lexicon from a Terraform-managed resource, offline",
579
588
  input: "Adopt aws_s3_bucket.assets into chant",
580
589
  output: "chant carve emit --from ./terraform --select aws_s3_bucket.assets --state ./terraform/terraform.tfstate",
581
590
  },
@@ -1 +1 @@
1
- {"version":3,"file":"reference-catalog.d.ts","sourceRoot":"","sources":["../src/reference-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAgGjC,CAAC"}
1
+ {"version":3,"file":"reference-catalog.d.ts","sourceRoot":"","sources":["../src/reference-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBA2IjC,CAAC"}
@@ -26,6 +26,22 @@ export const awsReferenceCatalog = {
26
26
  { kind: "AWS::ECS::Service", ids: ["ServiceArn"] },
27
27
  { kind: "AWS::ECS::TaskDefinition", ids: ["TaskDefinitionArn"] },
28
28
  { kind: "AWS::RDS::DBInstance", ids: ["DBInstanceArn", "Endpoint.Address"] },
29
+ // Targets of the CloudFormation-shape rules an index needs (#4522, the
30
+ // missing rules counted on INTENTIUS/behold#1023). Over an index each
31
+ // node is also matched by its Cloud Control identifier and its cloud ids,
32
+ // so a role's ARN joins even though the deep hooks prune `Arn`.
33
+ { kind: "AWS::RDS::DBSubnetGroup", ids: ["DBSubnetGroupName"] },
34
+ { kind: "AWS::IAM::Role", ids: ["Arn", "RoleName"] },
35
+ { kind: "AWS::EC2::EIP", ids: ["AllocationId", "PublicIp"] },
36
+ { kind: "AWS::Logs::LogGroup", ids: ["LogGroupName", "Arn"] },
37
+ { kind: "AWS::Route53::HostedZone", ids: ["Id"] },
38
+ { kind: "AWS::EKS::Cluster", ids: ["Name", "Arn"] },
39
+ { kind: "AWS::CloudFormation::Stack", ids: ["StackId"] },
40
+ // #4535: a record set is named by its record name, which is what a CNAME
41
+ // in the same zone points at; a bucket by its name, which is what a
42
+ // workload's env var carries (behold#166, ../../k8s/src/reference-catalog.ts).
43
+ { kind: "AWS::Route53::RecordSet", ids: ["Name"] },
44
+ { kind: "AWS::S3::Bucket", ids: ["BucketName"] },
29
45
  ],
30
46
  refs: [
31
47
  // ── containment (→ boundary boxes, #779) ──
@@ -82,25 +98,51 @@ export const awsReferenceCatalog = {
82
98
  // intrinsics to bare logical ids (= node ids), so these match by node id; the
83
99
  // property names are the CFN template shape (SecurityGroupIds, Cluster, …),
84
100
  // which differs from the describe/SDK shape above. No targetKind needed —
85
- // logical ids are unique.
86
- { from: "AWS::EC2::Subnet", path: "VpcId", relation: "containment", label: "in VPC" },
87
- { from: "AWS::EC2::SecurityGroup", path: "VpcId", relation: "containment", label: "in VPC" },
88
- { from: "AWS::EC2::RouteTable", path: "VpcId", relation: "containment", label: "in VPC" },
89
- { from: "AWS::EC2::Instance", path: "SubnetId", relation: "containment", label: "in subnet" },
90
- { from: "AWS::EC2::Instance", path: "SecurityGroupIds[]", relation: "reference", label: "sg" },
91
- { from: "AWS::EC2::NatGateway", path: "SubnetId", relation: "containment", label: "in subnet" },
92
- { from: "AWS::EC2::Route", path: "RouteTableId", relation: "reference", label: "in" },
93
- { from: "AWS::EC2::Route", path: "GatewayId", relation: "reference", label: "via" },
94
- { from: "AWS::EC2::Route", path: "NatGatewayId", relation: "reference", label: "via" },
95
- { from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "Subnets[]", relation: "containment", label: "in subnet" },
96
- { from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "SecurityGroups[]", relation: "reference", label: "sg" },
97
- { from: "AWS::ElasticLoadBalancingV2::TargetGroup", path: "VpcId", relation: "containment", label: "in VPC" },
98
- { from: "AWS::ElasticLoadBalancingV2::Listener", path: "LoadBalancerArn", relation: "reference", label: "on" },
99
- { from: "AWS::ElasticLoadBalancingV2::Listener", path: "DefaultActions[].TargetGroupArn", relation: "reference", label: "forwards to" },
100
- { from: "AWS::ECS::Service", path: "Cluster", relation: "reference", label: "in cluster" },
101
- { from: "AWS::ECS::Service", path: "TaskDefinition", relation: "reference", label: "runs" },
102
- { from: "AWS::ECS::Service", path: "LoadBalancers[].TargetGroupArn", relation: "reference", label: "registered in" },
103
- { from: "AWS::RDS::DBInstance", path: "DBSubnetGroupName", relation: "reference", label: "subnets" },
104
- { from: "AWS::RDS::DBInstance", path: "VPCSecurityGroups[]", relation: "reference", label: "sg" },
101
+ // logical ids are unique. Over an index (#4522) the same paths hold physical
102
+ // values, some of them names, so each carries the `indexedTargetKind` it
103
+ // takes there (ruled on INTENTIUS/behold#1023 Q4).
104
+ { from: "AWS::EC2::Subnet", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
105
+ { from: "AWS::EC2::SecurityGroup", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
106
+ { from: "AWS::EC2::RouteTable", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
107
+ { from: "AWS::EC2::Instance", path: "SubnetId", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
108
+ { from: "AWS::EC2::Instance", path: "SecurityGroupIds[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
109
+ { from: "AWS::EC2::NatGateway", path: "SubnetId", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
110
+ { from: "AWS::EC2::Route", path: "RouteTableId", indexedTargetKind: "AWS::EC2::RouteTable", relation: "reference", label: "in" },
111
+ { from: "AWS::EC2::Route", path: "GatewayId", indexedTargetKind: "AWS::EC2::InternetGateway", relation: "reference", label: "via" },
112
+ { from: "AWS::EC2::Route", path: "NatGatewayId", indexedTargetKind: "AWS::EC2::NatGateway", relation: "reference", label: "via" },
113
+ { from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "Subnets[]", indexedTargetKind: "AWS::EC2::Subnet", relation: "containment", label: "in subnet" },
114
+ { from: "AWS::ElasticLoadBalancingV2::LoadBalancer", path: "SecurityGroups[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
115
+ { from: "AWS::ElasticLoadBalancingV2::TargetGroup", path: "VpcId", indexedTargetKind: "AWS::EC2::VPC", relation: "containment", label: "in VPC" },
116
+ { from: "AWS::ElasticLoadBalancingV2::Listener", path: "LoadBalancerArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::LoadBalancer", relation: "reference", label: "on" },
117
+ { from: "AWS::ElasticLoadBalancingV2::Listener", path: "DefaultActions[].TargetGroupArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::TargetGroup", relation: "reference", label: "forwards to" },
118
+ { from: "AWS::ECS::Service", path: "Cluster", indexedTargetKind: "AWS::ECS::Cluster", relation: "reference", label: "in cluster" },
119
+ { from: "AWS::ECS::Service", path: "TaskDefinition", indexedTargetKind: "AWS::ECS::TaskDefinition", relation: "reference", label: "runs" },
120
+ { from: "AWS::ECS::Service", path: "LoadBalancers[].TargetGroupArn", indexedTargetKind: "AWS::ElasticLoadBalancingV2::TargetGroup", relation: "reference", label: "registered in" },
121
+ { from: "AWS::RDS::DBInstance", path: "DBSubnetGroupName", indexedTargetKind: "AWS::RDS::DBSubnetGroup", relation: "reference", label: "subnets" },
122
+ { from: "AWS::RDS::DBInstance", path: "VPCSecurityGroups[]", indexedTargetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "sg" },
123
+ // ── CloudFormation property shape, as Cloud Control returns it (#4522) ──
124
+ // The rules INTENTIUS/behold#1023's count found missing for an index of
125
+ // example-three-cloud. Targeted, so they hold over physical values and over
126
+ // logical ids alike.
127
+ { from: "AWS::EC2::VPCGatewayAttachment", path: "VpcId", targetKind: "AWS::EC2::VPC", relation: "reference", label: "attaches to" },
128
+ { from: "AWS::EC2::VPCGatewayAttachment", path: "InternetGatewayId", targetKind: "AWS::EC2::InternetGateway", relation: "reference", label: "attaches" },
129
+ { from: "AWS::EC2::NatGateway", path: "AllocationId", targetKind: "AWS::EC2::EIP", relation: "reference", label: "address" },
130
+ { from: "AWS::ECS::TaskDefinition", path: "ExecutionRoleArn", targetKind: "AWS::IAM::Role", relation: "reference", label: "execution role" },
131
+ { from: "AWS::ECS::TaskDefinition", path: "TaskRoleArn", targetKind: "AWS::IAM::Role", relation: "reference", label: "task role" },
132
+ { from: "AWS::ECS::TaskDefinition", path: "ContainerDefinitions[].LogConfiguration.Options.awslogs-group", targetKind: "AWS::Logs::LogGroup", relation: "reference", label: "logs to" },
133
+ { from: "AWS::EC2::SecurityGroup", path: "SecurityGroupIngress[].SourceSecurityGroupId", targetKind: "AWS::EC2::SecurityGroup", relation: "reference", label: "allows" },
134
+ { from: "AWS::Route53::RecordSet", path: "HostedZoneId", targetKind: "AWS::Route53::HostedZone", relation: "containment", label: "in zone" },
135
+ // A CNAME to another record of the estate (#4535: example-three-cloud's
136
+ // latency record for gcp points at gcp.three-cloud.example.). Optional,
137
+ // since most record values are addresses or hostnames outside it.
138
+ { from: "AWS::Route53::RecordSet", path: "ResourceRecords[]", targetKind: "AWS::Route53::RecordSet", relation: "reference", label: "aliases", optional: true },
139
+ ],
140
+ // Tags that name a cloud id in their key or value (behold#1023 Q5). Used
141
+ // over indexed nodes only. No rule matches equal tag values in general.
142
+ tagRefs: [
143
+ { key: "aws:cloudformation:stack-id", read: "value", targetKind: "AWS::CloudFormation::Stack", label: "in stack" },
144
+ { key: "aws:eks:cluster-name", read: "value", targetKind: "AWS::EKS::Cluster", label: "cluster" },
145
+ { key: "eks:cluster-name", read: "value", targetKind: "AWS::EKS::Cluster", label: "cluster" },
146
+ { key: "kubernetes.io/cluster/", read: "key-suffix", targetKind: "AWS::EKS::Cluster", label: "cluster" },
105
147
  ],
106
148
  };
@@ -1,20 +1,26 @@
1
1
  ---
2
2
  skill: chant-aws-carve-terraform
3
- description: Demo carving a resource out of Terraform into native chant — advise, emit, audit, bridge, apply — fully offline
3
+ description: Demo moving one Terraform resource to native CloudFormation, fully offline (advise, emit, audit, bridge, apply); Terraform keeps the rest
4
4
  user-invocable: true
5
5
  ---
6
6
 
7
- # Carve a resource out of Terraform (demo)
7
+ # Move one Terraform resource to CloudFormation (demo)
8
8
 
9
- Use this skill to cleanly demonstrate chant's Terraform carve-out flow for
10
- someone. The whole demo runs **offline** — no cloud account, no Terraform
11
- binary, no state backend. It carves an AWS S3 bucket out of a small Terraform
12
- estate into native chant source, patches the survivors, and plans the
13
- graduation.
9
+ Use this skill to demonstrate chant's carve flow, which moves one resource
10
+ from a Terraform estate to chant source for the AWS lexicon. The whole demo
11
+ runs **offline**, with no cloud account, Terraform binary or state backend. It
12
+ moves an S3 bucket from a small Terraform estate to chant source, patches the
13
+ resources that stay in Terraform, and plans the graduation.
14
14
 
15
15
  ## When to use
16
16
 
17
- - Someone asks "how does chant move things off Terraform?"
17
+ - Someone asks how chant can manage one resource from a Terraform root as
18
+ native CloudFormation.
19
+ - Someone on Terraform or OpenTofu asks how to get chant's ownership markers
20
+ on their resources. Point them at choudoufu instead
21
+ (`terraform.binary: "choudoufu"`, see
22
+ https://intentius.io/chant/lexicons/terraform/ops/#choudoufu). Their roots
23
+ stay in OpenTofu.
18
24
  - You want to show the advise → emit → audit → bridge → apply loop end to end.
19
25
  - You are evaluating whether a Terraform estate is worth carving.
20
26
 
@@ -40,12 +46,12 @@ Walk the person through the output. That is the whole demo.
40
46
 
41
47
  From `examples/terraform-carve-out`, with `TF=./terraform`:
42
48
 
43
- 1. **Advise — what is cheap to carve.**
49
+ 1. **Advise: rank the resources.**
44
50
  ```bash
45
51
  chant carve advise --from ./terraform
46
52
  ```
47
53
  Point out the three bands: clean leaves (carve now), carvable with edits,
48
- and leave-in-Terraform. `aws_s3_bucket.assets` is a clean leaf held back one
54
+ and stays in Terraform (`leave in Terraform` in the JSON). `aws_s3_bucket.assets` is a clean leaf held back one
49
55
  notch by the Lambda that reads it; `random_pet` has no native mapping.
50
56
 
51
57
  2. **Emit — adopt the bucket into chant source, offline, from state.**
@@ -68,9 +74,9 @@ From `examples/terraform-carve-out`, with `TF=./terraform`:
68
74
  chant build ./carveout/src --lexicon aws
69
75
  ```
70
76
  The first build fails, deliberately: the post-synth audit refuses the
71
- adopted bucket because Terraform managed it without a public-access block or
72
- a TLS-only policy. This is a feature of carving: chant immediately tells the
73
- person what is wrong with what they adopted. Show the fix (add
77
+ adopted bucket because it has no public-access block or TLS-only policy.
78
+ This is a feature of carving: chant tells the person which settings the
79
+ adopted resource is missing. Show the fix (add
74
80
  `PublicAccessBlockConfiguration` and a companion `S3BucketPolicy` with an
75
81
  `aws:SecureTransport = false` Deny — the tutorial page has the exact code),
76
82
  then re-run the build and show the valid CloudFormation template.
@@ -96,7 +102,8 @@ From `examples/terraform-carve-out`, with `TF=./terraform`:
96
102
 
97
103
  - Nothing is destroyed or applied; every step before graduation is reversible
98
104
  with `terraform import`.
99
- - You carve one resource at a time. The gnarly long tail stays in Terraform.
105
+ - You carve one resource at a time. Everything else stays in Terraform, where
106
+ it already works.
100
107
  - `advise` and `bridge` work against **any** Terraform tree — offer to point
101
108
  them at the person's own estate.
102
109
 
@@ -22,6 +22,11 @@ export interface CFNSchema {
22
22
  cloudFormationSystemTags?: boolean;
23
23
  tagProperty?: string;
24
24
  };
25
+ /**
26
+ * The resource provider's handlers (`create`, `read`, `update`, `delete`,
27
+ * `list`), each with its IAM permissions. A legacy type has none (#4536).
28
+ */
29
+ handlers?: Record<string, unknown>;
25
30
  additionalProperties?: boolean;
26
31
  }
27
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/spec/fetch.ts"],"names":[],"mappings":"AAOA,OAAO,EAA+C,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAKlF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,+BAA+B,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,C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6 +47,14 @@ export interface ParsedResource {
47
47
  conditionalCreateOnly: string[];
48
48
  replacementStrategy?: "delete_then_create" | "create_then_delete";
49
49
  tagging?: ResourceTagging;
50
+ /**
51
+ * The schema's `handlers` section as its operation names, sorted
52
+ * (`["create", "delete", "list", "read", "update"]`). The permissions each
53
+ * handler lists are left out. Absent when the schema has no handlers, as a
54
+ * legacy type does. CloudFormation can import a type with `create` and
55
+ * `read` (../importable.ts, #4536).
56
+ */
57
+ handlers?: string[];
50
58
  }
51
59
  /** How a type's tags are written: a `[{Key, Value}]` list or a key-to-value map. */
52
60
  export type TagShape = "list" | "map";
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/spec/parse.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoC,MAAM,SAAS,CAAC;AAC3E,OAAO,EAGL,kBAAkB,IAAI,sBAAsB,EAE5C,KAAK,mBAAmB,EAIzB,MAAM,sCAAsC,CAAC;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAkBhF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB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D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAYzE"}
@@ -125,6 +125,8 @@ export function parseCFNSchema(data) {
125
125
  ...tagPlacement(schema),
126
126
  };
127
127
  }
128
+ // --- Handlers (#4536): which operations the resource provider implements ---
129
+ const handlers = schema.handlers && typeof schema.handlers === "object" ? Object.keys(schema.handlers).sort() : [];
128
130
  // --- Replacement strategy ---
129
131
  let replacementStrategy;
130
132
  if (schema.replacementStrategy === "delete_then_create" || schema.replacementStrategy === "create_then_delete") {
@@ -146,6 +148,7 @@ export function parseCFNSchema(data) {
146
148
  conditionalCreateOnly: stripPointerPaths(schema.conditionalCreateOnlyProperties ?? [], schema),
147
149
  ...(replacementStrategy && { replacementStrategy }),
148
150
  ...(tagging && { tagging }),
151
+ ...(handlers.length > 0 && { handlers }),
149
152
  },
150
153
  propertyTypes: boundedPropertyTypes,
151
154
  enums,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-aws",
3
- "version": "0.124.52",
3
+ "version": "0.124.55",
4
4
  "description": "AWS CloudFormation lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -83,6 +83,6 @@
83
83
  "typescript": "^5.9.3"
84
84
  },
85
85
  "peerDependencies": {
86
- "@intentius/chant": "^0.124.52"
86
+ "@intentius/chant": "^0.124.55"
87
87
  }
88
88
  }
@@ -2,7 +2,7 @@
2
2
  * The AWS credential chain, as the AWS CLI walks it, for `chant lifecycle
3
3
  * whoami` (#3954).
4
4
  *
5
- * `resolveCredentials` (./sigv4.ts) reads the three environment variables and
5
+ * `resolveCredentials` (./signing.ts) reads the three environment variables and
6
6
  * nothing else. That is right for the read transport's synchronous signing
7
7
  * seam, and it made whoami wrong for anyone whose shell holds a profile rather
8
8
  * than keys: `AWS_PROFILE=dev` with an SSO session came back as "no identity
@@ -55,7 +55,7 @@ import { readFileSync } from "node:fs";
55
55
  import { homedir } from "node:os";
56
56
  import { join } from "node:path";
57
57
  import { AwsReadError, assumeRole, type AwsReadClientOptions } from "./read-client";
58
- import type { AwsCredentials } from "./sigv4";
58
+ import type { AwsCredentials } from "./signing";
59
59
 
60
60
  /** One HTTP exchange for the SSO portal and OIDC calls. Injected by tests. */
61
61
  export type CredentialChainHttp = (
@@ -613,7 +613,7 @@ async function walkForTransport(options: CredentialChainOptions, now: () => Date
613
613
  * What the native read transport signs with when the caller injected nothing:
614
614
  * the same chain whoami walks, so `lifecycle diff --live` signs as the
615
615
  * principal whoami reports. The signing seam (`AwsCredentialResolver` in
616
- * ./sigv4.ts) is synchronous and the chain is not, so the transport awaits
616
+ * ./signing.ts) is synchronous and the chain is not, so the transport awaits
617
617
  * this once before a request and passes the literal credentials in.
618
618
  *
619
619
  * Environment keys answer directly, as in the chain. Otherwise the walk is
@@ -21,7 +21,7 @@ import {
21
21
  xmlError,
22
22
  type AwsReadHttp,
23
23
  } from "./read-client";
24
- import { EMPTY_PAYLOAD_SHA256 } from "./sigv4";
24
+ import { EMPTY_PAYLOAD_SHA256 } from "./signing";
25
25
 
26
26
  const respond = (text: string, status = 200): ReturnType<AwsReadHttp> => Promise.resolve({ status, text });
27
27
 
@@ -246,7 +246,7 @@ describe("the region an endpoint override cannot carry in its host", () => {
246
246
  });
247
247
 
248
248
  /**
249
- * The signing decision, as the client makes it. `./sigv4.test.ts` proves the
249
+ * The signing decision, as the client makes it. `./signing.test.ts` proves the
250
250
  * signature is correct against AWS's own vectors; these prove the client only
251
251
  * produces one when it should.
252
252
  */
@@ -20,7 +20,7 @@
20
20
  * ## Signing
21
21
  *
22
22
  * Requests are signed with SigV4 (#1686) when credentials resolve — see
23
- * `./sigv4.ts`, which holds the implementation so that cedar's AVP client can
23
+ * `./signing.ts`, which signs through core's signer (#4583) so that cedar's AVP client can
24
24
  * adopt the same one rather than growing a second. With none injected, they
25
25
  * resolve through the AWS CLI's chain (`./credential-chain.ts`, the one
26
26
  * `chant lifecycle whoami` walks) once per process, by
@@ -46,9 +46,9 @@
46
46
  */
47
47
  import { homedir } from "node:os";
48
48
  import { transportCredentials } from "./credential-chain";
49
- import { resolveCredentials, signRequest, type AwsCredentialSource } from "./sigv4";
49
+ import { resolveCredentials, signRequest, type AwsCredentialSource } from "./signing";
50
50
 
51
- export type { AwsCredentials, AwsCredentialResolver, AwsCredentialSource } from "./sigv4";
51
+ export type { AwsCredentials, AwsCredentialResolver, AwsCredentialSource } from "./signing";
52
52
 
53
53
  const DEFAULT_REGION = "us-east-1";
54
54
  const CFN_API_VERSION = "2010-05-15";
@@ -1,75 +1,39 @@
1
1
  /**
2
- * SigV4 (#1686), checked against AWS's own published vectors.
2
+ * The aws lexicon's signing surface (#1686) over core's SigV4 signer (#4583).
3
3
  *
4
- * A signing implementation that is only tested against itself proves nothing —
5
- * it will happily agree with its own mistake. Three of the fixtures below are
6
- * values AWS publishes: the derived signing key from the documentation's
7
- * "deriving the signing key" example, and the canonical request hash and
8
- * signature of `get-vanilla` from the `aws-sig-v4-test-suite`. If a refactor
9
- * breaks canonicalization, those three stop matching.
4
+ * A signing implementation that is only tested against itself proves nothing,
5
+ * so the first block checks core's signer against `get-vanilla` from AWS's
6
+ * `aws-sig-v4-test-suite`. The Cloud Control vector further down was recorded
7
+ * from this lexicon's own signer before #4583 replaced it with core's: if the
8
+ * header set the lexicon signs drifts, that signature stops matching.
10
9
  *
11
10
  * Nothing here touches the network; there is nothing to touch. Signing is a
12
11
  * pure function of the request and the clock.
13
12
  */
14
13
  import { describe, test, expect } from "vitest";
15
- import { createHmac } from "node:crypto";
16
- import {
17
- EMPTY_PAYLOAD_SHA256,
18
- amzDate,
19
- canonicalHeaders,
20
- canonicalRequest,
21
- resolveCredentials,
22
- sha256Hex,
23
- signRequest,
24
- signingKey,
25
- stringToSign,
26
- } from "./sigv4";
14
+ import { sha256Hex, signV4 } from "@intentius/chant/cloud-lister/sigv4";
15
+ import { EMPTY_PAYLOAD_SHA256, UNSIGNED_HEADERS, resolveCredentials, signRequest } from "./signing";
27
16
 
28
17
  /** The example secret AWS uses throughout its Signature Version 4 documentation. */
29
18
  const SECRET = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY";
30
19
  const ACCESS_KEY = "AKIDEXAMPLE";
31
20
 
32
- describe("the published vectors", () => {
33
- test("the signing key matches the documented derivation", () => {
34
- // AWS, "Examples of how to derive a signing key for Signature Version 4":
35
- // 20120215 / us-east-1 / iam.
36
- expect(signingKey(SECRET, "20120215", "us-east-1", "iam").toString("hex")).toBe(
37
- "f4780e2d9f65fa895f9c67b32ce1baf0b0d8a43505a000a1a9e090d414db404d",
38
- );
39
- });
40
-
41
- test("get-vanilla canonicalizes and signs exactly as the test suite says", () => {
42
- const { canonical, signed } = canonicalRequest(
43
- "GET",
44
- new URL("https://example.amazonaws.com/"),
45
- { host: "example.amazonaws.com", "x-amz-date": "20150830T123600Z" },
46
- EMPTY_PAYLOAD_SHA256,
47
- );
48
-
49
- expect(canonical).toBe(
50
- [
51
- "GET",
52
- "/",
53
- "",
54
- "host:example.amazonaws.com",
55
- "x-amz-date:20150830T123600Z",
56
- "",
57
- "host;x-amz-date",
58
- EMPTY_PAYLOAD_SHA256,
59
- ].join("\n"),
60
- );
61
- expect(signed).toBe("host;x-amz-date");
62
-
63
- const scope = "20150830/us-east-1/service/aws4_request";
64
- const sts = stringToSign("20150830T123600Z", scope, canonical);
65
- expect(sts).toBe(
66
- "AWS4-HMAC-SHA256\n20150830T123600Z\n" +
67
- `${scope}\nbb579772317eb040ac9ed261061d46c1f17a8133879d6129b6e1c25292927e63`,
68
- );
69
-
70
- const key = signingKey(SECRET, "20150830", "us-east-1", "service");
71
- expect(createHmac("sha256", key).update(sts, "utf8").digest("hex")).toBe(
72
- "5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
21
+ describe("the published vector", () => {
22
+ test("get-vanilla signs exactly as the test suite says", () => {
23
+ const headers = signV4({
24
+ method: "GET",
25
+ url: "https://example.amazonaws.com/",
26
+ headers: {},
27
+ body: "",
28
+ region: "us-east-1",
29
+ service: "service",
30
+ credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET },
31
+ now: new Date("2015-08-30T12:36:00Z"),
32
+ });
33
+ expect(headers.authorization).toBe(
34
+ "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, " +
35
+ "SignedHeaders=host;x-amz-date, " +
36
+ "Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
73
37
  );
74
38
  });
75
39
 
@@ -78,40 +42,78 @@ describe("the published vectors", () => {
78
42
  });
79
43
  });
80
44
 
81
- describe("header canonicalization", () => {
82
- test("names lowercase and sort, values trim and collapse inner runs", () => {
83
- expect(
84
- canonicalHeaders({
85
- "X-Amz-Date": "20150830T123600Z",
86
- "Content-Type": " application/json ",
87
- Host: "example.amazonaws.com",
88
- "My-Header": "a b\tc",
89
- }),
90
- ).toEqual({
91
- canonical:
92
- "content-type:application/json\nhost:example.amazonaws.com\n" +
93
- "my-header:a b c\nx-amz-date:20150830T123600Z\n",
94
- signed: "content-type;host;my-header;x-amz-date",
45
+ describe("the Cloud Control vector (#4583)", () => {
46
+ // Recorded from lexicons/aws/src/api/sigv4.ts, the lexicon's own signer,
47
+ // with these inputs, before it was removed in favour of core's.
48
+ const request = {
49
+ method: "POST",
50
+ url: "https://cloudcontrolapi.us-east-1.amazonaws.com/",
51
+ headers: {
52
+ "content-type": "application/x-amz-json-1.0",
53
+ "x-amz-target": "CloudApiService.GetResource",
54
+ "user-agent": "chant/0.124.34",
55
+ "x-amzn-trace-id": "Root=1-5759e988-bd862e3fe1be46a994272793",
56
+ },
57
+ body: JSON.stringify({ TypeName: "AWS::S3::Bucket", Identifier: "chant-example-bucket" }),
58
+ service: "cloudcontrolapi",
59
+ region: "us-east-1",
60
+ now: new Date("2015-08-30T12:36:00Z"),
61
+ };
62
+
63
+ test("a GetResource read signs to the recorded signature, user-agent and trace id unsigned", () => {
64
+ const headers = signRequest({ ...request, credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET } });
65
+ expect(headers).toEqual({
66
+ "content-type": "application/x-amz-json-1.0",
67
+ "x-amz-target": "CloudApiService.GetResource",
68
+ "user-agent": "chant/0.124.34",
69
+ "x-amzn-trace-id": "Root=1-5759e988-bd862e3fe1be46a994272793",
70
+ "x-amz-date": "20150830T123600Z",
71
+ "x-amz-content-sha256": "0748e7c18ab9933c78b1a34cd08c91183112acfa9918aea20ba2f1a6d33ef3d0",
72
+ authorization:
73
+ "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/cloudcontrolapi/aws4_request, " +
74
+ "SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, " +
75
+ "Signature=f8f2bbebcf51eed1126eca37ab3e614b540f0d769eb64ec2a0c5ee811b168f51",
95
76
  });
96
77
  });
97
78
 
98
- test("sorting is by byte, so an uppercase name still sorts by its lowercase form", () => {
99
- expect(canonicalHeaders({ Zeta: "1", alpha: "2", MIDDLE: "3" }).signed).toBe("alpha;middle;zeta");
79
+ test("with a session token, the token is sent, signed, and the signature is the recorded one", () => {
80
+ const headers = signRequest({
81
+ ...request,
82
+ credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET, sessionToken: "FwoGZXIvYXdzEXAMPLE" },
83
+ });
84
+ expect(headers["x-amz-security-token"]).toBe("FwoGZXIvYXdzEXAMPLE");
85
+ expect(headers.authorization).toBe(
86
+ "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/cloudcontrolapi/aws4_request, " +
87
+ "SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-target, " +
88
+ "Signature=99fef393d5ff5ad524823b03476535fa00631828cc22dae15f8f3cfe9d18ab69",
89
+ );
100
90
  });
91
+ });
101
92
 
102
- test("the unsignable headers are left out — signing what a proxy rewrites is an intermittent 403", () => {
103
- const { signed } = canonicalHeaders({
104
- authorization: "stale",
93
+ describe("header set", () => {
94
+ test("the unsigned headers are sent but left out of the signature", () => {
95
+ const caller = {
105
96
  "user-agent": "chant",
106
97
  "x-amzn-trace-id": "Root=1-x",
107
98
  connection: "keep-alive",
108
99
  expect: "100-continue",
109
- host: "example.amazonaws.com",
100
+ };
101
+ const headers = signRequest({
102
+ method: "POST",
103
+ url: "https://cloudformation.us-east-1.amazonaws.com/",
104
+ headers: { ...caller, authorization: "stale" },
105
+ body: "",
106
+ service: "cloudformation",
107
+ region: "us-east-1",
108
+ credentials: { accessKeyId: ACCESS_KEY, secretAccessKey: SECRET },
109
+ now: new Date("2015-08-30T12:36:00Z"),
110
110
  });
111
- expect(signed).toBe("host");
111
+ for (const [name, value] of Object.entries(caller)) expect(headers[name]).toBe(value);
112
+ expect(headers.authorization).toContain("SignedHeaders=host;x-amz-content-sha256;x-amz-date,");
113
+ expect([...UNSIGNED_HEADERS].sort()).toEqual(["authorization", "connection", "expect", "user-agent", "x-amzn-trace-id"]);
112
114
  });
113
115
 
114
- test("a bodyless request hashes to the empty-payload constant, not to a hash of nothing-in-particular", () => {
116
+ test("a bodyless request hashes to the empty-payload constant", () => {
115
117
  const headers = signRequest({
116
118
  method: "POST",
117
119
  url: "https://cloudformation.us-east-1.amazonaws.com/",
@@ -124,20 +126,6 @@ describe("header canonicalization", () => {
124
126
  });
125
127
  expect(headers["x-amz-content-sha256"]).toBe(EMPTY_PAYLOAD_SHA256);
126
128
  });
127
-
128
- test("the query string sorts by name then value, RFC 3986 encoded", () => {
129
- const { canonical } = canonicalRequest(
130
- "GET",
131
- new URL("https://example.amazonaws.com/?b=2&a=z&a=a&c=hi%20there*"),
132
- { host: "example.amazonaws.com" },
133
- EMPTY_PAYLOAD_SHA256,
134
- );
135
- expect(canonical.split("\n")[2]).toBe("a=a&a=z&b=2&c=hi%20there%2A");
136
- });
137
-
138
- test("amzDate is ISO-8601 basic, which is what X-Amz-Date wants", () => {
139
- expect(amzDate(new Date("2015-08-30T12:36:00.123Z"))).toBe("20150830T123600Z");
140
- });
141
129
  });
142
130
 
143
131
  describe("signRequest", () => {