@skbkontur/node-core
Advanced tools
Comparing version 1.0.0-rc.3 to 1.0.0-rc.4
// @flow | ||
/* :: | ||
import type { Options, Config, Process, Logger } from './types'; | ||
import type { IStrategy, IRequestSender, HttpRequest, HttpResponse } from '@skbkontur/cluster-client' | ||
/* :: | ||
import { Options, Config, Process } from './types' | ||
export type { Options, Config, Logger, HttpRequest, HttpResponse }; | ||
*/ | ||
@@ -7,0 +9,0 @@ |
// @flow | ||
/*:: | ||
import { Options, Config, Process } from './types' | ||
/* :: | ||
import type { Options, Config, Process } from './types' | ||
*/ | ||
@@ -24,2 +24,6 @@ | ||
if (!spanAggrApiKey) { | ||
throw new TypeError('Config should contains spanAggrApiKey') | ||
} | ||
spanAggregator = new SpanAggregator({ | ||
@@ -26,0 +30,0 @@ apiKey: spanAggrApiKey, |
// @flow | ||
/* :: | ||
type loggerOptions = { | ||
serverName: string, | ||
path: string, | ||
apiKey: string, | ||
type?: string, | ||
} | ||
import type { Logger } from '../types'; | ||
*/ | ||
const winston = require('winston') | ||
const KonturLogstash = require('@skbkontur/winston-kontur-logstash') | ||
let logger = null | ||
let logger /* : ?Logger */ = null | ||
function createLogger(data /* : Object */) { | ||
function createLogger(options /* : loggerOptions */) /* : Logger */ { | ||
logger = new winston.Logger({ | ||
transports: [ | ||
new KonturLogstash(data), | ||
new KonturLogstash(options), | ||
new winston.transports.Console({ colorize: true }) | ||
@@ -13,0 +24,0 @@ ] |
// @flow | ||
/* :: | ||
import type { Context } from 'koa'; | ||
import type { Logger } from '../types'; | ||
*/ | ||
@@ -8,4 +10,4 @@ | ||
function appErrorHandlerModule(logger) { | ||
return async function appErrorHandler(err /* : Error */, ctx /* : Context*/) { | ||
function appErrorHandlerModule(logger /* : Logger */) { | ||
return async function appErrorHandler(err /* : Error */, ctx /* : Context */) { | ||
let availableLogger = logger | ||
@@ -16,4 +18,3 @@ let loggerLevel = 'error' | ||
try { | ||
const contextualLogger = ctx.state.container.resolve('logger') | ||
availableLogger = contextualLogger | ||
availableLogger = ctx.state.container.resolve('logger') | ||
} catch (ex) {} | ||
@@ -20,0 +21,0 @@ } |
// @flow | ||
/* :: | ||
import type { Application } from 'koa'; | ||
import Application from 'koa'; | ||
*/ | ||
@@ -14,3 +14,3 @@ | ||
function useCore(app /* : Application */, coreApp) { | ||
function useCore(app /* : Application */, coreApp /* : any */) { | ||
const { | ||
@@ -17,0 +17,0 @@ logger, |
// @flow | ||
/* :: | ||
import type { Context } from 'koa'; | ||
import type { Logger } from '../types'; | ||
*/ | ||
const requestMonitoringModule = (logger) => { | ||
const requestMonitoringModule = (logger /* : Logger */) => { | ||
return async ( | ||
@@ -7,0 +10,0 @@ ctx /* : Context */, |
@@ -17,9 +17,4 @@ // @flow | ||
import { IStrategy, IRequestSender } from '@skbkontur/cluster-client/src/types' | ||
import type { | ||
types: { | ||
IStrategy, IRequestSender | ||
} | ||
} from '@skbkontur/cluster-client' | ||
type Deps = { | ||
@@ -26,0 +21,0 @@ clusterConfig: ClusterConfig, |
// @flow | ||
/* :: | ||
import { Span } from '@skbkontur/span-aggregator-client' | ||
import type Span from '@skbkontur/span-aggregator-client/lib/Span' | ||
import SpanAggregator from '@skbkontur/span-aggregator-client' | ||
@@ -10,7 +10,3 @@ import type ClusterConfig from '@skbkontur/cluster-config-client' | ||
const { | ||
types: { | ||
IStrategy, IRequestSender | ||
} | ||
} = ClusterClientModule | ||
import type { IStrategy, IRequestSender } from '@skbkontur/cluster-client' | ||
@@ -17,0 +13,0 @@ type Deps = { |
@@ -0,1 +1,3 @@ | ||
// @flow | ||
/* :: | ||
@@ -28,2 +30,8 @@ export type Process = { | ||
export type Logger = { | ||
info: Function, | ||
warn: Function, | ||
error: Function | ||
} | ||
*/ |
{ | ||
"name": "@skbkontur/node-core", | ||
"version": "1.0.0-rc.3", | ||
"version": "1.0.0-rc.4", | ||
"description": "", | ||
@@ -16,3 +16,3 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@skbkontur/cluster-client": "^1.0.0-rc.3", | ||
"@skbkontur/cluster-client": "^1.0.0-rc.5", | ||
"@skbkontur/cluster-config-client": "^0.0.3", | ||
@@ -22,2 +22,3 @@ "@skbkontur/monitoring-client": "^1.0.0", | ||
"@skbkontur/winston-kontur-logstash": "^3.0.0", | ||
"koa": "^2.5.0", | ||
"winston": "^2.4.0" | ||
@@ -24,0 +25,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
36404
7
22
716
+ Addedkoa@^2.5.0
+ Addedaccepts@1.3.8(transitive)
+ Addedcache-content-type@1.0.1(transitive)
+ Addedco@4.6.0(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedcookies@0.9.1(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddeep-equal@1.0.1(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddepd@1.1.22.0.0(transitive)
+ Addeddestroy@1.2.0(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedencodeurl@1.0.2(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedfresh@0.5.2(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhttp-assert@1.5.0(transitive)
+ Addedhttp-errors@1.8.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedkeygrip@1.1.0(transitive)
+ Addedkoa@2.15.3(transitive)
+ Addedkoa-compose@4.2.0(transitive)
+ Addedkoa-convert@2.0.0(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedonly@0.0.2(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedstatuses@1.5.0(transitive)
+ Addedtoidentifier@1.0.1(transitive)
+ Addedtsscmp@1.0.6(transitive)
+ Addedtype-is@1.6.18(transitive)
+ Addedvary@1.1.2(transitive)
+ Addedylru@1.4.0(transitive)