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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@notum-cz/strapi-plugin-record-locking

v2.0.0

Published

Hey I am editing, don't change my content

Downloads

1,197

Readme

Strapi plugin record-locking

This plugin provides the functionality to prevent data loss in cases where multiple users are simultaneously editing the same record within STRAPI v5.

When a user attempts to edit a record that is already being edited, a warning will be displayed.

Record Locking Plugin Example

⚠️ We've released version 2.0.0 for the Record Locking Plugin.

Plugin version 2.x is aimed at Strapi V5. If you need support for Strapi V4, please follow the 1.x releases. What's new:

  • TypeScript rewrite.
  • Overall code refactor to make it safer & more readable.
  • Strapi V5 support.
    • Records are now matched based on document_id attribute.

Migration from 1.x to 2.x

Since the plugin does not retain any data, we're not providing migration scripts for the database. Strapi should update the columns automatically, however if this does not happen, you can update the columns manually when migrating to Strapi V5:

  • column entityType has been renamed to entityId
  • column entityIdentifier has been renamed to entityDocumentId

🙉 What does the plugin do for you?

✅ Safeguards against concurrent editing by restricting access to a record to a single user at a time.

✅ Provides clear visibility of the current editing user, enabling you to easily identify who is working on the record.

🧑‍💻 Installation

1. Install the plugin with your favourite package manager:

npm i @notum-cz/strapi-plugin-record-locking
yarn add @notum-cz/strapi-plugin-record-locking

2. Create or modify file config/plugins.js and include the following code snippet:

module.exports = ({ env }) => ({
  'record-locking': {
    enabled: true,
  },
});

We use websockets and you can determine the necessary transport yourself:

module.exports = ({ env }) => ({
  'record-locking': {
    enabled: true,
    config: {
      transports: ['websocket'],
    },
  },
});

If you do not specify a transport, the default parameters will be applied:

DEFAULT_TRANSPORTS: ['polling', 'websocket', 'webtransport'];

3. Enable websocket support by configuring the Strapi middleware.

In the config/middlewares.js file either replace 'strapi::security' with a middleware object (see the example below) or update your existing configuration accordingly.

  1. Ensure that contentSecurityPolicy.directives.connect-src array includes "ws:" and "wss:".
  2. Rebuild Strapi and test record locking features.
  3. You should not encounter any Content Security Policy errors in the console.
module.exports = [
  'strapi::errors',
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:", "ws:", "wss:", "http:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
          ],
          "media-src": ["'self'", "data:", "blob:"],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  'strapi::cors', ...

While optional, it is highly recommended to implement this step to prevent Socket.io from falling back to the HTTP protocol and generating the following error in the web console.
Refused to connect to <protocol>://<url> because it does not appear in the connect-src directive of the Content Security Policy


🛣️ Road map

Are any of these features significant to you? Please show your support by giving a thumbs up on the linked issues. This will help us assess their priority on the roadmap.

🐛 Bugs

We manage bugs through GitHub Issues. If you're interested in helping us, you would be a rock ⭐.

🧔 Authors

The main star: Martin Čapek https://github.com/martincapek Original Maintainer: Ondřej Mikulčík https://github.com/omikulcik Active Maintainer: Dominik Juriga https://github.com/dominik-juriga Project owner: Ondřej Janošík

💬 Community

Join our Discord server to discuss new features, implementation challenges or anything related to this plugin.

🚀 Created with passion by Notum Technologies

  • Official STRAPI partner and Czech based custom development agency.
  • We're passionate about sharing our expertise with the open source community, which is why we developed this plugin. 🖤

🎯 How can Notum help you with your STRAPI project?

✔️ We offer valuable assistance in developing custom STRAPI, web, and mobile apps to fulfill your requirements and goals.. ✔️ With a track record of 100+ projects, our open communication and exceptional project management skills provide us with the necessary tools to get your project across the finish line. 📅 To initiate a discussion about your Strapi project, feel free to reach out to us via email at [email protected]. We're here to assist you!

🔑 Keywords