alchemy 2.0.0-beta.1 → 2.0.0-beta.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 (129) hide show
  1. package/bin/alchemy-effect.js +31 -16
  2. package/bin/alchemy-effect.js.map +1 -1
  3. package/bin/alchemy-effect.sh +2 -3
  4. package/bin/alchemy-effect.ts +3 -3
  5. package/lib/cli/index.d.ts +39 -36
  6. package/lib/cli/index.d.ts.map +1 -1
  7. package/package.json +1 -1
  8. package/src/AWS/ACM/Certificate.ts +49 -46
  9. package/src/AWS/AutoScaling/AutoScalingGroup.ts +4 -1
  10. package/src/AWS/AutoScaling/LaunchTemplate.ts +3 -1
  11. package/src/AWS/AutoScaling/ScalingPolicy.ts +4 -1
  12. package/src/AWS/CloudFront/Distribution.ts +4 -1
  13. package/src/AWS/CloudFront/Function.ts +4 -1
  14. package/src/AWS/CloudFront/Invalidation.ts +4 -1
  15. package/src/AWS/CloudFront/KeyValueStore.ts +4 -1
  16. package/src/AWS/CloudFront/KvEntries.ts +4 -1
  17. package/src/AWS/CloudFront/KvRoutesUpdate.ts +4 -1
  18. package/src/AWS/CloudFront/OriginAccessControl.ts +4 -1
  19. package/src/AWS/CloudWatch/Alarm.ts +4 -1
  20. package/src/AWS/CloudWatch/AlarmMuteRule.ts +4 -1
  21. package/src/AWS/CloudWatch/AnomalyDetector.ts +4 -1
  22. package/src/AWS/CloudWatch/CompositeAlarm.ts +4 -1
  23. package/src/AWS/CloudWatch/Dashboard.ts +4 -1
  24. package/src/AWS/CloudWatch/InsightRule.ts +4 -1
  25. package/src/AWS/CloudWatch/MetricStream.ts +4 -1
  26. package/src/AWS/DynamoDB/Table.ts +3 -1
  27. package/src/AWS/EC2/EIP.ts +4 -1
  28. package/src/AWS/EC2/EgressOnlyInternetGateway.ts +4 -1
  29. package/src/AWS/EC2/Instance.ts +3 -1
  30. package/src/AWS/EC2/InternetGateway.ts +4 -1
  31. package/src/AWS/EC2/NatGateway.ts +4 -1
  32. package/src/AWS/EC2/NetworkAcl.ts +4 -1
  33. package/src/AWS/EC2/NetworkAclAssociation.ts +4 -1
  34. package/src/AWS/EC2/NetworkAclEntry.ts +4 -1
  35. package/src/AWS/EC2/Route.ts +4 -1
  36. package/src/AWS/EC2/RouteTable.ts +4 -1
  37. package/src/AWS/EC2/RouteTableAssociation.ts +4 -1
  38. package/src/AWS/EC2/SecurityGroup.ts +4 -1
  39. package/src/AWS/EC2/SecurityGroupRule.ts +4 -1
  40. package/src/AWS/EC2/Subnet.ts +4 -1
  41. package/src/AWS/EC2/Vpc.ts +4 -1
  42. package/src/AWS/EC2/VpcEndpoint.ts +4 -1
  43. package/src/AWS/ECR/Repository.ts +4 -1
  44. package/src/AWS/ECS/Cluster.ts +4 -1
  45. package/src/AWS/ECS/Service.ts +4 -1
  46. package/src/AWS/ECS/Task.ts +3 -1
  47. package/src/AWS/EKS/AccessEntry.ts +4 -1
  48. package/src/AWS/EKS/Addon.ts +4 -1
  49. package/src/AWS/EKS/Cluster.ts +3 -1
  50. package/src/AWS/EKS/PodIdentityAssociation.ts +4 -1
  51. package/src/AWS/ELBv2/Listener.ts +4 -1
  52. package/src/AWS/ELBv2/LoadBalancer.ts +4 -1
  53. package/src/AWS/ELBv2/TargetGroup.ts +4 -1
  54. package/src/AWS/EventBridge/EventBus.ts +4 -1
  55. package/src/AWS/EventBridge/Permission.ts +4 -1
  56. package/src/AWS/EventBridge/Rule.ts +4 -1
  57. package/src/AWS/IAM/AccessKey.ts +4 -1
  58. package/src/AWS/IAM/AccountAlias.ts +4 -1
  59. package/src/AWS/IAM/AccountPasswordPolicy.ts +4 -1
  60. package/src/AWS/IAM/Group.ts +4 -1
  61. package/src/AWS/IAM/GroupMembership.ts +4 -1
  62. package/src/AWS/IAM/InstanceProfile.ts +4 -1
  63. package/src/AWS/IAM/LoginProfile.ts +4 -1
  64. package/src/AWS/IAM/OpenIDConnectProvider.ts +4 -1
  65. package/src/AWS/IAM/Policy.ts +4 -1
  66. package/src/AWS/IAM/Role.ts +4 -1
  67. package/src/AWS/IAM/SAMLProvider.ts +4 -1
  68. package/src/AWS/IAM/SSHPublicKey.ts +4 -1
  69. package/src/AWS/IAM/ServerCertificate.ts +4 -1
  70. package/src/AWS/IAM/ServiceSpecificCredential.ts +4 -1
  71. package/src/AWS/IAM/SigningCertificate.ts +4 -1
  72. package/src/AWS/IAM/User.ts +4 -1
  73. package/src/AWS/IAM/VirtualMFADevice.ts +4 -1
  74. package/src/AWS/IdentityCenter/AccountAssignment.ts +4 -1
  75. package/src/AWS/IdentityCenter/Group.ts +4 -1
  76. package/src/AWS/IdentityCenter/Instance.ts +4 -1
  77. package/src/AWS/IdentityCenter/PermissionSet.ts +4 -1
  78. package/src/AWS/Kinesis/Stream.ts +4 -1
  79. package/src/AWS/Kinesis/StreamConsumer.ts +4 -1
  80. package/src/AWS/Lambda/EventSourceMapping.ts +4 -1
  81. package/src/AWS/Lambda/Function.ts +3 -1
  82. package/src/AWS/Lambda/Permission.ts +4 -1
  83. package/src/AWS/Logs/LogGroup.ts +4 -1
  84. package/src/AWS/Organizations/Account.ts +4 -1
  85. package/src/AWS/Organizations/DelegatedAdministrator.ts +4 -1
  86. package/src/AWS/Organizations/Organization.ts +4 -1
  87. package/src/AWS/Organizations/OrganizationResourcePolicy.ts +4 -1
  88. package/src/AWS/Organizations/OrganizationalUnit.ts +4 -1
  89. package/src/AWS/Organizations/Policy.ts +4 -1
  90. package/src/AWS/Organizations/PolicyAttachment.ts +4 -1
  91. package/src/AWS/Organizations/Root.ts +4 -1
  92. package/src/AWS/Organizations/RootPolicyType.ts +4 -1
  93. package/src/AWS/Organizations/TrustedServiceAccess.ts +4 -1
  94. package/src/AWS/Providers.ts +484 -438
  95. package/src/AWS/RDS/DBCluster.ts +4 -1
  96. package/src/AWS/RDS/DBClusterEndpoint.ts +4 -1
  97. package/src/AWS/RDS/DBClusterParameterGroup.ts +4 -1
  98. package/src/AWS/RDS/DBInstance.ts +4 -1
  99. package/src/AWS/RDS/DBParameterGroup.ts +4 -1
  100. package/src/AWS/RDS/DBProxy.ts +4 -1
  101. package/src/AWS/RDS/DBProxyEndpoint.ts +4 -1
  102. package/src/AWS/RDS/DBProxyTargetGroup.ts +4 -1
  103. package/src/AWS/RDS/DBSubnetGroup.ts +4 -1
  104. package/src/AWS/Route53/Record.ts +4 -1
  105. package/src/AWS/S3/Bucket.ts +3 -1
  106. package/src/AWS/SNS/Subscription.ts +4 -1
  107. package/src/AWS/SNS/Topic.ts +4 -1
  108. package/src/AWS/SQS/Queue.ts +3 -1
  109. package/src/AWS/Scheduler/Schedule.ts +4 -1
  110. package/src/AWS/Scheduler/ScheduleGroup.ts +4 -1
  111. package/src/AWS/SecretsManager/Secret.ts +4 -1
  112. package/src/AWS/Website/AssetDeployment.ts +4 -1
  113. package/src/Apply.ts +3 -3
  114. package/src/Binding.ts +18 -17
  115. package/src/Cloudflare/Container/ContainerApplication.ts +3 -1
  116. package/src/Cloudflare/D1/D1Database.ts +4 -1
  117. package/src/Cloudflare/KV/KVNamespace.ts +7 -4
  118. package/src/Cloudflare/Providers.ts +62 -60
  119. package/src/Cloudflare/R2/R2Bucket.ts +4 -1
  120. package/src/Cloudflare/R2/R2BucketBinding.ts +26 -31
  121. package/src/Cloudflare/Workers/Worker.ts +3 -1
  122. package/src/Cloudflare/Workers/Workflow.ts +3 -1
  123. package/src/Plan.ts +595 -596
  124. package/src/Platform.ts +9 -8
  125. package/src/Provider.ts +145 -23
  126. package/src/Resource.ts +10 -3
  127. package/src/Stack.ts +1 -1
  128. package/src/Util/service.ts +1 -1
  129. package/src/index.ts +10 -7
