nomoss 0.0.1

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 (81) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +45 -0
  3. package/bin/nomoss +13 -0
  4. package/docs/code-documentation.md +36 -0
  5. package/docs/effect-native-development.md +55 -0
  6. package/docs/engine-design.md +93 -0
  7. package/docs/linting.md +88 -0
  8. package/docs/releasing.md +13 -0
  9. package/docs/resource-command-policy-stage.md +71 -0
  10. package/docs/resource-graph-mvp.md +31 -0
  11. package/docs/resource-graph-testing-approach.md +11 -0
  12. package/docs/resource-lifecycle-tracker.md +93 -0
  13. package/docs/testing.md +86 -0
  14. package/examples/upload-events/README.md +41 -0
  15. package/media/nomoss.gif +0 -0
  16. package/package.json +64 -0
  17. package/src/cli.ts +18 -0
  18. package/src/cliCommand.ts +186 -0
  19. package/src/cliRuntimeLayer.ts +49 -0
  20. package/src/core/index.ts +17 -0
  21. package/src/core/lifecycle.ts +127 -0
  22. package/src/core/model.ts +229 -0
  23. package/src/core/physicalNameStore.ts +226 -0
  24. package/src/core/planner.ts +645 -0
  25. package/src/core/resourceCommandPolicy.ts +79 -0
  26. package/src/core/resourceGraphBuilder.ts +167 -0
  27. package/src/core/resourceGraphStore.ts +288 -0
  28. package/src/core/resourceOutputResolver.ts +185 -0
  29. package/src/core/resourcePolicy.ts +77 -0
  30. package/src/core/resourceStackDefinition.ts +17 -0
  31. package/src/core/resourceStackLifecycle.ts +456 -0
  32. package/src/core/resourceStackOperations.ts +129 -0
  33. package/src/core/runtimeLayer.ts +73 -0
  34. package/src/core/stackWorkflowRenderer.ts +239 -0
  35. package/src/core/stateSecretService.ts +553 -0
  36. package/src/core/stateStore.ts +652 -0
  37. package/src/core/tracing.ts +26 -0
  38. package/src/index.ts +2 -0
  39. package/src/providers/aws/awsApply.ts +132 -0
  40. package/src/providers/aws/awsBucket.ts +329 -0
  41. package/src/providers/aws/awsBucketNotification.ts +351 -0
  42. package/src/providers/aws/awsBucketNotificationResourcePolicy.ts +251 -0
  43. package/src/providers/aws/awsBucketResourcePolicy.ts +198 -0
  44. package/src/providers/aws/awsProviderLayer.ts +274 -0
  45. package/src/providers/aws/awsQueue.ts +346 -0
  46. package/src/providers/aws/awsQueuePolicy.ts +419 -0
  47. package/src/providers/aws/awsQueuePolicyResourcePolicy.ts +215 -0
  48. package/src/providers/aws/awsQueueResourcePolicy.ts +270 -0
  49. package/src/providers/aws/awsReconciliation.ts +92 -0
  50. package/src/providers/aws/awsRefresh.ts +50 -0
  51. package/src/providers/aws/awsResourceLifecycle.ts +118 -0
  52. package/src/providers/aws/awsResourcePolicy.ts +83 -0
  53. package/src/providers/aws/awsResources.ts +274 -0
  54. package/src/providers/aws/awsRuntimeLayer.ts +21 -0
  55. package/src/providers/aws/awsSqsTransport.ts +33 -0
  56. package/src/providers/aws/awsStackLifecycle.ts +272 -0
  57. package/src/providers/aws/awsTagging.ts +186 -0
  58. package/src/providers/aws/constants.ts +3 -0
  59. package/src/providers/aws/index.ts +22 -0
  60. package/src/providers/aws/sampleStack.ts +65 -0
  61. package/src/providers/aws/stackWorkflow.ts +443 -0
  62. package/src/providers/index.ts +5 -0
  63. package/src/providers/provider.ts +5 -0
  64. package/src/providers/providerRuntimeLayer.ts +121 -0
  65. package/src/providers/resourceCommandPolicyLayer.ts +240 -0
  66. package/src/providers/stripe/index.ts +15 -0
  67. package/src/providers/stripe/stripeAccount.ts +139 -0
  68. package/src/providers/stripe/stripeBillingConfigurationExport.ts +180 -0
  69. package/src/providers/stripe/stripeBillingConfigurationExportResourcePolicy.ts +178 -0
  70. package/src/providers/stripe/stripeBillingPortalConfiguration.ts +153 -0
  71. package/src/providers/stripe/stripeBillingPortalConfigurationResourcePolicy.ts +177 -0
  72. package/src/providers/stripe/stripeCustomer.ts +148 -0
  73. package/src/providers/stripe/stripeCustomerResourcePolicy.ts +160 -0
  74. package/src/providers/stripe/stripePrice.ts +218 -0
  75. package/src/providers/stripe/stripePriceResourcePolicy.ts +151 -0
  76. package/src/providers/stripe/stripeProduct.ts +171 -0
  77. package/src/providers/stripe/stripeProductResourcePolicy.ts +161 -0
  78. package/src/providers/stripe/stripeResources.ts +454 -0
  79. package/src/providers/stripe/stripeRuntimeLayer.ts +131 -0
  80. package/src/providers/stripe/stripeWebhookEndpoint.ts +293 -0
  81. package/src/providers/stripe/stripeWebhookEndpointResourcePolicy.ts +198 -0
