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

@fluent-org/logger

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluent-org/logger - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

7

build/src/event_retrier.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventRetrier = void 0;
const pDefer = require("p-defer");
const error_1 = require("./error");

@@ -21,3 +20,3 @@ const util_1 = require("./util");

};
this.cancelWait = pDefer();
this.cancelWait = util_1.pDefer();
}

@@ -31,3 +30,3 @@ /**

// Reinitialize the promise so this class can continue to be reused
this.cancelWait = pDefer();
this.cancelWait = util_1.pDefer();
resolve();

@@ -48,3 +47,3 @@ // The Promise.resolve PromiseJob will be enqueued after all the resolve functions on cancelWait.

// Reinitialize the promise so this class can continue to be reused
this.cancelWait = pDefer();
this.cancelWait = util_1.pDefer();
reject(new error_1.RetryShutdownError("Retries were shut down"));

@@ -51,0 +50,0 @@ // The Promise.resolve PromiseJob will be enqueued after all the resolve functions on cancelWait.

@@ -1,8 +0,8 @@

import * as pDefer from "p-defer";
import { Queue, PacketData } from "./queue";
import * as protocol from "../protocol";
import { DeferredPromise } from "../util";
declare type ForwardRecord = {
tag: protocol.Tag;
entries: protocol.Entry[];
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -9,0 +9,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForwardQueue = void 0;
const pDefer = require("p-defer");
const queue_1 = require("./queue");
const protocol = require("../protocol");
const util_1 = require("../util");
/**

@@ -44,3 +44,3 @@ * Implements the Forward specification's [Forward mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#forward-mode)

else {
const deferred = pDefer();
const deferred = util_1.pDefer();
this.sendQueue.set(tag, {

@@ -47,0 +47,0 @@ tag,

@@ -1,4 +0,4 @@

import * as pDefer from "p-defer";
import { Queue, PacketData } from "./queue";
import * as protocol from "../protocol";
import { DeferredPromise } from "../util";
declare type EventRecord = {

@@ -8,3 +8,3 @@ tag: protocol.Tag;

event: protocol.EventRecord;
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -11,0 +11,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageQueue = void 0;
const pDefer = require("p-defer");
const queue_1 = require("./queue");
const protocol = require("../protocol");
const util_1 = require("../util");
/**

@@ -33,3 +33,3 @@ * Implements the Forward specification's [Message mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#message-modes)

push(tag, time, event) {
const deferred = pDefer();
const deferred = util_1.pDefer();
this.sendQueue.add({

@@ -36,0 +36,0 @@ tag,

@@ -1,4 +0,4 @@

import * as pDefer from "p-defer";
import { PacketData, Queue } from "./queue";
import * as protocol from "../protocol";
import { DeferredPromise } from "../util";
declare type PackedRecord = {

@@ -13,3 +13,3 @@ tag: protocol.Tag;

size: number;
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -16,0 +16,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompressedPackedForwardQueue = exports.PackedForwardQueue = void 0;
const pDefer = require("p-defer");
const queue_1 = require("./queue");
const protocol = require("../protocol");
const util_1 = require("../util");
/**

@@ -55,3 +55,3 @@ * Implements the Forward specification's [(Compressed)?PackedForward mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#packedforward-mode)

else {
const deferred = pDefer();
const deferred = util_1.pDefer();
this.sendQueue.set(tag, {

@@ -58,0 +58,0 @@ tag,

import * as protocol from "../protocol";
import { DeferredPromise } from "p-defer";
import { DeferredPromise } from "../util";
/**

@@ -4,0 +4,0 @@ * Every queue must have this type of data

/// <reference types="node" />
import * as net from "net";
import * as tls from "tls";
import * as EventEmitter from "events";
import { EventEmitter } from "events";
import * as protocol from "./protocol";

@@ -6,0 +6,0 @@ /**

@@ -7,3 +7,3 @@ "use strict";

const crypto = require("crypto");
const EventEmitter = require("events");
const events_1 = require("events");
const protocol = require("./protocol");

@@ -28,3 +28,3 @@ const error_1 = require("./error");

*/
class FluentServer extends EventEmitter {
class FluentServer extends events_1.EventEmitter {
/**

@@ -31,0 +31,0 @@ * Creates a new server

/// <reference types="node" />
import * as tls from "tls";
import * as EventEmitter from "events";
import { EventEmitter } from "events";
import * as protocol from "./protocol";

@@ -5,0 +5,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

const tls = require("tls");
const EventEmitter = require("events");
const events_1 = require("events");
const error_1 = require("./error");

@@ -182,3 +182,3 @@ const protocol = require("./protocol");

*/
class FluentSocket extends EventEmitter {
class FluentSocket extends events_1.EventEmitter {
/**

@@ -185,0 +185,0 @@ * Creates a new socket

export declare const awaitAtMost: <T>(promise: Promise<T>, timeout: number) => Promise<unknown>;
export declare const awaitNextTick: () => Promise<void>;
export declare const awaitTimeout: (timeout: number) => Promise<void>;
export interface DeferredPromise<T> {
promise: Promise<T>;
resolve(value?: T | PromiseLike<T>): void;
reject(reason?: unknown): void;
}
export declare const pDefer: <T>() => DeferredPromise<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.awaitTimeout = exports.awaitNextTick = exports.awaitAtMost = void 0;
exports.pDefer = exports.awaitTimeout = exports.awaitNextTick = exports.awaitAtMost = void 0;
const awaitAtMost = (promise, timeout) => {

@@ -25,2 +25,11 @@ let timeoutId = null;

exports.awaitTimeout = awaitTimeout;
const pDefer = () => {
const deferred = {};
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
};
exports.pDefer = pDefer;
//# sourceMappingURL=util.js.map
{
"name": "@fluent-org/logger",
"version": "1.0.3",
"version": "1.0.4",
"description": "A node fluent protocol compatible logger",

@@ -33,12 +33,11 @@ "main": "./build/src/index.js",

"dependencies": {
"@msgpack/msgpack": "^2.7.0",
"p-defer": "^3.0.0"
"@msgpack/msgpack": "^2.7.1"
},
"devDependencies": {
"@types/chai": "^4.2.19",
"@types/chai": "^4.2.22",
"@types/chai-as-promised": "^7.1.4",
"@types/duplexer3": "^0.1.0",
"@types/mocha": "^8.2.2",
"@types/node": "^14.11.2",
"@types/sinon": "^10.0.2",
"@types/duplexer3": "^0.1.1",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.10",
"@types/sinon": "^10.0.6",
"chai": "^4.3.4",

@@ -49,5 +48,5 @@ "chai-as-promised": "^7.1.1",

"gts": "^3.1.0",
"mocha": "^9.0.1",
"sinon": "^11.1.1",
"typedoc": "^0.21.0",
"mocha": "^9.1.3",
"sinon": "^12.0.1",
"typedoc": "^0.22.9",
"typescript": "^4.0.3"

@@ -54,0 +53,0 @@ },

@@ -164,5 +164,5 @@ import * as crypto from "crypto";

} catch (e) {
return this.close(CloseState.FATAL, e);
return this.close(CloseState.FATAL, e as Error);
}
}
}

@@ -19,6 +19,10 @@ import {

} from "./modes";
import {DeferredPromise} from "p-defer";
import * as crypto from "crypto";
import {EventRetrier, EventRetryOptions} from "./event_retrier";
import {awaitAtMost, awaitNextTick, awaitTimeout} from "./util";
import {
DeferredPromise,
awaitAtMost,
awaitNextTick,
awaitTimeout,
} from "./util";

@@ -25,0 +29,0 @@ type AckData = {

@@ -1,4 +0,3 @@

import * as pDefer from "p-defer";
import {DroppedError, RetryShutdownError} from "./error";
import {awaitAtMost} from "./util";
import {awaitAtMost, pDefer, DeferredPromise} from "./util";

@@ -51,3 +50,3 @@ /**

private options: EventRetryOptions;
private cancelWait: pDefer.DeferredPromise<void>;
private cancelWait: DeferredPromise<void>;
constructor(opts: Partial<EventRetryOptions> = {}) {

@@ -124,3 +123,3 @@ this.options = {

this.options.onError(e);
this.options.onError(e as Error);

@@ -127,0 +126,0 @@ const retryInterval = Math.min(

@@ -1,4 +0,4 @@

import * as pDefer from "p-defer";
import {Queue, PacketData} from "./queue";
import * as protocol from "../protocol";
import {pDefer, DeferredPromise} from "../util";

@@ -8,3 +8,3 @@ type ForwardRecord = {

entries: protocol.Entry[];
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -11,0 +11,0 @@

@@ -1,4 +0,4 @@

import * as pDefer from "p-defer";
import {Queue, PacketData} from "./queue";
import * as protocol from "../protocol";
import {pDefer, DeferredPromise} from "../util";

@@ -9,3 +9,3 @@ type EventRecord = {

event: protocol.EventRecord;
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -12,0 +12,0 @@

@@ -1,4 +0,4 @@

import * as pDefer from "p-defer";
import {PacketData, Queue} from "./queue";
import * as protocol from "../protocol";
import {pDefer, DeferredPromise} from "../util";

@@ -14,3 +14,3 @@ type PackedRecord = {

size: number;
deferred: pDefer.DeferredPromise<void>;
deferred: DeferredPromise<void>;
};

@@ -17,0 +17,0 @@

import * as protocol from "../protocol";
import {DeferredPromise} from "p-defer";
import {DroppedError, QueueShutdownError} from "../error";
import {DeferredPromise} from "../util";

@@ -5,0 +5,0 @@ /**

import * as net from "net";
import * as tls from "tls";
import * as crypto from "crypto";
import * as EventEmitter from "events";
import {EventEmitter} from "events";
import * as protocol from "./protocol";

@@ -193,3 +193,3 @@ import {UnexpectedMessageError} from "./error";

false,
e.message,
(e as Error).message,
clientInfo.sharedKeyInfo

@@ -196,0 +196,0 @@ );

import * as net from "net";
import * as tls from "tls";
import * as EventEmitter from "events";
import {EventEmitter} from "events";
import {

@@ -5,0 +5,0 @@ SocketTimeoutError,

@@ -27,1 +27,16 @@ export const awaitAtMost = <T>(

};
export interface DeferredPromise<T> {
promise: Promise<T>;
resolve(value?: T | PromiseLike<T>): void;
reject(reason?: unknown): void;
}
export const pDefer = <T>(): DeferredPromise<T> => {
const deferred: Partial<DeferredPromise<T>> = {};
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred as DeferredPromise<T>;
};

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

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