Skip to content

Commit

Permalink
Move api gateway and api gateway to events folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Sep 23, 2019
1 parent 452eb36 commit df22f45
Show file tree
Hide file tree
Showing 45 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion __tests__/old-unit/LambdaProxyIntegrationEventTest.js
@@ -1,5 +1,5 @@
import RequestBuilder from './support/RequestBuilder.js'
import LambdaProxyIntegrationEvent from '../../src/api-gateway/lambda-events/LambdaProxyIntegrationEvent.js'
import LambdaProxyIntegrationEvent from '../../src/events/api-gateway/lambda-events/LambdaProxyIntegrationEvent.js'

const { isArray } = Array
const { keys } = Object
Expand Down
2 changes: 1 addition & 1 deletion __tests__/old-unit/authCanExecuteResourceTest.js
@@ -1,4 +1,4 @@
import authCanExecuteResource from '../../src/api-gateway/authCanExecuteResource.js'
import authCanExecuteResource from '../../src/events/api-gateway/authCanExecuteResource.js'

describe('authCanExecuteResource', () => {
describe('when the policy has one Statement in an array', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/old-unit/authFunctionNameExtractorTest.js
@@ -1,4 +1,4 @@
import authFunctionNameExtractor from '../../src/api-gateway/authFunctionNameExtractor.js'
import authFunctionNameExtractor from '../../src/events/api-gateway/authFunctionNameExtractor.js'

describe('authFunctionNameExtractor', () => {
const dummyLogging = (arrayStore) => (message) => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/old-unit/authMatchPolicyResourceTest.js
@@ -1,4 +1,4 @@
import authMatchPolicyResource from '../../src/api-gateway/authMatchPolicyResource.js'
import authMatchPolicyResource from '../../src/events/api-gateway/authMatchPolicyResource.js'

describe('authMatchPolicyResource', () => {
describe('when resource has no wildcards', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/old-unit/velocityContextTest.js
@@ -1,4 +1,4 @@
import VelocityContext from '../../src/api-gateway/lambda-events/VelocityContext.js'
import VelocityContext from '../../src/events/api-gateway/lambda-events/VelocityContext.js'

describe('#urlDecode', () => {
test('should decode url query parameters', () => {
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Expand Up @@ -63,7 +63,7 @@ export default [
rollupPluginCopy({
targets: [
{
src: 'src/api-gateway/templates/*.vm',
src: 'src/events/api-gateway/templates/*.vm',
dest: 'dist/templates',
},
{ src: 'src/lambda/handler-runner/*.{py,rb}', dest: 'dist' },
Expand Down
6 changes: 4 additions & 2 deletions src/ServerlessOffline.js
Expand Up @@ -125,7 +125,9 @@ export default class ServerlessOffline {
}

async _createApiGateway() {
const { default: ApiGateway } = await import('./api-gateway/index.js')
const { default: ApiGateway } = await import(
'./events/api-gateway/index.js'
)

this._apiGateway = new ApiGateway(
this._service,
Expand All @@ -142,7 +144,7 @@ export default class ServerlessOffline {

async _createApiGatewayWebSocket() {
const { default: ApiGatewayWebSocket } = await import(
'./api-gateway-websocket/index.js'
'./events/api-gateway-websocket/index.js'
)

this._apiGatewayWebSocket = new ApiGatewayWebSocket(
Expand Down
@@ -1,6 +1,6 @@
import { Server } from '@hapi/hapi'
import { catchAllRoute, connectionsRoutes } from './http-routes/index.js'
import serverlessLog from '../serverlessLog.js'
import serverlessLog from '../../serverlessLog.js'

export default class HttpServer {
constructor(options, webSocketClients) {
Expand Down
Expand Up @@ -4,13 +4,13 @@ import {
WebSocketDisconnectEvent,
WebSocketEvent,
} from './lambda-events/index.js'
import debugLog from '../debugLog.js'
import serverlessLog from '../serverlessLog.js'
import debugLog from '../../debugLog.js'
import serverlessLog from '../../serverlessLog.js'
import {
DEFAULT_WEBSOCKETS_API_ROUTE_SELECTION_EXPRESSION,
DEFAULT_WEBSOCKETS_ROUTE,
} from '../config/index.js'
import { createUniqueId, jsonPath } from '../utils/index.js'
} from '../../config/index.js'
import { createUniqueId, jsonPath } from '../../utils/index.js'

const { parse, stringify } = JSON

Expand Down
@@ -1,7 +1,7 @@
import { Server } from 'ws'
import debugLog from '../debugLog.js'
import serverlessLog from '../serverlessLog.js'
import { createUniqueId } from '../utils/index.js'
import debugLog from '../../debugLog.js'
import serverlessLog from '../../serverlessLog.js'
import { createUniqueId } from '../../utils/index.js'

export default class WebSocketServer {
constructor(options, webSocketClients, sharedServer) {
Expand Down
@@ -1,4 +1,4 @@
import debugLog from '../../../debugLog.js'
import debugLog from '../../../../debugLog.js'

export default function catchAllRoute() {
return {
Expand Down
@@ -1,5 +1,5 @@
import ConnectionsController from './ConnectionsController.js'
import debugLog from '../../../debugLog.js'
import debugLog from '../../../../debugLog.js'

export default function connectionsRoutes(webSocketClients) {
const connectionsController = new ConnectionsController(webSocketClients)
Expand Down
File renamed without changes.
Expand Up @@ -4,7 +4,7 @@ import {
parseMultiValueHeaders,
parseMultiValueQueryStringParameters,
parseQueryStringParameters,
} from '../../utils/index.js'
} from '../../../utils/index.js'

export default class WebSocketConnectEvent {
constructor(connectionId, request, options) {
Expand Down
@@ -1,5 +1,5 @@
import WebSocketRequestContext from './WebSocketRequestContext.js'
import { parseHeaders, parseMultiValueHeaders } from '../../utils/index.js'
import { parseHeaders, parseMultiValueHeaders } from '../../../utils/index.js'

export default class WebSocketDisconnectEvent {
constructor(connectionId) {
Expand Down
@@ -1,4 +1,4 @@
import { createUniqueId, formatToClfTime } from '../../utils/index.js'
import { createUniqueId, formatToClfTime } from '../../../utils/index.js'

const { now } = Date

Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'fs'
import { resolve } from 'path'
import debugLog from '../debugLog.js'
import OfflineEndpoint from './OfflineEndpoint.js'
import debugLog from '../../debugLog.js'

function readFile(filePath) {
return readFileSync(filePath, 'utf8')
Expand Down
Expand Up @@ -17,14 +17,14 @@ import {
VelocityContext,
} from './lambda-events/index.js'
import parseResources from './parseResources.js'
import debugLog from '../debugLog.js'
import serverlessLog, { logRoute } from '../serverlessLog.js'
import debugLog from '../../debugLog.js'
import serverlessLog, { logRoute } from '../../serverlessLog.js'
import {
createUniqueId,
detectEncoding,
jsonPath,
splitHandlerPathAndName,
} from '../utils/index.js'
} from '../../utils/index.js'

const { parse, stringify } = JSON

Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
import serverlessLog from '../serverlessLog.js'
import serverlessLog from '../../serverlessLog.js'

// FIXME "slessLog" param is only remaining for tests, should be removed
export default function extract(endpoint, slessLog) {
Expand Down
File renamed without changes.
@@ -1,18 +1,18 @@
import { join } from 'path'
import Boom from '@hapi/boom'
import authCanExecuteResource from './authCanExecuteResource.js'
import debugLog from '../debugLog.js'
import HandlerRunner from '../lambda/handler-runner/index.js'
import LambdaContext from '../lambda/LambdaContext.js'
import serverlessLog from '../serverlessLog.js'
import debugLog from '../../debugLog.js'
import HandlerRunner from '../../lambda/handler-runner/index.js'
import LambdaContext from '../../lambda/LambdaContext.js'
import serverlessLog from '../../serverlessLog.js'
import {
nullIfEmpty,
parseHeaders,
parseMultiValueHeaders,
parseMultiValueQueryStringParameters,
parseQueryStringParameters,
splitHandlerPathAndName,
} from '../utils/index.js'
} from '../../utils/index.js'

export default function createAuthScheme(
authFun,
Expand Down
File renamed without changes.
@@ -1,5 +1,5 @@
import serverlessLog from '../../../serverlessLog.js'
import { createUniqueId } from '../../../utils/index.js'
import serverlessLog from '../../../../serverlessLog.js'
import { createUniqueId } from '../../../../utils/index.js'

export default class InvokeController {
constructor(lambda) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -8,7 +8,7 @@ import {
parseMultiValueHeaders,
parseQueryStringParameters,
parseMultiValueQueryStringParameters,
} from '../../utils/index.js'
} from '../../../utils/index.js'

const { parse } = JSON

Expand Down
Expand Up @@ -6,7 +6,7 @@ import {
isPlainObject,
jsonPath,
parseHeaders,
} from '../../utils/index.js'
} from '../../../utils/index.js'

const { parse, stringify } = JSON
const { entries, fromEntries } = Object
Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
import { Compile, parse } from 'velocityjs'
import runInPollutedScope from '../javaHelpers.js'
import debugLog from '../../debugLog.js'
import { isPlainObject } from '../../utils/index.js'
import debugLog from '../../../debugLog.js'
import { isPlainObject } from '../../../utils/index.js'

const { entries } = Object

Expand Down
File renamed without changes.

0 comments on commit df22f45

Please sign in to comment.