@aws/nx-plugin 1.0.4 → 1.0.6
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/LICENSE-THIRD-PARTY +70 -92
- package/migrations.json +6 -1
- package/package.json +6 -6
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/migrations/v1.0.5/0001-api-custom-domain-runtime-config/metadata.json +3 -0
- package/src/migrations/v1.0.5/0001-api-custom-domain-runtime-config/migration.d.ts +6 -0
- package/src/migrations/v1.0.5/0001-api-custom-domain-runtime-config/migration.js +362 -0
- package/src/migrations/v1.0.5/0001-api-custom-domain-runtime-config/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +6 -6
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +8 -8
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +54 -6
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +390 -18
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +260 -12
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +444 -24
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +21 -21
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +34 -4
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +20 -2
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +63 -1
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +63 -1
- package/src/utils/docker.d.ts +1 -1
- package/src/utils/versions.d.ts +56 -56
- package/src/utils/versions.js +55 -55
- package/src/utils/versions.js.map +1 -1
|
@@ -245,10 +245,12 @@ import {
|
|
|
245
245
|
} from './utils.js';
|
|
246
246
|
import { CfnOutput, Stack } from 'aws-cdk-lib';
|
|
247
247
|
import {
|
|
248
|
+
DomainMappingOptions,
|
|
248
249
|
HttpApi as _HttpApi,
|
|
249
250
|
HttpApiProps as _HttpApiProps,
|
|
250
251
|
HttpMethod,
|
|
251
252
|
HttpStage,
|
|
253
|
+
IDomainName,
|
|
252
254
|
LogGroupLogDestination,
|
|
253
255
|
ThrottleSettings,
|
|
254
256
|
} from 'aws-cdk-lib/aws-apigatewayv2';
|
|
@@ -266,7 +268,7 @@ import { suppressRules } from '../checkov.js';
|
|
|
266
268
|
export interface HttpApiProps<
|
|
267
269
|
TIntegrations extends ApiIntegrations<TOperation, HttpApiIntegration>,
|
|
268
270
|
TOperation extends string,
|
|
269
|
-
> extends _HttpApiProps {
|
|
271
|
+
> extends Omit<_HttpApiProps, 'defaultDomainMapping'> {
|
|
270
272
|
/**
|
|
271
273
|
* Unique name for the API, used in runtime configuration
|
|
272
274
|
*/
|
|
@@ -285,6 +287,12 @@ export interface HttpApiProps<
|
|
|
285
287
|
* @default { rateLimit: 10000, burstLimit: 5000 }
|
|
286
288
|
*/
|
|
287
289
|
readonly throttle?: ThrottleSettings;
|
|
290
|
+
/**
|
|
291
|
+
* Custom domain mapped to the API's default stage
|
|
292
|
+
*/
|
|
293
|
+
readonly defaultDomainMapping?: DomainMappingOptions & {
|
|
294
|
+
readonly domainName: IDomainName;
|
|
295
|
+
};
|
|
288
296
|
}
|
|
289
297
|
|
|
290
298
|
/**
|
|
@@ -308,6 +316,9 @@ export class HttpApi<
|
|
|
308
316
|
/** Default auto-deployed stage */
|
|
309
317
|
public readonly defaultStage: HttpStage;
|
|
310
318
|
|
|
319
|
+
/** The URL clients call: the custom domain's if one is mapped, otherwise the stage's */
|
|
320
|
+
private readonly apiUrl: string;
|
|
321
|
+
|
|
311
322
|
/** Map of operation names to their API Gateway integrations */
|
|
312
323
|
public readonly integrations: TIntegrations;
|
|
313
324
|
|
|
@@ -319,6 +330,7 @@ export class HttpApi<
|
|
|
319
330
|
operations,
|
|
320
331
|
integrations,
|
|
321
332
|
throttle = { rateLimit: 10000, burstLimit: 5000 },
|
|
333
|
+
defaultDomainMapping,
|
|
322
334
|
...props
|
|
323
335
|
}: HttpApiProps<TIntegrations, TOperation>,
|
|
324
336
|
) {
|
|
@@ -351,12 +363,16 @@ export class HttpApi<
|
|
|
351
363
|
|
|
352
364
|
this.defaultStage = new HttpStage(this, 'DefaultStage', {
|
|
353
365
|
httpApi: this.api,
|
|
366
|
+
domainMapping: defaultDomainMapping,
|
|
354
367
|
autoDeploy: true,
|
|
355
368
|
throttle,
|
|
356
369
|
accessLogSettings: {
|
|
357
370
|
destination: new LogGroupLogDestination(accessLogGroup),
|
|
358
371
|
},
|
|
359
372
|
});
|
|
373
|
+
this.apiUrl = defaultDomainMapping
|
|
374
|
+
? this.defaultStage.domainUrl
|
|
375
|
+
: this.defaultStage.url!;
|
|
360
376
|
|
|
361
377
|
// Resolve the integration for a given operation.
|
|
362
378
|
// If the operation has a dedicated integration, use it; otherwise fall back to $router.
|
|
@@ -389,22 +405,36 @@ export class HttpApi<
|
|
|
389
405
|
);
|
|
390
406
|
|
|
391
407
|
new CfnOutput(this, \`\${apiName}Url\`, {
|
|
392
|
-
value: this.
|
|
408
|
+
value: this.apiUrl,
|
|
393
409
|
});
|
|
394
410
|
|
|
395
411
|
// Register the API URL in runtime configuration for client discovery
|
|
396
412
|
const rc = RuntimeConfig.ensure(this);
|
|
397
413
|
rc.set('connection', 'apis', {
|
|
398
414
|
...rc.get('connection').apis,
|
|
399
|
-
[apiName]: this.
|
|
415
|
+
[apiName]: this.apiUrl,
|
|
400
416
|
});
|
|
417
|
+
|
|
418
|
+
// Target for the custom domain's DNS record
|
|
419
|
+
if (defaultDomainMapping) {
|
|
420
|
+
new CfnOutput(this, \`\${apiName}DomainNameAlias\`, {
|
|
421
|
+
value: defaultDomainMapping.domainName.regionalDomainName,
|
|
422
|
+
description:
|
|
423
|
+
'Regional domain name to point a CNAME record at for the custom domain, with any DNS provider',
|
|
424
|
+
});
|
|
425
|
+
new CfnOutput(this, \`\${apiName}DomainNameAliasHostedZoneId\`, {
|
|
426
|
+
value: defaultDomainMapping.domainName.regionalHostedZoneId,
|
|
427
|
+
description:
|
|
428
|
+
'Hosted zone ID of the regional domain name, needed only for a Route 53 alias record',
|
|
429
|
+
});
|
|
430
|
+
}
|
|
401
431
|
}
|
|
402
432
|
|
|
403
433
|
/**
|
|
404
434
|
* Return the API url
|
|
405
435
|
*/
|
|
406
436
|
public get url() {
|
|
407
|
-
return this.
|
|
437
|
+
return this.apiUrl;
|
|
408
438
|
}
|
|
409
439
|
}
|
|
410
440
|
"
|
|
@@ -1085,7 +1115,7 @@ import {
|
|
|
1085
1115
|
Stage,
|
|
1086
1116
|
ThrottleSettings,
|
|
1087
1117
|
} from 'aws-cdk-lib/aws-apigateway';
|
|
1088
|
-
import { IAspect, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
1118
|
+
import { CfnOutput, IAspect, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
1089
1119
|
import {
|
|
1090
1120
|
CfnLoggingConfiguration,
|
|
1091
1121
|
CfnWebACL,
|
|
@@ -1174,6 +1204,7 @@ export class RestApi<
|
|
|
1174
1204
|
integrations,
|
|
1175
1205
|
enableWaf = true,
|
|
1176
1206
|
throttle = { rateLimit: 10000, burstLimit: 5000 },
|
|
1207
|
+
domainName,
|
|
1177
1208
|
...props
|
|
1178
1209
|
}: RestApiProps<TIntegrations, TOperation>,
|
|
1179
1210
|
) {
|
|
@@ -1199,6 +1230,7 @@ export class RestApi<
|
|
|
1199
1230
|
// Create the API Gateway REST API
|
|
1200
1231
|
this.api = new _RestApi(this, 'Api', {
|
|
1201
1232
|
...props,
|
|
1233
|
+
domainName,
|
|
1202
1234
|
deployOptions: {
|
|
1203
1235
|
accessLogDestination: new LogGroupLogDestination(accessLogs),
|
|
1204
1236
|
accessLogFormat: AccessLogFormat.jsonWithStandardFields(),
|
|
@@ -1340,8 +1372,24 @@ export class RestApi<
|
|
|
1340
1372
|
const rc = RuntimeConfig.ensure(this);
|
|
1341
1373
|
rc.set('connection', 'apis', {
|
|
1342
1374
|
...rc.get('connection').apis,
|
|
1343
|
-
[apiName]:
|
|
1375
|
+
[apiName]: domainName
|
|
1376
|
+
? \`https://\${domainName.domainName}/\${domainName.basePath ? \`\${domainName.basePath}/\` : ''}\`
|
|
1377
|
+
: this.api.url!,
|
|
1344
1378
|
});
|
|
1379
|
+
|
|
1380
|
+
// Target for the custom domain's DNS record
|
|
1381
|
+
if (domainName) {
|
|
1382
|
+
new CfnOutput(this, \`\${apiName}DomainNameAlias\`, {
|
|
1383
|
+
value: this.api.domainName!.domainNameAliasDomainName,
|
|
1384
|
+
description:
|
|
1385
|
+
'Domain name of the API Gateway endpoint (regional or edge) to point a CNAME record at for the custom domain, with any DNS provider',
|
|
1386
|
+
});
|
|
1387
|
+
new CfnOutput(this, \`\${apiName}DomainNameAliasHostedZoneId\`, {
|
|
1388
|
+
value: this.api.domainName!.domainNameAliasHostedZoneId,
|
|
1389
|
+
description:
|
|
1390
|
+
'Hosted zone ID of that domain name, needed only for a Route 53 alias record',
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1345
1393
|
}
|
|
1346
1394
|
|
|
1347
1395
|
/**
|