@@ -7,6 +7,7 @@ import { isResolved } from "../../Diff.ts";
7
7
  import { createPhysicalName } from "../../PhysicalName.ts";
8
8
  import * as Provider from "../../Provider.ts";
9
9
  import { Resource } from "../../Resource.ts";
10
+ import type { Providers } from "../Providers.ts";
10
11
  import { createInternalTags, diffTags } from "../../Tags.ts";
11
12
 
12
13
  export interface DBClusterProps {
@@ -116,7 +117,9 @@ export interface DBCluster extends Resource<
116
117
  vpcSecurityGroupIds: string[];
117
118
  httpEndpointEnabled: boolean | undefined;
118
119
  tags: Record<string, string>;
119
- }
120
+ },
121
+ never,
122
+ Providers
120
123
  > {}
121
124
 
122
125
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import { createInternalTags, diffTags } from "../../Tags.ts";
8
9
 
9
10
  export interface DBClusterEndpointProps {
@@ -47,7 +48,9 @@ export interface DBClusterEndpoint extends Resource<
47
48
  staticMembers: string[];
48
49
  excludedMembers: string[];
49
50
  tags: Record<string, string>;
50
- }
51
+ },
52
+ never,
53
+ Providers
51
54
  > {}
52
55
 
53
56
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import { createInternalTags, diffTags } from "../../Tags.ts";
8
9
 
