@js-soft/node-red-enmeshed-connector 0.1.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.
@@ -0,0 +1,97 @@
1
+ <script type="text/javascript">
2
+ (function () {
3
+ // IMPORTANT: Do NOT call RED.nodes.getType('openApi-red') here.
4
+ // Node-RED loads custom nodes (file: deps) before openapi-red (versioned dep)
5
+ // in the concatenated /nodes HTML, so openApi-red is not yet registered
6
+ // when this script runs.
7
+ //
8
+ // Instead, the lifecycle functions do a lazy getType() at call time —
9
+ // that is always safe because the editor is only opened after full page load.
10
+
11
+ function callBase(method, ctx, args) {
12
+ var base = RED.nodes.getType('openApi-red');
13
+ if (base && typeof base[method] === 'function') {
14
+ return base[method].apply(ctx, args || []);
15
+ }
16
+ console.warn('[enmeshed-connector] openApi-red not ready for ' + method);
17
+ }
18
+
19
+ RED.nodes.registerType('enmeshed-connector', {
20
+ // ── Visual identity ────────────────────────────────────────────────
21
+ category: 'enmeshed',
22
+ color: '#FFE5D0',
23
+ icon: 'jsFrog.svg',
24
+ paletteLabel: 'enmeshed connector',
25
+ inputs: 1,
26
+ outputs: 1,
27
+
28
+ // ── Defaults — must match openapi-red exactly so saved flows are valid ─
29
+ defaults: {
30
+ name: { value: '' },
31
+ configUrlNode: { value: '', type: 'openApi-red-url', required: true },
32
+ apiTag: { value: '', required: true },
33
+ keepAuth: { value: false },
34
+ operationData: { value: {}, validate: function (v) { return v.id !== ''; } },
35
+ target: { value: 'payload' },
36
+ targetType: { value: 'msg' },
37
+ outputStyle: { value: 'each response' },
38
+ errorHandling: { value: 'throw exception' },
39
+ internalErrors: { value: {}, validate: function (v) { return !Object.values(v).find(function (x) { return x; }); } },
40
+ parameters: { value: {}, validate: function (v) { return !v || !Array.isArray(v) || v.length === 0 || !v.find(function (p) { return p.required && p.value === ''; }); } },
41
+ requestContentType: { value: '' },
42
+ responseContentType: { value: '' },
43
+ outputs: { value: 1 },
44
+ responseOutputLabels:{ value: [{ code: 'default', text: 'default' }] },
45
+ responseAsPayload: { value: false },
46
+ debugMode: { value: false },
47
+ headers: { value: [] },
48
+ _version: { value: '' }
49
+ },
50
+
51
+ outputLabels: function (index) {
52
+ var base = RED.nodes.getType('openApi-red');
53
+ if (base && typeof base.outputLabels === 'function') {
54
+ return base.outputLabels.call(this, index);
55
+ }
56
+ var label = (this.responseOutputLabels || [])[index];
57
+ return label ? label.code + ': ' + label.text : '';
58
+ },
59
+
60
+ // ── Label shown on the canvas node ──────────────────────────────────
61
+ label: function () {
62
+ return this.name ||
63
+ (this.operationData && (this.operationData.title || this.operationData.id)) ||
64
+ 'enmeshed connector';
65
+ },
66
+
67
+ // ── Editor lifecycle — lazy delegation to openapi-red's Svelte UI ───
68
+ oneditprepare: function () { callBase('oneditprepare', this, arguments); },
69
+ oneditsave: function () { callBase('oneditsave', this, arguments); },
70
+ oneditcancel: function () { callBase('oneditcancel', this, arguments); },
71
+ onadd: function () { callBase('onadd', this, arguments); }
72
+ });
73
+ })();
74
+ </script>
75
+
76
+ <script type="text/html" data-template-name="enmeshed-connector">
77
+ <div id="openApi-red-svelte-container" class="svelte-integration-red-node-container"></div>
78
+ </script>
79
+
80
+ <script type="text/html" data-help-name="enmeshed-connector">
81
+ <p>
82
+ <b>Enmeshed Connector</b> — calls enmeshed connector REST endpoints via an
83
+ OpenAPI specification.
84
+ </p>
85
+ <p>
86
+ Configure it like a standard <em>openAPI client</em> node: select a config
87
+ URL pointing to the enmeshed connector spec, pick an operation, and map the
88
+ parameters.
89
+ </p>
90
+ <h3>Outputs</h3>
91
+ <dl class="message-properties">
92
+ <dt>payload <span class="property-type">object</span></dt>
93
+ <dd>The API response body.</dd>
94
+ <dt>response <span class="property-type">object</span></dt>
95
+ <dd>Full HTTP response metadata (status, headers, …).</dd>
96
+ </dl>
97
+ </script>
@@ -0,0 +1,39 @@
1
+ /**
2
+ * enmeshed-connector — frosch-styled wrapper around openapi-red.
3
+ *
4
+ * Captures the openApiRed constructor by temporarily intercepting
5
+ * RED.nodes.registerType during the second invocation of the factory,
6
+ * then re-registers it under the 'enmeshed-connector' type name.
7
+ */
8
+ module.exports = function (RED) {
9
+ let openApiRedFactory
10
+ try {
11
+ openApiRedFactory = require('openapi-red/src/openapi')
12
+ } catch (e) {
13
+ RED.log.error('[enmeshed-connector] openapi-red is not installed.')
14
+ return
15
+ }
16
+
17
+ let capturedConstructor = null
18
+ let capturedOptions = undefined
19
+ const originalRegisterType = RED.nodes.registerType.bind(RED.nodes)
20
+
21
+ RED.nodes.registerType = function (type, constructor, options) {
22
+ if (type === 'openApi-red') {
23
+ capturedConstructor = constructor
24
+ capturedOptions = options
25
+ return
26
+ }
27
+ originalRegisterType(type, constructor, options)
28
+ }
29
+
30
+ openApiRedFactory(RED)
31
+ RED.nodes.registerType = originalRegisterType
32
+
33
+ if (!capturedConstructor) {
34
+ RED.log.error('[enmeshed-connector] Could not capture openapi-red constructor.')
35
+ return
36
+ }
37
+
38
+ RED.nodes.registerType('enmeshed-connector', capturedConstructor, capturedOptions)
39
+ }
@@ -0,0 +1,13 @@
1
+ <svg width="127" height="90" viewBox="-13 -9 153 108" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_3680_754)">
3
+ <path d="M27.8815 13.7133C30.5199 13.7133 32.6587 11.5729 32.6587 8.93248C32.6587 6.29208 30.5199 4.15161 27.8815 4.15161C25.243 4.15161 23.1042 6.29208 23.1042 8.93248C23.1042 11.5729 25.243 13.7133 27.8815 13.7133Z" fill="#183248"/>
4
+ <path d="M76.3596 63.6937C75.9992 62.7038 75.7461 61.6601 75.6081 60.5781C75.1097 56.6107 76.2982 52.8198 78.6064 49.919C77.0804 48.6835 75.5391 47.4864 73.9671 46.3199C73.8904 46.2662 73.8214 46.2125 73.7448 46.1588C73.0393 45.6369 72.3261 45.1228 71.613 44.6163C70.7695 44.0177 69.9183 43.4268 69.0595 42.8513C69.0442 42.8436 69.0288 42.8283 69.0135 42.8206C66.391 49.9497 62.902 55.9277 60.0647 60.133C64.8113 62.957 70.4704 64.3153 76.3596 63.6937Z" fill="#183248"/>
5
+ <path d="M38.9006 55.0989C39.3684 56.204 40.5569 56.8716 41.7838 56.6337C43.1948 56.3574 44.115 54.9992 43.8389 53.5872C43.5629 52.1751 42.1979 51.2543 40.7947 51.5305C40.3422 51.6149 39.9512 51.8221 39.6291 52.0984C37.4973 51.2619 35.2506 50.6941 32.9194 50.4255C34.4531 46.9722 35.6876 43.0508 36.0481 38.9376C42.1212 43.1276 47.696 48.0312 52.6113 53.5718C53.8075 46.412 54.0069 39.7894 53.6925 34.0109C52.7416 33.5428 51.7908 33.09 50.8323 32.645C49.8201 32.1768 48.8002 31.7164 47.7727 31.2713C33.0421 24.948 17.031 21.2645 0.383423 20.7427C2.62253 24.549 7.2541 25.7231 7.2541 25.7231C12.7138 27.1427 17.9895 29.0612 23.0352 31.4325C23.871 34.2104 25.696 41.5391 25.1056 50.6634C21.0185 51.3924 17.2994 53.0116 14.1248 55.3138C13.634 55.0682 13.0589 54.9685 12.4761 55.0836C11.0652 55.3598 10.145 56.7258 10.4211 58.1301C10.6971 59.5345 12.0544 60.463 13.4653 60.1867C14.5772 59.9719 15.3747 59.074 15.528 58.0073C18.4189 57.0097 21.4249 56.2347 24.5305 55.7052C24.2467 57.4471 23.871 59.2352 23.3649 61.0462C23.3572 61.0462 23.3419 61.0462 23.3342 61.0462C21.9233 61.3225 21.0031 62.6884 21.2792 64.0928C21.5552 65.4971 22.9125 66.4257 24.3234 66.1494C25.7344 65.8731 26.6546 64.5072 26.3785 63.1028C26.2942 62.6808 26.1101 62.3124 25.8571 61.9978C26.9613 60.6088 28.771 58.1608 30.573 55.0068C33.3795 54.8303 36.1554 54.861 38.8853 55.0912L38.9006 55.0989Z" fill="#183248"/>
6
+ <path d="M126.364 45.821C125.505 38.9528 119.24 34.0799 112.377 34.9394C112.132 34.9701 111.894 35.0161 111.656 35.0621C102.071 24.8558 92.9841 14.6955 79.9789 11.5262C79.6875 11.4571 79.3961 11.388 79.1047 11.3266C65.6011 8.40287 51.668 6.79902 37.4666 6.61484C36.3164 3.70642 33.3258 1.8263 30.0822 2.23302C29.8598 2.26372 29.6374 2.30209 29.4227 2.34813C27.9427 0.682885 25.696 -0.245662 23.3188 0.0536219C19.6688 0.514059 17.0309 3.69874 17.192 7.31317C5.63605 9.01679 -1.8174 14.3348 0.383359 20.7426C17.0233 21.2644 33.0421 24.9479 47.7573 31.2635C49.7587 32.123 51.7294 33.0439 53.6848 34.0031C54.1449 42.4752 53.5084 52.7583 50.2341 63.9085C43.1794 64.5378 37.7503 66.7939 35.0741 68.1368C34.499 67.6687 33.7322 67.4462 32.9501 67.592C31.5391 67.8683 30.6189 69.2342 30.895 70.6385C31.171 72.0429 32.536 72.9714 33.9392 72.6952C35.1815 72.4573 36.0403 71.3676 36.0403 70.1474C41.5844 68.674 45.5412 68.8505 45.5412 68.8505C42.8957 70.2472 40.1198 73.4626 38.6168 75.3734C38.3638 75.3503 38.1107 75.3427 37.85 75.3964C36.4391 75.6727 35.5189 77.0309 35.7949 78.4429C36.071 79.855 37.4359 80.7758 38.8392 80.4996C40.2425 80.2233 41.1703 78.865 40.8943 77.453C40.8636 77.3072 40.8176 77.1691 40.7716 77.0309C46.3617 72.6107 51.0162 70.7767 51.0162 70.7767C51.0699 72.5417 50.9319 75.2199 50.8092 77.1153C49.5823 77.5144 48.8155 78.7653 49.0609 80.0698C49.3369 81.4818 50.7019 82.4027 52.1051 82.1264C53.5084 81.8502 54.4362 80.4919 54.1602 79.0799C54.0528 78.512 53.7538 78.0285 53.355 77.6602C55.8012 72.158 55.9469 67.216 55.9239 65.7042C58.2703 62.8495 64.7653 54.3237 69.0058 42.8128C72.3107 45.0229 75.5007 47.4019 78.5986 49.9112C76.2905 52.812 75.1096 56.6029 75.6004 60.5703C76.3289 66.3642 80.4313 70.9071 85.6917 72.4726C81.0984 73.4395 77.5864 74.9513 75.5927 75.9489C75.0176 75.4808 74.2508 75.2583 73.4686 75.4041C72.0577 75.6803 71.1375 77.0386 71.4136 78.4506C71.6896 79.8626 73.0546 80.7835 74.4578 80.5072C75.7001 80.2693 76.5589 79.1796 76.5589 77.9595C82.103 76.4861 86.0598 76.6626 86.0598 76.6626C83.4142 78.0592 80.6384 81.2746 79.1354 83.1854C78.8823 83.1624 78.6293 83.1548 78.3686 83.2085C76.9576 83.4847 76.0375 84.8507 76.3135 86.255C76.5896 87.667 77.9545 88.5879 79.3578 88.3116C80.761 88.0354 81.6889 86.6694 81.4128 85.2651C81.3822 85.1193 81.3362 84.9811 81.2902 84.843C86.8803 80.4228 91.5348 78.5888 91.5348 78.5888C91.5885 80.3538 91.4505 83.032 91.3278 84.9274C90.1009 85.3265 89.3341 86.5773 89.5794 87.8819C89.8555 89.2939 91.2204 90.2148 92.6237 89.9385C94.0346 89.6622 94.9548 88.304 94.6788 86.892C94.5714 86.3241 94.2724 85.8406 93.8736 85.4723C95.7753 81.1902 96.2891 77.2381 96.4118 74.982C97.4623 74.6597 112.837 69.7791 123.649 55.2523C123.956 54.8686 124.247 54.4772 124.516 54.0628C124.531 54.0398 124.546 54.0168 124.569 53.9938H124.562C126.026 51.6302 126.724 48.7832 126.356 45.8133L126.364 45.821ZM28.4718 13.6749C25.857 14.0048 23.4722 12.1478 23.1425 9.53094C22.8127 6.91413 24.6684 4.52753 27.2833 4.19755C29.8981 3.86757 32.2829 5.72467 32.6126 8.34148C32.9424 10.9583 31.0867 13.3449 28.4718 13.6749Z" fill="#FFB174"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_3680_754">
10
+ <rect width="126.456" height="90" fill="white"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@js-soft/node-red-enmeshed-connector",
3
+ "version": "0.1.0",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "provenance": true
7
+ },
8
+ "description": "Frosch-styled OpenAPI wrapper for the enmeshed connector",
9
+ "keywords": [
10
+ "node-red",
11
+ "openapi",
12
+ "enmeshed",
13
+ "frosch"
14
+ ],
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/js-soft/node-red-nodes.git",
19
+ "directory": "packages/node-red-enmeshed-connector"
20
+ },
21
+ "files": [
22
+ "enmeshed-connector.js",
23
+ "enmeshed-connector.html",
24
+ "icons",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "node-red": {
29
+ "nodes": {
30
+ "enmeshed-connector": "enmeshed-connector.js"
31
+ }
32
+ },
33
+ "engines": {
34
+ "node": "24.x"
35
+ }
36
+ }