Skip to content

Commit

Permalink
fix: allow false when true is excepted (sst#4995)
Browse files Browse the repository at this point in the history
* fix: boolean typing

* sync

---------

Co-authored-by: Frank <[email protected]>
  • Loading branch information
lodmfjord and fwang authored Nov 3, 2024
1 parent 84ab82a commit 4dff613
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 157 deletions.
9 changes: 6 additions & 3 deletions platform/src/components/aws/apigateway-websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ export interface ApiGatewayWebSocketRouteArgs {
*/
auth?: Input<{
/**
* Enable IAM authorization for a given API route. When IAM auth is enabled, clients need to use Signature Version 4 to sign their requests with their AWS credentials.
* Enable IAM authorization for a given API route. When IAM auth is enabled, clients need
* to use Signature Version 4 to sign their requests with their AWS credentials.
* @default `false`
*/
iam?: Input<true>;
iam?: Input<boolean>;
}>;
/**
* [Transform](/docs/components#transform) how this component creates its underlying
Expand All @@ -174,7 +176,8 @@ export interface ApiGatewayWebSocketRouteArgs {
}

/**
* The `ApiGatewayWebSocket` component lets you add an [Amazon API Gateway WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html) to your app.
* The `ApiGatewayWebSocket` component lets you add an [Amazon API Gateway WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html)
* to your app.
*
* @example
*
Expand Down
2 changes: 1 addition & 1 deletion platform/src/components/aws/apigatewayv1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export interface ApiGatewayV1RouteArgs {
*
* When IAM auth is enabled, clients need to use Signature Version 4 to sign their requests with their AWS credentials.
*/
iam?: Input<true>;
iam?: Input<boolean>;
/**
* Enable custom Lambda authorization for a given API route. Pass in the authorizer ID.
* @example
Expand Down
2 changes: 1 addition & 1 deletion platform/src/components/aws/apigatewayv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ export interface ApiGatewayV2RouteArgs {
/**
* Enable IAM authorization for a given API route. When IAM auth is enabled, clients need to use Signature Version 4 to sign their requests with their AWS credentials.
*/
iam?: Input<true>;
iam?: Input<boolean>;
/**
* Enable JWT or JSON Web Token authorization for a given API route. When JWT auth is enabled, clients need to include a valid JWT in their requests.
*
Expand Down
32 changes: 17 additions & 15 deletions platform/src/components/aws/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ export interface BucketArgs {
* Bucket versioning enables you to store multiple versions of an object, protecting
* against accidental deletion or overwriting.
*
* @default Versioning disabled
* @default `false`
* @example
* ```js
* {
* versioning: true
* }
* ```
*/
versioning?: Input<true>;
versioning?: Input<boolean>;
/**
* [Transform](/docs/components#transform) how this component creates its underlying
* resources.
Expand Down Expand Up @@ -408,21 +408,23 @@ export class Bucket extends Component implements Link.Linkable {
}

function createVersioning() {
if (!args.versioning) return;
return output(args.versioning).apply((versioning) => {
if (!versioning) return;

return new s3.BucketVersioningV2(
...transform(
args.transform?.versioning,
`${name}Versioning`,
{
bucket: bucket.bucket,
versioningConfiguration: {
status: "Enabled",
return new s3.BucketVersioningV2(
...transform(
args.transform?.versioning,
`${name}Versioning`,
{
bucket: bucket.bucket,
versioningConfiguration: {
status: "Enabled",
},
},
},
{ parent },
),
);
{ parent },
),
);
});
}

function createPublicAccess() {
Expand Down
12 changes: 7 additions & 5 deletions platform/src/components/aws/cognito-user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export interface CognitoUserPoolArgs {
/**
* Enable software token MFA for the User Pool.
*
* @default Software token MFA is disabled.
* @default `false`
* @example
*
* ```ts
Expand All @@ -244,7 +244,7 @@ export interface CognitoUserPoolArgs {
* }
* ```
*/
softwareToken?: Input<true>;
softwareToken?: Input<boolean>;
/**
* Configure triggers for this User Pool
* @default No triggers
Expand Down Expand Up @@ -543,9 +543,11 @@ export class CognitoUserPool extends Component implements Link.Linkable {
),
smsAuthenticationMessage: args.smsAuthenticationMessage,
smsConfiguration: args.sms,
softwareTokenMfaConfiguration: args.softwareToken && {
enabled: true,
},
softwareTokenMfaConfiguration: output(args.softwareToken).apply(
(v) => ({
enabled: v ?? false,
}),
),
lambdaConfig:
triggers &&
triggers.apply((triggers) => {
Expand Down
2 changes: 1 addition & 1 deletion platform/src/components/aws/dynamo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export interface DynamoArgs {
* }
* ```
*/
deletionProtection?: Input<true>;
deletionProtection?: Input<boolean>;
/**
* [Transform](/docs/components#transform) how this component creates its underlying
* resources.
Expand Down
4 changes: 2 additions & 2 deletions platform/src/components/aws/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,15 +967,15 @@ export interface FunctionArgs {
/**
* Enable versioning for the function.
*
* @default Versioning disabled
* @default `false`
* @example
* ```js
* {
* versioning: true
* }
* ```
*/
versioning?: Input<true>;
versioning?: Input<boolean>;
/**
* A list of Lambda layer ARNs to add to the function.
*
Expand Down
2 changes: 1 addition & 1 deletion platform/src/components/aws/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export interface PostgresArgs {
* }
* ```
*/
proxy?: Input<true>;
proxy?: Input<boolean>;
/**
* @internal
*/
Expand Down
Loading

0 comments on commit 4dff613

Please sign in to comment.