@hostwebhook/node-types 1.3.0 → 1.5.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.
package/dist/index.d.ts CHANGED
@@ -3,3 +3,5 @@ export { singleMeta, iterableMeta } from './types';
3
3
  export { NODE_CONNECTIONS, canReceiveFrom, canReceiveFromNodes, canSendToNodes, isTerminal, isNodeType, ALL_NODE_TYPES, } from './connections';
4
4
  export { NODE_UI, PREFIX_TO_TYPE, resolveNodeId, } from './ui';
5
5
  export { NODE_DISPATCH, getAllNodeCollections, getNodeDispatchConfig, } from './dispatch';
6
+ export type { NodeRegistryEntry, NodeGroup } from './registry';
7
+ export { NODE_REGISTRY, getNodeRegistryEntry, NODE_DETAIL_PATHS, NODE_COLORS, NODE_STATE_KEYS, PREFIX_TO_NODE_TYPE, NODE_TYPE_TO_PREFIX, } from './registry';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeDispatchConfig = exports.getAllNodeCollections = exports.NODE_DISPATCH = exports.resolveNodeId = exports.PREFIX_TO_TYPE = exports.NODE_UI = exports.ALL_NODE_TYPES = exports.isNodeType = exports.isTerminal = exports.canSendToNodes = exports.canReceiveFromNodes = exports.canReceiveFrom = exports.NODE_CONNECTIONS = exports.iterableMeta = exports.singleMeta = void 0;
3
+ exports.NODE_TYPE_TO_PREFIX = exports.PREFIX_TO_NODE_TYPE = exports.NODE_STATE_KEYS = exports.NODE_COLORS = exports.NODE_DETAIL_PATHS = exports.getNodeRegistryEntry = exports.NODE_REGISTRY = exports.getNodeDispatchConfig = exports.getAllNodeCollections = exports.NODE_DISPATCH = exports.resolveNodeId = exports.PREFIX_TO_TYPE = exports.NODE_UI = exports.ALL_NODE_TYPES = exports.isNodeType = exports.isTerminal = exports.canSendToNodes = exports.canReceiveFromNodes = exports.canReceiveFrom = exports.NODE_CONNECTIONS = exports.iterableMeta = exports.singleMeta = void 0;
4
4
  var types_1 = require("./types");
5
5
  Object.defineProperty(exports, "singleMeta", { enumerable: true, get: function () { return types_1.singleMeta; } });
6
6
  Object.defineProperty(exports, "iterableMeta", { enumerable: true, get: function () { return types_1.iterableMeta; } });
@@ -23,3 +23,11 @@ var dispatch_1 = require("./dispatch");
23
23
  Object.defineProperty(exports, "NODE_DISPATCH", { enumerable: true, get: function () { return dispatch_1.NODE_DISPATCH; } });
24
24
  Object.defineProperty(exports, "getAllNodeCollections", { enumerable: true, get: function () { return dispatch_1.getAllNodeCollections; } });
25
25
  Object.defineProperty(exports, "getNodeDispatchConfig", { enumerable: true, get: function () { return dispatch_1.getNodeDispatchConfig; } });
