@netlify/integrations
Advanced tools
Comparing version 0.3.0 to 0.4.0
import { HandlerContext, HandlerEvent, HandlerResponse } from '@netlify/functions'; | ||
declare type FunctionHandler<Context = unknown> = (event: HandlerEvent, context: HandlerContext & Context) => Promise<HandlerResponse>; | ||
export declare type IntegrationHandler<Context = unknown> = (handler: FunctionHandler<Context>) => FunctionHandler; | ||
declare type ExtractContextTypes<HandlerTypes extends unknown[]> = HandlerTypes extends [infer Handler, ...infer Remaining] ? Handler extends IntegrationHandler<infer ContextType> ? ContextType & ExtractContextTypes<Remaining> : unknown : unknown; | ||
export declare const wrap: <T extends IntegrationHandler<unknown>[]>(...handlers: T) => (functionHandler: (event: HandlerEvent, context: HandlerContext & ExtractContextTypes<T>) => Promise<HandlerResponse>) => (event: HandlerEvent, context: HandlerContext & ExtractContextTypes<T>) => Promise<HandlerResponse>; | ||
export declare type FunctionHandler<Context = any> = (event: HandlerEvent, context: HandlerContext & Context) => Promise<HandlerResponse>; | ||
export declare type IntegrationHandlerConfig<Config = any> = { | ||
[key: string]: { | ||
[key: string]: unknown; | ||
}; | ||
} & Config; | ||
export declare type IntegrationHandler<Context = any, Config = any> = (handler: FunctionHandler<Context>, config?: IntegrationHandlerConfig<Config>) => FunctionHandler; | ||
declare type ExtractContextTypes<HandlerTypes extends unknown[]> = HandlerTypes extends [infer Handler, ...infer Remaining] ? Handler extends IntegrationHandler<infer ContextType, infer ConfigType> ? ContextType & ExtractContextTypes<Remaining> : unknown : unknown; | ||
declare type ExtractConfigTypes<HandlerTypes extends unknown[]> = HandlerTypes extends [infer Handler, ...infer Remaining] ? Handler extends IntegrationHandler<infer ContextType, infer ConfigType> ? ConfigType & ExtractConfigTypes<Remaining> : unknown : unknown; | ||
export declare const wrap: <T extends IntegrationHandler<any, any>[]>(...handlers: T) => (functionHandler: (event: HandlerEvent, context: HandlerContext & ExtractContextTypes<T>) => Promise<HandlerResponse>, config?: ExtractConfigTypes<T> | undefined) => (event: HandlerEvent, context: HandlerContext & ExtractContextTypes<T>) => Promise<HandlerResponse>; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
export const wrap = (...handlers) => (functionHandler) => | ||
export const wrap = (...handlers) => (functionHandler, config) => | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
handlers.reduceRight((handler, integration) => integration(handler), functionHandler); | ||
handlers.reduceRight((handler, integration) => integration(handler, config), functionHandler); |
{ | ||
"name": "@netlify/integrations", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "", | ||
@@ -13,7 +13,2 @@ "type": "module", | ||
], | ||
"scripts": { | ||
"build": "tsc --project tsconfig.build.json", | ||
"test": "vitest", | ||
"test:ci": "vitest run" | ||
}, | ||
"config": { | ||
@@ -47,4 +42,11 @@ "eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,scripts,.github}/**/*.{js,ts,md,html}\" \"*.{js,ts,md,html}\" \".*.{js,ts,md,html}\"", | ||
"dependencies": { | ||
"@netlify/functions": "^1.4.0" | ||
"@netlify/functions": "^1.4.0", | ||
"@types/chance": "^1.1.3", | ||
"chance": "^1.1.9" | ||
}, | ||
"scripts": { | ||
"build": "tsc --project tsconfig.build.json", | ||
"test": "vitest", | ||
"test:ci": "vitest run" | ||
} | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4559
16
3
+ Added@types/chance@^1.1.3
+ Addedchance@^1.1.9
+ Added@types/chance@1.1.6(transitive)
+ Addedchance@1.1.12(transitive)