nomoss 0.0.3 → 0.0.5
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/CHANGELOG.md +34 -0
- package/README.md +5 -15
- package/ROADMAP.md +2 -0
- package/docs/README.md +1 -1
- package/docs/application/aws-resource-coverage.md +26 -0
- package/docs/application/aws-resource-lifecycle-management.md +13 -23
- package/docs/application/cli-workflow.md +1 -1
- package/docs/application/engine-design.md +2 -2
- package/docs/application/generation-architecture.md +10 -45
- package/docs/application/resource-command-policy-stage.md +2 -2
- package/docs/application/resource-graph.md +1 -1
- package/docs/application/resource-lifecycle-tracker.md +1 -9
- package/docs/application/resource-mapping.md +4 -9
- package/docs/application/resource-operations.md +4 -2
- package/docs/application/tracing.md +2 -6
- package/docs/development/code-documentation.md +2 -0
- package/docs/development/effect-native-development.md +44 -0
- package/docs/development/linting.md +1 -1
- package/docs/development/review-code.md +22 -6
- package/docs/development/review-remediation-spec.md +28 -37
- package/docs/development/spec-writing.md +1 -1
- package/docs/development/testing.md +23 -9
- package/docs/operations/observability-sop.md +11 -17
- package/docs/operations/releasing.md +3 -1
- package/examples/README.md +3 -26
- package/examples/commands.ts +2 -36
- package/examples/queue/application.ts +8 -2
- package/examples/state-machine/application.ts +3 -1
- package/package.json +40 -46
- package/providers/aws/README.md +21 -0
- package/providers/aws/awsEnvironment.ts +114 -0
- package/providers/aws/generated/managementRegistry.ts +136 -0
- package/{src/providers/aws/resources/generated/native/apigatewayv2/api/index.ts → providers/aws/generated/resources/apigatewayv2/api.ts} +13 -50
- package/{src/providers/aws/resources/generated/native/apigatewayv2/integration/index.ts → providers/aws/generated/resources/apigatewayv2/integration.ts} +13 -37
- package/{src/providers/aws/resources/generated/native/apigatewayv2/route/index.ts → providers/aws/generated/resources/apigatewayv2/route.ts} +23 -40
- package/{src/providers/aws/resources/generated/native/apigatewayv2/stage/index.ts → providers/aws/generated/resources/apigatewayv2/stage.ts} +13 -38
- package/providers/aws/generated/resources/iam/accesskey.ts +184 -0
- package/{src/providers/aws/resources/generated/native/iam/group/index.ts → providers/aws/generated/resources/iam/group.ts} +13 -38
- package/{src/providers/aws/resources/generated/native/iam/grouppolicy/index.ts → providers/aws/generated/resources/iam/grouppolicy.ts} +29 -59
- package/{src/providers/aws/resources/generated/native/iam/instanceprofile/index.ts → providers/aws/generated/resources/iam/instanceprofile.ts} +13 -41
- package/{src/providers/aws/resources/generated/native/iam/managedpolicy/index.ts → providers/aws/generated/resources/iam/managedpolicy.ts} +13 -95
- package/providers/aws/generated/resources/iam/oidcprovider.ts +314 -0
- package/{src/providers/aws/resources/generated/native/iam/policy/index.ts → providers/aws/generated/resources/iam/policy.ts} +13 -28
- package/{src/providers/aws/resources/generated/native/iam/role/index.ts → providers/aws/generated/resources/iam/role.ts} +13 -47
- package/{src/providers/aws/resources/generated/native/iam/rolepolicy/index.ts → providers/aws/generated/resources/iam/rolepolicy.ts} +29 -59
- package/providers/aws/generated/resources/iam/samlprovider.ts +463 -0
- package/providers/aws/generated/resources/iam/servercertificate.ts +465 -0
- package/providers/aws/generated/resources/iam/servicelinkedrole.ts +187 -0
- package/{src/providers/aws/resources/generated/native/iam/user/index.ts → providers/aws/generated/resources/iam/user.ts} +13 -38
- package/{src/providers/aws/resources/generated/native/iam/userpolicy/index.ts → providers/aws/generated/resources/iam/userpolicy.ts} +29 -59
- package/{src/providers/aws/resources/generated/native/iam/usertogroupaddition/index.ts → providers/aws/generated/resources/iam/usertogroupaddition.ts} +13 -27
- package/providers/aws/generated/resources/iam/virtualmfadevice.ts +298 -0
- package/{src/providers/aws/resources/generated/native/kms/key/index.ts → providers/aws/generated/resources/kms/key.ts} +13 -41
- package/{src/providers/aws/resources/generated/native/lambda/function/index.ts → providers/aws/generated/resources/lambda/function.ts} +13 -63
- package/{src/providers/aws/resources/generated/native/lambda/permission/index.ts → providers/aws/generated/resources/lambda/permission.ts} +13 -55
- package/{src/providers/aws/resources/generated/native/s3/bucket/index.ts → providers/aws/generated/resources/s3/bucket.ts} +14 -104
- package/{src/providers/aws/resources/generated/native/sns/topic/index.ts → providers/aws/generated/resources/sns/topic.ts} +14 -29
- package/{src/providers/aws/resources/generated/native/sqs/queue/index.ts → providers/aws/generated/resources/sqs/queue.ts} +14 -38
- package/{src/providers/aws/resources/generated/native/stepfunctions/statemachine/index.ts → providers/aws/generated/resources/stepfunctions/statemachine.ts} +15 -58
- package/providers/aws/management/mappings/iam/group.ts +63 -0
- package/providers/aws/management/mappings/iam/iamIdentity.ts +41 -0
- package/providers/aws/management/mappings/iam/iamLifecycleSettings.ts +8 -0
- package/providers/aws/management/mappings/iam/inlinePolicies.ts +159 -0
- package/providers/aws/management/mappings/iam/instanceProfile.ts +77 -0
- package/providers/aws/management/mappings/iam/oidcProvider.ts +94 -0
- package/providers/aws/management/mappings/iam/role.ts +74 -0
- package/providers/aws/management/mappings/iam/samlProvider.ts +98 -0
- package/providers/aws/management/mappings/iam/serverCertificate.ts +72 -0
- package/providers/aws/management/mappings/iam/user.ts +61 -0
- package/providers/aws/management/mappings/iam/userToGroupAddition.ts +75 -0
- package/providers/aws/management/operations/iam/accessKey.ts +206 -0
- package/providers/aws/management/operations/iam/managedPolicy.ts +491 -0
- package/providers/aws/management/operations/iam/policy.ts +476 -0
- package/providers/aws/management/operations/iam/serviceLinkedRole.ts +172 -0
- package/providers/aws/management/operations/iam/virtualMfaDevice.ts +253 -0
- package/providers/aws/management/resourceAssociationConfiguration.ts +112 -0
- package/providers/aws/management/resourceAssociationRegistration.ts +349 -0
- package/providers/aws/management/resourceAssociations.ts +168 -0
- package/{src/providers → providers}/aws/management/resourceConfiguration.ts +24 -26
- package/providers/aws/management/resourceLifecycleRegistration.ts +540 -0
- package/providers/aws/management/resourceManagementModule.ts +31 -0
- package/providers/aws/management/resourceManagementRegistry.ts +62 -0
- package/providers/aws/management/resourceMapping.ts +84 -0
- package/providers/aws/management/resourceOperation.ts +134 -0
- package/providers/aws/management/resourceTagOperations.ts +108 -0
- package/providers/aws/management/resourceTiming.ts +4 -0
- package/providers/aws/runtime.ts +52 -0
- package/src/core/resource/resourceCommandPolicy.ts +20 -0
- package/src/core/resource/resourceLifecycle.ts +644 -0
- package/src/core/resource/resourceStabilization.ts +120 -0
- package/src/core/resource/resourceVersions.ts +102 -0
- package/src/core/stack/planner.ts +9 -0
- package/src/core/stack/resourceStackLifecycle.ts +36 -3
- package/src/core/state/resourceState.ts +6 -4
- package/src/core/state/stateStore.ts +57 -10
- package/src/providers/file/resourcePolicy.ts +13 -12
- package/src/providers/providerRuntimeLayer.ts +5 -2
- package/src/providers/resourceCommandPolicyLayer.ts +117 -37
- package/src/providers/stripe/management/resourcePolicy.ts +22 -11
- package/examples/http-echo/application.ts +0 -87
- package/src/providers/aws/client/awsClient.ts +0 -418
- package/src/providers/aws/client/awsClientConfig.ts +0 -133
- package/src/providers/aws/client/awsClientModel.ts +0 -119
- package/src/providers/aws/client/awsHttpOperation.ts +0 -153
- package/src/providers/aws/client/awsQueryOperation.ts +0 -149
- package/src/providers/aws/client/awsRequestSigner.ts +0 -115
- package/src/providers/aws/client/awsResponseDecoder.ts +0 -135
- package/src/providers/aws/client/awsRetryPolicy.ts +0 -62
- package/src/providers/aws/client/generated/apiGatewayV2.ts +0 -3025
- package/src/providers/aws/client/generated/cloudControl.ts +0 -5746
- package/src/providers/aws/client/generated/iam.ts +0 -10892
- package/src/providers/aws/client/generated/lambda.ts +0 -5403
- package/src/providers/aws/client/generated/sqs.ts +0 -3769
- package/src/providers/aws/client/generated/stepFunctions.ts +0 -1726
- package/src/providers/aws/client/openapi/cloudControl/CancelResourceRequest.json +0 -579
- package/src/providers/aws/client/openapi/cloudControl/CreateResource.json +0 -1019
- package/src/providers/aws/client/openapi/cloudControl/DeleteResource.json +0 -1018
- package/src/providers/aws/client/openapi/cloudControl/GetResource.json +0 -883
- package/src/providers/aws/client/openapi/cloudControl/GetResourceRequestStatus.json +0 -655
- package/src/providers/aws/client/openapi/cloudControl/ListResourceRequests.json +0 -566
- package/src/providers/aws/client/openapi/cloudControl/ListResources.json +0 -913
- package/src/providers/aws/client/openapi/cloudControl/UpdateResource.json +0 -1027
- package/src/providers/aws/cloudControl/client.ts +0 -69
- package/src/providers/aws/cloudControl/requestTracker.ts +0 -138
- package/src/providers/aws/cloudControl/resourceCommandPolicyLayer.ts +0 -63
- package/src/providers/aws/cloudControl/resourceLifecycle.ts +0 -479
- package/src/providers/aws/cloudControl/resources/generated/certificatemanager/certificate/index.ts +0 -179
- package/src/providers/aws/cloudControl/resources/generated/kms/key/index.ts +0 -362
- package/src/providers/aws/cloudControl/resources/generated/s3/bucket/index.ts +0 -2364
- package/src/providers/aws/cloudControl/resources/generated/sns/topic/index.ts +0 -326
- package/src/providers/aws/cloudControl/resources/generated/sqs/queue/index.ts +0 -307
- package/src/providers/aws/cloudControl/resources/generated/sqs/queueinlinepolicy/index.ts +0 -108
- package/src/providers/aws/cloudControl/runtime.ts +0 -127
- package/src/providers/aws/management/resourceMapping.ts +0 -343
- package/src/providers/aws/management/resourceOperation.ts +0 -57
- package/src/providers/aws/management/resourcePolicy.ts +0 -549
- package/src/providers/aws/management/resourceRegistration.ts +0 -294
- package/src/providers/aws/resources/apiGatewayV2/httpApi.ts +0 -327
- package/src/providers/aws/resources/generated/native/resourceCommands.ts +0 -152
- package/src/providers/aws/resources/iam/grant.ts +0 -150
- package/src/providers/aws/resources/iam/grantCommands.ts +0 -283
- package/src/providers/aws/resources/iam/policyDocument.ts +0 -30
- package/src/providers/aws/resources/iam/policyStatement.ts +0 -59
- package/src/providers/aws/resources/iam/role.ts +0 -426
- package/src/providers/aws/resources/iam/roleDeclaration.ts +0 -105
- package/src/providers/aws/resources/lambda/function.ts +0 -403
- package/src/providers/aws/resources/lambda/functionDeclaration.ts +0 -234
- package/src/providers/aws/resources/lambda/permission.ts +0 -363
- package/src/providers/aws/resources/stepFunctions/stateMachine.ts +0 -95
- package/src/providers/aws/runtime.ts +0 -70
|
@@ -34,8 +34,52 @@ Use Layer.buildWithMemoMap when the caller must supply a [Layer](https://github.
|
|
|
34
34
|
|
|
35
35
|
Stop the active stream before its replacement starts. Give each stream its own scope and close that scope to stop it, or store the active fiber in service state and interrupt it directly. Apply that cleanup when a change of identity or runtime requires a new stream.
|
|
36
36
|
|
|
37
|
+
## Develop resource management
|
|
38
|
+
|
|
39
|
+
### Establish the resource lifecycle
|
|
40
|
+
|
|
41
|
+
Start with what the stack must be able to create, observe, change, replace, and remove. Read the provider specification and trace each action through the existing lifecycle service and saved state. Establish which provider values identify the owned object, which properties can change, what confirms a mutation, and what a retry needs after partial success. See the [resource lifecycle contract](../application/resource-operations.md).
|
|
42
|
+
|
|
43
|
+
Use a branded schema for AWS identities and metadata that pass between services. Decode provider replies and saved values through the canonical schema before a service uses an identity. The brand distinguishes values that share a wire type, such as an AWS account ID and an IAM role ID. Use the [AWS environment and ARN contracts](../../providers/aws/README.md) for account, partition, region, and ARN values.
|
|
44
|
+
|
|
45
|
+
### Combine generation, declarations, and code
|
|
46
|
+
|
|
47
|
+
Generate schemas and typed client operations from the provider specifications. Use a resource definition to select those operations and map identities, requests, and confirmed results through the shared lifecycle contract. A resource that follows a supported lifecycle should require only its definition and generator inputs. New field names, operation names, and response formats belong in mappings.
|
|
48
|
+
|
|
49
|
+
If the contract lacks a required behavior, explain the provider rule and what happens if the stack omits it. Extend the shared contract if the rule applies to other resources. Supply a typed Effect operation at the affected lifecycle step if a resource needs its own decision or sequence. The shared lifecycle still validates inputs, checks ownership, confirms changes, and saves state. A new interface, manifest field, or renderer requires a distinct behavior that the existing contract cannot express. See [Generate lifecycle operations](../application/generation-architecture.md#generate-lifecycle-operations).
|
|
50
|
+
|
|
51
|
+
### Resolve management by resource type
|
|
52
|
+
|
|
53
|
+
The provider Layer supplies services shared across resource types. A catalog indexed by resource type can tell the runtime where to find each management definition. Resolve the types a stack operation needs from declarations and saved state. Load and initialize those definitions within the existing application scope. The stack must still manage a saved resource after its declaration disappears. If a definition is missing, report the unsupported command before the runtime sends a request for that resource.
|
|
54
|
+
|
|
55
|
+
A new resource must leave provider runtime composition unchanged. A provider-wide `Layer.mergeAll` of resource command Layers builds every registration at startup. A generated list has the same cost, even if the generator writes one list per service. Keep that pattern out of provider composition. See the [Effect Layer implementation](../../../command-options-fund/refs/effect/packages/effect/src/Layer.ts) for how `mergeAll` builds its inputs.
|
|
56
|
+
|
|
57
|
+
### Verify the pattern at catalog scale
|
|
58
|
+
|
|
59
|
+
Show that a new resource can use an existing lifecycle through its definition and generator inputs. Run a fixed stack against a catalog of hundreds of resource types and check which management definitions load and initialize. Record the catalog size, the types the stack uses, and the observed startup work. Use the stack to verify mutation results, recovery after a failure, and removal after a declaration disappears.
|
|
60
|
+
|
|
61
|
+
### Use a local AWS client from another repository
|
|
62
|
+
|
|
63
|
+
Run `yarn install` in the Nomoss checkout. In a Yarn 4 app, add `@tradedal/aws-client-iam` and `@tradedal/aws-client-core` to `dependencies` with `"*"` as the version. Then run this from the app directory:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
NOMOSS=/path/to/nomoss
|
|
67
|
+
yarn link "$NOMOSS/providers/aws/generated/clients/iam" \
|
|
68
|
+
"$NOMOSS/providers/aws/client-core"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The app imports both packages by name and reads the linked source. If the app uses Yarn's `node-modules` linker, set `NODE_OPTIONS=--preserve-symlinks` when launching it. For an npm app, run `yarn workspace <package-name> pack --out /tmp/<package>.tgz` in Nomoss for each package, then install both archives together with `npm install` from the app. Repack and reinstall to pick up changes.
|
|
72
|
+
|
|
37
73
|
## Compose operations and return typed failures
|
|
38
74
|
|
|
75
|
+
### Let Effect infer channels at the call site
|
|
76
|
+
|
|
77
|
+
Let Effect's combinators infer success values, failures, and required services. A helper whose sole purpose is forwarding `Effect.Effect<A, E, R>` to a combinator repeats the library's signature, even when TypeScript infers the helper's return type. The same rule applies to generic Layer inputs.
|
|
78
|
+
|
|
79
|
+
For a retry, the service supplies the schedule and the caller decides which failures to retry with `request.pipe(Effect.retry({ schedule, while: isRetryable }))`. Effect checks the predicate against the request's failure type. Keep a domain type parameter when the signature relates application values, such as a resource observation and its readiness predicate. [Effect retry API and overloads](../../../command-options-fund/refs/effect/packages/effect/src/Effect.ts)
|
|
80
|
+
|
|
81
|
+
### Keep the complete operation in its Effect
|
|
82
|
+
|
|
39
83
|
Keep every operation required for a method's result in the Effect returned to its caller. Use explicit Effect sequencing for work that runs after an operation succeeds, such as rendering a plan before returning it. Separate logical steps with blank lines so readers can see where the operation obtains the result, uses it, and returns it. Perform external I/O and process execution through Effect services so the application supplies their implementations and controls their lifetimes. Send program logs through Effect and terminal output through the command renderer that applies the CLI's presentation contract.
|
|
40
84
|
|
|
41
85
|
Represent provider rejections, transport failures, and invalid responses with Data.TaggedError. Include the affected resource or operation and the provider's failure details so callers can identify the failed work. Decode modeled provider errors through generated contracts, and translate transport and validation failures in internal services into the tagged errors promised by their public methods.
|
|
@@ -20,7 +20,7 @@ Compiler and editor diagnostics must use the [Effect TypeScript 7 integration](h
|
|
|
20
20
|
|
|
21
21
|
The project uses Effect's CLI, Graph, HTTP, and persistence APIs, which Effect classifies as unstable. The unstableApiUsage diagnostic is disabled so those required APIs do not produce diagnostics. Composition, schema, runtime, and TypeScript diagnostics remain enforced.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Effect tsgo recognizes annotated integer and finite checks, so `schemaNumber` applies to handwritten and generated schemas. Projen suppresses `preferTypedSchemaDecoder` only in generated Stripe resource bindings. Those bindings still validate declaration properties against their provider request schemas before execution. [Effect tsgo fix](https://github.com/Effect-TS/tsgo/pull/986)
|
|
24
24
|
|
|
25
25
|
## Validate the assigned change
|
|
26
26
|
|
|
@@ -2,23 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
## Prepare or commit the review batch
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Read the active task before changing code. Choose one required result that a caller can observe. For a generator change, identify the source rule, the declaration it produces, and the caller that uses that declaration. Apply the checks below as soon as that operation is complete and correct it before extending the pattern to another resource.
|
|
6
6
|
|
|
7
7
|
Organize the batch around changes that must work together. Keep a changed interface with the callers migrated to it, because reviewing either part requires the other. Keep changed tests with the implementation they exercise.
|
|
8
8
|
|
|
9
9
|
Make batches easy to review and size them so review can advance without breaking related work into disconnected files or producing one large dump.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
When the user has staged selected work, compare the index with HEAD and the working tree with the index. Inspect both versions of a partially staged file and check whether its imports require untracked files. Preserve the user's staging choices. When preparing a batch for integration, validate the proposed staged contents independently so that local files cannot conceal a missing dependency.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Keep the batch in the working tree until the user requests staging or a commit.
|
|
14
|
+
|
|
15
|
+
## Check for clamped code
|
|
16
|
+
|
|
17
|
+
Clamping means statements from different logical steps are stacked together without a blank line between them. Keep the statements for one step together. Insert a blank line where the next step begins. For example, keep the statements that recover a queue name from its URL together, then leave a blank line before collecting tags.
|
|
18
|
+
|
|
19
|
+
- [ ] Read every changed function and test for missing logical breaks after formatting. Apply the same check to generated code and fix missing breaks in the generator. When spacing is the issue, inserting the blank line completes the fix.
|
|
14
20
|
|
|
15
21
|
## Required behavior and public APIs
|
|
16
22
|
|
|
17
23
|
- [ ] Compare the completed implementation with the accepted requirements through the public API the application is supposed to use. Follow the call to the result its consumer receives. Restore missing behavior within the assignment. Report a conflict that needs a user decision before changing the required API or narrowing what counts as complete.
|
|
18
24
|
|
|
25
|
+
- [ ] Read the resource test beside the application declaration. Exercise the declaration form the application uses, since a property on a parent and a separate resource can have different lifecycles. Verify which provider values change and which state the stack preserves.
|
|
26
|
+
|
|
19
27
|
- [ ] Trace successful returns to the work they claim to complete. Replace placeholder results, unexecuted Effects, or successful defaults that skip required work with calls to the responsible production services. Verify the actual result and saved state; a method name or return type does not establish that the operation happened.
|
|
20
28
|
|
|
21
|
-
- [ ] Check
|
|
29
|
+
- [ ] Check whether callers must perform engine procedures after a cleanup or type repair. Keep registration, declaration isolation, preparation, and output resolution inside the engine where the accepted design assigns them. Fix the service composition if a caller must invoke an internal procedure to use the public API.
|
|
22
30
|
|
|
23
31
|
- [ ] Compare resource-specific branches with the general capability required by the assignment. Move behavior implemented only for an example into the responsible core service or generator. Verify that other supported resources use the same implementation. Keep examples as consumers of that capability.
|
|
24
32
|
|
|
@@ -40,7 +48,13 @@ For a batch of mechanical changes of low risk, commit without waiting for the us
|
|
|
40
48
|
|
|
41
49
|
- [ ] Inspect lint fixes for deeply nested callbacks, unrelated inputs collected into an object, or helpers added only to silence a diagnostic. Rewrite the affected operation through readable native Effect composition. Preserve execution order and keep local parsing and decisions beside the work that uses them.
|
|
42
50
|
|
|
43
|
-
- [ ] Read
|
|
51
|
+
- [ ] Read each changed operation and its generated result from top to bottom. Give a condition a name that states the resource rule, then keep the value or failure it selects beside it. Use a local name when a nested expression makes the reader reconstruct a schema or request before they can see what it does.
|
|
52
|
+
|
|
53
|
+
- [ ] Read each rejection condition as a rule a caller must satisfy. For example, a configured value prefix requires a string property with a relationship at that exact path. Express the conditions in those terms and keep the typed failure beside the decision. Check that a reader can identify invalid input without reversing several nested tests.
|
|
54
|
+
|
|
55
|
+
- [ ] Trace how the runtime finds each resource's management definition. A new type that uses an existing lifecycle must leave provider Layer composition unchanged. Check that the stack loads definitions by type and can manage a resource it knows only from saved state. Use the [resource management development guide](effect-native-development.md#develop-resource-management) to assess the design at catalog scale.
|
|
56
|
+
|
|
57
|
+
- [ ] Read the generator beside one emitted module. Check the source comment where the generator makes a domain decision and the emitted documentation where the application author uses the result. For a generated import, follow the imported symbol to the expression that needs it and document the reason for that dependency beside the owning block. Cite the checked-in library guide or API that supports the operation. Apply the [code documentation requirements](code-documentation.md) to both files.
|
|
44
58
|
|
|
45
59
|
- [ ] Check validation against the canonical schema for the domain. Replace copied contracts and local validators that make a business decision with that schema and the responsible service operation. Preserve the typed failures promised to callers instead of hiding them through fallback values.
|
|
46
60
|
|
|
@@ -48,7 +62,9 @@ For a batch of mechanical changes of low risk, commit without waiting for the us
|
|
|
48
62
|
|
|
49
63
|
## Evidence and completion
|
|
50
64
|
|
|
51
|
-
- [ ]
|
|
65
|
+
- [ ] For each resource management case, identify the requirement, the action taken through the public stack API, and the observation that would distinguish correct behavior from a regression. Apply the [resource test structure](testing.md#structure-resource-management-tests) before accepting the case. Move declaration details out of the workflow and remove assertions that only confirm fixture inputs. A new case must cover a specific outcome the existing cases leave open.
|
|
66
|
+
|
|
67
|
+
- [ ] Follow each behavior test through the production operation. Use the shared fixture and real consumer so the test exercises that operation. Keep the provider responses the fixture needs. Verify the results the consumer receives after a write or a retry when the requirement covers those outcomes.
|
|
52
68
|
|
|
53
69
|
- [ ] Compare changed assertions, snapshots, and examples with the accepted behavior before accepting them. Correct evidence that merely follows the new implementation or uses an available internal API in place of the required public API. Add coverage only for a specific behavior gap under the [testing contract](testing.md).
|
|
54
70
|
|
|
@@ -1,49 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Code review and remediation checklist
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Scope
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- [ ] Compare the working tree and index with the requested change. Preserve unrelated edits and their staged state. For a plan-only assignment, limit the review to the plan.
|
|
6
|
+
- [ ] Confirm the user authorized removal before deleting experimental code, references, tests, or dedicated fixtures. Keep deleted declarations absent.
|
|
7
|
+
- [ ] Record unfinished work in the assigned tracker. Name the affected user, the result they still need, and what blocks it.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Application behavior
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- [ ] Run the application action through its public API. Compare the returned result, saved state, and reported failures with the accepted requirements.
|
|
12
|
+
- [ ] Trace a declaration through planning, provider calls, state writes, and output resolution. Check that the services use the same instances in the shared Layer graph. Fix the dependency that causes consumers to read different state.
|
|
13
|
+
- [ ] Review changes to resource definitions, generation, and provider registration against the [resource management development guide](effect-native-development.md#develop-resource-management).
|
|
14
|
+
- [ ] For long-running work, exercise interruption, replacement, and resumption as required. Check which local work stops and what the remote cancellation contract requires. In regression tests, use deterministic Effect signals to wait for the result the real consumer receives.
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Public APIs and Effect composition
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
- [ ] Compare public names with the repository's terms for the same capability. Follow imports to their canonical declarations and remove forwarding exports used solely to rename them. Check that package entry points expose the services, contracts, and errors callers need.
|
|
19
|
+
- [ ] Read the complete method and its callbacks together. Keep local validation and decisions beside the work that uses them. Call public methods or dependency services for shared behavior. Return the service's public API object directly from its constructor.
|
|
20
|
+
- [ ] Check inputs against the canonical schema and verify callers supply its required types. Return the completed result from a named local with an explicit domain type. Let TypeScript infer intermediate types and Effect channels. Replace casts, manual channel declarations, and `satisfies` expressions that mask a mismatch with a fix where the mismatch originates.
|
|
21
|
+
- [ ] Trace generic parameters in Effect and Layer inputs, callbacks, and local type aliases. If a parameter only carries a success type, error type, or service requirement, use the native combinator to infer it. [Effect channel inference](effect-native-development.md#let-effect-infer-channels-at-the-call-site)
|
|
22
|
+
- [ ] Inspect callbacks and `Effect.sync` bodies for loops or branches that obscure execution order or failures. Use Effect's collection and decision operations where they express the work directly. [Effect development contract](effect-native-development.md)
|
|
23
|
+
- [ ] Group lookup and validation statements together. Leave a blank line before the work that consumes the result. Keep execution order and control flow intact when adjusting whitespace.
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
## AWS generation and execution
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
- [ ] Compare the Smithy model with the generated contract callers import. Check request bindings, payload schemas, and execution metadata. Follow the public export to the AWS client and verify input validation and serialization. Check that the signer receives the final request before transport and that the client decodes the response or returns the typed failure. Verify the dependencies, prepared request reuse on retry, and interruption of HTTP work and waits against the contract. [AWS resource specification](../application/aws-resource-lifecycle-management.md)
|
|
28
|
+
- [ ] Follow a native AWS mutation through confirmation. Check that the lifecycle reads and validates the resource before it saves outputs or releases dependent work. [AWS resource specification](../application/aws-resource-lifecycle-management.md)
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
## Comments and documentation
|
|
20
31
|
|
|
21
|
-
Read each
|
|
32
|
+
- [ ] Read each changed comment with the operation and its callers. Keep the reason or contract the reader needs to understand the call. For a library extension, identify the library API it uses and the behavior the extension adds. Check multiline JSDoc delimiters, line width, and paragraph spacing. [Code documentation](code-documentation.md)
|
|
33
|
+
- [ ] Walk through each edited specification as its intended reader. Verify that it explains the required workflow and outcome. Remove accounts of method calls, constructor statements, and tracker activity. Where an architecture or API decision is required, explain the constraint and its consequence. Leave private project details outside repository documentation. [Specification guidance](spec-writing.md) · [Writing review](unslop.md)
|
|
34
|
+
- [ ] Try to follow the steps in edited operating instructions. Check that the commands and expected results let the reader complete the task. In API documentation, check that callers can tell how to call the API and interpret the result.
|
|
22
35
|
|
|
23
|
-
|
|
36
|
+
## Validation and completion
|
|
24
37
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Place the statements that look up or validate a value together, then separate them with a blank line from the work that consumes the result. Keep related statements together and leave enough space around multiline calls to show where each operation ends. When you adjust whitespace, keep statements in their existing blocks and preserve their execution order and control flow.
|
|
30
|
-
|
|
31
|
-
For an AWS operation, read the source model and check that the generator preserves its request bindings, payload schemas, and execution metadata in the contract callers import. Follow a caller through that public export to the internal client, as required by the [AWS resource specification](../application/aws-resource-lifecycle-management.md). Check that the generated schema validates caller input, the client prepares and serializes the request, and the signer signs that final request before the HTTP service sends it. Check how the client decodes the response or returns a typed failure. For a Cloud Control mutation, follow how the tracker uses the request token until AWS reports a terminal result. Check that the lifecycle reads and validates the resource model before it saves outputs or releases dependent work. Assess each step against the linked contract, including which dependencies it permits, how retries reuse the prepared request, and which HTTP work and waits must stop when the caller is interrupted.
|
|
32
|
-
|
|
33
|
-
## Review comments, specifications, and operating instructions
|
|
34
|
-
|
|
35
|
-
Read each source comment with the complete operation and its callers. Check that it explains a supported reason or requirement that adjacent statements do not establish. If the code extends a library, the comment must explain what the extension adds and which behavior the library already supplies.
|
|
36
|
-
|
|
37
|
-
Write multiline JSDoc with its delimiters on separate lines. Wrap prose to the configured width and separate paragraphs with blank comment lines. Check that specifications explain required behavior, API documentation explains how to call the API and interpret its result, and operating instructions provide the steps and commands needed to perform the task.
|
|
38
|
-
|
|
39
|
-
Read a functionality specification as someone who must perform its workflow and understand the expected result. The reader must not need to reconstruct the implementation. Remove accounts of method calls, constructor statements, and tracker activity. Explain required architecture and API decisions with enough technical detail to establish the constraint and its consequence.
|
|
40
|
-
|
|
41
|
-
Read the complete edited text against the [documentation contract](code-documentation.md), [specification guidance](spec-writing.md), and [writing review](unslop.md). Keep private project details outside repository documentation.
|
|
42
|
-
|
|
43
|
-
## Verify the completed change
|
|
44
|
-
|
|
45
|
-
Choose each check to answer a question about the behavior delivered by the change. Reuse existing evidence when the relevant work is unchanged. Add a test only for an identified Nomoss behavior that needs proof. Remove tests and dedicated fixtures that merely repeat implementation or library guarantees only when the user has authorized that removal.
|
|
46
|
-
|
|
47
|
-
Finish the fixes before the final checks for the assigned scope. Run the Biome and Effect language-service checks required for changed code by the [linting workflow](linting.md). Read the result against the governing contract as well; automated checks cannot establish every requirement. Repeat a check after a relevant change or when the existing evidence does not answer a specific question.
|
|
48
|
-
|
|
49
|
-
Check that the finished change provides the promised behavior to its required consumers. Stage only the requested scope and record unfinished work in its assigned tracker. Commit or push only with the user's explicit authorization and follow the repository's Git rules.
|
|
38
|
+
- [ ] Compare proposed tests with existing coverage. Add a test for a specific gap in Nomoss behavior and assert the result its consumer receives. Use existing evidence for unchanged work. [Testing contract](testing.md)
|
|
39
|
+
- [ ] After the final fixes, run the required Biome and Effect language-service checks for the changed code. Inspect the result against the governing contract for requirements that need direct review. Rerun a check after a change that affects its result or when the evidence leaves a specific requirement unverified. [Linting workflow](linting.md)
|
|
40
|
+
- [ ] Stage only the requested files. Obtain explicit authorization before committing or pushing.
|
|
@@ -12,7 +12,7 @@ Translate feedback into ordinary English before you add it to a specification. P
|
|
|
12
12
|
|
|
13
13
|
## Explain what the software does
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Open each section of a specification or README at the point where the reader needs it. For example, a contributor who must choose a field mapping needs to know how AWS uses that field on create and update before instructions for choosing the mapping will make sense. Introduce a resource, request, or saved record before a requirement refers to it. When one operation depends on another, explain which result it needs and why that result affects its behavior.
|
|
16
16
|
|
|
17
17
|
A paragraph must develop an explanation through related sentences. Explain what the consumer can accomplish and how the relevant conditions determine the result. A service name, a paraphrase of its code, or the word must cannot replace that explanation.
|
|
18
18
|
|
|
@@ -20,6 +20,20 @@ When a complete generated artifact establishes the required result, capture it t
|
|
|
20
20
|
|
|
21
21
|
For a failed stack, resource, or provider operation, CLI tests must check the diagnostics the operator receives and how the process exits. They must also check how it exits after interruption. To test progress reports, run the executable workflow, observe elapsed time and terminal output, and verify that the display stops when its scope ends.
|
|
22
22
|
|
|
23
|
+
## Structure resource management tests
|
|
24
|
+
|
|
25
|
+
Group integration tests by provider and application workflow. Native AWS suites live under `tests/aws/native/`. Place a case with the workflow that establishes the required behavior.
|
|
26
|
+
|
|
27
|
+
Give each independent outcome its own case. Keep successive actions together when a later action needs the identity saved by an earlier one. Each case owns its stack name, provider objects, and cleanup so Vitest can run resource files in parallel.
|
|
28
|
+
|
|
29
|
+
Exercise the resource relationships the application relies on. If an update or removal affects one part of the workflow, read the provider state to check the intended change and confirm that unrelated state survives. Use a provider authorization check when the requirement concerns effective permissions.
|
|
30
|
+
|
|
31
|
+
For the AWS suites, select the integration account and region as described in [Test AWS workflows](#test-aws-workflows). Run `yarn exec vitest run --config vitest.integration.config.ts tests/aws/native/ --pool forks`. Use the path of a suite or service directory to limit the run.
|
|
32
|
+
|
|
33
|
+
Put the application declaration in a named fixture when its properties would obscure the workflow. Supply stable configuration there and let the case specify the change an application author makes.
|
|
34
|
+
|
|
35
|
+
Write the body in the order the application experiences the change. Establish the starting condition, call the public stack operation, then inspect the promised outcome. Separate these steps with blank lines. For an update that must preserve identity, retain the identity from the first apply and use it to read the changed resource. For an unsuccessful update, check what remains active and which operation the stack permits next.
|
|
36
|
+
|
|
23
37
|
## Check generated metadata
|
|
24
38
|
|
|
25
39
|
Run the AWS operation metadata tests in the ordinary test suite. They verify metadata from versioned documents converted from Smithy models after the declared source corrections are applied.
|
|
@@ -40,7 +54,7 @@ Run the catalog and resource input tests to check contracts generated from small
|
|
|
40
54
|
yarn exec vitest run tests/resourceCatalogs.test.ts tests/stripe/stripeClientGenerator.test.ts --pool forks
|
|
41
55
|
```
|
|
42
56
|
|
|
43
|
-
To check AWS Queue output metadata against the CloudFormation Registry document,
|
|
57
|
+
To check AWS Queue output metadata against the CloudFormation Registry document, prepare the local reference checkout described in the [native AWS generation guide](../../tools/awsServiceResources/README.md). This test reads the local reference and requires no provider credentials.
|
|
44
58
|
|
|
45
59
|
```sh
|
|
46
60
|
yarn exec vitest run --config vitest.integration.config.ts tests/resourceCatalogs.integration.test.ts --pool forks
|
|
@@ -66,20 +80,20 @@ Run integration files with vitest.integration.config.ts because vitest.config.ts
|
|
|
66
80
|
|
|
67
81
|
## Test AWS workflows
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
Give each native AWS case a name, a declaration that uses a unique name where AWS requires one, and the values AWS should report after creation. Use the saved identity to verify the resource in AWS. Teardown must remove both the AWS resource and its saved record. Use Vitest's `-t` option with the case name to select one resource.
|
|
70
84
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
The S3-to-SQS workflow in awsUploadEvents.integration.test.ts must establish event delivery through generated Cloud Control declarations. Create the bucket and queue and apply delivery permission before you enable bucket notifications, because S3 validates the destination. Use the installed AWS CLI with the selected profile to upload an object and receive its SQS notification.
|
|
85
|
+
For an in-place change, add the revised declaration and the expected provider values to the same case. Each phase reads the resource from saved state and verifies that its identity stayed the same. A rejection phase specifies the diagnostic and the provider values that must remain after the failed apply.
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Select the integration account with AWS_PROFILE and the region with AWS_REGION. The default region is us-east-1. Run the AWS workflow suite with the following command. To run all integration files for operating-system services and live providers, use `yarn test:integration`.
|
|
87
|
+
Set `NOMOSS_AWS_INTEGRATION_PROFILE` to your local AWS profile. Set `NOMOSS_AWS_INTEGRATION_REGION` to select a region; it defaults to `us-east-1`.
|
|
78
88
|
|
|
79
89
|
```sh
|
|
80
|
-
|
|
90
|
+
NOMOSS_AWS_INTEGRATION_PROFILE=your-integration-profile yarn exec vitest run --config vitest.integration.config.ts tests/aws/native/ --pool forks --reporter=verbose
|
|
81
91
|
```
|
|
82
92
|
|
|
93
|
+
Before you request credentials on a workstation already configured for integration tests, check `~/.codex/memories/nomoss-integration.md` for the selected AWS profile and Stripe secret reference.
|
|
94
|
+
|
|
95
|
+
To validate resources in AWS, supply live provider Layers and verify the resources through provider reads. Effect Vitest's it.live selects live test services, such as the clock. The Layers supplied to the test determine which provider it calls.
|
|
96
|
+
|
|
83
97
|
## Test Stripe workflows
|
|
84
98
|
|
|
85
99
|
The live Stripe suite exercises three billing applications to check resource updates and their application outputs. One has a single offer, and another exports three offers and a webhook. When a price amount changes, the suite follows the replacement price ID into the dependent portal configuration and exported application IDs.
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# Inspect an operation through its trace
|
|
2
2
|
|
|
3
|
+
## Instrument the application
|
|
4
|
+
|
|
5
|
+
Read the operation and its caller. Put a root span around the work the caller waits for, including cleanup. Use named `Effect.fn` operations and `Effect.withSpan` to measure the work inside it. For a child process, include the wait for its exit. For a stream, measure consumption. Use `NomossTracingLive` in the application runtime so those spans share a trace and reach the collector.
|
|
6
|
+
|
|
7
|
+
Use `Effect.annotateCurrentSpan` to record the operation context needed to interpret the timing. Use log events for decisions and failures that help explain a span. Take elapsed times and parent relationships from the recorded spans.
|
|
8
|
+
|
|
9
|
+
Run the real operation and open its trace in Jaeger. Verify that the trace contains the expected root and child spans, and that the root outcome agrees with what the caller received. Record the trace ID and the durations that answer the timing question.
|
|
10
|
+
|
|
3
11
|
## Reproduce an operation
|
|
4
12
|
|
|
5
|
-
Choose the
|
|
13
|
+
Choose the timing question and follow the [tracing contract](../application/tracing.md). For a performance fix, capture the baseline before changing the slow operation. Reproduce the same workload after the change and report the root duration, the affected span duration, and the trace IDs. Share the measured cause and new timings as they become available.
|
|
6
14
|
|
|
7
15
|
Jaeger's local OTLP HTTP receiver listens on port 4318. Open [Jaeger](http://127.0.0.1:16686) to inspect traces in the browser. If trace export fails, inspect the collector's service status and configured logs.
|
|
8
16
|
|
|
@@ -15,24 +23,10 @@ OTEL_BSP_SCHEDULE_DELAY=1000 \
|
|
|
15
23
|
yarn nomoss queue diff
|
|
16
24
|
```
|
|
17
25
|
|
|
18
|
-
The live integration creates and removes uniquely named AWS resources. Select the authorized account and region explicitly. Record the reproduction time, keep the process active until cleanup and exporter shutdown finish, and retain the test result separately from the tracker.
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
AWS_PROFILE=your-integration-profile AWS_REGION=us-east-1 \
|
|
22
|
-
OTEL_TRACES_EXPORTER=otlp \
|
|
23
|
-
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 \
|
|
24
|
-
OTEL_BSP_SCHEDULE_DELAY=1000 \
|
|
25
|
-
yarn test:integration:aws
|
|
26
|
-
```
|
|
27
|
-
|
|
28
26
|
## Inspect Jaeger
|
|
29
27
|
|
|
30
|
-
Search Jaeger for
|
|
31
|
-
|
|
32
|
-
Compare the root's elapsed time with the time the workflow spends in each apply pass, in reconciliation and destruction, and as it polls for notifications. Read AwsCloudControlRequestTracker.awaitResourceRequest events to determine the provider status, retry timestamps, and poll_delay_ms. Compare those waits with CloudControl operation spans and their HTTP children. Check AwsClient retry events before you conclude that transport or provider throttling caused a delay.
|
|
33
|
-
|
|
34
|
-
After deletion, the workflow's final reads intentionally receive ResourceNotFoundException from Cloud Control to establish that the resources are absent. The HTTP request span reports that provider failure. AwsCloudControlResourceLifecycle.readResource accepts the same response as proof that the object is absent. Inspect the enclosing resource read and root outcome to determine whether Jaeger's error flag indicates an expected absence check or a failed workflow.
|
|
28
|
+
Search Jaeger for the `nomoss` service and the reproduction interval. Open the completed trace and inspect the root operation, its children, and their durations.
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
For an apply trace, compare the root duration with the time spent in provider calls, retries, and confirmation. Check `AwsClient` retry events before attributing a delay to the transport or AWS. Compare action timestamps within a dependency batch to measure time spent waiting for earlier actions. After a change, repeat the same workflow and retain its cleanup.
|
|
37
31
|
|
|
38
32
|
Run lint on touched files, the configured Effect project compiler, and the existing behavior suites for the affected operation. Include validation results and trace evidence in the change review.
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The `release` workflow accumulates conventional commits on `main` into a release PR. Use a `fix:` subject for a patch release and `feat:` for a minor release. A `feat!:` subject or a `BREAKING CHANGE:` footer produces a major release.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The [AWS client packages](../../providers/aws/README.md) use the Nomoss release version. After a release PR merges, the workflow sets the workspace versions, checks the project, and packs every public workspace before publishing. Yarn resolves workspace dependencies to version ranges in the archives and schedules publication so each package's workspace dependencies publish first. The archives are in `$RUNNER_TEMP/nomoss-release` on the release runner.
|
|
6
|
+
|
|
7
|
+
Configure npm publishing for every package before enabling the release workflow. The workflow uses GitHub Actions OpenID Connect and npm provenance. Use the package list in [tools/awsClientPackages.ts](../../tools/awsClientPackages.ts) when setting up registry access for `Tradedal/nomoss` and `release.yml`.
|
package/examples/README.md
CHANGED
|
@@ -4,31 +4,8 @@ Each `application.ts` shows the stack's resources, provider, and state store. Ru
|
|
|
4
4
|
|
|
5
5
|
| Example | What it shows | How to try it |
|
|
6
6
|
| --- | --- | --- |
|
|
7
|
-
| [Queue](queue/application.ts) | Give a worker 31 seconds to process a message before SQS makes it available again. | `yarn nomoss queue diff` |
|
|
8
|
-
| [State machine](state-machine/application.ts) | Declare a workflow and its execution role. The
|
|
7
|
+
| [Queue](queue/application.ts) | Give a worker 31 seconds to process a message before SQS makes it available again. | `yarn nomoss queue diff` previews the declaration. Native deployment is unavailable. |
|
|
8
|
+
| [State machine](state-machine/application.ts) | Declare a workflow and its execution role. The workflow definition waits five seconds before returning a ready status. | Native deployment is unavailable. |
|
|
9
9
|
| [Stripe billing](stripe-billing/application.ts) | Offer monthly and annual prices for one membership and let subscribers switch plans in the billing portal. Nomoss creates the product and prices before it configures the portal with their Stripe IDs. | Set `STRIPE_API_KEY` to a Stripe sandbox key, then run `yarn nomoss stripe-billing diff`. |
|
|
10
|
-
| [HTTP echo](http-echo/application.ts) | Route `GET /health` and `POST /echo` through API Gateway to two Lambda functions. | Run `yarn nomoss http-echo diff` to build the checked-in handler and inspect the deployment. |
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Run HTTP echo
|
|
15
|
-
|
|
16
|
-
Run `yarn nomoss http-echo diff --detailed` to build the TypeScript handlers in [index.ts](http-echo/index.ts) and review the resources and code digest. The declaration selects the source through `Asset.fromBuild` and defines the runtime, handlers, and timeout. The build includes the handlers' Effect imports in the deployment package. Nomoss packages and deploys that code when you run `yarn nomoss http-echo create`. Supply ordinary provider credentials and region configuration for deployment. Each function calls `grantInvoke(route)` to let API Gateway invoke it for the route's method and path across the declared API's stages.
|
|
17
|
-
|
|
18
|
-
The stack calls `LambdaExecutionRole("ExecutionRole")` to create a role Lambda can assume and give it permission to write CloudWatch Logs. Both functions pass that role as `executionRole`. Nomoss waits for the role and its inline policy before creating either function, and removes both functions before deleting the role.
|
|
19
|
-
|
|
20
|
-
`yarn nomoss http-echo create` prints the API URL after deployment. To look it up later, run `yarn nomoss http-echo state read Api`. A GET to `/health` returns `{"status":"ready"}`. A POST to `/echo` returns its request body in the JSON `message` field. Edit the handler or the declared timeout and run `yarn nomoss http-echo update --detailed` to review and apply the change. Run `yarn nomoss http-echo delete` to remove the managed resources.
|
|
21
|
-
|
|
22
|
-
### Permit one EventBridge rule to invoke a function
|
|
23
|
-
|
|
24
|
-
Call `addPermission` on the function when your application supplies the service principal and source restriction. In this example, `partnerRuleArn` is the ARN of an EventBridge rule that targets `echoFunction`. Add the call to the same stack resource program as the function.
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
yield* echoFunction.addPermission("PartnerRule", {
|
|
28
|
-
action: "lambda:InvokeFunction",
|
|
29
|
-
principal: "events.amazonaws.com",
|
|
30
|
-
sourceArn: partnerRuleArn,
|
|
31
|
-
});
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
After deploying, inspect the statement with `aws lambda get-policy` and send a matching event through the rule. Remove the call and run the stack's `update` command to revoke the rule's permission while keeping the function's other statements.
|
|
11
|
+
For Stripe billing, replace `diff` with `create` to deploy the stack, `update` to apply later edits, or `delete` to remove its managed resources. Each example stores state under `.nomoss/state`.
|
package/examples/commands.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Layer } from "effect";
|
|
2
2
|
import { Command } from "effect/cli";
|
|
3
3
|
import { stackCommandRuntimeLayer, withStackCommands } from "nomoss/cli";
|
|
4
|
-
import { httpEchoStack } from "./http-echo/application.js";
|
|
5
4
|
import { queueStack } from "./queue/application.js";
|
|
6
|
-
import { stateMachineStack } from "./state-machine/application.js";
|
|
7
5
|
import { billingStack } from "./stripe-billing/application.js";
|
|
8
6
|
|
|
9
7
|
const queue = Command.make("queue").pipe(
|
|
@@ -17,17 +15,6 @@ const queue = Command.make("queue").pipe(
|
|
|
17
15
|
),
|
|
18
16
|
);
|
|
19
17
|
|
|
20
|
-
const stateMachine = Command.make("state-machine").pipe(
|
|
21
|
-
Command.withDescription("Manage an AWS Step Functions workflow"),
|
|
22
|
-
withStackCommands(stateMachineStack),
|
|
23
|
-
Command.provide(
|
|
24
|
-
stackCommandRuntimeLayer.pipe(
|
|
25
|
-
Layer.provideMerge(stateMachineStack.providers),
|
|
26
|
-
Layer.provide(stateMachineStack.state),
|
|
27
|
-
),
|
|
28
|
-
),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
18
|
const billing = Command.make("stripe-billing").pipe(
|
|
32
19
|
Command.withDescription("Manage Stripe membership billing"),
|
|
33
20
|
withStackCommands(billingStack),
|
|
@@ -39,28 +26,7 @@ const billing = Command.make("stripe-billing").pipe(
|
|
|
39
26
|
),
|
|
40
27
|
);
|
|
41
28
|
|
|
42
|
-
const httpEchoRuntime = stackCommandRuntimeLayer.pipe(
|
|
43
|
-
Layer.provideMerge(httpEchoStack.providers),
|
|
44
|
-
Layer.provide(httpEchoStack.state),
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The httpEcho command uses the same provider and state store for declaration
|
|
49
|
-
* and lifecycle execution. Each subcommand receives that runtime through
|
|
50
|
-
* Effect's command composition.
|
|
51
|
-
*
|
|
52
|
-
* @see ../../command-options-fund/refs/effect/packages/effect/src/cli/Command.ts (provide)
|
|
53
|
-
*/
|
|
54
|
-
const httpEcho = Command.make("http-echo").pipe(
|
|
55
|
-
Command.withDescription("Manage an HTTP API backed by two Lambda functions"),
|
|
56
|
-
withStackCommands({
|
|
57
|
-
...httpEchoStack,
|
|
58
|
-
renderCreateOutputs: ({ url }) => Console.log(`API URL: ${url}`),
|
|
59
|
-
}),
|
|
60
|
-
Command.provide(httpEchoRuntime),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
29
|
export const exampleCommands = Command.make("nomoss").pipe(
|
|
64
30
|
Command.withDescription("Manage the Nomoss example stacks"),
|
|
65
|
-
Command.withSubcommands([queue,
|
|
31
|
+
Command.withSubcommands([queue, billing]),
|
|
66
32
|
);
|
|
@@ -8,13 +8,17 @@ import {
|
|
|
8
8
|
} from "nomoss/providers/aws";
|
|
9
9
|
import { AWSQueue } from "nomoss/providers/aws/sqs/queue";
|
|
10
10
|
|
|
11
|
-
const awsRegion = Layer.succeed(
|
|
11
|
+
const awsRegion = Layer.succeed(
|
|
12
|
+
AwsRegion,
|
|
13
|
+
Option.some(AwsRegionName.make("us-east-1")),
|
|
14
|
+
);
|
|
15
|
+
|
|
12
16
|
const awsConfig = awsClientConfigLayer.pipe(Layer.provide(awsRegion));
|
|
13
17
|
|
|
14
18
|
export const queueStack = {
|
|
15
19
|
name: "native-queue",
|
|
16
20
|
providers: AwsProviderLive.pipe(
|
|
17
|
-
Layer.provide(
|
|
21
|
+
Layer.provide(Layer.provideMerge(awsConfig, FetchHttpClient.layer)),
|
|
18
22
|
),
|
|
19
23
|
state: localState(),
|
|
20
24
|
resources: Effect.gen(function* () {
|
|
@@ -29,3 +33,5 @@ export const queueStack = {
|
|
|
29
33
|
return () => ({ queueUrl: queue.QueueUrl });
|
|
30
34
|
}),
|
|
31
35
|
};
|
|
36
|
+
|
|
37
|
+
import { AwsRegionName } from "@tradedal/aws-client-core/model";
|
|
@@ -15,7 +15,9 @@ import { AWSStateMachine } from "nomoss/providers/aws/stepfunctions/statemachine
|
|
|
15
15
|
export const stateMachineStack = {
|
|
16
16
|
name: "state-machine",
|
|
17
17
|
providers: AwsProviderLive.pipe(
|
|
18
|
-
Layer.provide(
|
|
18
|
+
Layer.provide(
|
|
19
|
+
Layer.provideMerge(awsClientConfigLayer, FetchHttpClient.layer),
|
|
20
|
+
),
|
|
19
21
|
),
|
|
20
22
|
state: localState(),
|
|
21
23
|
resources: Effect.gen(function* () {
|