quidproquo-webserver
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -5,3 +5,3 @@ import { QPQConfig } from 'quidproquo-core'; | ||
import { OpenApiQPQWebServerConfigSetting } from './config/settings/openApi'; | ||
import { HttpEventHeaders } from './types/HTTPEvent'; | ||
import { HttpEventHeaders, HTTPEventParams, HTTPEventResponse } from './types/HTTPEvent'; | ||
import { RouteOptions } from './config/settings/route'; | ||
@@ -18,1 +18,3 @@ export declare const getAllRoutes: (configs: QPQConfig) => RouteQPQWebServerConfigSetting[]; | ||
export declare const getCorsHeaders: (configs: QPQConfig, route: RouteOptions, reqHeaders: HttpEventHeaders) => HttpEventHeaders; | ||
export declare const fromJsonEventRequest: <T>(httpJsonEvent: HTTPEventParams) => T; | ||
export declare const toJsonEventResponse: (item: any, status?: number) => HTTPEventResponse; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getFeatureDomainName = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getDeployRegion = exports.getAllSeo = exports.getAllRoutes = void 0; | ||
exports.toJsonEventResponse = exports.fromJsonEventRequest = exports.getCorsHeaders = exports.getAllowedOrigins = exports.getHeaderValue = exports.getFeatureDomainName = exports.getDomainName = exports.getAllSrcEntries = exports.getAllOpenApiSpecs = exports.getDeployRegion = exports.getAllSeo = exports.getAllRoutes = void 0; | ||
const quidproquo_core_1 = require("quidproquo-core"); | ||
@@ -84,1 +84,19 @@ const QPQConfig_1 = require("./config/QPQConfig"); | ||
exports.getCorsHeaders = getCorsHeaders; | ||
const fromJsonEventRequest = (httpJsonEvent) => { | ||
const item = JSON.parse(httpJsonEvent.isBase64Encoded | ||
? Buffer.from(httpJsonEvent.body, 'base64').toString() | ||
: httpJsonEvent.body); | ||
return item; | ||
}; | ||
exports.fromJsonEventRequest = fromJsonEventRequest; | ||
const toJsonEventResponse = (item, status = 200) => { | ||
return { | ||
status, | ||
body: JSON.stringify(item), | ||
isBase64Encoded: false, | ||
headers: { | ||
'content-type': 'application/json', | ||
}, | ||
}; | ||
}; | ||
exports.toJsonEventResponse = toJsonEventResponse; |
@@ -5,3 +5,3 @@ import { HTTPMethod } from 'quidproquo-core'; | ||
} | ||
export interface HTTPEventParams<T> { | ||
export interface HTTPEventParams<T = string> { | ||
path: string; | ||
@@ -16,2 +16,9 @@ query: { | ||
sourceIp: string; | ||
isBase64Encoded: boolean; | ||
} | ||
export interface HTTPEventResponse<T = string> { | ||
status: number; | ||
body?: T; | ||
headers?: HttpEventHeaders; | ||
isBase64Encoded: boolean; | ||
} |
@@ -15,2 +15,3 @@ import { HTTPMethod } from 'quidproquo-core'; | ||
sourceIp: string; | ||
domain: string; | ||
} | ||
@@ -22,2 +23,3 @@ export interface SeoEventResponse { | ||
headers?: SeoEventHeaders; | ||
bodyEncoding?: 'binary' | 'base64'; | ||
} |
{ | ||
"name": "quidproquo-webserver", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25806
525