9
10
  export interface DBClusterParameterGroupProps {
@@ -34,7 +35,9 @@ export interface DBClusterParameterGroup extends Resource<
34
35
  family: string;
35
36
  description: string | undefined;
36
37
  tags: Record<string, string>;
37
- }
38
+ },
39
+ never,
40
+ Providers
38
41
  > {}
39
42
 
40
43
  /**
@@ -5,6 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import { createInternalTags, diffTags } from "../../Tags.ts";
9
10
 
10
11
  export interface DBInstanceProps {
@@ -80,7 +81,9 @@ export interface DBInstance extends Resource<
80
81
  dbSubnetGroupName: string | undefined;
81
82
  dbParameterGroupNames: string[];
82
83
  tags: Record<string, string>;
83
- }
84
+ },
85
+ never,
86
+ Providers
84
87
  > {}
85
88
 
86
89
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import { createInternalTags, diffTags } from "../../Tags.ts";
8
9
 
9
10
  export interface DBParameterGroupProps {
@@ -34,7 +35,9 @@ export interface DBParameterGroup extends Resource<
34
35
  family: string;
35
36
  description: string | undefined;
36
37
  tags: Record<string, string>;
37
- }
38
+ },
39
+ never,
40
+ Providers
38
41
  > {}
39
42
 
40
43
  /**
@@ -5,6 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import { createInternalTags, diffTags } from "../../Tags.ts";
9
10
 
10
11
  export interface DBProxyProps {
@@ -75,7 +76,9 @@ export interface DBProxy extends Resource<
75
76
  idleClientTimeout: number | undefined;
76
77
  debugLogging: boolean | undefined;
77
78
  tags: Record<string, string>;
78
- }
79
+ },
80
+ never,
81
+ Providers
79
82
  > {}
80
83
 
81
84
  /**
@@ -5,6 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import { createInternalTags, diffTags } from "../../Tags.ts";
9
10
 
10
11
  export interface DBProxyEndpointProps {
@@ -52,7 +53,9 @@ export interface DBProxyEndpoint extends Resource<
52
53
  vpcSecurityGroupIds: string[];
53
54
  targetRole: string | undefined;
54
55
  tags: Record<string, string>;
55
- }
56
+ },
57
+ never,
58
+ Providers
56
59
  > {}
57
60
 
58
61
  /**
@@ -3,6 +3,7 @@ import * as Effect from "effect/Effect";
3
3
  import { isResolved } from "../../Diff.ts";
4
4
  import * as Provider from "../../Provider.ts";
5
5
  import { Resource } from "../../Resource.ts";
6
+ import type { Providers } from "../Providers.ts";
6
7
 
7
8
  export interface DBProxyTargetGroupProps {
8
9
  /**
@@ -40,7 +41,9 @@ export interface DBProxyTargetGroup extends Resource<
40
41
  connectionPoolConfig: rds.ConnectionPoolConfigurationInfo | undefined;
41
42
  dbClusterIdentifiers: string[];
42
43
  dbInstanceIdentifiers: string[];
43
- }
44
+ },
45
+ never,
46
+ Providers
44
47
  > {}
45
48
 
46
49
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import { createInternalTags, diffTags } from "../../Tags.ts";
8
9
  import type { SubnetId } from "../EC2/Subnet.ts";
9
10
 
@@ -38,7 +39,9 @@ export interface DBSubnetGroup extends Resource<
38
39
  status: string | undefined;
39
40
  supportedNetworkTypes: string[] | undefined;
40
41
  tags: Record<string, string>;
41
- }
42
+ },
43
+ never,
44
+ Providers
42
45
  > {}
43
46
 
44
47
  /**
@@ -5,6 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import type { Input } from "../../Input.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
 
9
10
  export interface RecordAliasTarget {
10
11
  /**
@@ -92,7 +93,9 @@ export interface Record extends Resource<
92
93
  * Optional routing set identifier.
93
94
  */
