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

@trigger.dev/core-backend

Package Overview
Dependencies
Maintainers
4
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trigger.dev/core-backend - npm Package Compare versions

Comparing version 0.0.0-svelte-test-20231206141434 to 0.0.0-yalt-20231214135505

15

dist/index.d.ts

@@ -12,2 +12,15 @@ declare class BloomFilter {

export { BloomFilter };
type LogLevel = "log" | "error" | "warn" | "info" | "debug";
declare class Logger {
#private;
constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown, additionalFields?: () => Record<string, unknown>);
filter(...keys: string[]): Logger;
static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel): boolean;
log(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
error(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
warn(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
info(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
debug(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
}
export { BloomFilter, type LogLevel, Logger };
'use strict';
var node_buffer = require('node:buffer');
var node_process = require('node:process');

@@ -12,2 +13,24 @@ var __defProp = Object.defineProperty;

};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
var __privateMethod = (obj, member, method) => {
__accessCheck(obj, member, "access private method");
return method;
};
var _BloomFilter = class _BloomFilter {

@@ -62,5 +85,165 @@ constructor(size) {

__name(murmurHash3, "murmurHash3");
var logLevels = [
"log",
"error",
"warn",
"info",
"debug"
];
var _name, _level, _filteredKeys, _jsonReplacer, _additionalFields, _structuredLog, structuredLog_fn;
var _Logger = class _Logger {
constructor(name, level = "info", filteredKeys = [], jsonReplacer, additionalFields) {
__privateAdd(this, _structuredLog);
__privateAdd(this, _name, void 0);
__privateAdd(this, _level, void 0);
__privateAdd(this, _filteredKeys, []);
__privateAdd(this, _jsonReplacer, void 0);
__privateAdd(this, _additionalFields, void 0);
__privateSet(this, _name, name);
__privateSet(this, _level, logLevels.indexOf(node_process.env.TRIGGER_LOG_LEVEL ?? level));
__privateSet(this, _filteredKeys, filteredKeys);
__privateSet(this, _jsonReplacer, createReplacer(jsonReplacer));
__privateSet(this, _additionalFields, additionalFields ?? (() => ({})));
}
// Return a new Logger instance with the same name and a new log level
// but filter out the keys from the log messages (at any level)
filter(...keys) {
return new _Logger(__privateGet(this, _name), logLevels[__privateGet(this, _level)], keys, __privateGet(this, _jsonReplacer));
}
static satisfiesLogLevel(logLevel, setLevel) {
return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);
}
log(message, ...args) {
if (__privateGet(this, _level) < 0)
return;
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
}
error(message, ...args) {
if (__privateGet(this, _level) < 1)
return;
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
}
warn(message, ...args) {
if (__privateGet(this, _level) < 2)
return;
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
}
info(message, ...args) {
if (__privateGet(this, _level) < 3)
return;
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
}
debug(message, ...args) {
if (__privateGet(this, _level) < 4)
return;
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
}
};
_name = new WeakMap();
_level = new WeakMap();
_filteredKeys = new WeakMap();
_jsonReplacer = new WeakMap();
_additionalFields = new WeakMap();
_structuredLog = new WeakSet();
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
const structuredLog = {
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
...__privateGet(this, _additionalFields).call(this),
timestamp: /* @__PURE__ */ new Date(),
name: __privateGet(this, _name),
message,
level
};
loggerFunction(JSON.stringify(structuredLog, __privateGet(this, _jsonReplacer)));
}, "#structuredLog");
__name(_Logger, "Logger");
var Logger = _Logger;
function createReplacer(replacer) {
return (key, value) => {
if (typeof value === "bigint") {
return value.toString();
}
if (replacer) {
return replacer(key, value);
}
return value;
};
}
__name(createReplacer, "createReplacer");
function bigIntReplacer(_key, value) {
if (typeof value === "bigint") {
return value.toString();
}
return value;
}
__name(bigIntReplacer, "bigIntReplacer");
function safeJsonClone(obj) {
try {
return JSON.parse(JSON.stringify(obj, bigIntReplacer));
} catch (e) {
return;
}
}
__name(safeJsonClone, "safeJsonClone");
function structureArgs(args, filteredKeys = []) {
if (!args) {
return;
}
if (args.length === 0) {
return;
}
if (args.length === 1 && typeof args[0] === "object") {
return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);
}
return args;
}
__name(structureArgs, "structureArgs");
function filterKeys(obj, keys) {
if (typeof obj !== "object" || obj === null) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map((item) => filterKeys(item, keys));
}
const filteredObj = {};
for (const [key, value] of Object.entries(obj)) {
if (keys.includes(key)) {
if (value) {
filteredObj[key] = `[filtered ${prettyPrintBytes(value)}]`;
} else {
filteredObj[key] = value;
}
continue;
}
filteredObj[key] = filterKeys(value, keys);
}
return filteredObj;
}
__name(filterKeys, "filterKeys");
function prettyPrintBytes(value) {
if (node_process.env.NODE_ENV === "production") {
return "skipped size";
}
const sizeInBytes = getSizeInBytes(value);
if (sizeInBytes < 1024) {
return `${sizeInBytes} bytes`;
}
if (sizeInBytes < 1024 * 1024) {
return `${(sizeInBytes / 1024).toFixed(2)} KB`;
}
if (sizeInBytes < 1024 * 1024 * 1024) {
return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;
}
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
}
__name(prettyPrintBytes, "prettyPrintBytes");
function getSizeInBytes(value) {
const jsonString = JSON.stringify(value);
return node_buffer.Buffer.byteLength(jsonString, "utf8");
}
__name(getSizeInBytes, "getSizeInBytes");
exports.BloomFilter = BloomFilter;
exports.Logger = Logger;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@trigger.dev/core-backend",
"version": "0.0.0-svelte-test-20231206141434",
"version": "0.0.0-yalt-20231214135505",
"description": "Core code used across `@trigger.dev/sdk` and Trigger.dev server",

@@ -5,0 +5,0 @@ "license": "MIT",

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