@theotherwillembotha/node-red-nginxproxymanager 0.0.55 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/build/GenerateNodes.d.ts +2 -0
  2. package/build/GenerateNodes.d.ts.map +1 -0
  3. package/build/GenerateNodes.js +7 -6
  4. package/build/Nodes.html +653 -414
  5. package/build/Nodes.js +34995 -12
  6. package/build/Plugins.html +37 -0
  7. package/build/Plugins.js +34650 -55
  8. package/build/index.d.ts +5 -0
  9. package/build/index.d.ts.map +1 -0
  10. package/build/nginx/node/NginxGetHostsNode.d.ts +19 -0
  11. package/build/nginx/node/NginxGetHostsNode.d.ts.map +1 -0
  12. package/build/nginx/node/NginxGetHostsNode.js +2 -2
  13. package/build/nginx/node/NginxProxyManagerConfigNode.d.ts +15 -0
  14. package/build/nginx/node/NginxProxyManagerConfigNode.d.ts.map +1 -0
  15. package/build/nginx/node/NginxProxyManagerConfigNode.js +4 -3
  16. package/build/nginx/node/UpdateHostNode.d.ts +18 -0
  17. package/build/nginx/node/UpdateHostNode.d.ts.map +1 -0
  18. package/build/nginx/node/UpdateHostNode.js +2 -3
  19. package/build/nginx/service/NginxProxyManagerClient.d.ts +9 -0
  20. package/build/nginx/service/NginxProxyManagerClient.d.ts.map +1 -0
  21. package/build/nginx/service/NginxProxyManagerClient.js +3 -0
  22. package/build/nginx/service/NginxProxyManagerService.d.ts +9 -0
  23. package/build/nginx/service/NginxProxyManagerService.d.ts.map +1 -0
  24. package/build/nginx/service/NginxProxyManagerService.js +21 -5
  25. package/build/nginx/service/client/NginxClient.d.ts +69 -0
  26. package/build/nginx/service/client/NginxClient.d.ts.map +1 -0
  27. package/build/nginx/service/client/NginxHttpClient.d.ts +26 -0
  28. package/build/nginx/service/client/NginxHttpClient.d.ts.map +1 -0
  29. package/build/nginx/service/client/types.d.ts +291 -0
  30. package/build/nginx/service/client/types.d.ts.map +1 -0
  31. package/build/runtime/NodeManagerRuntime.js +140 -0
  32. package/package.json +10 -6
  33. package/documentation/GetHostsNode.png +0 -0
  34. package/documentation/NginxProxyManagerConfig.png +0 -0
  35. package/documentation/UpdateHostNode.png +0 -0
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * NodeManagerRuntime.ts
4
+ *
5
+ * STANDALONE - zero imports from the rest of plugincore.
6
+ *
7
+ * This file is compiled and copied into every plugin's build output so that
8
+ * plugins are self-contained and do not require plugincore to be separately
9
+ * installed in the user's Node-RED environment.
10
+ *
11
+ * When multiple plugins are deployed, each ships its own copy of this file.
12
+ * The first plugin to load registers its NodeManager and nodes; subsequent
13
+ * copies operate independently on their own node types with no conflict.
14
+ *
15
+ * POST_CONSTRUCT_KEY is intentionally a plain string (not a Symbol) so that
16
+ * the decorators (from plugincore's NodeConstructor, loaded via the plugin's
17
+ * dependency on plugincore) and this runtime file (a separate module instance)
18
+ * resolve to the same property key on node instances.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.NodeManager = exports.POST_CONSTRUCT_KEY = exports.NODEMANAGER_API_VERSION = void 0;
22
+ exports.runPostConstructInitializers = runPostConstructInitializers;
23
+ // ─── API version ────────────────────────────────────────────────────────────
24
+ // Semver of the NodeManager API contract - independent of plugincore's package
25
+ // version. Bump when the contract changes; plugins can read this to warn users
26
+ // that they were built against a different NodeManager version.
27
+ exports.NODEMANAGER_API_VERSION = "1.0.0";
28
+ // ─── Shared key for post-construct initializer lists ────────────────────────
29
+ // Must be a plain string so it resolves identically across module instances.
30
+ exports.POST_CONSTRUCT_KEY = '__plugincore_postConstructInitializers__';
31
+ // ─── Post-construct initializer runner ───────────────────────────────────────
32
+ function runPostConstructInitializers(instance) {
33
+ const initializers = instance[exports.POST_CONSTRUCT_KEY];
34
+ if (!initializers || initializers.length === 0)
35
+ return;
36
+ const className = instance.constructor.name;
37
+ initializers.forEach((init, index) => {
38
+ try {
39
+ init(instance);
40
+ }
41
+ catch (error) {
42
+ console.error(`Post-construct initialization failed:\n` +
43
+ ` Class: ${className}\n` +
44
+ ` Initializer: ${index + 1}/${initializers.length}\n` +
45
+ ` Error: ${error instanceof Error ? error.message : String(error)}`);
46
+ throw error;
47
+ }
48
+ });
49
+ delete instance[exports.POST_CONSTRUCT_KEY];
50
+ }
51
+ // ─── NodeManager ─────────────────────────────────────────────────────────────
52
+ // RED is stored on `global` rather than as a static class field so that all
53
+ // module instances of NodeManagerRuntime (the local copy bundled into Nodes.js
54
+ // and the copy bundled via plugincore's NodeConstructor) share the same value.
55
+ // Without this, esbuild's two separate inline copies would have independent
56
+ // static fields and the one used by decorators would never see RED being set.
57
+ const _GLOBAL_RED_KEY = '__plugincore_NodeManager_RED__';
58
+ // ─── Global node-type registration guard ─────────────────────────────────────
59
+ // When multiple self-contained plugins are installed they each bundle plugincore
60
+ // inline and each try to call RED.nodes.registerType for the same shared
61
+ // infrastructure node types (ConsoleLoggerConfigNode, RestLoggerConfigNode, etc.).
62
+ // Node-RED rejects duplicate registrations with a warning and the second
63
+ // plugin's Nodes.js fails to load. This global set tracks which types have
64
+ // already been registered so subsequent plugins silently skip them.
65
+ const _GLOBAL_REGISTERED_NODES_KEY = '__plugincore_registered_nodes__';
66
+ function getRegisteredNodes() {
67
+ if (!global[_GLOBAL_REGISTERED_NODES_KEY]) {
68
+ global[_GLOBAL_REGISTERED_NODES_KEY] = new Set();
69
+ }
70
+ return global[_GLOBAL_REGISTERED_NODES_KEY];
71
+ }
72
+ class NodeManager {
73
+ constructor(RED) {
74
+ this.typeBacklog = [];
75
+ global[_GLOBAL_RED_KEY] = RED;
76
+ const nodeTypeServiceId = "@theotherwillembotha/nodetypeservice";
77
+ const nodeTypeServiceListener = (pluginID) => {
78
+ if (pluginID === nodeTypeServiceId) {
79
+ RED.events.off('plugin.instantiated', nodeTypeServiceListener);
80
+ this.nodeTypeService = RED.plugins.get(nodeTypeServiceId).instance;
81
+ for (const nodeType of this.typeBacklog) {
82
+ for (const tag of nodeType.getNodeDescriptor().tags()) {
83
+ this.nodeTypeService.registerNodeType(tag, nodeType);
84
+ }
85
+ }
86
+ this.typeBacklog = [];
87
+ }
88
+ };
89
+ this.nodeTypeService = RED.plugins.get(nodeTypeServiceId)?.instance;
90
+ if (!this.nodeTypeService) {
91
+ RED.events.on('plugin.instantiated', nodeTypeServiceListener);
92
+ }
93
+ }
94
+ static get RED() {
95
+ return global[_GLOBAL_RED_KEY];
96
+ }
97
+ registerNodeType(typeName, type) {
98
+ if (!type) {
99
+ console.error(`[NodeManager v${exports.NODEMANAGER_API_VERSION}] Type "${typeName}" is undefined. ` +
100
+ `Ensure it is exported and included in GenerateNodes.`);
101
+ return this;
102
+ }
103
+ const registeredNodes = getRegisteredNodes();
104
+ if (registeredNodes.has(typeName)) {
105
+ // Already registered by another plugin - skip to avoid Node-RED duplicate-registration error.
106
+ return this;
107
+ }
108
+ registeredNodes.add(typeName);
109
+ const nodeConstructor = function (config) {
110
+ try {
111
+ NodeManager.RED.nodes.createNode(this, config);
112
+ const node = new type(this, config);
113
+ runPostConstructInitializers(node);
114
+ if (node.onInit) {
115
+ node.onInit();
116
+ }
117
+ }
118
+ catch (error) {
119
+ console.error(`[NodeManager v${exports.NODEMANAGER_API_VERSION}] Failed to construct node "${typeName}":`, error);
120
+ }
121
+ };
122
+ try {
123
+ NodeManager.RED.nodes.registerType(typeName, nodeConstructor, { settings: {} });
124
+ const nodeDescription = type.getNodeDescriptor();
125
+ if (this.nodeTypeService) {
126
+ for (const tag of nodeDescription.tags()) {
127
+ this.nodeTypeService.registerNodeType(tag, type);
128
+ }
129
+ }
130
+ else {
131
+ this.typeBacklog.push(type);
132
+ }
133
+ }
134
+ catch (error) {
135
+ console.error(`[NodeManager v${exports.NODEMANAGER_API_VERSION}] Failed to register node type "${typeName}":`, error);
136
+ }
137
+ return this;
138
+ }
139
+ }
140
+ exports.NodeManager = NodeManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theotherwillembotha/node-red-nginxproxymanager",
3
- "version": "0.0.55",
3
+ "version": "0.4.0",
4
4
  "description": "Node-RED nodes for managing Nginx Proxy Manager hosts, built on node-red-plugincore.",
