diagnostic-channel

  • Version 1.1.1
  • Published
  • 23.3 kB
  • 1 dependency
  • MIT license

Install

npm i diagnostic-channel
yarn add diagnostic-channel
pnpm add diagnostic-channel

Overview

Provides a context-saving pub/sub channel to connect diagnostic event publishers and subscribers

Index

Variables

variable channel

const channel: IChannel;

    Functions

    function makePatchingRequire

    makePatchingRequire: (
    knownPatches: IModulePatchMap
    ) => (moduleId: string) => any;

      function trueFilter

      trueFilter: (publishing: boolean) => boolean;

        Classes

        class ContextPreservingEventEmitter

        class ContextPreservingEventEmitter implements IChannel {}

          property modulesPatched

          modulesPatched: IPatchedModule[];

            property spanContextPropagator

            spanContextPropagator: any;

              property version

              version: string;

                method addContextPreservation

                addContextPreservation: <T extends Function>(preserver: (cb: T) => T) => void;

                  method addPatchedModule

                  addPatchedModule: (name: string, version: string) => void;

                    method bindToContext

                    bindToContext: <T extends Function>(cb: T) => T;

                      method getPatchesObject

                      getPatchesObject: () => IModulePatchMap;

                        method publish

                        publish: <T>(name: string, event: T) => void;

                          method registerMonkeyPatch

                          registerMonkeyPatch: (packageName: string, patcher: IModulePatcher) => void;

                            method reset

                            reset: () => void;

                              method shouldPublish

                              shouldPublish: (name: string) => boolean;

                                method subscribe

                                subscribe: <T>(
                                name: string,
                                listener: ISubscriber<T>,
                                filter?: IFilter,
                                patchCallback?: IPatchedCallback
                                ) => void;

                                  method unsubscribe

                                  unsubscribe: <T>(
                                  name: string,
                                  listener: ISubscriber<T>,
                                  filter?: IFilter
                                  ) => boolean;

                                    Interfaces

                                    interface IChannel

                                    interface IChannel {}

                                      method addContextPreservation

                                      addContextPreservation: <T extends Function>(preserver: (cb: T) => T) => void;

                                        method addPatchedModule

                                        addPatchedModule: (moduleName: string, version: string) => void;

                                          method bindToContext

                                          bindToContext: <T extends Function>(cb: T) => T;

                                            method getPatchesObject

                                            getPatchesObject: () => IModulePatchMap;

                                              method publish

                                              publish: <T>(name: string, event: T) => void;

                                                method registerMonkeyPatch

                                                registerMonkeyPatch: (packageName: string, patcher: IModulePatcher) => void;

                                                  method shouldPublish

                                                  shouldPublish: (name: string) => boolean;

                                                    method subscribe

                                                    subscribe: <T>(
                                                    name: string,
                                                    listener: ISubscriber<T>,
                                                    filter?: IFilter,
                                                    patchCallback?: IPatchedCallback
                                                    ) => void;

                                                      method unsubscribe

                                                      unsubscribe: <T>(
                                                      name: string,
                                                      listener: ISubscriber<T>,
                                                      filter?: IFilter
                                                      ) => void;

                                                        interface IModulePatcher

                                                        interface IModulePatcher {}

                                                          property patch

                                                          patch: PatchFunction;

                                                            property publisherName

                                                            publisherName?: string;

                                                              property versionSpecifier

                                                              versionSpecifier: string;

                                                                interface ISpanContext

                                                                interface ISpanContext {}

                                                                  property spanId

                                                                  spanId: string;

                                                                    property traceFlags

                                                                    traceFlags?: string;

                                                                      property traceId

                                                                      traceId: string;

                                                                        property tracestate

                                                                        tracestate?: string;

                                                                          interface IStandardEvent

                                                                          interface IStandardEvent<T> {}

                                                                            property data

                                                                            data: T;

                                                                              property timestamp

                                                                              timestamp: number;

                                                                                Type Aliases

                                                                                type IFilter

                                                                                type IFilter = (publishing: boolean) => boolean;

                                                                                  type IPatchedCallback

                                                                                  type IPatchedCallback = (moduleName: string, version: string) => void;

                                                                                    type ISubscriber

                                                                                    type ISubscriber<T> = (event: IStandardEvent<T>) => void;

                                                                                      type PatchFunction

                                                                                      type PatchFunction = (module: any, path: string) => any;

                                                                                        Package Files (2)

                                                                                        Dependencies (1)

                                                                                        Dev Dependencies (6)

                                                                                        Peer Dependencies (0)

                                                                                        No peer dependencies.

                                                                                        Badge

                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/diagnostic-channel.

                                                                                        • Markdown
                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/diagnostic-channel)
                                                                                        • HTML
                                                                                          <a href="https://www.jsdocs.io/package/diagnostic-channel"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>