@compas/stdlib
Advanced tools
Comparing version 0.6.0 to 0.7.0
11
index.js
@@ -5,3 +5,3 @@ /// <reference path="./types/advanced-types.d.ts"> | ||
* @template T, E | ||
* @typedef {import("./types/advanced-types").Either<T, E>} Either | ||
* @typedef {import("./types/advanced-types.js").Either<T, E>} Either | ||
*/ | ||
@@ -11,3 +11,3 @@ | ||
* @template T,E | ||
* @typedef {import("./types/advanced-types").EitherN<T,E>} EitherN | ||
* @typedef {import("./types/advanced-types.js").EitherN<T,E>} EitherN | ||
*/ | ||
@@ -20,11 +20,11 @@ | ||
/** | ||
* @typedef {import("./src/config-loader").ConfigLoaderOptions} ConfigLoaderOptions | ||
* @typedef {import("./src/config-loader.js").ConfigLoaderOptions} ConfigLoaderOptions | ||
*/ | ||
/** | ||
* @typedef {import("./src/config-loader").ConfigLoaderResult} ConfigLoaderResult | ||
* @typedef {import("./src/config-loader.js").ConfigLoaderResult} ConfigLoaderResult | ||
*/ | ||
/** | ||
* @typedef {import("./src/events").InsightEvent} InsightEvent | ||
* @typedef {import("./src/events.js").InsightEvent} InsightEvent | ||
*/ | ||
@@ -86,2 +86,3 @@ | ||
loggerExtendGlobalContext, | ||
loggerDetermineDefaultDestination, | ||
} from "./src/logger.js"; | ||
@@ -88,0 +89,0 @@ |
{ | ||
"name": "@compas/stdlib", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "All kinds of utility functions", | ||
"main": "./index.js", | ||
"exports": { | ||
".": "./index.js", | ||
".": { | ||
"import": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"types": "./index.d.ts", | ||
"type": "module", | ||
@@ -20,6 +23,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@types/node": "20.4.2", | ||
"dotenv": "16.0.3", | ||
"@types/node": "20.5.1", | ||
"dotenv": "16.3.1", | ||
"lodash.merge": "4.6.2", | ||
"pino": "8.14.1" | ||
"pino": "8.15.0" | ||
}, | ||
@@ -26,0 +29,0 @@ "author": { |
import { existsSync } from "node:fs"; | ||
import { readFile } from "node:fs/promises"; | ||
import os from "node:os"; | ||
import { pathToFileURL } from "url"; | ||
import { pathToFileURL } from "node:url"; | ||
import { environment } from "./env.js"; | ||
@@ -6,0 +6,0 @@ import { AppError } from "./error.js"; |
// @ts-nocheck | ||
import { randomUUID } from "crypto"; | ||
import { randomUUID } from "node:crypto"; | ||
@@ -12,3 +12,3 @@ /** | ||
* | ||
* @type {import("../types/advanced-types").UuidFunc} | ||
* @type {import("../types/advanced-types.d.ts").UuidFunc} | ||
*/ | ||
@@ -15,0 +15,0 @@ export const uuid = randomUUID; |
// @ts-nocheck | ||
import { inspect } from "util"; | ||
import { inspect } from "node:util"; | ||
import { isNil, isPlainObject } from "./lodash.js"; | ||
@@ -5,0 +5,0 @@ |
@@ -15,8 +15,21 @@ import { AppError } from "./error.js"; | ||
/** | ||
* Manually track (async) function duration. | ||
* The insight event is a tool for tracking the duration of (async) functions manually. | ||
* By utilizing the insight event, you can gain access to a task or request-specific logger and | ||
* obtain insights into the execution time of your functions. | ||
* | ||
* By passing the event down through (async) functions, it facilitates a unified way to | ||
* have access to a task / request specific logger and insights in the duration of your | ||
* functions. | ||
* How to use the Insight Event: | ||
* | ||
* Start by retrieving a root event. It can be created by calling {@link newEvent} | ||
* and passing it a logger. When you use the {@link getApp} from @compas/store, | ||
* it automatically adds a root event to `ctx.event`. | ||
* In your tests you can use {@link newTestEvent}. | ||
* | ||
* You could pass the event object down through your (async) functions as an argument. | ||
* This allows the insight event to associate the event with the specific task or request. | ||
* | ||
* Finally, you should stop the event for correct logging by calling {@link eventStop}. | ||
* When the root event is stopped via {@link eventStop} it calculates the duration | ||
* by subtracting the start time from the end time. the event can log the start | ||
* and end times of the function execution if necessary. | ||
* | ||
* @example | ||
@@ -23,0 +36,0 @@ * async function userList(event) { |
@@ -1,4 +0,4 @@ | ||
import { relative } from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { inspect } from "util"; | ||
import { relative } from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import { inspect } from "node:util"; | ||
@@ -5,0 +5,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import pino from "pino"; | ||
import { pino } from "pino"; | ||
import { environment, isProduction } from "./env.js"; | ||
@@ -3,0 +3,0 @@ import { AppError } from "./error.js"; |
@@ -1,6 +0,6 @@ | ||
import { exec as cpExec, spawn as cpSpawn } from "child_process"; | ||
import { lstatSync, readdirSync } from "fs"; | ||
import { lstat, readdir } from "fs/promises"; | ||
import { posix } from "path"; | ||
import { promisify } from "util"; | ||
import { exec as cpExec, spawn as cpSpawn } from "node:child_process"; | ||
import { lstatSync, readdirSync } from "node:fs"; | ||
import { lstat, readdir } from "node:fs/promises"; | ||
import { posix } from "node:path"; | ||
import { promisify } from "node:util"; | ||
@@ -7,0 +7,0 @@ const internalExec = promisify(cpExec); |
@@ -1,6 +0,6 @@ | ||
import { lstatSync, realpathSync } from "fs"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { setFlagsFromString } from "v8"; | ||
import { runInNewContext } from "vm"; | ||
import { lstatSync, realpathSync } from "node:fs"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import { setFlagsFromString } from "node:v8"; | ||
import { runInNewContext } from "node:vm"; | ||
import dotenv from "dotenv"; | ||
@@ -31,3 +31,3 @@ import { environment, isProduction, refreshEnvironmentCache } from "./env.js"; | ||
* @since 0.1.0 | ||
* @type {import("../types/advanced-types").NoopFn} | ||
* @type {import("../types/advanced-types.d.ts").NoopFn} | ||
*/ | ||
@@ -34,0 +34,0 @@ export function noop() {} |
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
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
0
0
47703
16
1669
+ Added@types/node@20.5.1(transitive)
+ Addeddotenv@16.3.1(transitive)
+ Addedpino@8.15.0(transitive)
- Removed@types/node@20.4.2(transitive)
- Removeddotenv@16.0.3(transitive)
- Removedpino@8.14.1(transitive)
Updated@types/node@20.5.1
Updateddotenv@16.3.1
Updatedpino@8.15.0