@aws/nx-plugin-mcp 1.0.0-rc.15 → 1.0.0-rc.17
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/docs/guides/ts-rdb.mdx
CHANGED
|
@@ -37,23 +37,28 @@ The generator will create the following project structure in the `<directory>/<n
|
|
|
37
37
|
- models
|
|
38
38
|
- example.prisma Example model definition
|
|
39
39
|
- schema.prisma Main Prisma schema (references models)
|
|
40
|
-
- scripts
|
|
41
|
-
- pull-image.ts Pulls the database container image for local development
|
|
42
|
-
- start-container.ts Starts a local database container
|
|
43
|
-
- wait-for-db.ts Waits for the local database to be ready
|
|
44
40
|
- src
|
|
45
41
|
- index.ts Project entry point
|
|
46
|
-
- constants.ts Local development connection details and runtime config key
|
|
47
42
|
- prisma.ts Prisma runtime client wrapper
|
|
48
43
|
- utils.ts Runtime config and secret helpers
|
|
49
44
|
- create-db-user-handler.ts Lambda handler used to create the application database user during deployment
|
|
50
45
|
- migration-handler.ts Lambda handler used to run database migrations during deployment
|
|
51
46
|
- .gitignore Git ignore entries including generated Prisma client output
|
|
47
|
+
- config.json Local development connection details and runtime config key
|
|
52
48
|
- Dockerfile Container image definition for the migration handler
|
|
53
49
|
- project.json Project configuration and build targets
|
|
54
50
|
- prisma.config.ts Configuration for Prisma CLI
|
|
55
51
|
</FileTree>
|
|
56
52
|
|
|
53
|
+
Local development scripts are shared across all database projects and generated into `packages/common/scripts/`:
|
|
54
|
+
|
|
55
|
+
<FileTree>
|
|
56
|
+
- packages/common/scripts/src/rdb
|
|
57
|
+
- pull-image.ts Pulls the database container image
|
|
58
|
+
- start-container.ts Starts a local database container
|
|
59
|
+
- wait-for-db.ts Waits for the local database to be ready
|
|
60
|
+
</FileTree>
|
|
61
|
+
|
|
57
62
|
### Infrastructure
|
|
58
63
|
|
|
59
64
|
<Snippet name="shared-constructs" />
|
|
@@ -156,7 +161,6 @@ Use the `prisma` target to run Prisma CLI commands from the workspace root:
|
|
|
156
161
|
|
|
157
162
|
The runtime wrapper in `src/prisma.ts` exports:
|
|
158
163
|
|
|
159
|
-
- `DB_PACKAGE_NAME` - the key used under the `database` runtime config namespace in AWS AppConfig
|
|
160
164
|
- `getPrisma()` - loads database connection settings from AWS AppConfig and creates a Prisma client using IAM authentication
|
|
161
165
|
|
|
162
166
|
The client automatically:
|
|
@@ -540,7 +544,7 @@ Pin a specific Aurora engine version.
|
|
|
540
544
|
|
|
541
545
|
By default, the generated local database container image matches the default Aurora engine version. If you change the Aurora engine version, it's recommended to also use a matching local container image version for maximum compatibility. See the AWS release notes for [Aurora PostgreSQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/aurorapostgresql-release-calendar.html) and [Aurora MySQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraMySQLReleaseNotes/AuroraMySQL.Updates.30Updates.html) to identify the corresponding community database version.
|
|
542
546
|
|
|
543
|
-
The local database image is configured in the
|
|
547
|
+
The local database image is configured in the `serveLocal.image` field of the generated `config.json` file in your database project root. Update that value when you change engine versions.
|
|
544
548
|
|
|
545
549
|
<OptionFilter when={{ engine: 'postgres' }}>
|
|
546
550
|
<Infrastructure>
|
|
@@ -172,6 +172,37 @@ module "my_api" {
|
|
|
172
172
|
</Fragment>
|
|
173
173
|
</Infrastructure>
|
|
174
174
|
|
|
175
|
+
#### Customising Options Per-Operation
|
|
176
|
+
|
|
177
|
+
<Infrastructure>
|
|
178
|
+
<Fragment slot="cdk">
|
|
179
|
+
To customise the options used to create the default integration for _specific_ operations (without affecting the others), you can use the `withOperationOptions` method. For example, if you would like to increase the Lambda function timeout for just one operation:
|
|
180
|
+
|
|
181
|
+
```ts {4-6}
|
|
182
|
+
const api = new MyApi(this, 'MyApi', {
|
|
183
|
+
integrations: MyApi.defaultIntegrations(this)
|
|
184
|
+
.withOperationOptions({
|
|
185
|
+
sayHello: {
|
|
186
|
+
timeout: Duration.seconds(60),
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
.build(),
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// The selected operations remain default integrations, so they're still typed accordingly:
|
|
193
|
+
api.integrations.sayHello.handler.addToRolePolicy(new PolicyStatement({ ... }));
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The options you specify are merged with the default integration options (and any options set via `withDefaultOptions`). Note that you cannot specify options for operations which you have replaced via `withOverrides`, since these no longer use the default integration.
|
|
197
|
+
|
|
198
|
+
You will encounter a type error if the same operation is targeted by both `withOperationOptions` and `withOverrides`, regardless of the order in which you call them.
|
|
199
|
+
|
|
200
|
+
</Fragment>
|
|
201
|
+
<Fragment slot="terraform">
|
|
202
|
+
To customise options for specific operations with Terraform, you need to edit the generated Terraform module to configure individual Lambda functions per operation (see the [Explicit Integrations](#explicit-integrations) section below).
|
|
203
|
+
</Fragment>
|
|
204
|
+
</Infrastructure>
|
|
205
|
+
|
|
175
206
|
#### Overriding Integrations
|
|
176
207
|
|
|
177
208
|
<Infrastructure>
|