@@ -0,0 +1,198 @@
1
+ import { Array as Arr, Context, Effect, Match, Option } from "effect";
2
+
3
+ import {
4
+ PlanDecision,
5
+ type PlanDecision as PlanDecisionValue,
6
+ PlanRepairChange,
7
+ ResourceCommand,
8
+ ResourceCommandResult,
9
+ ResourceCommandUnsupported,
10
+ type ResourceObservation,
11
+ } from "../../core/lifecycle.js";
12
+ import { ResourceModel, type ResourceNode } from "../../core/model.js";
13
+ import { ResourcePolicy } from "../../core/resourcePolicy.js";
14
+ import {
15
+ BucketLifecycleService,
16
+ type BucketObservedState,
17
+ BucketObservedStateSchema,
18
+ BucketPropsSchema,
19
+ } from "./awsBucket.js";
20
+ import { AwsTagging } from "./awsTagging.js";
21
+
22
+ const formatTagValue = (value: string | undefined) =>
23
+ Match.value(value).pipe(
24
+ Match.when(undefined, () => "undefined"),
25
+ Match.orElse((defined) => `"${defined}"`),
26
+ );
27
+
28
+ const bucketTagDecision = (
29
+ node: ResourceNode,
30
+ observedTags: ReadonlyArray<{
31
+ readonly Key: string;
32
+ readonly Value?: string;
33
+ }>,
34
+ ) =>
35
+ Option.match(
36
+ Option.liftPredicate(observedTags, (tags) => tags.length > 0),
37
+ {
38
+ onNone: () => PlanDecision.NoOp({ node }),
39
+ onSome: (tags) =>
40
+ PlanDecision.Repair({
41
+ node,
42
+ reason: "bucket tags differ from desired state",
43
+ changes: Arr.map(tags, (tag) =>
44
+ PlanRepairChange.Removed({
45
+ path: ["aws", "s3", "bucket", "tags", tag.Key],
46
+ before: formatTagValue(tag.Value),
47
+ }),
48
+ ),
49
+ }),
50
+ },
51
+ );
52
+
53
+ /**
54
+ * The AWS resource dispatcher reaches bucket behavior through this policy so
55
+ * tag reconciliation and force-destroy semantics stay bucket-specific.
56
+ */
57
+ export class BucketResourcePolicy extends Context.Service<BucketResourcePolicy>()(
58
+ "nomoss/providers/aws/awsBucketResourcePolicy/BucketResourcePolicy",
59
+ {
60
+ make: Effect.gen(function* () {
61
+ const lifecycle = yield* BucketLifecycleService;
62
+ const tagging = yield* AwsTagging;
63
+ const model = yield* ResourceModel;
64
+ const resourcePolicy = yield* ResourcePolicy;
65
+
66
+ const read = Effect.fn("BucketResourcePolicy.read")(function* (
67
+ node: ResourceNode,
68
+ ) {
69
+ const props = yield* model.decodeProps(node, BucketPropsSchema);
70
+ const output = yield* lifecycle.read(props);
71
+ const result = yield* Effect.fromOption(output).pipe(
72
+ Effect.flatMap((state: BucketObservedState) =>
73
+ Effect.map(
74
+ model.encodeJson(BucketObservedStateSchema, state),
75
+ (observed) => resourcePolicy.present(node, observed),
76
+ ),
77
+ ),
78
+ Effect.catchNoSuchElement,
79
+ Effect.map(Option.getOrElse(() => resourcePolicy.missing(node))),
80
+ );
81
+
82
+ return result;
83
+ });
84
+ const diff = Effect.fn("BucketResourcePolicy.diff")(function* (
85
+ node: ResourceNode,
86
+ observation: ResourceObservation,
87
+ ) {
88
+ const decision = yield* Match.value(observation).pipe(
89
+ Match.tagsExhaustive({
90
+ Missing: () => Effect.succeed(PlanDecision.Create({ node })),
91
+ Unreadable: ({ reason }) =>
92
+ Effect.succeed(PlanDecision.Repair({ node, reason })),
93
+ Drifted: ({ reason }) =>
94
+ Effect.succeed(PlanDecision.Repair({ node, reason })),
95
+ Present: ({ observed }) =>
96
+ Effect.map(
97
+ model.decodeJson(BucketObservedStateSchema, observed),
98
+ (state) =>
99
+ bucketTagDecision(
100
+ node,
101
+ Option.match(Option.fromUndefinedOr(state.tagging), {
102
+ onNone: () => [],
103
+ onSome: (tagging) => tagging.TagSet,
104
+ }),
105
+ ),
106
+ ),
107
+ }),
108
+ );
109
+
110
+ return ResourceCommandResult.Decided({ decision });
111
+ });
112
+ const create = Effect.fn("BucketResourcePolicy.create")(function* (
113
+ node: ResourceNode,
114
+ ) {
115
+ const props = yield* model.decodeProps(node, BucketPropsSchema);
116
+ yield* lifecycle.create(props);
117
+
118
+ return ResourceCommandResult.Created({ node });
119
+ });
120
+ const repair = Effect.fn("BucketResourcePolicy.repair")(function* (
121
+ node: ResourceNode,
122
+ ) {
123
+ const props = yield* model.decodeProps(node, BucketPropsSchema);
124
+ yield* tagging.reconcile({
125
+ target: { _tag: "S3Bucket", bucket: props.Bucket },
126
+ desiredTags: {},
127
+ observedTags: {},
128
+ });
129
+
130
+ return ResourceCommandResult.Updated({ node });
131
+ });
132
+ const destroy = Effect.fn("BucketResourcePolicy.destroy")(function* (
133
+ node: ResourceNode,
134
+ ) {
135
+ const props = yield* model.decodeProps(node, BucketPropsSchema);
136
+ yield* lifecycle.destroy(props);
137
+
138
+ return ResourceCommandResult.Destroyed({ node });
139
+ });
140
+ const apply = Effect.fn("BucketResourcePolicy.apply")(function* (
141
+ decision: PlanDecisionValue,
142
+ ) {
143
+ return yield* Match.value(decision).pipe(
144
+ Match.tagsExhaustive({
145
+ Create: ({ node }) => create(node),
146
+ Repair: ({ node }) => repair(node),
147
+ Destroy: ({ node }) => destroy(node),
148
+ NoOp: () =>
149
+ Effect.fail(
150
+ new ResourceCommandUnsupported({
151
+ command: ResourceCommand.Apply({ decision }),
152
+ }),
153
+ ),
154
+ Update: () =>
155
+ Effect.fail(
156
+ new ResourceCommandUnsupported({
157
+ command: ResourceCommand.Apply({ decision }),
158
+ }),
159
+ ),
160
+ Delete: () =>
161
+ Effect.fail(
162
+ new ResourceCommandUnsupported({
163
+ command: ResourceCommand.Apply({ decision }),
164
+ }),
165
+ ),
166
+ }),
167
+ );
168
+ });
169
+
170
+ return {
171
+ read,
172
+ diff,
173
+ create,
174
+ repair,
175
+ destroy,
176
+ apply,
177
+ execute: Effect.fn("BucketResourcePolicy.execute")(function* (
178
+ command: ResourceCommand,
179
+ ) {
180
+ return yield* Match.value(command).pipe(
181
+ Match.tagsExhaustive({
182
+ Read: ({ node }) => read(node),
183
+ Diff: ({ node, observation }) => diff(node, observation),
184
+ Apply: ({ decision }) => apply(decision),
185
+ Create: ({ node }) => create(node),
186
+ Update: () =>
187
+ Effect.fail(new ResourceCommandUnsupported({ command })),
188
+ Delete: () =>
189
+ Effect.fail(new ResourceCommandUnsupported({ command })),
190
+ Destroy: () =>
191
+ Effect.fail(new ResourceCommandUnsupported({ command })),
192
+ }),
193
+ );
194
+ }),
195
+ };
196
+ }),
197
+ },
198
+ ) {}
@@ -0,0 +1,274 @@
1
+ import * as Auth from "@distilled.cloud/aws/Auth";
2
+ import * as Credentials from "@distilled.cloud/aws/Credentials";
3
+ import * as Region from "@distilled.cloud/aws/Region";
4
+ import * as sqs from "@distilled.cloud/aws/sqs";
5
+ import { Context, Effect, Layer } from "effect";
6
+
7
+ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
8
+ import * as NodePath from "@effect/platform-node/NodePath";
9
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
10
+
11
+ import {
12
+ resourceGraphBuilderLayer,
13
+ resourceModelLayer,
14
+ resourcePlannerLayer,
15
+ resourcePolicyLayer,
16
+ } from "../../core/runtimeLayer.js";
17
+ import { AwsApply } from "./awsApply.js";
18
+ import { BucketLifecycleService } from "./awsBucket.js";
19
+ import { BucketNotificationLifecycleService } from "./awsBucketNotification.js";
20
+ import { BucketNotificationResourcePolicy } from "./awsBucketNotificationResourcePolicy.js";
21
+ import { BucketResourcePolicy } from "./awsBucketResourcePolicy.js";
22
+ import { QueueLifecycleService } from "./awsQueue.js";
23
+ import { QueuePolicyLifecycleService } from "./awsQueuePolicy.js";
24
+ import { QueuePolicyResourcePolicy } from "./awsQueuePolicyResourcePolicy.js";
25
+ import { QueueResourcePolicy } from "./awsQueueResourcePolicy.js";
26
+ import { AwsReconciliation } from "./awsReconciliation.js";
27
+ import { AwsRefresh } from "./awsRefresh.js";
28
+ import { AwsResourceLifecycle } from "./awsResourceLifecycle.js";
29
+ import { AwsResourcePolicy } from "./awsResourcePolicy.js";
30
+ import { AwsResources } from "./awsResources.js";
31
+ import { AwsSqsTransport } from "./awsSqsTransport.js";
32
+ import { AwsTagging } from "./awsTagging.js";
33
+
34
+ const awsAuthRuntimeLayerLive = () =>
35
+ Layer.effect(Auth.Auth, Auth.makeAuthService()).pipe(
36
+ Layer.provideMerge(
37
+ Layer.mergeAll(
38
+ FetchHttpClient.layer,
39
+ NodeFileSystem.layer,
40
+ NodePath.layer,
41
+ ),
42
+ ),
43
+ );
44
+
45
+ export const awsRuntimeLayerLive = Layer.mergeAll(
46
+ Credentials.fromChain(),
47
+ Region.fromEnv(),
48
+ FetchHttpClient.layer,
49
+ );
50
+
51
+ export const awsRuntimeLayerSsoRegion = (profile: string, region: string) =>
52
+ Layer.mergeAll(
53
+ Credentials.fromSSO(profile).pipe(Layer.provide(awsAuthRuntimeLayerLive())),
54
+ Layer.succeed(Region.Region, Effect.succeed(region)),
55
+ FetchHttpClient.layer,
56
+ );
57
+
58
+ const awsSqsTransportLayerLive = (awsRuntimeLayer = awsRuntimeLayerLive) =>
59
+ Layer.effect(
60
+ AwsSqsTransport,
61
+ Effect.gen(function* () {
62
+ const distilledCreateQueue = yield* sqs.createQueue;
63
+ const distilledDeleteQueue = yield* sqs.deleteQueue;
64
+ const distilledGetQueueAttributes = yield* sqs.getQueueAttributes;
65
+ const distilledGetQueueUrl = yield* sqs.getQueueUrl;
66
+ const distilledListQueueTags = yield* sqs.listQueueTags;
67
+
68
+ return {
69
+ createQueue: (request: sqs.CreateQueueRequest) =>
70
+ distilledCreateQueue(request).pipe(Effect.provide(awsRuntimeLayer)),
71
+ deleteQueue: (request: sqs.DeleteQueueRequest) =>
72
+ distilledDeleteQueue(request).pipe(Effect.provide(awsRuntimeLayer)),
73
+ getQueueAttributes: (request: sqs.GetQueueAttributesRequest) =>
74
+ distilledGetQueueAttributes(request).pipe(
75
+ Effect.provide(awsRuntimeLayer),
76
+ ),
77
+ getQueueUrl: (request: sqs.GetQueueUrlRequest) =>
78
+ distilledGetQueueUrl(request).pipe(Effect.provide(awsRuntimeLayer)),
79
+ listQueueTags: (request: sqs.ListQueueTagsRequest) =>
80
+ distilledListQueueTags(request).pipe(Effect.provide(awsRuntimeLayer)),
81
+ };
82
+ }).pipe(Effect.provide(awsRuntimeLayer)),
83
+ );
84
+
85
+ export const awsBucketLifecycleLayerLive = Layer.effect(
86
+ BucketLifecycleService,
87
+ BucketLifecycleService.make,
88
+ );
89
+
90
+ export const awsQueueLifecycleLayerLive = Layer.effect(
91
+ QueueLifecycleService,
92
+ QueueLifecycleService.make,
93
+ );
94
+
95
+ export const awsQueuePolicyLifecycleLayerLive = Layer.effect(
96
+ QueuePolicyLifecycleService,
97
+ QueuePolicyLifecycleService.make,
98
+ );
99
+
100
+ export const awsBucketNotificationLifecycleLayerLive = Layer.effect(
101
+ BucketNotificationLifecycleService,
102
+ BucketNotificationLifecycleService.make,
103
+ );
104
+
105
+ export const awsTaggingLayerLive = Layer.effect(AwsTagging, AwsTagging.make);
106
+
107
+ export const awsProviderLifecycleLayerLive = Layer.mergeAll(
108
+ awsBucketLifecycleLayerLive,
109
+ awsQueueLifecycleLayerLive,
110
+ awsQueuePolicyLifecycleLayerLive,
111
+ awsBucketNotificationLifecycleLayerLive,
112
+ ).pipe(Layer.provide(awsSqsTransportLayerLive()));
113
+
114
+ export const awsBucketResourcePolicyLayerLive = Layer.effect(
115
+ BucketResourcePolicy,
116
+ BucketResourcePolicy.make,
117
+ ).pipe(
118
+ Layer.provideMerge(awsBucketLifecycleLayerLive),
119
+ Layer.provideMerge(awsTaggingLayerLive),
120
+ Layer.provideMerge(resourceModelLayer),
121
+ Layer.provideMerge(resourcePolicyLayer),
122
+ );
123
+
124
+ export const awsQueueResourcePolicyLayerLive = (
125
+ awsRuntimeLayer = awsRuntimeLayerLive,
126
+ ) =>
127
+ Layer.effect(QueueResourcePolicy, QueueResourcePolicy.make).pipe(
128
+ Layer.provideMerge(
129
+ Layer.provide(
130
+ awsQueueLifecycleLayerLive,
131
+ awsSqsTransportLayerLive(awsRuntimeLayer),
132
+ ),
133
+ ),
134
+ Layer.provideMerge(awsTaggingLayerLive),
135
+ Layer.provideMerge(resourceModelLayer),
136
+ Layer.provideMerge(resourcePolicyLayer),
137
+ );
138
+
139
+ export const awsQueuePolicyResourcePolicyLayerLive = Layer.effect(
140
+ QueuePolicyResourcePolicy,
141
+ QueuePolicyResourcePolicy.make,
142
+ ).pipe(
143
+ Layer.provideMerge(awsQueuePolicyLifecycleLayerLive),
144
+ Layer.provideMerge(resourceModelLayer),
145
+ Layer.provideMerge(resourcePolicyLayer),
146
+ );
147
+
148
+ export const awsBucketNotificationResourcePolicyLayerLive = Layer.effect(
149
+ BucketNotificationResourcePolicy,
150
+ BucketNotificationResourcePolicy.make,
151
+ ).pipe(
152
+ Layer.provideMerge(awsBucketNotificationLifecycleLayerLive),
153
+ Layer.provideMerge(resourceModelLayer),
154
+ Layer.provideMerge(resourcePolicyLayer),
155
+ );
156
+
157
+ export const awsResourcePolicyLayerLive = (
158
+ awsRuntimeLayer = awsRuntimeLayerLive,
159
+ ) =>
160
+ Layer.effect(AwsResourcePolicy, AwsResourcePolicy.make).pipe(
161
+ Layer.provideMerge(
162
+ Layer.mergeAll(
163
+ awsBucketResourcePolicyLayerLive,
164
+ awsQueueResourcePolicyLayerLive(awsRuntimeLayer),
165
+ awsQueuePolicyResourcePolicyLayerLive,
166
+ awsBucketNotificationResourcePolicyLayerLive,
167
+ ),
168
+ ),
169
+ );
170
+
171
+ const awsResourceLifecycleLayer = (awsRuntimeLayer = awsRuntimeLayerLive) =>
172
+ Layer.effect(AwsResourceLifecycle, AwsResourceLifecycle.make).pipe(
173
+ Layer.provideMerge(awsResourcePolicyLayerLive(awsRuntimeLayer)),
174
+ Layer.provideMerge(awsRuntimeLayer),
175
+ );
176
+
177
+ export const awsResourceLifecycleLayerLive = awsResourceLifecycleLayer();
178
+
179
+ const awsApplyLayer = (awsRuntimeLayer = awsRuntimeLayerLive) =>
180
+ Layer.effect(AwsApply, AwsApply.make).pipe(
181
+ Layer.provideMerge(awsResourceLifecycleLayer(awsRuntimeLayer)),
182
+ Layer.provideMerge(resourcePlannerLayer),
183
+ );
184
+
185
+ export const awsApplyLayerLive = awsApplyLayer();
186
+
187
+ const awsRefreshLayer = (awsRuntimeLayer = awsRuntimeLayerLive) =>
188
+ Layer.effect(AwsRefresh, AwsRefresh.make).pipe(
189
+ Layer.provideMerge(awsResourceLifecycleLayer(awsRuntimeLayer)),
190
+ Layer.provideMerge(resourcePolicyLayer),
191
+ );
192
+
193
+ export const awsRefreshLayerLive = awsRefreshLayer();
194
+
195
+ const awsReconciliationLayer = (awsRuntimeLayer = awsRuntimeLayerLive) =>
196
+ Layer.effect(AwsReconciliation, AwsReconciliation.make).pipe(
197
+ Layer.provideMerge(awsResourceLifecycleLayer(awsRuntimeLayer)),
198
+ );
199
+
200
+ export const awsReconciliationLayerLive = awsReconciliationLayer();
201
+
202
+ const awsDecisionLayer = (awsRuntimeLayer = awsRuntimeLayerLive) =>
203
+ Layer.mergeAll(
204
+ awsApplyLayer(awsRuntimeLayer),
205
+ awsRefreshLayer(awsRuntimeLayer),
206
+ awsReconciliationLayer(awsRuntimeLayer),
207
+ );
208
+
209
+ export const awsDecisionLayerLive = awsDecisionLayer();
210
+
211
+ export const awsResourcesLayerLive = Layer.effect(
212
+ AwsResources,
213
+ AwsResources.make,
214
+ ).pipe(Layer.provideMerge(resourceGraphBuilderLayer));
215
+
216
+ /**
217
+ * Provider runtimes select one of these layers to choose live credentials,
218
+ * SSO credentials, or SSO credentials with an explicit region.
219
+ */
220
+ export class AwsProviderRuntime extends Context.Service<AwsProviderRuntime>()(
221
+ "nomoss/providers/aws/awsProviderLayer/AwsProviderRuntime",
222
+ {
223
+ make: Effect.gen(function* () {
224
+ const runtimeLayerSso = (profile: string) =>
225
+ Layer.mergeAll(
226
+ Credentials.fromSSO(profile).pipe(
227
+ Layer.provide(awsAuthRuntimeLayerLive()),
228
+ ),
229
+ Region.fromEnv(),
230
+ FetchHttpClient.layer,
231
+ );
232
+ return {
233
+ providerLayerLive: awsProviderLifecycleLayerLive,
234
+ bucketLifecycleLayerLive: awsBucketLifecycleLayerLive,
235
+ queueLifecycleLayerLive: awsQueueLifecycleLayerLive,
236
+ queuePolicyLifecycleLayerLive: awsQueuePolicyLifecycleLayerLive,
237
+ bucketNotificationLifecycleLayerLive:
238
+ awsBucketNotificationLifecycleLayerLive,
239
+ taggingLayerLive: awsTaggingLayerLive,
240
+ bucketResourcePolicyLayerLive: awsBucketResourcePolicyLayerLive,
241
+ queueResourcePolicyLayerLive: awsQueueResourcePolicyLayerLive,
242
+ queuePolicyResourcePolicyLayerLive:
243
+ awsQueuePolicyResourcePolicyLayerLive,
244
+ bucketNotificationResourcePolicyLayerLive:
245
+ awsBucketNotificationResourcePolicyLayerLive,
246
+ resourcePolicyLayerLive: awsResourcePolicyLayerLive,
247
+ resourceLifecycleLayerLive: awsResourceLifecycleLayerLive,
248
+ applyLayerLive: awsApplyLayerLive,
249
+ applyLayerSsoRegion: (profile: string, region: string) =>
250
+ awsApplyLayer(awsRuntimeLayerSsoRegion(profile, region)),
251
+ refreshLayerLive: awsRefreshLayerLive,
252
+ reconciliationLayerLive: awsReconciliationLayerLive,
253
+ decisionLayerLive: awsDecisionLayerLive,
254
+ decisionLayerSsoRegion: (profile: string, region: string) =>
255
+ awsDecisionLayer(awsRuntimeLayerSsoRegion(profile, region)),
256
+ resourcesLayerLive: awsResourcesLayerLive,
257
+ runtimeLayerLive: awsRuntimeLayerLive,
258
+ runtimeLayerSso,
259
+ runtimeLayerSsoRegion: awsRuntimeLayerSsoRegion,
260
+ resourceLayerLive: awsProviderLifecycleLayerLive.pipe(
261
+ Layer.provideMerge(awsRuntimeLayerLive),
262
+ ),
263
+ resourceLayerSso: (profile: string) =>
264
+ awsProviderLifecycleLayerLive.pipe(
265
+ Layer.provideMerge(runtimeLayerSso(profile)),
266
+ ),
267
+ resourceLayerSsoRegion: (profile: string, region: string) =>
268
+ awsProviderLifecycleLayerLive.pipe(
269
+ Layer.provideMerge(awsRuntimeLayerSsoRegion(profile, region)),
270
+ ),
271
+ };
272
+ }),
273
+ },
274
+ ) {}