{"_id":"@allanoricil/nrg-nodes","_rev":"2-ff7cea47e8794cf395c53bba175975a6","name":"@allanoricil/nrg-nodes","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.1":{"name":"@allanoricil/nrg-nodes","version":"1.0.1","keywords":["node-red","es6+"],"author":{"name":"AllanOricil","email":"allanoricil@duck.com"},"license":"MIT","_id":"@allanoricil/nrg-nodes@1.0.1","maintainers":[{"name":"allanoricil","email":"allanoricilcos@outlook.com"}],"homepage":"https://github.com/AllanOricil/nrg-nodes#readme","bugs":{"url":"https://github.com/AllanOricil/nrg-nodes/issues"},"dist":{"shasum":"db879753712189fea0404e09202d8a944440c478","tarball":"https://registry.npmjs.org/@allanoricil/nrg-nodes/-/nrg-nodes-1.0.1.tgz","fileCount":10,"integrity":"sha512-3Z9gHIBhApCx6IumYoHwG6uu3XFtHJuqT/h2T1KFtzvMx+TW6iWLuFpXkH8/vWwkF7NZg3ieHEh+tn6v2f7mxA==","signatures":[{"sig":"MEQCIF88gpFVbaE+fN2fhvYLzN5+DUFYInJEHM2tAkLzb+YRAiAta6u37+YM1XqkM8OMWHnQi5AFc6OLC8inq/YN+LhO3w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90313},"main":"./lib/index.cjs.js","types":"./lib/index.d.ts","module":"./lib/index.esm.js","engines":{"node":">=18"},"exports":{".":"./lib/index.cjs.js","./module":"./lib/index.esm.js"},"gitHead":"594925bbe118ab14629f3cab8c699ecdbe4b97e1","scripts":{"lint":"eslint .","build":"node esbuild.config.js && npm run build:types","format":"prettier **/*.{js,json} --ignore-unknown","prepare":"husky install","lint:fix":"eslint --fix .","format:fix":"prettier **/*.{js,json} --write --ignore-unknown","build:types":"tsc --emitDeclarationOnly --declaration --project tsconfig.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"allanoricil","email":"allanoricilcos@outlook.com"},"repository":{"url":"git+https://github.com/AllanOricil/nrg-nodes.git","type":"git"},"_npmVersion":"10.2.5","description":"A very simple lib that aims to ease and structure the creation of custom node-red nodes using ES6+ featues","directories":{},"lint-staged":{"**/*.{js,json}":["prettier --write --ignore-unknown","eslint --fix"]},"_nodeVersion":"18.18.0","dependencies":{"camelcase":"^8.0.0"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^8.0.3","eslint":"^8.57.0","esbuild":"^0.21.5","prettier":"^3.2.5","typescript":"^5.5.4","lint-staged":"^15.2.0","@commitlint/cli":"^19.3.0","semantic-release":"^23.1.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.1","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2","@semantic-release/commit-analyzer":"^11.1.0","@semantic-release/release-notes-generator":"^12.1.0"},"_npmOperationalInternal":{"tmp":"tmp/nrg-nodes_1.0.1_1728182072993_0.06207548109602645","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@allanoricil/nrg-nodes","version":"1.1.0","keywords":["node-red","es6+","nrg"],"author":{"name":"AllanOricil","email":"allanoricil@duck.com"},"license":"MIT","_id":"@allanoricil/nrg-nodes@1.1.0","maintainers":[{"name":"allanoricil","email":"allanoricilcos@outlook.com"}],"homepage":"https://github.com/AllanOricil/nrg-nodes#readme","bugs":{"url":"https://github.com/AllanOricil/nrg-nodes/issues"},"dist":{"shasum":"3269568a30f41ab21e3943bab5ea9aa7352dda8c","tarball":"https://registry.npmjs.org/@allanoricil/nrg-nodes/-/nrg-nodes-1.1.0.tgz","fileCount":11,"integrity":"sha512-82kNpAVhf3Lmho5ifcbVaIoeqQkW39AYkxYBcheBoDL8t0k4mvIBGAXGR7jIAIZz2347oV4jYmnCWBMgaf+JPA==","signatures":[{"sig":"MEUCIB0tc3Gg2hDkwBiFgOSf4EOpVlzECADyn3OiJl6BXqQBAiEAlqTm0rKgHzSTvgVrpcYiQ5likDemUieI4vXpdIGn0pM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allanoricil%2fnrg-nodes@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":95417},"main":"./lib/index.cjs.js","types":"./lib/index.d.ts","module":"./lib/index.esm.js","engines":{"node":">=18"},"exports":{".":"./lib/index.cjs.js","./module":"./lib/index.esm.js"},"gitHead":"0ee09e459b14aea8c6f5e0ad97d8e969d0eb259a","scripts":{"lint":"eslint .","build":"node esbuild.config.js && npm run build:types","format":"prettier **/*.{js,json} --ignore-unknown","prepare":"husky install","lint:fix":"eslint --fix .","format:fix":"prettier **/*.{js,json} --write --ignore-unknown","build:types":"tsc --emitDeclarationOnly --declaration --project tsconfig.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"allanoricil","email":"allanoricilcos@outlook.com"},"repository":{"url":"git+https://github.com/AllanOricil/nrg-nodes.git","type":"git"},"_npmVersion":"10.8.0","description":"A very simple lib that aims to ease and structure the creation of custom node-red nodes using ES6+ featues","directories":{},"lint-staged":{"**/*.{js,json}":["prettier --write --ignore-unknown","eslint --fix"]},"_nodeVersion":"20.13.1","dependencies":{"camelcase":"^8.0.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"husky":"^8.0.3","eslint":"^8.57.0","esbuild":"^0.21.5","prettier":"^3.2.5","typescript":"^5.5.4","lint-staged":"^15.2.0","@commitlint/cli":"^19.3.0","semantic-release":"^23.1.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.1","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","@semantic-release/changelog":"^6.0.3","@commitlint/config-conventional":"^19.2.2","@semantic-release/commit-analyzer":"^11.1.0","@semantic-release/release-notes-generator":"^12.1.0"},"_npmOperationalInternal":{"tmp":"tmp/nrg-nodes_1.1.0_1728851711755_0.7746815957373705","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@allanoricil/nrg-nodes","version":"1.1.1","description":"A very simple lib that aims to ease and structure the creation of custom node-red nodes using ES6+ featues","main":"./lib/index.cjs.js","module":"./lib/index.esm.js","types":"./lib/index.d.ts","exports":{".":"./lib/index.cjs.js","./module":"./lib/index.esm.js"},"author":{"name":"AllanOricil","email":"allanoricil@duck.com"},"repository":{"type":"git","url":"git+https://github.com/AllanOricil/nrg-nodes.git"},"bugs":{"url":"https://github.com/AllanOricil/nrg-nodes/issues"},"homepage":"https://github.com/AllanOricil/nrg-nodes#readme","license":"MIT","publishConfig":{"access":"public","provenance":true},"engines":{"node":">=18"},"keywords":["node-red","es6+","nrg"],"scripts":{"lint":"eslint .","lint:fix":"eslint --fix .","format":"prettier **/*.{js,json} --ignore-unknown","format:fix":"prettier **/*.{js,json} --write --ignore-unknown","prepare":"husky install","build":"node esbuild.config.js && npm run build:types","build:types":"tsc --emitDeclarationOnly --declaration --project tsconfig.json","prepublishOnly":"npm run build"},"lint-staged":{"**/*.{js,json}":["prettier --write --ignore-unknown","eslint --fix"]},"devDependencies":{"@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^11.1.0","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^12.1.0","esbuild":"^0.21.5","eslint":"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","husky":"^8.0.3","lint-staged":"^15.2.0","prettier":"^3.2.5","semantic-release":"^23.1.1","typescript":"^5.5.4"},"dependencies":{"camelcase":"^8.0.0"},"_id":"@allanoricil/nrg-nodes@1.1.1","gitHead":"365e77d313cb6ab432cd58de5cfabb2f3453028e","_nodeVersion":"20.13.1","_npmVersion":"10.8.0","dist":{"integrity":"sha512-OjKbKsNjnYzUa9ogPUYdXgUiUlGTdIp/YLzgV2YunSWRAdo5zF3D3KaH40q9x+gqjzpMQkF9xXf3fJzcSmjLaA==","shasum":"8a06af9e9c2dc61f3c97700d2fad169b650ad513","tarball":"https://registry.npmjs.org/@allanoricil/nrg-nodes/-/nrg-nodes-1.1.1.tgz","fileCount":11,"unpackedSize":96545,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allanoricil%2fnrg-nodes@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFzUlc6qWnqR1BbNtct0BOxhhwjZqlES8hBAHuxqeuz6AiBLpUnwNgjC474Dlm/a34g9knyj8nTXtuhZi04hrHJsTg=="}]},"_npmUser":{"name":"allanoricil","email":"allanoricilcos@outlook.com"},"directories":{},"maintainers":[{"name":"allanoricil","email":"allanoricilcos@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nrg-nodes_1.1.1_1730574499244_0.2204751994914378"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-06T02:34:32.864Z","modified":"2024-11-02T19:08:19.923Z","1.0.1":"2024-10-06T02:34:33.157Z","1.1.0":"2024-10-13T20:35:11.973Z","1.1.1":"2024-11-02T19:08:19.480Z"},"bugs":{"url":"https://github.com/AllanOricil/nrg-nodes/issues"},"author":{"name":"AllanOricil","email":"allanoricil@duck.com"},"license":"MIT","homepage":"https://github.com/AllanOricil/nrg-nodes#readme","keywords":["node-red","es6+","nrg"],"repository":{"type":"git","url":"git+https://github.com/AllanOricil/nrg-nodes.git"},"description":"A very simple lib that aims to ease and structure the creation of custom node-red nodes using ES6+ featues","maintainers":[{"name":"allanoricil","email":"allanoricilcos@outlook.com"}],"readme":"# node-red-node\n\nA very simple lib that aims to ease the creation of node-red nodes using ES6+ features.\n\n> [!IMPORTANT]\n> This lib does not provide or use typescript types for node-red objects or methods\n\n## 📖 How to define a Node\n\n```js\nimport { Node } from \"@allanoricil/nrg-nodes\";\nimport fetch from \"node-fetch\";\n\nexport default class MyCustomNodeClass extends Node {\n  constructor(config) {\n    super(config);\n    this.log(`constructed type: ${this.type} id: ${this.id}`);\n  }\n\n  // NOTE: Unlike the constructor, this executes only once, regardless of how many nodes of this type are in the flow.\n  static init() {\n    Node.RED.httpAdmin.get(\"/test\", async function (req, res) {\n      try {\n        res.status(200).json({ message: \"success\" });\n      } catch (err) {\n        Node.RED.log.error(\"ERROR:\" + err.message);\n        res.status(500).json({ message: \"something unknown happened\" });\n      }\n    });\n  }\n\n  // NOTE: Implement this method if your node has credentials. This object is passed to `RED.nodes.registerType(\"type\", MyCustomNodeClass, { credentials })`\n  static credentials() {\n    return {\n      username: { type: \"text\", required: true },\n      password: { type: \"password\", required: true },\n    };\n  }\n\n  /*\n    NOTE: Considering this node's implementation is located at ./src/nodes/node-1/server/index.js, its type will be node-1.\n    Therefore, the \"customSetting\" shown below will be accessible as 'RED.settings.node1CustomSetting' in both client and server side.\n    Read this doc to understand more: https://nodered.org/docs/creating-nodes/node-js#custom-node-settings\n    It feels weird, but this is how Node-RED is currently handling custom settings. I hope that in the future settings are scoped by node's type using another nested property. For example `RED.settings.[\"node-1\"].customSettings`\n  */\n  static settings() {\n    return {\n      customSetting: {\n        value: \"default\",\n        exportable: true,\n      },\n    };\n  }\n\n  async onInput(msg, send, done) {\n    try {\n      this.log(\"node-1 on input\", msg.payload);\n      this.status({\n        fill: \"blue\",\n        shape: \"ring\",\n        text: \"fetching data\",\n      });\n      const response = await fetch(\"https://dog.ceo/api/breeds/image/random\");\n      this.status({\n        fill: \"green\",\n        shape: \"dot\",\n        text: \"success\",\n      });\n      if (!response.ok) {\n        throw new Error(`HTTP error! Status: ${response.status}`);\n      }\n      const data = await response.json();\n      msg.payload = data;\n      send(msg);\n      done();\n    } catch (error) {\n      this.status({\n        fill: \"red\",\n        shape: \"ring\",\n        text: \"error\",\n      });\n      this.error(\"Failed to fetch dog image:\", error);\n      done(error);\n    } finally {\n      setTimeout(() => {\n        this.status({});\n      }, 3000);\n    }\n  }\n\n  onClose(removed, done) {\n    if (removed) {\n      this.log(`type: ${this.type} id: ${this.id} disabled/deleted`);\n    } else {\n      this.log(`type: ${this.type} id: ${this.id} restarted`);\n    }\n    done();\n  }\n}\n```\n","readmeFilename":"README.md"}