5
5
  "author": "Willem Botha (@theotherwillembotha)",
6
6
  "license": "ISC",
@@ -13,9 +13,11 @@
13
13
  ],
14
14
  "main": "./build/index.js",
15
15
  "exports": "./build/index.js",
16
+ "types": "./build/index.d.ts",
16
17
  "scripts": {
17
18
  "test": "echo \"Error: no test specified\" && exit 1",
18
- "build": "npm run clean && tsc && npm run generate-nodes && npm run copy-files",
19
+ "build": "npm run clean && tsc && npm run generate-nodes && npm run bundle && npm run copy-files",
20
+ "bundle": "node esbuild.js",
19
21
  "clean": "rm -rf ./build",
20
22
  "generate-nodes": "node build/GenerateNodes.js",
21
23
  "copy-files": "cp -r ./icons ./build/"
@@ -23,10 +25,12 @@
23
25
  "files": [
24
26
  "build/",
25
27
  "icons/",
26
- "documentation/",
27
28
  "LICENSE",
28
29
  "README.md"
29
30
  ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
30
34
  "repository": {
31
35
  "type": "git",
32
36
  "url": "https://github.com/theotherwillembotha/nodered_nginxproxymanager.git"
@@ -40,13 +44,13 @@
40
44
  "nodered": ">=4.0.0"
41
45
  },
42
46
  "dependencies": {
43
- "@theotherwillembotha/node-red-plugincore": "^0.0.55"
47
+ "@theotherwillembotha/node-red-plugincore": "^0.4.2"
44
48
  },
45
49
  "devDependencies": {
46
50
  "@theotherwillembotha/node-red-plugincore": "../nodered_plugincore",
47
- "@types/md5": "^2.3.5",
48
51
  "@types/node": "^22.15.16",
49
- "@types/node-red": "~1.3.5"
52
+ "@types/node-red": "~1.3.5",
53
+ "esbuild": "^0.25.0"
50
54
  },
51
55
  "node-red": {
52
56
  "version": ">=4.0.0",
Binary file
Binary file