@@ -59,11 +59,11 @@ interface ConstructorBuildProps {
5959 readonly optionalConstructorProps ?: boolean ;
6060
6161 /**
62- * Visbility for the constructor.
62+ * Visibility for the constructor.
6363 *
64- * @default MemberVisbility .Public
64+ * @default MemberVisibility .Public
6565 */
66- readonly constructorVisbility ?: MemberVisibility ;
66+ readonly constructorVisibility ?: MemberVisibility ;
6767
6868 /**
6969 * These statements are added to the constructor body in the order they appear in this property.
@@ -98,6 +98,13 @@ export interface HandlerFrameworkClassProps {
9898 * @default - the latest Lambda runtime available in the region.
9999 */
100100 readonly runtime ?: Runtime ;
101+
102+ /**
103+ * Visibility for the constructor.
104+ *
105+ * @default MemberVisibility.Public
106+ */
107+ readonly constructorVisibility ?: MemberVisibility ;
101108}
102109
103110interface BuildRuntimePropertyOptions {
@@ -134,13 +141,13 @@ export abstract class HandlerFrameworkClass extends ClassType {
134141 [ 'runtime' , this . buildRuntimeProperty ( scope , { runtime : props . runtime } ) ] ,
135142 ] ) ;
136143 const metadataStatements : Statement [ ] = [
137- expr . directCode ( `this.node.addMetadata('${ CUSTOM_RESOURCE_RUNTIME_FAMILY } ', this.runtime.family)` ) ,
144+ stmt . directCode ( `this.node.addMetadata('${ CUSTOM_RESOURCE_RUNTIME_FAMILY } ', this.runtime.family)` ) ,
138145 ] ;
139146 this . buildConstructor ( {
140147 constructorPropsType : LAMBDA_MODULE . FunctionOptions ,
141148 superProps,
142149 optionalConstructorProps : true ,
143- constructorVisbility : MemberVisibility . Public ,
150+ constructorVisibility : MemberVisibility . Public ,
144151 statements : metadataStatements ,
145152 } ) ;
146153 }
@@ -226,16 +233,16 @@ export abstract class HandlerFrameworkClass extends ClassType {
226233 [ 'runtime' , this . buildRuntimeProperty ( scope , { runtime : props . runtime , isEvalNodejsProvider } ) ] ,
227234 ] ) ;
228235 const metadataStatements : Statement [ ] = [
229- expr . directCode ( `this.addMetadata('${ CUSTOM_RESOURCE_SINGLETON } ', true)` ) ,
230- expr . directCode ( `this.addMetadata('${ CUSTOM_RESOURCE_RUNTIME_FAMILY } ', this.runtime.family)` ) ,
231- expr . directCode ( `if (props?.logGroup) { this.logGroup.node.addMetadata('${ CUSTOM_RESOURCE_SINGLETON_LOG_GROUP } ', true) }` ) ,
236+ stmt . directCode ( `this.addMetadata('${ CUSTOM_RESOURCE_SINGLETON } ', true)` ) ,
237+ stmt . directCode ( `this.addMetadata('${ CUSTOM_RESOURCE_RUNTIME_FAMILY } ', this.runtime.family)` ) ,
238+ stmt . directCode ( `if (props?.logGroup) { this.logGroup.node.addMetadata('${ CUSTOM_RESOURCE_SINGLETON_LOG_GROUP } ', true) }` ) ,
232239 // We need to access the private `_logRetention` custom resource, the only public property - `logGroup` - provides an ARN reference to the resource, instead of the resource itself.
233- expr . directCode ( `if (props?.logRetention) { ((this as any).lambdaFunction as lambda.Function)._logRetention?.node.addMetadata('${ CUSTOM_RESOURCE_SINGLETON_LOG_RETENTION } ', true) }` ) ,
240+ stmt . directCode ( `if (props?.logRetention) { ((this as any).lambdaFunction as lambda.Function)._logRetention?.node.addMetadata('${ CUSTOM_RESOURCE_SINGLETON_LOG_RETENTION } ', true) }` ) ,
234241 ] ;
235242 this . buildConstructor ( {
236243 constructorPropsType : _interface . type ,
237244 superProps,
238- constructorVisbility : MemberVisibility . Public ,
245+ constructorVisibility : MemberVisibility . Public ,
239246 statements : metadataStatements ,
240247 } ) ;
241248 }
@@ -337,11 +344,11 @@ export abstract class HandlerFrameworkClass extends ClassType {
337344 isCustomResourceProvider : true ,
338345 } ) ] ,
339346 ] ) ;
340- const metadataStatements : Statement [ ] = [ expr . directCode ( `this.node.addMetadata('${ CUSTOM_RESOURCE_PROVIDER } ', true)` ) ] ;
347+ const metadataStatements : Statement [ ] = [ stmt . directCode ( `this.node.addMetadata('${ CUSTOM_RESOURCE_PROVIDER } ', true)` ) ] ;
341348 this . buildConstructor ( {
342349 constructorPropsType : CORE_MODULE . CustomResourceProviderOptions ,
343350 superProps,
344- constructorVisbility : MemberVisibility . Private ,
351+ constructorVisibility : props . constructorVisibility ?? MemberVisibility . Private ,
345352 optionalConstructorProps : true ,
346353 statements : metadataStatements ,
347354 } ) ;
@@ -370,7 +377,7 @@ export abstract class HandlerFrameworkClass extends ClassType {
370377
371378 private buildConstructor ( props : ConstructorBuildProps ) {
372379 const init = this . addInitializer ( {
373- visibility : props . constructorVisbility ,
380+ visibility : props . constructorVisibility ,
374381 } ) ;
375382 const scope = init . addParameter ( {
376383 name : 'scope' ,
0 commit comments