@kensio/yulin 1.19.0 → 1.19.2

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 (170) hide show
  1. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts +2 -2
  2. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts.map +1 -1
  3. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js.map +1 -1
  4. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +3 -3
  5. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
  6. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js.map +1 -1
  7. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +5 -4
  8. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
  9. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
  10. package/dist/service/cloudformation/index.d.ts +7 -0
  11. package/dist/service/cloudformation/index.d.ts.map +1 -1
  12. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts +59 -0
  13. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts.map +1 -0
  14. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js +2 -0
  15. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js.map +1 -0
  16. package/dist/service/cloudformation/sim-cloudformation.d.ts +8 -9
  17. package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
  18. package/dist/service/cloudformation/sim-cloudformation.js +1 -3
  19. package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
  20. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +68 -0
  21. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -0
  22. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js +2 -0
  23. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js.map +1 -0
  24. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +2 -1
  25. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
  26. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts +21 -0
  27. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts.map +1 -0
  28. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js +21 -0
  29. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js.map +1 -0
  30. package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
  31. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts +12 -0
  32. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts.map +1 -0
  33. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js +60 -0
  34. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js.map +1 -0
  35. package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts +60 -0
  36. package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts.map +1 -0
  37. package/dist/service/cloudformation/terraform/sim-tf-attributes.js +121 -0
  38. package/dist/service/cloudformation/terraform/sim-tf-attributes.js.map +1 -0
  39. package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts +14 -0
  40. package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts.map +1 -0
  41. package/dist/service/cloudformation/terraform/sim-tf-map-config.js +36 -0
  42. package/dist/service/cloudformation/terraform/sim-tf-map-config.js.map +1 -0
  43. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts +15 -0
  44. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts.map +1 -0
  45. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js +74 -0
  46. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js.map +1 -0
  47. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts +5 -0
  48. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts.map +1 -0
  49. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js +32 -0
  50. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js.map +1 -0
  51. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts +12 -0
  52. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts.map +1 -0
  53. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js +52 -0
  54. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js.map +1 -0
  55. package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts +9 -0
  56. package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts.map +1 -0
  57. package/dist/service/cloudformation/terraform/sim-tf-map-iam.js +80 -0
  58. package/dist/service/cloudformation/terraform/sim-tf-map-iam.js.map +1 -0
  59. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts +19 -0
  60. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts.map +1 -0
  61. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js +90 -0
  62. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js.map +1 -0
  63. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts +5 -0
  64. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts.map +1 -0
  65. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js +12 -0
  66. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js.map +1 -0
  67. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts +5 -0
  68. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts.map +1 -0
  69. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js +32 -0
  70. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js.map +1 -0
  71. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts +9 -0
  72. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts.map +1 -0
  73. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js +48 -0
  74. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js.map +1 -0
  75. package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts +5 -0
  76. package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts.map +1 -0
  77. package/dist/service/cloudformation/terraform/sim-tf-map-s3.js +18 -0
  78. package/dist/service/cloudformation/terraform/sim-tf-map-s3.js.map +1 -0
  79. package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts +15 -0
  80. package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts.map +1 -0
  81. package/dist/service/cloudformation/terraform/sim-tf-map-sns.js +40 -0
  82. package/dist/service/cloudformation/terraform/sim-tf-map-sns.js.map +1 -0
  83. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts +5 -0
  84. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts.map +1 -0
  85. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js +56 -0
  86. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js.map +1 -0
  87. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts +41 -0
  88. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts.map +1 -0
  89. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js +2 -0
  90. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js.map +1 -0
  91. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts +19 -0
  92. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts.map +1 -0
  93. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js +63 -0
  94. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js.map +1 -0
  95. package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts +26 -0
  96. package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts.map +1 -0
  97. package/dist/service/cloudformation/terraform/sim-tf-plan-index.js +45 -0
  98. package/dist/service/cloudformation/terraform/sim-tf-plan-index.js.map +1 -0
  99. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts +39 -0
  100. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts.map +1 -0
  101. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js +44 -0
  102. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js.map +1 -0
  103. package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts +94 -0
  104. package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts.map +1 -0
  105. package/dist/service/cloudformation/terraform/sim-tf-plan.type.js +2 -0
  106. package/dist/service/cloudformation/terraform/sim-tf-plan.type.js.map +1 -0
  107. package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts +27 -0
  108. package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts.map +1 -0
  109. package/dist/service/cloudformation/terraform/sim-tf-reference-address.js +58 -0
  110. package/dist/service/cloudformation/terraform/sim-tf-reference-address.js.map +1 -0
  111. package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts +64 -0
  112. package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts.map +1 -0
  113. package/dist/service/cloudformation/terraform/sim-tf-reference.js +122 -0
  114. package/dist/service/cloudformation/terraform/sim-tf-reference.js.map +1 -0
  115. package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts +14 -0
  116. package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts.map +1 -0
  117. package/dist/service/cloudformation/terraform/sim-tf-registry.js +40 -0
  118. package/dist/service/cloudformation/terraform/sim-tf-registry.js.map +1 -0
  119. package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts +31 -0
  120. package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts.map +1 -0
  121. package/dist/service/cloudformation/terraform/sim-tf-report.type.js +2 -0
  122. package/dist/service/cloudformation/terraform/sim-tf-report.type.js.map +1 -0
  123. package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts +20 -0
  124. package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts.map +1 -0
  125. package/dist/service/cloudformation/terraform/sim-tf-template-folds.js +28 -0
  126. package/dist/service/cloudformation/terraform/sim-tf-template-folds.js.map +1 -0
  127. package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts +29 -0
  128. package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts.map +1 -0
  129. package/dist/service/cloudformation/terraform/sim-tf-template-graph.js +71 -0
  130. package/dist/service/cloudformation/terraform/sim-tf-template-graph.js.map +1 -0
  131. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts +23 -0
  132. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts.map +1 -0
  133. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js +72 -0
  134. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js.map +1 -0
  135. package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts +21 -0
  136. package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts.map +1 -0
  137. package/dist/service/cloudformation/terraform/sim-tf-template-merge.js +33 -0
  138. package/dist/service/cloudformation/terraform/sim-tf-template-merge.js.map +1 -0
  139. package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts +21 -0
  140. package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts.map +1 -0
  141. package/dist/service/cloudformation/terraform/sim-tf-template-prune.js +51 -0
  142. package/dist/service/cloudformation/terraform/sim-tf-template-prune.js.map +1 -0
  143. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts +18 -0
  144. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts.map +1 -0
  145. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js +23 -0
  146. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js.map +1 -0
  147. package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts +10 -0
  148. package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts.map +1 -0
  149. package/dist/service/cloudformation/terraform/sim-tf-template-references.js +39 -0
  150. package/dist/service/cloudformation/terraform/sim-tf-template-references.js.map +1 -0
  151. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts +12 -0
  152. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts.map +1 -0
  153. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js +17 -0
  154. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js.map +1 -0
  155. package/dist/service/cloudformation/terraform/sim-tf-template.d.ts +26 -0
  156. package/dist/service/cloudformation/terraform/sim-tf-template.d.ts.map +1 -0
  157. package/dist/service/cloudformation/terraform/sim-tf-template.js +54 -0
  158. package/dist/service/cloudformation/terraform/sim-tf-template.js.map +1 -0
  159. package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.d.ts +6 -0
  160. package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.d.ts.map +1 -1
  161. package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.js +8 -3
  162. package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.js.map +1 -1
  163. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts +2 -2
  164. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts.map +1 -1
  165. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.js.map +1 -1
  166. package/dist/util/filesystem/test-terraform-project.d.ts +56 -0
  167. package/dist/util/filesystem/test-terraform-project.d.ts.map +1 -0
  168. package/dist/util/filesystem/test-terraform-project.js +83 -0
  169. package/dist/util/filesystem/test-terraform-project.js.map +1 -0
  170. package/package.json +3 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-resolver.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAmB,EACnB,SAAuC;IAEvC,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAC/B,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,QAAQ,KAAK,WAAW;QACjC,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC/C,CAAC;IAEF,OAAO,IAAI,0BAA0B,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { CfnTemplateBodyRecord } from "../template/sim-cfn-template.js";
