alchemy-effect 0.5.0 → 0.6.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 (1149) hide show
  1. package/bin/alchemy-effect.js +7155 -17689
  2. package/bin/alchemy-effect.js.map +1 -1
  3. package/bin/alchemy-effect.sh +14 -0
  4. package/bin/alchemy-effect.ts +644 -130
  5. package/bin/process-manager.ts +10 -0
  6. package/lib/cli/index.d.ts +207 -378
  7. package/lib/cli/index.d.ts.map +1 -1
  8. package/lib/cli/index.js +4134 -985
  9. package/lib/cli/index.js.map +1 -1
  10. package/package.json +165 -103
  11. package/src/AWS/ACM/Certificate.ts +502 -0
  12. package/src/AWS/ACM/index.ts +1 -0
  13. package/src/AWS/AGENTS.md +505 -0
  14. package/src/AWS/Account.ts +56 -0
  15. package/src/AWS/Assets.ts +182 -0
  16. package/src/AWS/AutoScaling/AutoScalingGroup.ts +440 -0
  17. package/src/AWS/AutoScaling/LaunchTemplate.ts +535 -0
  18. package/src/AWS/AutoScaling/ScalingPolicy.ts +232 -0
  19. package/src/AWS/AutoScaling/index.ts +3 -0
  20. package/src/AWS/Bootstrap.ts +281 -0
  21. package/src/AWS/CloudFront/Distribution.ts +952 -0
  22. package/src/AWS/CloudFront/Function.ts +374 -0
  23. package/src/AWS/CloudFront/Invalidation.ts +202 -0
  24. package/src/AWS/CloudFront/KeyValueStore.ts +216 -0
  25. package/src/AWS/CloudFront/KvEntries.ts +250 -0
  26. package/src/AWS/CloudFront/KvRoutesUpdate.ts +301 -0
  27. package/src/AWS/CloudFront/ManagedPolicies.ts +20 -0
  28. package/src/AWS/CloudFront/OriginAccessControl.ts +266 -0
  29. package/src/AWS/CloudFront/common.ts +55 -0
  30. package/src/AWS/CloudFront/index.ts +15 -0
  31. package/src/AWS/CloudWatch/Alarm.ts +198 -0
  32. package/src/AWS/CloudWatch/AlarmMuteRule.ts +183 -0
  33. package/src/AWS/CloudWatch/AnomalyDetector.ts +242 -0
  34. package/src/AWS/CloudWatch/CompositeAlarm.ts +198 -0
  35. package/src/AWS/CloudWatch/Dashboard.ts +262 -0
  36. package/src/AWS/CloudWatch/DescribeAlarmContributors.ts +79 -0
  37. package/src/AWS/CloudWatch/DescribeAlarmHistory.ts +66 -0
  38. package/src/AWS/CloudWatch/DescribeAlarms.ts +94 -0
  39. package/src/AWS/CloudWatch/DescribeAlarmsForMetric.ts +66 -0
  40. package/src/AWS/CloudWatch/DescribeAnomalyDetectors.ts +68 -0
  41. package/src/AWS/CloudWatch/DescribeInsightRules.ts +66 -0
  42. package/src/AWS/CloudWatch/DisableAlarmActions.ts +74 -0
  43. package/src/AWS/CloudWatch/DisableInsightRules.ts +74 -0
  44. package/src/AWS/CloudWatch/EnableAlarmActions.ts +74 -0
  45. package/src/AWS/CloudWatch/GetAlarmMuteRule.ts +75 -0
  46. package/src/AWS/CloudWatch/GetDashboard.ts +75 -0
  47. package/src/AWS/CloudWatch/GetInsightRuleReport.ts +76 -0
  48. package/src/AWS/CloudWatch/GetMetricData.ts +62 -0
  49. package/src/AWS/CloudWatch/GetMetricStatistics.ts +64 -0
  50. package/src/AWS/CloudWatch/GetMetricStream.ts +75 -0
  51. package/src/AWS/CloudWatch/GetMetricWidgetImage.ts +66 -0
  52. package/src/AWS/CloudWatch/InsightRule.ts +277 -0
  53. package/src/AWS/CloudWatch/ListAlarmMuteRules.ts +64 -0
  54. package/src/AWS/CloudWatch/ListDashboards.ts +62 -0
  55. package/src/AWS/CloudWatch/ListManagedInsightRules.ts +68 -0
  56. package/src/AWS/CloudWatch/ListMetricStreams.ts +64 -0
  57. package/src/AWS/CloudWatch/ListMetrics.ts +62 -0
  58. package/src/AWS/CloudWatch/ListTagsForResource.ts +79 -0
  59. package/src/AWS/CloudWatch/MetricStream.ts +262 -0
  60. package/src/AWS/CloudWatch/PutMetricData.ts +62 -0
  61. package/src/AWS/CloudWatch/SetAlarmState.ts +73 -0
  62. package/src/AWS/CloudWatch/alarmStateChanges.ts +24 -0
  63. package/src/AWS/CloudWatch/binding-common.ts +42 -0
  64. package/src/AWS/CloudWatch/common.ts +168 -0
  65. package/src/AWS/CloudWatch/index.ts +32 -0
  66. package/src/AWS/Context.ts +30 -0
  67. package/src/AWS/Credentials.ts +52 -0
  68. package/src/AWS/DynamoDB/AttributeValue.ts +250 -0
  69. package/src/AWS/DynamoDB/BatchExecuteStatement.ts +113 -0
  70. package/src/AWS/DynamoDB/BatchGetItem.ts +138 -0
  71. package/src/AWS/DynamoDB/BatchWriteItem.ts +144 -0
  72. package/src/AWS/DynamoDB/DeleteItem.ts +67 -0
  73. package/src/AWS/DynamoDB/DescribeTable.ts +69 -0
  74. package/src/AWS/DynamoDB/DescribeTimeToLive.ts +72 -0
  75. package/src/AWS/DynamoDB/ExecuteStatement.ts +91 -0
  76. package/src/AWS/DynamoDB/ExecuteTransaction.ts +77 -0
  77. package/src/AWS/DynamoDB/GetItem.ts +85 -0
  78. package/src/AWS/DynamoDB/ListTables.ts +56 -0
  79. package/src/AWS/DynamoDB/ListTagsOfResource.ts +72 -0
  80. package/src/AWS/DynamoDB/ProjectionExpression.ts +159 -0
  81. package/src/AWS/DynamoDB/PutItem.ts +67 -0
  82. package/src/AWS/DynamoDB/Query.ts +68 -0
  83. package/src/AWS/DynamoDB/RestoreTableToPointInTime.ts +94 -0
  84. package/src/AWS/DynamoDB/Scan.ts +68 -0
  85. package/src/AWS/DynamoDB/Stream.ts +94 -0
  86. package/src/AWS/DynamoDB/Table.ts +1175 -0
  87. package/src/AWS/DynamoDB/TransactGetItems.ts +154 -0
  88. package/src/AWS/DynamoDB/TransactWriteItems.ts +216 -0
  89. package/src/AWS/DynamoDB/UpdateItem.ts +67 -0
  90. package/src/AWS/DynamoDB/UpdateTimeToLive.ts +71 -0
  91. package/src/AWS/DynamoDB/index.ts +24 -0
  92. package/src/AWS/EC2/EIP.ts +285 -0
  93. package/src/AWS/EC2/EgressOnlyInternetGateway.ts +248 -0
  94. package/src/AWS/EC2/Image.ts +108 -0
  95. package/src/AWS/EC2/Instance.ts +877 -0
  96. package/src/AWS/EC2/InternetGateway.ts +382 -0
  97. package/src/AWS/EC2/NatGateway.ts +474 -0
  98. package/src/AWS/EC2/Network.ts +459 -0
  99. package/src/AWS/EC2/NetworkAcl.ts +247 -0
  100. package/src/AWS/EC2/NetworkAclAssociation.ts +206 -0
  101. package/src/AWS/EC2/NetworkAclEntry.ts +300 -0
  102. package/src/AWS/EC2/Route.ts +323 -0
  103. package/src/AWS/EC2/RouteTable.ts +448 -0
  104. package/src/AWS/EC2/RouteTableAssociation.ts +274 -0
  105. package/src/AWS/EC2/SecurityGroup.ts +552 -0
  106. package/src/AWS/EC2/SecurityGroupRule.ts +395 -0
  107. package/src/AWS/EC2/Subnet.ts +583 -0
  108. package/src/AWS/EC2/Vpc.ts +455 -0
  109. package/src/AWS/EC2/VpcEndpoint.ts +657 -0
  110. package/src/AWS/EC2/hosted.ts +891 -0
  111. package/src/AWS/EC2/index.ts +18 -0
  112. package/src/AWS/ECR/Repository.ts +254 -0
  113. package/src/AWS/ECR/index.ts +1 -0
  114. package/src/AWS/ECS/Cluster.ts +257 -0
  115. package/src/AWS/ECS/DescribeTasks.ts +67 -0
  116. package/src/AWS/ECS/ListTasks.ts +67 -0
  117. package/src/AWS/ECS/RunTask.ts +82 -0
  118. package/src/AWS/ECS/Schedule.ts +115 -0
  119. package/src/AWS/ECS/Service.ts +572 -0
  120. package/src/AWS/ECS/StopTask.ts +64 -0
  121. package/src/AWS/ECS/Task.ts +981 -0
  122. package/src/AWS/ECS/index.ts +28 -0
  123. package/src/AWS/EKS/AccessEntry.ts +382 -0
  124. package/src/AWS/EKS/Addon.ts +385 -0
  125. package/src/AWS/EKS/AutoCluster.ts +288 -0
  126. package/src/AWS/EKS/Cluster.ts +655 -0
  127. package/src/AWS/EKS/LoadBalancedWorkload.ts +76 -0
  128. package/src/AWS/EKS/PodIdentityAssociation.ts +354 -0
  129. package/src/AWS/EKS/PodIdentityServiceAccount.ts +156 -0
  130. package/src/AWS/EKS/PodIdentityWorkload.ts +185 -0
  131. package/src/AWS/EKS/Workload.ts +145 -0
  132. package/src/AWS/EKS/index.ts +9 -0
  133. package/src/AWS/ELBv2/Listener.ts +139 -0
  134. package/src/AWS/ELBv2/LoadBalancer.ts +227 -0
  135. package/src/AWS/ELBv2/TargetGroup.ts +209 -0
  136. package/src/AWS/ELBv2/index.ts +3 -0
  137. package/src/AWS/Endpoint.ts +16 -0
  138. package/src/AWS/EventBridge/DescribeEventBus.ts +71 -0
  139. package/src/AWS/EventBridge/DescribeRule.ts +73 -0
  140. package/src/AWS/EventBridge/EventBus.ts +273 -0
  141. package/src/AWS/EventBridge/EventSource.ts +146 -0
  142. package/src/AWS/EventBridge/ListEventBuses.ts +60 -0
  143. package/src/AWS/EventBridge/ListRules.ts +87 -0
  144. package/src/AWS/EventBridge/ListTargetsByRule.ts +76 -0
  145. package/src/AWS/EventBridge/Permission.ts +151 -0
  146. package/src/AWS/EventBridge/PutEvents.ts +91 -0
  147. package/src/AWS/EventBridge/Rule.ts +620 -0
  148. package/src/AWS/EventBridge/TestEventPattern.ts +60 -0
  149. package/src/AWS/EventBridge/ToEcsTask.ts +118 -0
  150. package/src/AWS/EventBridge/ToLambda.ts +87 -0
  151. package/src/AWS/EventBridge/ToQueue.ts +97 -0
  152. package/src/AWS/EventBridge/index.ts +14 -0
  153. package/src/AWS/IAM/AccessKey.ts +142 -0
  154. package/src/AWS/IAM/AccountAlias.ts +96 -0
  155. package/src/AWS/IAM/AccountPasswordPolicy.ts +64 -0
  156. package/src/AWS/IAM/Group.ts +357 -0
  157. package/src/AWS/IAM/GroupMembership.ts +142 -0
  158. package/src/AWS/IAM/InstanceProfile.ts +285 -0
  159. package/src/AWS/IAM/LoginProfile.ts +137 -0
  160. package/src/AWS/IAM/OpenIDConnectProvider.ts +192 -0
  161. package/src/AWS/IAM/Policy.ts +387 -0
  162. package/src/AWS/IAM/Role.ts +500 -0
  163. package/src/AWS/IAM/SAMLProvider.ts +165 -0
  164. package/src/AWS/IAM/SSHPublicKey.ts +148 -0
  165. package/src/AWS/IAM/ServerCertificate.ts +261 -0
  166. package/src/AWS/IAM/ServiceSpecificCredential.ts +172 -0
  167. package/src/AWS/IAM/SigningCertificate.ts +137 -0
  168. package/src/AWS/IAM/User.ts +436 -0
  169. package/src/AWS/IAM/VirtualMFADevice.ts +259 -0
  170. package/src/AWS/IAM/common.ts +89 -0
  171. package/src/AWS/IAM/index.ts +40 -0
  172. package/src/AWS/IdentityCenter/AccountAssignment.ts +290 -0
  173. package/src/AWS/IdentityCenter/Group.ts +211 -0
  174. package/src/AWS/IdentityCenter/Instance.ts +190 -0
  175. package/src/AWS/IdentityCenter/PermissionSet.ts +235 -0
  176. package/src/AWS/IdentityCenter/common.ts +117 -0
  177. package/src/AWS/IdentityCenter/index.ts +4 -0
  178. package/src/AWS/Kinesis/DescribeAccountSettings.ts +63 -0
  179. package/src/AWS/Kinesis/DescribeLimits.ts +59 -0
  180. package/src/AWS/Kinesis/DescribeStream.ts +69 -0
  181. package/src/AWS/Kinesis/DescribeStreamConsumer.ts +72 -0
  182. package/src/AWS/Kinesis/DescribeStreamSummary.ts +72 -0
  183. package/src/AWS/Kinesis/GetRecords.ts +59 -0
  184. package/src/AWS/Kinesis/GetResourcePolicy.ts +72 -0
  185. package/src/AWS/Kinesis/GetShardIterator.ts +71 -0
  186. package/src/AWS/Kinesis/ListShards.ts +66 -0
  187. package/src/AWS/Kinesis/ListStreamConsumers.ts +72 -0
  188. package/src/AWS/Kinesis/ListStreams.ts +56 -0
  189. package/src/AWS/Kinesis/ListTagsForResource.ts +78 -0
  190. package/src/AWS/Kinesis/PutRecord.ts +67 -0
  191. package/src/AWS/Kinesis/PutRecords.ts +67 -0
  192. package/src/AWS/Kinesis/Stream.ts +731 -0
  193. package/src/AWS/Kinesis/StreamConsumer.ts +325 -0
  194. package/src/AWS/Kinesis/StreamEventSource.ts +106 -0
  195. package/src/AWS/Kinesis/StreamSink.ts +68 -0
  196. package/src/AWS/Kinesis/SubscribeToShard.ts +71 -0
  197. package/src/AWS/Kinesis/index.ts +19 -0
  198. package/src/AWS/Lambda/BucketEventSource.ts +146 -0
  199. package/src/AWS/Lambda/EventBridgeEventSource.ts +183 -0
  200. package/src/AWS/Lambda/EventSourceMapping.ts +438 -0
  201. package/src/AWS/Lambda/Function.ts +1185 -0
  202. package/src/AWS/Lambda/HttpServer.ts +125 -0
  203. package/src/AWS/Lambda/InvokeFunction.ts +67 -0
  204. package/src/AWS/Lambda/Permission.ts +217 -0
  205. package/src/AWS/Lambda/QueueEventSource.ts +96 -0
  206. package/src/AWS/Lambda/StreamEventSource.ts +123 -0
  207. package/src/AWS/Lambda/TableEventSource.ts +156 -0
  208. package/src/AWS/Lambda/TopicEventSource.ts +105 -0
  209. package/src/AWS/Lambda/index.ts +13 -0
  210. package/src/AWS/Logs/LogGroup.ts +209 -0
  211. package/src/AWS/Logs/index.ts +1 -0
  212. package/src/AWS/Organizations/Account.ts +328 -0
  213. package/src/AWS/Organizations/DelegatedAdministrator.ts +158 -0
  214. package/src/AWS/Organizations/Organization.ts +179 -0
  215. package/src/AWS/Organizations/OrganizationResourcePolicy.ts +108 -0
  216. package/src/AWS/Organizations/OrganizationalUnit.ts +268 -0
  217. package/src/AWS/Organizations/Policy.ts +241 -0
  218. package/src/AWS/Organizations/PolicyAttachment.ts +130 -0
  219. package/src/AWS/Organizations/Root.ts +151 -0
  220. package/src/AWS/Organizations/RootPolicyType.ts +130 -0
  221. package/src/AWS/Organizations/TenantRoot.ts +506 -0
  222. package/src/AWS/Organizations/TrustedServiceAccess.ts +107 -0
  223. package/src/AWS/Organizations/common.ts +130 -0
  224. package/src/AWS/Organizations/index.ts +11 -0
  225. package/src/AWS/Profile.ts +5 -0
  226. package/src/AWS/Providers.ts +324 -0
  227. package/src/AWS/RDS/Aurora.ts +499 -0
  228. package/src/AWS/RDS/Connect.ts +127 -0
  229. package/src/AWS/RDS/DBCluster.ts +361 -0
  230. package/src/AWS/RDS/DBClusterEndpoint.ts +226 -0
  231. package/src/AWS/RDS/DBClusterParameterGroup.ts +195 -0
  232. package/src/AWS/RDS/DBInstance.ts +274 -0
  233. package/src/AWS/RDS/DBParameterGroup.ts +190 -0
  234. package/src/AWS/RDS/DBProxy.ts +257 -0
  235. package/src/AWS/RDS/DBProxyEndpoint.ts +255 -0
  236. package/src/AWS/RDS/DBProxyTargetGroup.ts +243 -0
  237. package/src/AWS/RDS/DBSubnetGroup.ts +208 -0
  238. package/src/AWS/RDS/index.ts +11 -0
  239. package/src/AWS/RDSData/BatchExecuteStatement.ts +103 -0
  240. package/src/AWS/RDSData/BeginTransaction.ts +97 -0
  241. package/src/AWS/RDSData/CommitTransaction.ts +102 -0
  242. package/src/AWS/RDSData/ExecuteSql.ts +98 -0
  243. package/src/AWS/RDSData/ExecuteStatement.ts +99 -0
  244. package/src/AWS/RDSData/RollbackTransaction.ts +105 -0
  245. package/src/AWS/RDSData/index.ts +6 -0
  246. package/src/AWS/Region.ts +77 -0
  247. package/src/AWS/Route53/Record.ts +342 -0
  248. package/src/AWS/Route53/index.ts +1 -0
  249. package/src/AWS/S3/AbortMultipartUpload.ts +73 -0
  250. package/src/AWS/S3/Bucket.ts +550 -0
  251. package/src/AWS/S3/BucketEventSource.ts +26 -0
  252. package/src/AWS/S3/BucketNotifications.ts +77 -0
  253. package/src/AWS/S3/CompleteMultipartUpload.ts +73 -0
  254. package/src/AWS/S3/CopyObject.ts +68 -0
  255. package/src/AWS/S3/CreateMultipartUpload.ts +73 -0
  256. package/src/AWS/S3/DeleteObject.ts +67 -0
  257. package/src/AWS/S3/GetObject.ts +74 -0
  258. package/src/AWS/S3/HeadObject.ts +67 -0
  259. package/src/AWS/S3/ListObjectsV2.ts +67 -0
  260. package/src/AWS/S3/PutObject.ts +83 -0
  261. package/src/AWS/S3/S3Event.ts +43 -0
  262. package/src/AWS/S3/UploadPart.ts +67 -0
  263. package/src/AWS/S3/index.ts +14 -0
  264. package/src/AWS/SNS/AddPermission.ts +66 -0
  265. package/src/AWS/SNS/ConfirmSubscription.ts +72 -0
  266. package/src/AWS/SNS/GetDataProtectionPolicy.ts +72 -0
  267. package/src/AWS/SNS/GetSubscriptionAttributes.ts +72 -0
  268. package/src/AWS/SNS/GetTopicAttributes.ts +70 -0
  269. package/src/AWS/SNS/ListSubscriptions.ts +60 -0
  270. package/src/AWS/SNS/ListSubscriptionsByTopic.ts +72 -0
  271. package/src/AWS/SNS/ListTagsForResource.ts +72 -0
  272. package/src/AWS/SNS/ListTopics.ts +56 -0
  273. package/src/AWS/SNS/Publish.ts +66 -0
  274. package/src/AWS/SNS/PublishBatch.ts +66 -0
  275. package/src/AWS/SNS/PutDataProtectionPolicy.ts +72 -0
  276. package/src/AWS/SNS/RemovePermission.ts +66 -0
  277. package/src/AWS/SNS/SetSubscriptionAttributes.ts +72 -0
  278. package/src/AWS/SNS/SetTopicAttributes.ts +70 -0
  279. package/src/AWS/SNS/Subscription.ts +305 -0
  280. package/src/AWS/SNS/TagResource.ts +66 -0
  281. package/src/AWS/SNS/Topic.ts +363 -0
  282. package/src/AWS/SNS/TopicEventSource.ts +42 -0
  283. package/src/AWS/SNS/TopicSink.ts +61 -0
  284. package/src/AWS/SNS/UntagResource.ts +66 -0
  285. package/src/AWS/SNS/index.ts +21 -0
  286. package/src/AWS/SQS/DeleteMessage.ts +67 -0
  287. package/src/AWS/SQS/DeleteMessageBatch.ts +72 -0
  288. package/src/AWS/SQS/Queue.ts +210 -0
  289. package/src/AWS/SQS/QueueEventSource.ts +57 -0
  290. package/src/AWS/SQS/QueueSink.ts +62 -0
  291. package/src/AWS/SQS/ReceiveMessage.ts +68 -0
  292. package/src/AWS/SQS/SendMessage.ts +69 -0
  293. package/src/AWS/SQS/SendMessageBatch.ts +67 -0
  294. package/src/AWS/SQS/index.ts +8 -0
  295. package/src/AWS/Scheduler/Schedule.ts +296 -0
  296. package/src/AWS/Scheduler/ScheduleGroup.ts +186 -0
  297. package/src/AWS/Scheduler/builders.ts +229 -0
  298. package/src/AWS/Scheduler/index.ts +3 -0
  299. package/src/AWS/SecretsManager/DescribeSecret.ts +66 -0
  300. package/src/AWS/SecretsManager/GetRandomPassword.ts +65 -0
  301. package/src/AWS/SecretsManager/GetSecretValue.ts +78 -0
  302. package/src/AWS/SecretsManager/ListSecrets.ts +62 -0
  303. package/src/AWS/SecretsManager/PutSecretValue.ts +78 -0
  304. package/src/AWS/SecretsManager/Secret.ts +318 -0
  305. package/src/AWS/SecretsManager/index.ts +6 -0
  306. package/src/AWS/StageConfig.ts +44 -0
  307. package/src/AWS/Website/AssetDeployment.ts +348 -0
  308. package/src/AWS/Website/Router.ts +384 -0
  309. package/src/AWS/Website/SsrSite.ts +393 -0
  310. package/src/AWS/Website/StaticSite.ts +611 -0
  311. package/src/AWS/Website/cfcode.ts +180 -0
  312. package/src/AWS/Website/index.ts +5 -0
  313. package/src/AWS/Website/shared.ts +223 -0
  314. package/src/AWS/index.ts +37 -0
  315. package/src/AdoptPolicy.ts +25 -0
  316. package/src/Agent/Agent.ts +26 -0
  317. package/src/Agent/Aspect.ts +173 -0
  318. package/src/Agent/AspectGraph.ts +98 -0
  319. package/src/Agent/ContextPlugin.ts +18 -0
  320. package/src/Agent/Plugin.ts +29 -0
  321. package/src/Agent/chat/channel.ts +26 -0
  322. package/src/Agent/chat/event.ts +43 -0
  323. package/src/Agent/chat/message.ts +35 -0
  324. package/src/Agent/chat/service.ts +133 -0
  325. package/src/Agent/chat/thread.ts +17 -0
  326. package/src/Agent/coding/bash.ts +198 -0
  327. package/src/Agent/coding/edit.ts +152 -0
  328. package/src/Agent/coding/glob.ts +97 -0
  329. package/src/Agent/coding/grep.ts +144 -0
  330. package/src/Agent/coding/index.ts +7 -0
  331. package/src/Agent/coding/read.ts +119 -0
  332. package/src/Agent/coding/readlints.ts +78 -0
  333. package/src/Agent/coding/write.ts +79 -0
  334. package/src/Agent/fs/file.ts +22 -0
  335. package/src/Agent/fs/folder.ts +16 -0
  336. package/src/Agent/index.ts +9 -0
  337. package/src/Agent/llm/error.ts +330 -0
  338. package/src/Agent/llm/index.ts +4 -0
  339. package/src/Agent/llm/llm.ts +131 -0
  340. package/src/Agent/llm/stream-collectors.ts +58 -0
  341. package/src/Agent/llm/stream-text-part.ts +7 -0
  342. package/src/Agent/lsp/client.ts +293 -0
  343. package/src/Agent/lsp/diagnostics.ts +64 -0
  344. package/src/Agent/lsp/jsonrpc.ts +317 -0
  345. package/src/Agent/lsp/manager.ts +213 -0
  346. package/src/Agent/lsp/servers.ts +37 -0
  347. package/src/Agent/process/driver.ts +168 -0
  348. package/src/Agent/process/issue-service.ts +48 -0
  349. package/src/Agent/process/issue-tools.ts +33 -0
  350. package/src/Agent/process/issue.ts +22 -0
  351. package/src/Agent/process/organization.ts +16 -0
  352. package/src/Agent/process/process.ts +16 -0
  353. package/src/Agent/process/reply.ts +21 -0
  354. package/src/Agent/process/task.ts +34 -0
  355. package/src/Agent/tool/index.ts +3 -0
  356. package/src/Agent/tool/parameter.ts +35 -0
  357. package/src/Agent/tool/result.ts +51 -0
  358. package/src/Agent/tool/tool.ts +74 -0
  359. package/src/Agent/util/command-validator.ts +98 -0
  360. package/src/Agent/util/exec.ts +18 -0
  361. package/src/Agent/util/parser.ts +39 -0
  362. package/src/Agent/util/replace.ts +559 -0
  363. package/src/Agent/util/ripgrep.ts +256 -0
  364. package/src/Apply.ts +1074 -0
  365. package/src/Binding.ts +193 -0
  366. package/src/Build/Command.ts +322 -0
  367. package/src/Build/index.ts +1 -0
  368. package/src/Bundle/Bundle.ts +215 -0
  369. package/src/Bundle/Docker.ts +213 -0
  370. package/src/Bundle/TempRoot.ts +104 -0
  371. package/src/Bundle/index.ts +3 -0
  372. package/src/Cli/Cli.ts +23 -0
  373. package/src/Cli/Event.ts +32 -0
  374. package/src/Cli/InkCLI.tsx +60 -0
  375. package/src/Cli/NamespaceTree.ts +199 -0
  376. package/src/Cli/Reporter.ts +8 -0
  377. package/src/Cli/components/ApprovePlan.tsx +44 -0
  378. package/src/Cli/components/Plan.tsx +148 -0
  379. package/src/Cli/components/PlanProgress.tsx +325 -0
  380. package/src/Cli/index.ts +2 -0
  381. package/src/Cloudflare/Account.ts +38 -0
  382. package/src/Cloudflare/Container.ts +1345 -0
  383. package/src/Cloudflare/KV/Delete.ts +38 -0
  384. package/src/Cloudflare/KV/Get.ts +40 -0
  385. package/src/Cloudflare/KV/GetWithMetadata.ts +54 -0
  386. package/src/Cloudflare/KV/List.ts +45 -0
  387. package/src/Cloudflare/KV/Namespace.ts +150 -0
  388. package/src/Cloudflare/KV/NamespaceBinding.ts +25 -0
  389. package/src/Cloudflare/KV/Put.ts +59 -0
  390. package/src/Cloudflare/KV/index.ts +6 -0
  391. package/src/Cloudflare/Logs.ts +139 -0
  392. package/src/Cloudflare/Providers.ts +75 -0
  393. package/src/Cloudflare/R2/Bucket.ts +173 -0
  394. package/src/Cloudflare/R2/BucketBinding.ts +31 -0
  395. package/src/Cloudflare/R2/CreateMultipartUpload.ts +59 -0
  396. package/src/Cloudflare/R2/DeleteObject.ts +41 -0
  397. package/src/Cloudflare/R2/GetObject.ts +47 -0
  398. package/src/Cloudflare/R2/HeadObject.ts +41 -0
  399. package/src/Cloudflare/R2/ListObjects.ts +45 -0
  400. package/src/Cloudflare/R2/MultipartUploadClient.ts +40 -0
  401. package/src/Cloudflare/R2/PutObject.ts +55 -0
  402. package/src/Cloudflare/R2/ResumeMultipartUpload.ts +48 -0
  403. package/src/Cloudflare/R2/UploadValue.ts +10 -0
  404. package/src/Cloudflare/R2/index.ts +9 -0
  405. package/src/Cloudflare/StageConfig.ts +8 -0
  406. package/src/Cloudflare/Website/StaticSite.ts +35 -0
  407. package/src/Cloudflare/Website/TanstackStart.ts +14 -0
  408. package/src/Cloudflare/Website/index.ts +2 -0
  409. package/src/Cloudflare/Workers/Assets.ts +286 -0
  410. package/src/Cloudflare/Workers/ConfigProvider.ts +9 -0
  411. package/src/Cloudflare/Workers/DurableObject.ts +558 -0
  412. package/src/Cloudflare/Workers/DynamicWorker.ts +144 -0
  413. package/src/Cloudflare/Workers/Fetch.ts +142 -0
  414. package/src/Cloudflare/Workers/Fetcher.ts +280 -0
  415. package/src/Cloudflare/Workers/HttpServer.ts +159 -0
  416. package/src/Cloudflare/Workers/Rpc.ts +472 -0
  417. package/src/Cloudflare/Workers/WebSocket.ts +44 -0
  418. package/src/Cloudflare/Workers/Worker.ts +1222 -0
  419. package/src/Cloudflare/Workers/Workflow.ts +400 -0
  420. package/src/Cloudflare/Workers/cloudflare_workers.ts +25 -0
  421. package/src/Cloudflare/Workers/index.ts +10 -0
  422. package/src/Cloudflare/index.ts +7 -0
  423. package/src/Cloudflare/stream.ts +20 -0
  424. package/src/Config.ts +31 -0
  425. package/src/Construct.ts +75 -0
  426. package/src/Daemon/Client.ts +112 -0
  427. package/src/Daemon/Config.ts +28 -0
  428. package/src/Daemon/Errors.ts +32 -0
  429. package/src/Daemon/Lock.ts +162 -0
  430. package/src/Daemon/ProcessRegistry.ts +284 -0
  431. package/src/Daemon/RpcSchema.ts +43 -0
  432. package/src/Daemon/RpcServer.ts +231 -0
  433. package/src/Daemon/index.ts +25 -0
  434. package/src/Destroy.ts +15 -0
  435. package/src/Diff.ts +142 -0
  436. package/src/ExecutionContext.ts +30 -0
  437. package/src/FQN.ts +94 -0
  438. package/src/Http.ts +105 -0
  439. package/src/Input.ts +91 -0
  440. package/src/InstanceId.ts +19 -0
  441. package/src/Kubernetes/ConfigMap.ts +59 -0
  442. package/src/Kubernetes/Deployment.ts +123 -0
  443. package/src/Kubernetes/Job.ts +82 -0
  444. package/src/Kubernetes/Namespace.ts +49 -0
  445. package/src/Kubernetes/Object.ts +99 -0
  446. package/src/Kubernetes/Service.ts +78 -0
  447. package/src/Kubernetes/ServiceAccount.ts +49 -0
  448. package/src/Kubernetes/client.ts +298 -0
  449. package/src/Kubernetes/common.ts +23 -0
  450. package/src/Kubernetes/index.ts +11 -0
  451. package/src/Kubernetes/types.ts +177 -0
  452. package/src/Namespace.ts +64 -0
  453. package/src/Observability.ts +0 -0
  454. package/src/Output.ts +584 -0
  455. package/src/Phase.ts +5 -0
  456. package/src/PhysicalName.ts +62 -0
  457. package/src/Plan.ts +899 -0
  458. package/src/Platform.ts +398 -0
  459. package/src/Provider.ts +156 -0
  460. package/src/Ref.ts +46 -0
  461. package/src/RemovalPolicy.ts +51 -0
  462. package/src/Resource.ts +387 -0
  463. package/src/SQLite/BunSQLite.ts +132 -0
  464. package/src/SQLite/SQLite.ts +19 -0
  465. package/src/SQLite/SQLiteConnection.ts +55 -0
  466. package/src/SQLite/SQLiteError.ts +904 -0
  467. package/src/SQLite/SQLiteStatement.ts +24 -0
  468. package/src/SQLite/index.ts +6 -0
  469. package/src/SQLite/libSQL.ts +194 -0
  470. package/src/Schema.ts +333 -0
  471. package/src/Self.ts +10 -0
  472. package/src/Server/Process.ts +30 -0
  473. package/src/Server/S3BucketEventSource.ts +100 -0
  474. package/src/Server/SQSQueueEventSource.ts +77 -0
  475. package/src/Server/index.ts +3 -0
  476. package/src/Serverless/Function.ts +18 -0
  477. package/src/Serverless/index.ts +1 -0
  478. package/src/Spawn.ts +23 -0
  479. package/src/Stack.ts +84 -0
  480. package/src/Stage.ts +3 -0
  481. package/src/State/InMemoryState.ts +86 -0
  482. package/src/State/LocalState.ts +120 -0
  483. package/src/State/ResourceState.ts +121 -0
  484. package/src/State/State.ts +72 -0
  485. package/src/State/index.ts +4 -0
  486. package/src/Tags.ts +104 -0
  487. package/src/Test/TestCli.ts +21 -0
  488. package/src/Test/TestState.ts +37 -0
  489. package/src/Test/Vitest.ts +503 -0
  490. package/src/Test/index.ts +3 -0
  491. package/src/Trait.ts +105 -0
  492. package/src/Util/base32.ts +44 -0
  493. package/src/Util/camel.ts +23 -0
  494. package/src/Util/class.ts +7 -0
  495. package/src/Util/effect.ts +57 -0
  496. package/src/Util/index.ts +15 -0
  497. package/src/Util/instance.ts +9 -0
  498. package/src/Util/pointer.ts +5 -0
  499. package/src/Util/schema-to-type.ts +456 -0
  500. package/src/Util/service.ts +16 -0
  501. package/src/Util/sha256.ts +27 -0
  502. package/src/Util/stable.ts +41 -0
  503. package/src/Util/todo.ts +4 -0
  504. package/src/Util/types.ts +25 -0
  505. package/src/Util/unknown.ts +19 -0
  506. package/src/Util/zip.ts +27 -0
  507. package/src/index.ts +29 -26
  508. package/README.md +0 -179
  509. package/lib/$.d.ts +0 -5
  510. package/lib/$.d.ts.map +0 -1
  511. package/lib/$.js +0 -9
  512. package/lib/$.js.map +0 -1
  513. package/lib/app.d.ts +0 -15
  514. package/lib/app.d.ts.map +0 -1
  515. package/lib/app.js +0 -7
  516. package/lib/app.js.map +0 -1
  517. package/lib/apply.d.ts +0 -18
  518. package/lib/apply.d.ts.map +0 -1
  519. package/lib/apply.js +0 -567
  520. package/lib/apply.js.map +0 -1
  521. package/lib/assert-never.d.ts +0 -12
  522. package/lib/assert-never.d.ts.map +0 -1
  523. package/lib/assert-never.js +0 -11
  524. package/lib/assert-never.js.map +0 -1
  525. package/lib/aws/account.d.ts +0 -27
  526. package/lib/aws/account.d.ts.map +0 -1
  527. package/lib/aws/account.js +0 -33
  528. package/lib/aws/account.js.map +0 -1
  529. package/lib/aws/arn.d.ts +0 -2
  530. package/lib/aws/arn.d.ts.map +0 -1
  531. package/lib/aws/arn.js +0 -1
  532. package/lib/aws/arn.js.map +0 -1
  533. package/lib/aws/assets.d.ts +0 -8
  534. package/lib/aws/assets.d.ts.map +0 -1
  535. package/lib/aws/assets.js +0 -4
  536. package/lib/aws/assets.js.map +0 -1
  537. package/lib/aws/bundle.d.ts +0 -4
  538. package/lib/aws/bundle.d.ts.map +0 -1
  539. package/lib/aws/bundle.js +0 -4
  540. package/lib/aws/bundle.js.map +0 -1
  541. package/lib/aws/client.d.ts +0 -8
  542. package/lib/aws/client.d.ts.map +0 -1
  543. package/lib/aws/client.js +0 -27
  544. package/lib/aws/client.js.map +0 -1
  545. package/lib/aws/config.d.ts +0 -15
  546. package/lib/aws/config.d.ts.map +0 -1
  547. package/lib/aws/config.js +0 -1
  548. package/lib/aws/config.js.map +0 -1
  549. package/lib/aws/credentials.d.ts +0 -156
  550. package/lib/aws/credentials.d.ts.map +0 -1
  551. package/lib/aws/credentials.js +0 -196
  552. package/lib/aws/credentials.js.map +0 -1
  553. package/lib/aws/dynamodb/attribute-value.d.ts +0 -20
  554. package/lib/aws/dynamodb/attribute-value.d.ts.map +0 -1
  555. package/lib/aws/dynamodb/attribute-value.js +0 -217
  556. package/lib/aws/dynamodb/attribute-value.js.map +0 -1
  557. package/lib/aws/dynamodb/client.d.ts +0 -12
  558. package/lib/aws/dynamodb/client.d.ts.map +0 -1
  559. package/lib/aws/dynamodb/client.js +0 -11
  560. package/lib/aws/dynamodb/client.js.map +0 -1
  561. package/lib/aws/dynamodb/expr.d.ts +0 -41
  562. package/lib/aws/dynamodb/expr.d.ts.map +0 -1
  563. package/lib/aws/dynamodb/expr.js +0 -1
  564. package/lib/aws/dynamodb/expr.js.map +0 -1
  565. package/lib/aws/dynamodb/index.d.ts +0 -10
  566. package/lib/aws/dynamodb/index.d.ts.map +0 -1
  567. package/lib/aws/dynamodb/index.js +0 -9
  568. package/lib/aws/dynamodb/index.js.map +0 -1
  569. package/lib/aws/dynamodb/projection.d.ts +0 -25
  570. package/lib/aws/dynamodb/projection.d.ts.map +0 -1
  571. package/lib/aws/dynamodb/projection.js +0 -1
  572. package/lib/aws/dynamodb/projection.js.map +0 -1
  573. package/lib/aws/dynamodb/secondary-index.d.ts +0 -26
  574. package/lib/aws/dynamodb/secondary-index.d.ts.map +0 -1
  575. package/lib/aws/dynamodb/secondary-index.js +0 -4
  576. package/lib/aws/dynamodb/secondary-index.js.map +0 -1
  577. package/lib/aws/dynamodb/table.d.ts +0 -59
  578. package/lib/aws/dynamodb/table.d.ts.map +0 -1
  579. package/lib/aws/dynamodb/table.get-item.d.ts +0 -57
  580. package/lib/aws/dynamodb/table.get-item.d.ts.map +0 -1
  581. package/lib/aws/dynamodb/table.get-item.js +0 -77
  582. package/lib/aws/dynamodb/table.get-item.js.map +0 -1
  583. package/lib/aws/dynamodb/table.js +0 -4
  584. package/lib/aws/dynamodb/table.js.map +0 -1
  585. package/lib/aws/dynamodb/table.provider.d.ts +0 -7
  586. package/lib/aws/dynamodb/table.provider.d.ts.map +0 -1
  587. package/lib/aws/dynamodb/table.provider.js +0 -196
  588. package/lib/aws/dynamodb/table.provider.js.map +0 -1
  589. package/lib/aws/ec2/client.d.ts +0 -12
  590. package/lib/aws/ec2/client.d.ts.map +0 -1
  591. package/lib/aws/ec2/client.js +0 -11
  592. package/lib/aws/ec2/client.js.map +0 -1
  593. package/lib/aws/ec2/index.d.ts +0 -15
  594. package/lib/aws/ec2/index.d.ts.map +0 -1
  595. package/lib/aws/ec2/index.js +0 -15
  596. package/lib/aws/ec2/index.js.map +0 -1
  597. package/lib/aws/ec2/internet-gateway.d.ts +0 -65
  598. package/lib/aws/ec2/internet-gateway.d.ts.map +0 -1
  599. package/lib/aws/ec2/internet-gateway.js +0 -4
  600. package/lib/aws/ec2/internet-gateway.js.map +0 -1
  601. package/lib/aws/ec2/internet-gateway.provider.d.ts +0 -6
  602. package/lib/aws/ec2/internet-gateway.provider.d.ts.map +0 -1
  603. package/lib/aws/ec2/internet-gateway.provider.js +0 -193
  604. package/lib/aws/ec2/internet-gateway.provider.js.map +0 -1
  605. package/lib/aws/ec2/route-table-association.d.ts +0 -63
  606. package/lib/aws/ec2/route-table-association.d.ts.map +0 -1
  607. package/lib/aws/ec2/route-table-association.js +0 -4
  608. package/lib/aws/ec2/route-table-association.js.map +0 -1
  609. package/lib/aws/ec2/route-table-association.provider.d.ts +0 -4
  610. package/lib/aws/ec2/route-table-association.provider.d.ts.map +0 -1
  611. package/lib/aws/ec2/route-table-association.provider.js +0 -121
  612. package/lib/aws/ec2/route-table-association.provider.js.map +0 -1
  613. package/lib/aws/ec2/route-table.d.ts +0 -159
  614. package/lib/aws/ec2/route-table.d.ts.map +0 -1
  615. package/lib/aws/ec2/route-table.js +0 -4
  616. package/lib/aws/ec2/route-table.js.map +0 -1
  617. package/lib/aws/ec2/route-table.provider.d.ts +0 -6
  618. package/lib/aws/ec2/route-table.provider.d.ts.map +0 -1
  619. package/lib/aws/ec2/route-table.provider.js +0 -213
  620. package/lib/aws/ec2/route-table.provider.js.map +0 -1
  621. package/lib/aws/ec2/route.d.ts +0 -155
  622. package/lib/aws/ec2/route.d.ts.map +0 -1
  623. package/lib/aws/ec2/route.js +0 -3
  624. package/lib/aws/ec2/route.js.map +0 -1
  625. package/lib/aws/ec2/route.provider.d.ts +0 -4
  626. package/lib/aws/ec2/route.provider.d.ts.map +0 -1
  627. package/lib/aws/ec2/route.provider.js +0 -166
  628. package/lib/aws/ec2/route.provider.js.map +0 -1
  629. package/lib/aws/ec2/subnet.d.ts +0 -175
  630. package/lib/aws/ec2/subnet.d.ts.map +0 -1
  631. package/lib/aws/ec2/subnet.js +0 -4
  632. package/lib/aws/ec2/subnet.js.map +0 -1
  633. package/lib/aws/ec2/subnet.provider.d.ts +0 -4
  634. package/lib/aws/ec2/subnet.provider.d.ts.map +0 -1
  635. package/lib/aws/ec2/subnet.provider.js +0 -250
  636. package/lib/aws/ec2/subnet.provider.js.map +0 -1
  637. package/lib/aws/ec2/vpc.d.ts +0 -136
  638. package/lib/aws/ec2/vpc.d.ts.map +0 -1
  639. package/lib/aws/ec2/vpc.js +0 -4
  640. package/lib/aws/ec2/vpc.js.map +0 -1
  641. package/lib/aws/ec2/vpc.provider.d.ts +0 -6
  642. package/lib/aws/ec2/vpc.provider.d.ts.map +0 -1
  643. package/lib/aws/ec2/vpc.provider.js +0 -205
  644. package/lib/aws/ec2/vpc.provider.js.map +0 -1
  645. package/lib/aws/iam.d.ts +0 -23
  646. package/lib/aws/iam.d.ts.map +0 -1
  647. package/lib/aws/iam.js +0 -7
  648. package/lib/aws/iam.js.map +0 -1
  649. package/lib/aws/index.d.ts +0 -28
  650. package/lib/aws/index.d.ts.map +0 -1
  651. package/lib/aws/index.js +0 -21
  652. package/lib/aws/index.js.map +0 -1
  653. package/lib/aws/lambda/client.d.ts +0 -8
  654. package/lib/aws/lambda/client.d.ts.map +0 -1
  655. package/lib/aws/lambda/client.js +0 -7
  656. package/lib/aws/lambda/client.js.map +0 -1
  657. package/lib/aws/lambda/consume.d.ts +0 -16
  658. package/lib/aws/lambda/consume.d.ts.map +0 -1
  659. package/lib/aws/lambda/consume.js +0 -30
  660. package/lib/aws/lambda/consume.js.map +0 -1
  661. package/lib/aws/lambda/function.d.ts +0 -41
  662. package/lib/aws/lambda/function.d.ts.map +0 -1
  663. package/lib/aws/lambda/function.handler.d.ts +0 -7
  664. package/lib/aws/lambda/function.handler.d.ts.map +0 -1
  665. package/lib/aws/lambda/function.handler.js +0 -8
  666. package/lib/aws/lambda/function.handler.js.map +0 -1
  667. package/lib/aws/lambda/function.invoke.d.ts +0 -12
  668. package/lib/aws/lambda/function.invoke.d.ts.map +0 -1
  669. package/lib/aws/lambda/function.invoke.js +0 -33
  670. package/lib/aws/lambda/function.invoke.js.map +0 -1
  671. package/lib/aws/lambda/function.js +0 -3
  672. package/lib/aws/lambda/function.js.map +0 -1
  673. package/lib/aws/lambda/function.provider.d.ts +0 -10
  674. package/lib/aws/lambda/function.provider.d.ts.map +0 -1
  675. package/lib/aws/lambda/function.provider.js +0 -464
  676. package/lib/aws/lambda/function.provider.js.map +0 -1
  677. package/lib/aws/lambda/index.d.ts +0 -9
  678. package/lib/aws/lambda/index.d.ts.map +0 -1
  679. package/lib/aws/lambda/index.js +0 -10
  680. package/lib/aws/lambda/index.js.map +0 -1
  681. package/lib/aws/lambda/serve.d.ts +0 -12
  682. package/lib/aws/lambda/serve.d.ts.map +0 -1
  683. package/lib/aws/lambda/serve.js +0 -7
  684. package/lib/aws/lambda/serve.js.map +0 -1
  685. package/lib/aws/parse-ini.d.ts +0 -4
  686. package/lib/aws/parse-ini.d.ts.map +0 -1
  687. package/lib/aws/parse-ini.js +0 -67
  688. package/lib/aws/parse-ini.js.map +0 -1
  689. package/lib/aws/profile.d.ts +0 -6
  690. package/lib/aws/profile.d.ts.map +0 -1
  691. package/lib/aws/profile.js +0 -4
  692. package/lib/aws/profile.js.map +0 -1
  693. package/lib/aws/region.d.ts +0 -31
  694. package/lib/aws/region.d.ts.map +0 -1
  695. package/lib/aws/region.js +0 -46
  696. package/lib/aws/region.js.map +0 -1
  697. package/lib/aws/s3.d.ts +0 -8
  698. package/lib/aws/s3.d.ts.map +0 -1
  699. package/lib/aws/s3.js +0 -7
  700. package/lib/aws/s3.js.map +0 -1
  701. package/lib/aws/sqs/client.d.ts +0 -12
  702. package/lib/aws/sqs/client.d.ts.map +0 -1
  703. package/lib/aws/sqs/client.js +0 -11
  704. package/lib/aws/sqs/client.js.map +0 -1
  705. package/lib/aws/sqs/index.d.ts +0 -8
  706. package/lib/aws/sqs/index.d.ts.map +0 -1
  707. package/lib/aws/sqs/index.js +0 -8
  708. package/lib/aws/sqs/index.js.map +0 -1
  709. package/lib/aws/sqs/queue.consume.d.ts +0 -12
  710. package/lib/aws/sqs/queue.consume.d.ts.map +0 -1
  711. package/lib/aws/sqs/queue.consume.js +0 -2
  712. package/lib/aws/sqs/queue.consume.js.map +0 -1
  713. package/lib/aws/sqs/queue.d.ts +0 -81
  714. package/lib/aws/sqs/queue.d.ts.map +0 -1
  715. package/lib/aws/sqs/queue.event-source.d.ts +0 -22
  716. package/lib/aws/sqs/queue.event-source.d.ts.map +0 -1
  717. package/lib/aws/sqs/queue.event-source.js +0 -130
  718. package/lib/aws/sqs/queue.event-source.js.map +0 -1
  719. package/lib/aws/sqs/queue.js +0 -3
  720. package/lib/aws/sqs/queue.js.map +0 -1
  721. package/lib/aws/sqs/queue.provider.d.ts +0 -6
  722. package/lib/aws/sqs/queue.provider.d.ts.map +0 -1
  723. package/lib/aws/sqs/queue.provider.js +0 -87
  724. package/lib/aws/sqs/queue.provider.js.map +0 -1
  725. package/lib/aws/sqs/queue.send-message.d.ts +0 -13
  726. package/lib/aws/sqs/queue.send-message.d.ts.map +0 -1
  727. package/lib/aws/sqs/queue.send-message.js +0 -34
  728. package/lib/aws/sqs/queue.send-message.js.map +0 -1
  729. package/lib/aws/sts.d.ts +0 -8
  730. package/lib/aws/sts.d.ts.map +0 -1
  731. package/lib/aws/sts.js +0 -7
  732. package/lib/aws/sts.js.map +0 -1
  733. package/lib/aws/zip.d.ts +0 -3
  734. package/lib/aws/zip.d.ts.map +0 -1
  735. package/lib/aws/zip.js +0 -12
  736. package/lib/aws/zip.js.map +0 -1
  737. package/lib/binding.d.ts +0 -106
  738. package/lib/binding.d.ts.map +0 -1
  739. package/lib/binding.js +0 -27
  740. package/lib/binding.js.map +0 -1
  741. package/lib/capability.d.ts +0 -49
  742. package/lib/capability.d.ts.map +0 -1
  743. package/lib/capability.js +0 -1
  744. package/lib/capability.js.map +0 -1
  745. package/lib/cli/components/ApprovePlan.d.ts +0 -8
  746. package/lib/cli/components/ApprovePlan.d.ts.map +0 -1
  747. package/lib/cli/components/ApprovePlan.js +0 -30
  748. package/lib/cli/components/ApprovePlan.js.map +0 -1
  749. package/lib/cli/components/Plan.d.ts +0 -7
  750. package/lib/cli/components/Plan.d.ts.map +0 -1
  751. package/lib/cli/components/Plan.js +0 -100
  752. package/lib/cli/components/Plan.js.map +0 -1
  753. package/lib/cli/components/PlanProgress.d.ts +0 -13
  754. package/lib/cli/components/PlanProgress.d.ts.map +0 -1
  755. package/lib/cli/components/PlanProgress.js +0 -176
  756. package/lib/cli/components/PlanProgress.js.map +0 -1
  757. package/lib/cli/ink-service.d.ts +0 -4
  758. package/lib/cli/ink-service.d.ts.map +0 -1
  759. package/lib/cli/ink-service.js +0 -43
  760. package/lib/cli/ink-service.js.map +0 -1
  761. package/lib/cli/service.d.ts +0 -21
  762. package/lib/cli/service.d.ts.map +0 -1
  763. package/lib/cli/service.js +0 -5
  764. package/lib/cli/service.js.map +0 -1
  765. package/lib/cloudflare/account.d.ts +0 -10
  766. package/lib/cloudflare/account.d.ts.map +0 -1
  767. package/lib/cloudflare/account.js +0 -24
  768. package/lib/cloudflare/account.js.map +0 -1
  769. package/lib/cloudflare/api.d.ts +0 -36
  770. package/lib/cloudflare/api.d.ts.map +0 -1
  771. package/lib/cloudflare/api.js +0 -100
  772. package/lib/cloudflare/api.js.map +0 -1
  773. package/lib/cloudflare/config.d.ts +0 -9
  774. package/lib/cloudflare/config.d.ts.map +0 -1
  775. package/lib/cloudflare/config.js +0 -1
  776. package/lib/cloudflare/config.js.map +0 -1
  777. package/lib/cloudflare/context.d.ts +0 -27
  778. package/lib/cloudflare/context.d.ts.map +0 -1
  779. package/lib/cloudflare/context.js +0 -24
  780. package/lib/cloudflare/context.js.map +0 -1
  781. package/lib/cloudflare/index.d.ts +0 -8
  782. package/lib/cloudflare/index.d.ts.map +0 -1
  783. package/lib/cloudflare/index.js +0 -8
  784. package/lib/cloudflare/index.js.map +0 -1
  785. package/lib/cloudflare/kv/index.d.ts +0 -4
  786. package/lib/cloudflare/kv/index.d.ts.map +0 -1
  787. package/lib/cloudflare/kv/index.js +0 -4
  788. package/lib/cloudflare/kv/index.js.map +0 -1
  789. package/lib/cloudflare/kv/namespace.binding.d.ts +0 -10
  790. package/lib/cloudflare/kv/namespace.binding.d.ts.map +0 -1
  791. package/lib/cloudflare/kv/namespace.binding.js +0 -15
  792. package/lib/cloudflare/kv/namespace.binding.js.map +0 -1
  793. package/lib/cloudflare/kv/namespace.client.d.ts +0 -11
  794. package/lib/cloudflare/kv/namespace.client.d.ts.map +0 -1
  795. package/lib/cloudflare/kv/namespace.client.js +0 -31
  796. package/lib/cloudflare/kv/namespace.client.js.map +0 -1
  797. package/lib/cloudflare/kv/namespace.d.ts +0 -24
  798. package/lib/cloudflare/kv/namespace.d.ts.map +0 -1
  799. package/lib/cloudflare/kv/namespace.js +0 -3
  800. package/lib/cloudflare/kv/namespace.js.map +0 -1
  801. package/lib/cloudflare/kv/namespace.provider.d.ts +0 -6
  802. package/lib/cloudflare/kv/namespace.provider.d.ts.map +0 -1
  803. package/lib/cloudflare/kv/namespace.provider.js +0 -87
  804. package/lib/cloudflare/kv/namespace.provider.js.map +0 -1
  805. package/lib/cloudflare/live.d.ts +0 -11
  806. package/lib/cloudflare/live.d.ts.map +0 -1
  807. package/lib/cloudflare/live.js +0 -15
  808. package/lib/cloudflare/live.js.map +0 -1
  809. package/lib/cloudflare/r2/bucket.binding.d.ts +0 -10
  810. package/lib/cloudflare/r2/bucket.binding.d.ts.map +0 -1
  811. package/lib/cloudflare/r2/bucket.binding.js +0 -18
  812. package/lib/cloudflare/r2/bucket.binding.js.map +0 -1
  813. package/lib/cloudflare/r2/bucket.client.d.ts +0 -8
  814. package/lib/cloudflare/r2/bucket.client.d.ts.map +0 -1
  815. package/lib/cloudflare/r2/bucket.client.js +0 -9
  816. package/lib/cloudflare/r2/bucket.client.js.map +0 -1
  817. package/lib/cloudflare/r2/bucket.d.ts +0 -33
  818. package/lib/cloudflare/r2/bucket.d.ts.map +0 -1
  819. package/lib/cloudflare/r2/bucket.del.d.ts +0 -4
  820. package/lib/cloudflare/r2/bucket.del.d.ts.map +0 -1
  821. package/lib/cloudflare/r2/bucket.del.js +0 -7
  822. package/lib/cloudflare/r2/bucket.del.js.map +0 -1
  823. package/lib/cloudflare/r2/bucket.get.d.ts +0 -5
  824. package/lib/cloudflare/r2/bucket.get.d.ts.map +0 -1
  825. package/lib/cloudflare/r2/bucket.get.js +0 -7
  826. package/lib/cloudflare/r2/bucket.get.js.map +0 -1
  827. package/lib/cloudflare/r2/bucket.head.d.ts +0 -4
  828. package/lib/cloudflare/r2/bucket.head.d.ts.map +0 -1
  829. package/lib/cloudflare/r2/bucket.head.js +0 -7
  830. package/lib/cloudflare/r2/bucket.head.js.map +0 -1
  831. package/lib/cloudflare/r2/bucket.js +0 -3
  832. package/lib/cloudflare/r2/bucket.js.map +0 -1
  833. package/lib/cloudflare/r2/bucket.list.d.ts +0 -5
  834. package/lib/cloudflare/r2/bucket.list.d.ts.map +0 -1
  835. package/lib/cloudflare/r2/bucket.list.js +0 -7
  836. package/lib/cloudflare/r2/bucket.list.js.map +0 -1
  837. package/lib/cloudflare/r2/bucket.multipart.d.ts +0 -19
  838. package/lib/cloudflare/r2/bucket.multipart.d.ts.map +0 -1
  839. package/lib/cloudflare/r2/bucket.multipart.js +0 -25
  840. package/lib/cloudflare/r2/bucket.multipart.js.map +0 -1
  841. package/lib/cloudflare/r2/bucket.provider.d.ts +0 -5
  842. package/lib/cloudflare/r2/bucket.provider.d.ts.map +0 -1
  843. package/lib/cloudflare/r2/bucket.provider.js +0 -78
  844. package/lib/cloudflare/r2/bucket.provider.js.map +0 -1
  845. package/lib/cloudflare/r2/bucket.put.d.ts +0 -6
  846. package/lib/cloudflare/r2/bucket.put.d.ts.map +0 -1
  847. package/lib/cloudflare/r2/bucket.put.js +0 -8
  848. package/lib/cloudflare/r2/bucket.put.js.map +0 -1
  849. package/lib/cloudflare/r2/index.d.ts +0 -10
  850. package/lib/cloudflare/r2/index.d.ts.map +0 -1
  851. package/lib/cloudflare/r2/index.js +0 -10
  852. package/lib/cloudflare/r2/index.js.map +0 -1
  853. package/lib/cloudflare/stream.d.ts +0 -10
  854. package/lib/cloudflare/stream.d.ts.map +0 -1
  855. package/lib/cloudflare/stream.js +0 -16
  856. package/lib/cloudflare/stream.js.map +0 -1
  857. package/lib/cloudflare/worker/assets.fetch.d.ts +0 -9
  858. package/lib/cloudflare/worker/assets.fetch.d.ts.map +0 -1
  859. package/lib/cloudflare/worker/assets.fetch.js +0 -12
  860. package/lib/cloudflare/worker/assets.fetch.js.map +0 -1
  861. package/lib/cloudflare/worker/assets.provider.d.ts +0 -66
  862. package/lib/cloudflare/worker/assets.provider.d.ts.map +0 -1
  863. package/lib/cloudflare/worker/assets.provider.js +0 -145
  864. package/lib/cloudflare/worker/assets.provider.js.map +0 -1
  865. package/lib/cloudflare/worker/index.d.ts +0 -5
  866. package/lib/cloudflare/worker/index.d.ts.map +0 -1
  867. package/lib/cloudflare/worker/index.js +0 -5
  868. package/lib/cloudflare/worker/index.js.map +0 -1
  869. package/lib/cloudflare/worker/worker.d.ts +0 -66
  870. package/lib/cloudflare/worker/worker.d.ts.map +0 -1
  871. package/lib/cloudflare/worker/worker.handler.d.ts +0 -11
  872. package/lib/cloudflare/worker/worker.handler.d.ts.map +0 -1
  873. package/lib/cloudflare/worker/worker.handler.js +0 -15
  874. package/lib/cloudflare/worker/worker.handler.js.map +0 -1
  875. package/lib/cloudflare/worker/worker.js +0 -4
  876. package/lib/cloudflare/worker/worker.js.map +0 -1
  877. package/lib/cloudflare/worker/worker.provider.d.ts +0 -10
  878. package/lib/cloudflare/worker/worker.provider.d.ts.map +0 -1
  879. package/lib/cloudflare/worker/worker.provider.js +0 -225
  880. package/lib/cloudflare/worker/worker.provider.js.map +0 -1
  881. package/lib/cloudflare/worker/worker.serve.d.ts +0 -39
  882. package/lib/cloudflare/worker/worker.serve.d.ts.map +0 -1
  883. package/lib/cloudflare/worker/worker.serve.js +0 -4
  884. package/lib/cloudflare/worker/worker.serve.js.map +0 -1
  885. package/lib/data.d.ts +0 -3
  886. package/lib/data.d.ts.map +0 -1
  887. package/lib/data.js +0 -8
  888. package/lib/data.js.map +0 -1
  889. package/lib/destroy.d.ts +0 -2
  890. package/lib/destroy.d.ts.map +0 -1
  891. package/lib/destroy.js +0 -3
  892. package/lib/destroy.js.map +0 -1
  893. package/lib/diff.d.ts +0 -18
  894. package/lib/diff.d.ts.map +0 -1
  895. package/lib/diff.js +0 -22
  896. package/lib/diff.js.map +0 -1
  897. package/lib/dot-alchemy.d.ts +0 -10
  898. package/lib/dot-alchemy.d.ts.map +0 -1
  899. package/lib/dot-alchemy.js +0 -15
  900. package/lib/dot-alchemy.js.map +0 -1
  901. package/lib/env.d.ts +0 -9
  902. package/lib/env.d.ts.map +0 -1
  903. package/lib/env.js +0 -19
  904. package/lib/env.js.map +0 -1
  905. package/lib/esbuild.d.ts +0 -28
  906. package/lib/esbuild.d.ts.map +0 -1
  907. package/lib/esbuild.js +0 -63
  908. package/lib/esbuild.js.map +0 -1
  909. package/lib/event.d.ts +0 -16
  910. package/lib/event.d.ts.map +0 -1
  911. package/lib/event.js +0 -1
  912. package/lib/event.js.map +0 -1
  913. package/lib/exports.d.ts +0 -9
  914. package/lib/exports.d.ts.map +0 -1
  915. package/lib/exports.js +0 -13
  916. package/lib/exports.js.map +0 -1
  917. package/lib/index.d.ts +0 -27
  918. package/lib/index.d.ts.map +0 -1
  919. package/lib/index.js +0 -27
  920. package/lib/index.js.map +0 -1
  921. package/lib/input.d.ts +0 -32
  922. package/lib/input.d.ts.map +0 -1
  923. package/lib/input.js +0 -1
  924. package/lib/input.js.map +0 -1
  925. package/lib/instance-id.d.ts +0 -12
  926. package/lib/instance-id.d.ts.map +0 -1
  927. package/lib/instance-id.js +0 -16
  928. package/lib/instance-id.js.map +0 -1
  929. package/lib/output.d.ts +0 -145
  930. package/lib/output.d.ts.map +0 -1
  931. package/lib/output.js +0 -283
  932. package/lib/output.js.map +0 -1
  933. package/lib/phase.d.ts +0 -2
  934. package/lib/phase.d.ts.map +0 -1
  935. package/lib/phase.js +0 -1
  936. package/lib/phase.js.map +0 -1
  937. package/lib/physical-name.d.ts +0 -28
  938. package/lib/physical-name.d.ts.map +0 -1
  939. package/lib/physical-name.js +0 -55
  940. package/lib/physical-name.js.map +0 -1
  941. package/lib/plan.d.ts +0 -135
  942. package/lib/plan.d.ts.map +0 -1
  943. package/lib/plan.js +0 -686
  944. package/lib/plan.js.map +0 -1
  945. package/lib/policy.d.ts +0 -54
  946. package/lib/policy.d.ts.map +0 -1
  947. package/lib/policy.js +0 -24
  948. package/lib/policy.js.map +0 -1
  949. package/lib/provider.d.ts +0 -71
  950. package/lib/provider.d.ts.map +0 -1
  951. package/lib/provider.js +0 -11
  952. package/lib/provider.js.map +0 -1
  953. package/lib/ref.d.ts +0 -14
  954. package/lib/ref.d.ts.map +0 -1
  955. package/lib/ref.js +0 -21
  956. package/lib/ref.js.map +0 -1
  957. package/lib/reporter.d.ts +0 -8
  958. package/lib/reporter.d.ts.map +0 -1
  959. package/lib/reporter.js +0 -4
  960. package/lib/reporter.js.map +0 -1
  961. package/lib/resource.d.ts +0 -36
  962. package/lib/resource.d.ts.map +0 -1
  963. package/lib/resource.js +0 -26
  964. package/lib/resource.js.map +0 -1
  965. package/lib/runtime.d.ts +0 -40
  966. package/lib/runtime.d.ts.map +0 -1
  967. package/lib/runtime.js +0 -54
  968. package/lib/runtime.js.map +0 -1
  969. package/lib/schema.d.ts +0 -37
  970. package/lib/schema.d.ts.map +0 -1
  971. package/lib/schema.js +0 -61
  972. package/lib/schema.js.map +0 -1
  973. package/lib/service.d.ts +0 -36
  974. package/lib/service.d.ts.map +0 -1
  975. package/lib/service.js +0 -4
  976. package/lib/service.js.map +0 -1
  977. package/lib/sha256.d.ts +0 -5
  978. package/lib/sha256.d.ts.map +0 -1
  979. package/lib/sha256.js +0 -16
  980. package/lib/sha256.js.map +0 -1
  981. package/lib/stack.d.ts +0 -60
  982. package/lib/stack.d.ts.map +0 -1
  983. package/lib/stack.js +0 -11
  984. package/lib/stack.js.map +0 -1
  985. package/lib/stage.d.ts +0 -39
  986. package/lib/stage.d.ts.map +0 -1
  987. package/lib/stage.js +0 -32
  988. package/lib/stage.js.map +0 -1
  989. package/lib/state.d.ts +0 -157
  990. package/lib/state.d.ts.map +0 -1
  991. package/lib/state.js +0 -71
  992. package/lib/state.js.map +0 -1
  993. package/lib/tags.d.ts +0 -32
  994. package/lib/tags.d.ts.map +0 -1
  995. package/lib/tags.js +0 -49
  996. package/lib/tags.js.map +0 -1
  997. package/lib/test.d.ts +0 -35
  998. package/lib/test.d.ts.map +0 -1
  999. package/lib/test.js +0 -68
  1000. package/lib/test.js.map +0 -1
  1001. package/lib/todo.d.ts +0 -3
  1002. package/lib/todo.d.ts.map +0 -1
  1003. package/lib/todo.js +0 -3
  1004. package/lib/todo.js.map +0 -1
  1005. package/lib/tsconfig.test.tsbuildinfo +0 -1
  1006. package/lib/type.d.ts +0 -6
  1007. package/lib/type.d.ts.map +0 -1
  1008. package/lib/type.js +0 -3
  1009. package/lib/type.js.map +0 -1
  1010. package/lib/unknown.d.ts +0 -4
  1011. package/lib/unknown.d.ts.map +0 -1
  1012. package/lib/unknown.js +0 -4
  1013. package/lib/unknown.js.map +0 -1
  1014. package/lib/user.d.ts +0 -3
  1015. package/lib/user.d.ts.map +0 -1
  1016. package/lib/user.js +0 -3
  1017. package/lib/user.js.map +0 -1
  1018. package/lib/util.d.ts +0 -6
  1019. package/lib/util.d.ts.map +0 -1
  1020. package/lib/util.js +0 -9
  1021. package/lib/util.js.map +0 -1
  1022. package/src/$.ts +0 -17
  1023. package/src/app.ts +0 -15
  1024. package/src/apply.ts +0 -858
  1025. package/src/aws/account.ts +0 -57
  1026. package/src/aws/assets.ts +0 -8
  1027. package/src/aws/bundle.ts +0 -5
  1028. package/src/aws/client.ts +0 -46
  1029. package/src/aws/config.ts +0 -16
  1030. package/src/aws/credentials.ts +0 -444
  1031. package/src/aws/dynamodb/attribute-value.ts +0 -240
  1032. package/src/aws/dynamodb/client.ts +0 -20
  1033. package/src/aws/dynamodb/index.ts +0 -12
  1034. package/src/aws/dynamodb/projection.ts +0 -159
  1035. package/src/aws/dynamodb/secondary-index.ts +0 -45
  1036. package/src/aws/dynamodb/table.get-item.ts +0 -173
  1037. package/src/aws/dynamodb/table.provider.ts +0 -288
  1038. package/src/aws/dynamodb/table.ts +0 -101
  1039. package/src/aws/ec2/client.ts +0 -20
  1040. package/src/aws/ec2/index.ts +0 -15
  1041. package/src/aws/ec2/internet-gateway.provider.ts +0 -316
  1042. package/src/aws/ec2/internet-gateway.ts +0 -79
  1043. package/src/aws/ec2/route-table-association.provider.ts +0 -214
  1044. package/src/aws/ec2/route-table-association.ts +0 -82
  1045. package/src/aws/ec2/route-table.provider.ts +0 -306
  1046. package/src/aws/ec2/route-table.ts +0 -175
  1047. package/src/aws/ec2/route.provider.ts +0 -213
  1048. package/src/aws/ec2/route.ts +0 -192
  1049. package/src/aws/ec2/subnet.provider.ts +0 -358
  1050. package/src/aws/ec2/subnet.ts +0 -213
  1051. package/src/aws/ec2/vpc.provider.ts +0 -294
  1052. package/src/aws/ec2/vpc.ts +0 -165
  1053. package/src/aws/iam.ts +0 -30
  1054. package/src/aws/index.ts +0 -63
  1055. package/src/aws/lambda/client.ts +0 -14
  1056. package/src/aws/lambda/consume.ts +0 -64
  1057. package/src/aws/lambda/function.handler.ts +0 -30
  1058. package/src/aws/lambda/function.invoke.ts +0 -44
  1059. package/src/aws/lambda/function.provider.ts +0 -675
  1060. package/src/aws/lambda/function.ts +0 -48
  1061. package/src/aws/lambda/index.ts +0 -11
  1062. package/src/aws/lambda/serve.ts +0 -29
  1063. package/src/aws/parse-ini.ts +0 -80
  1064. package/src/aws/profile.ts +0 -3
  1065. package/src/aws/region.ts +0 -76
  1066. package/src/aws/s3.ts +0 -10
  1067. package/src/aws/sqs/client.ts +0 -20
  1068. package/src/aws/sqs/index.ts +0 -8
  1069. package/src/aws/sqs/queue.consume.ts +0 -13
  1070. package/src/aws/sqs/queue.event-source.ts +0 -227
  1071. package/src/aws/sqs/queue.provider.ts +0 -108
  1072. package/src/aws/sqs/queue.send-message.ts +0 -48
  1073. package/src/aws/sqs/queue.ts +0 -91
  1074. package/src/aws/sts.ts +0 -13
  1075. package/src/aws/zip.ts +0 -17
  1076. package/src/binding.ts +0 -240
  1077. package/src/capability.ts +0 -63
  1078. package/src/cli/components/ApprovePlan.tsx +0 -44
  1079. package/src/cli/components/Plan.tsx +0 -155
  1080. package/src/cli/components/PlanProgress.tsx +0 -224
  1081. package/src/cli/index.ts +0 -2
  1082. package/src/cli/ink-service.tsx +0 -61
  1083. package/src/cli/service.ts +0 -23
  1084. package/src/cloudflare/account.ts +0 -37
  1085. package/src/cloudflare/api.ts +0 -156
  1086. package/src/cloudflare/config.ts +0 -7
  1087. package/src/cloudflare/context.ts +0 -49
  1088. package/src/cloudflare/index.ts +0 -8
  1089. package/src/cloudflare/kv/index.ts +0 -3
  1090. package/src/cloudflare/kv/namespace.binding.ts +0 -27
  1091. package/src/cloudflare/kv/namespace.client.ts +0 -70
  1092. package/src/cloudflare/kv/namespace.provider.ts +0 -105
  1093. package/src/cloudflare/kv/namespace.ts +0 -30
  1094. package/src/cloudflare/live.ts +0 -32
  1095. package/src/cloudflare/r2/bucket.binding.ts +0 -29
  1096. package/src/cloudflare/r2/bucket.client.ts +0 -22
  1097. package/src/cloudflare/r2/bucket.del.ts +0 -11
  1098. package/src/cloudflare/r2/bucket.get.ts +0 -13
  1099. package/src/cloudflare/r2/bucket.head.ts +0 -11
  1100. package/src/cloudflare/r2/bucket.list.ts +0 -12
  1101. package/src/cloudflare/r2/bucket.multipart.ts +0 -55
  1102. package/src/cloudflare/r2/bucket.provider.ts +0 -94
  1103. package/src/cloudflare/r2/bucket.put.ts +0 -17
  1104. package/src/cloudflare/r2/bucket.ts +0 -44
  1105. package/src/cloudflare/r2/index.ts +0 -9
  1106. package/src/cloudflare/stream.ts +0 -21
  1107. package/src/cloudflare/worker/assets.fetch.ts +0 -29
  1108. package/src/cloudflare/worker/assets.provider.ts +0 -249
  1109. package/src/cloudflare/worker/index.ts +0 -4
  1110. package/src/cloudflare/worker/worker.handler.ts +0 -39
  1111. package/src/cloudflare/worker/worker.provider.ts +0 -279
  1112. package/src/cloudflare/worker/worker.serve.ts +0 -22
  1113. package/src/cloudflare/worker/worker.ts +0 -77
  1114. package/src/destroy.ts +0 -3
  1115. package/src/diff.ts +0 -48
  1116. package/src/dot-alchemy.ts +0 -18
  1117. package/src/env.ts +0 -39
  1118. package/src/esbuild.ts +0 -98
  1119. package/src/event.ts +0 -33
  1120. package/src/exports.ts +0 -21
  1121. package/src/input.ts +0 -81
  1122. package/src/instance-id.ts +0 -20
  1123. package/src/output.ts +0 -542
  1124. package/src/phase.ts +0 -1
  1125. package/src/physical-name.ts +0 -84
  1126. package/src/plan.ts +0 -1123
  1127. package/src/policy.ts +0 -128
  1128. package/src/provider.ts +0 -112
  1129. package/src/ref.ts +0 -48
  1130. package/src/reporter.ts +0 -8
  1131. package/src/resource.ts +0 -140
  1132. package/src/runtime.ts +0 -152
  1133. package/src/schema.ts +0 -102
  1134. package/src/service.ts +0 -59
  1135. package/src/sha256.ts +0 -23
  1136. package/src/stack.ts +0 -116
  1137. package/src/stage.ts +0 -85
  1138. package/src/state.ts +0 -390
  1139. package/src/tags.ts +0 -69
  1140. package/src/test.ts +0 -172
  1141. package/src/todo.ts +0 -4
  1142. package/src/unknown.ts +0 -6
  1143. package/src/user.ts +0 -4
  1144. package/src/util.ts +0 -21
  1145. /package/src/{aws/arn.ts → AWS/Arn.ts} +0 -0
  1146. /package/src/{aws/dynamodb/expr.ts → AWS/DynamoDB/Expr.ts} +0 -0
  1147. /package/src/{assert-never.ts → Util/assert-never.ts} +0 -0
  1148. /package/src/{data.ts → Util/data.ts} +0 -0
  1149. /package/src/{type.ts → Util/type.ts} +0 -0
