@netlify/functions
Advanced tools
Comparing version 0.8.0 to 0.8.1-beta.0
import type { Context } from './context'; | ||
import type { Event } from './event'; | ||
import type { Response } from './response'; | ||
import type { Response, BuilderResponse } from './response'; | ||
export interface HandlerCallback { | ||
@@ -10,1 +10,7 @@ (error: any, response: Response): void; | ||
} | ||
export interface BuilderCallback { | ||
(error: any, response: BuilderResponse): void; | ||
} | ||
export interface BuilderHandler { | ||
(event: Event, context: Context, callback: BuilderCallback): void | BuilderResponse | Promise<BuilderResponse>; | ||
} |
@@ -12,1 +12,4 @@ export interface Response { | ||
} | ||
export interface BuilderResponse extends Response { | ||
ttl?: number; | ||
} |
@@ -1,3 +0,3 @@ | ||
import { Handler } from '../function/handler'; | ||
declare const wrapHandler: (handler: Handler) => Handler; | ||
import { BuilderHandler } from '../function/handler'; | ||
declare const wrapHandler: (handler: BuilderHandler) => BuilderHandler; | ||
export { wrapHandler as builder }; |
@@ -21,6 +21,8 @@ "use strict"; | ||
var augmentResponse = function (response) { | ||
var _a; | ||
if (!response || response.statusCode !== consts_1.HTTP_STATUS_OK) { | ||
return response; | ||
} | ||
return __assign(__assign({}, response), { metadata: { version: consts_1.METADATA_VERSION, builder_function: consts_1.BUILDER_FUNCTIONS_FLAG } }); | ||
var metadata = { version: consts_1.METADATA_VERSION, builder_function: consts_1.BUILDER_FUNCTIONS_FLAG, ttl: (_a = response.ttl) !== null && _a !== void 0 ? _a : 0 }; | ||
return __assign(__assign({}, response), { metadata: metadata }); | ||
}; | ||
@@ -27,0 +29,0 @@ var wrapHandler = function (handler) { |
@@ -5,3 +5,3 @@ { | ||
"types": "./dist/main.d.ts", | ||
"version": "0.8.0", | ||
"version": "0.8.1-beta.0", | ||
"description": "JavaScript utilities for Netlify Functions", | ||
@@ -62,3 +62,3 @@ "files": [ | ||
"@commitlint/config-conventional": "^13.0.0", | ||
"@netlify/eslint-config-node": "^3.3.4", | ||
"@netlify/eslint-config-node": "^3.3.5", | ||
"ava": "^2.4.0", | ||
@@ -65,0 +65,0 @@ "husky": "^4.3.8", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12688
182
0