@nearform/sql
Advanced tools
| version: 2 | ||
| updates: | ||
| - package-ecosystem: npm | ||
| directory: '/' | ||
| directory: / | ||
| schedule: | ||
| interval: daily | ||
| interval: weekly | ||
| - package-ecosystem: github-actions | ||
| directory: '/' | ||
| directory: / | ||
| schedule: | ||
| interval: daily | ||
| interval: weekly |
+1
-1
| { | ||
| "name": "@nearform/sql", | ||
| "version": "1.10.4", | ||
| "version": "1.10.5", | ||
| "description": "SQL injection protection module", | ||
@@ -5,0 +5,0 @@ "main": "./SQL.js", |
+36
-0
@@ -47,2 +47,26 @@ /** A tagged template containing strings and values */ | ||
| /** | ||
| * A function that accepts an array of objects and a mapper function | ||
| * It returns a clean SQL format using the object properties defined in the mapper function | ||
| * @param array the items to be mapped over | ||
| * @param mapFunc a function to transform the items in `array` before being added to the SqlStatement | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3])}` | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3], x => x ** 2)}` | ||
| */ | ||
| map<T>(array: T[], mapFunc?: (item: T) => unknown): SqlStatement | ||
| /** | ||
| * A function that accepts an array of objects and a mapper function | ||
| * It returns a clean SQL format using the object properties defined in the mapper function | ||
| * @param array the items to be mapped over | ||
| * @param mapFunc a function to transform the items in `array` before being added to the SqlStatement | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3])}` | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3], x => x ** 2)}` | ||
| */ | ||
| static map<T>(array: T[], mapFunc?: (item: T) => unknown): SqlStatement | ||
| /** Returns a formatted but unsafe statement of strings and values, useful for debugging */ | ||
@@ -89,2 +113,14 @@ get debug(): string | ||
| /** | ||
| * A function that accepts an array of objects and a mapper function | ||
| * It returns a clean SQL format using the object properties defined in the mapper function | ||
| * @param array the items to be mapped over | ||
| * @param mapFunc a function to transform the items in `array` before being added to the SqlStatement | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3])}` | ||
| * @example | ||
| * SQL`SELECT ${SQL.map([1,2,3], x => x ** 2)}` | ||
| */ | ||
| export function map<T>(array: T[], mapFunc?: (item: T) => unknown): SqlStatement | ||
| export function unsafe<T>(value: T): { value: T } | ||
@@ -91,0 +127,0 @@ export function quoteIdent(value: string): { value: string } |
+5
-1
| import SQL from '.' | ||
| import { glue, SqlStatement } from '.' | ||
| import { glue, map, SqlStatement } from '.' | ||
| import { expectType, expectError } from 'tsd' | ||
@@ -11,2 +11,6 @@ | ||
| expectType<SQL.SqlStatement>(SQL.glue([SQL`SELECT`, SQL`1`], ' ')) | ||
| expectType<SQL.SqlStatement>(SQL.map([1,2,3])) | ||
| expectType<SQL.SqlStatement>(SQL.map([1,2,3], x => x**2)) | ||
| expectType<SQL.SqlStatement>(map([1,2,3])) | ||
| expectType<SQL.SqlStatement>(map([1,2,3], x => x**2)) | ||
| expectType<string>(SQL`SELECT 1`.debug) | ||
@@ -13,0 +17,0 @@ expectType<string>(SQL`SELECT 1`.sql) |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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 5 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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 5 instances in 1 package
60684
2.98%1212
3.15%3
50%