26
+ var registry_1 = require("./registry");
27
+ Object.defineProperty(exports, "NODE_REGISTRY", { enumerable: true, get: function () { return registry_1.NODE_REGISTRY; } });
28
+ Object.defineProperty(exports, "getNodeRegistryEntry", { enumerable: true, get: function () { return registry_1.getNodeRegistryEntry; } });
29
+ Object.defineProperty(exports, "NODE_DETAIL_PATHS", { enumerable: true, get: function () { return registry_1.NODE_DETAIL_PATHS; } });
30
+ Object.defineProperty(exports, "NODE_COLORS", { enumerable: true, get: function () { return registry_1.NODE_COLORS; } });
31
+ Object.defineProperty(exports, "NODE_STATE_KEYS", { enumerable: true, get: function () { return registry_1.NODE_STATE_KEYS; } });
32
+ Object.defineProperty(exports, "PREFIX_TO_NODE_TYPE", { enumerable: true, get: function () { return registry_1.PREFIX_TO_NODE_TYPE; } });
33
+ Object.defineProperty(exports, "NODE_TYPE_TO_PREFIX", { enumerable: true, get: function () { return registry_1.NODE_TYPE_TO_PREFIX; } });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Centralized NODE_REGISTRY — single source of truth for all node metadata.
3
+ *
4
+ * When adding a new node type, add ONE entry here. The dashboard derives
5
+ * all per-node maps (colors, URLs, Redux keys, palette, delete, etc.)
6
+ * from this registry. No more 18+ touch points.
7
+ */
8
+ import type { NodeType } from './types';
9
+ export type NodeGroup = 'Sources' | 'Flow Control' | 'Actions' | 'Monitoring' | 'Annotations';
10
+ export interface NodeRegistryEntry {
11
+ /** Canonical type (e.g., "httpAction") */
12
+ type: NodeType;
13
+ /** Canvas ID prefix (e.g., "ha") */
14
+ prefix: string;
15
+ /** Display label (e.g., "HTTP Action") */
16
+ label: string;
17
+ /** Group in palette */
18
+ group: NodeGroup;
19
+ /** Detail page path (e.g., "/dashboard/http-actions") */
20
+ detailPath: string;
21
+ /** API endpoint base (e.g., "/http-actions") */
22
+ apiPath: string;
23
+ /** Redux state key for filtered array (e.g., "httpActions") */
24
+ stateKey: string;
25
+ /** Redux state key for all array (e.g., "allHttpActions") */
26
+ allStateKey: string;
27
+ /** MiniMap hex color */
28
+ color: string;
29
+ /** Whether this node supports test execution */
30
+ testable: boolean;
31
+ }
32
+ export declare const NODE_REGISTRY: Record<NodeType, NodeRegistryEntry>;
33
+ /** Get registry entry by canonical type */
34
+ export declare function getNodeRegistryEntry(type: string): NodeRegistryEntry | undefined;
35
+ /** type → detail page path */
36
+ export declare const NODE_DETAIL_PATHS: Record<string, string>;
37
+ /** type → minimap color */
38
+ export declare const NODE_COLORS: Record<string, string>;
39
+ /** type → [stateKey, allStateKey] */
40
+ export declare const NODE_STATE_KEYS: Record<string, [string, string]>;
41
+ /** prefix → type */
42
+ export declare const PREFIX_TO_NODE_TYPE: Record<string, NodeType>;
43
+ /** type → prefix */
44
+ export declare const NODE_TYPE_TO_PREFIX: Record<string, string>;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ /**
3
+ * Centralized NODE_REGISTRY — single source of truth for all node metadata.
4
+ *
5
+ * When adding a new node type, add ONE entry here. The dashboard derives
6
+ * all per-node maps (colors, URLs, Redux keys, palette, delete, etc.)
7
+ * from this registry. No more 18+ touch points.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NODE_TYPE_TO_PREFIX = exports.PREFIX_TO_NODE_TYPE = exports.NODE_STATE_KEYS = exports.NODE_COLORS = exports.NODE_DETAIL_PATHS = exports.NODE_REGISTRY = void 0;
11
+ exports.getNodeRegistryEntry = getNodeRegistryEntry;
12
+ exports.NODE_REGISTRY = {
13
+ // ── Sources ──
14
+ endpoint: {
15
+ type: 'endpoint', prefix: 'ep', label: 'Endpoint',
16
+ group: 'Sources', detailPath: '/dashboard/endpoints', apiPath: '/endpoints',
17
+ stateKey: 'endpoints', allStateKey: 'allEndpoints',
18
+ color: '#a78bfa', testable: false,
19
+ },
20
+ scheduledWebhook: {
21
+ type: 'scheduledWebhook', prefix: 'sw', label: 'Scheduled Webhook',
22
+ group: 'Sources', detailPath: '/dashboard/scheduled-webhooks', apiPath: '/scheduled-webhooks',
23
+ stateKey: 'scheduledWebhooks', allStateKey: 'allScheduledWebhooks',
24
+ color: '#2dd4bf', testable: true,
25
+ },
26
+ // ── Flow Control ──
27
+ filter: {
28
+ type: 'filter', prefix: 'fi', label: 'Filter',
29
+ group: 'Flow Control', detailPath: '/dashboard/filter-nodes', apiPath: '/filter-nodes',
30
+ stateKey: 'filterNodes', allStateKey: 'allFilterNodes',
31
+ color: '#facc15', testable: true,
32
+ },
33
+ transform: {
34
+ type: 'transform', prefix: 'tr', label: 'Transform',
35
+ group: 'Flow Control', detailPath: '/dashboard/transform-nodes', apiPath: '/transform-nodes',
36
+ stateKey: 'transformNodes', allStateKey: 'allTransformNodes',
37
+ color: '#fbbf24', testable: true,
38
+ },
39
+ schemaValidator: {
40
+ type: 'schemaValidator', prefix: 'sv', label: 'Schema Validator',
41
+ group: 'Flow Control', detailPath: '/dashboard/schema-validators', apiPath: '/schema-validators',
42
+ stateKey: 'schemaValidators', allStateKey: 'allSchemaValidators',
43
+ color: '#818cf8', testable: false,
44
+ },
45
+ conditional: {
46
+ type: 'conditional', prefix: 'cond', label: 'Conditional',
47
+ group: 'Flow Control', detailPath: '/dashboard/conditional-nodes', apiPath: '/conditional-nodes',
48
+ stateKey: 'conditionalNodes', allStateKey: 'allConditionalNodes',
49
+ color: '#c084fc', testable: false,
50
+ },
51
+ delay: {
52
+ type: 'delay', prefix: 'delay', label: 'Delay',
53
+ group: 'Flow Control', detailPath: '/dashboard/delay-nodes', apiPath: '/delay-nodes',
54
+ stateKey: 'delayNodes', allStateKey: 'allDelayNodes',
55
+ color: '#94a3b8', testable: false,
56
+ },
57
+ rateLimiter: {
58
+ type: 'rateLimiter', prefix: 'rl', label: 'Rate Limiter',
59
+ group: 'Flow Control', detailPath: '/dashboard/rate-limiter-nodes', apiPath: '/rate-limiter-nodes',
60
+ stateKey: 'rateLimiterNodes', allStateKey: 'allRateLimiterNodes',
61
+ color: '#f97316', testable: false,
62
+ },
63
+ aggregator: {
64
+ type: 'aggregator', prefix: 'agg', label: 'Aggregator',
65
+ group: 'Flow Control', detailPath: '/dashboard/aggregator-nodes', apiPath: '/aggregator-nodes',
66
+ stateKey: 'aggregatorNodes', allStateKey: 'allAggregatorNodes',
67
+ color: '#84cc16', testable: true,
68
+ },
69
+ cache: {
70
+ type: 'cache', prefix: 'cache', label: 'Cache',
71
+ group: 'Flow Control', detailPath: '/dashboard/cache-nodes', apiPath: '/cache-nodes',
72
+ stateKey: 'cacheNodes', allStateKey: 'allCacheNodes',
73
+ color: '#d946ef', testable: false,
74
+ },
75
+ code: {
76
+ type: 'code', prefix: 'code', label: 'Code',
77
+ group: 'Flow Control', detailPath: '/dashboard/code-nodes', apiPath: '/code-nodes',
78
+ stateKey: 'codeNodes', allStateKey: 'allCodeNodes',
79
+ color: '#a855f7', testable: true,
80
+ },
81
+ ai: {
82
+ type: 'ai', prefix: 'ai', label: 'AI',
83
+ group: 'Flow Control', detailPath: '/dashboard/ai-nodes', apiPath: '/ai-nodes',
84
+ stateKey: 'aiNodes', allStateKey: 'allAiNodes',
85
+ color: '#d946ef', testable: false,
86
+ },
87
+ merge: {
88
+ type: 'merge', prefix: 'merge', label: 'Merge',
89
+ group: 'Flow Control', detailPath: '/dashboard/merge-nodes', apiPath: '/merge-nodes',
90
+ stateKey: 'mergeNodes', allStateKey: 'allMergeNodes',
91
+ color: '#94a3b8', testable: false,
92
+ },
93
+ approval: {
94
+ type: 'approval', prefix: 'appr', label: 'Approval',
95
+ group: 'Flow Control', detailPath: '/dashboard/approval-nodes', apiPath: '/approval-nodes',
96
+ stateKey: 'approvalNodes', allStateKey: 'allApprovalNodes',
97
+ color: '#94a3b8', testable: false,
98
+ },
99
+ // ── Routing ──
100
+ router: {
101
+ type: 'router', prefix: 'ro', label: 'Router',
102
+ group: 'Flow Control', detailPath: '/dashboard/routers', apiPath: '/routers',
103
+ stateKey: 'routers', allStateKey: 'allRouters',
104
+ color: '#38bdf8', testable: false,
105
+ },
106
+ fanout: {
107
+ type: 'fanout', prefix: 'fo', label: 'Fan-out',
108
+ group: 'Sources', detailPath: '/dashboard/fan-out', apiPath: '/fan-out',
109
+ stateKey: 'fanOuts', allStateKey: 'allFanOuts',
110
+ color: '#a78bfa', testable: false,
111
+ },
112
+ // ── Actions ──
113
+ emailAction: {
114
+ type: 'emailAction', prefix: 'ea', label: 'Email Action',
115
+ group: 'Actions', detailPath: '/dashboard/email-actions', apiPath: '/email-actions',
116
+ stateKey: 'emailActions', allStateKey: 'allEmailActions',
117
+ color: '#f472b6', testable: true,
118
+ },
119
+ httpAction: {
120
+ type: 'httpAction', prefix: 'ha', label: 'HTTP Action',
121
+ group: 'Actions', detailPath: '/dashboard/http-actions', apiPath: '/http-actions',
122
+ stateKey: 'httpActions', allStateKey: 'allHttpActions',
123
+ color: '#3b82f6', testable: true,
124
+ },
125
+ mongoAction: {
126
+ type: 'mongoAction', prefix: 'ma', label: 'MongoDB Action',
127
+ group: 'Actions', detailPath: '/dashboard/mongo-actions', apiPath: '/mongo-actions',
128
+ stateKey: 'mongoActions', allStateKey: 'allMongoActions',
129
+ color: '#34d399', testable: false,
130
+ },
131
+ notificationAction: {
132
+ type: 'notificationAction', prefix: 'na', label: 'Notification',
133
+ group: 'Actions', detailPath: '/dashboard/notification-actions', apiPath: '/notification-actions',
134
+ stateKey: 'notificationActions', allStateKey: 'allNotificationActions',
135
+ color: '#f472b6', testable: false,
136
+ },
137
+ sheetsAction: {
138
+ type: 'sheetsAction', prefix: 'sheet', label: 'Google Sheets Action',
139
+ group: 'Actions', detailPath: '/dashboard/sheets-actions', apiPath: '/sheets-actions',
140
+ stateKey: 'sheetsActions', allStateKey: 'allSheetsActions',
141
+ color: '#34d399', testable: true,
142
+ },
143
+ // ── Monitoring ──
144
+ alert: {
145
+ type: 'alert', prefix: 'al', label: 'Alert',
146
+ group: 'Monitoring', detailPath: '/dashboard/alerts', apiPath: '/alerts',
147
+ stateKey: 'alerts', allStateKey: 'allAlerts',
148
+ color: '#ef4444', testable: false,
149
+ },
150
+ // ── Annotations ──
151
+ stickyNote: {
152
+ type: 'stickyNote', prefix: 'note', label: 'Sticky Note',
153
+ group: 'Annotations', detailPath: '', apiPath: '/sticky-notes',
154
+ stateKey: 'stickyNotes', allStateKey: 'allStickyNotes',
155
+ color: '#fbbf24', testable: false,
156
+ },
157
+ };
158
+ // ── Derived helpers ──
159
+ /** Get registry entry by canonical type */
160
+ function getNodeRegistryEntry(type) {
161
+ return exports.NODE_REGISTRY[type];
162
+ }
163
+ /** type → detail page path */
164
+ exports.NODE_DETAIL_PATHS = Object.fromEntries(Object.values(exports.NODE_REGISTRY).filter(n => n.detailPath).map(n => [n.type, n.detailPath]));
165
+ /** type → minimap color */
166
+ exports.NODE_COLORS = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.type, n.color]));
167
+ /** type → [stateKey, allStateKey] */
168
+ exports.NODE_STATE_KEYS = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.type, [n.stateKey, n.allStateKey]]));
169
+ /** prefix → type */
170
+ exports.PREFIX_TO_NODE_TYPE = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.prefix, n.type]));
171
+ /** type → prefix */
172
+ exports.NODE_TYPE_TO_PREFIX = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.type, n.prefix]));
package/dist/types.d.ts CHANGED
@@ -55,4 +55,6 @@ export declare function iterableMeta(field: string, count: number): PayloadMeta;
55
55
  export interface PrefixMapping {
56
56
  prefix: string;
57
57
  type: NodeType;
58
+ /** Canvas node type used in React Flow nodeTypes map (e.g. "cache-node", "email-action") */
59
+ canvasType: string;
58
60
  }
