diff --git a/.npmrc b/.npmrc index 025fe3f..5c85ebf 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -publish-branch=v0.8.x \ No newline at end of file +publish-branch=v0.9.x diff --git a/docs/ts-simple-db-mysql/classes/SimpleDbMysql.html b/docs/ts-simple-db-mysql/classes/SimpleDbMysql.html index 133c0b8..d8dcda9 100644 --- a/docs/ts-simple-db-mysql/classes/SimpleDbMysql.html +++ b/docs/ts-simple-db-mysql/classes/SimpleDbMysql.html @@ -1,8 +1,8 @@ -SimpleDbMysql | @wymp/simple-db-mysql

Implements

  • SimpleSqlDbInterface

Constructors

constructor +SimpleDbMysql | @wymp/simple-db-mysql

Implements

  • SimpleSqlDbInterface

Constructors

Properties

Methods

Constructors

Properties

pool: PromisePool
config: PoolOptions

Methods

  • Type Parameters

    • T = unknown

    Parameters

    • q: string
    • Optional params: null | SqlValue[]

    Returns Promise<SimpleSqlResponseInterface<T>>

  • Type Parameters

    • T = unknown

    Parameters

    • q: string
    • params: undefined | null | SqlValue[]
    • cnx: MysqlConnection

    Returns Promise<{
        rows: T[];
        affectedRows: number;
    } | {
        affectedRows?: undefined;
        rows: T[];
    }>

  • Type Parameters

    • T

    Parameters

    • queries: ((cnx) => Promise<T>)
        • (cnx): Promise<T>
        • Parameters

          • cnx: SimpleSqlDbInterface

          Returns Promise<T>

    • Optional txName: unknown

    Returns Promise<T>

  • Returns Promise<void>

Generated using TypeDoc

\ No newline at end of file +

Constructors

Properties

pool: PromisePool
config: PoolOptions

Methods

  • Type Parameters

    • T = unknown

    Parameters

    • q: string
    • Optional params: null | SqlValue[]

    Returns Promise<SimpleSqlResponseInterface<T>>

  • Type Parameters

    • T = unknown

    Parameters

    • q: string
    • params: undefined | null | SqlValue[]
    • cnx: MysqlConnection

    Returns Promise<{
        rows: T[];
        affectedRows: number;
    } | {
        affectedRows?: undefined;
        rows: T[];
    }>

  • Type Parameters

    • T

    Parameters

    • queries: ((cnx) => Promise<T>)
        • (cnx): Promise<T>
        • Parameters

          • cnx: SimpleSqlDbInterface

          Returns Promise<T>

    • Optional txName: unknown

    Returns Promise<T>

  • Returns Promise<void>

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/ts-simple-db-mysql/index.html b/docs/ts-simple-db-mysql/index.html index 79c338b..4e12342 100644 --- a/docs/ts-simple-db-mysql/index.html +++ b/docs/ts-simple-db-mysql/index.html @@ -2,6 +2,6 @@ allows for better interoperability and dependency choice for consumers.

This package provides a light wrapper around mysql2 that enforces conformity with the SimpleSqlDbInterface defined in -ts-simple-interfaces. +ts-simple-interfaces. See that package for information about the interface.

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/ts-simple-http-client-axios/classes/SimpleHttpClientAxios.html b/docs/ts-simple-http-client-axios/classes/SimpleHttpClientAxios.html index df08001..74d6a93 100644 --- a/docs/ts-simple-http-client-axios/classes/SimpleHttpClientAxios.html +++ b/docs/ts-simple-http-client-axios/classes/SimpleHttpClientAxios.html @@ -1,4 +1,4 @@ -SimpleHttpClientAxios | @wymp/simple-http-client-axios

Implements

  • SimpleHttpClientInterface

Constructors

constructor +SimpleHttpClientAxios | @wymp/simple-http-client-axios

Implements

  • SimpleHttpClientInterface

Constructors

Properties

Methods

Constructors

Properties

axios: AxiosInstance

Methods

  • Type Parameters

    • T

    Parameters

    • _config: Omit<AxiosRequestConfig<any>, "headers"> & SimpleHttpClientRequestConfig
    • Optional log: SimpleLoggerInterface

    Returns Promise<SimpleHttpClientResponseInterface<T>>

Generated using TypeDoc

\ No newline at end of file +

Constructors

Properties

axios: AxiosInstance

Methods

  • Type Parameters

    • T

    Parameters

    • _config: Omit<AxiosRequestConfig<any>, "headers"> & SimpleHttpClientRequestConfig
    • Optional log: SimpleLoggerInterface

    Returns Promise<SimpleHttpClientResponseInterface<T>>

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/ts-simple-http-client-axios/index.html b/docs/ts-simple-http-client-axios/index.html index 3845804..63ce200 100644 --- a/docs/ts-simple-http-client-axios/index.html +++ b/docs/ts-simple-http-client-axios/index.html @@ -2,6 +2,6 @@ interoperability and dependency choice for consumers.

This package provides a light wrapper around axios that enforces conformity with the SimpleHttpClientInterface defined in -ts-simple-interfaces. +ts-simple-interfaces. See that package for information about the interface.

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientFetch.html b/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientFetch.html index 62d8930..d913597 100644 --- a/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientFetch.html +++ b/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientFetch.html @@ -9,9 +9,9 @@

**REGARDING SELF-SIGNED CERTS: Fetch does not provide any way to turn off cert verification. If you're in a browser, you can do this yourself by visiting the sites with the bad certs and marking them as "trusted" (there's a dialog for this that will pop up in the browser). If you're in node, you can use the NODE_TLS_REJECT_UNAUTHORIZED env var.

-

Implements

Constructors

Implements

  • SimpleHttpClientInterface

Constructors

Properties

f

Methods

Constructors

  • Parameters

    • Optional deps: {
          fetch?: {
              (input, init?): Promise<Response>;
              (input, init?): Promise<Response>;
          };
      }
      • Optional fetch?: {
            (input, init?): Promise<Response>;
            (input, init?): Promise<Response>;
        }
          • (input, init?): Promise<Response>
          • Parameters

            • input: URL | RequestInfo
            • Optional init: RequestInit

            Returns Promise<Response>

          • (input, init?): Promise<Response>
          • Parameters

            • input: string | URL | Request
            • Optional init: RequestInit

            Returns Promise<Response>

    Returns SimpleHttpClientFetch

Properties

f: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: URL | RequestInfo
      • Optional init: RequestInit

      Returns Promise<Response>

    • (input, init?): Promise<Response>
    • Parameters

      • input: string | URL | Request
      • Optional init: RequestInit

      Returns Promise<Response>

Methods

Generated using TypeDoc

\ No newline at end of file +

Parameters

  • input: URL | RequestInfo
  • Optional init: RequestInit