94
95
  setIdentifier: string | undefined;
95
- }
96
+ },
97
+ never,
98
+ Providers
96
99
  > {}
97
100
 
98
101
  /**
@@ -8,6 +8,7 @@ import { isResolved } from "../../Diff.ts";
8
8
  import { createPhysicalName } from "../../PhysicalName.ts";
9
9
  import * as Provider from "../../Provider.ts";
10
10
  import { Resource, type ResourceBinding } from "../../Resource.ts";
11
+ import type { Providers } from "../Providers.ts";
11
12
  import { diffTags } from "../../Tags.ts";
12
13
  import { Account, type AccountID } from "../Account.ts";
13
14
  import type { PolicyStatement } from "../IAM/Policy.ts";
@@ -76,7 +77,8 @@ export interface Bucket extends Resource<
76
77
  * Policy statements for the bucket.
77
78
  */
78
79
  policyStatements?: PolicyStatement[];
79
- }
80
+ },
81
+ Providers
80
82
  > {}
81
83
 
82
84
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import type { Input } from "../../Input.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
 
8
9
  export type SubscriptionArn = string;
9
10
 
@@ -42,7 +43,9 @@ export interface Subscription extends Resource<
42
43
  owner: string | undefined;
43
44
  pendingConfirmation: boolean;
44
45
  attributes: Record<string, string>;
45
- }
46
+ },
47
+ never,
48
+ Providers
46
49
  > {}
47
50
 
