Socket
Socket
Sign inDemoInstall

tote-lib

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.7 to 0.0.8

dist/invoke.d.ts

1

dist/index.d.ts

@@ -5,1 +5,2 @@ import * as joi from '@hapi/joi';

export { default as Func } from './func';
export { default as invoke } from './invoke';

@@ -9,2 +9,3 @@ 'use strict';

var get = _interopDefault(require('lodash.get'));
var path = require('path');

@@ -91,2 +92,3 @@ /*! *****************************************************************************

var NODE_ENV = process.env.NODE_ENV;
var Func = /** @class */ (function () {

@@ -110,2 +112,5 @@ function Func(context, request) {

};
if (!this.context.res.status) {
this.status(200);
}
return this;

@@ -135,2 +140,6 @@ };

case 0:
// workaround for Azure Function host bug
if (NODE_ENV === 'development') {
console.log = context.log;
}
func = new Func(context, request);

@@ -178,4 +187,32 @@ _b.label = 1;

var _this = undefined;
var invoke = (function (name, request) { return __awaiter(_this, void 0, void 0, function () {
var path$1, func, context, _a, body, status;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
path$1 = path.resolve('src', name);
return [4 /*yield*/, require(path$1).default
// @ts-ignore
];
case 1:
func = _b.sent();
context = {
res: {}
};
return [4 /*yield*/, func(context, request)];
case 2:
_b.sent();
_a = context.res, body = _a.body, status = _a.status;
return [2 /*return*/, {
body: body,
status: status
}];
}
});
}); });
exports.joi = joi;
exports.Exception = Exception;
exports.Func = Func;
exports.invoke = invoke;

2

package.json
{
"name": "tote-lib",
"license": "MIT",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -11,3 +11,3 @@ # `tote-lib`

`Func` is the class you use to setup your function. It includes several helper methods and a nice setup.
`Func` is the class you use to setup your function. It includes several helper methods.

@@ -91,2 +91,6 @@ #### Example

### `joi`
Look at [Joi docs](https://github.com/hapijs/joi).
### `invoke`

@@ -93,0 +97,0 @@

@@ -11,3 +11,3 @@ import fs from 'fs-extra'

export default {
external: ['@hapi/joi', 'fs-extra', 'lodash.get'],
external: ['@hapi/joi', 'fs-extra', 'lodash.get', 'path'],
input: './src/index.ts',

@@ -14,0 +14,0 @@ output: {

@@ -5,2 +5,4 @@ import get from 'lodash.get'

const { NODE_ENV } = process.env
interface Constructable {

@@ -41,2 +43,6 @@ new (context: Context, request: HttpRequest)

if (!this.context.res.status) {
this.status(200)
}
return this

@@ -73,3 +79,5 @@ }

// workaround for Azure Function host bug
console.log = context.log
if (NODE_ENV === 'development') {
console.log = context.log
}

@@ -76,0 +84,0 @@ const func: Func = new Func(context, request)

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

import { join } from 'path'
import { resolve } from 'path'

@@ -6,5 +6,5 @@ import { AzureFunction, Context } from '@azure/functions'

export default async (name: string, request: any) => {
const path = join(__dirname, '..', 'src', name)
const path = resolve('src', name)
const func: AzureFunction = await import(path)
const func: AzureFunction = await require(path).default

@@ -11,0 +11,0 @@ // @ts-ignore

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc