npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mysimpleapp/msa-sheet

v0.1.9

Published

MySimpleApp module offering the possibility to create WYSIWYG sheets

Readme

msa-sheet

MySimpleApp module offering the possibility to create WYSIWYG sheets.

SERVER API

The following code is available by importing the corresponding node module:

// Example
var msaSheet = Msa.require("msa-sheet")

Function: msaSheet.registerType

From index.js

Register a new sheet type.

Each sheet type has its own configuration (default permissions, default content), its own database collection.

// Simple example
msaSheet.registerType("my_sheet_type")

// Complete example
msaSheet.registerType("my_sheet_type", {
  // default content
  content: "<div>Hello</div>",
  // default permissions
  perms: {
    create: { group:"admin"}
  },
  // DB collection
  dbCollection: "my_sheet_types"
})
  • msaSheet.registerType: Function(type[, args])
    • *type: String, new sheet type to create and register.
    • args: Object, possible properties are:
      • content: HTML Expr, default sheet content.
      • perms: Object, default user permissions. The possible properties are:
        • create: User Expr, users hqving permission to create sheets of this type.
      • dbCollection: String or Collection, DB collection where sheets of this tpe will be stored.

Function: msaSheet.registerTemplate

From index.js

Register a piece of html to be insertable in a sheet by the user.

// Simple example
var welUrl = Msa.compsUrl+"/my-custom-element/my-custom-element.html"
msaSheet.registerTemplate("My super element", { wel:welUrl })

// Complex example
msaSheet.registerTemplate("My super element", { wel:welUrl },
  {
    img:"<img src='/url/of/img.jpg'></img>"
  })
  • msaSheet.registerTemplate: Function(name, html [, args])
    • *name: String, name of the template.
    • *html: HTML Expr, content of the template.
    • args: Object, possible properties are:
      • img: HTML Expr, image used in the template selection menu.
      • head: HTML Expr, associated HEAD dependencies on template (if the template is a web element, this field is automatically filled).

Function: msaSheet.registerHead

From index.js

If a HTML element can be inserted in a sheet (with a template for example), and this element needs to import some external content (such as a web component), then this external content needs to be registered with this function.

// Example
var welUrl = Msa.compsUrl+"/my-custom-element/my-custom-element.html"
msaSheet.registerHead("my-custom-element", { html:welUrl })
  • msaSheet.registerHead: Function(tag, head)
    • *tag: String, tag of the element to register.
    • *head: HTML Expr, HEAD dependencies associated to element.

Function: msaSheet.getSheet

From index.js

Get a formatted sheet from database.

// Simple example
msaSheet.getSheet("page", "home", function(err, sheet){
	if(err) console.error(err)
	else if(sheet===null) console.log("The requested sheet does not exist")
	else console.log("The requested sheet:", sheet)
})

// Complex example
msaSheet.getSheet("page", "home",
  {
		user: req.session.user
		ifNotExist": "create"
	},
	function(err, sheet){
		if(err===401) console.error("User is not authorized to view this sheet")
		else if(err) console.error(err)
		else console.log("The requested sheet:", sheet)
	}
)
  • msaSheet.getSheet: Function(type, name [, args], next)
    • *type: String, sheet type.
    • *name: String, sheet name.
    • args: Object, possible properties are:
      • user: User Object.
      • checkUserPerms: Boolean, check if user is authorized to view the sheet (default: true if user is provided, false otherwise).
      • ifNotExist: String or Function(), behaviour when requested sheet does not exist.
        • if "null": returned sheet is null (default value).
        • if "error": trigger an error.
        • if "create": create the sheet (see msaSheet.createSheet for more details).
        • if Function(), call this function.
    • next: Function(err, sheet)
      • err: returned error (if any).
      • sheet: returned sheet.

Function: msaSheet.createSheet

From index.js

Create a sheet in database.

// Simple example
msaSheet.createSheet("page", "home", function(err, sheet){
  if(err) console.error(err)
  else console.log("The created sheet:", sheet)
})

// Complex example
msaSheet.createSheet("page", "home",
  {
    user: req.session.user
    ifExist: "error",
    insertInDb: false
  },
  function(err, sheet){
    if(err===401) console.error("User is not authorized to create this sheet")
    else if(err) console.error(err)
    else console.log("The created sheet:", sheet)
  }
)
  • msaSheet.createSheet: Function(type, name [, args], next)
    • *type: String, sheet type.
    • *name: String, sheet name.
    • args: Object, possible properties are:
      • user: User Object.
      • checkUserPerms: Boolean, check if user is authorized to create the sheet (default: true if user is provided, false otherwise).
      • ifExist: String or Function(), behaviour when sheet already exists in database.
        • if "get": default value, return the sheet that already exists (see msaSheet.getSheet for more details).
        • if "null": returned sheet is null.
        • if "error": trigger an error.
        • if Function(sheet), call this function. *sheet: the sheet that already exists.
      • insertInDb: Do insert the created sheet in database (default: true)
    • next: Function(err, sheet)
      • err: returned error (if any).
      • sheet: returned created sheet.

Function: msaSheet.updateSheet

From index.js

Update a sheet in database.

// Simple example
msaSheet.updateSheet("page", "home",
  { content:"<div>Coucou</div>" },
  function(err, sheet){
    if(err) console.error(err)
    else console.log("The updated sheet:", sheet)
  }
)

// Complex example
msaSheet.updateSheet("page", "home",
  { content:"<div>Coucou</div>" },
  {
    user: req.session.user
    ifNotExist: "error",
    insertInDb: false
  },
  function(err, sheet){
    if(err===401) console.error("User is not authorized to update this sheet")
    else if(err) console.error(err)
    else console.log("The updated sheet:", sheet)
  }
)
  • msaSheet.updateSheet: Function(type, name, updates [, args], next)
    • *type: String, sheet type.
    • *name: String, sheet name.
    • *updates: Object, sheet updates. The possible properties are:
      • content: HTML Expr, the new content of the sheet.
    • args: Object, possible properties are:
      • user: User Object.
      • checkUserPerms: Boolean, check if user is authorized to create the sheet (default: true if user is provided, false otherwise).
      • ifNotExist: String or Function(), behaviour when sheet does not exist in database.
        • if "create": default value, create a new sheet and update it (see msaSheet.createSheet for more details).
        • if "null": returned sheet is null.
        • if "error": trigger an error.
        • if Function(), call this function.
      • insertInDb: Do update the created sheet in database (default: true)
    • next: Function(err, sheet)
      • err: returned error (if any).
      • sheet: returned updated sheet.

LICENSE

MIT