New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lvchengbin/yolk

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lvchengbin/yolk - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

3

lib/console.js

@@ -61,2 +61,5 @@ const util = require( 'util' );

break;
case 'rsc' :
tag = `[/m:${instance.module.moduleName}/rsc]`
break;
case 'yolk' :

@@ -63,0 +66,0 @@ tag = '[/]'

@@ -95,2 +95,4 @@ const fs = require( 'fs' );

this.console.log( '<<< finish loading config files' );
// to initialize the logger before initializing other parts.

@@ -97,0 +99,0 @@ const config = this.config.log || {};

59

lib/rsc.js

@@ -6,4 +6,5 @@ const request = require( 'request-promise-native' );

const RSC_REAL_CONFIG_INSTANCE = Symbol( 'rsc#config' );
const RSC_CONFIG = Symbol( 'config' );
const RSC_MODULE_CONFIG_INSTANCE = Symbol( 'rsc#module#config#instance' );
const RSC_APP_CONFIG_INSTANCE = Symbol( 'rsc#app#config#instance' );
const RSC_CONFIG = Symbol( 'rsc#config' );

@@ -16,19 +17,17 @@ class RSC {

this.debugging = this.app.debugging;
this.debugging = this.module.debugging;
this.console = new Console( this, {
type : 'rsc',
name : 'module ' + this.module.moduleName
} );
this.console = new Console( this, 'rsc' );
const moduleServicesConfig = this.module.config( 'rsc', {} );
const appServicesConfig = this.app.config( 'rsc', {} );
const config = {};
Object.assign( config, appServicesConfig, moduleServicesConfig );
Object.assign( this[ RSC_CONFIG ], config );
this[ RSC_REAL_CONFIG_INSTANCE ] = new Config( config );
/**
* to load config from both current module and the app.
*/
this[ RSC_MODULE_CONFIG_INSTANCE ] = new Config( this.module.config( 'rsc', {} ) );
this[ RSC_APP_CONFIG_INSTANCE ] = new Config( this.app.config( 'rsc', {} ) );
}
[RSC_CONFIG]( path, defaultValue ) {
return this[ RSC_REAL_CONFIG_INSTANCE ].get( path, defaultValue );
const res = this[ RSC_MODULE_CONFIG_INSTANCE ].get( path );
if( !is.undefined( res ) ) return res;
return this[ RSC_APP_CONFIG_INSTANCE ].get( path, defaultValue );
}

@@ -50,3 +49,3 @@

if( !uri ) {
const conf = this[ RSC_CONFIG ]( service );
const conf = this[ RSC_CONFIG ]( `service.${service}` );

@@ -70,6 +69,6 @@ if( !conf ) {

if( options.method.toUpperCase() === 'POST' ) {
options.qs = rscqs( this.ctx );
options.qs = rscqs( this );
options.body = opt.body || {};
} else {
options.qs = Object.assign( rscqs( this.ctx ), opt.qs );
options.qs = Object.assign( rscqs( this ), opt.qs );
}

@@ -97,7 +96,8 @@

api( service, api, params = {} ) {
const conf = this[ RSC_CONFIG ]( service );
const conf = this[ RSC_CONFIG ]( `service.${service}` );
if( !conf ) {
this.console.error( `cannot find service "${service}" in config files.` );
throw new Error( '' );
const msg = `cannot find service "${service}" in config files.`;
this.console.error( msg );
throw new Error( msg );
}

@@ -109,4 +109,5 @@

if( !apis || !apiConf ) {
this.console.error( `cannot find API ${api} in ${service} service.` );
throw new Error( '' );
const msg = `cannot find API ${api} in ${service} service.`;
this.console.error( msg );
throw new Error( msg );
}

@@ -126,6 +127,6 @@

if( method.toUpperCase() === 'POST' ) {
options.qs = rscqs( this.ctx );
options.qs = rscqs( this );
options.body = params;
} else {
options.qs = Object.assign( rscqs( this.ctx ), params );
options.qs = Object.assign( rscqs( this ), params );
}

@@ -142,9 +143,11 @@

function rscqs( ctx ) {
function rscqs( rsc ) {
return {
__key : rsc[ RSC_CONFIG ]( 'client.key', '' ),
__client : rsc[ RSC_CONFIG ]( 'client.name', '' ),
__service : 1,
__time : +new Date,
__clientip : ctx.request.ip,
__app : ctx.app.name || 'yolk',
__module : ctx.module.moduleName,
__clientip : rsc.ctx.request.ip,
__app : rsc.app.name || 'yolk',
__module : rsc.module.moduleName,
__token : ''

@@ -151,0 +154,0 @@ };

@@ -65,3 +65,2 @@ const fs = require( 'fs' );

/**

@@ -68,0 +67,0 @@ * to init logger before initializing other parts

@@ -8,3 +8,3 @@ {

},
"version": "0.0.14",
"version": "0.0.15",
"keywords": [

@@ -11,0 +11,0 @@ "koa",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc