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

leanengine-extend

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leanengine-extend

Add some useful methods to leanengine AV Object

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Helper functions to leancloud sdk

Client

toObject (avObject)

const member = new AV.Member({
  team: new AV.Team(),
  nickname
})

toObject(member).id === member.id
toObject(member).createdAt === member.createdAt
toObject(member).updatedAt === member.updatedAt
toObject(member).team === member.team
toObject(member).nickname === member.nickname

cors(req, res, next)

import AV from 'leanengine'
import express from 'express'
const app = express()
// Use cors middleware to fix leanengine 1.0.0-rc.1 cors header mismatch with client sdk error
app.use(cors)
app.use(AV.express())

proxy(protocol = 'https', host = 'api.leanengine.cn')

import AV from 'leanengine'
import express from 'express'
const app = express()
// Use proxy method before AV.express() to proxy non-cloud-function requests to
// lean cloud, and handle cloud function local.
app.use(proxy())
app.use(AV.express())

class HookFunction

import AV from 'leanengine'
const hook = new HookFunction()
  .connect(async ({ object: folder }) => {
    const comments = await new AV.Query('File').equalTo('folder', folder).count()
    if (comments.length > 0) throw 'Forbidden Delete. There are files in this folder'
  })
  .connect(async ({ object: folder }) => {
    const handles = await new AV.Query('Handle').equalTo('folder', folder).count()
    if (comments.length > 0) throw 'Forbidden Delete. There are handles open on this folder'
  })
  .connect(async ({ object: folder }) => {
    const protection = await new AV.Query('Protection').equalTo('folder', folder).first()
    if (protection) throw 'Forbidden Delete. This dir is under protection'
  })

AV.Cloud.beforeDelete('Folder', hook.hook)

Keywords

FAQs

Package last updated on 07 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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