48
51
  /**
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import { createInternalTags, createTagsList, diffTags } from "../../Tags.ts";
8
9
  import type { AccountID } from "../Account.ts";
9
10
  import type { RegionID } from "../Region.ts";
@@ -50,7 +51,9 @@ export interface Topic extends Resource<
50
51
  attributes: Record<string, string>;
51
52
  dataProtectionPolicy: string | undefined;
52
53
  tags: Record<string, string>;
53
- }
54
+ },
55
+ never,
56
+ Providers
54
57
  > {}
55
58
 
56
59
  /**
@@ -6,6 +6,7 @@ import { isResolved } from "../../Diff.ts";
6
6
  import { createPhysicalName } from "../../PhysicalName.ts";
7
7
  import * as Provider from "../../Provider.ts";
8
8
  import { Resource, type ResourceBinding } from "../../Resource.ts";
9
+ import type { Providers } from "../Providers.ts";
9
10
  import { Account, type AccountID } from "../Account.ts";
10
11
  import type { PolicyStatement } from "../IAM/Policy.ts";
11
12
  import type { RegionID } from "../Region.ts";
@@ -82,7 +83,8 @@ export interface Queue extends Resource<
82
83
  },
83
84
  {
84
85
  policyStatements: PolicyStatement[];
85
- }
86
+ },
87
+ Providers
86
88
  > {}
87
89
 
88
90
  export const Queue = Resource<Queue>("AWS.SQS.Queue");
@@ -5,6 +5,7 @@ import type { Input } from "../../Input.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import {
9
10
  createInternalTags,
10
11
  createTagsList,
@@ -97,7 +98,9 @@ export interface Schedule extends Resource<
97
98
  scheduleName: string;
98
99
  groupName: string;
99
100
  state: string | undefined;
100
- }
101
+ },
102
+ never,
103
+ Providers
101
104
  > {}
102
105
 
103
106
  export const Schedule = Resource<Schedule>("AWS.Scheduler.Schedule");
@@ -4,6 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
+ import type { Providers } from "../Providers.ts";
7
8
  import {
8
9
  createInternalTags,
9
10
  createTagsList,
@@ -45,7 +46,9 @@ export interface ScheduleGroup extends Resource<
45
46
  scheduleGroupArn: string;
46
47
  scheduleGroupName: string;
47
48
  state: string | undefined;
48
- }
49
+ },
50
+ never,
51
+ Providers
49
52
  > {}
50
53
 
51
54
  export const ScheduleGroup = Resource<ScheduleGroup>(
@@ -5,6 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import { createInternalTags, diffTags } from "../../Tags.ts";
9
10
 
10
11
  export interface GenerateSecretStringProps
@@ -62,7 +63,9 @@ export interface Secret extends Resource<
62
63
  description: string | undefined;
63
64
  kmsKeyId: string | undefined;
64
65
  tags: Record<string, string>;
65
- }
66
+ },
67
+ never,
68
+ Providers
66
69
  > {}
67
70
 
68
71
  /**
@@ -7,6 +7,7 @@ import { readdir, readFile } from "node:fs/promises";
7
7
  import path from "node:path";
8
8
  import * as Provider from "../../Provider.ts";
9
9
  import { Resource } from "../../Resource.ts";
10
+ import type { Providers } from "../Providers.ts";
10
11
  import type { WebsiteTextEncoding } from "./shared.ts";
11
12
 
12
13
  export interface AssetFileOption {
@@ -67,7 +68,9 @@ export interface AssetDeployment extends Resource<
67
68
  prefix: string;
68
69
  version: string;
69
70
  fileCount: number;
70
- }
71
+ },
72
+ never,
73
+ Providers
71
74
  > {}
72
75
 
73
76
  /**
package/src/Apply.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as Deferred from "effect/Deferred";
2
2
  import * as Effect from "effect/Effect";
3
+ import * as Option from "effect/Option";
3
4
  import type { Simplify } from "effect/Types";
4
5
  import {
5
6
  Artifacts,
@@ -8,7 +9,6 @@ import {
8
9
  ensureArtifactStore,
9
10
  makeScopedArtifacts,
10
11
  } from "./Artifacts.ts";
11
- import * as Option from "effect/Option";
12
12
  import {
13
13
  type PlanStatusSession,
14
14
  type ScopedPlanStatusSession,
@@ -21,7 +21,7 @@ import type { Input } from "./Input.ts";
21
21
  import { generateInstanceId, InstanceId } from "./InstanceId.ts";
22
22
  import * as Output from "./Output.ts";
23
23
  import { type Apply, type Delete, type Plan } from "./Plan.ts";
24
- import { getProviderByType } from "./Provider.ts";
24
+ import { findProviderByType } from "./Provider.ts";
25
25
  import type { ResourceBinding } from "./Resource.ts";
26
26
  import { Stack } from "./Stack.ts";
27
27
  import { Stage } from "./Stage.ts";
@@ -927,7 +927,7 @@ const collectGarbage = Effect.fnUntraced(function* (
927
927
  downstream: node.old.downstream,
928
928
  props: node.old.props,
929
929
  attr: node.old.attr,
930
- provider: yield* getProviderByType(node.old.resourceType),
930
+ provider: yield* findProviderByType(node.old.resourceType),
931
931
  };
932
932
 
933
933
  const fqn = toFqn(namespace, logicalId);
package/src/Binding.ts CHANGED
@@ -6,6 +6,7 @@ import { SingleShotGen } from "effect/Utils";
6
6
  import { ExecutionContext } from "./ExecutionContext.ts";
7
7
  import * as Namespace from "./Namespace.ts";
8
8
  import { ALCHEMY_PHASE } from "./Phase.ts";
9
+ import { tryFindProviderByType } from "./Provider.ts";
9
10
  import type { ResourceLike } from "./Resource.ts";
10
11
  import { Self } from "./Self.ts";
11
12
  import { CurrentStack } from "./Stack.ts";
@@ -133,24 +134,24 @@ export const Policy =
133
134
 
134
135
  // we use a service option because at runtime (e.g. in a Lambda Function or Cloudflare Worker)
135
136
  // the Policy Layer is not provided and this becomes a no-op
136
- const Service = Effect.serviceOption(self)
137
- .asEffect()
138
- .pipe(
139
- Effect.map(Option.getOrUndefined),
140
- Effect.flatMap((service) =>
141
- service
142
- ? Effect.succeed(service)
143
- : Effect.all([CurrentStack, ALCHEMY_PHASE.asEffect()]).pipe(
144
- Effect.flatMap(([stack, phase]) =>
145
- stack && phase === "plan"
146
- ? Effect.die(
147
- `Binding.Policy provider '${Identifier}' was not provided at Plan Time in Stack '${stack.name}'`,
148
- )
149
- : Effect.succeed((() => Effect.void) as any as Shape),
150
- ),
137
+ const Service = tryFindProviderByType<Policy<Self, Identifier, Shape>>(
138
+ self.key as Identifier,
139
+ ).pipe(
140
+ Effect.map(Option.getOrUndefined),
141
+ Effect.flatMap((service) =>
142
+ service
143
+ ? Effect.succeed(service)
144
+ : Effect.all([CurrentStack, ALCHEMY_PHASE.asEffect()]).pipe(
145
+ Effect.flatMap(([stack, phase]) =>
146
+ stack && phase === "plan"
147
+ ? Effect.die(
148
+ `Binding.Policy provider 'Policy<${Identifier}>' was not provided at Plan Time in Stack '${stack.name}'`,
149
+ )
150
+ : Effect.succeed((() => Effect.void) as any as Shape),
151
151
  ),
152
- ),
153
- );
152
+ ),
153
+ ),
154
+ );
154
155
 
155
156
  const asEffect = () =>
156
157
  Effect.all([Self.asEffect(), Service]).pipe(
@@ -33,6 +33,7 @@ import { sha256Object } from "../../Util/sha256.ts";
33
33
  import { normalizeNulls } from "../../Util/stable.ts";
34
34
  import { Account } from "../Account.ts";
35
35
  import { CloudflareLogs, type TelemetryFilter } from "../Logs.ts";
36
+ import type { Providers } from "../Providers.ts";
36
37
  import { Container, ContainerTypeId } from "./Container.ts";
37
38
 
38
39
  export { Credentials } from "@distilled.cloud/cloudflare/Credentials";
@@ -254,7 +255,8 @@ export interface ContainerApplication<Shape = unknown> extends Resource<
254
255
  namespaceId: string;
255
256
  };
256
257
  env?: Record<string, any>;
257
- }
258
+ },
259
+ Providers
258
260
  > {
259
261
  /** @internal phantom */