2
+ import type { TerraformPlan } from "./sim-tf-plan.type.js";
3
+ import type { TerraformImportReport } from "./sim-tf-report.type.js";
4
+ export interface TerraformImportResult {
5
+ readonly template: CfnTemplateBodyRecord;
6
+ readonly report: TerraformImportReport;
7
+ }
8
+ /**
9
+ * A CloudFormation template body built from a Terraform plan.
10
+ *
11
+ * The plan is the JSON `terraform show -json` writes for a saved plan file.
12
+ * What comes back is the body `deployTemplate` takes, so everything downstream
13
+ * of the template is the machinery a CloudFormation or SAM deployment already
14
+ * goes through.
15
+ *
16
+ * The report alongside it says what happened to every resource of the plan. A
17
+ * type with no mapping is skipped and named, in the same spirit as the skipped
18
+ * Resources a Stack records for a CloudFormation type no simulated service
19
+ * models.
20
+ *
21
+ * This is spike code, kept so the measurement behind it stays reproducible.
22
+ * The README beside it says what is known to need work before this is a
23
+ * feature, and nothing here is exported from the package.
24
+ */
25
+ export declare function cfnTemplateFromTerraformPlan(plan: TerraformPlan): TerraformImportResult;
26
+ //# sourceMappingURL=sim-tf-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,KAAK,EACV,qBAAqB,EAItB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,aAAa,GAClB,qBAAqB,CAoCvB"}
@@ -0,0 +1,54 @@
1
+ import { terraformPlanResources } from "./sim-tf-plan-resources.js";
2
+ import { mappableResolver } from "./sim-tf-template-resolver.js";
3
+ import { applyMappings } from "./sim-tf-template-mappings.js";
4
+ import { recordPrunedResources } from "./sim-tf-template-pruned.js";
5
+ import { applyFolds } from "./sim-tf-template-folds.js";
6
+ /**
7
+ * A CloudFormation template body built from a Terraform plan.
8
+ *
9
+ * The plan is the JSON `terraform show -json` writes for a saved plan file.
10
+ * What comes back is the body `deployTemplate` takes, so everything downstream
11
+ * of the template is the machinery a CloudFormation or SAM deployment already
12
+ * goes through.
13
+ *
14
+ * The report alongside it says what happened to every resource of the plan. A
15
+ * type with no mapping is skipped and named, in the same spirit as the skipped
16
+ * Resources a Stack records for a CloudFormation type no simulated service
17
+ * models.
18
+ *
19
+ * This is spike code, kept so the measurement behind it stays reproducible.
20
+ * The README beside it says what is known to need work before this is a
21
+ * feature, and nothing here is exported from the package.
22
+ */
23
+ export function cfnTemplateFromTerraformPlan(plan) {
24
+ const resources = terraformPlanResources(plan);
25
+ const resolver = mappableResolver(plan, resources);
26
+ const mapped = [];
27
+ const folded = [];
28
+ const skipped = [];
29
+ const lost = [];
30
+ const templates = new Map();
31
+ const claimedBy = new Map();
32
+ applyMappings({
33
+ resources,
34
+ resolver,
35
+ templates,
36
+ claimedBy,
37
+ mapped,
38
+ skipped,
39
+ lost,
40
+ });
41
+ applyFolds({ resources, resolver, templates, folded, skipped });
42
+ recordPrunedResources({ templates, claimedBy, mapped, skipped });
43
+ return {
44
+ template: { Resources: Object.fromEntries(templates) },
45
+ report: {
46
+ total: resources.length,
47
+ mapped,
48
+ folded,
49
+ skipped,
50
+ lost,
51
+ },
52
+ };
53
+ }
54
+ //# sourceMappingURL=sim-tf-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAaxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAmB;IAEnB,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAE/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,OAAO,GAA+B,EAAE,CAAC;IAC/C,MAAM,IAAI,GAA6B,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,aAAa,CAAC;QACZ,SAAS;QACT,QAAQ;QACR,SAAS;QACT,SAAS;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC;IAEH,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEhE,qBAAqB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEjE,OAAO;QACL,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QACtD,MAAM,EAAE;YACN,KAAK,EAAE,SAAS,CAAC,MAAM;YACvB,MAAM;YACN,MAAM;YACN,OAAO;YACP,IAAI;SACL;KACF,CAAC;AACJ,CAAC"}
@@ -54,6 +54,12 @@ export declare class SimCognitoHostedPasskeySignIn {
54
54
  /**
55
55
  * The user the presented credential signs in, having checked that this
56
56
  * user's passkey signed the challenge the pool issued.
57
+ *
58
+ * The user is resolved before the session is, because the form posts back
59
+ * whatever the page carried, and on a pool with `UsernameAttributes` that is
60
+ * the address the person signed in by rather than the username the pool
61
+ * generated. The session belongs to the user, so the username it is looked
62
+ * up by has to be the resolved one.
57
63
  */
58
64
  present(pool: SimCognitoUserPool, client: SimCognitoUserPoolClient, presented: SimCognitoPresentedPasskey): SimCognitoUser;
59
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cognito-hosted-passkey-sign-in.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAMpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAI/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,UAAU,uCAAuC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IAEjC,YAAY,UAAU,EAAE,uCAAuC,EAG9D;IAED;;;OAGG;IACH,GAAG,CACD,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,QAAQ,EAAE,MAAM,GACf,KAAK,CASP;IAED;;;OAGG;IACH,OAAO,CACL,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,SAAS,EAAE,0BAA0B,GACpC,cAAc,CAsBhB;IAED;;OAEG;IACH,OAAO,CAAC,SAAS;CAWlB"}
1
+ {"version":3,"file":"sim-cognito-hosted-passkey-sign-in.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAMpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAI/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,UAAU,uCAAuC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IAEjC,YAAY,UAAU,EAAE,uCAAuC,EAG9D;IAED;;;OAGG;IACH,GAAG,CACD,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,QAAQ,EAAE,MAAM,GACf,KAAK,CASP;IAED;;;;;;;;;OASG;IACH,OAAO,CACL,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,SAAS,EAAE,0BAA0B,GACpC,cAAc,CAqBhB;IAED;;OAEG;IACH,OAAO,CAAC,SAAS;CAWlB"}
@@ -42,17 +42,22 @@ export class SimCognitoHostedPasskeySignIn {
42
42
  /**
43
43
  * The user the presented credential signs in, having checked that this
44
44
  * user's passkey signed the challenge the pool issued.
45
+ *
46
+ * The user is resolved before the session is, because the form posts back
47
+ * whatever the page carried, and on a pool with `UsernameAttributes` that is
48
+ * the address the person signed in by rather than the username the pool
49
+ * generated. The session belongs to the user, so the username it is looked
50
+ * up by has to be the resolved one.
45
51
  */
46
52
  present(pool, client, presented) {
47
- const { username } = presented;
53
+ const user = this.signingIn(pool, client, presented.username);
48
54
  const session = pool.auth.requireSession({
49
55
  sessionId: presented.session,
50
- username,
56
+ username: user.username,
51
57
  clientId: client.id,
52
58
  challengeName: simCognitoWebAuthnChallenge,
53
59
  now: this.clock.now(),
54
60
  });
55
- const user = this.signingIn(pool, client, username);
56
61
  requireSimCognitoWebAuthnAssertion(user.webAuthn.credentials, new SimCognitoAuthParameters("the managed login form", {
57
62
  credential: presented.credential,
58
63
  }).requireDocument("credential"), session.requireWebAuthnOptions());
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cognito-hosted-passkey-sign-in.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAAE,kCAAkC,EAAE,MAAM,mEAAmE,CAAC;AACvH,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AA0B1F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,6BAA6B;IACvB,SAAS,CAAiC;IAC1C,KAAK,CAAW;IAEjC,YAAY,UAAmD;QAC7D,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,GAAG,CACD,IAAwB,EACxB,MAAgC,EAChC,QAAgB;QAEhB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAChC,EAAE,IAAI,EAAE,MAAM,E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OAAO;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,MAAM,CAAC,EAAE;YACnB,aAAa,EAAE,2BAA2B;YAC1C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC;QAEH,kCAAkC,CAChC,IAAI,CAAC,QAAQ,CAAC,WAAW,EACzB,IAAI,wBAAwB,CAAC,wBAAwB,EAAE;YACrD,UAAU,EAAE,SAAS,CAAC,UAAU;SACjC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,EAChC,OAAO,CAAC,sBAAsB,EAAE,CACjC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,SAAS,CACf,IAAwB,EACxB,MAAgC,EAChC,QAAgB;QAEhB,MAAM,IAAI,GAAG,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEjE,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- import type { SimCfnStack } from "../../cloudformation/stack/sim-cfn-stack.js";
1
+ import type { SimCfnDeployedStack } from "../../cloudformation/stack/sim-cfn-deployed-stack.type.js";
2
2
  /**
3
3
  * One stack Output, as the string an ELBv2 Resource answers with.
4
4
  *
@@ -6,5 +6,5 @@ import type { SimCfnStack } from "../../cloudformation/stack/sim-cfn-stack.js";
6
6
  * asking for it as a string here keeps each assertion about the value rather
7
7
  * than about what shape it came out in.
8
8
  */
9
- export declare function simCfnElbV2Output(stack: SimCfnStack, name: string): string;
9
+ export declare function simCfnElbV2Output(stack: SimCfnDeployedStack, name: string): string;
10
10
  //# sourceMappingURL=sim-cfn-elbv2.fixture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cfn-elbv2.fixture.d.ts","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1E"}
1
+ {"version":3,"file":"sim-cfn-elbv2.fixture.d.ts","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAErG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cfn-elbv2.fixture.js","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkB,EAAE,IAAY;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAE7C,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"sim-cfn-elbv2.fixture.js","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA0B,EAC1B,IAAY;IAEZ,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAE7C,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,56 @@
1
+ export interface TestTerraformProjectProperties {
2
+ /**
3
+ * Whether this configuration is expected to fail its `data` blocks.
4
+ *
5
+ * Only a configuration known to read AWS at plan time sets this, and it
6
+ * limits the tolerance to that one. Every other configuration treats a
7
+ * non-zero exit as the failure it is.
8
+ */
9
+ readonly toleratesDataSourceErrors?: boolean;
10
+ }
11
+ /**
12
+ * A Terraform configuration under `test/terraform`, planned on demand.
13
+ *
14
+ * The plan JSON a Terraform import reads runs to thousands of lines, and the
15
+ * configuration behind it runs to tens. Only the configuration is in the
16
+ * repository, and this produces the plan from it the way `TestCdkProject`
17
+ * produces a cloud assembly from a CDK app.
18
+ *
19
+ * `terraform init` downloads the AWS provider, which is one binary of about
20
+ * 650MB. That is far too slow to sit inside a test, so it is left to
21
+ * `pnpm tf:init` and to the workflow step that caches it. A configuration that
22
+ * has never been initialised is reported rather than initialised here.
23
+ */
24
+ export declare class TestTerraformProject {
25
+ readonly name: string;
26
+ private readonly directory;
27
+ private readonly toleratesDataSourceErrors;
28
+ constructor(name: string, properties?: TestTerraformProjectProperties);
29
+ /**
30
+ * The plan JSON for this configuration, as `terraform show -json` writes it.
31
+ *
32
+ * The plan file goes to a temporary directory rather than into the
33
+ * configuration, so a run leaves the repository as it found it.
34
+ */
35
+ planJson(): Promise<unknown>;
36
+ /**
37
+ * Write the plan file.
38
+ *
39
+ * A configuration reading a `data` block that calls AWS cannot be planned
40
+ * offline. Terraform reports each one as an error and exits non-zero, and it
41
+ * still writes a plan covering the managed resources, which are what an
42
+ * import reads. A configuration expecting that says so. Every other failure
43
+ * is a failure, so a broken configuration cannot pass as a partial plan.
44
+ */
45
+ private plan;
46
+ private show;
47
+ /**
48
+ * Fail with what to run, rather than with what Terraform says.
49
+ *
50
+ * Terraform's own message for an uninitialised directory names a command
51
+ * that would work and say nothing about the provider cache this repository
52
+ * shares between its two configurations.
53
+ */
54
+ private requireInitialised;
55
+ }
56
+ //# sourceMappingURL=test-terraform-project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-terraform-project.d.ts","sourceRoot":"","sources":["../../../src/util/filesystem/test-terraform-project.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;aAKb,IAAI,EAAE,MAAM;IAJ9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAU;IAEpD,YACkB,IAAI,EAAE,MAAM,EAC5B,UAAU,GAAE,8BAAmC,EAKhD;IAED;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAUjC;IAED;;;;;;;;OAQG;YACW,IAAI;YAmBJ,IAAI;IAUlB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAY3B"}
@@ -0,0 +1,83 @@
1
+ import { existsSync } from "node:fs";
2
+ import { execa } from "execa";
3
+ import { repoPath } from "./path.js";
4
+ import { TemporaryDirectory } from "./temporary-directory.js";
5
+ /**
6
+ * A Terraform configuration under `test/terraform`, planned on demand.
7
+ *
8
+ * The plan JSON a Terraform import reads runs to thousands of lines, and the
9
+ * configuration behind it runs to tens. Only the configuration is in the
10
+ * repository, and this produces the plan from it the way `TestCdkProject`
11
+ * produces a cloud assembly from a CDK app.
12
+ *
13
+ * `terraform init` downloads the AWS provider, which is one binary of about
14
+ * 650MB. That is far too slow to sit inside a test, so it is left to
15
+ * `pnpm tf:init` and to the workflow step that caches it. A configuration that
16
+ * has never been initialised is reported rather than initialised here.
17
+ */
18
+ export class TestTerraformProject {
19
+ name;
20
+ directory;
21
+ toleratesDataSourceErrors;
22
+ constructor(name, properties = {}) {
23
+ this.name = name;
24
+ this.directory = repoPath(`test/terraform/${name}`);
25
+ this.toleratesDataSourceErrors =
26
+ properties.toleratesDataSourceErrors ?? false;
27
+ }
28
+ /**
29
+ * The plan JSON for this configuration, as `terraform show -json` writes it.
30
+ *
31
+ * The plan file goes to a temporary directory rather than into the
32
+ * configuration, so a run leaves the repository as it found it.
33
+ */
34
+ async planJson() {
35
+ this.requireInitialised();
36
+ const output = new TemporaryDirectory();
37
+ await output.resolvePath();
38
+ const planFile = output.join(`${this.name}.tfplan`);
39
+ await this.plan(planFile);
40
+ return JSON.parse(await this.show(planFile));
41
+ }
42
+ /**
43
+ * Write the plan file.
44
+ *
45
+ * A configuration reading a `data` block that calls AWS cannot be planned
46
+ * offline. Terraform reports each one as an error and exits non-zero, and it
47
+ * still writes a plan covering the managed resources, which are what an
48
+ * import reads. A configuration expecting that says so. Every other failure
49
+ * is a failure, so a broken configuration cannot pass as a partial plan.
50
+ */
51
+ async plan(planFile) {
52
+ const result = await execa("terraform", [`-chdir=${this.directory}`, "plan", "-input=false", "-out", planFile], { env: { TF_IN_AUTOMATION: "1" }, reject: false });
53
+ if (result.exitCode === 0) {
54
+ return;
55
+ }
56
+ // oxlint-disable-next-line security/detect-non-literal-fs-filename
57
+ if (this.toleratesDataSourceErrors && existsSync(planFile)) {
58
+ return;
59
+ }
60
+ throw new Error(`terraform plan failed for ${this.name}: ${result.stderr}`);
61
+ }
62
+ async show(planFile) {
63
+ const { stdout } = await execa("terraform", [`-chdir=${this.directory}`, "show", "-json", planFile], { env: { TF_IN_AUTOMATION: "1" } });
64
+ return stdout;
65
+ }
66
+ /**
67
+ * Fail with what to run, rather than with what Terraform says.
68
+ *
69
+ * Terraform's own message for an uninitialised directory names a command
70
+ * that would work and say nothing about the provider cache this repository
71
+ * shares between its two configurations.
72
+ */
73
+ requireInitialised() {
74
+ // oxlint-disable-next-line security/detect-non-literal-fs-filename
75
+ if (existsSync(`${this.directory}/.terraform`)) {
76
+ return;
77
+ }
78
+ throw new Error(`Terraform configuration ${this.name} is not initialised. ` +
79
+ `Run \`pnpm tf:init\` first. It downloads the AWS provider, which ` +
80
+ `takes a few minutes the first time and nothing afterwards.`);
81
+ }
82
+ }
83
+ //# sourceMappingURL=test-terraform-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-terraform-project.js","sourceRoot":"","sources":["../../../src/util/filesystem/test-terraform-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAa9D;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAoB;IAKb,IAAI;IAJL,SAAS,CAAS;IAClB,yBAAyB,CAAU;IAEpD,YACkB,IAAY,EAC5B,UAAU,GAAmC,EAAE;oBAD/B,IAAI;QAGpB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,yBAAyB;YAC5B,UAAU,CAAC,yBAAyB,IAAI,KAAK,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,MAAM,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACxC,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC;QAEpD,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAY,CAAC;IAC1D,CAAC;IAED;;;;;;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+ "version": "1.19.2",
4
4
  "description": "AWS system behaviour simulation for isolated unit testing",
5
5
  "repository": "https://github.com/KensioSoftware/yulin",
6
6
  "homepage": "https://yulinsim.dev/",
@@ -28,7 +28,8 @@
28
28
  "examples:lint": "oxlint --type-aware --max-warnings=0 docs",
29
29
  "examples:check": "pnpm examples:extract && pnpm examples:tsc && pnpm examples:lint",
30
30
  "fta": "./scripts/sh/fta.sh",
31
- "check": "pnpm fmt && pnpm fta && pnpm build:check && pnpm examples:check && pnpm test:coverage"
31
+ "check": "pnpm fmt && pnpm fta && pnpm build:check && pnpm examples:check && pnpm test:coverage",
32
+ "tf:init": "./scripts/sh/tf-init.sh"
32
33
  },
33
34
  "keywords": [
34
35
  "aws",