@axiomhq/pino
Advanced tools
Comparing version 0.1.3 to 1.0.0-rc.1
@@ -10,2 +10,12 @@ # Changelog | ||
## [1.0.0-rc.1] - 2023-09-27 | ||
### Breaking Change | ||
- Axiom token is now required as a parameter of the constructor, automatic detection of environment variables is now removed. | ||
## Fixed | ||
- switched the build process to use rollup in order to solves the module resolution issue. | ||
## [0.1.2] - 2023-06-26 | ||
@@ -12,0 +22,0 @@ |
import build from 'pino-abstract-transport'; | ||
import { Axiom } from '@axiomhq/js'; | ||
// The browsers don't have process.env, fake it | ||
const process = typeof window === 'undefined' ? global.process : { env: {} }; | ||
export var AxiomEventLevel; | ||
var AxiomEventLevel; | ||
(function (AxiomEventLevel) { | ||
@@ -15,5 +14,5 @@ AxiomEventLevel["Trace"] = "trace"; | ||
})(AxiomEventLevel || (AxiomEventLevel = {})); | ||
export default async function axiomTransport(options) { | ||
async function axiomTransport(options) { | ||
const axiom = new Axiom(options); | ||
const dataset = options?.dataset || process.env.AXIOM_DATASET; | ||
const dataset = options.dataset; | ||
return build(async function (source) { | ||
@@ -32,3 +31,3 @@ for await (const obj of source) { | ||
// See https://github.com/pinojs/pino/blob/master/docs/api.md#loggerlevel-string-gettersetter | ||
export const mapLogLevel = (level) => { | ||
const mapLogLevel = (level) => { | ||
if (typeof level === 'string') { | ||
@@ -57,2 +56,4 @@ return level; | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
export { AxiomEventLevel, axiomTransport as default, mapLogLevel }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@axiomhq/pino", | ||
"version": "0.1.3", | ||
"version": "1.0.0-rc.1", | ||
"description": "The official Axiom transport for Pino", | ||
"main": "dist/cjs/index.ts", | ||
"types": "dist/types/index.d.ts", | ||
"type": "module", | ||
"types": "dist/esm/types/index.d.ts", | ||
"module": "dist/esm/index.js", | ||
"main": "dist/cjs/index.cjs", | ||
"author": "Axiom, Inc.", | ||
@@ -28,20 +29,19 @@ "license": "MIT", | ||
"exports": { | ||
"types": "./dist/esm/types/index.d.ts", | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"default": "./dist/cjs/index.js", | ||
"types": "./dist/types/index.d.ts" | ||
"require": "./dist/cjs/index.cjs", | ||
"default": "./dist/esm/index.js" | ||
}, | ||
"dependencies": { | ||
"pino-abstract-transport": "^1.0.0", | ||
"@axiomhq/js": "0.1.3" | ||
"@axiomhq/js": "1.0.0-rc.1" | ||
}, | ||
"scripts": { | ||
"build": "tsc -b", | ||
"build:esm": "tsc --project tsconfig.esm.json", | ||
"build": "rollup -c rollup.config.js", | ||
"build:cjs": "rollup -c rollup.config.cjs.js", | ||
"format": "eslint 'src/**/*.{js,ts}' --quiet --fix", | ||
"lint": "eslint 'src/**/*.{js,ts}'", | ||
"test": "jest test/unit", | ||
"prepublish": "npm run build && npm run build:esm", | ||
"cover": "nyc -r text -e .ts -x 'tests/unit/**/*.spec.ts' npm run test" | ||
"test": "vitest run test/unit/* --coverage", | ||
"prepublish": "npm run build && npm run build:cjs" | ||
} | ||
} |
import build from 'pino-abstract-transport'; | ||
import { Axiom, ClientOptions } from '@axiomhq/js'; | ||
// The browsers don't have process.env, fake it | ||
const process: { env: Record<string, string | undefined> } = | ||
typeof window === 'undefined' ? global.process : { env: {} }; | ||
export enum AxiomEventLevel { | ||
@@ -19,9 +15,10 @@ Trace = 'trace', | ||
export interface Options extends ClientOptions { | ||
dataset?: string; | ||
dataset: string; | ||
} | ||
export default async function axiomTransport(options?: Options) { | ||
export default async function axiomTransport(options: Options) { | ||
const axiom = new Axiom(options); | ||
const dataset = options?.dataset || process.env.AXIOM_DATASET; | ||
const dataset = options.dataset; | ||
return build( | ||
@@ -38,3 +35,3 @@ async function (source: any) { | ||
axiom.ingest(dataset!, event); | ||
axiom.ingest(dataset, event); | ||
} | ||
@@ -41,0 +38,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import { describe, it, expect } from '@jest/globals'; | ||
import { describe, it, expect } from 'vitest'; | ||
import axiomTransport from '../../src'; | ||
@@ -6,3 +6,3 @@ | ||
it('creates a truthy instance', () => { | ||
const t = axiomTransport(); | ||
const t = axiomTransport({ token: process.env.AXIOM_TOKEN || '', dataset: process.env.AXIOM_DATASET || ''}); | ||
expect(t).toBeTruthy(); | ||
@@ -9,0 +9,0 @@ expect(t).toBeDefined(); |
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"target": "ES5", | ||
"module": "Commonjs", | ||
"baseUrl": ".", | ||
"target": "ESNext", | ||
"module": "ES6", | ||
"moduleResolution": "node", | ||
"rootDir": "./src", | ||
"outDir": "dist/cjs", | ||
"outDir": "dist", | ||
"declarationDir": "dist/types" | ||
@@ -9,0 +11,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
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
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
75329
29
387
0
Yes
1
+ Added@axiomhq/js@1.0.0-rc.1(transitive)
- Removed@axiomhq/js@0.1.3(transitive)
- Removedcross-fetch@3.1.8(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
Updated@axiomhq/js@1.0.0-rc.1