Returns Promise<Response>

  • (input, init?): Promise<Response>
  • Parameters

    • input: string | URL | Request
    • Optional init: RequestInit

    Returns Promise<Response>

  • Returns SimpleHttpClientFetch

    Properties

    f: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    }

    Type declaration

      • (input, init?): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optional init: RequestInit

        Returns Promise<Response>

      • (input, init?): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optional init: RequestInit

        Returns Promise<Response>

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientResponseError.html b/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientResponseError.html index ebdc59a..dfa065b 100644 --- a/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientResponseError.html +++ b/docs/ts-simple-http-client-fetch/classes/SimpleHttpClientResponseError.html @@ -1,4 +1,4 @@ -SimpleHttpClientResponseError | @wymp/simple-http-client-fetch

    Type Parameters

    • E = unknown

    Hierarchy

    • Error
      • SimpleHttpClientResponseError

    Constructors

    constructor +SimpleHttpClientResponseError | @wymp/simple-http-client-fetch

    Type Parameters

    • E = unknown

    Hierarchy

    • Error
      • SimpleHttpClientResponseError

    Constructors

    Properties

    Methods

    Constructors

    Properties

    res: SimpleHttpClientResponseInterface<E>
    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    +

    Constructors

    Properties

    res: SimpleHttpClientResponseInterface<E>
    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    Type declaration

    See

    https://v8.dev/docs/stack-trace-api#customizing-stack-traces

    diff --git a/docs/ts-simple-http-client-fetch/index.html b/docs/ts-simple-http-client-fetch/index.html index a73bd3f..00394c5 100644 --- a/docs/ts-simple-http-client-fetch/index.html +++ b/docs/ts-simple-http-client-fetch/index.html @@ -1,6 +1,6 @@ @wymp/simple-http-client-fetch

    @wymp/simple-http-client-fetch

    Simple Http Client, Fetch

    A Simple™-conformant wrapper around fetch. "Simple" is intended to be a highly reduced interface that allows for better interoperability and dependency choice for consumers.

    This package provides a light wrapper around fetch that enforces conformity with the SimpleHttpClientInterface -defined in ts-simple-interfaces. +defined in ts-simple-interfaces. See that package for information about the interface.

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-client-fetch/interfaces/SimpleFetchRequestConfig.html b/docs/ts-simple-http-client-fetch/interfaces/SimpleFetchRequestConfig.html index 769b58d..5c64737 100644 --- a/docs/ts-simple-http-client-fetch/interfaces/SimpleFetchRequestConfig.html +++ b/docs/ts-simple-http-client-fetch/interfaces/SimpleFetchRequestConfig.html @@ -1,5 +1,5 @@ SimpleFetchRequestConfig | @wymp/simple-http-client-fetch

    Request config composed of both SimpleHttpClientRequestConfig and any additions that are fetch-specific

    -
    interface SimpleFetchRequestConfig {
        keepalive?: boolean;
        integrity?: string;
        signal?: AbortSignal;
        credentials?: RequestCredentials;
        mode?: RequestMode;
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Hierarchy

    • SimpleHttpClientRequestConfig
      • SimpleFetchRequestConfig

    Properties

    interface SimpleFetchRequestConfig {
        keepalive?: boolean;
        integrity?: string;
        signal?: AbortSignal;
        credentials?: "include" | "omit" | "same-origin";
        mode?: "same-origin" | "cors" | "navigate" | "no-cors";
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Hierarchy

    • SimpleHttpClientRequestConfig
      • SimpleFetchRequestConfig

    Properties

    keepalive?: boolean
    integrity?: string

    A cryptographic hash of the resource being fetched. If the retreived resource does not match, an error is thrown

    -
    signal?: AbortSignal

    An AbortSignal object instance; allows you to communicate with a fetch request and abort it if desired via an +

    Properties

    keepalive?: boolean
    integrity?: string

    A cryptographic hash of the resource being fetched. If the retreived resource does not match, an error is thrown

    +
    signal?: AbortSignal

    An AbortSignal object instance; allows you to communicate with a fetch request and abort it if desired via an AbortController. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal for details.

    -
    credentials?: RequestCredentials

    Policy specifying whether to include credentials. See +

    credentials?: "include" | "omit" | "same-origin"

    Policy specifying whether to include credentials. See https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#credentials

    -
    mode?: RequestMode
    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    -

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    -
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    -
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise +

    mode?: "same-origin" | "cors" | "navigate" | "no-cors"
    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    +

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    +
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    +
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise the request will automatically follow redirects up to the number specified. If undefined, redirects are handled automatically up to whatever maximum the implementation defaults to.

    -
    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    -
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not +

    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    +
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not self-signed

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-client-rpn/classes/ResponseError.html b/docs/ts-simple-http-client-rpn/classes/ResponseError.html index 0a635fc..e3b9435 100644 --- a/docs/ts-simple-http-client-rpn/classes/ResponseError.html +++ b/docs/ts-simple-http-client-rpn/classes/ResponseError.html @@ -1,4 +1,4 @@ -ResponseError | @wymp/simple-http-client-rpn

    Type Parameters

    • E = unknown

    Hierarchy

    • Error
      • ResponseError

    Constructors

    constructor +ResponseError | @wymp/simple-http-client-rpn

    Type Parameters

    • E = unknown

    Hierarchy

    • Error
      • ResponseError

    Constructors

    Properties

    Methods

    Constructors

    Properties

    res: SimpleHttpClientResponseInterface<E>
    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    +

    Constructors

    Properties

    res: SimpleHttpClientResponseInterface<E>
    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    Type declaration

    See

    https://v8.dev/docs/stack-trace-api#customizing-stack-traces

    diff --git a/docs/ts-simple-http-client-rpn/classes/SimpleHttpClientRpn.html b/docs/ts-simple-http-client-rpn/classes/SimpleHttpClientRpn.html index a8594a2..db62eca 100644 --- a/docs/ts-simple-http-client-rpn/classes/SimpleHttpClientRpn.html +++ b/docs/ts-simple-http-client-rpn/classes/SimpleHttpClientRpn.html @@ -1,5 +1,5 @@ -SimpleHttpClientRpn | @wymp/simple-http-client-rpn

    Implements

    • SimpleHttpClientInterface

    Constructors

    constructor +SimpleHttpClientRpn | @wymp/simple-http-client-rpn

    Implements

    • SimpleHttpClientInterface

    Constructors

    Properties

    Methods

    Constructors

    Properties

    rpn: ((conf) => Promise<Response>)

    Type declaration

      • (conf): Promise<Response>
      • Parameters

        • conf: OptionsWithUrl

        Returns Promise<Response>

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    rpn: ((conf) => Promise<Response>)

    Type declaration

      • (conf): Promise<Response>
      • Parameters

        • conf: OptionsWithUrl

        Returns Promise<Response>

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-client-rpn/index.html b/docs/ts-simple-http-client-rpn/index.html index 2f157fc..6ddc1ac 100644 --- a/docs/ts-simple-http-client-rpn/index.html +++ b/docs/ts-simple-http-client-rpn/index.html @@ -4,6 +4,6 @@ request-promise-native) is deprecated. Use @wymp/simple-http-client-fetch as an alternative.**

    This package provides a light wrapper around request-promise-native that enforces conformity with the -SimpleHttpClientInterface defined in ts-simple-interfaces. +SimpleHttpClientInterface defined in ts-simple-interfaces. See that package for information about the interface.

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-client-rpn/interfaces/SimpleRpnRequestConfig.html b/docs/ts-simple-http-client-rpn/interfaces/SimpleRpnRequestConfig.html index defe3fb..d04432a 100644 --- a/docs/ts-simple-http-client-rpn/interfaces/SimpleRpnRequestConfig.html +++ b/docs/ts-simple-http-client-rpn/interfaces/SimpleRpnRequestConfig.html @@ -1,4 +1,4 @@ -SimpleRpnRequestConfig | @wymp/simple-http-client-rpn
    interface SimpleRpnRequestConfig {
        transform?: ((body, response, resolveWithFullResponse?) => any);
        transform2xxOnly?: boolean;
        json?: any;
        removeRefererHeader?: boolean;
        rejectUnauthorized?: boolean;
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Hierarchy

    • SimpleHttpClientRequestConfig
      • SimpleRpnRequestConfig

    Properties

    transform? +SimpleRpnRequestConfig | @wymp/simple-http-client-rpn
    interface SimpleRpnRequestConfig {
        transform?: ((body, response, resolveWithFullResponse?) => any);
        transform2xxOnly?: boolean;
        json?: any;
        removeRefererHeader?: boolean;
        rejectUnauthorized?: boolean;
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Hierarchy

    • SimpleHttpClientRequestConfig
      • SimpleRpnRequestConfig

    Properties

    transform?: ((body, response, resolveWithFullResponse?) => any)

    Type declaration

      • (body, response, resolveWithFullResponse?): any
      • Parameters

        • body: any
        • response: Response
        • Optional resolveWithFullResponse: boolean

        Returns any

    transform2xxOnly?: boolean
    json?: any
    removeRefererHeader?: boolean
    rejectUnauthorized?: boolean
    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    -

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    -
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    -
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise +

    Properties

    transform?: ((body, response, resolveWithFullResponse?) => any)

    Type declaration

      • (body, response, resolveWithFullResponse?): any
      • Parameters

        • body: any
        • response: Response
        • Optional resolveWithFullResponse: boolean

        Returns any

    transform2xxOnly?: boolean
    json?: any
    removeRefererHeader?: boolean
    rejectUnauthorized?: boolean
    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    +

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    +
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    +
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise the request will automatically follow redirects up to the number specified. If undefined, redirects are handled automatically up to whatever maximum the implementation defaults to.

    -
    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    -
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not +

    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    +
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not self-signed

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-server-express/classes/SimpleHttpServerExpress.html b/docs/ts-simple-http-server-express/classes/SimpleHttpServerExpress.html index 94e068e..1985b5f 100644 --- a/docs/ts-simple-http-server-express/classes/SimpleHttpServerExpress.html +++ b/docs/ts-simple-http-server-express/classes/SimpleHttpServerExpress.html @@ -1,5 +1,5 @@ SimpleHttpServerExpress | @wymp/simple-http-server-express

    Main class

    -

    Implements

    • SimpleHttpRequestHandlerInterface

    Constructors

    Implements

    • SimpleHttpRequestHandlerInterface

    Constructors

    Properties

    app config log @@ -14,4 +14,4 @@ head options listen -

    Constructors

    Properties

    app: Express
    log: SimpleLoggerInterface

    Methods

    • Parameters

      • middleware: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • errorHandler: SimpleHttpServerErrorHandler | SimpleHttpServerErrorHandler[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • route: string | RegExp | (string | RegExp)[]
      • handlers: SimpleHttpServerMiddleware | SimpleHttpServerMiddleware[]

      Returns SimpleHttpRequestHandlerInterface

    • Parameters

      • Optional userCallback: ((listener, args) => unknown)
          • (listener, args): unknown
          • Parameters

            • listener: [number, undefined | string]
            • args: unknown[]

            Returns unknown

      Returns Server<typeof IncomingMessage, typeof ServerResponse>[]

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    app: Express
    log: SimpleLoggerInterface

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-server-express/index.html b/docs/ts-simple-http-server-express/index.html index c51185d..fb0af4a 100644 --- a/docs/ts-simple-http-server-express/index.html +++ b/docs/ts-simple-http-server-express/index.html @@ -3,7 +3,7 @@

    NOTE: This library is experimental right now and in active beta development. While you may feel free to use it, it is expected to change considerably.

    This package provides a light wrapper around ExpressJS that enforces conformity with the SimpleHttpServerInterface -defined in ts-simple-interfaces.

    +defined in ts-simple-interfaces.

    See that package for information about the interface.

    At the time of this writing, this package is not meant to be a fully-functional, do-it-all web service framework. To the contrary, it is meant to be a pared down, simplified building block that just does routing and listening. It may grow diff --git a/docs/ts-simple-http-server-express/interfaces/SimpleHttpServerConfig.html b/docs/ts-simple-http-server-express/interfaces/SimpleHttpServerConfig.html index 602bbf7..1d6c07c 100644 --- a/docs/ts-simple-http-server-express/interfaces/SimpleHttpServerConfig.html +++ b/docs/ts-simple-http-server-express/interfaces/SimpleHttpServerConfig.html @@ -1,2 +1,2 @@ -SimpleHttpServerConfig | @wymp/simple-http-server-express

    interface SimpleHttpServerConfig {
        listeners: [number, undefined | string][];
    }

    Properties

    Properties

    listeners: [number, undefined | string][]

    Generated using TypeDoc

    \ No newline at end of file +SimpleHttpServerConfig | @wymp/simple-http-server-express
    interface SimpleHttpServerConfig {
        listeners: [number, undefined | string][];
    }

    Properties

    Properties

    listeners: [number, undefined | string][]

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-http-server-express/variables/Parsers.html b/docs/ts-simple-http-server-express/variables/Parsers.html index 8fd4105..b477e2c 100644 --- a/docs/ts-simple-http-server-express/variables/Parsers.html +++ b/docs/ts-simple-http-server-express/variables/Parsers.html @@ -2,4 +2,4 @@

    Because these deal with low-level properties of the request, we need to create adapters for them to keep the interface simple. In this case, since it's assumed that we're using them with the express version of SimpleHttpRequestHandlerInterface, we feel it is safe to cast.

    -

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces-testing/classes/MockSimpleHttpClient.html b/docs/ts-simple-interfaces-testing/classes/MockSimpleHttpClient.html index f856adf..2a10bd2 100644 --- a/docs/ts-simple-interfaces-testing/classes/MockSimpleHttpClient.html +++ b/docs/ts-simple-interfaces-testing/classes/MockSimpleHttpClient.html @@ -1,8 +1,8 @@ -MockSimpleHttpClient | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleHttpClientInterface

    Constructors

    constructor +MockSimpleHttpClient | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleHttpClientInterface

    Constructors

    Properties

    responses: {
        [key: string]: (SimpleHttpClientResponseInterface | NodeJS.ErrnoException)[];
    } = {}

    Type declaration

    • [key: string]: (SimpleHttpClientResponseInterface | NodeJS.ErrnoException)[]
    _requests: SimpleHttpClientRequestConfig[] = []

    Accessors

    Methods

    • Parameters

      • key: string
      • response: SimpleHttpClientResponseInterface<unknown> | ErrnoException

      Returns void

    • Type Parameters

      • T = any

      Parameters

      • config: SimpleHttpClientRequestConfig

      Returns Promise<SimpleHttpClientResponseInterface<T>>

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    responses: {
        [key: string]: (SimpleHttpClientResponseInterface | NodeJS.ErrnoException)[];
    } = {}

    Type declaration

    • [key: string]: (SimpleHttpClientResponseInterface | NodeJS.ErrnoException)[]
    _requests: SimpleHttpClientRequestConfig[] = []

    Accessors

    Methods

    • Parameters

      • key: string
      • response: SimpleHttpClientResponseInterface<unknown> | ErrnoException

      Returns void

    • Type Parameters

      • T = any

      Parameters

      • config: SimpleHttpClientRequestConfig

      Returns Promise<SimpleHttpClientResponseInterface<T>>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces-testing/classes/MockSimpleLogger.html b/docs/ts-simple-interfaces-testing/classes/MockSimpleLogger.html index 800272d..93ab859 100644 --- a/docs/ts-simple-interfaces-testing/classes/MockSimpleLogger.html +++ b/docs/ts-simple-interfaces-testing/classes/MockSimpleLogger.html @@ -1,4 +1,4 @@ -MockSimpleLogger | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleLoggerInterface

    Constructors

    constructor +MockSimpleLogger | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleLoggerInterface

    Constructors

    Properties

    Accessors

    messages @@ -14,4 +14,4 @@ info debug log -

    Constructors

    Properties

    _loggedMessages: string[] = []
    opts: Opts

    Accessors

    Methods

    • Type Parameters

      • T extends "outputMessages"

      Parameters

      • opt: T
      • val: Opts[T]

      Returns void

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • level: string
      • message: string
      • Rest ...meta: any[]

      Returns this

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    _loggedMessages: string[] = []
    opts: Opts

    Accessors

    Methods

    • Type Parameters

      • T extends "outputMessages"

      Parameters

      • opt: T
      • val: Opts[T]

      Returns void

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • level: string
      • message: string
      • Rest ...meta: any[]

      Returns this

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces-testing/classes/MockSimplePublisher.html b/docs/ts-simple-interfaces-testing/classes/MockSimplePublisher.html index 270372e..a36ed2b 100644 --- a/docs/ts-simple-interfaces-testing/classes/MockSimplePublisher.html +++ b/docs/ts-simple-interfaces-testing/classes/MockSimplePublisher.html @@ -1,4 +1,4 @@ -MockSimplePublisher | @wymp/ts-simple-interfaces-testing

    Implements

    • SimplePublisherInterface<unknown, unknown>

    Constructors

    constructor +MockSimplePublisher | @wymp/ts-simple-interfaces-testing

    Implements

    • SimplePublisherInterface<unknown, unknown>

    Constructors

    Properties

    Accessors

    Constructors

    Properties

    emitter: EventEmitter
    _calls: MethodCall[] = []

    Accessors

    Methods

    • Parameters

      • channel: string
      • routingKey: string
      • event: unknown
      • Optional options: unknown
      • Rest ...rest: any[]

      Returns Promise<void>

    • Parameters

      • Rest ...rest: any[]

      Returns Promise<void>

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • Optional event: "error" | "connect" | "disconnect"

      Returns this

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    emitter: EventEmitter
    _calls: MethodCall[] = []

    Accessors

    Methods

    • Parameters

      • channel: string
      • routingKey: string
      • event: unknown
      • Optional options: unknown
      • Rest ...rest: any[]

      Returns Promise<void>

    • Parameters

      • Rest ...rest: any[]

      Returns Promise<void>

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • Optional event: "error" | "connect" | "disconnect"

      Returns this

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces-testing/classes/MockSimpleSqlDb.html b/docs/ts-simple-interfaces-testing/classes/MockSimpleSqlDb.html index 4674c49..b7a7e6f 100644 --- a/docs/ts-simple-interfaces-testing/classes/MockSimpleSqlDb.html +++ b/docs/ts-simple-interfaces-testing/classes/MockSimpleSqlDb.html @@ -1,4 +1,4 @@ -MockSimpleSqlDb | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleSqlDbInterface

    Constructors

    constructor +MockSimpleSqlDb | @wymp/ts-simple-interfaces-testing

    Implements

    • SimpleSqlDbInterface

    Constructors

    Properties

    Constructors

    Properties

    closed: boolean = false
    config: MockDbConfig = ...
    queryMockResultQueue: {
        [hash: string]: (SimpleSqlResponseInterface<any> | NodeJS.ErrnoException)[];
    } = {}

    Type declaration

    • [hash: string]: (SimpleSqlResponseInterface<any> | NodeJS.ErrnoException)[]

    Methods

    • If an exception is passed, it is thrown when the query is called. Otherwise, the given response is returned

      -

      Parameters

      • hashOrQuery: string
      • result: ErrnoException | SimpleSqlResponseInterface<any>

      Returns void

    • Parameters

      • query: string
      • Optional params: SqlValue[]

      Returns Promise<SimpleSqlResponseInterface<any>>

    • Type Parameters

      • T

      Parameters

      • queries: ((cnx) => Promise<T>)
          • (cnx): Promise<T>
          • Parameters

            • cnx: SimpleSqlDbInterface

            Returns Promise<T>

      • Optional txName: null | string

      Returns Promise<T>

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    closed: boolean = false
    config: MockDbConfig = ...
    queryMockResultQueue: {
        [hash: string]: (SimpleSqlResponseInterface<any> | NodeJS.ErrnoException)[];
    } = {}

    Type declaration

    • [hash: string]: (SimpleSqlResponseInterface<any> | NodeJS.ErrnoException)[]

    Methods

    • If an exception is passed, it is thrown when the query is called. Otherwise, the given response is returned

      +

      Parameters

      • hashOrQuery: string
      • result: ErrnoException | SimpleSqlResponseInterface<any>

      Returns void

    • Parameters

      • query: string
      • Optional params: SqlValue[]

      Returns Promise<SimpleSqlResponseInterface<any>>

    • Type Parameters

      • T

      Parameters

      • queries: ((cnx) => Promise<T>)
          • (cnx): Promise<T>
          • Parameters

            • cnx: SimpleSqlDbInterface

            Returns Promise<T>

      • Optional txName: null | string

      Returns Promise<T>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/classes/Errors.SimpleHttpClientRequestError.html b/docs/ts-simple-interfaces/classes/Errors.SimpleHttpClientRequestError.html index 65f9391..ec1e29a 100644 --- a/docs/ts-simple-interfaces/classes/Errors.SimpleHttpClientRequestError.html +++ b/docs/ts-simple-interfaces/classes/Errors.SimpleHttpClientRequestError.html @@ -3,7 +3,7 @@ SimpleHttpClientResponseInterface). You can use this response object to, for example, inspect the headers of the response or get the raw response body.

    This error is intended to be thrown by a client when it receives an error response from a server.

    -

    Type Parameters

    Hierarchy (view full)

    Constructors

    Type Parameters

    Hierarchy (view full)

    Constructors

    • Type Parameters

      • Data

      • Status extends 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 444 | 449 | 450 | 451 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 598 | 599 = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 444 | 449 | 450 | 451 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 598 | 599

      • Obstructions extends {
            code: string;
            text: string;
        } = {
            code: string;
            text: string;
        }

      Parameters

      Returns SimpleHttpClientRequestError<Data, Status, Obstructions>

    Properties

    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    +

    Constructors

    Properties

    prepareStackTrace?: ((err, stackTraces) => any)

    Optional override for formatting stack traces

    Type declaration

    headers: Record<string, string>

    Headers to attach to the HTTP response. Useful for things like attaching the WWW-Authenticate header to 401 responses.

    message: string
    stack?: string

    Methods

    Constructors

    Properties

    header: string

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/index.html b/docs/ts-simple-interfaces/index.html index 7b22ebb..905bd99 100644 --- a/docs/ts-simple-interfaces/index.html +++ b/docs/ts-simple-interfaces/index.html @@ -1,61 +1,55 @@ -@wymp/ts-simple-interfaces

    @wymp/ts-simple-interfaces

    Simple Interfaces for Typescript

    NOTE: This library is experimental right now and in active alpha development. While you may -feel free to use it, it is expected to change considerably.

    -

    TL;DR

    The "Simple" suite of packages should be considered a collection of interfaces (defined in this -package) along with a collection of concrete implementations (defined in other packages prefaced -with simple-) that allow you to write code that is highly portable and highly testable.

    -

    The idea is that your code should always use the simple interfaces, for function argument types, -and that you should then pass in the concrete implementations that you wish to -use.

    -

    For example, your application may require an HTTP client, like Axios or Request Promise Native. -To set your application up, you would type the variable holding the client as -SimpleHttpClientInterface and then set it to a concrete implementation, such as -SimpleHttpClientAxios from the -simple-http-client-axios package:

    +@wymp/ts-simple-interfaces

    @wymp/ts-simple-interfaces

    Simple Interfaces for Typescript

    NOTE: This library is experimental right now and in active alpha development. While you may feel free to use it, it +is expected to change considerably.

    +

    TL;DR

    The "Simple" suite of packages should be considered a collection of interfaces (defined in this package) along with a +collection of concrete implementations (defined in other packages prefaced with simple-) that allow you to write code +that is highly portable and highly testable.

    +

    The idea is that your code should always use the simple interfaces, for function argument types, and that you should +then pass in the concrete implementations that you wish to use.

    +

    For example, your application may require an HTTP client, like Axios or Request Promise Native. To set your application +up, you would type the variable holding the client as SimpleHttpClientInterface and then set it to a concrete +implementation, such as SimpleHttpClientFetch from the +@wymp/simple-http-client-fetch package:

    // src/MyClient.ts
    import { SimpleHttpClientInterface } from "ts-simple-interfaces";
    import { SomeData } from "./Types";

    export class MyClient {
    public constructor(protected httpClient: SimpleHttpClientInterface) { }

    public getSomeData() {
    return this.httpClient.request<SomeData>({
    //...
    });
    }
    }

    // --------------------------------------------------------------------

    // src/index.ts
    import { MyClient } from "./MyClient";
    import { SimpleHttpClientAxios } from "simple-http-client-axios";

    const axios = new SimpleHttpClientAxios();
    const myClient = new MyClient(axios);

    const data = myClient.getSomeData();
    // ....
    -

    Doing this means that if for any reason in the future it Axios goes out of production or becomes -problematic, you can easily switch to a different implementation with minimal adjustments.

    -

    Note that the idea is not necessarily that there be no adjustments. Individual implementations -have varying features that you may want to use. However, sticking to Simple-conformant -implementations not only minimizes the adjustments you have to make when migrating, but it also -increases your options for testing, as other people can focus on building robust, widely -applicable test implementations that conform to the general Simple interfaces and can be dropped in -with no modifications, or at least only minor ones.

    -

    Longer Overview

    This library attempts to define a set of simplified interfaces for typescript that are compatible -with common tools in the ecosystem. Most of these tools are I/O-based, such as pub/subs (amqp), -relational databases (mysql, postgres), key-value stores (redis), and loggers (winston), but -technically any complex tool is fair game for a simplified interface.

    -

    The problem is that many of these tools have unnecessarily complex native interfaces that make -them problematic for testing and portability. For example, Winston is a wonderful logger, but -its LoggerInterface defines a bunch of methods that are not very useful to the average user, -and furthermore extends NodeJSStream.Transport, yielding a final interface that defines over -40 methods that have little to do with logging messages. Thus, incorporating these interfaces -into your code unnecessarily expands the contracts that your code uses, making your applications -less flexible, more difficult to test, and more difficult to migrate to new technologies.

    -

    Another issue is that Winston's LoggerInterface is defined in the library itself, meaning that -if you want to use that LoggerInterface, you have to depend on the whole Winston package. This -isn't technically a huge deal, but it also tends to hamper the responsible specification of -general interfaces that are independent of any single project.

    -

    TOC for Simple Suite of Packages

    As mentioned in the TL;DR, the "simple" concept is actually a collection of repositories/packages. -For each interface defined, the goal is to create one or more "official" concrete implementations -based on current popular libraries.

    +

    Doing this means that if for any reason in the future it Axios goes out of production or becomes problematic, you can +easily switch to a different implementation with minimal adjustments.

    +

    Note that the idea is not necessarily that there be no adjustments. Individual implementations have varying features +that you may want to use. However, sticking to Simple-conformant implementations not only minimizes the adjustments you +have to make when migrating, but it also increases your options for testing, as other people can focus on building +robust, widely applicable test implementations that conform to the general Simple interfaces and can be dropped in with +no modifications, or at least only minor ones.

    +

    Longer Overview

    This library attempts to define a set of simplified interfaces for typescript that are compatible with common tools in +the ecosystem. Most of these tools are I/O-based, such as pub/subs (amqp), relational databases (mysql, postgres), +key-value stores (redis), and loggers (winston), but technically any complex tool is fair game for a simplified +interface.

    +

    The problem is that many of these tools have unnecessarily complex native interfaces that make them problematic for +testing and portability. For example, Winston is a wonderful logger, but its LoggerInterface defines a bunch of +methods that are not very useful to the average user, and furthermore extends NodeJSStream.Transport, yielding a +final interface that defines over 40 methods that have little to do with logging messages. Thus, incorporating these +interfaces into your code unnecessarily expands the contracts that your code uses, making your applications less +flexible, more difficult to test, and more difficult to migrate to new technologies.

    +

    Another issue is that Winston's LoggerInterface is defined in the library itself, meaning that if you want to use that +LoggerInterface, you have to depend on the whole Winston package. This isn't technically a huge deal, but it also +tends to hamper the responsible specification of general interfaces that are independent of any single project.

    +

    TOC for Simple Suite of Packages

    As mentioned in the TL;DR, the "simple" concept is actually a collection of repositories/packages. For each interface +defined, the goal is to create one or more "official" concrete implementations based on current popular libraries.

    -

    Because the Simple suite is still very much a work in progress, very few concrete implementations -have been defined. However, as the interfaces stabilize and are used in production environments, -the hope is to deliver more. Feel free to let me know about any concrete implementations that -spring up in the wild....

    +

    Because the Simple suite is still very much a work in progress, very few concrete implementations have been defined. +However, as the interfaces stabilize and are used in production environments, the hope is to deliver more. Feel free +to let me know about any concrete implementations that spring up in the wild....

    Following is a list of implementations by interface:

    SimpleHttpClientInterface

    SimpleHttpRequestHandlerInterface

    SimpleLoggerInterface

    SimplePubSubInterface

    • simple-pubsub-amqp
    • @@ -63,18 +57,18 @@

      SimpleSqlDbInterface

      -

      Testing

      One of the advantages of referencing these interfaces in your code is that you can use potentially -powerful pre-built testing mocks/spies/stubs that conform to them. At the time of this writing, -these are being developed here.

      -

      For example, you can instantiate a SimpleMockSqlDb that implements SimpleSqlDbInterface and -gives you the ability to easily analyze query requests and define responses.

      -

      Usage

      To use this library, just list it as a dependency[1] and then define classes that implement -these interfaces. For example:

      +

      Testing

      One of the advantages of referencing these interfaces in your code is that you can use potentially powerful pre-built +testing mocks/spies/stubs that conform to them. At the time of this writing, these are being developed +here.

      +

      For example, you can instantiate a SimpleMockSqlDb that implements SimpleSqlDbInterface and gives you the ability to +easily analyze query requests and define responses.

      +

      Usage

      To use this library, just list it as a dependency[^1] and then define classes that implement these interfaces. For +example:

      // src/MyDatasource.ts
      import { SimpleDatasourceInterface } from "ts-simple-interfaces";

      export class MyDatasource implements SimpleDatasourceInterface {
      ....
      }
      -

      API

      The best way to understand the API is by just looking at the declarations file -here.

      -

      Footnotes

      [1] Note that this library should be included as a proper dependency, not a dev dependency, -because it may define enums that actually compile down to javascript that your project uses +

      API

      The best way to understand the API is by just looking at the definitions +here.

      +

      Footnotes

      [1]: Note that the @wymp/ts-simple-interfaces library should be included as a proper dependency, not a dev dependency, +because it may define enums and certain utility classes that actually compile down to javascript that your project uses at runtime.

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/BufferLike.html b/docs/ts-simple-interfaces/interfaces/BufferLike.html index 7fa9d2f..8adedf3 100644 --- a/docs/ts-simple-interfaces/interfaces/BufferLike.html +++ b/docs/ts-simple-interfaces/interfaces/BufferLike.html @@ -1,7 +1,7 @@ -BufferLike | @wymp/ts-simple-interfaces
    interface BufferLike {
        equals(otherBuffer): boolean;
        toString(encoding?, start?, end?): string;
        slice(start?, end?): BufferLike;
        indexOf(value, byteOffset?, encoding?): number;
        lastIndexOf(value, byteOffset?, encoding?): number;
        includes(value, byteOffset?, encoding?): boolean;
    }

    Methods

    equals +BufferLike | @wymp/ts-simple-interfaces
    interface BufferLike {
        equals(otherBuffer): boolean;
        toString(encoding?, start?, end?): string;
        slice(start?, end?): BufferLike;
        indexOf(value, byteOffset?, encoding?): number;
        lastIndexOf(value, byteOffset?, encoding?): number;
        includes(value, byteOffset?, encoding?): boolean;
    }

    Methods

    • Parameters

      • otherBuffer: object

      Returns boolean

    • Parameters

      • Optional encoding: string
      • Optional start: number
      • Optional end: number

      Returns string

    • Parameters

      • Optional start: number
      • Optional end: number

      Returns BufferLike

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns number

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns number

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns boolean

    Generated using TypeDoc

    \ No newline at end of file +

    Methods

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns number

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns number

    • Parameters

      • value: string | number | object
      • Optional byteOffset: number
      • Optional encoding: string

      Returns boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleDatasetInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleDatasetInterface.html index ab54cf3..fc9ac83 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleDatasetInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleDatasetInterface.html @@ -1,3 +1,3 @@ SimpleDatasetInterface | @wymp/ts-simple-interfaces

    Interface SimpleDatasetInterface<T>

    A SimpleDataset is anything with rows of data.

    -
    interface SimpleDatasetInterface<T> {
        rows: T[];
    }

    Type Parameters

    • T

    Hierarchy (view full)

    Properties

    Properties

    rows: T[]

    Generated using TypeDoc

    \ No newline at end of file +
    interface SimpleDatasetInterface<T> {
        rows: T[];
    }

    Type Parameters

    • T

    Hierarchy (view full)

    Properties

    Properties

    rows: T[]

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleDatasourceInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleDatasourceInterface.html index aca6aa0..086e270 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleDatasourceInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleDatasourceInterface.html @@ -1,7 +1,7 @@ SimpleDatasourceInterface | @wymp/ts-simple-interfaces

    Interface SimpleDatasourceInterface

    A SimpleDatasource is imagined to be a generic, CRUD-enabled I/O layer.

    This may be a REST API, a SQL database, a document store, etc. - it's just anything that you can save something to and retrieve something from.

    -
    interface SimpleDatasourceInterface {
        get: (<T>(query) => Promise<SimpleDatasetInterface<T>>);
        save: (<T>(resource, force) => Promise<T>);
        delete: ((resourceId) => Promise<void>);
    }

    Properties

    get +
    interface SimpleDatasourceInterface {
        get: (<T>(query) => Promise<SimpleDatasetInterface<T>>);
        save: (<T>(resource, force) => Promise<T>);
        delete: ((resourceId) => Promise<void>);
    }

    Properties

    Properties

    get: (<T>(query) => Promise<SimpleDatasetInterface<T>>)

    get is meant to accept a structured DSL query serialized to string. This may @@ -16,7 +16,7 @@ dsl-queries package.

    Either way, this function is to return at least a simple dataset interface, and may return something more complex depending on your implementation.

    -

    Type Parameters

    • T

    Parameters

    • query: string

    Returns Promise<SimpleDatasetInterface<T>>

    save: (<T>(resource, force) => Promise<T>)

    Save is intended to be used for both creation and update. Some people prefer to use +

    Type Parameters

    • T

    Parameters

    • query: string

    Returns Promise<SimpleDatasetInterface<T>>

    save: (<T>(resource, force) => Promise<T>)

    Save is intended to be used for both creation and update. Some people prefer to use complex Resource objects that offer interesting features like change tracking, etc., while others prefer simpler objects that act only as value stores. This interface allows you to use anything, so long as you return the same.

    @@ -36,6 +36,6 @@ a POST or a PATCH request. Note that implementations of this interface should make their own decisions about how to handle resources that do or don't already have assigned IDs.

    -

    Type Parameters

    • T

    Parameters

    • resource: Partial<T>
    • force: boolean

    Returns Promise<T>

    delete: ((resourceId) => Promise<void>)

    Should accept the ID of a resource to delete.

    +

    Type Parameters

    Parameters

    Returns Promise<T>

    delete: ((resourceId) => Promise<void>)

    Should accept the ID of a resource to delete.

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleEvent.html b/docs/ts-simple-interfaces/interfaces/SimpleEvent.html index 997ab6a..a38391c 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleEvent.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleEvent.html @@ -1,15 +1,15 @@ SimpleEvent | @wymp/ts-simple-interfaces

    An interface that provides a good starting point for a typical Event

    Note that this is intended to be extended in your domain to include whatever other data you might want in an event. This is not meant to be a complete event object.

    -
    interface SimpleEvent {
        parentIds?: null | string[];
        meta?: unknown;
        type: "event";
        id: string;
        timestamp: number;
        domain: string;
    }

    Hierarchy (view full)

    Properties

    interface SimpleEvent {
        parentIds?: null | string[];
        meta?: unknown;
        type: "event";
        id: string;
        timestamp: number;
        domain: string;
    }

    Hierarchy (view full)

    Properties

    parentIds?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    -
    meta?: unknown

    A field for miscellaneous data

    -
    type: "event"
    id: string

    A UUID for the event

    -
    timestamp: number

    The time in MS at which the event occurred

    -
    domain: string

    The domain in which the event was produced

    -

    Generated using TypeDoc

    \ No newline at end of file +
    meta?: unknown

    A field for miscellaneous data

    +
    type: "event"
    id: string

    A UUID for the event

    +
    timestamp: number

    The time in MS at which the event occurred

    +
    domain: string

    The domain in which the event was produced

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientInterface.html index d1b1f11..1846953 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientInterface.html @@ -1,4 +1,4 @@ SimpleHttpClientInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpClientInterface

    This defines a simple HTTP interface which can dress Axios, Request-Promise-Native, etc.

    It should throw a SimpleHttpClientRequestError on status codes >= 400.

    -
    interface SimpleHttpClientInterface {
        request: (<T>(config, _log?) => Promise<SimpleHttpClientResponseInterface<T>>);
    }

    Properties

    Properties

    request: (<T>(config, _log?) => Promise<SimpleHttpClientResponseInterface<T>>)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +
    interface SimpleHttpClientInterface {
        request: (<T>(config, _log?) => Promise<SimpleHttpClientResponseInterface<T>>);
    }

    Properties

    Properties

    request: (<T>(config, _log?) => Promise<SimpleHttpClientResponseInterface<T>>)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientRequestConfig.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientRequestConfig.html index b1b479c..b979e73 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientRequestConfig.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientRequestConfig.html @@ -1,5 +1,5 @@ SimpleHttpClientRequestConfig | @wymp/ts-simple-interfaces

    Interface SimpleHttpClientRequestConfig

    A simple HTTP Request config object (reduced clone of AxiosRequestConfig)

    -
    interface SimpleHttpClientRequestConfig {
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Properties

    interface SimpleHttpClientRequestConfig {
        url?: string;
        baseURL?: string;
        method?: HttpMethods;
        headers?: {
            [headerName: string]: string[] | string | undefined;
        };
        params?: {
            [paramKey: string]: string | number | null | undefined;
        };
        data?: any;
        timeoutMs?: number;
        maxRedirects?: number;
        throwErrors?: boolean;
        requireValidCerts?: boolean;
    }

    Properties

    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    -

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    -
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    -
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise +

    Properties

    url?: string
    baseURL?: string
    method?: HttpMethods
    headers?: {
        [headerName: string]: string[] | string | undefined;
    }

    Type declaration

    • [headerName: string]: string[] | string | undefined
    params?: {
        [paramKey: string]: string | number | null | undefined;
    }

    Query parameters to be included after the ? in the request url

    +

    Type declaration

    • [paramKey: string]: string | number | null | undefined
    data?: any

    Data to send in the body. Should be a string or buffer

    +
    timeoutMs?: number

    How long to wait (in MS before throwing a timeout error)

    +
    maxRedirects?: number

    If set to -1, a 3xx code throws an error; if set to 0, redirects are returned to you to handle manually, otherwise the request will automatically follow redirects up to the number specified. If undefined, redirects are handled automatically up to whatever maximum the implementation defaults to.

    -
    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    -
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not +

    throwErrors?: boolean

    Whether or not to convert 4xx and 5xx responses to native JS errors. Default is implementation-dependent.

    +
    requireValidCerts?: boolean

    If false, disables checking of SSL certificates. If true or undefined, requires that SSL certs be valid and not self-signed

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientResponseInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientResponseInterface.html index c534e22..daa7f95 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpClientResponseInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpClientResponseInterface.html @@ -1,7 +1,7 @@ SimpleHttpClientResponseInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpClientResponseInterface<T>

    A simple HTTP Response interface (reduced clone of AxiosResponse) representing a response object received by an HTTP Client in response to a request made to a server.

    -
    interface SimpleHttpClientResponseInterface<T> {
        data: T;
        status: number;
        headers: any;
        config: SimpleHttpClientRequestConfig;
    }

    Type Parameters

    • T = unknown

    Properties

    interface SimpleHttpClientResponseInterface<T> {
        data: T;
        status: number;
        headers: any;
        config: SimpleHttpClientRequestConfig;
    }

    Type Parameters

    • T = unknown

    Properties

    data: T
    status: number
    headers: any

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    data: T
    status: number
    headers: any

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerBasicInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerBasicInterface.html index 9c60c6b..cfaa42a 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerBasicInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerBasicInterface.html @@ -1,4 +1,4 @@ -SimpleHttpRequestHandlerBasicInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpRequestHandlerBasicInterface

    interface SimpleHttpRequestHandlerBasicInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
    }

    Hierarchy (view full)

    Properties

    all +SimpleHttpRequestHandlerBasicInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpRequestHandlerBasicInterface

    interface SimpleHttpRequestHandlerBasicInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
    }

    Hierarchy (view full)

    Properties

    all get post patch @@ -6,4 +6,4 @@ delete head options -

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerInterface.html index 45a25be..ab3cb49 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpRequestHandlerInterface.html @@ -2,7 +2,7 @@ handling, as well as routing per http method. It used to support the idea of a collection of app-local variables, but upon further consideration it was determined that there is not enough perceived value added by that system to really continue its existence.

    -
    interface SimpleHttpRequestHandlerInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        use(middleware): SimpleHttpRequestHandlerInterface;
        catch(errorHandler): SimpleHttpRequestHandlerInterface;
    }

    Hierarchy (view full)

    Properties

    all +
    interface SimpleHttpRequestHandlerInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        use(middleware): SimpleHttpRequestHandlerInterface;
        catch(errorHandler): SimpleHttpRequestHandlerInterface;
    }

    Hierarchy (view full)

    Properties

    all get post patch @@ -12,4 +12,4 @@ options

    Methods

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerErrorHandler.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerErrorHandler.html index 238cbef..d662ab2 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerErrorHandler.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerErrorHandler.html @@ -1 +1 @@ -SimpleHttpServerErrorHandler | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerErrorHandler

    interface SimpleHttpServerErrorHandler ((e, req, res, next) => unknown)

    Generated using TypeDoc

    \ No newline at end of file +SimpleHttpServerErrorHandler | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerErrorHandler

    interface SimpleHttpServerErrorHandler ((e, req, res, next) => unknown)

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerInterface.html index d19595a..f84636e 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerInterface.html @@ -2,7 +2,7 @@ method for listening for requests on a port and host.

    This is separate from the request handler interface to facilitate configurations in which more of the control around setup and listening is retained by a framework.

    -
    interface SimpleHttpServerInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        use(middleware): SimpleHttpRequestHandlerInterface;
        catch(errorHandler): SimpleHttpRequestHandlerInterface;
        listen(port, hostname, listeningCallback?): unknown;
        listen(port, listeningCallback?): unknown;
    }

    Hierarchy (view full)

    Properties

    all +
    interface SimpleHttpServerInterface {
        all: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        get: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        post: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        patch: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        put: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        delete: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        head: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        options: ((route, handlers) => SimpleHttpRequestHandlerInterface);
        use(middleware): SimpleHttpRequestHandlerInterface;
        catch(errorHandler): SimpleHttpRequestHandlerInterface;
        listen(port, hostname, listeningCallback?): unknown;
        listen(port, listeningCallback?): unknown;
    }

    Hierarchy (view full)

    Properties

    all get post patch @@ -13,4 +13,4 @@

    Methods

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Methods

    • Parameters

      • port: number
      • hostname: string
      • Optional listeningCallback: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns unknown

    • Parameters

      • port: number
      • Optional listeningCallback: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns unknown

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    all: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    get: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    post: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    patch: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    put: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    delete: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    head: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    options: ((route, handlers) => SimpleHttpRequestHandlerInterface)

    Type declaration

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerMiddleware.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerMiddleware.html index f8ee202..aab5dba 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerMiddleware.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerMiddleware.html @@ -1,4 +1,4 @@ SimpleHttpServerMiddleware | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerMiddleware

    This defines a function that accepts the standard request/response/next triad and utilizes them to do something, including (sometimes) send responses or add variables to the request, etc.

    It additionally defines a special middleware that handles errors

    -
    interface SimpleHttpServerMiddleware ((req, res, next) => unknown)

    Generated using TypeDoc

    \ No newline at end of file +
    interface SimpleHttpServerMiddleware ((req, res, next) => unknown)

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerRequestInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerRequestInterface.html index aa024d4..9d92bc3 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerRequestInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerRequestInterface.html @@ -1,4 +1,4 @@ -SimpleHttpServerRequestInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerRequestInterface

    interface SimpleHttpServerRequestInterface {
        params: {
            [key: string]: string;
        };
        query: {
            [key: string]: any;
        };
        get(name): undefined | string;
        header(name): undefined | string;
        path: string;
        hostname: string;
        body: any;
        method: string;
        originalUrl: string;
        url: string;
        accepts(): string[];
        accepts(type): undefined | string | false;
        accepts(type): undefined | string | false;
        accepts(...type): undefined | string | false;
    }

    Properties

    params +SimpleHttpServerRequestInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerRequestInterface

    interface SimpleHttpServerRequestInterface {
        params: {
            [key: string]: string;
        };
        query: {
            [key: string]: any;
        };
        get(name): undefined | string;
        header(name): undefined | string;
        path: string;
        hostname: string;
        body: any;
        method: string;
        originalUrl: string;
        url: string;
        accepts(): string[];
        accepts(type): undefined | string | false;
        accepts(type): undefined | string | false;
        accepts(...type): undefined | string | false;
    }

    Properties

    params query path hostname @@ -13,17 +13,17 @@

    Note: Because this is a runtime boundary, it's not useful to try to define this using generics. It's much better to leave it vague and to force developers to do runtime checks on the incoming data.

    -

    Type declaration

    • [key: string]: string
    query: {
        [key: string]: any;
    }

    Query parameters

    +

    Type declaration

    • [key: string]: string
    query: {
        [key: string]: any;
    }

    Query parameters

    See params for explanation of choice around "any" typing.

    -

    Type declaration

    • [key: string]: any
    path: string

    Get the full path of the request

    -
    hostname: string

    Get the hostname of the request

    -
    body: any

    Get the body of the request

    +

    Type declaration

    • [key: string]: any
    path: string

    Get the full path of the request

    +
    hostname: string

    Get the hostname of the request

    +
    body: any

    Get the body of the request

    See params for explanation of choice around "any" typing.

    -
    method: string

    The method by which the route was called

    -
    originalUrl: string

    The original URL for the request

    -
    url: string

    The final URL for the request

    -

    Methods

    • Get the value of a header

      -

      Parameters

      • name: string

      Returns undefined | string

    • Parameters

      • name: string

      Returns undefined | string

    method: string

    The method by which the route was called

    +
    originalUrl: string

    The original URL for the request

    +
    url: string

    The final URL for the request

    +

    Methods

    • Tests whether this request accepts the given content type(s). Returns false (or undefined?) if it does not, otherwise returns the preffered type that was passed in. (See express type documentation for more information.)

      -

      Returns string[]

    • Parameters

      • type: string

      Returns undefined | string | false

    • Parameters

      • type: string[]

      Returns undefined | string | false

    • Parameters

      • Rest ...type: string[]

      Returns undefined | string | false

    Generated using TypeDoc

    \ No newline at end of file +

    Returns string[]

  • Parameters

    • type: string

    Returns undefined | string | false

  • Parameters

    • type: string[]

    Returns undefined | string | false

  • Parameters

    • Rest ...type: string[]

    Returns undefined | string | false

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerResponseInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerResponseInterface.html index 806e6c1..0f753f2 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleHttpServerResponseInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleHttpServerResponseInterface.html @@ -1,6 +1,6 @@ SimpleHttpServerResponseInterface | @wymp/ts-simple-interfaces

    Interface SimpleHttpServerResponseInterface

    A response object, usually passed into request handlers and used to build up and eventually send an HTTP response.

    -
    interface SimpleHttpServerResponseInterface {
        status(code): SimpleHttpServerResponseInterface;
        send: ((body?) => SimpleHttpServerResponseInterface);
        set(field): SimpleHttpServerResponseInterface;
        set(field, value?): SimpleHttpServerResponseInterface;
        header(field): SimpleHttpServerResponseInterface;
        header(field, value?): SimpleHttpServerResponseInterface;
        get(field): string;
        redirect(url, status): void;
        locals: any;
    }

    Properties

    interface SimpleHttpServerResponseInterface {
        status(code): SimpleHttpServerResponseInterface;
        send: ((body?) => SimpleHttpServerResponseInterface);
        set(field): SimpleHttpServerResponseInterface;
        set(field, value?): SimpleHttpServerResponseInterface;
        header(field): SimpleHttpServerResponseInterface;
        header(field, value?): SimpleHttpServerResponseInterface;
        get(field): string;
        redirect(url, status): void;
        locals: any;
    }

    Properties

    Methods

    status set @@ -15,19 +15,19 @@

    Examples:

    res.send(Buffer.from('wahoo'));
    res.send({ some: 'json' });
    res.send('<p>some html</p>');
    res.status(404).send('Sorry, cant find that');
    -

    Parameters

    • Optional body: unknown

    Returns SimpleHttpServerResponseInterface

    locals: any

    Variables to attach to the response

    +

    Parameters

    • Optional body: unknown

    Returns SimpleHttpServerResponseInterface

    locals: any

    Variables to attach to the response

    While this is not a runtime boundary, there's no way to link handler functions together in such a way that we can statically verify conformity with expectations for this variable. Thus, it's better to type it as "any" because we will almost always be using it in a sort of "if this is set, then use it" sort of way.

    -

    Methods

    Methods

    • Get value for header field.

      -

      Parameters

      • field: string

      Returns string

    • Redirect to the given URL with the given status (defaults to 302 temporary)

      -

      Parameters

      • url: string
      • status: number

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns SimpleHttpServerResponseInterface

  • Parameters

    Returns SimpleHttpServerResponseInterface

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleLogLevels.html b/docs/ts-simple-interfaces/interfaces/SimpleLogLevels.html index 53aabeb..4d0fed8 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleLogLevels.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleLogLevels.html @@ -4,7 +4,7 @@ SimpleLoggerInterface defines these methods explicitly. Different loggers may implement other levels (for whatever reason) if they must.


    -
    interface SimpleLogLevels {
        debug: SimpleLeveledLogMethod;
        info: SimpleLeveledLogMethod;
        notice: SimpleLeveledLogMethod;
        warning: SimpleLeveledLogMethod;
        error: SimpleLeveledLogMethod;
        alert: SimpleLeveledLogMethod;
        critical: SimpleLeveledLogMethod;
        emergency: SimpleLeveledLogMethod;
    }

    Hierarchy (view full)

    Properties

    Hierarchy (view full)

    Properties

    Properties

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleLoggerConsumerInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleLoggerConsumerInterface.html index 0e12964..33d7073 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleLoggerConsumerInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleLoggerConsumerInterface.html @@ -1,3 +1,3 @@ SimpleLoggerConsumerInterface | @wymp/ts-simple-interfaces

    Interface SimpleLoggerConsumerInterface

    A SimpleLoggerConsumer accepts and uses a SimpleLoggerInterface

    -
    interface SimpleLoggerConsumerInterface {
        setLogger: ((logger) => unknown);
    }

    Properties

    Properties

    setLogger: ((logger) => unknown)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +
    interface SimpleLoggerConsumerInterface {
        setLogger: ((logger) => unknown);
    }

    Properties

    Properties

    setLogger: ((logger) => unknown)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleLoggerInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleLoggerInterface.html index eeaec95..3a130b6 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleLoggerInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleLoggerInterface.html @@ -4,7 +4,7 @@ SimpleLoggerInterface defines these methods explicitly. Different loggers may implement other levels (for whatever reason) if they must.


    -
    interface SimpleLoggerInterface {
        debug: SimpleLeveledLogMethod;
        info: SimpleLeveledLogMethod;
        notice: SimpleLeveledLogMethod;
        warning: SimpleLeveledLogMethod;
        error: SimpleLeveledLogMethod;
        alert: SimpleLeveledLogMethod;
        critical: SimpleLeveledLogMethod;
        emergency: SimpleLeveledLogMethod;
        log: SimpleLogMethod;
    }

    Hierarchy (view full)

    Implemented by

    Properties

    Hierarchy (view full)

    Implemented by

    Properties

    Properties

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimplePubSubInterface.html b/docs/ts-simple-interfaces/interfaces/SimplePubSubInterface.html index 809c274..978bc24 100644 --- a/docs/ts-simple-interfaces/interfaces/SimplePubSubInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimplePubSubInterface.html @@ -1,5 +1,5 @@ SimplePubSubInterface | @wymp/ts-simple-interfaces

    Interface SimplePubSubInterface<SubMsgType, PubMsgType, SubOptions, PubOptions>

    An interface that presents a pub/sub client

    -
    interface SimplePubSubInterface<SubMsgType, PubMsgType, SubOptions, PubOptions> {
        publish(channel, msg, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
        subscribe(routes, handler, options?): Promise<void>;
    }

    Type Parameters

    Hierarchy (view full)

    Methods

    interface SimplePubSubInterface<SubMsgType, PubMsgType, SubOptions, PubOptions> {
        publish(channel, msg, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
        subscribe(routes, handler, options?): Promise<void>;
    }

    Type Parameters

    Hierarchy (view full)

    Methods

    publish on once removeListener @@ -12,6 +12,6 @@ it is the channel's job to then route the message. The msg value should carry all necessary information for your implementation of the publisher to specify the correct routing parameters.

    -

    Parameters

    Returns Promise<void>

    • Needs to accommodate connection-level error handling and events

      -

      Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • Optional event: "error" | "connect" | "disconnect"

      Returns this

    • Close the connection

      -

      Returns Promise<unknown>

    • Parameters

      • routes: {
            [channel: string]: RoutingKey[];
        }
        • [channel: string]: RoutingKey[]
      • handler: ((msg, log) => Promise<boolean>)
      • Optional options: SubOptions

      Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimplePubSubMessageInterface.html b/docs/ts-simple-interfaces/interfaces/SimplePubSubMessageInterface.html index 22875e6..a7b4185 100644 --- a/docs/ts-simple-interfaces/interfaces/SimplePubSubMessageInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimplePubSubMessageInterface.html @@ -3,6 +3,6 @@ interface should resist the temptation to deserialize messages, as it gets very confusing trying to figure out when and where a message is expected to be in it's final form. That job should be delegated to higher level libraries.

    -
    interface SimplePubSubMessageInterface<Extra> {
        content: string | BufferLike;
        extra?: Extra;
    }

    Type Parameters

    Properties

    interface SimplePubSubMessageInterface<Extra> {
        content: string | BufferLike;
        extra?: Extra;
    }

    Type Parameters

    • Extra = unknown

    Properties

    Properties

    content: string | BufferLike
    extra?: Extra

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    content: string | BufferLike
    extra?: Extra

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimplePublisherInterface.html b/docs/ts-simple-interfaces/interfaces/SimplePublisherInterface.html index bcec56e..5de1629 100644 --- a/docs/ts-simple-interfaces/interfaces/SimplePublisherInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimplePublisherInterface.html @@ -2,7 +2,7 @@

    Implementations of this interface are expected to specify a concrete type for the msg parameter. This allows implementations to choose their own valid message formats.

    -
    interface SimplePublisherInterface<MsgType, Options> {
        publish(channel, msg, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
    }

    Type Parameters

    Hierarchy (view full)

    Methods

    interface SimplePublisherInterface<MsgType, Options> {
        publish(channel, msg, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
    }

    Type Parameters

    • MsgType

    • Options = unknown

    Hierarchy (view full)

    Methods

    publish on once removeListener @@ -14,6 +14,6 @@ it is the channel's job to then route the message. The msg value should carry all necessary information for your implementation of the publisher to specify the correct routing parameters.

    -

    Parameters

    Returns Promise<void>

    • Needs to accommodate connection-level error handling and events

      -

      Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • Optional event: "error" | "connect" | "disconnect"

      Returns this

    • Close the connection

      -

      Returns Promise<unknown>

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleSqlDbInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleSqlDbInterface.html index 1c75474..d150692 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleSqlDbInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleSqlDbInterface.html @@ -1,3 +1,3 @@ -SimpleSqlDbInterface | @wymp/ts-simple-interfaces
    interface SimpleSqlDbInterface {
        query: (<T>(query, params?) => Promise<SimpleSqlResponseInterface<T>>);
        transaction: (<T>(queries, txName?) => Promise<T>);
    }

    Properties

    query +SimpleSqlDbInterface | @wymp/ts-simple-interfaces
    interface SimpleSqlDbInterface {
        query: (<T>(query, params?) => Promise<SimpleSqlResponseInterface<T>>);
        transaction: (<T>(queries, txName?) => Promise<T>);
    }

    Properties

    Properties

    query: (<T>(query, params?) => Promise<SimpleSqlResponseInterface<T>>)

    Type declaration

    transaction: (<T>(queries, txName?) => Promise<T>)

    Type declaration

      • <T>(queries, txName?): Promise<T>
      • Type Parameters

        • T

        Parameters

        • queries: ((cnx) => Promise<T>)
        • Optional txName: null | string

        Returns Promise<T>

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    query: (<T>(query, params?) => Promise<SimpleSqlResponseInterface<T>>)

    Type declaration

    transaction: (<T>(queries, txName?) => Promise<T>)

    Type declaration

      • <T>(queries, txName?): Promise<T>
      • Type Parameters

        • T

        Parameters

        • queries: ((cnx) => Promise<T>)
        • Optional txName: null | string

        Returns Promise<T>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleSqlResponseInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleSqlResponseInterface.html index 4efad73..0b75694 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleSqlResponseInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleSqlResponseInterface.html @@ -1,8 +1,8 @@ SimpleSqlResponseInterface | @wymp/ts-simple-interfaces

    Interface SimpleSqlResponseInterface<T>

    Most of these properties are optional, since they are rarely used and many developers will choose not to implement them.

    -
    interface SimpleSqlResponseInterface<T> {
        rows: T[];
        affectedRows?: null | number;
        totalRows?: null | number;
    }

    Type Parameters

    • T

    Hierarchy (view full)

    Properties

    interface SimpleSqlResponseInterface<T> {
        rows: T[];
        affectedRows?: null | number;
        totalRows?: null | number;
    }

    Type Parameters

    • T

    Hierarchy (view full)

    Properties

    rows: T[]
    affectedRows?: null | number

    The number of rows affected by a create, update or delete action

    -
    totalRows?: null | number

    The total number of rows a SELECT query would have returned had it not had a limit applied

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Properties

    rows: T[]
    affectedRows?: null | number

    The number of rows affected by a create, update or delete action

    +
    totalRows?: null | number

    The total number of rows a SELECT query would have returned had it not had a limit applied

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleSubmittedEvent.html b/docs/ts-simple-interfaces/interfaces/SimpleSubmittedEvent.html index 66cee0a..f399d08 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleSubmittedEvent.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleSubmittedEvent.html @@ -1,14 +1,14 @@ SimpleSubmittedEvent | @wymp/ts-simple-interfaces

    An interface that provides a good starting point for a typical Event

    Note that this is intended to be extended in your domain to include whatever other data you might want in an event. This is not meant to be a complete event object.

    -
    interface SimpleSubmittedEvent {
        id?: string;
        timestamp?: number;
        domain?: string;
        parentIds?: null | string[];
        meta?: unknown;
    }

    Hierarchy (view full)

    Properties

    id? +
    interface SimpleSubmittedEvent {
        id?: string;
        timestamp?: number;
        domain?: string;
        parentIds?: null | string[];
        meta?: unknown;
    }

    Hierarchy (view full)

    Properties

    id?: string

    A UUID for the event

    -
    timestamp?: number

    The time in MS at which the event occurred

    -
    domain?: string

    The domain in which the event was produced

    -
    parentIds?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    -
    meta?: unknown

    A field for miscellaneous data

    -

    Generated using TypeDoc

    \ No newline at end of file +
    timestamp?: number

    The time in MS at which the event occurred

    +
    domain?: string

    The domain in which the event was produced

    +
    parentIds?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    +
    meta?: unknown

    A field for miscellaneous data

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleSubmittedTask.html b/docs/ts-simple-interfaces/interfaces/SimpleSubmittedTask.html index df388cf..9895761 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleSubmittedTask.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleSubmittedTask.html @@ -1,14 +1,14 @@ SimpleSubmittedTask | @wymp/ts-simple-interfaces

    An interface that provides a good starting point (based on JsonRpc) for a task-type message

    -
    interface SimpleSubmittedTask {
        id?: string;
        parents?: null | string[];
        domain?: string;
        method: string;
        params?: {
            [name: string]: string | number | boolean | object | null;
        } | (null | string | number | boolean | object)[];
        meta?: unknown;
    }

    Hierarchy (view full)

    Properties

    id? +
    interface SimpleSubmittedTask {
        id?: string;
        parents?: null | string[];
        domain?: string;
        method: string;
        params?: {
            [name: string]: string | number | boolean | object | null;
        } | (null | string | number | boolean | object)[];
        meta?: unknown;
    }

    Hierarchy (view full)

    Properties

    id?: string

    A UUID for the task

    -
    parents?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    -
    domain?: string

    The domain in which the task was produced

    -
    method: string

    The method to be called (see JsonRpc spec)

    -
    params?: {
        [name: string]: string | number | boolean | object | null;
    } | (null | string | number | boolean | object)[]

    The parameters to be supplied (see JsonRpc spec)

    -

    Type declaration

    • [name: string]: string | number | boolean | object | null
    meta?: unknown

    Misc extra data

    -

    Generated using TypeDoc

    \ No newline at end of file +
    parents?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    +
    domain?: string

    The domain in which the task was produced

    +
    method: string

    The method to be called (see JsonRpc spec)

    +
    params?: {
        [name: string]: string | number | boolean | object | null;
    } | (null | string | number | boolean | object)[]

    The parameters to be supplied (see JsonRpc spec)

    +

    Type declaration

    meta?: unknown

    Misc extra data

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleSubscriberInterface.html b/docs/ts-simple-interfaces/interfaces/SimpleSubscriberInterface.html index 99c1529..9fb92d7 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleSubscriberInterface.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleSubscriberInterface.html @@ -1,9 +1,9 @@ -SimpleSubscriberInterface | @wymp/ts-simple-interfaces

    Interface SimpleSubscriberInterface<MsgType, Options>

    interface SimpleSubscriberInterface<MsgType, Options> {
        subscribe(routes, handler, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
    }

    Type Parameters

    Hierarchy (view full)

    Methods

    subscribe +SimpleSubscriberInterface | @wymp/ts-simple-interfaces

    Interface SimpleSubscriberInterface<MsgType, Options>

    interface SimpleSubscriberInterface<MsgType, Options> {
        subscribe(routes, handler, options?): Promise<void>;
        on(event, listener): this;
        on(event, listener): this;
        on(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        once(event, listener): this;
        removeListener(event, listener): this;
        removeAllListeners(event?): this;
        close(): Promise<unknown>;
    }

    Type Parameters

    Hierarchy (view full)

    Methods

    • Parameters

      • routes: {
            [channel: string]: RoutingKey[];
        }
        • [channel: string]: RoutingKey[]
      • handler: ((msg, log) => Promise<boolean>)
      • Optional options: Options

      Returns Promise<void>

    • Needs to accommodate connection-level error handling and events

      -

      Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error"
      • listener: ((e) => void)
          • (e): void
          • Parameters

            • e: Error

            Returns void

      Returns this

    • Parameters

      • event: "connect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • Optional event: "error" | "connect" | "disconnect"

      Returns this

    • Close the connection

      -

      Returns Promise<unknown>

    Generated using TypeDoc

    \ No newline at end of file +

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/interfaces/SimpleTask.html b/docs/ts-simple-interfaces/interfaces/SimpleTask.html index 69c4e26..cc408a5 100644 --- a/docs/ts-simple-interfaces/interfaces/SimpleTask.html +++ b/docs/ts-simple-interfaces/interfaces/SimpleTask.html @@ -1,5 +1,5 @@ SimpleTask | @wymp/ts-simple-interfaces

    An interface that provides a good starting point (based on JsonRpc) for a task-type message

    -
    interface SimpleTask {
        parents?: null | string[];
        method: string;
        params?: {
            [name: string]: string | number | boolean | object | null;
        } | (null | string | number | boolean | object)[];
        meta?: unknown;
        type: "task";
        id: string;
        domain: string;
    }

    Hierarchy (view full)

    Properties

    interface SimpleTask {
        parents?: null | string[];
        method: string;
        params?: {
            [name: string]: string | number | boolean | object | null;
        } | (null | string | number | boolean | object)[];
        meta?: unknown;
        type: "task";
        id: string;
        domain: string;
    }

    Hierarchy (view full)

    Properties

    Properties

    parents?: null | string[]

    A stack of event ID that caused this event to be produced, if applicable

    -
    method: string

    The method to be called (see JsonRpc spec)

    -
    params?: {
        [name: string]: string | number | boolean | object | null;
    } | (null | string | number | boolean | object)[]

    The parameters to be supplied (see JsonRpc spec)

    -

    Type declaration

    • [name: string]: string | number | boolean | object | null
    meta?: unknown

    Misc extra data

    -
    type: "task"
    id: string

    A UUID for the task

    -
    domain: string

    The domain in which the task was produced

    -

    Generated using TypeDoc

    \ No newline at end of file +
    method: string

    The method to be called (see JsonRpc spec)

    +
    params?: {
        [name: string]: string | number | boolean | object | null;
    } | (null | string | number | boolean | object)[]

    The parameters to be supplied (see JsonRpc spec)

    +

    Type declaration

    meta?: unknown

    Misc extra data

    +
    type: "task"
    id: string

    A UUID for the task

    +
    domain: string

    The domain in which the task was produced

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/modules/Errors.html b/docs/ts-simple-interfaces/modules/Errors.html index 648f81a..e63a1fe 100644 --- a/docs/ts-simple-interfaces/modules/Errors.html +++ b/docs/ts-simple-interfaces/modules/Errors.html @@ -1,4 +1,4 @@ -Errors | @wymp/ts-simple-interfaces

    Index

    Classes

    SimpleHttpClientRequestError +Errors | @wymp/ts-simple-interfaces

    Index

    Classes

    Type Aliases

    HttpErrorStatuses HttpStatusCodes diff --git a/docs/ts-simple-interfaces/types/CharacterEncodings.html b/docs/ts-simple-interfaces/types/CharacterEncodings.html index 89d3377..39b5fdb 100644 --- a/docs/ts-simple-interfaces/types/CharacterEncodings.html +++ b/docs/ts-simple-interfaces/types/CharacterEncodings.html @@ -1,4 +1,4 @@ CharacterEncodings | @wymp/ts-simple-interfaces
    CharacterEncodings: "utf8" | "hex" | "base64" | "utf16"

    NOTE: In order to make BufferLike work without node types, we had to use some displeasingly vague types, like "object". This is considered acceptable in light of the goal of not requiring node typings for this library.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/HttpMethods.html b/docs/ts-simple-interfaces/types/HttpMethods.html index 258f9dd..9106cc2 100644 --- a/docs/ts-simple-interfaces/types/HttpMethods.html +++ b/docs/ts-simple-interfaces/types/HttpMethods.html @@ -1 +1 @@ -HttpMethods | @wymp/ts-simple-interfaces

    Generated using TypeDoc

    \ No newline at end of file +HttpMethods | @wymp/ts-simple-interfaces

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SimpleHttpServerNextFunction.html b/docs/ts-simple-interfaces/types/SimpleHttpServerNextFunction.html index 7055719..91561d1 100644 --- a/docs/ts-simple-interfaces/types/SimpleHttpServerNextFunction.html +++ b/docs/ts-simple-interfaces/types/SimpleHttpServerNextFunction.html @@ -3,4 +3,4 @@ error occurs while processing a request, you can pass that error to this next function to activate any error handling logic you've put in place. Otherwise, control is simply passed to the next middleware in the stack.

    -

    Type declaration

      • (errOrOtherVal?): void
      • Parameters

        • Optional errOrOtherVal: any

        Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SimpleLeveledLogMethod.html b/docs/ts-simple-interfaces/types/SimpleLeveledLogMethod.html index 2346252..d83df87 100644 --- a/docs/ts-simple-interfaces/types/SimpleLeveledLogMethod.html +++ b/docs/ts-simple-interfaces/types/SimpleLeveledLogMethod.html @@ -1 +1 @@ -SimpleLeveledLogMethod | @wymp/ts-simple-interfaces

    Type alias SimpleLeveledLogMethod

    SimpleLeveledLogMethod: ((message, ...meta) => SimpleLoggerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +SimpleLeveledLogMethod | @wymp/ts-simple-interfaces

    Type alias SimpleLeveledLogMethod

    SimpleLeveledLogMethod: ((message, ...meta) => SimpleLoggerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SimpleLogMethod.html b/docs/ts-simple-interfaces/types/SimpleLogMethod.html index f8239b3..a858000 100644 --- a/docs/ts-simple-interfaces/types/SimpleLogMethod.html +++ b/docs/ts-simple-interfaces/types/SimpleLogMethod.html @@ -1 +1 @@ -SimpleLogMethod | @wymp/ts-simple-interfaces
    SimpleLogMethod: ((level, message, ...meta) => SimpleLoggerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +SimpleLogMethod | @wymp/ts-simple-interfaces
    SimpleLogMethod: ((level, message, ...meta) => SimpleLoggerInterface)

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SimpleMessage.html b/docs/ts-simple-interfaces/types/SimpleMessage.html index 85062e9..7a5a5ea 100644 --- a/docs/ts-simple-interfaces/types/SimpleMessage.html +++ b/docs/ts-simple-interfaces/types/SimpleMessage.html @@ -1 +1 @@ -SimpleMessage | @wymp/ts-simple-interfaces
    SimpleMessage: SimpleEvent | SimpleTask

    Generated using TypeDoc

    \ No newline at end of file +SimpleMessage | @wymp/ts-simple-interfaces
    SimpleMessage: SimpleEvent | SimpleTask

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SqlPrimitive.html b/docs/ts-simple-interfaces/types/SqlPrimitive.html index 3221c6f..4f6e65d 100644 --- a/docs/ts-simple-interfaces/types/SqlPrimitive.html +++ b/docs/ts-simple-interfaces/types/SqlPrimitive.html @@ -2,4 +2,4 @@ be implemented more specifically as a general SimpleSqlDbInterface. This interface is intended to help unify the various implementations of SQL databases out in the wild, such that they may be more plug-and-playable.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-interfaces/types/SqlValue.html b/docs/ts-simple-interfaces/types/SqlValue.html index 62e860f..3054253 100644 --- a/docs/ts-simple-interfaces/types/SqlValue.html +++ b/docs/ts-simple-interfaces/types/SqlValue.html @@ -1 +1 @@ -SqlValue | @wymp/ts-simple-interfaces
    SqlValue: SqlPrimitive | SqlValue[]

    Generated using TypeDoc

    \ No newline at end of file +SqlValue | @wymp/ts-simple-interfaces
    SqlValue: SqlPrimitive | SqlValue[]

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-console/classes/SimpleLoggerConsole.html b/docs/ts-simple-logger-console/classes/SimpleLoggerConsole.html index d28422e..572ced5 100644 --- a/docs/ts-simple-logger-console/classes/SimpleLoggerConsole.html +++ b/docs/ts-simple-logger-console/classes/SimpleLoggerConsole.html @@ -4,7 +4,7 @@ returns a string composed using that data. Defaults to the following:

    ${timestamp} [${level}] ${message}${meta}
     
    -

    Implements

    Constructors

    Implements

    • SimpleLoggerInterface

    Constructors

    Properties

    Constructors

    Properties

    _level: number = 20
    formatter: ((level, message, ...args) => string)

    Type declaration

      • (level, message, ...args): string
      • Parameters

        • level: string
        • message: string
        • Rest ...args: any[]

        Returns string

    legacyFormat: string = '${timestamp} [${level}] ${message}${meta}'
    console: Console
    levelMap: {
        debug: number;
        info: number;
        notice: number;
        warning: number;
        error: number;
        alert: number;
        critical: number;
        emergency: number;
    } = ...

    Type declaration

    • debug: number
    • info: number
    • notice: number
    • warning: number
    • error: number
    • alert: number
    • critical: number
    • emergency: number

    Accessors

    • get level(): keyof SimpleLogLevels
    • Returns keyof SimpleLogLevels

    • set level(l): void
    • Parameters

      • l: keyof SimpleLogLevels

      Returns void

    Methods

    • Parameters

      • _level: string
      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    _level: number = 20
    formatter: ((level, message, ...args) => string)

    Type declaration

      • (level, message, ...args): string
      • Parameters

        • level: string
        • message: string
        • Rest ...args: any[]

        Returns string

    legacyFormat: string = '${timestamp} [${level}] ${message}${meta}'
    console: Console
    levelMap: {
        debug: number;
        info: number;
        notice: number;
        warning: number;
        error: number;
        alert: number;
        critical: number;
        emergency: number;
    } = ...

    Type declaration

    • debug: number
    • info: number
    • notice: number
    • warning: number
    • error: number
    • alert: number
    • critical: number
    • emergency: number

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-console/index.html b/docs/ts-simple-logger-console/index.html index 2359f88..deb2825 100644 --- a/docs/ts-simple-logger-console/index.html +++ b/docs/ts-simple-logger-console/index.html @@ -2,7 +2,7 @@ that allows for better interoperability and dependency choice for consumers.

    This package provides a light wrapper around the console logger that enforces conformity with the SimpleLoggerInterface defined in -ts-simple-interfaces.

    +ts-simple-interfaces.

    Specifically, this gives you the ability to tone down the messages logged to the console in the browser.

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-console/types/Console.html b/docs/ts-simple-logger-console/types/Console.html index 4f0ce02..071da60 100644 --- a/docs/ts-simple-logger-console/types/Console.html +++ b/docs/ts-simple-logger-console/types/Console.html @@ -1,2 +1,2 @@ Console | @wymp/simple-logger-console
    Console: {
        debug: ((msg, ...args) => void);
        info: ((msg, ...args) => void);
        log: ((msg, ...args) => void);
        warn: ((msg, ...args) => void);
        error: ((msg, ...args) => void);
    }

    A Console interface for use in creating a mock console for testing

    -

    Type declaration

    • debug: ((msg, ...args) => void)
        • (msg, ...args): void
        • Parameters

          • msg: string
          • Rest ...args: any[]

          Returns void

    • info: ((msg, ...args) => void)
        • (msg, ...args): void
        • Parameters

          • msg: string
          • Rest ...args: any[]

          Returns void

    • log: ((msg, ...args) => void)
        • (msg, ...args): void
        • Parameters

          • msg: string
          • Rest ...args: any[]

          Returns void

    • warn: ((msg, ...args) => void)
        • (msg, ...args): void
        • Parameters

          • msg: string
          • Rest ...args: any[]

          Returns void

    • error: ((msg, ...args) => void)
        • (msg, ...args): void
        • Parameters

          • msg: string
          • Rest ...args: any[]

          Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-console/types/LegacyOpts.html b/docs/ts-simple-logger-console/types/LegacyOpts.html index 17b9352..d59ffc8 100644 --- a/docs/ts-simple-logger-console/types/LegacyOpts.html +++ b/docs/ts-simple-logger-console/types/LegacyOpts.html @@ -1,2 +1,2 @@ LegacyOpts | @wymp/simple-logger-console
    LegacyOpts: {
        format: string;
    }

    Old options hash

    -

    Type declaration

    • format: string

    Deprecated

    Generated using TypeDoc

    \ No newline at end of file +

    Type declaration

    Deprecated

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-console/types/Opts.html b/docs/ts-simple-logger-console/types/Opts.html index e08c1e4..774cde9 100644 --- a/docs/ts-simple-logger-console/types/Opts.html +++ b/docs/ts-simple-logger-console/types/Opts.html @@ -2,4 +2,4 @@

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns string

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-winston/classes/SimpleLoggerWinston.html b/docs/ts-simple-logger-winston/classes/SimpleLoggerWinston.html index 5cfd11c..4c4f152 100644 --- a/docs/ts-simple-logger-winston/classes/SimpleLoggerWinston.html +++ b/docs/ts-simple-logger-winston/classes/SimpleLoggerWinston.html @@ -1,4 +1,4 @@ -SimpleLoggerWinston | @wymp/simple-logger-winston

    Implements

    • SimpleLoggerInterface

    Constructors

    constructor +SimpleLoggerWinston | @wymp/simple-logger-winston

    Implements

    • SimpleLoggerInterface

    Constructors

    Properties

    Methods

    log debug @@ -9,4 +9,4 @@ alert critical emergency -

    Constructors

    Properties

    winston: Logger

    Methods

    • Parameters

      • level: string
      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    winston: Logger

    Methods

    • Parameters

      • level: string
      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    • Parameters

      • message: string
      • Rest ...meta: any[]

      Returns this

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-logger-winston/index.html b/docs/ts-simple-logger-winston/index.html index 32621be..50988af 100644 --- a/docs/ts-simple-logger-winston/index.html +++ b/docs/ts-simple-logger-winston/index.html @@ -5,5 +5,5 @@ Winston are largely irrelevant in a modern containerized environment.

    This package provides a light wrapper around the winston logger that enforces conformity with the SimpleLoggerInterface defined in -ts-simple-interfaces.

    +ts-simple-interfaces.

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/assets/highlight.css b/docs/ts-simple-pubsub-amqp/assets/highlight.css index 5674cf3..6e7ef39 100644 --- a/docs/ts-simple-pubsub-amqp/assets/highlight.css +++ b/docs/ts-simple-pubsub-amqp/assets/highlight.css @@ -1,22 +1,92 @@ :root { + --light-hl-0: #0000FF; + --dark-hl-0: #569CD6; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #267F99; + --dark-hl-2: #4EC9B0; + --light-hl-3: #A31515; + --dark-hl-3: #CE9178; + --light-hl-4: #001080; + --dark-hl-4: #9CDCFE; + --light-hl-5: #008000; + --dark-hl-5: #6A9955; + --light-hl-6: #795E26; + --dark-hl-6: #DCDCAA; + --light-hl-7: #AF00DB; + --dark-hl-7: #C586C0; + --light-hl-8: #0070C1; + --dark-hl-8: #4FC1FF; + --light-hl-9: #000000FF; + --dark-hl-9: #D4D4D4; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @media (prefers-color-scheme: light) { :root { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } } @media (prefers-color-scheme: dark) { :root { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } } :root[data-theme='light'] { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } :root[data-theme='dark'] { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } +.hl-0 { color: var(--hl-0); } +.hl-1 { color: var(--hl-1); } +.hl-2 { color: var(--hl-2); } +.hl-3 { color: var(--hl-3); } +.hl-4 { color: var(--hl-4); } +.hl-5 { color: var(--hl-5); } +.hl-6 { color: var(--hl-6); } +.hl-7 { color: var(--hl-7); } +.hl-8 { color: var(--hl-8); } +.hl-9 { color: var(--hl-9); } pre, code { background: var(--code-background); } diff --git a/docs/ts-simple-pubsub-amqp/assets/navigation.js b/docs/ts-simple-pubsub-amqp/assets/navigation.js index e7982e2..d0eb308 100644 --- a/docs/ts-simple-pubsub-amqp/assets/navigation.js +++ b/docs/ts-simple-pubsub-amqp/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA43SzwuCMBTA8f/lnSUpKMJbeY4Ej9FhW08dzmm+CUL0v4cZ/dqYXnZ5331g451uYLA3EMGhFuWuujax7iGAhpkCIhCKESGFX8NFYSoFAZRSXyBarrb3wDYKpjUqjzMGPiuVVaNwiA9IxHL8aFIbbDMmkEKr+iVX68032XESrWyMrPXxeZIbtTsfm3RcSSp84m/iw/ZMlHWWOZXXzPvE93/Etc5kPvFpYzQb1CiGB0yjr3Am/L8tbtW1Mi4y6Xja8eGKvX//hW8Bd5xMy4TxeXZji+cH9cXsu2QDAAA=" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA43SwW6DMAwG4HfxGY0WqVvHbZp6rDqN49RDyNwSEUIWG4lq2rtXsGqshIZecvHvL5bsj29gbBlS2NayfKm+7KtpIQIruIAUpBZESPG/4kPBlYYISmU+IV0m65/INwphDOqA8xsIWV1s07ITg8InixT/Fa67k8Xz03KVjIQtEokjThmX0pySqcpqzJqcpFOWVW12/UuDqQyjOwiJFN9Mj75ZPXpfvDW5VlTM69fBEPyO7E6TUl+Zn6nfVW0O6hiYZwjdDRqU3fDz6CV4Jzw+u2l16vZuLCRr8q7FP+RxInjJObETkkOen/HF/RlyHJU7rQMAAA==" \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/assets/search.js b/docs/ts-simple-pubsub-amqp/assets/search.js index 66e8161..d7c4cd9 100644 --- a/docs/ts-simple-pubsub-amqp/assets/search.js +++ b/docs/ts-simple-pubsub-amqp/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/classes/AbstractPubSubAmqp.html b/docs/ts-simple-pubsub-amqp/classes/AbstractPubSubAmqp.html index 8a5f015..fef5ff1 100644 --- a/docs/ts-simple-pubsub-amqp/classes/AbstractPubSubAmqp.html +++ b/docs/ts-simple-pubsub-amqp/classes/AbstractPubSubAmqp.html @@ -1,9 +1,14 @@ -AbstractPubSubAmqp | @wymp/simple-pubsub-amqp

    Class AbstractPubSubAmqpAbstract

    It will be common for projects to want to further specify their incoming and outgoing message +AbstractPubSubAmqp | @wymp/simple-pubsub-amqp

    Class AbstractPubSubAmqp<PubMsgType>Abstract

    It will be common for projects to want to further specify their incoming and outgoing message formats. However, doing so will be incompatible with the base PubSubInterface used by the above class, and thus extending will not work.

    Following is an abstract adapter class allowing projects to define their message types more specifically without having to do much work.

    -

    Constructors

    constructor +

    You will generally extend this class and add publish and subscribe methods to accommodate +your desired pub-sub interface. These methods should use the underlying SimplePubSubAmqp class +provided by this.driver to do their actual work.

    +

    Example

    type MyActions = 'create' | 'update' | 'delete';

    type FooTypes = 'one' | 'two' | 'three';
    type FooMsgs =
    | { domain: 'foo'; action: MyActions; resourceType: FooTypes; data: { foo: string } };

    type BarTypes = 'four' | 'five' | 'six';
    type BarMsgs =
    | { domain: 'bar'; action: MyActions; resourceType: BarTypes; data: { bar: number } };

    type BazTypes = 'seven' | 'eight' | 'nine';
    type BazMsgs =
    | { domain: 'baz'; action: MyActions; resourceType: BazTypes; data: { baz: boolean } };

    type MyMsgs = FooMsgs | BarMsgs | BazMsgs;

    // With this class, we greatly simplify and make more specific our pub-sub interface. We can do this because we're
    // taking certain values (like the channel) up front (say, because you have only one exchange that you use for
    // all MQ communication), and because we've defined our message types in a way that allows us to auto-generate
    // publishing information about them (specifically, the routingKey).
    //
    // Now our publishing flow is greatly simplified and our subscription handlers can focus on simply processing the
    // incoming data.
    class MyFooPubSub extends AbstractPubSubAmqp<FooMsgs> {
    public constructor(protected channel: string, config: SimpleAmqpConfig, log: SimpleLoggerInterface, deps?: { retry?: Retry}) {
    super(config, log, deps);
    }

    // Subscriptions have to handle messages from any domain, so the handler accepts messages of all our message types.
    public async subscribe(keys: Array<string>, handler: (msg: MyMsgs, log: SimpleLoggerInterface) => Promise<boolean>) {
    return this.driver.subscribe(
    { [this.channel]: keys },
    (msg, log) => {
    // Retry logic is already handled by our driver, so we just need to translate the message here
    const m: MyMsgs = JSON.parse(msg.content.toString('utf8'));
    return handler(m, log);
    },
    { queue: { name: 'foo-queue' } }
    );
    }

    // However, you can only publish FooMsgs
    public async publish(msg: FooMsgs) {
    return this.driver.publish(this.channel, msg, { routingKey: `${msg.domain}.${msg.action}.${msg.resourceType}` });
    }
    }
    +
    +

    Type Parameters

    • PubMsgType = unknown

    Constructors

    Properties

    Constructors

    Properties

    log: SimpleLoggerInterface

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    log: SimpleLoggerInterface

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/classes/MockAmqpChannel.html b/docs/ts-simple-pubsub-amqp/classes/MockAmqpChannel.html index a2fed5a..ccccbbb 100644 --- a/docs/ts-simple-pubsub-amqp/classes/MockAmqpChannel.html +++ b/docs/ts-simple-pubsub-amqp/classes/MockAmqpChannel.html @@ -1,4 +1,5 @@ -MockAmqpChannel | @wymp/simple-pubsub-amqp

    Implements

    Constructors

    constructor +MockAmqpChannel | @wymp/simple-pubsub-amqp

    A simple AMQP channel

    +

    Implements

    Constructors

    Properties

    Constructors

    Properties

    emitter: EventEmitter
    _calls: {
        [method: string]: any[][];
    } = {}

    Type declaration

    • [method: string]: any[][]
    _index: number
    subscriptions: {
        [queue: string]: any[];
    } = {}

    Type declaration

    • [queue: string]: any[]
    log: SimpleLoggerInterface
    publishReturnValueQueue: (boolean | Error)[] = []

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    emitter: EventEmitter
    _calls: {
        [method: string]: any[][];
    } = {}

    Type declaration

    • [method: string]: any[][]
    _index: number
    subscriptions: {
        [queue: string]: any[];
    } = {}

    Type declaration

    • [queue: string]: any[]
    log: SimpleLoggerInterface
    publishReturnValueQueue: (boolean | Error)[] = []

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/classes/MockAmqpCnx.html b/docs/ts-simple-pubsub-amqp/classes/MockAmqpCnx.html index 5c96eb8..8d02ded 100644 --- a/docs/ts-simple-pubsub-amqp/classes/MockAmqpCnx.html +++ b/docs/ts-simple-pubsub-amqp/classes/MockAmqpCnx.html @@ -1,4 +1,5 @@ -MockAmqpCnx | @wymp/simple-pubsub-amqp

    Implements

    Constructors

    constructor +MockAmqpCnx | @wymp/simple-pubsub-amqp

    A simple AMQP connection

    +

    Implements

    Constructors

    Properties

    Constructors

    Properties

    manualResolve: boolean = false
    emitter: EventEmitter
    ch: null | MockAmqpChannel = null
    _resolve: null | ((ch) => void) = null

    Type declaration

    log: SimpleLoggerInterface

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    manualResolve: boolean = false
    emitter: EventEmitter
    ch: null | MockAmqpChannel = null
    _resolve: null | ((ch) => void) = null

    Type declaration

    log: SimpleLoggerInterface

    Accessors

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/classes/SimplePubSubAmqp.html b/docs/ts-simple-pubsub-amqp/classes/SimplePubSubAmqp.html index 8891c66..86c6322 100644 --- a/docs/ts-simple-pubsub-amqp/classes/SimplePubSubAmqp.html +++ b/docs/ts-simple-pubsub-amqp/classes/SimplePubSubAmqp.html @@ -1,10 +1,13 @@ -SimplePubSubAmqp | @wymp/simple-pubsub-amqp

    Main PubSub class

    -

    Implements

    Constructors

    constructor +SimplePubSubAmqp | @wymp/simple-pubsub-amqp

    Class SimplePubSubAmqp<PubMsgType>

    The standard Simple PubSub implementation for AMQP.

    +

    Because amqplib has such awful error handling properties, this class implements complex logic for managing the +connection. It will attempt to re-establish the both the channel and the connection in the case of errors in either, +and will queue subscription requests until the connection is established and restore subscriptions on reconnect.

    +

    Type Parameters

    • PubMsgType = unknown

    Implements

    Constructors

    Properties

    cnx: null | SimpleAmqpConnection = null
    ch: null | SimpleAmqpChannel = null
    subscriptions: SubscriptionQueue = []
    _waiting: boolean = true
    backoff: Backoff
    emitter: EventEmitter
    closed: boolean = false
    amqpConnect: ((url, socketOptions?) => Promise<SimpleAmqpConnection>)

    Type declaration

    reloads: number = 0
    reloadTimer: any = null
    log: SimpleLoggerInterface

    Accessors

    Methods

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • routes: {
            [exchange: string]: RoutingKey[];
        }
        • [exchange: string]: RoutingKey[]
      • handler: ((msg, log) => Promise<boolean>)
          • (msg, log): Promise<boolean>
          • Parameters

            Returns Promise<boolean>

      • options: SubscriptionOptions

      Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    cnx: null | SimpleAmqpConnection = null
    ch: null | SimpleAmqpChannel = null
    subscriptions: SubscriptionQueue = []
    _waiting: boolean = true
    retry: Retry
    emitter: EventEmitter
    closed: boolean = false
    amqpConnect: ((url, socketOptions?) => Promise<SimpleAmqpConnection>)

    Type declaration

    reloads: number = 0
    reloadTimer: any = null
    log: SimpleLoggerInterface

    Accessors

    Methods

    • Parameters

      • event: "error" | "connect" | "disconnect"
      • listener: (() => void)
          • (): void
          • Returns void

      Returns this

    • Parameters

      • routes: {
            [exchange: string]: RoutingKey[];
        }
        • [exchange: string]: RoutingKey[]
      • handler: ((msg, log) => Promise<boolean>)
          • (msg, log): Promise<boolean>
          • Parameters

            Returns Promise<boolean>

      • options: SimpleSubscriptionOptions

      Returns Promise<void>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/hierarchy.html b/docs/ts-simple-pubsub-amqp/hierarchy.html index 4cb68e2..d5b76f5 100644 --- a/docs/ts-simple-pubsub-amqp/hierarchy.html +++ b/docs/ts-simple-pubsub-amqp/hierarchy.html @@ -1 +1 @@ -@wymp/simple-pubsub-amqp

    @wymp/simple-pubsub-amqp

    Class Hierarchy

    Generated using TypeDoc

    \ No newline at end of file +@wymp/simple-pubsub-amqp

    @wymp/simple-pubsub-amqp

    Class Hierarchy

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/index.html b/docs/ts-simple-pubsub-amqp/index.html index aaddff5..d0d7fd7 100644 --- a/docs/ts-simple-pubsub-amqp/index.html +++ b/docs/ts-simple-pubsub-amqp/index.html @@ -1,9 +1,9 @@ @wymp/simple-pubsub-amqp

    @wymp/simple-pubsub-amqp

    Simple PubSub, AMQP

    A Simple™-conformant wrapper for the AMQP PubSub Implementation. "Simple" is intended to be a highly reduced interface that allows for better interoperability and dependency choice for consumers.

    This package provides a light wrapper around amqplib that enforces conformity with the SimplePubSubInterface defined -in ts-simple-interfaces. +in ts-simple-interfaces. See that package for information about the interface.

    This implementation provides for the definition of exchange and queue options via the optional options argument supplied to the subscribe function. For publishing, you must first call the assertChannel method, which is a pass-through to the underlying assertExchange method of amqplib and accepts the same arguments.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/Backoff.html b/docs/ts-simple-pubsub-amqp/interfaces/Backoff.html deleted file mode 100644 index 1fa3ead..0000000 --- a/docs/ts-simple-pubsub-amqp/interfaces/Backoff.html +++ /dev/null @@ -1,2 +0,0 @@ -Backoff | @wymp/simple-pubsub-amqp
    interface Backoff {
        run(job, log): Promise<boolean>;
    }

    Methods

    run -

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/PublishOptions.html b/docs/ts-simple-pubsub-amqp/interfaces/PublishOptions.html deleted file mode 100644 index 221abb4..0000000 --- a/docs/ts-simple-pubsub-amqp/interfaces/PublishOptions.html +++ /dev/null @@ -1,11 +0,0 @@ -PublishOptions | @wymp/simple-pubsub-amqp
    interface PublishOptions {
        routingKey: string;
        appId?: string;
        type?: string;
        timestamp?: number;
        messageId?: string;
        headers?: {
            [k: string]: string | number;
        };
        contentEncoding?: string;
        contentType?: string;
        expiration?: number;
        persistent?: boolean;
    }

    Properties

    routingKey: string
    appId?: string
    type?: string
    timestamp?: number
    messageId?: string
    headers?: {
        [k: string]: string | number;
    }

    Type declaration

    • [k: string]: string | number
    contentEncoding?: string
    contentType?: string
    expiration?: number
    persistent?: boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/Retry.html b/docs/ts-simple-pubsub-amqp/interfaces/Retry.html new file mode 100644 index 0000000..f8e71a0 --- /dev/null +++ b/docs/ts-simple-pubsub-amqp/interfaces/Retry.html @@ -0,0 +1,3 @@ +Retry | @wymp/simple-pubsub-amqp

    An interface defining a retry controller for running jobs with retries on failure

    +
    interface Retry {
        run(job, log, jobId?): Promise<boolean>;
    }

    Methods

    run +

    Methods

    • Parameters

      • job: (() => Promise<boolean>)
          • (): Promise<boolean>
          • Returns Promise<boolean>

      • log: SimpleLoggerInterface
      • Optional jobId: string

      Returns Promise<boolean>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpChannel.html b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpChannel.html index 719140f..95517cb 100644 --- a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpChannel.html +++ b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpChannel.html @@ -1,4 +1,5 @@ -SimpleAmqpChannel | @wymp/simple-pubsub-amqp
    interface SimpleAmqpChannel {
        close(): Promise<void>;
        assertExchange(exchange, type, options?): Promise<AssertExchange>;
        assertQueue(queue, options?): Promise<AssertQueue>;
        bindQueue(queue, source, pattern, args?): Promise<Empty>;
        consume(queue, onMessage, options?): Promise<Consume>;
        ack(message, allUpTo?): void;
        nack(message, allUpTo?, requeue?): void;
        publish(exchange, routingKey, content, options?): boolean;
        once(ev, handler): unknown;
        on(ev, handler): unknown;
        on(ev, handler): unknown;
    }

    Implemented by

    Methods

    close +SimpleAmqpChannel | @wymp/simple-pubsub-amqp

    A simple AMQP channel

    +
    interface SimpleAmqpChannel {
        close(): Promise<void>;
        assertExchange(exchange, type, options?): Promise<AssertExchange>;
        assertQueue(queue, options?): Promise<AssertQueue>;
        bindQueue(queue, source, pattern, args?): Promise<Empty>;
        consume(queue, onMessage, options?): Promise<Consume>;
        ack(message, allUpTo?): void;
        nack(message, allUpTo?, requeue?): void;
        publish(exchange, routingKey, content, options?): boolean;
        once(ev, handler): unknown;
        on(ev, handler): unknown;
        on(ev, handler): unknown;
    }

    Implemented by

    Methods

    • Parameters

      • queue: string
      • onMessage: ((msg) => any)
          • (msg): any
          • Parameters

            • msg: null | ConsumeMessage

            Returns any

      • Optional options: Consume

      Returns Promise<Consume>

    Generated using TypeDoc

    \ No newline at end of file +

    Methods

    • Parameters

      • queue: string
      • onMessage: ((msg) => any)
          • (msg): any
          • Parameters

            • msg: null | ConsumeMessage

            Returns any

      • Optional options: Consume

      Returns Promise<Consume>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConfig.html b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConfig.html index 1d26907..70d1006 100644 --- a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConfig.html +++ b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConfig.html @@ -1,5 +1,5 @@ -SimpleAmqpConfig | @wymp/simple-pubsub-amqp

    Some AMQP definitions for purposes of improving testability

    -
    interface SimpleAmqpConfig {
        protocol?: string;
        hostname?: string;
        port?: number;
        username?: string;
        password?: string;
        locale?: string;
        frameMax?: number;
        heartbeat?: number;
        vhost?: string;
    }

    Hierarchy

    • Connect
      • SimpleAmqpConfig

    Properties

    protocol? +SimpleAmqpConfig | @wymp/simple-pubsub-amqp

    Configuration options for the SimplePubsubAmqp class

    +
    interface SimpleAmqpConfig {
        protocol?: string;
        hostname?: string;
        port?: number;
        username?: string;
        password?: string;
        locale?: string;
        frameMax?: number;
        heartbeat?: number;
        vhost?: string;
    }

    Hierarchy

    • Connect
      • SimpleAmqpConfig

    Properties

    protocol? hostname? port? username? @@ -27,4 +27,4 @@

    Default value: 0

    vhost?: string

    What VHost shall be used.

    Default value: '/'

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConnection.html b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConnection.html index 79ecaf6..a9e7635 100644 --- a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConnection.html +++ b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpConnection.html @@ -1,4 +1,5 @@ -SimpleAmqpConnection | @wymp/simple-pubsub-amqp

    Interface SimpleAmqpConnection

    interface SimpleAmqpConnection {
        close(): Promise<void>;
        createChannel(): Promise<SimpleAmqpChannel>;
        on(ev, handler): unknown;
        on(ev, handler): unknown;
    }

    Implemented by

    Methods

    close +SimpleAmqpConnection | @wymp/simple-pubsub-amqp

    Interface SimpleAmqpConnection

    A simple AMQP connection

    +
    interface SimpleAmqpConnection {
        close(): Promise<void>;
        createChannel(): Promise<SimpleAmqpChannel>;
        on(ev, handler): unknown;
        on(ev, handler): unknown;
    }

    Implemented by

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpMessage.html b/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpMessage.html deleted file mode 100644 index 5690bf1..0000000 --- a/docs/ts-simple-pubsub-amqp/interfaces/SimpleAmqpMessage.html +++ /dev/null @@ -1,4 +0,0 @@ -SimpleAmqpMessage | @wymp/simple-pubsub-amqp

    AMQP-Specific Types

    -
    interface SimpleAmqpMessage {
        content: Buffer;
        extra: {
            exchange: string;
            routingKey: string;
            redelivered: boolean;
            appId?: string;
            type?: string;
            timestamp: number;
            messageId: string;
            headers?: {
                [k: string]: string | number;
            };
            contentEncoding?: string;
            contentType?: string;
            expiration?: number;
        };
    }

    Hierarchy

    • SimplePubSubMessageInterface
      • SimpleAmqpMessage

    Properties

    Properties

    content: Buffer
    extra: {
        exchange: string;
        routingKey: string;
        redelivered: boolean;
        appId?: string;
        type?: string;
        timestamp: number;
        messageId: string;
        headers?: {
            [k: string]: string | number;
        };
        contentEncoding?: string;
        contentType?: string;
        expiration?: number;
    }

    Type declaration

    • exchange: string
    • routingKey: string
    • redelivered: boolean
    • Optional appId?: string
    • Optional type?: string
    • timestamp: number
    • messageId: string
    • Optional headers?: {
          [k: string]: string | number;
      }
      • [k: string]: string | number
    • Optional contentEncoding?: string
    • Optional contentType?: string
    • Optional expiration?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimplePublishOptions.html b/docs/ts-simple-pubsub-amqp/interfaces/SimplePublishOptions.html new file mode 100644 index 0000000..192cb24 --- /dev/null +++ b/docs/ts-simple-pubsub-amqp/interfaces/SimplePublishOptions.html @@ -0,0 +1,11 @@ +SimplePublishOptions | @wymp/simple-pubsub-amqp

    Interface SimplePublishOptions

    interface SimplePublishOptions {
        routingKey: string;
        appId?: string;
        type?: string;
        timestamp?: number;
        messageId?: string;
        headers?: {
            [k: string]: string | number;
        };
        contentEncoding?: string;
        contentType?: string;
        expiration?: number;
        persistent?: boolean;
    }

    Properties

    routingKey: string
    appId?: string
    type?: string
    timestamp?: number
    messageId?: string
    headers?: {
        [k: string]: string | number;
    }

    Type declaration

    • [k: string]: string | number
    contentEncoding?: string
    contentType?: string
    expiration?: number
    persistent?: boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SimpleSubscriptionOptions.html b/docs/ts-simple-pubsub-amqp/interfaces/SimpleSubscriptionOptions.html new file mode 100644 index 0000000..f31461b --- /dev/null +++ b/docs/ts-simple-pubsub-amqp/interfaces/SimpleSubscriptionOptions.html @@ -0,0 +1,4 @@ +SimpleSubscriptionOptions | @wymp/simple-pubsub-amqp

    Interface SimpleSubscriptionOptions

    Subscription options

    +
    interface SimpleSubscriptionOptions {
        queue: {
            name: string;
            exclusive?: boolean;
            durable?: boolean;
            autoDelete?: boolean;
        };
        exchanges?: {
            [ex: string]: {
                type?: string;
                durable?: boolean;
                internal?: boolean;
                autoDelete?: boolean;
                alternateExchange?: string;
            };
        };
    }

    Properties

    Properties

    queue: {
        name: string;
        exclusive?: boolean;
        durable?: boolean;
        autoDelete?: boolean;
    }

    Type declaration

    • name: string
    • Optional exclusive?: boolean
    • Optional durable?: boolean
    • Optional autoDelete?: boolean
    exchanges?: {
        [ex: string]: {
            type?: string;
            durable?: boolean;
            internal?: boolean;
            autoDelete?: boolean;
            alternateExchange?: string;
        };
    }

    Type declaration

    • [ex: string]: {
          type?: string;
          durable?: boolean;
          internal?: boolean;
          autoDelete?: boolean;
          alternateExchange?: string;
      }
      • Optional type?: string
      • Optional durable?: boolean
      • Optional internal?: boolean
      • Optional autoDelete?: boolean
      • Optional alternateExchange?: string

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/interfaces/SubscriptionOptions.html b/docs/ts-simple-pubsub-amqp/interfaces/SubscriptionOptions.html deleted file mode 100644 index 7b9aaf2..0000000 --- a/docs/ts-simple-pubsub-amqp/interfaces/SubscriptionOptions.html +++ /dev/null @@ -1,3 +0,0 @@ -SubscriptionOptions | @wymp/simple-pubsub-amqp

    Interface SubscriptionOptions

    interface SubscriptionOptions {
        queue: {
            name: string;
            exclusive?: boolean;
            durable?: boolean;
            autoDelete?: boolean;
        };
        exchanges?: {
            [ex: string]: {
                type?: string;
                durable?: boolean;
                internal?: boolean;
                autoDelete?: boolean;
                alternateExchange?: string;
            };
        };
    }

    Properties

    Properties

    queue: {
        name: string;
        exclusive?: boolean;
        durable?: boolean;
        autoDelete?: boolean;
    }

    Type declaration

    • name: string
    • Optional exclusive?: boolean
    • Optional durable?: boolean
    • Optional autoDelete?: boolean
    exchanges?: {
        [ex: string]: {
            type?: string;
            durable?: boolean;
            internal?: boolean;
            autoDelete?: boolean;
            alternateExchange?: string;
        };
    }

    Type declaration

    • [ex: string]: {
          type?: string;
          durable?: boolean;
          internal?: boolean;
          autoDelete?: boolean;
          alternateExchange?: string;
      }
      • Optional type?: string
      • Optional durable?: boolean
      • Optional internal?: boolean
      • Optional autoDelete?: boolean
      • Optional alternateExchange?: string

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/modules.html b/docs/ts-simple-pubsub-amqp/modules.html index 70ca60f..04c7e71 100644 --- a/docs/ts-simple-pubsub-amqp/modules.html +++ b/docs/ts-simple-pubsub-amqp/modules.html @@ -2,11 +2,12 @@ MockAmqpChannel SimplePubSubAmqp AbstractPubSubAmqp -

    Interfaces

    SimpleAmqpMessage -SubscriptionOptions -PublishOptions -Backoff +

    Interfaces

    SimpleSubscriptionOptions +SimplePublishOptions +Retry SimpleAmqpConfig SimpleAmqpConnection SimpleAmqpChannel -

    Generated using TypeDoc

    \ No newline at end of file +

    Type Aliases

    AmqpExtra +AmqpMessage +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/types/AmqpExtra.html b/docs/ts-simple-pubsub-amqp/types/AmqpExtra.html new file mode 100644 index 0000000..ad6c816 --- /dev/null +++ b/docs/ts-simple-pubsub-amqp/types/AmqpExtra.html @@ -0,0 +1,2 @@ +AmqpExtra | @wymp/simple-pubsub-amqp
    AmqpExtra: {
        exchange: string;
        routingKey: string;
        redelivered: boolean;
        appId?: string;
        type?: string;
        timestamp: number;
        messageId: string;
        headers?: {
            [k: string]: string | number;
        };
        contentEncoding?: string;
        contentType?: string;
        expiration?: number;
    }

    RabbitMQ-specific "extra" properties

    +

    Type declaration

    • exchange: string
    • routingKey: string
    • redelivered: boolean
    • Optional appId?: string
    • Optional type?: string
    • timestamp: number
    • messageId: string
    • Optional headers?: {
          [k: string]: string | number;
      }
      • [k: string]: string | number
    • Optional contentEncoding?: string
    • Optional contentType?: string
    • Optional expiration?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/ts-simple-pubsub-amqp/types/AmqpMessage.html b/docs/ts-simple-pubsub-amqp/types/AmqpMessage.html new file mode 100644 index 0000000..56b4c58 --- /dev/null +++ b/docs/ts-simple-pubsub-amqp/types/AmqpMessage.html @@ -0,0 +1,2 @@ +AmqpMessage | @wymp/simple-pubsub-amqp
    AmqpMessage: SimplePubSubMessageInterface<AmqpExtra> & {
        content: Buffer;
    }

    The actual type of a RabbitMQ message

    +

    Type declaration

    • content: Buffer

    Generated using TypeDoc

    \ No newline at end of file diff --git a/libs/ts-simple-db-mysql/package.json b/libs/ts-simple-db-mysql/package.json index 3d65559..2e33d40 100644 --- a/libs/ts-simple-db-mysql/package.json +++ b/libs/ts-simple-db-mysql/package.json @@ -2,7 +2,7 @@ "author": "Kael Shipman ", "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.4.1 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.4.1 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0", "mysql2": "^2.0.0 || ^3.7.0" }, "description": "A Simple™-conformant wrapper around mysql", @@ -38,5 +38,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-http-client-axios/package.json b/libs/ts-simple-http-client-axios/package.json index 656155c..5416f4d 100644 --- a/libs/ts-simple-http-client-axios/package.json +++ b/libs/ts-simple-http-client-axios/package.json @@ -2,7 +2,7 @@ "author": "Kael Shipman ", "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.8.0 || ^0.9.0", "axios": ">= 0.19.0 && < 0.26.0" }, "description": "A Simple™-conformant wrapper around Axios", @@ -38,5 +38,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-http-client-fetch/package.json b/libs/ts-simple-http-client-fetch/package.json index c137c66..cd71e91 100644 --- a/libs/ts-simple-http-client-fetch/package.json +++ b/libs/ts-simple-http-client-fetch/package.json @@ -2,7 +2,7 @@ "author": "Kael Shipman ", "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.8.0" + "@wymp/ts-simple-interfaces": "workspace:^0.8.0 || ^0.9.0" }, "description": "A Simple™-conformant wrapper around request-promise-native", "devDependencies": { @@ -38,5 +38,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-http-client-rpn/package.json b/libs/ts-simple-http-client-rpn/package.json index 4846894..d9d7921 100644 --- a/libs/ts-simple-http-client-rpn/package.json +++ b/libs/ts-simple-http-client-rpn/package.json @@ -4,7 +4,7 @@ "dependencies": { "@types/request": "^2.48.12", "@types/request-promise-native": "^1.0.16", - "@wymp/ts-simple-interfaces": "workspace:^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.8.0 || ^0.9.0", "request": "^2.88.2", "request-promise-native": "^1.0.9" }, @@ -42,5 +42,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-http-server-express/package.json b/libs/ts-simple-http-server-express/package.json index 337c7a3..ee85673 100644 --- a/libs/ts-simple-http-server-express/package.json +++ b/libs/ts-simple-http-server-express/package.json @@ -4,7 +4,7 @@ "dependencies": { "@types/body-parser": "^1.19.0", "@types/express": "^4.17.2", - "@wymp/ts-simple-interfaces": "workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0", "body-parser": "^1.19.0", "express": "^4.17.1" }, @@ -43,5 +43,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-interfaces-testing/package.json b/libs/ts-simple-interfaces-testing/package.json index afb1fe4..0a8e9c9 100644 --- a/libs/ts-simple-interfaces-testing/package.json +++ b/libs/ts-simple-interfaces-testing/package.json @@ -3,7 +3,7 @@ "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "contributors": "https://github.com/kael-shipman/ts-simple-interfaces/graphs/contributors", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0", "ts-md5": "^1.2.4" }, "description": "This library supplies testing utilities like stubs, spies and fixtures, for testing applications that utilize SimpleInterface implementations.", @@ -39,5 +39,5 @@ "prettier:fix": "../../scripts/prettier-fix.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-interfaces/package.json b/libs/ts-simple-interfaces/package.json index 07c7726..efe143f 100644 --- a/libs/ts-simple-interfaces/package.json +++ b/libs/ts-simple-interfaces/package.json @@ -39,5 +39,5 @@ "prettier:fix": "../../scripts/prettier-fix.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-logger-console/package.json b/libs/ts-simple-logger-console/package.json index 8478f46..88990d4 100644 --- a/libs/ts-simple-logger-console/package.json +++ b/libs/ts-simple-logger-console/package.json @@ -2,7 +2,7 @@ "author": "Kael Shipman ", "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0" + "@wymp/ts-simple-interfaces": "workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0" }, "description": "A Simple™-conformant wrapper around console.log", "devDependencies": { @@ -36,5 +36,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-logger-winston/package.json b/libs/ts-simple-logger-winston/package.json index db04737..7f2c0a2 100644 --- a/libs/ts-simple-logger-winston/package.json +++ b/libs/ts-simple-logger-winston/package.json @@ -2,7 +2,7 @@ "author": "Kael Shipman ", "bugs": "https://github.com/wymp/ts-simple-interfaces/issues", "dependencies": { - "@wymp/ts-simple-interfaces": "workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", + "@wymp/ts-simple-interfaces": "workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0", "winston": "^3.2.1" }, "description": "A Simple™-conformant wrapper around winston logger", @@ -37,5 +37,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-pubsub-amqp/package.json b/libs/ts-simple-pubsub-amqp/package.json index afa33d8..65c97dc 100644 --- a/libs/ts-simple-pubsub-amqp/package.json +++ b/libs/ts-simple-pubsub-amqp/package.json @@ -4,8 +4,8 @@ "dependencies": { "@types/amqplib": ">=0.5.13", "@types/uuid": "^9.0.7", - "@wymp/ts-simple-interfaces": "workspace:^0.5.5 || ^0.6.0 || ^0.7.0 || ^0.8.0", - "amqplib": "^0.5.5 || ^0.6.0 || ^0.7.1 || ^0.8.0 || ^0.9.0 || ^0.10.0", + "@wymp/ts-simple-interfaces": "workspace:^0.5.5 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0", + "amqplib": "^0.5.5 || ^0.6.0 || ^0.7.1 || ^0.8.0 || ^0.9.0 || ^0.9.0 || ^0.10.0", "uuid": "^9.0.1" }, "description": "A Simple™-conformant wrapper around amqplib", @@ -42,5 +42,5 @@ "test": "../../scripts/test.sh", "typecheck": "../../scripts/typecheck.sh" }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/libs/ts-simple-pubsub-amqp/src/SimpleAmqp.ts b/libs/ts-simple-pubsub-amqp/src/SimpleAmqp.ts index 5eade49..38c32cf 100644 --- a/libs/ts-simple-pubsub-amqp/src/SimpleAmqp.ts +++ b/libs/ts-simple-pubsub-amqp/src/SimpleAmqp.ts @@ -9,36 +9,38 @@ import { } from '@wymp/ts-simple-interfaces'; import { EventEmitter } from 'events'; -/** - * - * - * - * - * AMQP-Specific Types - * - * - * - * - */ +// +// +// +// +// AMQP-Specific Types +// +// +// +// + +/** RabbitMQ-specific "extra" properties */ +export type AmqpExtra = { + exchange: string; + routingKey: string; + redelivered: boolean; + appId?: string; + type?: string; + timestamp: number; + messageId: string; + headers?: { [k: string]: string | number }; + contentEncoding?: string; + contentType?: string; + expiration?: number; +}; -export interface SimpleAmqpMessage extends SimplePubSubMessageInterface { +/** The actual type of a RabbitMQ message */ +export type AmqpMessage = SimplePubSubMessageInterface & { content: Buffer; - extra: { - exchange: string; - routingKey: string; - redelivered: boolean; - appId?: string; - type?: string; - timestamp: number; - messageId: string; - headers?: { [k: string]: string | number }; - contentEncoding?: string; - contentType?: string; - expiration?: number; - }; -} +}; -export interface SubscriptionOptions { +/** Subscription options */ +export interface SimpleSubscriptionOptions { queue: { name: string; exclusive?: boolean; @@ -56,7 +58,7 @@ export interface SubscriptionOptions { }; } -export interface PublishOptions { +export interface SimplePublishOptions { routingKey: string; appId?: string; type?: string; @@ -69,37 +71,37 @@ export interface PublishOptions { persistent?: boolean; } -export interface Backoff { - run(job: () => Promise, log: SimpleLoggerInterface): Promise; +/** An interface defining a retry controller for running jobs with retries on failure */ +export interface Retry { + run(job: () => Promise, log: SimpleLoggerInterface, jobId?: string): Promise; } -/** - * Private (internal) types - */ +// +// Private (internal) types +// + declare type RoutingKey = string; declare type Subscription = { routes: { [exchange: string]: Array }; - handler: (msg: SimpleAmqpMessage, log: SimpleLoggerInterface) => Promise; - options: SubscriptionOptions; + handler: (msg: AmqpMessage, log: SimpleLoggerInterface) => Promise; + options: SimpleSubscriptionOptions; }; declare type SubscriptionQueue = Array; -/** - * - * - * - * - * - * Some AMQP definitions for purposes of improving testability - * - * - * - * - * - */ - +// +// +// +// +// Some AMQP definitions for purposes of improving testability +// +// +// +// + +/** Configuration options for the SimplePubsubAmqp class */ export interface SimpleAmqpConfig extends amqp.Options.Connect {} +/** A simple AMQP connection */ export interface SimpleAmqpConnection { close(): Promise; createChannel(): Promise; @@ -107,6 +109,7 @@ export interface SimpleAmqpConnection { on(ev: 'close', handler: (e?: Error) => void | unknown): unknown; } +/** A simple AMQP channel */ export interface SimpleAmqpChannel { close(): Promise; assertExchange( @@ -129,27 +132,35 @@ export interface SimpleAmqpChannel { on(ev: 'close', handler: (e?: Error) => void | unknown): unknown; } +// +// +// +// +// +// +// Main PubSub class +// +// +// +// +// +// + /** + * The standard Simple PubSub implementation for AMQP. * - * - * - * - * - * Main PubSub class - * - * - * - * - * + * Because amqplib has such awful error handling properties, this class implements complex logic for managing the + * connection. It will attempt to re-establish the both the channel and the connection in the case of errors in either, + * and will queue subscription requests until the connection is established and restore subscriptions on reconnect. */ -export class SimplePubSubAmqp - implements SimplePubSubInterface +export class SimplePubSubAmqp + implements SimplePubSubInterface { protected cnx: SimpleAmqpConnection | null = null; protected ch: SimpleAmqpChannel | null = null; protected subscriptions: SubscriptionQueue = []; protected _waiting: boolean = true; - protected backoff: Backoff; + protected retry: Retry; protected emitter: EventEmitter; protected closed: boolean = false; private amqpConnect: (url: string | AmqpProps.Options.Connect, socketOptions?: any) => Promise; @@ -160,16 +171,18 @@ export class SimplePubSubAmqp protected config: SimpleAmqpConfig, protected log: SimpleLoggerInterface, deps?: { - backoff?: Backoff; + retry?: Retry; amqpConnect?: (url: string | AmqpProps.Options.Connect, socketOptions?: any) => Promise; }, ) { - // If we don't pass in a backoff mechanism, then wait 1 second before nacking failures - this.backoff = - deps && deps.backoff - ? deps.backoff + // If we don't pass in a retry mechanism, then wait 1 second before nacking failures (nacking will send it back + // to the queue, which will then re-deliver it to us if configured to do so, so a waiting 1 second on failure is + // like having a 1-second periodic retry mechanism) + this.retry = + deps && deps.retry + ? deps.retry : { - run: (j: () => Promise, l: SimpleLoggerInterface): Promise => { + run: (j: () => Promise, l: SimpleLoggerInterface, _jobId: string): Promise => { return new Promise((r) => { j().then((result) => { if (!result) { @@ -326,7 +339,7 @@ export class SimplePubSubAmqp const log = new TaggedLogger(`MQ: ${qopts.name}:${m.extra.messageId ? ` ${m.extra.messageId}:` : ``}`, this.log); log.debug(`Received message: ${m.content.toString('utf8')}`); - const result = await this.backoff.run(() => sub.handler(m, log), log); + const result = await this.retry.run(() => sub.handler(m, log), log, m.extra.messageId); if (result) { this.ch!.ack(msg); @@ -336,7 +349,7 @@ export class SimplePubSubAmqp }); } - public async publish(channel: string, msg: unknown, options: PublishOptions): Promise { + public async publish(channel: string, msg: PubMsgType, options: SimplePublishOptions): Promise { // Fill in default options options.timestamp = options.timestamp || Date.now(); options.messageId = options.messageId || uuid.v4(); @@ -374,6 +387,7 @@ export class SimplePubSubAmqp } else { // If we return false, then the buffer is full. Try again after the 'drain' event this.ch!.once('drain', () => publish()); + return; } } catch (e) { // If we caught an error, then call "tryAgain" to re-estabslish the connection and then try the publish again @@ -453,19 +467,75 @@ export class SimplePubSubAmqp * * Following is an abstract adapter class allowing projects to define their message types more * specifically without having to do much work. + * + * You will generally extend this class and add `publish` and `subscribe` methods to accommodate + * your desired pub-sub interface. These methods should use the underlying SimplePubSubAmqp class + * provided by `this.driver` to do their actual work. + * + * @example + * + * ```ts + * type MyActions = 'create' | 'update' | 'delete'; + * + * type FooTypes = 'one' | 'two' | 'three'; + * type FooMsgs = + * | { domain: 'foo'; action: MyActions; resourceType: FooTypes; data: { foo: string } }; + * + * type BarTypes = 'four' | 'five' | 'six'; + * type BarMsgs = + * | { domain: 'bar'; action: MyActions; resourceType: BarTypes; data: { bar: number } }; + * + * type BazTypes = 'seven' | 'eight' | 'nine'; + * type BazMsgs = + * | { domain: 'baz'; action: MyActions; resourceType: BazTypes; data: { baz: boolean } }; + * + * type MyMsgs = FooMsgs | BarMsgs | BazMsgs; + * + * // With this class, we greatly simplify and make more specific our pub-sub interface. We can do this because we're + * // taking certain values (like the channel) up front (say, because you have only one exchange that you use for + * // all MQ communication), and because we've defined our message types in a way that allows us to auto-generate + * // publishing information about them (specifically, the routingKey). + * // + * // Now our publishing flow is greatly simplified and our subscription handlers can focus on simply processing the + * // incoming data. + * class MyFooPubSub extends AbstractPubSubAmqp { + * public constructor(protected channel: string, config: SimpleAmqpConfig, log: SimpleLoggerInterface, deps?: { retry?: Retry}) { + * super(config, log, deps); + * } + * + * // Subscriptions have to handle messages from any domain, so the handler accepts messages of all our message types. + * public async subscribe(keys: Array, handler: (msg: MyMsgs, log: SimpleLoggerInterface) => Promise) { + * return this.driver.subscribe( + * { [this.channel]: keys }, + * (msg, log) => { + * // Retry logic is already handled by our driver, so we just need to translate the message here + * const m: MyMsgs = JSON.parse(msg.content.toString('utf8')); + * return handler(m, log); + * }, + * { queue: { name: 'foo-queue' } } + * ); + * } + * + * // However, you can only publish FooMsgs + * public async publish(msg: FooMsgs) { + * return this.driver.publish(this.channel, msg, { routingKey: `${msg.domain}.${msg.action}.${msg.resourceType}` }); + * } + * } + * + * ``` */ -export abstract class AbstractPubSubAmqp { - private _driver: SimplePubSubAmqp; +export abstract class AbstractPubSubAmqp { + private _driver: SimplePubSubAmqp; public constructor( protected config: SimpleAmqpConfig, protected log: SimpleLoggerInterface, deps?: { - backoff?: Backoff; + retry?: Retry; amqpConnect?: (url: string | SimpleAmqpConfig, socketOptions?: any) => Promise; }, ) { - this._driver = new SimplePubSubAmqp(config, log, deps); + this._driver = new SimplePubSubAmqp(config, log, deps); } protected get driver() { diff --git a/package.json b/package.json index 25154a0..17e4c79 100644 --- a/package.json +++ b/package.json @@ -42,5 +42,5 @@ "@types/node": "$@types/node" } }, - "version": "0.8.1" + "version": "0.9.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4675c5..e3e6813 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,7 +64,7 @@ importers: libs/ts-simple-db-mysql: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.4.1 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.4.1 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces mysql2: specifier: ^2.0.0 || ^3.7.0 @@ -80,7 +80,7 @@ importers: libs/ts-simple-http-client-axios: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.8.0 + specifier: workspace:^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces axios: specifier: '>= 0.19.0 && < 0.26.0' @@ -96,7 +96,7 @@ importers: libs/ts-simple-http-client-fetch: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.8.0 + specifier: workspace:^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces devDependencies: '@types/jest': @@ -118,7 +118,7 @@ importers: specifier: ^1.0.16 version: 1.0.21 '@wymp/ts-simple-interfaces': - specifier: workspace:^0.8.0 + specifier: workspace:^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces request: specifier: ^2.88.2 @@ -146,7 +146,7 @@ importers: specifier: ^4.17.2 version: 4.17.21 '@wymp/ts-simple-interfaces': - specifier: workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces body-parser: specifier: ^1.19.0 @@ -181,7 +181,7 @@ importers: libs/ts-simple-interfaces-testing: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces ts-md5: specifier: ^1.2.4 @@ -197,7 +197,7 @@ importers: libs/ts-simple-logger-console: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces devDependencies: '@types/jest': @@ -207,7 +207,7 @@ importers: libs/ts-simple-logger-winston: dependencies: '@wymp/ts-simple-interfaces': - specifier: workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces winston: specifier: ^3.2.1 @@ -226,10 +226,10 @@ importers: specifier: ^9.0.7 version: 9.0.7 '@wymp/ts-simple-interfaces': - specifier: workspace:^0.5.5 || ^0.6.0 || ^0.7.0 || ^0.8.0 + specifier: workspace:^0.5.5 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 version: link:../ts-simple-interfaces amqplib: - specifier: ^0.5.5 || ^0.6.0 || ^0.7.1 || ^0.8.0 || ^0.9.0 || ^0.10.0 + specifier: ^0.5.5 || ^0.6.0 || ^0.7.1 || ^0.8.0 || ^0.9.0 || ^0.9.0 || ^0.10.0 version: 0.8.0 uuid: specifier: ^9.0.1