Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@4lch4/backpack

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4lch4/backpack - npm Package Compare versions

Comparing version 0.0.6-1 to 0.0.7

dist/apis/index.d.ts

29

dist/constants/env/Axiom.d.ts
/**
* An Enum of all the environment variables that can be used to configure access to [Axiom][0] for
* logging.
* logging. I like having this enum specifically because I fat finger variable names all the time
* and am prone to forgetting what they are. This enum helps me avoid all of that.
*
* [0]: https://axiom.co
*/
export declare enum AxiomConfigVariable {
export declare enum AxiomVar {
/** Specifies which dataset to send logs to. */

@@ -16,6 +17,28 @@ dataset = "AXIOM_DATASET",

/**
* An Enum of all the datasets I have configured in [Axiom][0].
* The dataset to use for logging to [Axiom][0]. The value is retrieved from the environment
* variable with the name specified by {@link AxiomVar.dataset}.
*
* [0]: https://axiom.co
*/
export declare const AxiomDataSet: string | undefined;
/**
* The token to use for logging to [Axiom][0]. The value is retrieved from the environment variable
* with the name specified by {@link AxiomVar.token}.
*
* [0]: https://axiom.co
*/
export declare const AxiomToken: string | undefined;
/**
* The organization ID to use for logging to [Axiom][0]. The value is retrieved from the environment
* variable with the name specified by {@link AxiomVar.orgId}.
*
* [0]: https://axiom.co
*/
export declare const AxiomOrgId: string | undefined;
/**
* An Enum of all the datasets I have configured in [Axiom][0]. I'm not entirely sure if I'll keep
* this one around, but I'm keeping it for now.
*
* [0]: https://axiom.co
*/
export declare enum AxiomDataset {

@@ -22,0 +45,0 @@ /** The default dataset to use for my various services. */

39

dist/constants/env/Axiom.js
/**
* An Enum of all the environment variables that can be used to configure access to [Axiom][0] for
* logging.
* logging. I like having this enum specifically because I fat finger variable names all the time
* and am prone to forgetting what they are. This enum helps me avoid all of that.
*
* [0]: https://axiom.co
*/
export var AxiomConfigVariable;
(function (AxiomConfigVariable) {
export var AxiomVar;
(function (AxiomVar) {
/** Specifies which dataset to send logs to. */
AxiomConfigVariable["dataset"] = "AXIOM_DATASET";
AxiomVar["dataset"] = "AXIOM_DATASET";
/** The token to use to authenticate with Axiom. */
AxiomConfigVariable["token"] = "AXIOM_TOKEN";
AxiomVar["token"] = "AXIOM_TOKEN";
/** The organization ID to use to authenticate with Axiom. */
AxiomConfigVariable["orgId"] = "AXIOM_ORG_ID";
})(AxiomConfigVariable || (AxiomConfigVariable = {}));
AxiomVar["orgId"] = "AXIOM_ORG_ID";
})(AxiomVar || (AxiomVar = {}));
/**
* An Enum of all the datasets I have configured in [Axiom][0].
* The dataset to use for logging to [Axiom][0]. The value is retrieved from the environment
* variable with the name specified by {@link AxiomVar.dataset}.
*
* [0]: https://axiom.co
*/
export const AxiomDataSet = process.env[AxiomVar.dataset];
/**
* The token to use for logging to [Axiom][0]. The value is retrieved from the environment variable
* with the name specified by {@link AxiomVar.token}.
*
* [0]: https://axiom.co
*/
export const AxiomToken = process.env[AxiomVar.token];
/**
* The organization ID to use for logging to [Axiom][0]. The value is retrieved from the environment
* variable with the name specified by {@link AxiomVar.orgId}.
*
* [0]: https://axiom.co
*/
export const AxiomOrgId = process.env[AxiomVar.orgId];
/**
* An Enum of all the datasets I have configured in [Axiom][0]. I'm not entirely sure if I'll keep
* this one around, but I'm keeping it for now.
*
* [0]: https://axiom.co
*/
export var AxiomDataset;

@@ -22,0 +45,0 @@ (function (AxiomDataset) {

export * as constants from './constants/index.js';
export * from './lib/index.js';
export * from './apis/Elysia.js';
//# sourceMappingURL=index.d.ts.map
export * as constants from './constants/index.js';
export * from './lib/index.js';
export * from './apis/index.js';
//# sourceMappingURL=index.js.map

@@ -0,3 +1,6 @@

import { WinstonTransport } from '@axiomhq/winston';
import Winston from 'winston';
export declare const ConsoleTransport: Winston.transports.ConsoleTransportInstance;
export declare function AxiomTransport(dataset: string, token: string, orgId: string): WinstonTransport;
export declare const logger: Winston.Logger;
//# sourceMappingURL=Logger.d.ts.map
import { WinstonTransport } from '@axiomhq/winston';
import { DEFAULT_LOG_HOSTNAME, DEFAULT_LOG_NODE_ENV, DEFAULT_LOG_SERVICE, } from '../constants/log/index.js';
import { AxiomDataSet, AxiomOrgId, AxiomToken, DEFAULT_LOG_HOSTNAME, DEFAULT_LOG_NODE_ENV, DEFAULT_LOG_SERVICE, } from '../constants/index.js';
import { arch, platform } from 'os';
import Winston, { transports as WinstonTransports } from 'winston';
const transports = [
new WinstonTransports.Console({
format: Winston.format.combine(Winston.format.colorize({ colors: { success: 'cyan', info: 'gray' } }), Winston.format.simple()),
}),
];
export const ConsoleTransport = new WinstonTransports.Console({
format: Winston.format.combine(Winston.format.colorize({ colors: { success: 'green', info: 'cyan' } }), Winston.format.simple()),
});
export function AxiomTransport(dataset, token, orgId) {
return new WinstonTransport({ dataset, token, orgId });
}
const transports = [ConsoleTransport];
// Ensure that we only log to Axiom if all required environment variables are set.
if (process.env.AXIOM_DATASET && process.env.AXIOM_TOKEN && process.env.AXIOM_ORG_ID) {
transports.push(new WinstonTransport({
dataset: process.env.AXIOM_DATASET,
token: process.env.AXIOM_TOKEN,
orgId: process.env.AXIOM_ORG_ID,
}));
if (AxiomDataSet && AxiomOrgId && AxiomToken) {
transports.push(AxiomTransport(AxiomDataSet, AxiomToken, AxiomOrgId));
}
export const logger = Winston.createLogger({
defaultMeta: {
service: process.env.LOG_SERVICE || DEFAULT_LOG_SERVICE,
service: process.env.LOG_SERVICE || process.env.APP_NAME || DEFAULT_LOG_SERVICE,
nodeEnv: process.env.NODE_ENV || DEFAULT_LOG_NODE_ENV,

@@ -22,0 +20,0 @@ hostname: process.env.HOSTNAME || DEFAULT_LOG_HOSTNAME,

{
"name": "@4lch4/backpack",
"displayName": "4lch4's Backpack",
"version": "0.0.6-1",
"version": "0.0.7",
"description": "A collection of useful functions, constants, and more, for use in a variety of NodeJS packages/projects.",

@@ -33,9 +33,13 @@ "keywords": [

"lint": "prettier -c .",
"pretty": "prettier --write ."
"pretty": "prettier --write .",
"prepublish": "bun test"
},
"dependencies": {
"@axiomhq/winston": "^1.0.0-rc.1",
"cli-table": "^0.3.11",
"elysia": "^0.7.21",
"winston": "^3.11.0"
},
"devDependencies": {
"@types/cli-table": "^0.3.3",
"@types/node": "^20.8.6",

@@ -50,3 +54,4 @@ "bun-types": "^1.0.6",

"engines": {
"node": ">=16.0.0"
"node": ">=16.0.0",
"bun": ">=1.0.0"
},

@@ -53,0 +58,0 @@ "publishConfig": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc