@netlify/functions
Advanced tools
Comparing version
@@ -6,2 +6,3 @@ interface BasePurgeCacheOptions { | ||
token?: string; | ||
userAgent?: string; | ||
} | ||
@@ -8,0 +9,0 @@ interface PurgeCacheOptionsWithSiteID extends BasePurgeCacheOptions { |
@@ -61,9 +61,13 @@ "use strict"; | ||
} | ||
const headers = { | ||
"Content-Type": "application/json; charset=utf8", | ||
Authorization: `Bearer ${token}` | ||
}; | ||
if (options.userAgent) { | ||
headers["user-agent"] = options.userAgent; | ||
} | ||
const apiURL = options.apiURL || "https://api.netlify.com"; | ||
const response = await fetch(`${apiURL}/api/v1/purge`, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json; charset=utf8", | ||
Authorization: `Bearer ${token}` | ||
}, | ||
headers, | ||
body: JSON.stringify(payload) | ||
@@ -70,0 +74,0 @@ }); |
@@ -108,9 +108,13 @@ "use strict"; | ||
} | ||
const headers = { | ||
"Content-Type": "application/json; charset=utf8", | ||
Authorization: `Bearer ${token}` | ||
}; | ||
if (options.userAgent) { | ||
headers["user-agent"] = options.userAgent; | ||
} | ||
const apiURL = options.apiURL || "https://api.netlify.com"; | ||
const response = await fetch(`${apiURL}/api/v1/purge`, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json; charset=utf8", | ||
Authorization: `Bearer ${token}` | ||
}, | ||
headers, | ||
body: JSON.stringify(payload) | ||
@@ -117,0 +121,0 @@ }); |
@@ -28,3 +28,3 @@ { | ||
}, | ||
"version": "2.8.2", | ||
"version": "3.0.0", | ||
"description": "JavaScript utilities for Netlify Functions", | ||
@@ -54,6 +54,6 @@ "files": [ | ||
"test:ci": "run-s test:ci:*", | ||
"test:dev:ava": "ava", | ||
"test:dev:vitest": "vitest", | ||
"test:dev:tsd": "tsd", | ||
"test:publish": "publint && attw --pack", | ||
"test:ci:ava": "nyc -r lcovonly -r text -r json ava" | ||
"test:ci:vitest": "vitest run --coverage" | ||
}, | ||
@@ -64,8 +64,2 @@ "config": { | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/unit/*.js" | ||
], | ||
"verbose": true | ||
}, | ||
"tsd": { | ||
@@ -85,3 +79,3 @@ "directory": "test/types/" | ||
"dependencies": { | ||
"@netlify/serverless-functions-api": "1.26.1" | ||
"@netlify/serverless-functions-api": "1.30.1" | ||
}, | ||
@@ -93,6 +87,6 @@ "devDependencies": { | ||
"@netlify/eslint-config-node": "^7.0.1", | ||
"ava": "^2.4.0", | ||
"@types/semver": "^7.5.8", | ||
"@vitest/coverage-v8": "^2.1.8", | ||
"husky": "^7.0.4", | ||
"npm-run-all2": "^5.0.0", | ||
"nyc": "^15.0.0", | ||
"publint": "^0.2.7", | ||
@@ -102,7 +96,8 @@ "semver": "^7.5.4", | ||
"tsup": "^8.0.2", | ||
"typescript": "^4.4.4" | ||
"typescript": "^4.4.4", | ||
"vitest": "^2.1.8" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=18.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2623880
4300.05%89
23.61%78630
6091.34%14
7.69%47
2250%10
900%+ Added
- Removed