JSPM

node-red-contrib-gatekeeper

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q33242F
  • License MIT

A gatekeeper node to stop or allow message flow based on msg/flow/global/env/jsonata values

Package Exports

  • node-red-contrib-gatekeeper
  • node-red-contrib-gatekeeper/gatekeeper.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-red-contrib-gatekeeper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-red-contrib-gatekeeper

A tiny Node-RED node that opens or closes the gate for passing messages forward.
You choose a property (from msg, flow, global, env, or a jsonata expression).
If that value is true (or the string "true"), the gate closes (message dropped).
Otherwise, the gate opens and the message continues.

status license


Features

  • ✅ Simple allow/deny logic in one node
  • ✅ Supports msg, flow, global, env, or jsonata
  • ✅ Clear status: open (green) / closed (red)
  • ✅ No external deps

Install

From your Node-RED user directory (~/.node-red):

npm install node-red-contrib-gatekeeper

Or via Manage paletteInstall → search for node-red-contrib-gatekeeper.


Usage

  1. Drag Gatekeeper into your flow.

  2. Set Property to check:

    • msg/flow/global/env: provide the property/key (e.g., payload, allow, FEATURE_FLAG)
    • jsonata: provide a JSONata expression (e.g., payload.allow = true)
  3. If the evaluated value is true or the string "true"gate closed (message not forwarded). Anything else → gate open (message forwarded).

Status

  • green dotopen (message passes)
  • red dotclosed (message blocked)
  • red ringerror

Properties

Field Type Description
Name string Optional label shown under the node.
Property msg/flow/global/env/jsonata The value to check. If it resolves to true (or "true"), gate closes.

Examples:

  • msg + payload → checks msg.payload
  • flow + allow → checks flow.get("allow")
  • global + feature.enabled → checks global.get("feature.enabled") (if you store an object)
  • env + FEATURE_FLAG → checks process.env.FEATURE_FLAG
  • jsonata + payload.level > 10 → evaluates expression on the incoming msg

Example flows

1) Simple boolean in msg.payload

[
  { "id":"inject1","type":"inject","name":"allow=false","props":[{"p":"payload"}],"payload":"false","payloadType":"bool" },
  { "id":"gate1","type":"gatekeeper","name":"Gate","property":"payload","propertyType":"msg" },
  { "id":"debug1","type":"debug","name":"Passed","complete":"true" }
]
  • payload=false → gate open → message passes
  • Set payload=true → gate closed → message dropped

2) JSONata condition

[
  { "id":"inject2","type":"inject","name":"payload={ level: 12 }","props":[{"p":"payload"}],"payload":"{\"level\":12}","payloadType":"json" },
  { "id":"gate2","type":"gatekeeper","name":"Level Gate","property":"payload.level > 10","propertyType":"jsonata" },
  { "id":"debug2","type":"debug","name":"Passed","complete":"true" }
]
  • Expression resolves to true → gate closed (blocked)
  • Change to payload.level > 99 → resolves false → gate open

Notes

  • The node treats boolean true and string "true" as closed; everything else is open.
  • With jsonata, the expression is evaluated against the current msg. Any exception is shown as error status.

License

MIT © AIOUBSAI