260
262
  Shape: Shape;
@@ -6,6 +6,7 @@ import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
8
  import { Account } from "../Account.ts";
9
+ import type { Providers } from "../Providers.ts";
9
10
 
10
11
  export type Jurisdiction = "default" | "eu" | "fedramp";
11
12
  export type PrimaryLocationHint =
@@ -48,7 +49,9 @@ export type D1Database = Resource<
48
49
  jurisdiction: Jurisdiction;
49
50
  readReplication: { mode: "auto" | "disabled" } | undefined;
50
51
  accountId: string;
51
- }
52
+ },
53
+ never,
54
+ Providers
52
55
  >;
53
56
 
54
57
  /**
@@ -5,9 +5,10 @@ import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
7
  import { Account } from "../Account.ts";
8
+ import type { Providers } from "../Providers.ts";
8
9
  import { KVNamespaceBinding } from "./KVNamespaceBinding.ts";
9
10
 
10
- export type NamespaceProps = {
11
+ export type KVNamespaceProps = {
11
12
  /**
12
13
  * A human-readable string name for the namespace.
13
14
  * If omitted, a unique name will be generated.
@@ -18,20 +19,22 @@ export type NamespaceProps = {
18
19
 
19
20
  export type KVNamespace = Resource<
20
21
  "Cloudflare.KVNamespace",
21
- NamespaceProps,
22
+ KVNamespaceProps,
22
23
  {
23
24
  title: string;
24
25
  namespaceId: string;
25
26
  supportsUrlEncoding: boolean | undefined;
26
27
  accountId: string;
27
- }
28
+ },
29
+ never,
30
+ Providers
28
31
  >;
29
32
 
30
33
  export const KVNamespace = Resource<KVNamespace>("Cloudflare.KVNamespace")({
31
34
  bind: KVNamespaceBinding.bind,
32
35
  });
33
36
 
34
- export const NamespaceProvider = () =>
37
+ export const KVNamespaceProvider = () =>
35
38
  Provider.effect(
36
39
  KVNamespace,
37
40
  Effect.gen(function* () {
@@ -1,75 +1,77 @@
1
1
  import * as Auth from "@distilled.cloud/cloudflare/Auth";
2
- import { pipe } from "effect/Function";
3
2
  import * as Layer from "effect/Layer";
4
- import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
5
3
  import * as Socket from "effect/unstable/socket/Socket";
6
- import { CommandProvider } from "../Build/Command.ts";
7
- import { RandomProvider } from "../Random.ts";
4
+ import { Command } from "../Build/Command.ts";
5
+ import * as Build from "../Build/index.ts";
6
+ import * as Provider from "../Provider.ts";
7
+ import { Random, RandomProvider } from "../Random.ts";
8
8
  import * as Account from "./Account.ts";
9
- import { ContainerProvider } from "./Container/ContainerApplication.ts";
9
+ import * as Containers from "./Container/index.ts";
10
10
  import * as D1 from "./D1/index.ts";
11
11
  import * as KV from "./KV/index.ts";
12
12
  import * as R2 from "./R2/index.ts";
13
- import { AssetsProvider } from "./Workers/Assets.ts";
14
- import { WorkerProvider } from "./Workers/Worker.ts";
15
- import { WorkflowProvider } from "./Workers/Workflow.ts";
13
+ import * as Assets from "./Workers/Assets.ts";
14
+ import * as Workers from "./Workers/index.ts";
15
+ import * as Workflows from "./Workers/Workflow.ts";
16
16
 
17
- // export type Providers = Extract<Layer.Success<_providers>, Provider<any>>;
17
+ export { Credentials } from "@distilled.cloud/cloudflare/Credentials";
18
18
 
19
- export interface Providers extends Layer.Layer<
20
- Layer.Success<_providers>,
21
- Layer.Error<_providers>,
22
- Layer.Services<_providers>
23
- > {}
19
+ export class Providers extends Provider.ProviderCollection<Providers>()(
20
+ "Cloudflare",
21
+ ) {}
22
+
23
+ export type ProviderRequirements = Layer.Services<ReturnType<typeof providers>>;
24
24
 
25
25
  /**
26
26
  * Cloudflare providers, bindings, and credentials for Worker-based stacks.
27
27
  */
