Skip to content

Commit

Permalink
fix examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbalfour committed Mar 22, 2024
1 parent 7081828 commit efaae64
Show file tree
Hide file tree
Showing 12 changed files with 336 additions and 254 deletions.
2 changes: 1 addition & 1 deletion packages/constructs/active-ruleset/tests/integ.stack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { App, Stack } from '@reapit-cdk/integration-tests'
import { ActiveRuleset } from '../dist'
import { ActiveRuleset } from '../'
import { CfnOutput } from 'aws-cdk-lib'

const app = new App()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const swaggerHtml = (urlPrefix: string) => `<!DOCTYPE html>

export class EdgeAPISwaggerEndpoint extends Construct implements IFrontendEndpoint {
bucket: Bucket
invalidationItems?: string[]
invalidationItems: string[]
pathPattern: string

constructor(scope: Construct, id: string, props: EdgeAPISwaggerEndpointProps) {
Expand Down
14 changes: 8 additions & 6 deletions packages/constructs/edge-api-swagger/usage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Stack, App } from 'aws-cdk-lib'
import { EdgeAPI, EdgeAPILambda } from '@reapit-cdk/edge-api'
import { EdgeAPI, EdgeAPILambda, LambdaEndpoint } from '@reapit-cdk/edge-api'
import { Code, Runtime } from 'aws-cdk-lib/aws-lambda'
import { EdgeAPISwaggerEndpoint } from '@reapit-cdk/edge-api-swagger'
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'
Expand All @@ -20,7 +20,7 @@ const api = new EdgeAPI(stack, 'api', {
},
})

const lambda = new EdgeAPILambda(stack, 'lambda', {
const lambdaFunction = new EdgeAPILambda(stack, 'lambda', {
code: Code.fromAsset(path.resolve('../lambda/dist')),
codePath: path.resolve('../lambda/src/index.ts'), // gets added to the docs
handler: 'index.handler',
Expand All @@ -30,10 +30,12 @@ const lambda = new EdgeAPILambda(stack, 'lambda', {
},
})

api.addEndpoint({
pathPattern: '/api/lambda',
lambda,
})
api.addEndpoint(
new LambdaEndpoint({
pathPattern: '/api/lambda',
lambdaFunction,
}),
)

api.addEndpoint(
new EdgeAPISwaggerEndpoint(stack, 'docs', {
Expand Down
2 changes: 1 addition & 1 deletion packages/constructs/edge-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class ProxyEndpoint extends BaseEndpoint {
export class RedirectionEndpoint extends BaseEndpoint {
destination: Destination
redirect: boolean
responseHeaderOverrides: ResponseHeadersPolicyProps | undefined
responseHeaderOverrides?: ResponseHeadersPolicyProps | undefined

constructor({ destination, pathPattern, redirect, responseHeaderOverrides }: RedirectionEndpointProps) {
super({
Expand Down
Loading

0 comments on commit efaae64

Please sign in to comment.