package/dist/ui.js CHANGED
@@ -40,29 +40,29 @@ exports.NODE_UI = {
40
40
  };
41
41
  /** Canvas prefix → node type mapping (used by FlowCanvas to identify node type from XYFlow node ID) */
42
42
  exports.PREFIX_TO_TYPE = [
43
- { prefix: 'ep-', type: 'endpoint' },
44
- { prefix: 'sw-', type: 'scheduledWebhook' },
45
- { prefix: 'fo-', type: 'fanout' },
46
- { prefix: 'al-', type: 'alert' },
47
- { prefix: 'ea-', type: 'emailAction' },
48
- { prefix: 'ha-', type: 'httpAction' },
49
- { prefix: 'ma-', type: 'mongoAction' },
50
- { prefix: 'na-', type: 'notificationAction' },
51
- { prefix: 'ro-', type: 'router' },
52
- { prefix: 'fi-', type: 'filter' },
53
- { prefix: 'tr-', type: 'transform' },
54
- { prefix: 'sv-', type: 'schemaValidator' },
55
- { prefix: 'delay-', type: 'delay' },
56
- { prefix: 'sheet-', type: 'sheetsAction' },
57
- { prefix: 'appr-', type: 'approval' },
58
- { prefix: 'merge-', type: 'merge' },
59
- { prefix: 'cond-', type: 'conditional' },
60
- { prefix: 'rl-', type: 'rateLimiter' },
61
- { prefix: 'agg-', type: 'aggregator' },
62
- { prefix: 'cache-', type: 'cache' },
63
- { prefix: 'code-', type: 'code' },
64
- { prefix: 'ai-', type: 'ai' },
65
- { prefix: 'note-', type: 'stickyNote' },
43
+ { prefix: 'ep-', type: 'endpoint', canvasType: 'endpoint' },
44
+ { prefix: 'sw-', type: 'scheduledWebhook', canvasType: 'scheduled-webhook' },
45
+ { prefix: 'fo-', type: 'fanout', canvasType: 'fanout' },
46
+ { prefix: 'al-', type: 'alert', canvasType: 'alert' },
47
+ { prefix: 'ea-', type: 'emailAction', canvasType: 'email-action' },
48
+ { prefix: 'ha-', type: 'httpAction', canvasType: 'http-action' },
49
+ { prefix: 'ma-', type: 'mongoAction', canvasType: 'mongo-action' },
50
+ { prefix: 'na-', type: 'notificationAction', canvasType: 'notification-action' },
51
+ { prefix: 'ro-', type: 'router', canvasType: 'router' },
52
+ { prefix: 'fi-', type: 'filter', canvasType: 'filter-node' },
53
+ { prefix: 'tr-', type: 'transform', canvasType: 'transform-node' },
54
+ { prefix: 'sv-', type: 'schemaValidator', canvasType: 'schema-validator' },
55
+ { prefix: 'delay-', type: 'delay', canvasType: 'delay-node' },
56
+ { prefix: 'sheet-', type: 'sheetsAction', canvasType: 'sheets-action' },
57
+ { prefix: 'appr-', type: 'approval', canvasType: 'approval-node' },
58
+ { prefix: 'merge-', type: 'merge', canvasType: 'merge-node' },
59
+ { prefix: 'cond-', type: 'conditional', canvasType: 'conditional-node' },
60
+ { prefix: 'rl-', type: 'rateLimiter', canvasType: 'rate-limiter-node' },
61
+ { prefix: 'agg-', type: 'aggregator', canvasType: 'aggregator-node' },
62
+ { prefix: 'cache-', type: 'cache', canvasType: 'cache-node' },
63
+ { prefix: 'code-', type: 'code', canvasType: 'code-node' },
64
+ { prefix: 'ai-', type: 'ai', canvasType: 'ai-node' },
65
+ { prefix: 'note-', type: 'stickyNote', canvasType: 'sticky-note' },
66
66
  ];
67
67
  /** Resolve canvas node ID to { type, entityId } */
68
68
  function resolveNodeId(canvasId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostwebhook/node-types",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Shared node type definitions, connection rules, and dispatch config for HostWebhook",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",