28
- export const providers: () => Providers = () => _providers();
29
-
30
- type _providers = ReturnType<typeof _providers>;
31
- const _providers = () =>
32
- pipe(
33
- resources(),
34
- Layer.provideMerge(bindings()),
35
- Layer.provideMerge(utils()),
36
- Layer.provideMerge(credentials()),
28
+ export const providers = () =>
29
+ Layer.effect(
30
+ Providers,
31
+ Provider.collection([
32
+ Command,
33
+ Containers.Container,
34
+ D1.D1ConnectionPolicy,
35
+ D1.D1Database,
36
+ KV.KVNamespace,
37
+ KV.KVNamespaceBindingPolicy,
38
+ R2.R2Bucket,
39
+ R2.R2BucketBindingPolicy,
40
+ Random,
41
+ Workers.BindWorkerPolicy,
42
+ Workers.FetchPolicy,
43
+ Workers.Worker,
44
+ Workflows.WorkflowResource,
45
+ ]),
46
+ ).pipe(
47
+ Layer.provide(
48
+ Layer.mergeAll(
49
+ Containers.ContainerProvider(),
50
+ D1.D1ConnectionPolicyLive,
51
+ D1.DatabaseProvider(),
52
+ KV.KVNamespaceBindingPolicyLive,
53
+ KV.KVNamespaceProvider(),
54
+ R2.R2BucketBindingPolicyLive,
55
+ R2.R2BucketProvider(),
56
+ Workers.BindWorkerPolicyLive,
57
+ Workers.FetchPolicyLive,
58
+ Workers.WorkerProvider(),
59
+ Workflows.WorkflowProvider(),
60
+ ),
61
+ ),
62
+ Layer.provideMerge(
63
+ Layer.mergeAll(
64
+ Assets.AssetsProvider(),
65
+ Build.CommandProvider(),
66
+ RandomProvider(),
67
+ ),
68
+ ),
69
+ Layer.provideMerge(
70
+ Layer.mergeAll(
71
+ Account.fromStageConfig(),
72
+ Auth.fromEnv(),
73
+ Socket.layerWebSocketConstructorGlobal,
74
+ ),
75
+ ),
37
76
  Layer.orDie,
38
77
  );
39
-
40
- /**
41
- * Cloudflare account credentials and auth context.
42
- */
43
- export const credentials = () =>
44
- Layer.mergeAll(
45
- Account.fromStageConfig(),
46
- Layer.provideMerge(Auth.fromEnv(), FetchHttpClient.layer),
47
- );
48
-
49
- /**
50
- * All Cloudflare resource providers.
51
- */
52
- export const resources = () =>
53
- Layer.mergeAll(
54
- CommandProvider(),
55
- RandomProvider(),
56
- ContainerProvider(),
57
- WorkerProvider(),
58
- WorkflowProvider(),
59
- D1.DatabaseProvider(),
60
- KV.NamespaceProvider(),
61
- R2.R2BucketProvider(),
62
- );
63
-
64
- /**
65
- * All Cloudflare binding policies.
66
- */
67
- export const bindings = () =>
68
- Layer.mergeAll(
69
- D1.D1ConnectionPolicyLive,
70
- R2.R2BucketBindingPolicyLive,
71
- KV.KVNamespaceBindingPolicyLive,
72
- );
73
-
74
- const utils = () =>
75
- Layer.mergeAll(AssetsProvider(), Socket.layerWebSocketConstructorGlobal);
@@ -6,6 +6,7 @@ import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
8
  import { Account } from "../Account.ts";
9
+ import type { Providers } from "../Providers.ts";
9
10
  import { R2BucketBinding } from "./R2BucketBinding.ts";
10
11
 
11
12
  export type R2BucketName = string;
@@ -41,7 +42,9 @@ export type R2Bucket = Resource<
41
42
  jurisdiction: R2Bucket.Jurisdiction;
42
43
  location: R2Bucket.Location | undefined;
43
44
  accountId: string;
44
- }
45
+ },
46
+ never,
47
+ Providers
45
48
  >;
46
49
 
47
50
  export const R2Bucket = Resource<R2Bucket>("Cloudflare.R2Bucket")({