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

@backlib/koa

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backlib/koa - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0-SNAPSHOT-02

dist/base-router.d.ts

2

dist/index.d.ts

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

export * from './koa';
export * from './base-router';

@@ -10,5 +10,5 @@ "use strict";

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./koa"), exports);
__exportStar(require("./base-router"), exports);
{
"name": "@backlib/koa",
"version": "0.2.0",
"version": "0.3.0-SNAPSHOT-02",
"description": "Minimalist KOA utilities for backend web services",

@@ -12,3 +12,3 @@ "main": "dist/index.js",

"type": "git",
"url": "https://github.com/briteboard/node-backlib.git"
"url": "https://github.com/britesnow/node-backlib-koa.git"
},

@@ -23,18 +23,24 @@ "scripts": {

"dependencies": {
"@koa/router": "^9.3.1",
"@types/koa": "^2.11.3",
"@types/koa__router": "^8.0.2",
"fs-extra-plus": "^0.5.18",
"@koa/router": "^10.0.0",
"@types/koa": "^2.11.6",
"@types/koa__router": "^8.0.3",
"fs-extra-plus": "^0.5.20",
"handlebars": "^4.7.6",
"js-yaml": "^3.14.0",
"koa": "^2.13.0",
"koa-compose": "^4.1.0"
"koa-compose": "^4.1.0",
"markdown-it": "^12.0.2"
},
"peerDependencies": {
"backlib": "^0.2.0"
"backlib": "^0.3.0"
},
"devDependencies": {
"@types/mocha": "^8.0.0",
"mocha": "^8.0.1",
"@types/js-yaml": "^3.12.5",
"@types/markdown-it": "^10.0.3",
"@types/mocha": "^8.0.4",
"backlib": "^0.3.0",
"mocha": "^8.2.1",
"rimraf": "^3.0.2",
"ts-node-dev": "^1.0.0-pre.51",
"typescript": "^3.9.6"
"ts-node-dev": "^1.0.0",
"typescript": "^4.1.2"
},

@@ -41,0 +47,0 @@ "files": [

Minimalist utilities for backend services.
Minimalist koa utilities on top of backlib.

@@ -10,75 +10,1 @@ - **Typed** Build with typescript for typescript.

> NOTE: Still under development. If not part of BriteSnow, wait for 0.3.0 and above to use this library. In the meantime feel free to copy/paste code.
## Log
Provides a `BaseLog` class with a `LogWriter` driver architecture.
```ts
import {BaseLog, LogWriter} from 'backlib';
interface WebLogRecord {
...
}
class WebLog extends BaseLog<WebLogRecord>{
constructor() {
const writers: LogWriter<WebLogRecord>[] = [];
const baseName = 'web_log';
// Add custom writer using redstream (Redis Stream) for realtime login
const logStream = getWebLogStream(); // not provided
writers.push({
name: baseName + '_stream',
writeRec: async (rec: WebLogRecord) => {
await logStream.xadd(rec);
}
});
super({ writers });
}
}
const _webLog = new WebLog(); // must be after ServiceLog definition
export webLog(rec: WebLogRecord){
_webLog.log(rec);
}
```
## isTop
Know if a decorator method is at the `leaf` of the class tree. Usefull when want to apply logic one one per method name.
```ts
// One per decorator
const leafTracer = newLeafTracer();
export function MethodDec() {
return function (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) {
// original method
const method = descriptor.value!;
descriptor.value = async function methodDecWrapper() {
// must be called on each invocation (because of order of Decoration eval at init time).
// However, flag is cache, so fast check.
const isLeaf = leafTracer.trace(this.constructor, target.constructor, propertyKey);
if (isLeaf){
// here logic to be apply only for the top most method for a given name for this class inheritance tree
}
const result = method.apply(this,arguments);// exec and get result
if (isLeaf){
// eventual logic post execution
}
return result;
}
}
}
```

@@ -1,2 +0,2 @@

export * from './koa';
export * from './base-router';
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