Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-i

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-i - npm Package Compare versions

Comparing version 8.1.1 to 9.0.1

2

package.json
{
"name": "api-i",
"version": "8.1.1",
"version": "9.0.1",
"description": "Create REST API",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -10,3 +10,3 @@ [![NPM version][npm-version-image]][npm-url]

### v.8.1.1
### v.9.0.1

@@ -13,0 +13,0 @@ ## Example

@@ -30,3 +30,5 @@ module.exports = ({ models, log }) => {

return (name, link, { updateGet, updateGetOne } = {}) => ({
return (name, link, {
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch,
} = {}) => ({
get: async (ctx) => {

@@ -111,3 +113,3 @@ const { id } = ctx.params;

ctx.location = `/${realName}/${result1.id}`;
ctx.body = result1;
ctx.body = updatePost ? updatePost(result1) : result1;
},

@@ -117,11 +119,13 @@

await models.replace(name, ctx.params.id, ctx.request.body);
ctx.body = ctx.params;
ctx.body = updatePut ? updatePut(ctx.params) : ctx.params;
},
update: async (ctx) => {
ctx.body = await models.update(name, ctx.params.id, ctx.request.body);
const result = await models.update(name, ctx.params.id, ctx.request.body);
ctx.body = updatePatch ? updatePatch(result) : result;
},
delete: async (ctx) => {
ctx.body = await models.delete(name, ctx.params.id);
const result = await models.delete(name, ctx.params.id);
ctx.body = updateDelete ? updateDelete(result) : result;
},

@@ -128,0 +132,0 @@

@@ -69,2 +69,3 @@ const Koa = require('koa');

links, openMethods, denyMethods, updateGet, updateGetOne,
updatePost, updateDelete, updatePut, updatePatch,
} = opt;

@@ -76,3 +77,4 @@ if (links) this.links.push({ [name]: links });

await Promise.all([
this.routes(name, this.router, this.controllers, links, security, updateGet, updateGetOne),
this.routes(name, this.router, this.controllers, links, security,
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch),
this.models.create(name, schema, links),

@@ -79,0 +81,0 @@ ]);

@@ -1,3 +0,6 @@

module.exports = (name, app, controller, links, security, updateGet, updateGetOne) => {
const c = controller(name, undefined, { updateGet, updateGetOne });
module.exports = (name, app, controller, links, security,
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch) => {
const c = controller(name, undefined, {
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch,
});

@@ -47,4 +50,8 @@ const path = `/${name}`;

for (const link of [].concat(links)) {
const c1 = controller(name, link, { updateGet, updateGetOne });
const c2 = controller(link, name, { updateGet, updateGetOne });
const c1 = controller(name, link, {
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch,
});
const c2 = controller(link, name, {
updateGet, updateGetOne, updatePost, updateDelete, updatePut, updatePatch,
});
const pathIdlinked1 = `/${name}/:id/${link}`;

@@ -51,0 +58,0 @@ const pathIdlinked2 = `/${link}/:id/${name}`;

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