UNPKG

@x82-softworks/aws-api

Version:

An OpenAPI compatible api system intended for use with AWS Lambda and API Gateway

1 lines 41.1 kB
{"version":3,"file":"commonjs.min.cjs","mappings":"mBACA,IC4CYA,ED5CRC,EAAsB,CEA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,yYJwCvD,SAAYtB,GACV,YACA,cACA,YACA,kBACA,gBACA,oBANF,CAAYA,IAAAA,EAAM,KK7CX,MAAMuB,EAAS,SACTC,EAAU,UACVC,EAAU,UACVC,EAAQ,QACRC,EAAQ,QACRC,EAAS,SACTC,EAAQ,QACRC,EAAS,SACTC,EAAS,SACTC,EAAO,OACPC,EAAS,SACTC,EAAO,OACPC,EAAW,WACXC,EAAQ,QACRC,EAAS,SACTC,EAAW,WACXC,EAAS,SACTC,EAAQ,QCjBfC,EAAa,aAEZ,MAAMC,EAGXC,YAAYC,GACV,MAAMC,EAAsB,GAC5B,IAAIpC,EAEJ,KAAQA,EAAMgC,EAAWK,KAAKF,IAC5BnC,EAAMA,EAAI,GAAGsC,MAAM,GAAI,GACvBF,EAAKG,KAAKvC,GAGZwC,KAAKJ,KAAOA,EACZD,EAAUA,EAAQM,QAAQ,aAA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K,EAAIC,MAE9BD,EAAIC,KAAO,CACToF,MAAiC,QAA3B,EAACrF,EAAIC,YAAsB,eAAEoF,OAAQvF,EAC3CwF,QAAStF,EAAIC,KAAKqF,QAClB3D,WAAY+G,EAAKjD,0BACb,KAC2B,QAA1B,EAAAzF,EAAIC,YAAsB,eAAE0B,YAGhC3B,EAAIc,aACPd,EAAIc,WAAad,EAAIC,KAAKa,YAAc,MAGpB,iBAAbd,EAAIC,MAAsBD,EAAIsC,QAAQsB,MAE/C5D,EAAIsC,QAAQsB,IA1fP,oBA6fA7D,EAAYC,MA7DA,YAAnB6B,EAAIsH,WAECnJ,EAEFa,EAAeb,OA+D5B,YA4Ba2K,GAAS,SACpBC,EACAC,GAEA,OAAO,IAAI7G,GAAI4G,EAAMC,IAQVC,GAAuBvK,IAA2B,CAC7D8B,UAAU,EACVG,QAAS,CACP,mBAAoB,CAClBjC,OAAQA,MAWDwK,GAAuBxK,IAA2B,CAC7D,mBAAoB,CAClBA,OAAQA,K","sources":["webpack://@x82-softworks/aws-api/webpack/bootstrap","webpack://@x82-softworks/aws-api/./src/types.ts","webpack://@x82-softworks/aws-api/webpack/runtime/compat get default export","webpack://@x82-softworks/aws-api/webpack/runtime/define property getters","webpack://@x82-softworks/aws-api/webpack/runtime/hasOwnProperty shorthand","webpack://@x82-softworks/aws-api/webpack/runtime/make namespace object","webpack://@x82-softworks/aws-api/./src/constants.ts","webpack://@x82-softworks/aws-api/./src/urlPattern.ts","webpack://@x82-softworks/aws-api/./src/utils.ts","webpack://@x82-softworks/aws-api/external commonjs \"serialize-error\"","webpack://@x82-softworks/aws-api/external commonjs \"@x82-softworks/clone-merge\"","webpack://@x82-softworks/aws-api/external commonjs \"cookie\"","webpack://@x82-softworks/aws-api/external commonjs \"ajv\"","webpack://@x82-softworks/aws-api/external commonjs \"is-integer\"","webpack://@x82-softworks/aws-api/./src/jsonSchemaValidator.ts","webpack://@x82-softworks/aws-api/./src/params.ts","webpack://@x82-softworks/aws-api/external commonjs \"@x82-softworks/aws-api-multipart\"","webpack://@x82-softworks/aws-api/external commonjs \"query-string\"","webpack://@x82-softworks/aws-api/./src/requestBody.ts","webpack://@x82-softworks/aws-api/./src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","import { URLPattern } from './urlPattern';\n\nexport interface Response {\n body: any\n headers: object\n statusCode: number\n}\n\nexport type Path = {\n regex: URLPattern\n original: string\n}\n\nexport interface Headers {\n cookie?: string\n}\n\nexport interface Request {\n path: string\n rawPath: string\n /**\n * The lowercase version of the http method\n */\n httpMethod: string\n\n pathParams: Nullable<object>\n headers: Headers\n rawHeaders: Headers\n queryStringParameters: object \n params: object\n stageVariables: object\n requestContext: object\n body: any\n rawBody: any\n isBase64Encoded: boolean\n}\n\nexport type ExtendedError = Error & {\n additional: any\n code: any\n}\n\nexport type Reference = {\n $ref: string\n}\nexport enum Method {\n GET = 'get',\n POST = 'post',\n PUT = 'put',\n DELETE = 'delete',\n PATCH = 'patch',\n OPTIONS = 'options',\n}\n\nexport interface RootDefinitionInfo {\n version: string\n description: string\n termsOfService: string\n title: string\n contact: object\n license: object\n}\n\nexport interface RootDefinition {\n components: Nullable<object>\n openapi: string\n paths: object\n info: RootDefinitionInfo\n host: string\n basePath: string\n}\n\nexport interface RootDefinitionOverride {\n components?: RootDefinition['components']\n openapi?: RootDefinition['openapi']\n paths?: RootDefinition['paths']\n info?: RootDefinition['info']\n host?: RootDefinition['host']\n basePath?: RootDefinition['basePath']\n}\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const NUMBER = \"number\"\nexport const BOOLEAN = \"boolean\"\nexport const INTEGER = \"integer\"\nexport const INT32 = \"int32\"\nexport const INT64 = \"int64\"\nexport const STRING = \"string\"\nexport const FLOAT = \"float\"\nexport const DOUBLE = \"double\"\nexport const OBJECT = \"object\"\nexport const BYTE = \"byte\"\nexport const BINARY = \"binary\"\nexport const DATE = \"date\"\nexport const DATETIME = \"dateTime\"\nexport const ARRAY = \"array\"\nexport const HEADER = \"header\"\nexport const PASSWORD = \"password\"\nexport const APIKEY = \"apikey\"\nexport const EMAIL = \"email\"\n","const keyPattern = /({[^}]*})/g\n\nexport class URLPattern {\n regex: RegExp\n keys: Array<string>\n constructor(pattern: string) {\n const keys: Array<string> = []\n let key\n\n while ((key = keyPattern.exec(pattern))) {\n key = key[0].slice(1, -1)\n keys.push(key)\n }\n //We need the inorder value of the keys\n this.keys = keys\n pattern = pattern.replace(/({[^}]*})/g, \"([a-zA-Z0-9-\\\\._~ %]+)\")\n this.regex = new RegExp(pattern)\n }\n\n match(test: string): Nullable<object> {\n let ret: Nullable<object> = null,\n match\n if ((match = this.regex.exec(test))) {\n ret = {}\n for (let i = 0; i < this.keys.length; i++) {\n ret[this.keys[i]] = match[i + 1]\n }\n //We need to check for the param keys and return it as an object\n }\n return ret\n }\n}\n","import { BOOLEAN, INTEGER, NUMBER, OBJECT } from \"./constants\"\nimport { Response } from \"./types\"\nimport { URLPattern } from \"./urlPattern\"\n\n/**\n * The default generic error code\n * @public\n */\nexport const GENERIC_ERROR = \"GenericError\"\n\nexport const isError = (err): boolean => {\n return typeof err === \"object\" && err.name && err.stack && err.message\n}\n/**\n * Performs the final toStringing of data in the res body\n * @internal\n * @param res - The response\n * @returns The same response with the stringified version of its body\n */\nexport const returnFinal = (res: Response): Response => {\n if (res.body && typeof res.body !== \"string\") {\n res.body = JSON.stringify(res.body)\n }\n return res\n}\n\n/**\n * Checks to see if the object contains a reference to another in the api doc\n * @param obj\n */\nexport const isRef = (obj: any): boolean => {\n return typeof obj === \"object\" && typeof obj?.$ref === \"string\"\n}\n\nexport const coerce = (schema, val) => {\n switch (schema.type) {\n case OBJECT:\n if (typeof val === \"string\") {\n val = JSON.parse(val)\n }\n break\n case INTEGER:\n case NUMBER:\n val = Number(val)\n break\n case BOOLEAN:\n val = Boolean(val)\n break\n default:\n break\n }\n return val\n}\n\nexport const returnNotFound = async function (res: Response) {\n return returnFinal({\n ...res,\n statusCode: 404,\n })\n}\n\n/**\n * Convert a string like /{test}/{param} to a url pattern matching object\n * @internal\n * @param path\n * @returns A URLPattern matcher\n */\nexport const convertToRegex = (path: string): URLPattern => {\n return new URLPattern(path)\n}\n\nexport const returnInvalid = async function (res: Response, reason) {\n if (typeof reason === \"string\") {\n reason = {\n code: GENERIC_ERROR,\n message: reason,\n }\n }\n if (isError(reason)) {\n reason = {\n code: reason.code || GENERIC_ERROR,\n message: reason.message,\n }\n }\n return returnFinal({\n ...res,\n statusCode: 400,\n body: reason,\n })\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"serialize-error\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@x82-softworks/clone-merge\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"cookie\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"ajv\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"is-integer\");","import { INT32, INT64, NUMBER } from \"./constants\"\nimport Ajv from \"ajv\"\nimport isInteger from \"is-integer\"\n\nconst MAX_INT_32 = 2147483647\nconst ajv = new Ajv({\n useDefaults: true,\n coerceTypes: true,\n})\najv.addFormat(INT32, {\n validate: function (a) {\n return isInteger(a) && a <= MAX_INT_32 && a >= -MAX_INT_32\n },\n type: NUMBER,\n})\najv.addFormat(INT64, {\n validate: function (a) {\n return isInteger(a)\n },\n type: NUMBER,\n})\n/**\n * Checks to see if the value matches to the given schema\n * @method exports\n * @param schema\n * @param val\n * @internal\n * @throws {Error}\n */\nexport default (schema: object, val: any) => {\n let validate = ajv.compile(schema),\n err\n if (!validate(val)) {\n err = new Error(\"Validation error\")\n err.additional = validate.errors\n throw err\n }\n}\n","import { coerce, isRef } from './utils';\nimport isNotValid from './jsonSchemaValidator';\nexport default async (req, controller, api) => {\n (controller.parameters || []).forEach(param => {\n let val;\n switch (param.in) {\n case 'query':\n val = (req.queryStringParameters || {})[param.name];\n break;\n case 'header':\n val = req.headers[param.name];\n break;\n case 'path':\n val = decodeURIComponent(req.pathParams[param.name]);\n break;\n case 'cookie':\n val = req.headers.cookie[param.name];\n break;\n default:\n throw new Error('Unknown param type : ' + param.in);\n }\n if (val === undefined) {\n if (param.required) {\n throw new Error(`Required parameter \"${param.name}\" not found`);\n }\n } else if (param.schema) {\n let schema = param.schema;\n if (isRef(schema)) {\n schema = api.getRef(schema);\n }\n val = coerce(schema, val);\n isNotValid(schema, val);\n }\n req.params[param.name] = val;\n });\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@x82-softworks/aws-api-multipart\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"query-string\");","/* eslint-disable no-case-declarations */\nimport { coerce, isRef } from \"./utils\"\nimport { parse } from \"@x82-softworks/aws-api-multipart\"\nimport isNotValid from \"./jsonSchemaValidator\"\nimport qs from \"query-string\"\n\nfunction validateSchema(req, schema, api) {\n if (!schema) {\n return\n }\n if (isRef(schema)) {\n schema = api.getRef(schema)\n }\n const val = (req.body = coerce(schema, req.body))\n isNotValid(schema, val)\n}\n/**\n * Handles the request body portion of a request\n * @param {Object} req\n * @param {?Object} controllerRequestBody\n * @param {Object} api\n */\nexport default async function (req, controllerRequestBody, api) {\n let contentSelector,\n hasNoBody = req.body === null || req.body === undefined,\n schema,\n contentType\n if (!controllerRequestBody) {\n return\n }\n //Check if its a request body reference\n if (isRef(controllerRequestBody)) {\n controllerRequestBody = api.getRef(controllerRequestBody)\n }\n //Check to see if required\n if (controllerRequestBody.required && hasNoBody) {\n throw new Error(\"Request body must be supplied\")\n }\n //If there is no body to parse and its not required then we're done\n if (hasNoBody) {\n return\n }\n contentType = req.headers[\"content-type\"]\n if (!contentType) {\n return\n // throw new Error('Request headers do not contain \"content-type\"');\n }\n //In the case of multipart/form-data having a boundary\n contentType = contentType.split(\";\")[0]\n //Check to see if that controller accepts the content type\n if (!(contentSelector = controllerRequestBody.content[contentType])) {\n throw new Error(`Content Type \"${contentType}\" is not supported`)\n }\n schema = contentSelector.schema\n switch (contentType) {\n case \"application/json\":\n try {\n req.body = JSON.parse(req.body)\n } catch (err) {\n throw new Error(\"Cannot parse request body\")\n }\n break\n case \"application/x-www-form-urlencoded\":\n req.body = qs.parse(req.body)\n break\n case \"multipart/form-data\":\n const ret = await parse(req)\n const { val, multiparts } = ret.files.reduce(\n (acc, file) => {\n acc.val[file.fieldName] = file.data.toString(\"utf-8\")\n acc.multiparts[file.fieldName] = file\n return acc\n },\n {\n val: {},\n multiparts: {},\n }\n )\n\n //The coercion from the validate schea should handle converting application json,etc for us\n req.body = val\n req.multiparts = multiparts\n break\n //Passthrough\n default:\n break\n }\n validateSchema(req, schema, api)\n}\n","import {\n ExtendedError,\n Method,\n Path,\n Reference,\n Request,\n Response,\n RootDefinition,\n RootDefinitionOverride\n} from './types';\nimport {\n GENERIC_ERROR,\n convertToRegex,\n isRef,\n returnFinal,\n returnNotFound\n} from './utils';\nimport { STRING } from './constants';\nimport { serializeError } from 'serialize-error';\nimport cloneMerge from '@x82-softworks/clone-merge';\nimport cookie from 'cookie';\nimport params from './params';\nimport requestBodyHandler from './requestBody';\n\nexport const FORM_ENCODED = 'application/x-www-form-urlencoded';\nexport const DEFAULT_CORS = {\n 'Access-Control-Allow-Methods': 'GET,OPTIONS,HEAD',\n 'Access-Control-Allow-headers':\n 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'\n};\nexport * from './constants';\nexport { GENERIC_ERROR } from './utils';\n\nconst APP_JSON = 'application/json',\n REQUEST_BODY = 'requestBodies',\n SCHEMA = 'schemas',\n CALLBACK = 'callbacks',\n HEADER = 'headers',\n SECURITY = 'securitySchemes',\n PARAMETER = 'parameters',\n RESPONSE = 'responses',\n EXAMPLE = 'examples',\n LINK = 'links',\n OBJECT = 'object',\n CONTENT_TYPE = 'content-type';\n\nexport type Handler = (Request, Response, API) => void\n\nconst paramRegex = /\\{([^}]*)\\}/;\n/**\n * Generates a reference object\n * @public\n * @param type\n * @param name\n * @returns A reference object\n */\nfunction ref(type: string, name: string): Reference {\n return {\n $ref: '#/components/' + type + '/' + name\n };\n}\n\nclass API {\n devMode: boolean;\n rootDef: RootDefinition;\n corsConfig: Function;\n /**\n * @internal\n */\n paths: Array<Path>;\n _suppressValidationErrors: boolean;\n\n constructor(opts: RootDefinitionOverride, devMode: boolean) {\n this.devMode = !!devMode;\n this.rootDef = cloneMerge(\n {\n openapi: '3.0.0',\n info: {\n version: '0.0.0',\n description: 'Default API',\n termsOfService: 'http://swagger.io/terms/',\n title: '',\n contact: {\n email: 'no-reply@example.com'\n },\n license: {\n name: 'Proprietary'\n // url: 'http://www.apache.org/licenses/LICENSE-2.0.html'\n }\n },\n host: 'localhost',\n basePath: '/',\n paths: {}\n },\n opts\n );\n this.corsConfig = function (req, res) {\n const origin = req.headers.Origin ? req.headers.Origin : '*';\n res.headers = cloneMerge(\n res.headers,\n {\n 'Access-Control-Allow-Origin': origin\n },\n DEFAULT_CORS\n );\n };\n this.paths = [];\n this.defSchema('genericError', {\n type: OBJECT,\n properties: {\n code: {\n description: 'Error code',\n type: STRING\n },\n message: {\n description: 'Human readable message',\n type: STRING\n }\n },\n required: ['code', 'message']\n });\n this.defResponse('genericError', {\n description: 'An unexpected error occurred',\n content: {\n 'application/json': {\n schema: this.refSchema('genericError')\n }\n }\n });\n\n this._suppressValidationErrors = false;\n }\n /**\n * Sets the validation error suppression\n * @param val\n */\n suppressValidationErrors(val: boolean) {\n this._suppressValidationErrors = val;\n }\n /**\n * @public\n * @returns The Root API defintion\n */\n getRoot(): object {\n return cloneMerge(true, this.rootDef);\n }\n defRoot(def: object) {\n this.rootDef = cloneMerge(true, this.rootDef, def);\n }\n /**\n * Define the Cors function\n */\n cors(configFunc: Function) {\n this.corsConfig = configFunc;\n }\n defComponent(type, name, val): API {\n if (!this.rootDef.components) {\n this.rootDef.components = {};\n }\n if (!this.rootDef.components[type]) {\n this.rootDef.components[type] = {};\n }\n if (this.rootDef.components[type][name]) {\n throw new Error(\n 'Component of type : \"' +\n type +\n '\" and name : \"' +\n name +\n '\" is already defined'\n );\n }\n this.rootDef.components[type][name] = val;\n return this;\n }\n defSecurity(name, props) {\n return this.defComponent(SECURITY, name, props);\n }\n defResponse(name, props) {\n return this.defComponent(RESPONSE, name, props);\n }\n ref(type: string, name: string): Reference {\n return ref(type, name);\n }\n defSchema(name, props) {\n if (!props.title) {\n props.title = name;\n }\n return this.defComponent(SCHEMA, name, props);\n }\n getHost(): string {\n return this.rootDef.host;\n }\n /**\n * Gets the value from the reference object\n * @public\n * @param refObj\n * @returns The referenced object\n */\n getRef(refObj: Reference): object {\n if (!isRef(refObj)) {\n throw new Error('Not a valid reference object');\n }\n //\"$ref\": \"#/components/schemas/Pet\"\n return refObj.$ref\n .split('/')\n .slice(1)\n .reduce(function (acc, piece) {\n return acc[piece];\n }, this.rootDef);\n }\n\n /**\n * Ref requests\n */\n\n refResponse(name: string): Reference {\n return ref(RESPONSE, name);\n }\n refSchema(name: string): Reference {\n return ref(SCHEMA, name);\n }\n refRequestBody(name: string): Reference {\n return ref(REQUEST_BODY, name);\n }\n refSecurity(name: string): Reference {\n return ref(SECURITY, name);\n }\n refExample(name: string): Reference {\n return ref(EXAMPLE, name);\n }\n refParameter(name: string): Reference {\n return ref(PARAMETER, name);\n }\n refHeader(name: string): Reference {\n return ref(HEADER, name);\n }\n refCallback(name: string): Reference {\n return ref(CALLBACK, name);\n }\n refLink(name: string): Reference {\n return ref(LINK, name);\n }\n /**\n * Adds a route to the router\n * @public\n * @param path\n * @param method\n * @param [def]\n * @param handler\n */\n path(path: string, method: Method, def, handler: Handler): API {\n if (!handler) {\n handler = def;\n def = null;\n }\n def = cloneMerge(\n true,\n {\n summary: '',\n description: '',\n tags: [],\n parameters: [],\n requestBody: null,\n responses: {\n 200: {\n description: 'Success' // schema: null\n },\n default: this.refResponse('genericError')\n }\n },\n def\n );\n if (!def.requestBody) {\n delete def.requestBody;\n }\n const methodString = method.toLowerCase();\n def.handler = handler;\n if (!this.rootDef.paths) {\n this.rootDef.paths = {};\n }\n if (!this.rootDef.paths[path]) {\n this.rootDef.paths[path] = {};\n }\n if (this.rootDef.paths[path][methodString]) {\n throw new Error(\n 'Redefinition of path : ' + path + ' method : ' + methodString\n );\n }\n this.rootDef.paths[path][methodString] = def;\n //If it has path params\n if (paramRegex.test(path)) {\n this.paths.push({\n regex: convertToRegex(path),\n original: path\n });\n }\n return this;\n }\n /**\n * Adds a GET route\n * @public\n * @param path\n * @param [def]\n * @param handler\n */\n get(path: string, def, handler: Handler): API {\n return this.path(path, Method.GET, def, handler);\n }\n /**\n * Adds a POST route\n * @public\n * @param path\n * @param [def]\n * @param handler\n */\n post(path: string, def, handler: Handler): API {\n return this.path(path, Method.POST, def, handler);\n }\n\n /**\n * Adds a PUT route\n * @public\n * @param path\n * @param [def]\n * @param handler\n */\n put(path: string, def, handler: Handler): API {\n return this.path(path, Method.PUT, def, handler);\n }\n\n /**\n * Adds a PATCH route\n * @public\n * @param path\n * @param [def]\n * @param handler\n */\n patch(path: string, def, handler: Handler): API {\n return this.path(path, Method.PATCH, def, handler);\n }\n\n /**\n * Adds a DELETE route\n * @public\n * @param path\n * @param [def]\n * @param handler\n */\n delete(path: string, def, handler: Handler): API {\n return this.path(path, Method.DELETE, def, handler);\n }\n defParameter(name, props) {\n return this.defComponent(PARAMETER, name, props);\n }\n defExample(name, props) {\n return this.defComponent(EXAMPLE, name, props);\n }\n defRequestBody(name, props) {\n return this.defComponent(REQUEST_BODY, name, props);\n }\n defHeader(name, props) {\n return this.defComponent(HEADER, name, props);\n }\n defLink(name, props) {\n return this.defComponent(LINK, name, props);\n }\n defCallback(name, props) {\n return this.defComponent(CALLBACK, name, props);\n }\n lambda() {\n const self = this;\n\n return async function (event) {\n //Automatically set the correct host\n if (event.headers && event.headers.Host) {\n let more = '';\n if (event.requestContext) {\n if (\n event.requestContext.path.indexOf(\n '/' + event.requestContext.stage\n ) === 0\n ) {\n //Then we have some kind of basepath added on\n more = '/' + event.requestContext.stage;\n }\n }\n self.defRoot({\n host: 'https://' + event.headers.Host + more\n });\n }\n return await self.dispatch(event);\n };\n }\n\n /**\n * @public\n * @param event\n */\n async dispatch(event: object) {\n const req: Request = {\n path: '/',\n rawPath: '/',\n httpMethod: Method.GET, //'Incoming request's method name,\n headers: {\n //Incoming request headers\n },\n rawHeaders: {},\n queryStringParameters: {\n //query string parameters\n },\n params: {\n //Will be added by the dispatcher\n },\n stageVariables: {\n //Applicable stage variables\n },\n requestContext: {\n //Request context,including authorizer - returned key - value pairs\n },\n pathParams: {},\n body: null, //A JSON string of the request payload.\n isBase64Encoded: false, // \"A boolean flag to indicate if the applicable request payload is Base64-encode\",\n rawBody: null,\n ...event\n };\n const self = this;\n req.rawPath = req.path;\n req.httpMethod = req.httpMethod.toLowerCase();\n //Make sure all headers are lower case as according to RFCs it doesn't matter but it does simplify lookup\n\n req.headers = Object.keys(req.headers || {}).reduce((acc, key) => {\n acc[key.toLowerCase()] = req.headers[key];\n return acc;\n }, {});\n //In case middleware attempts to overwrite it\n req.rawBody = req.body;\n req.rawHeaders = req.headers;\n if (req.headers?.cookie) {\n req.headers.cookie = cookie.parse(req.headers.cookie);\n }\n if (req.path[0] !== '/') {\n //Normalise\n req.path = '/' + req.path;\n }\n if (!req.httpMethod || !req.path) {\n throw new Error('Event is not wellformed');\n }\n\n const res: Response = {\n body: undefined,\n headers: {},\n statusCode: 200\n };\n\n //check this against the base path\n if (req.path.indexOf(self.rootDef.basePath) !== 0) {\n return returnNotFound(res);\n }\n self.corsConfig(req, res);\n req.path = req.path.slice(self.rootDef.basePath.length);\n if (req.path[0] !== '/') {\n req.path = '/' + req.path;\n }\n\n //Lookup the path directly if possible otherwise use pattern matching\n let methods = self.rootDef.paths[req.path],\n pathParams: Nullable<object> = null,\n controller;\n\n if (!methods) {\n //Try lookup via path matching\n for (let i = 0, c = self.paths.length; i < c; i++) {\n if ((pathParams = self.paths[i].regex.match(req.path))) {\n methods = self.rootDef.paths[self.paths[i].original];\n break;\n }\n }\n }\n req.pathParams = pathParams;\n if (!methods || !(controller = methods[req.httpMethod])) {\n //This allows added options to override the base support\n if (req.httpMethod === 'options') {\n //Automagic option support\n return res;\n }\n return returnNotFound(res);\n }\n return (\n requestBodyHandler(req, controller.requestBody, self)\n .catch(err => {\n //Assume user fuckup\n res.statusCode = 400;\n throw err;\n })\n .then(async () => {\n await params(req, controller, self);\n return new Promise((resolve, reject) => {\n try {\n resolve(controller.handler(req, res));\n } catch (err) {\n reject(err);\n }\n }).catch(err => {\n if (!res.body) {\n if (self.devMode) {\n res.body = err;\n } else {\n // eslint-disable-next-line no-console\n console.error(err);\n res.body = new Error('An internal server error has occurred');\n }\n res.statusCode = res.body.statusCode ? res.body.statusCode : 500;\n }\n });\n })\n //Errors from params and requestbody should fall through to here\n .catch(err => {\n res.body = err;\n })\n .then(() => {\n //Check if the body is an error in which case we extract only the message to prevent leaking the specifics of the server\n if (res.body instanceof Error) {\n if (self.devMode) {\n res.body = serializeError(res.body);\n } else {\n res.body = {\n code: (res.body as ExtendedError)?.code || GENERIC_ERROR,\n message: res.body.message,\n additional: self._suppressValidationErrors\n ? null\n : (res.body as ExtendedError)?.additional\n };\n }\n if (!res.statusCode) {\n res.statusCode = res.body.statusCode || 500;\n }\n }\n if (typeof res.body === 'object' && !res.headers[CONTENT_TYPE]) {\n //All other types must be\n res.headers[CONTENT_TYPE] = APP_JSON;\n }\n //Convert the body to a string\n return returnFinal(res);\n })\n );\n }\n}\n\nexport default API;\n//Auto generate all the ref functions\n// [\n// SECURITY,\n// EXAMPLE,\n// PARAMETER,\n// RESPONSE,\n// HEADER,\n// CALLBACK,\n// LINK,\n// SCHEMA,\n// REQUEST_BODY\n// ].forEach(type => {\n// let name = type;\n// if (name === REQUEST_BODY) {\n// //Tiny hack because request body does not have a simple pluralization\n// name = 'RequestBodys';\n// }\n// //We use the -1 to remove the pluralization\n// API.prototype['ref' + capitalize(name).slice(0, -1)] = (name) => ref(type, name);\n// });\n/**\n * Factory function to create an API\n * @public\n * @param init\n * @param debug\n * @returns The created api\n */\nexport const create = function (\n init: RootDefinitionOverride,\n debug: boolean\n): API {\n return new API(init, debug);\n};\n\n/**\n * An easy shorthand to create a required JSON requestBody with provided inner schema\n * @public\n * @param schema\n */\nexport const requiredJsonRequest = (schema: object): object => ({\n required: true,\n content: {\n 'application/json': {\n schema: schema\n }\n }\n});\n\n/**\n * An easy shorhand to create a json response with the provided schema\n * @param schema\n * @public\n * @returns\n */\nexport const jsonResponseContent = (schema: object): object => ({\n 'application/json': {\n schema: schema\n }\n});\n"],"names":["Method","__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","NUMBER","BOOLEAN","INTEGER","INT32","INT64","STRING","FLOAT","DOUBLE","OBJECT","BYTE","BINARY","DATE","DATETIME","ARRAY","HEADER","PASSWORD","APIKEY","EMAIL","keyPattern","URLPattern","constructor","pattern","keys","exec","slice","push","this","replace","regex","RegExp","match","test","ret","i","length","GENERIC_ERROR","returnFinal","res","body","JSON","stringify","isRef","$ref","coerce","schema","val","type","parse","Number","Boolean","returnNotFound","statusCode","convertToRegex","path","require","MAX_INT_32","ajv","useDefaults","coerceTypes","addFormat","validate","err","compile","Error","additional","errors","req","controllerRequestBody","api","contentSelector","contentType","hasNoBody","undefined","getRef","required","headers","split","content","multiparts","files","reduce","acc","file","fieldName","data","toString","validateSchema","FORM_ENCODED","DEFAULT_CORS","REQUEST_BODY","SCHEMA","CALLBACK","SECURITY","PARAMETER","RESPONSE","EXAMPLE","LINK","CONTENT_TYPE","paramRegex","ref","name","API","opts","devMode","rootDef","openapi","info","version","description","termsOfService","title","contact","email","license","host","basePath","paths","corsConfig","origin","Origin","defSchema","properties","code","message","defResponse","refSchema","_suppressValidationErrors","suppressValidationErrors","getRoot","defRoot","def","cors","configFunc","defComponent","components","defSecurity","props","getHost","refObj","piece","refResponse","refRequestBody","refSecurity","refExample","refParameter","refHeader","refCallback","refLink","method","handler","summary","tags","parameters","requestBody","responses","default","methodString","toLowerCase","original","GET","post","POST","put","PUT","patch","PATCH","delete","DELETE","defParameter","defExample","defRequestBody","defHeader","defLink","defCallback","lambda","self","event","Host","more","requestContext","indexOf","stage","dispatch","rawPath","httpMethod","rawHeaders","queryStringParameters","params","stageVariables","pathParams","isBase64Encoded","rawBody","cookie","controller","methods","c","catch","then","forEach","param","in","decodeURIComponent","Promise","resolve","reject","console","error","serializeError","create","init","debug","requiredJsonRequest","jsonResponseContent"],"sourceRoot":""}