alchemy 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/alchemy-effect.js +31 -16
- package/bin/alchemy-effect.js.map +1 -1
- package/bin/alchemy-effect.sh +2 -3
- package/bin/alchemy-effect.ts +3 -3
- package/lib/cli/index.d.ts +39 -36
- package/lib/cli/index.d.ts.map +1 -1
- package/package.json +18 -9
- package/src/AWS/ACM/Certificate.ts +49 -46
- package/src/AWS/AutoScaling/AutoScalingGroup.ts +4 -1
- package/src/AWS/AutoScaling/LaunchTemplate.ts +3 -1
- package/src/AWS/AutoScaling/ScalingPolicy.ts +4 -1
- package/src/AWS/CloudFront/Distribution.ts +4 -1
- package/src/AWS/CloudFront/Function.ts +4 -1
- package/src/AWS/CloudFront/Invalidation.ts +4 -1
- package/src/AWS/CloudFront/KeyValueStore.ts +4 -1
- package/src/AWS/CloudFront/KvEntries.ts +4 -1
- package/src/AWS/CloudFront/KvRoutesUpdate.ts +4 -1
- package/src/AWS/CloudFront/OriginAccessControl.ts +4 -1
- package/src/AWS/CloudWatch/Alarm.ts +4 -1
- package/src/AWS/CloudWatch/AlarmMuteRule.ts +4 -1
- package/src/AWS/CloudWatch/AnomalyDetector.ts +4 -1
- package/src/AWS/CloudWatch/CompositeAlarm.ts +4 -1
- package/src/AWS/CloudWatch/Dashboard.ts +4 -1
- package/src/AWS/CloudWatch/InsightRule.ts +4 -1
- package/src/AWS/CloudWatch/MetricStream.ts +4 -1
- package/src/AWS/DynamoDB/Table.ts +3 -1
- package/src/AWS/EC2/EIP.ts +4 -1
- package/src/AWS/EC2/EgressOnlyInternetGateway.ts +4 -1
- package/src/AWS/EC2/Instance.ts +3 -1
- package/src/AWS/EC2/InternetGateway.ts +4 -1
- package/src/AWS/EC2/NatGateway.ts +4 -1
- package/src/AWS/EC2/NetworkAcl.ts +4 -1
- package/src/AWS/EC2/NetworkAclAssociation.ts +4 -1
- package/src/AWS/EC2/NetworkAclEntry.ts +4 -1
- package/src/AWS/EC2/Route.ts +4 -1
- package/src/AWS/EC2/RouteTable.ts +4 -1
- package/src/AWS/EC2/RouteTableAssociation.ts +4 -1
- package/src/AWS/EC2/SecurityGroup.ts +4 -1
- package/src/AWS/EC2/SecurityGroupRule.ts +4 -1
- package/src/AWS/EC2/Subnet.ts +4 -1
- package/src/AWS/EC2/Vpc.ts +4 -1
- package/src/AWS/EC2/VpcEndpoint.ts +4 -1
- package/src/AWS/ECR/Repository.ts +4 -1
- package/src/AWS/ECS/Cluster.ts +4 -1
- package/src/AWS/ECS/Service.ts +4 -1
- package/src/AWS/ECS/Task.ts +3 -1
- package/src/AWS/EKS/AccessEntry.ts +4 -1
- package/src/AWS/EKS/Addon.ts +4 -1
- package/src/AWS/EKS/Cluster.ts +3 -1
- package/src/AWS/EKS/PodIdentityAssociation.ts +4 -1
- package/src/AWS/ELBv2/Listener.ts +4 -1
- package/src/AWS/ELBv2/LoadBalancer.ts +4 -1
- package/src/AWS/ELBv2/TargetGroup.ts +4 -1
- package/src/AWS/EventBridge/EventBus.ts +4 -1
- package/src/AWS/EventBridge/Permission.ts +4 -1
- package/src/AWS/EventBridge/Rule.ts +4 -1
- package/src/AWS/IAM/AccessKey.ts +4 -1
- package/src/AWS/IAM/AccountAlias.ts +4 -1
- package/src/AWS/IAM/AccountPasswordPolicy.ts +4 -1
- package/src/AWS/IAM/Group.ts +4 -1
- package/src/AWS/IAM/GroupMembership.ts +4 -1
- package/src/AWS/IAM/InstanceProfile.ts +4 -1
- package/src/AWS/IAM/LoginProfile.ts +4 -1
- package/src/AWS/IAM/OpenIDConnectProvider.ts +4 -1
- package/src/AWS/IAM/Policy.ts +4 -1
- package/src/AWS/IAM/Role.ts +4 -1
- package/src/AWS/IAM/SAMLProvider.ts +4 -1
- package/src/AWS/IAM/SSHPublicKey.ts +4 -1
- package/src/AWS/IAM/ServerCertificate.ts +4 -1
- package/src/AWS/IAM/ServiceSpecificCredential.ts +4 -1
- package/src/AWS/IAM/SigningCertificate.ts +4 -1
- package/src/AWS/IAM/User.ts +4 -1
- package/src/AWS/IAM/VirtualMFADevice.ts +4 -1
- package/src/AWS/IdentityCenter/AccountAssignment.ts +4 -1
- package/src/AWS/IdentityCenter/Group.ts +4 -1
- package/src/AWS/IdentityCenter/Instance.ts +4 -1
- package/src/AWS/IdentityCenter/PermissionSet.ts +4 -1
- package/src/AWS/Kinesis/Stream.ts +4 -1
- package/src/AWS/Kinesis/StreamConsumer.ts +4 -1
- package/src/AWS/Lambda/EventSourceMapping.ts +4 -1
- package/src/AWS/Lambda/Function.ts +3 -1
- package/src/AWS/Lambda/Permission.ts +4 -1
- package/src/AWS/Logs/LogGroup.ts +4 -1
- package/src/AWS/Organizations/Account.ts +4 -1
- package/src/AWS/Organizations/DelegatedAdministrator.ts +4 -1
- package/src/AWS/Organizations/Organization.ts +4 -1
- package/src/AWS/Organizations/OrganizationResourcePolicy.ts +4 -1
- package/src/AWS/Organizations/OrganizationalUnit.ts +4 -1
- package/src/AWS/Organizations/Policy.ts +4 -1
- package/src/AWS/Organizations/PolicyAttachment.ts +4 -1
- package/src/AWS/Organizations/Root.ts +4 -1
- package/src/AWS/Organizations/RootPolicyType.ts +4 -1
- package/src/AWS/Organizations/TrustedServiceAccess.ts +4 -1
- package/src/AWS/Providers.ts +484 -438
- package/src/AWS/RDS/DBCluster.ts +4 -1
- package/src/AWS/RDS/DBClusterEndpoint.ts +4 -1
- package/src/AWS/RDS/DBClusterParameterGroup.ts +4 -1
- package/src/AWS/RDS/DBInstance.ts +4 -1
- package/src/AWS/RDS/DBParameterGroup.ts +4 -1
- package/src/AWS/RDS/DBProxy.ts +4 -1
- package/src/AWS/RDS/DBProxyEndpoint.ts +4 -1
- package/src/AWS/RDS/DBProxyTargetGroup.ts +4 -1
- package/src/AWS/RDS/DBSubnetGroup.ts +4 -1
- package/src/AWS/Route53/Record.ts +4 -1
- package/src/AWS/S3/Bucket.ts +3 -1
- package/src/AWS/SNS/Subscription.ts +4 -1
- package/src/AWS/SNS/Topic.ts +4 -1
- package/src/AWS/SQS/Queue.ts +3 -1
- package/src/AWS/Scheduler/Schedule.ts +4 -1
- package/src/AWS/Scheduler/ScheduleGroup.ts +4 -1
- package/src/AWS/SecretsManager/Secret.ts +4 -1
- package/src/AWS/Website/AssetDeployment.ts +4 -1
- package/src/Apply.ts +3 -3
- package/src/Binding.ts +18 -17
- package/src/Cloudflare/Container/Container.ts +122 -0
- package/src/Cloudflare/Container/ContainerApplication.ts +6 -1
- package/src/Cloudflare/Container/ContainerBinding.ts +1 -1
- package/src/Cloudflare/Container/StartContainer.ts +1 -1
- package/src/Cloudflare/D1/D1Database.ts +27 -5
- package/src/Cloudflare/KV/KVNamespace.ts +32 -4
- package/src/Cloudflare/Providers.ts +62 -60
- package/src/Cloudflare/R2/R2Bucket.ts +47 -1
- package/src/Cloudflare/R2/R2BucketBinding.ts +26 -31
- package/src/Cloudflare/Website/StaticSite.ts +57 -0
- package/src/Cloudflare/Website/Vite.ts +52 -8
- package/src/Cloudflare/Workers/{DurableObject.ts → DurableObjectNamespace.ts} +242 -0
- package/src/Cloudflare/Workers/DynamicWorkerLoader.ts +66 -7
- package/src/Cloudflare/Workers/WebSocket.ts +1 -1
- package/src/Cloudflare/Workers/Worker.ts +315 -8
- package/src/Cloudflare/Workers/Workflow.ts +56 -12
- package/src/Cloudflare/Workers/index.ts +1 -1
- package/src/GitHub/Comment.ts +224 -0
- package/src/GitHub/Secret.ts +212 -0
- package/src/GitHub/Variable.ts +123 -0
- package/src/GitHub/index.ts +3 -0
- package/src/Plan.ts +595 -596
- package/src/Platform.ts +9 -8
- package/src/Provider.ts +145 -23
- package/src/Resource.ts +10 -3
- package/src/Stack.ts +1 -1
- package/src/Util/dedent.ts +56 -0
- package/src/Util/index.ts +1 -0
- package/src/Util/service.ts +1 -1
- package/src/index.ts +10 -7
package/bin/alchemy-effect.js
CHANGED
|
@@ -69,7 +69,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
69
69
|
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region package.json
|
|
72
|
-
var version = "2.0.0-beta.
|
|
72
|
+
var version = "2.0.0-beta.3";
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/Artifacts.ts
|
|
@@ -240,10 +240,24 @@ const parseFqn = (fqn) => {
|
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region src/Provider.ts
|
|
242
242
|
const Provider = (type) => Context.Service()(type);
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
const isProviderCollectionService = (value) => {
|
|
244
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "ProviderCollection";
|
|
245
|
+
};
|
|
246
|
+
const findProviderByType = (type) => tryFindProviderByType(type).pipe(Effect.flatMap(Option.match({
|
|
247
|
+
onNone: () => Effect.die(`Provider not found for ${type}`),
|
|
248
|
+
onSome: (provider) => Effect.succeed(provider)
|
|
249
|
+
})));
|
|
250
|
+
const tryFindProviderByType = Effect.fnUntraced(function* (resourceType) {
|
|
251
|
+
const Tag = Provider(resourceType);
|
|
252
|
+
const direct = yield* Effect.serviceOption(Tag);
|
|
253
|
+
if (Option.isSome(direct)) return direct;
|
|
254
|
+
const context = yield* Effect.context();
|
|
255
|
+
for (const value of context.mapUnsafe.values()) if (isProviderCollectionService(value)) {
|
|
256
|
+
const provider = value.get(resourceType);
|
|
257
|
+
if (provider) return Option.some(provider);
|
|
258
|
+
}
|
|
259
|
+
console.log(context.mapUnsafe.keys());
|
|
260
|
+
return Option.none();
|
|
247
261
|
});
|
|
248
262
|
|
|
249
263
|
//#endregion
|
|
@@ -278,9 +292,9 @@ const make$1 = (name, providers, stack) => (effect) => Effect.all([
|
|
|
278
292
|
Stack.asEffect(),
|
|
279
293
|
Effect.context()
|
|
280
294
|
]).pipe(Effect.map(([output, stack$1, services]) => ({
|
|
295
|
+
...stack$1,
|
|
281
296
|
output,
|
|
282
|
-
services
|
|
283
|
-
...stack$1
|
|
297
|
+
services
|
|
284
298
|
})), Effect.provide(providers), Effect.provideServiceEffect(Stack, Stage.asEffect().pipe(Effect.map((stage$1) => stack ?? {
|
|
285
299
|
name,
|
|
286
300
|
stage: stage$1,
|
|
@@ -1078,7 +1092,7 @@ const collectGarbage = Effect.fnUntraced(function* (plan, session) {
|
|
|
1078
1092
|
downstream: node.old.downstream,
|
|
1079
1093
|
props: node.old.props,
|
|
1080
1094
|
attr: node.old.attr,
|
|
1081
|
-
provider: yield*
|
|
1095
|
+
provider: yield* findProviderByType(node.old.resourceType)
|
|
1082
1096
|
};
|
|
1083
1097
|
const fqn = toFqn(namespace, logicalId);
|
|
1084
1098
|
const nextAncestors = new Set(ancestors).add(fqn);
|
|
@@ -44364,7 +44378,7 @@ const asEffect = (effect) => Effect.isEffect(effect) ? effect : Effect.succeed(e
|
|
|
44364
44378
|
|
|
44365
44379
|
//#endregion
|
|
44366
44380
|
//#region src/Plan.ts
|
|
44367
|
-
const make = (stack, options = {}) =>
|
|
44381
|
+
const make = (stack, options = {}) => Effect.gen(function* () {
|
|
44368
44382
|
const state = yield* State;
|
|
44369
44383
|
const resources = Object.values(stack.resources);
|
|
44370
44384
|
const stackName = stack.name;
|
|
@@ -44382,7 +44396,7 @@ const make = (stack, options = {}) => ensureArtifactStore(Effect.gen(function* (
|
|
|
44382
44396
|
const resolveResource = (resourceExpr) => Effect.gen(function* () {
|
|
44383
44397
|
return yield* resolvedResources[resourceExpr.src.FQN] ??= yield* Effect.cached(Effect.gen(function* () {
|
|
44384
44398
|
const resource = resourceExpr.src;
|
|
44385
|
-
const provider = yield*
|
|
44399
|
+
const provider = yield* findProviderByType(resource.Type);
|
|
44386
44400
|
const props = yield* resolveInput(resource.Props);
|
|
44387
44401
|
const oldState = yield* state.get({
|
|
44388
44402
|
stack: stackName,
|
|
@@ -44449,7 +44463,7 @@ const make = (stack, options = {}) => ensureArtifactStore(Effect.gen(function* (
|
|
|
44449
44463
|
}));
|
|
44450
44464
|
const newDownstreamDependencies = Object.fromEntries(resources.map((resource) => [resource.FQN, Object.entries(newUpstreamDependencies).filter(([_, upstream$1]) => upstream$1.includes(resource.FQN)).map(([depFqn]) => depFqn)]));
|
|
44451
44465
|
const resourceGraph = Object.fromEntries((yield* Effect.all(resources.map(Effect.fn(function* (resource) {
|
|
44452
|
-
const provider = yield*
|
|
44466
|
+
const provider = yield* findProviderByType(resource.Type);
|
|
44453
44467
|
const id = resource.LogicalId;
|
|
44454
44468
|
const fqn = resource.FQN;
|
|
44455
44469
|
const news = yield* resolveInput(resource.Props);
|
|
@@ -44632,7 +44646,7 @@ const make = (stack, options = {}) => ensureArtifactStore(Effect.gen(function* (
|
|
|
44632
44646
|
if (oldState) {
|
|
44633
44647
|
const { logicalId } = parseFqn(fqn);
|
|
44634
44648
|
const resourceType = oldState.resourceType;
|
|
44635
|
-
const provider = yield*
|
|
44649
|
+
const provider = yield* findProviderByType(resourceType);
|
|
44636
44650
|
if (oldState.attr === void 0) {
|
|
44637
44651
|
if (provider.read) attr = yield* provider.read({
|
|
44638
44652
|
id: logicalId,
|
|
@@ -44658,7 +44672,8 @@ const make = (stack, options = {}) => ensureArtifactStore(Effect.gen(function* (
|
|
|
44658
44672
|
Binding: void 0,
|
|
44659
44673
|
Provider: Provider(resourceType),
|
|
44660
44674
|
RemovalPolicy: oldState.removalPolicy,
|
|
44661
|
-
ExecutionContext: void 0
|
|
44675
|
+
ExecutionContext: void 0,
|
|
44676
|
+
Providers: void 0
|
|
44662
44677
|
},
|
|
44663
44678
|
downstream: oldDownstreamDependencies[fqn] ?? [],
|
|
44664
44679
|
bindings: oldState.bindings.map((binding) => ({
|
|
@@ -44682,7 +44697,7 @@ const make = (stack, options = {}) => ensureArtifactStore(Effect.gen(function* (
|
|
|
44682
44697
|
deletions,
|
|
44683
44698
|
output: stack.output
|
|
44684
44699
|
};
|
|
44685
|
-
}));
|
|
44700
|
+
}).pipe(ensureArtifactStore);
|
|
44686
44701
|
const providePlanScope = (fqn, instanceId) => (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrElse(createArtifactStore)), Effect.flatMap((store) => effect.pipe(Effect.provideService(Artifacts, makeScopedArtifacts(store, fqn)), Effect.provideService(InstanceId, instanceId))));
|
|
44687
44702
|
var DeleteResourceHasDownstreamDependencies = class extends Data.TaggedError("DeleteResourceHasDownstreamDependencies") {};
|
|
44688
44703
|
var UnsatisfiedResourceCycle = class extends Data.TaggedError("UnsatisfiedResourceCycle") {};
|
|
@@ -44810,7 +44825,7 @@ const tailCommand = Command.make("tail", {
|
|
|
44810
44825
|
fqn
|
|
44811
44826
|
});
|
|
44812
44827
|
if (!resourceState?.attr) continue;
|
|
44813
|
-
const provider = yield*
|
|
44828
|
+
const provider = yield* findProviderByType(resource.Type);
|
|
44814
44829
|
if (!provider.tail) continue;
|
|
44815
44830
|
tailable.push({
|
|
44816
44831
|
logicalId: resource.LogicalId,
|
|
@@ -44927,7 +44942,7 @@ const logsCommand = Command.make("logs", {
|
|
|
44927
44942
|
fqn
|
|
44928
44943
|
});
|
|
44929
44944
|
if (!resourceState?.attr) continue;
|
|
44930
|
-
const provider = yield*
|
|
44945
|
+
const provider = yield* findProviderByType(resource.Type);
|
|
44931
44946
|
if (!provider.logs) continue;
|
|
44932
44947
|
const lines = yield* provider.logs({
|
|
44933
44948
|
id: resource.LogicalId,
|