File tree Expand file tree Collapse file tree 9 files changed +103
-0
lines changed
packages/rest-api-construct Expand file tree Collapse file tree 9 files changed +103
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Be very careful editing this file. It is crafted to work around [this issue](https://github.com/npm/npm/issues/4479)
2
+
3
+ # First ignore everything
4
+ ** /*
5
+
6
+ # Then add back in transpiled js and ts declaration files
7
+ ! lib /** /* .js
8
+ ! lib /** /* .d.ts
9
+
10
+ # Then ignore test js and ts declaration files
11
+ * .test.js
12
+ * .test.d.ts
13
+
14
+ # This leaves us with including only js and ts declaration files of functional code
Original file line number Diff line number Diff line change
1
+ # Description
2
+
3
+ Replace with a description of this package
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ../../api-extractor.base.json"
3
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @aws-amplify/rest-api-construct" ,
3
+ "version" : " 0.1.0" ,
4
+ "type" : " module" ,
5
+ "publishConfig" : {
6
+ "access" : " public"
7
+ },
8
+ "exports" : {
9
+ "." : {
10
+ "types" : " ./lib/index.d.ts" ,
11
+ "import" : " ./lib/index.js" ,
12
+ "require" : " ./lib/index.js"
13
+ }
14
+ },
15
+ "types" : " lib/index.d.ts" ,
16
+ "scripts" : {
17
+ "update:api" : " api-extractor run --local"
18
+ },
19
+ "license" : " Apache-2.0" ,
20
+ "peerDependencies" : {
21
+ "aws-cdk-lib" : " ^2.158.0" ,
22
+ "constructs" : " ^10.0.0"
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ import { describe , it } from 'node:test' ;
2
+ import { AmplifyConstruct } from './construct.js' ;
3
+ import { App , Stack } from 'aws-cdk-lib' ;
4
+ import { Template } from 'aws-cdk-lib/assertions' ;
5
+
6
+ void describe ( 'AmplifyConstruct' , ( ) => {
7
+ void it ( 'creates a queue if specified' , ( ) => {
8
+ const app = new App ( ) ;
9
+ const stack = new Stack ( app ) ;
10
+ new AmplifyConstruct ( stack , 'test' , {
11
+ includeQueue : true ,
12
+ } ) ;
13
+ const template = Template . fromStack ( stack ) ;
14
+ template . resourceCountIs ( 'AWS::SQS::Queue' , 1 ) ;
15
+ } ) ;
16
+
17
+ void it ( 'does nothing if queue is false' , ( ) => {
18
+ const app = new App ( ) ;
19
+ const stack = new Stack ( app ) ;
20
+ new AmplifyConstruct ( stack , 'test' , {
21
+ includeQueue : false ,
22
+ } ) ;
23
+ const template = Template . fromStack ( stack ) ;
24
+ template . resourceCountIs ( 'AWS::SQS::Queue' , 0 ) ;
25
+ } ) ;
26
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { Construct } from 'constructs' ;
2
+ import { aws_sqs as sqs } from 'aws-cdk-lib' ;
3
+
4
+ export type ConstructCognitoProps = {
5
+ includeQueue ?: boolean ;
6
+ } ;
7
+
8
+ /**
9
+ * Hello world construct implementation
10
+ */
11
+ export class AmplifyConstruct extends Construct {
12
+ /**
13
+ * Create a new AmplifyConstruct
14
+ */
15
+ constructor ( scope : Construct , id : string , props : ConstructCognitoProps = { } ) {
16
+ super ( scope , id ) ;
17
+
18
+ if ( props . includeQueue ) {
19
+ new sqs . Queue ( this , 'placeholder' ) ;
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ export * from './construct.js' ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ../../tsconfig.base.json" ,
3
+ "compilerOptions" : {
4
+ "rootDir" : " src" ,
5
+ "outDir" : " lib"
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "entryPoints" : [" src/index.ts" ]
3
+ }
You can’t perform that action at this time.
0 commit comments