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,86 @@
1
+ # Nomoss Testing
2
+
3
+ ## Scope
4
+
5
+ This document defines deterministic, composable testing for Nomoss. [linting.md](linting.md) covers the lint workflow. Effect Vitest APIs are documented by the installed `@effect/vitest` package.
6
+
7
+ ## Test File Names
8
+
9
+ Keep tests for a service in a file named after that service:
10
+
11
+ ```text
12
+ awsStackLifecycle.test.ts
13
+ ```
14
+
15
+ Do not encode a scenario, implementation detail, or timing mechanism in the file name. Those belong in the test label.
16
+
17
+ ## Test Labels
18
+
19
+ Test labels describe the observable outcome, not the implementation. A reader should know what contract the test proves without reading the body.
20
+
21
+ Use one of these shapes:
22
+
23
+ ```text
24
+ It {capability or state} {observable outcome}
25
+ It {capability or state} {observable outcome} when|if|after|for {condition}
26
+ ```
27
+
28
+ Examples:
29
+
30
+ - `It creates a bucket when the desired graph contains a missing bucket`
31
+ - `It saves the applied resource state after all provider operations succeed`
32
+ - `It reports no changes when the live stack matches the desired graph`
33
+
34
+ Weak labels describe internal work rather than the result:
35
+
36
+ - `It calls refresh before apply`
37
+ - `It uses the queue fixture`
38
+ - `It renders no changes`
39
+
40
+ Name the capability family in `describe`. Use a mechanical group name only when it represents a real technical contract.
41
+
42
+ ## Testing Principles
43
+
44
+ Tests call real code paths and assert observable outcomes. Fixtures and test layers supply standard data through standard services; tests should not rebuild provider or model wiring locally.
45
+
46
+ Reusable fixture states belong beside the relevant adapter or service. Extend a shared fixture when a scenario is useful across contracts. Keep a genuinely one-off input local to one test.
47
+
48
+ Test code stays thin. It invokes the production operation, provides its assigned graph once at the test edge, and asserts the resulting state, output, or tagged error.
49
+
50
+ ## Service Test Layers
51
+
52
+ Provider and service modules expose reusable test layers beside their live layers using a `TestLayer` suffix. Each test group composes one service graph and provides it once.
53
+
54
+ Use `Layer.provide` when dependencies are internal to the service under test. Use `Layer.provideMerge` only when the provided service is intentionally part of the test boundary. Do not build the same stateful dependency in parallel layer graphs.
55
+
56
+ ## Behavior Coverage
57
+
58
+ Behavior tests begin at the production entry point responsible for a contract and end where that contract becomes observable. Assert persisted state, provider commands, rendered output, or tagged errors—not helper calls or incidental sequencing.
59
+
60
+ Helper tests are separate. They name the helper contract and assert the helper result; they do not stand in for a behavior test that should exercise the owning command path.
61
+
62
+ The label and assertion must state the same contract. A persistence label requires a persisted read. An output label requires the rendered output. An ordering label requires an observing boundary that records the claimed order.
63
+
64
+ Tests should survive refactors that change private helpers, local preparation, or internal sequencing without changing the observable contract.
65
+
66
+ ## Effect Tests
67
+
68
+ Effect Vitest tests put assertions in the main `Effect` returned from `it.effect(...)`, using a flat `Effect.gen(...)` or `Effect.sync(...)` flow.
69
+
70
+ For expected failures, flip the program and match the tagged error directly. Asynchronous tests use deterministic Effect signals and runtime-controlled clocks, not sleeps, raw timers, or ambient wall-clock time.
71
+
72
+ Use one terminating Effect chain for a test. Manual fiber control is reserved for tests whose contract is interruption or shared-fiber responsibility.
73
+
74
+ ## Validation
75
+
76
+ Documentation-only edits do not need Biome, TypeScript, or Vitest validation.
77
+
78
+ For code changes, run file-level linting, the project compiler, and the smallest affected test:
79
+
80
+ ```sh
81
+ yarn exec biome lint tests/awsStackWorkflowRenderer.test.ts
82
+ yarn typecheck:tsgo
83
+ yarn vitest run --pool forks tests/awsStackWorkflowRenderer.test.ts
84
+ ```
85
+
86
+ For a behavior regression, first run the test against a realistic break in the production path and confirm that it fails. Restore the implementation and confirm the same test passes.
@@ -0,0 +1,41 @@
1
+ # S3 upload events
2
+
3
+ The `upload-events` resource program connects the `Uploads` S3 bucket to the `UploadEvents` SQS queue. `UploadEventsPolicy` permits S3 to publish messages to the queue. `UploadEventsNotification` routes S3 object-created events to that queue.
4
+
5
+ The program lives in [`src/providers/aws/sampleStack.ts`](../../src/providers/aws/sampleStack.ts). The `Uploads` bucket sets `forceDestroy`, so `nomoss destroy` removes its objects and the bucket. Use a non-production AWS account for this demo.
6
+
7
+ ## Inspect the resource program
8
+
9
+ `nomoss graph` prints the dependency graph. `nomoss plan` derives the execution batches from the graph and local Nomoss state. `nomoss list` prints the declared resources.
10
+
11
+ ```sh
12
+ nomoss graph --stack upload-events
13
+ nomoss plan --stack upload-events
14
+ nomoss list --stack upload-events
15
+ ```
16
+
17
+ ## Plan
18
+
19
+ With no saved resource state, `nomoss plan --stack upload-events` returns this plan. The `diff` fence colors each `Create` action on GitHub.
20
+
21
+ ```diff
22
+ batch 0:
23
+ + Create aws:s3:bucket/Uploads
24
+ + Create aws:sqs:queue/UploadEvents
25
+ batch 1:
26
+ + Create aws:sqs:queue-policy/UploadEventsPolicy
27
+ batch 2:
28
+ + Create aws:s3:bucket-notification/UploadEventsNotification
29
+ ```
30
+
31
+ ## Apply to AWS
32
+
33
+ The AWS SSO profile must permit S3 and SQS resource creation and deletion. Replace `my-profile` with that profile name.
34
+
35
+ ```sh
36
+ nomoss diff --stack upload-events --profile my-profile
37
+ nomoss create --stack upload-events --profile my-profile
38
+ nomoss destroy --stack upload-events --profile my-profile
39
+ ```
40
+
41
+ `nomoss diff` reads live AWS state. `nomoss create` applies the resource plan. `nomoss destroy` removes the demo resources.
Binary file
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "nomoss",
3
+ "description": "Effect-native infrastructure automation for TypeScript.",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/Tradedal/nomoss.git"
7
+ },
8
+ "bin": "bin/nomoss",
9
+ "scripts": {
10
+ "check": "yarn lint && yarn typecheck:tsgo && vitest run --pool forks --passWithNoTests --exclude 'tests/**/*.integration.test.ts'",
11
+ "lint": "biome lint --reporter=summary",
12
+ "lint:fix": "biome check --write",
13
+ "tsgo:patch": "effect-tsgo patch",
14
+ "typecheck:tsgo": "tsc -b .",
15
+ "projen": "tsx .projenrc.ts"
16
+ },
17
+ "devDependencies": {
18
+ "@biomejs/biome": "2.4.12",
19
+ "@catenarycloud/linteffect": "0.0.7-dev.2",
20
+ "@effect/tsgo": "0.23.0",
21
+ "@effect/vitest": "4.0.0-beta.93",
22
+ "@types/node": "^24.0.0",
23
+ "commit-and-tag-version": "^12",
24
+ "constructs": "^10.0.0",
25
+ "projen": "^0.98.34",
26
+ "typescript": "7.0.2",
27
+ "vite": "^8.0.7",
28
+ "vitest": "^4.1.4"
29
+ },
30
+ "dependencies": {
31
+ "@distilled.cloud/aws": "^0.27.0",
32
+ "@distilled.cloud/stripe": "^0.27.0",
33
+ "@effect/platform-node": "4.0.0-beta.93",
34
+ "effect": "4.0.0-beta.93",
35
+ "tsx": "^4.20.6"
36
+ },
37
+ "engines": {
38
+ "node": ">=24"
39
+ },
40
+ "license": "MIT",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "version": "0.0.1",
45
+ "packageManager": "yarn@4.17.1",
46
+ "type": "module",
47
+ "exports": {
48
+ ".": "./src/index.ts",
49
+ "./core": "./src/core/index.ts",
50
+ "./providers": "./src/providers/index.ts",
51
+ "./providers/aws": "./src/providers/aws/index.ts",
52
+ "./providers/stripe": "./src/providers/stripe/index.ts"
53
+ },
54
+ "files": [
55
+ "README.md",
56
+ "LICENSE",
57
+ "bin",
58
+ "docs",
59
+ "examples",
60
+ "media",
61
+ "src"
62
+ ],
63
+ "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
64
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Effect } from "effect";
4
+
5
+ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
+ import { Command } from "effect/unstable/cli";
7
+
8
+ import { nomossCliCommand } from "./cliCommand.js";
9
+ import { nomossCliRuntimeLayer } from "./cliRuntimeLayer.js";
10
+
11
+ export const cli = nomossCliCommand.pipe(
12
+ Command.run({
13
+ version: "0.0.1",
14
+ }),
15
+ Effect.provide(nomossCliRuntimeLayer),
16
+ );
17
+
18
+ NodeRuntime.runMain(cli);
@@ -0,0 +1,186 @@
1
+ import { Effect, Logger, Match, Schema } from "effect";
2
+
3
+ import { Argument, Command, Flag } from "effect/unstable/cli";
4
+
5
+ import {
6
+ type StackName,
7
+ StackNameSchema,
8
+ } from "./providers/aws/sampleStack.js";
9
+ import {
10
+ applyLiveStack,
11
+ destroyStack,
12
+ listStackResources,
13
+ printGraph,
14
+ printLiveDiff,
15
+ printPlan,
16
+ type ResourceOutputFormat,
17
+ showStackResource,
18
+ } from "./providers/aws/stackWorkflow.js";
19
+
20
+ const defaultStackName: StackName = "upload-events";
21
+
22
+ const stackFlag = Flag.string("stack").pipe(
23
+ Flag.withDescription("Stack name"),
24
+ Flag.withDefault(defaultStackName),
25
+ );
26
+
27
+ const profileFlag = Flag.string("profile").pipe(
28
+ Flag.withDescription("AWS SSO profile used by the provider layer"),
29
+ );
30
+
31
+ const resourceFormatFlag = Flag.choice("format", [
32
+ "text",
33
+ "json",
34
+ "logfmt",
35
+ "logger-json",
36
+ "structured",
37
+ ] as const).pipe(
38
+ Flag.withDescription("Resource output format"),
39
+ Flag.withDefault("text" as ResourceOutputFormat),
40
+ );
41
+
42
+ const logicalIdArgument = Argument.string("logical-id");
43
+
44
+ const decodeStackName = (value: string) =>
45
+ Schema.decodeUnknownEffect(StackNameSchema)(value);
46
+
47
+ const resourceLoggerLayer = (format: ResourceOutputFormat) =>
48
+ Logger.layer([
49
+ Match.value(format).pipe(
50
+ Match.when("logfmt", () => Logger.consoleLogFmt),
51
+ Match.when("logger-json", () => Logger.consoleJson),
52
+ Match.when("structured", () => Logger.consoleStructured),
53
+ Match.orElse(() => Logger.consolePretty({ colors: false })),
54
+ ),
55
+ ]);
56
+
57
+ const nomoss = Command.make("nomoss").pipe(
58
+ Command.withDescription("Effect-native infrastructure graph prototype"),
59
+ );
60
+
61
+ export const nomossCliCommand = Command.withSubcommands(nomoss, [
62
+ Command.withDescription(
63
+ Command.make("graph", { stack: stackFlag }, (flags) =>
64
+ Effect.gen(function* () {
65
+ const stackName = yield* decodeStackName(flags.stack);
66
+
67
+ yield* printGraph(stackName);
68
+ }),
69
+ ),
70
+ "Print the discovered resource graph as Mermaid",
71
+ ),
72
+ Command.make("plan", { stack: stackFlag }, (flags) =>
73
+ Effect.gen(function* () {
74
+ const stackName = yield* decodeStackName(flags.stack);
75
+
76
+ yield* printPlan(stackName);
77
+ }),
78
+ ).pipe(Command.withDescription("Print create batches for a stack")),
79
+ Command.make(
80
+ "list",
81
+ { stack: stackFlag, format: resourceFormatFlag },
82
+ (flags) =>
83
+ Effect.gen(function* () {
84
+ const stackName = yield* decodeStackName(flags.stack);
85
+ const output = listStackResources({
86
+ stackName,
87
+ format: flags.format,
88
+ });
89
+
90
+ yield* Match.value(flags.format).pipe(
91
+ Match.when("logfmt", () =>
92
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
93
+ ),
94
+ Match.when("logger-json", () =>
95
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
96
+ ),
97
+ Match.when("structured", () =>
98
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
99
+ ),
100
+ Match.orElse(() => output),
101
+ );
102
+ }),
103
+ ).pipe(Command.withDescription("List stack resources")),
104
+ Command.make(
105
+ "show",
106
+ {
107
+ stack: stackFlag,
108
+ format: resourceFormatFlag,
109
+ logicalId: logicalIdArgument,
110
+ },
111
+ (flags) =>
112
+ Effect.gen(function* () {
113
+ const stackName = yield* decodeStackName(flags.stack);
114
+ const output = showStackResource({
115
+ stackName,
116
+ logicalId: flags.logicalId,
117
+ format: flags.format,
118
+ });
119
+
120
+ yield* Match.value(flags.format).pipe(
121
+ Match.when("logfmt", () =>
122
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
123
+ ),
124
+ Match.when("logger-json", () =>
125
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
126
+ ),
127
+ Match.when("structured", () =>
128
+ Effect.provide(output, resourceLoggerLayer(flags.format)),
129
+ ),
130
+ Match.orElse(() => output),
131
+ );
132
+ }),
133
+ ).pipe(Command.withDescription("Show one stack resource")),
134
+ Command.make("diff", { profile: profileFlag, stack: stackFlag }, (flags) =>
135
+ Effect.gen(function* () {
136
+ const stackName = yield* decodeStackName(flags.stack);
137
+
138
+ yield* printLiveDiff({
139
+ profile: flags.profile,
140
+ stackName,
141
+ });
142
+ }),
143
+ ).pipe(Command.withDescription("Print live resource changes before apply")),
144
+ Command.make("apply", { profile: profileFlag, stack: stackFlag }, (flags) =>
145
+ Effect.gen(function* () {
146
+ const stackName = yield* decodeStackName(flags.stack);
147
+
148
+ yield* applyLiveStack({
149
+ profile: flags.profile,
150
+ stackName,
151
+ });
152
+ }),
153
+ ).pipe(Command.withDescription("Apply live resource changes")),
154
+ Command.make(
155
+ "destroy",
156
+ {
157
+ profile: profileFlag,
158
+ stack: stackFlag,
159
+ },
160
+ (flags) =>
161
+ Effect.gen(function* () {
162
+ const stackName = yield* decodeStackName(flags.stack);
163
+
164
+ yield* destroyStack({
165
+ profile: flags.profile,
166
+ stackName,
167
+ });
168
+ }),
169
+ ).pipe(Command.withDescription("Destroy a stack")),
170
+ Command.make(
171
+ "create",
172
+ {
173
+ profile: profileFlag,
174
+ stack: stackFlag,
175
+ },
176
+ (flags) =>
177
+ Effect.gen(function* () {
178
+ const stackName = yield* decodeStackName(flags.stack);
179
+
180
+ yield* applyLiveStack({
181
+ profile: flags.profile,
182
+ stackName,
183
+ });
184
+ }),
185
+ ).pipe(Command.withDescription("Create missing stack resources")),
186
+ ]);
@@ -0,0 +1,49 @@
1
+ import { Layer } from "effect";
2
+
3
+ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
4
+ import * as NodeServices from "@effect/platform-node/NodeServices";
5
+
6
+ import {
7
+ physicalNameStoreLayer as corePhysicalNameStoreLayer,
8
+ resourceStateStoreBaseLayer as coreResourceStateStoreLayer,
9
+ resourceGraphStoreLayer,
10
+ resourcePlannerLayer,
11
+ } from "./core/runtimeLayer.js";
12
+ import { ConfiguredStateSecretServiceLayer } from "./core/stateSecretService.js";
13
+ import { NomossTracingLive } from "./core/tracing.js";
14
+ import {
15
+ AwsProviderRuntime,
16
+ awsResourcesLayerLive,
17
+ } from "./providers/aws/awsProviderLayer.js";
18
+ import {
19
+ awsStackLifecycleLayerLive,
20
+ stackCatalogLayerLive,
21
+ stackWorkflowRendererLayerLive,
22
+ } from "./providers/aws/awsRuntimeLayer.js";
23
+
24
+ const physicalNameStoreWithNodeFileSystemLayer = Layer.provide(
25
+ corePhysicalNameStoreLayer,
26
+ NodeFileSystem.layer,
27
+ );
28
+ const resourceStateStoreWithNodeFileSystemLayer = Layer.provide(
29
+ coreResourceStateStoreLayer,
30
+ Layer.merge(
31
+ NodeFileSystem.layer,
32
+ ConfiguredStateSecretServiceLayer.pipe(Layer.provide(NodeServices.layer)),
33
+ ),
34
+ );
35
+ const awsResourcesLayer = awsResourcesLayerLive.pipe(
36
+ Layer.provideMerge(resourceGraphStoreLayer),
37
+ Layer.provideMerge(physicalNameStoreWithNodeFileSystemLayer),
38
+ );
39
+
40
+ export const nomossCliRuntimeLayer = awsStackLifecycleLayerLive.pipe(
41
+ Layer.provideMerge(awsResourcesLayer),
42
+ Layer.provideMerge(resourceStateStoreWithNodeFileSystemLayer),
43
+ Layer.provideMerge(stackCatalogLayerLive),
44
+ Layer.provideMerge(stackWorkflowRendererLayerLive),
45
+ Layer.provideMerge(resourcePlannerLayer),
46
+ Layer.provideMerge(Layer.effect(AwsProviderRuntime, AwsProviderRuntime.make)),
47
+ Layer.provideMerge(NodeServices.layer),
48
+ Layer.provideMerge(NomossTracingLive),
49
+ );
@@ -0,0 +1,17 @@
1
+ export * from "./lifecycle.js";
2
+ export * from "./model.js";
3
+ export * from "./physicalNameStore.js";
4
+ export * from "./planner.js";
5
+ export * from "./resourceCommandPolicy.js";
6
+ export * from "./resourceGraphBuilder.js";
7
+ export * from "./resourceGraphStore.js";
8
+ export * from "./resourceOutputResolver.js";
9
+ export * from "./resourcePolicy.js";
10
+ export * from "./resourceStackDefinition.js";
11
+ export * from "./resourceStackLifecycle.js";
12
+ export * from "./resourceStackOperations.js";
13
+ export * from "./runtimeLayer.js";
14
+ export * from "./stackWorkflowRenderer.js";
15
+ export * from "./stateSecretService.js";
16
+ export * from "./stateStore.js";
17
+ export * from "./tracing.js";
@@ -0,0 +1,127 @@
1
+ import { Data, type Schema } from "effect";
2
+
3
+ import type { ResourceNode } from "./model.js";
4
+
5
+ /**
6
+ * Repair decisions describe provider drift as explicit operations so renderers
7
+ * do not infer behavior from ad hoc action strings.
8
+ */
9
+ export type PlanRepairChange = Data.TaggedEnum<{
10
+ Added: {
11
+ readonly path: ReadonlyArray<string>;
12
+ readonly after: string;
13
+ };
14
+ Removed: {
15
+ readonly path: ReadonlyArray<string>;
16
+ readonly before: string;
17
+ };
18
+ Updated: {
19
+ readonly path: ReadonlyArray<string>;
20
+ readonly before?: string;
21
+ readonly after?: string;
22
+ };
23
+ }>;
24
+
25
+ export const PlanRepairChange = Data.taggedEnum<PlanRepairChange>();
26
+
27
+ export type ResourceObservation = Data.TaggedEnum<{
28
+ Present: {
29
+ readonly node: ResourceNode;
30
+ readonly observed: Schema.Json;
31
+ };
32
+ Missing: {
33
+ readonly node: ResourceNode;
34
+ };
35
+ Drifted: {
36
+ readonly node: ResourceNode;
37
+ readonly reason: string;
38
+ };
39
+ Unreadable: {
40
+ readonly node: ResourceNode;
41
+ readonly reason: string;
42
+ };
43
+ }>;
44
+
45
+ export const ResourceObservation = Data.taggedEnum<ResourceObservation>();
46
+
47
+ export type PlanDecision = Data.TaggedEnum<{
48
+ NoOp: {
49
+ readonly node: ResourceNode;
50
+ };
51
+ Create: {
52
+ readonly node: ResourceNode;
53
+ };
54
+ Update: {
55
+ readonly node: ResourceNode;
56
+ readonly current: ResourceNode;
57
+ };
58
+ Repair: {
59
+ readonly node: ResourceNode;
60
+ readonly reason: string;
61
+ readonly changes?: ReadonlyArray<PlanRepairChange>;
62
+ };
63
+ Delete: {
64
+ readonly node: ResourceNode;
65
+ };
66
+ Destroy: {
67
+ readonly node: ResourceNode;
68
+ };
69
+ }>;
70
+
71
+ export const PlanDecision = Data.taggedEnum<PlanDecision>();
72
+
73
+ export type ResourceCommand = Data.TaggedEnum<{
74
+ Read: {
75
+ readonly node: ResourceNode;
76
+ };
77
+ Diff: {
78
+ readonly node: ResourceNode;
79
+ readonly observation: ResourceObservation;
80
+ };
81
+ Apply: {
82
+ readonly decision: PlanDecision;
83
+ };
84
+ Create: {
85
+ readonly node: ResourceNode;
86
+ };
87
+ Update: {
88
+ readonly node: ResourceNode;
89
+ };
90
+ Delete: {
91
+ readonly node: ResourceNode;
92
+ };
93
+ Destroy: {
94
+ readonly node: ResourceNode;
95
+ };
96
+ }>;
97
+
98
+ export const ResourceCommand = Data.taggedEnum<ResourceCommand>();
99
+
100
+ export type ResourceCommandResult = Data.TaggedEnum<{
101
+ Observed: {
102
+ readonly observation: ResourceObservation;
103
+ };
104
+ Decided: {
105
+ readonly decision: PlanDecision;
106
+ };
107
+ Created: {
108
+ readonly node: ResourceNode;
109
+ };
110
+ Updated: {
111
+ readonly node: ResourceNode;
112
+ };
113
+ Deleted: {
114
+ readonly node: ResourceNode;
115
+ };
116
+ Destroyed: {
117
+ readonly node: ResourceNode;
118
+ };
119
+ }>;
120
+
121
+ export const ResourceCommandResult = Data.taggedEnum<ResourceCommandResult>();
122
+
123
+ export class ResourceCommandUnsupported extends Data.TaggedError(
124
+ "ResourceCommandUnsupported",
125
+ )<{
126
+ readonly command: ResourceCommand;
127
+ }> {}