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

desolid

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

desolid

Minimalistic Headless CMS

  • 0.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Desolid: Minimalistic Headless CMS

Minimalistic Headless CMS

CMS model

The CMS models using a graphql file schema.graphql in the root directory. here you can see a simple example:

enum UserGroup {
    Admin # default
    User # default
    Editor
    Author
}

type User
    @model
    @authorization(
        READ: "$user.group = Editor || $user.id = $this.id"
        CREATE: "true"
        UPDATE: "$user.group = Editor || $user.id = $this.id"
        DELETE: "$user.group = Editor || $user.id = $this.id"
    ) {
    id: ID! @auto
    createdAt: DateTime! @createdAt
    updatedAt: DateTime! @updatedAt
    email: Email! @unique
    phone: PhoneNumber @unique
    password: Password! @validation(length: { min: 12, max: 25 })
    group: UserGroup!
    name: String!
    family: String!
    avatar: File @upload(accept: "imagee/*", size: { max: "5MB", min: "10KB" })
}

type Post
    @model
    @authorization(
        READ: "$this.published || $user.group = Editor || $user.id = $this.author"
        CREATE: "$user.group in [Editor, Author]"
        UPDATE: "$user.group = Editor || $user.id = $this.author"
        DELETE: "$user.group = Editor || $user.id = $this.author"
    ) {
    id: ID! @auto
    createdAt: DateTime! @createdAt
    updatedAt: DateTime! @updatedAt
    author: User!
    title: String!
    content: String!
    published: Boolean! @default(value: false) @authorize(READ: "$user.group in [Editor, Author]")
    categories: [Category!]!
}

type Category
    @model
    @authorization(
        READ: "true"
        CREATE: "$user.group = Editor"
        UPDATE: "$user.group = Editor"
        DELETE: "$user.group = Editor"
    ) {
    id: ID! @auto
    createdAt: DateTime! @createdAt
    updatedAt: DateTime! @updatedAt
    name: String!
    posts: [Post!]!
}

Usgae

@todo describe

Node

npm install -g desolid

Docker

Docker Compose

Global Variables

  • $now refers to current DateTime
  • $userrefers to the authenticated user
  • $this refers to the current model

Primitive Scalars

  • ID
  • Int
  • Float
  • String
  • Boolean

Built in Scalars

  • Datetime
  • Password
  • PhoneNumber
  • Email
  • Json

Built in Types

  • Resource
  • SoftDeleteResource

Built in Models

  • User
  • File

Authorization

Authorization describes using @Athorization directive. you can indicate the logic using javascript boolean operators:

type Post
    @model
    @authorization(
        READ: "$this.published || $user.group = Editor || $user.id = $this.author"
        CREATE: "$user.group in [Editor, Author]"
        UPDATE: "$user.group = Editor || $user.id = $this.author"
        DELETE: "$user.group = Editor || $user.id = $this.author"
    ) {
    id: ID! @auto
    createdAt: DateTime! @createdAt
    updatedAt: DateTime! @updatedAt
    author: User!
    title: String!
    content: String!
    published: Boolean! @default(value: false) @authorize(READ: "$user.group in [Editor, Author]")
    categories: [Category!]!
}

2 variables are available in the scope:

  • $user: refers to the authenticated user
  • $this: refers to the current model

FAQs

Package last updated on 16 May 2020

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