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

fastify-casbin-rest

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-casbin-rest - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

package.json
{
"name": "fastify-casbin-rest",
"version": "1.2.0",
"version": "1.2.1",
"description": "Plugin for fastify to add support for Casbin REST model",

@@ -5,0 +5,0 @@ "main": "plugin.js",

/// <reference types="node" />
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest } from 'fastify'
import {
ContextConfigDefault,
RawReplyDefaultExpression,
RawRequestDefaultExpression,
RawServerBase,
RawServerDefault
} from 'fastify/types/utils'
import { RouteGenericInterface } from 'fastify/types/route'
declare module 'fastify' {
interface RouteShorthandOptions {
interface RouteShorthandOptions<
RawServer extends RawServerBase = RawServerDefault,
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
ContextConfig = ContextConfigDefault
> {
casbin?: {
rest?: boolean | {
getSub?: ((request: FastifyRequest) => string) | string,
getObj?: ((request: FastifyRequest) => string) | string,
getAct?: ((request: FastifyRequest) => string) | string
getSub?: ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>) => string) | string,
getObj?: ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>) => string) | string,
getAct?: ((request: FastifyRequest<RouteGeneric, RawServer, RawRequest>) => string) | string
}

@@ -13,0 +27,0 @@ }

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

import fastify, { FastifyReply, FastifyRequest } from 'fastify'
import fastify, { FastifyReply, FastifyRequest, RequestGenericInterface } from 'fastify'
import { expectType } from 'tsd'

@@ -50,1 +50,16 @@ import casbinRest from '../plugin'

}, () => Promise.resolve('ok'))
interface ListRequest extends RequestGenericInterface {
Params: {
listID: string
}
}
server.get<ListRequest>('/', {
casbin: {
rest: {
getObj: (request) => request.params.listID,
}
}
}, () => Promise.resolve('ok'))
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