@@ -0,0 +1,1185 @@
1
+ import * as logs from "@distilled.cloud/aws/cloudwatch-logs";
2
+ import type { Credentials } from "@distilled.cloud/aws/Credentials";
3
+ import * as iam from "@distilled.cloud/aws/iam";
4
+ import type { CreateFunctionRequest } from "@distilled.cloud/aws/lambda";
5
+ import * as Lambda from "@distilled.cloud/aws/lambda";
6
+ import { Region } from "@distilled.cloud/aws/Region";
7
+ import type * as lambda from "aws-lambda";
8
+ import * as Config from "effect/Config";
9
+ import * as Effect from "effect/Effect";
10
+ import * as FileSystem from "effect/FileSystem";
11
+ import * as Option from "effect/Option";
12
+ import * as Path from "effect/Path";
13
+ import * as Schedule from "effect/Schedule";
14
+ import * as ServiceMap from "effect/ServiceMap";
15
+ import * as Stream from "effect/Stream";
16
+ import type * as rolldown from "rolldown";
17
+ import * as Bundle from "../../Bundle/Bundle.ts";
18
+ import * as TempRoot from "../../Bundle/TempRoot.ts";
19
+ import { isResolved } from "../../Diff.ts";
20
+ import type { HttpEffect } from "../../Http.ts";
21
+ import * as Output from "../../Output.ts";
22
+ import { createPhysicalName } from "../../PhysicalName.ts";
23
+ import { Platform, type Main, type PlatformProps } from "../../Platform.ts";
24
+ import type { LogLine, LogsInput } from "../../Provider.ts";
25
+ import { Resource, type ResourceBinding } from "../../Resource.ts";
26
+ import * as Serverless from "../../Serverless/index.ts";
27
+ import { Stack } from "../../Stack.ts";
28
+ import { createInternalTags, createTagsList, hasTags } from "../../Tags.ts";
29
+ import { sha256 } from "../../Util/sha256.ts";
30
+ import { zipCode } from "../../Util/zip.ts";
31
+ import { Account } from "../Account.ts";
32
+ import { Assets } from "../Assets.ts";
33
+ import * as IAM from "../IAM/index.ts";
34
+ import type { PolicyStatement } from "../IAM/Policy.ts";
35
+ import { makeFunctionHttpHandler } from "./HttpServer.ts";
36
+
37
+ export const FunctionTypeId = "AWS.Lambda.Function" as const;
38
+ export type FunctionTypeId = typeof FunctionTypeId;
39
+
40
+ export class HandlerContext extends ServiceMap.Service<
41
+ HandlerContext,
42
+ lambda.Context
43
+ >()("AWS.Lambda.HandlerContext") {}
44
+
45
+ export const isFunction = (value: any): value is Function => {
46
+ return (
47
+ typeof value === "object" &&
48
+ value !== null &&
49
+ "Type" in value &&
50
+ value.Type === "AWS.Lambda.Function"
51
+ );
52
+ };
53
+
54
+ export interface FunctionBuildOptions {
55
+ readonly input?: Partial<rolldown.InputOptions>;
56
+ readonly output?: Partial<rolldown.OutputOptions>;
57
+ }
58
+
59
+ export interface FunctionProps extends PlatformProps {
60
+ /**
61
+ * Entry module for the bundled Lambda function.
62
+ */
63
+ main: string;
64
+ /**
65
+ * Exported handler symbol inside the bundled module.
66
+ * @default "handler"
67
+ */
68
+ handler?: string;
69
+ /**
70
+ * Whether to create a public Lambda function URL.
71
+ * @default false
72
+ */
73
+ url?: boolean;
74
+ functionName?: string;
75
+ // TODO(sam): use a Layer instead so we can manage Effect platform?
76
+ runtime?: "nodejs22.x" | "nodejs24.x";
77
+ build?: FunctionBuildOptions;
78
+ uploadSourceMap?: boolean;
79
+ env?: Record<string, any>;
80
+ exports?: string[];
81
+ /**
82
+ * Attach the function to a VPC for private AWS connectivity such as Aurora.
83
+ */
84
+ vpc?: {
85
+ subnetIds: string[];
86
+ securityGroupIds: string[];
87
+ };
88
+ }
89
+
90
+ export interface Function extends Resource<
91
+ FunctionTypeId,
92
+ FunctionProps,
93
+ {
94
+ functionArn: string;
95
+ functionName: string;
96
+ functionUrl: string | undefined;
97
+ roleName: string;
98
+ roleArn: string;
99
+ code: {
100
+ hash: string;
101
+ };
102
+ },
103
+ {
104
+ env?: Record<string, any>;
105
+ policyStatements?: PolicyStatement[];
106
+ }
107
+ > {}
108
+
109
+ export type FunctionServices = Credentials | Region;
110
+
111
+ export type FunctionShape = Main<FunctionServices>;
112
+
113
+ /**
114
+ * An AWS Lambda host resource that combines code bundling, IAM role
115
+ * provisioning, and runtime binding collection.
116
+ *
117
+ * `Function` is the canonical runtime host for AWS. Resource bindings attach
118
+ * environment variables and IAM statements during deployment, while the runtime
119
+ * execution context collects listeners and exports from the Effect program.
120
+ *
121
+ * @section Creating Functions
122
+ * @example Basic Function
123
+ * ```typescript
124
+ * const func = yield* Function("OrdersFunction", {
125
+ * main: "./src/orders.ts",
126
+ * });
127
+ * ```
128
+ *
129
+ * @example Function with URL
130
+ * ```typescript
131
+ * const func = yield* Function("ApiFunction", {
132
+ * main: "./src/api.ts",
133
+ * url: true,
134
+ * });
135
+ * ```
136
+ */
137
+ export const Function: Platform<
138
+ Function,
139
+ FunctionServices,
140
+ FunctionShape,
141
+ Serverless.FunctionContext
142
+ > = Platform(FunctionTypeId, (id: string): Serverless.FunctionContext => {
143
+ const listeners: Effect.Effect<Serverless.FunctionListener>[] = [];
144
+ const env: Record<string, any> = {};
145
+
146
+ const ctx = {
147
+ Type: FunctionTypeId,
148
+ id,
149
+ env,
150
+ set: (id: string, output: Output.Output) =>
151
+ Effect.sync(() => {
152
+ const key = id.replaceAll(/[^a-zA-Z0-9]/g, "_");
153
+ env[key] = output.pipe(Output.map((value) => JSON.stringify(value)));
154
+ return key;
155
+ }),
156
+ get: <T>(key: string) =>
157
+ Config.string(key)
158
+ .asEffect()
159
+ .pipe(
160
+ Effect.flatMap((val) =>
161
+ Effect.try({
162
+ try: () => JSON.parse(val) as T,
163
+ catch: () => val, // assume it's just a string
164
+ }),
165
+ ),
166
+ Effect.catch((cause) =>
167
+ Effect.die(
168
+ new Error(`Failed to get environment variable: ${key}`, {
169
+ cause,
170
+ }),
171
+ ),
172
+ ),
173
+ ),
174
+ serve: (handler: HttpEffect) =>
175
+ ctx.listen(makeFunctionHttpHandler(handler)),
176
+ listen: ((
177
+ handler:
178
+ | Serverless.FunctionListener
179
+ | Effect.Effect<Serverless.FunctionListener>,
180
+ ) =>
181
+ Effect.sync(() =>
182
+ Effect.isEffect(handler)
183
+ ? listeners.push(handler)
184
+ : listeners.push(Effect.succeed(handler)),
185
+ )) as any as Serverless.FunctionContext["listen"],
186
+ exports: Effect.sync(() => ({
187
+ // construct an Effect that produces the Function's entrypoint
188
+ // Effect<(event, context) => Promise<any>>
189
+ handler: Effect.map(
190
+ Effect.all(listeners, {
191
+ concurrency: "unbounded",
192
+ }),
193
+ (handlers) =>
194
+ async (event: any, context: lambda.Context): Promise<any> => {
195
+ console.log({ event, handlers });
196
+ for (const handler of handlers) {
197
+ const eff = handler(event);
198
+ if (Effect.isEffect(eff)) {
199
+ return await eff.pipe(
200
+ Effect.provideService(HandlerContext, context),
201
+ Effect.tap(Effect.logDebug),
202
+ Effect.runPromise,
203
+ );
204
+ }
205
+ }
206
+ throw new Error("No event handler found");
207
+ },
208
+ ),
209
+ })),
210
+ };
211
+ return ctx;
212
+ });
213
+
214
+ export const FunctionProvider = () =>
215
+ Function.provider.effect(
216
+ Effect.gen(function* () {
217
+ const stack = yield* Stack;
218
+ const accountId = yield* Account;
219
+ const region = yield* Region;
220
+ const fs = yield* FileSystem.FileSystem;
221
+ const path = yield* Path.Path;
222
+ const virtualEntryPlugin = yield* Bundle.virtualEntryPlugin;
223
+ const alchemyEnv = {
224
+ ALCHEMY_STACK_NAME: stack.name,
225
+ ALCHEMY_STAGE: stack.stage,
226
+ ALCHEMY_PHASE: "runtime",
227
+ };
228
+
229
+ const createFunctionName = (
230
+ id: string,
231
+ functionName: string | undefined,
232
+ ) =>
233
+ Effect.gen(function* () {
234
+ return (
235
+ functionName ?? (yield* createPhysicalName({ id, maxLength: 64 }))
236
+ );
237
+ });
238
+
239
+ const createRoleName = (id: string) =>
240
+ createPhysicalName({ id, maxLength: 64 });
241
+
242
+ const createPolicyName = (id: string) =>
243
+ createPhysicalName({ id, maxLength: 128 });
244
+
245
+ const hashBundle = (code: Uint8Array<ArrayBufferLike>) => sha256(code);
246
+
247
+ const createNames = (id: string, functionName: string | undefined) =>
248
+ Effect.gen(function* () {
249
+ const roleName = yield* createRoleName(id);
250
+ const policyName = yield* createPolicyName(id);
251
+ const fn = yield* createFunctionName(id, functionName);
252
+ return {
253
+ roleName,
254
+ policyName,
255
+ functionName: fn,
256
+ roleArn: `arn:aws:iam::${accountId}:role/${roleName}`,
257
+ functionArn: `arn:aws:lambda:${region}:${accountId}:function:${fn}`,
258
+ };
259
+ });
260
+
261
+ const attachBindings = Effect.fnUntraced(function* ({
262
+ roleName,
263
+ policyName,
264
+ // functionArn,
265
+ // functionName,
266
+ bindings,
267
+ }: {
268
+ roleName: string;
269
+ policyName: string;
270
+ functionArn: string;
271
+ functionName: string;
272
+ bindings: ResourceBinding<Function["Binding"]>[];
273
+ }) {
274
+ const activeBindings = bindings.filter(
275
+ (
276
+ binding: ResourceBinding<Function["Binding"]> & { action?: string },
277
+ ) => binding.action !== "delete",
278
+ );
279
+ const env = activeBindings
280
+ .map((binding) => binding?.data?.env)
281
+ .reduce((acc, env) => ({ ...acc, ...env }), {});
282
+ const policyStatements = activeBindings.flatMap(
283
+ (binding) =>
284
+ binding?.data?.policyStatements?.map(
285
+ (stmt: IAM.PolicyStatement) => ({
286
+ ...stmt,
287
+ Sid: stmt.Sid?.replace(/[^A-Za-z0-9]+/gi, ""),
288
+ }),
289
+ ) ?? [],
290
+ );
291
+
292
+ if (policyStatements.length > 0) {
293
+ yield* iam.putRolePolicy({
294
+ RoleName: roleName,
295
+ PolicyName: policyName,
296
+ PolicyDocument: JSON.stringify({
297
+ Version: "2012-10-17",
298
+ Statement: policyStatements,
299
+ } satisfies IAM.PolicyDocument),
300
+ });
301
+ } else {
302
+ yield* iam
303
+ .deleteRolePolicy({
304
+ RoleName: roleName,
305
+ PolicyName: policyName,
306
+ })
307
+ .pipe(Effect.catchTag("NoSuchEntityException", () => Effect.void));
308
+ }
309
+
310
+ return env;
311
+ });
312
+
313
+ const createRoleIfNotExists = Effect.fnUntraced(function* ({
314
+ id,
315
+ roleName,
316
+ vpc,
317
+ }: {
318
+ id: string;
319
+ roleName: string;
320
+ vpc?: FunctionProps["vpc"];
321
+ }) {
322
+ yield* Effect.logDebug(`creating role ${id}`);
323
+ const tags = yield* createInternalTags(id);
324
+ const role = yield* iam
325
+ .createRole({
326
+ RoleName: roleName,
327
+ AssumeRolePolicyDocument: JSON.stringify({
328
+ Version: "2012-10-17",
329
+ Statement: [
330
+ {
331
+ Effect: "Allow",
332
+ Principal: {
333
+ Service: "lambda.amazonaws.com",
334
+ },
335
+ Action: "sts:AssumeRole",
336
+ },
337
+ ],
338
+ }),
339
+ Tags: createTagsList(tags),
340
+ })
341
+ .pipe(
342
+ Effect.catchTag("EntityAlreadyExistsException", () =>
343
+ iam
344
+ .getRole({
345
+ RoleName: roleName,
346
+ })
347
+ .pipe(
348
+ Effect.filterOrFail(
349
+ (role) => hasTags(tags, role.Role?.Tags),
350
+ () =>
351
+ new Error(
352
+ `Role ${roleName} exists but has incorrect tags`,
353
+ ),
354
+ ),
355
+ ),
356
+ ),
357
+ );
358
+
359
+ yield* Effect.logDebug(`attaching policy ${id}`);
360
+ yield* iam
361
+ .attachRolePolicy({
362
+ RoleName: roleName,
363
+ PolicyArn:
364
+ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
365
+ })
366
+ .pipe(Effect.tapError(Effect.logDebug), Effect.tap(Effect.logDebug));
367
+
368
+ if (vpc) {
369
+ yield* iam
370
+ .attachRolePolicy({
371
+ RoleName: roleName,
372
+ PolicyArn:
373
+ "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole",
374
+ })
375
+ .pipe(
376
+ Effect.tapError(Effect.logDebug),
377
+ Effect.tap(Effect.logDebug),
378
+ );
379
+ }
380
+
381
+ yield* Effect.logDebug(`attached policy ${id}`);
382
+ return role;
383
+ });
384
+
385
+ const bundleCode = Effect.fnUntraced(function* (
386
+ id: string,
387
+ props: FunctionProps,
388
+ ) {
389
+ const handler = props.handler ?? "default";
390
+ const sourcemap = props.build?.output?.sourcemap ?? true;
391
+ const uploadSourceMap = props.uploadSourceMap ?? true;
392
+
393
+ const realMain = yield* fs.realPath(props.main);
394
+ const cwd = yield* TempRoot.findCwdForBundle(realMain);
395
+
396
+ const rolldownSourcemap = sourcemap;
397
+
398
+ const buildBundle = Effect.fnUntraced(function* (
399
+ entry: string,
400
+ plugins?: rolldown.RolldownPluginOption,
401
+ ) {
402
+ return yield* Bundle.build(
403
+ {
404
+ ...props.build?.input,
405
+ input: entry,
406
+ cwd,
407
+ external: [
408
+ /^@aws-sdk\//,
409
+ /^@smithy\//,
410
+ ...((props.build?.input?.external as string[]) ?? []),
411
+ ],
412
+ platform: "node",
413
+ plugins: [props.build?.input?.plugins, plugins],
414
+ },
415
+ {
416
+ ...props.build?.output,
417
+ format: "esm",
418
+ sourcemap: rolldownSourcemap,
419
+ minify: props.build?.output?.minify ?? true,
420
+ entryFileNames: "index.js",
421
+ },
422
+ );
423
+ });
424
+
425
+ const bundleOutput = props.isExternal
426
+ ? yield* buildBundle(realMain)
427
+ : yield* buildBundle(
428
+ realMain,
429
+ virtualEntryPlugin(
430
+ (importPath) => `
431
+ import { NodeServices } from "@effect/platform-node";
432
+ import { Stack } from "alchemy-effect/Stack";
433
+ import * as Config from "effect/Config";
434
+ import * as ConfigProvider from "effect/ConfigProvider";
435
+ import * as Credentials from "@distilled.cloud/aws/Credentials";
436
+ import * as Effect from "effect/Effect";
437
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
438
+ import * as Layer from "effect/Layer";
439
+ import * as Logger from "effect/Logger";
440
+ import * as Region from "@distilled.cloud/aws/Region";
441
+ import * as ServiceMap from "effect/ServiceMap";
442
+ import { MinimumLogLevel } from "effect/References";
443
+
444
+ import { ${handler} as layer } from "${importPath}";
445
+
446
+ const platform = Layer.mergeAll(
447
+ NodeServices.layer,
448
+ FetchHttpClient.layer,
449
+ // TODO(sam): wire this up to telemetry more directly
450
+ Logger.layer([Logger.consolePretty()]),
451
+ );
452
+
453
+ const tag = ServiceMap.Service("${FunctionTypeId}<${id}>")
454
+
455
+ const stack = Layer.effect(
456
+ Stack,
457
+ Effect.all([
458
+ Config.string("ALCHEMY_STACK_NAME").asEffect(),
459
+ Config.string("ALCHEMY_STAGE").asEffect()
460
+ ]).pipe(
461
+ Effect.map(([name, stage]) => ({
462
+ name,
463
+ stage,
464
+ bindings: {},
465
+ resources: {}
466
+ }))
467
+ )
468
+ );
469
+
470
+ const handlerEffect = tag.asEffect().pipe(
471
+ Effect.flatMap(func => func.ExecutionContext.exports.handler),
472
+ Effect.provide(
473
+ layer.pipe(
474
+ Layer.provideMerge(stack),
475
+ Layer.provideMerge(Credentials.fromEnv()),
476
+ Layer.provideMerge(Region.fromEnv()),
477
+ Layer.provideMerge(platform),
478
+ Layer.provideMerge(
479
+ Layer.succeed(
480
+ ConfigProvider.ConfigProvider,
481
+ ConfigProvider.fromEnv()
482
+ )
483
+ ),
484
+ Layer.provideMerge(
485
+ Layer.succeed(
486
+ MinimumLogLevel,
487
+ process.env.DEBUG ? "Debug" : "Info",
488
+ )
489
+ ),
490
+ )
491
+ ),
492
+ Effect.scoped
493
+ );
494
+
495
+ export default await Effect.runPromise(handlerEffect)
496
+ `,
497
+ ),
498
+ );
499
+
500
+ const mainFile = bundleOutput.files[0];
501
+ const code =
502
+ typeof mainFile.content === "string"
503
+ ? new TextEncoder().encode(mainFile.content)
504
+ : mainFile.content;
505
+
506
+ const sourceMapFile =
507
+ uploadSourceMap && (sourcemap === true || sourcemap === "hidden")
508
+ ? bundleOutput.files.find((f: Bundle.BundleFile) =>
509
+ f.path.endsWith(".map"),
510
+ )
511
+ : undefined;
512
+
513
+ const archive = yield* zipCode(
514
+ code,
515
+ sourceMapFile
516
+ ? [
517
+ {
518
+ path: sourceMapFile.path,
519
+ content: sourceMapFile.content,
520
+ },
521
+ ]
522
+ : undefined,
523
+ );
524
+ return {
525
+ archive,
526
+ code,
527
+ hash: bundleOutput.hash,
528
+ };
529
+ });
530
+
531
+ const withNodeSourceMaps = (
532
+ env: Record<string, string> | undefined,
533
+ props: FunctionProps,
534
+ ) => {
535
+ const sourcemap = props.build?.output?.sourcemap ?? true;
536
+ const uploadSourceMap = props.uploadSourceMap ?? true;
537
+ const shouldEnableSourceMaps =
538
+ sourcemap === "inline" ||
539
+ (uploadSourceMap && (sourcemap === true || sourcemap === "hidden"));
540
+
541
+ if (!shouldEnableSourceMaps) {
542
+ return env;
543
+ }
544
+
545
+ const current = env?.NODE_OPTIONS;
546
+ if (current?.split(/\s+/).includes("--enable-source-maps")) {
547
+ return env;
548
+ }
549
+
550
+ return {
551
+ ...env,
552
+ NODE_OPTIONS: current
553
+ ? `${current} --enable-source-maps`
554
+ : "--enable-source-maps",
555
+ };
556
+ };
557
+
558
+ const createOrUpdateFunction = Effect.fnUntraced(function* ({
559
+ id,
560
+ news,
561
+ roleArn,
562
+ archive,
563
+ hash,
564
+ env,
565
+ functionName,
566
+ preferUpdate,
567
+ session,
568
+ }: {
569
+ id: string;
570
+ news: FunctionProps;
571
+ roleArn: string;
572
+ archive: Uint8Array<ArrayBufferLike>;
573
+ hash: string;
574
+ env: Record<string, string> | undefined;
575
+ functionName: string;
576
+ preferUpdate?: boolean;
577
+ session: { note: (note: string) => Effect.Effect<void> };
578
+ }) {
579
+ yield* Effect.logDebug(`creating function ${id}`);
580
+ const waitStartedAt = Date.now();
581
+
582
+ const isRolePropagationError = <
583
+ E extends Lambda.UpdateFunctionCodeError | Lambda.CreateFunctionError,
584
+ >(
585
+ e: E,
586
+ ) =>
587
+ e._tag === "InvalidParameterValueException" &&
588
+ (e.message?.includes("cannot be assumed by Lambda") ||
589
+ (e.message?.includes("KMS key is invalid for CreateGrant") &&
590
+ e.message?.includes("ARN does not refer to a valid principal")));
591
+
592
+ const noteRolePropagationWait = () =>
593
+ session.note(
594
+ `Waiting for Lambda execution role to become assumable: ${functionName} (${Math.ceil((Date.now() - waitStartedAt) / 1000)}s)`,
595
+ );
596
+
597
+ const tags = yield* createInternalTags(id);
598
+
599
+ // Try to use S3 if assets bucket is available, otherwise fall back to inline ZipFile
600
+ const assets = (yield* Effect.serviceOption(Assets)).pipe(
601
+ Option.getOrUndefined,
602
+ );
603
+
604
+ const codeLocation = yield* Effect.gen(function* () {
605
+ if (assets) {
606
+ const key = yield* assets.uploadAsset(hash, archive);
607
+ yield* Effect.logDebug(
608
+ `Using S3 for code: s3://${assets.bucketName}/${key}`,
609
+ );
610
+ return {
611
+ S3Bucket: assets.bucketName,
612
+ S3Key: key,
613
+ } as const;
614
+ } else {
615
+ return { ZipFile: archive } as const;
616
+ }
617
+ });
618
+ const runtimeEnv = withNodeSourceMaps(env, news);
619
+
620
+ const createFunctionRequest: CreateFunctionRequest = {
621
+ FunctionName: functionName,
622
+ Handler: `index.${news.handler ?? "default"}`,
623
+ Role: roleArn,
624
+ Code: codeLocation,
625
+ Runtime: news.runtime ?? "nodejs22.x",
626
+ Environment: runtimeEnv
627
+ ? {
628
+ Variables: {
629
+ ...runtimeEnv,
630
+ ...alchemyEnv,
631
+ },
632
+ }
633
+ : undefined,
634
+ Tags: tags,
635
+ VpcConfig: news.vpc
636
+ ? {
637
+ SubnetIds: news.vpc.subnetIds,
638
+ SecurityGroupIds: news.vpc.securityGroupIds,
639
+ }
640
+ : undefined,
641
+ };
642
+
643
+ const getAndUpdate = Lambda.getFunction({
644
+ FunctionName: functionName,
645
+ }).pipe(
646
+ Effect.filterOrFail(
647
+ // if it exists and contains these tags, we will assume it was created by alchemy
648
+ // but state was lost, so if it exists, let's adopt it
649
+ (f) => hasTags(tags, f.Tags),
650
+ () =>
651
+ // TODO(sam): add custom
652
+ new Error("Function tags do not match expected values"),
653
+ ),
654
+ Effect.flatMap(() =>
655
+ Effect.gen(function* () {
656
+ yield* Effect.logDebug(`updating function code ${id}`);
657
+ yield* Lambda.updateFunctionCode({
658
+ FunctionName: createFunctionRequest.FunctionName,
659
+ Architectures: createFunctionRequest.Architectures,
660
+ // Use S3 or ZipFile based on what was used for create
661
+ ...("S3Bucket" in codeLocation
662
+ ? {
663
+ S3Bucket: codeLocation.S3Bucket,
664
+ S3Key: codeLocation.S3Key,
665
+ }
666
+ : { ZipFile: codeLocation.ZipFile }),
667
+ }).pipe(
668
+ Effect.tapError((e) =>
669
+ isRolePropagationError(e)
670
+ ? noteRolePropagationWait()
671
+ : Effect.void,
672
+ ),
673
+ Effect.retry({
674
+ while: (e) =>
675
+ e._tag === "ResourceConflictException" ||
676
+ isRolePropagationError(e),
677
+ schedule: Schedule.exponential(100),
678
+ }),
679
+ );
680
+ yield* Effect.logDebug(`updated function code ${id}`);
681
+ yield* Lambda.updateFunctionConfiguration({
682
+ FunctionName: createFunctionRequest.FunctionName,
683
+ DeadLetterConfig: createFunctionRequest.DeadLetterConfig,
684
+ Description: createFunctionRequest.Description,
685
+ Environment: createFunctionRequest.Environment,
686
+ EphemeralStorage: createFunctionRequest.EphemeralStorage,
687
+ FileSystemConfigs: createFunctionRequest.FileSystemConfigs,
688
+ Handler: createFunctionRequest.Handler,
689
+ ImageConfig: createFunctionRequest.ImageConfig,
690
+ KMSKeyArn: createFunctionRequest.KMSKeyArn,
691
+ Layers: createFunctionRequest.Layers,
692
+ LoggingConfig: createFunctionRequest.LoggingConfig,
693
+ MemorySize: createFunctionRequest.MemorySize,
694
+ // RevisionId: "???"
695
+ Role: createFunctionRequest.Role,
696
+ Runtime: createFunctionRequest.Runtime,
697
+ SnapStart: createFunctionRequest.SnapStart,
698
+ Timeout: createFunctionRequest.Timeout,
699
+ TracingConfig: createFunctionRequest.TracingConfig,
700
+ VpcConfig: createFunctionRequest.VpcConfig,
701
+ }).pipe(
702
+ Effect.tapError((e) =>
703
+ isRolePropagationError(e)
704
+ ? noteRolePropagationWait()
705
+ : Effect.void,
706
+ ),
707
+ Effect.retry({
708
+ while: (e) =>
709
+ e._tag === "ResourceConflictException" ||
710
+ isRolePropagationError(e),
711
+ schedule: Schedule.exponential(100),
712
+ }),
713
+ );
714
+ yield* Effect.logDebug(`updated function configuration ${id}`);
715
+ }),
716
+ ),
717
+ );
718
+
719
+ const create = Lambda.createFunction(createFunctionRequest).pipe(
720
+ Effect.tapError((e) =>
721
+ Effect.gen(function* () {
722
+ yield* Effect.logDebug(e);
723
+ }),
724
+ ),
725
+ Effect.retry({
726
+ while: (e) => isRolePropagationError(e),
727
+ schedule: Schedule.fixed(1000).pipe(
728
+ Schedule.tapOutput(() => noteRolePropagationWait()),
729
+ ),
730
+ }),
731
+ Effect.catchTags({
732
+ ResourceConflictException: () => getAndUpdate,
733
+ }),
734
+ );
735
+
736
+ if (preferUpdate) {
737
+ yield* getAndUpdate.pipe(
738
+ Effect.catchTags({
739
+ ResourceNotFoundException: () => create,
740
+ }),
741
+ );
742
+ } else {
743
+ yield* create;
744
+ }
745
+ });
746
+
747
+ const createOrUpdateFunctionUrl = Effect.fnUntraced(function* ({
748
+ functionName,
749
+ url = true,
750
+ oldUrl,
751
+ }: {
752
+ functionName: string;
753
+ url: FunctionProps["url"];
754
+ oldUrl?: FunctionProps["url"];
755
+ }) {
756
+ // TODO(sam): support AWS_IAM
757
+ const authType = "NONE";
758
+ yield* Effect.logDebug(`creating function url config ${functionName}`);
759
+ if (url) {
760
+ const config = {
761
+ FunctionName: functionName,
762
+ AuthType: authType, // | AWS_IAM
763
+ // Cors: {
764
+ // AllowCredentials: true,
765
+ // AllowHeaders: ["*"],
766
+ // AllowMethods: ["*"],
767
+ // AllowOrigins: ["*"],
768
+ // ExposeHeaders: ["*"],
769
+ // MaxAge: 86400,
770
+ // },
771
+ InvokeMode: "BUFFERED", // | RESPONSE_STREAM
772
+ // Qualifier: "$LATEST"
773
+ } satisfies
774
+ | Lambda.CreateFunctionUrlConfigRequest
775
+ | Lambda.UpdateFunctionUrlConfigRequest;
776
+ const urlPermission = {
777
+ FunctionName: functionName,
778
+ StatementId: "FunctionURLAllowPublicAccess",
779
+ Action: "lambda:InvokeFunctionUrl",
780
+ Principal: "*",
781
+ FunctionUrlAuthType: "NONE",
782
+ } as const;
783
+ const invokePermission = {
784
+ FunctionName: functionName,
785
+ StatementId: "FunctionURLAllowPublicInvoke",
786
+ Action: "lambda:InvokeFunction",
787
+ Principal: "*",
788
+ } as const;
789
+ const upsertPermission = (permission: Lambda.AddPermissionRequest) =>
790
+ Lambda.addPermission(permission).pipe(
791
+ Effect.catchTag("ResourceConflictException", () =>
792
+ Effect.gen(function* () {
793
+ yield* Lambda.removePermission({
794
+ FunctionName: functionName,
795
+ StatementId: permission.StatementId,
796
+ });
797
+ yield* Lambda.addPermission(permission);
798
+ }),
799
+ ),
800
+ );
801
+ const [{ FunctionUrl }] = yield* Effect.all([
802
+ Lambda.createFunctionUrlConfig(config).pipe(
803
+ Effect.catchTag("ResourceConflictException", () =>
804
+ Lambda.updateFunctionUrlConfig(config),
805
+ ),
806
+ ),
807
+ authType === "NONE"
808
+ ? Effect.all([
809
+ upsertPermission(urlPermission),
810
+ upsertPermission(invokePermission),
811
+ ])
812
+ : // TODO(sam): support AWS_IAM
813
+ Effect.void,
814
+ ]);
815
+ yield* Effect.logDebug(`created function url config ${functionName}`);
816
+ return FunctionUrl;
817
+ } else if (oldUrl) {
818
+ yield* Effect.logDebug(
819
+ `deleting function url config ${functionName}`,
820
+ );
821
+ yield* Effect.all([
822
+ Lambda.deleteFunctionUrlConfig({
823
+ FunctionName: functionName,
824
+ }).pipe(
825
+ Effect.catchTag("ResourceNotFoundException", () => Effect.void),
826
+ ),
827
+ Lambda.removePermission({
828
+ FunctionName: functionName,
829
+ StatementId: "FunctionURLAllowPublicAccess",
830
+ }).pipe(
831
+ Effect.catchTag("ResourceNotFoundException", () => Effect.void),
832
+ ),
833
+ Lambda.removePermission({
834
+ FunctionName: functionName,
835
+ StatementId: "FunctionURLAllowPublicInvoke",
836
+ }).pipe(
837
+ Effect.catchTag("ResourceNotFoundException", () => Effect.void),
838
+ ),
839
+ ]);
840
+ yield* Effect.logDebug(`deleted function url config ${functionName}`);
841
+ }
842
+ return undefined;
843
+ });
844
+
845
+ const summary = ({ code }: { code: Uint8Array<ArrayBufferLike> }) =>
846
+ `${
847
+ code.length >= 1024 * 1024
848
+ ? `${(code.length / (1024 * 1024)).toFixed(2)}MB`
849
+ : code.length >= 1024
850
+ ? `${(code.length / 1024).toFixed(2)}KB`
851
+ : `${code.length}B`
852
+ }`;
853
+
854
+ return {
855
+ stables: ["functionArn", "functionName", "roleName"],
856
+ diff: Effect.fnUntraced(function* ({ id, olds, news, output }) {
857
+ if (!isResolved(news)) return;
858
+ // If output is undefined (resource in creating state), defer to default diff
859
+ if (!output) {
860
+ return undefined;
861
+ }
862
+ if (
863
+ // function name changed
864
+ output.functionName !==
865
+ (yield* createFunctionName(id, news.functionName)) ||
866
+ // url changed
867
+ (olds.url ?? true) !== news.url
868
+ ) {
869
+ return { action: "replace" };
870
+ }
871
+ if (
872
+ output.code.hash !==
873
+ (yield* bundleCode(id, {
874
+ main: news.main,
875
+ handler: news.handler,
876
+ build: news.build,
877
+ uploadSourceMap: news.uploadSourceMap,
878
+ })).hash
879
+ ) {
880
+ // code changed
881
+ return { action: "update" };
882
+ }
883
+ }),
884
+ read: Effect.fnUntraced(function* ({ id, output }) {
885
+ if (output) {
886
+ yield* Effect.logDebug(`reading function ${id}`);
887
+ // example: refresh the function URL from the API
888
+ return {
889
+ ...output,
890
+ functionUrl: (yield* Lambda.getFunctionUrlConfig({
891
+ FunctionName: yield* createFunctionName(
892
+ id,
893
+ output.functionName,
894
+ ),
895
+ }).pipe(
896
+ Effect.map((f) => f.FunctionUrl),
897
+ Effect.retry({
898
+ // TODO(sam): did we lose this error? Is it missing for a good
899
+ while: (e: any) => e._tag === "ResourceConflictException",
900
+ schedule: Schedule.exponential(100),
901
+ }),
902
+ Effect.catchTag("ResourceNotFoundException", () =>
903
+ Effect.succeed(undefined),
904
+ ),
905
+ )) as any,
906
+ };
907
+ }
908
+ return output;
909
+ }),
910
+
911
+ precreate: Effect.fnUntraced(function* ({ id, news, session }) {
912
+ const { roleName, functionName, roleArn } = yield* createNames(
913
+ id,
914
+ news.functionName,
915
+ );
916
+
917
+ const role = yield* createRoleIfNotExists({
918
+ id,
919
+ roleName,
920
+ vpc: news.vpc,
921
+ });
922
+
923
+ // mock code
924
+ const code = new TextEncoder().encode("export default () => {}");
925
+ const archive = yield* zipCode(code);
926
+ const hash = yield* hashBundle(code);
927
+ yield* createOrUpdateFunction({
928
+ id,
929
+ news,
930
+ roleArn: role.Role.Arn,
931
+ archive,
932
+ hash,
933
+ functionName,
934
+ env: alchemyEnv,
935
+ session,
936
+ });
937
+
938
+ return {
939
+ functionArn: `arn:aws:lambda:${region}:${accountId}:function:${functionName}`,
940
+ functionName,
941
+ functionUrl: undefined,
942
+ roleName,
943
+ code: {
944
+ hash,
945
+ },
946
+ roleArn,
947
+ };
948
+ }),
949
+ create: Effect.fnUntraced(function* ({
950
+ id,
951
+ news,
952
+ bindings,
953
+ output,
954
+ session,
955
+ }) {
956
+ const { roleName, policyName, functionName, functionArn } =
957
+ yield* createNames(id, news.functionName);
958
+
959
+ const roleArn =
960
+ output?.roleArn ??
961
+ (yield* createRoleIfNotExists({ id, roleName, vpc: news.vpc })).Role
962
+ .Arn;
963
+
964
+ const env = yield* attachBindings({
965
+ roleName,
966
+ policyName,
967
+ functionArn,
968
+ functionName,
969
+ bindings,
970
+ });
971
+
972
+ const { archive, code, hash } = yield* bundleCode(id, news);
973
+
974
+ yield* createOrUpdateFunction({
975
+ id,
976
+ news,
977
+ roleArn,
978
+ archive,
979
+ hash,
980
+ env: {
981
+ ...env,
982
+ ...news.env,
983
+ },
984
+ functionName,
985
+ preferUpdate: output !== undefined,
986
+ session,
987
+ });
988
+
989
+ const functionUrl = yield* createOrUpdateFunctionUrl({
990
+ functionName,
991
+ url: news.url,
992
+ });
993
+
994
+ yield* session.note(summary({ code }));
995
+
996
+ return {
997
+ functionArn,
998
+ functionName,
999
+ functionUrl: functionUrl as any,
1000
+ roleName,
1001
+ roleArn,
1002
+ code: {
1003
+ hash,
1004
+ },
1005
+ };
1006
+ }),
1007
+ update: Effect.fnUntraced(function* ({
1008
+ id,
1009
+ news,
1010
+ olds,
1011
+ bindings,
1012
+ output,
1013
+ session,
1014
+ }) {
1015
+ const { roleName, policyName, functionName, functionArn } =
1016
+ yield* createNames(id, news.functionName);
1017
+
1018
+ const env = yield* attachBindings({
1019
+ roleName,
1020
+ policyName,
1021
+ functionArn,
1022
+ functionName,
1023
+ bindings,
1024
+ });
1025
+
1026
+ const { archive, code, hash } = yield* bundleCode(id, news);
1027
+
1028
+ yield* createOrUpdateFunction({
1029
+ id,
1030
+ news,
1031
+ roleArn: output.roleArn,
1032
+ archive,
1033
+ hash,
1034
+ env: {
1035
+ ...env,
1036
+ ...news.env,
1037
+ },
1038
+ functionName,
1039
+ session,
1040
+ });
1041
+
1042
+ const functionUrl = yield* createOrUpdateFunctionUrl({
1043
+ functionName,
1044
+ url: news.url,
1045
+ oldUrl: olds.url,
1046
+ });
1047
+
1048
+ yield* session.note(summary({ code }));
1049
+
1050
+ return {
1051
+ ...output,
1052
+ functionArn,
1053
+ functionName,
1054
+ functionUrl: functionUrl as any,
1055
+ roleName,
1056
+ roleArn: output.roleArn,
1057
+ code: {
1058
+ hash,
1059
+ },
1060
+ };
1061
+ }),
1062
+ delete: Effect.fnUntraced(function* ({ output }) {
1063
+ yield* iam
1064
+ .listRolePolicies({
1065
+ RoleName: output.roleName,
1066
+ })
1067
+ .pipe(
1068
+ Effect.flatMap((policies) =>
1069
+ Effect.all(
1070
+ (policies.PolicyNames ?? []).map((policyName) =>
1071
+ iam.deleteRolePolicy({
1072
+ RoleName: output.roleName,
1073
+ PolicyName: policyName,
1074
+ }),
1075
+ ),
1076
+ ),
1077
+ ),
1078
+ );
1079
+
1080
+ yield* iam
1081
+ .listAttachedRolePolicies({
1082
+ RoleName: output.roleName,
1083
+ })
1084
+ .pipe(
1085
+ Effect.flatMap((policies) =>
1086
+ Effect.all(
1087
+ (policies.AttachedPolicies ?? []).map((policy) =>
1088
+ iam
1089
+ .detachRolePolicy({
1090
+ RoleName: output.roleName,
1091
+ PolicyArn: policy.PolicyArn!,
1092
+ })
1093
+ .pipe(
1094
+ Effect.catchTag(
1095
+ "NoSuchEntityException",
1096
+ () => Effect.void,
1097
+ ),
1098
+ ),
1099
+ ),
1100
+ ),
1101
+ ),
1102
+ );
1103
+
1104
+ yield* Lambda.deleteFunction({
1105
+ FunctionName: output.functionName,
1106
+ }).pipe(
1107
+ Effect.catchTag("ResourceNotFoundException", () => Effect.void),
1108
+ );
1109
+
1110
+ yield* iam
1111
+ .deleteRole({
1112
+ RoleName: output.roleName,
1113
+ })
1114
+ .pipe(Effect.catchTag("NoSuchEntityException", () => Effect.void));
1115
+ return null as any;
1116
+ }),
1117
+ tail: ({ output }) => {
1118
+ const logGroupArn = `arn:aws:logs:${region}:${accountId}:log-group:/aws/lambda/${output.functionName}`;
1119
+
1120
+ const runTailSession = Effect.gen(function* () {
1121
+ const response = yield* logs.startLiveTail({
1122
+ logGroupIdentifiers: [logGroupArn],
1123
+ });
1124
+
1125
+ if (!response.responseStream) {
1126
+ return Stream.empty as Stream.Stream<LogLine>;
1127
+ }
1128
+
1129
+ return response.responseStream.pipe(
1130
+ Stream.flatMap((event) => {
1131
+ if ("sessionUpdate" in event && event.sessionUpdate) {
1132
+ const lines: LogLine[] = (
1133
+ event.sessionUpdate.sessionResults ?? []
1134
+ ).flatMap((result) => {
1135
+ if (!result.message) return [];
1136
+ return [
1137
+ {
1138
+ timestamp: new Date(result.timestamp ?? Date.now()),
1139
+ message: result.message.trimEnd(),
1140
+ },
1141
+ ];
1142
+ });
1143
+ return Stream.fromIterable(lines);
1144
+ }
1145
+ return Stream.empty;
1146
+ }),
1147
+ );
1148
+ });
1149
+
1150
+ return Stream.unwrap(runTailSession).pipe(
1151
+ Stream.retry(Schedule.spaced("1 second")),
1152
+ );
1153
+ },
1154
+ logs: ({
1155
+ output,
1156
+ options,
1157
+ }: {
1158
+ output: Function["Attributes"];
1159
+ options: LogsInput;
1160
+ }) =>
1161
+ logs
1162
+ .filterLogEvents({
1163
+ logGroupName: `/aws/lambda/${output.functionName}`,
1164
+ startTime: options.since?.getTime(),
1165
+ limit: options.limit ?? 100,
1166
+ })
1167
+ .pipe(
1168
+ Effect.map((response) =>
1169
+ (response.events ?? []).flatMap((event): LogLine[] => {
1170
+ if (!event.message) return [];
1171
+ return [
1172
+ {
1173
+ timestamp: new Date(event.timestamp ?? Date.now()),
1174
+ message: event.message.trimEnd(),
1175
+ },
1176
+ ];
1177
+ }),
1178
+ ),
1179
+ Effect.catchTag("ResourceNotFoundException", () =>
1180
+ Effect.succeed([] as LogLine[]),
1181
+ ),
1182
+ ),
1183
+ };
1184
+ }),
1185
+ );