@compas/stdlib
Advanced tools
Comparing version 0.14.1 to 0.15.0
{ | ||
"name": "@compas/stdlib", | ||
"version": "0.14.1", | ||
"version": "0.15.0", | ||
"description": "All kinds of utility functions", | ||
@@ -23,3 +23,3 @@ "exports": { | ||
"dependencies": { | ||
"@types/node": "22.5.4", | ||
"@types/node": "22.7.5", | ||
"dotenv": "16.4.5", | ||
@@ -30,3 +30,3 @@ "lodash.merge": "4.6.2", | ||
"devDependencies": { | ||
"@sentry/node": "^8.27.0" | ||
"@sentry/node": "^8.32.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "author": { |
@@ -209,9 +209,11 @@ // @ts-nocheck | ||
const body = | ||
typeof e.response?.data?.pipe === "function" && // @ts-ignore | ||
typeof e.response?.data?._read === "function" | ||
? { | ||
message: | ||
"Response was a stream, which can not be serialized by AppError#format. Use a try-catch and 'streamToBuffer(e.response?.data)' to get the provided response.", | ||
} | ||
: e.response?.data; | ||
( | ||
typeof e.response?.data?.pipe === "function" && // @ts-ignore | ||
typeof e.response?.data?._read === "function" | ||
) ? | ||
{ | ||
message: | ||
"Response was a stream, which can not be serialized by AppError#format. Use a try-catch and 'streamToBuffer(e.response?.data)' to get the provided response.", | ||
} | ||
: e.response?.data; | ||
@@ -218,0 +220,0 @@ return { |
@@ -56,3 +56,3 @@ /** | ||
abortedTime?: number | undefined; | ||
children: InsightEventSpan[]; | ||
children: Array<InsightEventSpan>; | ||
}; | ||
@@ -59,0 +59,0 @@ /** |
@@ -12,3 +12,3 @@ import { AppError } from "./error.js"; | ||
* @property {number} [abortedTime] | ||
* @property {InsightEventSpan[]} children | ||
* @property {Array<InsightEventSpan>} children | ||
*/ | ||
@@ -15,0 +15,0 @@ |
@@ -54,3 +54,3 @@ /** | ||
* | ||
* @type {(target: any, ...sources: any[]) => object} | ||
* @type {(target: any, ...sources: Array<any>) => object} | ||
* @param {object} target The destination object. | ||
@@ -60,2 +60,2 @@ * @param {...object} [sources] The source objects. | ||
*/ | ||
export const merge: (target: any, ...sources: any[]) => object; | ||
export const merge: (target: any, ...sources: Array<any>) => object; |
@@ -38,3 +38,3 @@ import lodashMerge from "lodash.merge"; | ||
* | ||
* @type {(target: any, ...sources: any[]) => object} | ||
* @type {(target: any, ...sources: Array<any>) => object} | ||
* @param {object} target The destination object. | ||
@@ -41,0 +41,0 @@ * @param {...object} [sources] The source objects. |
@@ -64,7 +64,5 @@ import { relative } from "node:path"; | ||
export function loggerFormatPretty(level, timestamp, context, message) { | ||
let prefix = level | ||
? `${loggerFormatDate(timestamp)} ${loggerFormatLevel( | ||
level, | ||
context?.type, | ||
)} ` | ||
let prefix = | ||
level ? | ||
`${loggerFormatDate(timestamp)} ${loggerFormatLevel(level, context?.type)} ` | ||
: ""; | ||
@@ -124,4 +122,4 @@ | ||
return level === "error" | ||
? `\x1b[31m${str}\x1b[39m` | ||
return level === "error" ? | ||
`\x1b[31m${str}\x1b[39m` | ||
: `\x1b[34m${str}\x1b[39m`; | ||
@@ -128,0 +126,0 @@ } |
@@ -116,4 +116,5 @@ import { pino } from "pino"; | ||
export function newLogger(options) { | ||
const context = options?.ctx | ||
? { | ||
const context = | ||
options?.ctx ? | ||
{ | ||
...globalContext, | ||
@@ -216,3 +217,6 @@ ...options.ctx, | ||
if (isNil(printer)) { | ||
printer = isGitHubActions ? "github-actions" : isProd ? "ndjson" : "pretty"; | ||
printer = | ||
isGitHubActions ? "github-actions" | ||
: isProd ? "ndjson" | ||
: "pretty"; | ||
} | ||
@@ -219,0 +223,0 @@ |
@@ -33,7 +33,7 @@ /** | ||
* @param {string} command | ||
* @param {string[]} args | ||
* @param {Array<string>} args | ||
* @param {import("child_process").SpawnOptions} [opts={}] | ||
* @returns {Promise<{exitCode: number}>} | ||
*/ | ||
export function spawn(command: string, args: string[], opts?: import("child_process").SpawnOptions | undefined): Promise<{ | ||
export function spawn(command: string, args: Array<string>, opts?: import("child_process").SpawnOptions | undefined): Promise<{ | ||
exitCode: number; | ||
@@ -40,0 +40,0 @@ }>; |
@@ -58,3 +58,3 @@ import { exec as cpExec, spawn as cpSpawn } from "node:child_process"; | ||
* @param {string} command | ||
* @param {string[]} args | ||
* @param {Array<string>} args | ||
* @param {import("child_process").SpawnOptions} [opts={}] | ||
@@ -61,0 +61,0 @@ * @returns {Promise<{exitCode: number}>} |
@@ -6,23 +6,23 @@ import { RandomUUIDOptions } from "crypto"; | ||
export type Either<T, E = AppError> = | ||
| { value: T; error?: never } | ||
| { value?: never; error: E }; | ||
| { value: T; error?: never } | ||
| { value?: never; error: E }; | ||
export type EitherN<T, E = AppError> = | ||
| { value: T; errors?: never } | ||
| { value?: never; errors: E[] }; | ||
| { value: T; errors?: never } | ||
| { value?: never; errors: E[] }; | ||
export interface NoopFn { | ||
(): void; | ||
(): void; | ||
} | ||
export interface UuidFunc { | ||
/** | ||
* Returns true if value conforms a basic uuid structure. | ||
* This check is case-insensitive. | ||
*/ | ||
isValid: (value: any) => boolean; | ||
/** | ||
* Returns true if value conforms a basic uuid structure. | ||
* This check is case-insensitive. | ||
*/ | ||
isValid: (value: any) => boolean; | ||
/** | ||
* Return a new uuid v4 | ||
*/ (options?: RandomUUIDOptions): string; | ||
/** | ||
* Return a new uuid v4 | ||
*/ (options?: RandomUUIDOptions): string; | ||
} | ||
@@ -34,12 +34,12 @@ | ||
export interface ProcessDirectoryOptions { | ||
/** | ||
* Skip node_modules directory, true by default | ||
*/ | ||
skipNodeModules?: boolean; | ||
/** | ||
* Skip node_modules directory, true by default | ||
*/ | ||
skipNodeModules?: boolean; | ||
/** | ||
* Skip files and directories starting with a '.', true | ||
* by default | ||
*/ | ||
skipDotFiles?: boolean; | ||
/** | ||
* Skip files and directories starting with a '.', true | ||
* by default | ||
*/ | ||
skipDotFiles?: boolean; | ||
} |
76086
2516
546
+ Added@types/node@22.7.5(transitive)
- Removed@types/node@22.5.4(transitive)
Updated@types/node@22.7.5