@hostwebhook/node-types 1.0.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/connections.d.ts +17 -0
- package/dist/connections.js +78 -0
- package/dist/dispatch.d.ts +10 -0
- package/dist/dispatch.js +45 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.js +2 -0
- package/dist/ui.d.ts +13 -0
- package/dist/ui.js +72 -0
- package/package.json +17 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Connection Registry — THE single source of truth for what each node
|
|
3
|
+
* type can receive from and send to.
|
|
4
|
+
*
|
|
5
|
+
* Used by: API (pipeline dispatch), Broker (agent wiring), Dashboard (canvas validation)
|
|
6
|
+
*
|
|
7
|
+
* Adding a new node type = add 1 entry here. All repos import from this package.
|
|
8
|
+
*/
|
|
9
|
+
import type { NodeType, NodeConnectionConfig } from './types';
|
|
10
|
+
export declare const NODE_CONNECTIONS: Record<NodeType, NodeConnectionConfig>;
|
|
11
|
+
export declare function canReceiveFrom(targetType: NodeType, sourceType: NodeType): boolean;
|
|
12
|
+
export declare function canReceiveFromNodes(nodeType: NodeType): boolean;
|
|
13
|
+
export declare function canSendToNodes(nodeType: NodeType): boolean;
|
|
14
|
+
export declare function isTerminal(nodeType: NodeType): boolean;
|
|
15
|
+
export declare function isNodeType(type: string): type is NodeType;
|
|
16
|
+
/** All valid node type strings */
|
|
17
|
+
export declare const ALL_NODE_TYPES: NodeType[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node Connection Registry — THE single source of truth for what each node
|
|
4
|
+
* type can receive from and send to.
|
|
5
|
+
*
|
|
6
|
+
* Used by: API (pipeline dispatch), Broker (agent wiring), Dashboard (canvas validation)
|
|
7
|
+
*
|
|
8
|
+
* Adding a new node type = add 1 entry here. All repos import from this package.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ALL_NODE_TYPES = exports.NODE_CONNECTIONS = void 0;
|
|
12
|
+
exports.canReceiveFrom = canReceiveFrom;
|
|
13
|
+
exports.canReceiveFromNodes = canReceiveFromNodes;
|
|
14
|
+
exports.canSendToNodes = canSendToNodes;
|
|
15
|
+
exports.isTerminal = isTerminal;
|
|
16
|
+
exports.isNodeType = isNodeType;
|
|
17
|
+
/** All node types that can appear as pipeline outputs */
|
|
18
|
+
const PROCESSING_OUTPUTS = [
|
|
19
|
+
'endpoint', 'router', 'filter', 'transform', 'cache', 'rateLimiter',
|
|
20
|
+
'aggregator', 'conditional', 'delay', 'schemaValidator',
|
|
21
|
+
'emailAction', 'httpAction', 'mongoAction', 'notificationAction', 'sheetsAction',
|
|
22
|
+
];
|
|
23
|
+
/** Standard processing input sources */
|
|
24
|
+
const STANDARD_INPUTS = [
|
|
25
|
+
'endpoint', 'scheduledWebhook', 'router', 'filter', 'transform',
|
|
26
|
+
'cache', 'rateLimiter', 'aggregator', 'conditional', 'delay', 'schemaValidator',
|
|
27
|
+
];
|
|
28
|
+
/** Action nodes that can chain (non-terminal) */
|
|
29
|
+
const CHAINABLE_ACTIONS = ['httpAction', 'mongoAction', 'sheetsAction'];
|
|
30
|
+
/** Full input list for action nodes (standard + chainable actions) */
|
|
31
|
+
const ACTION_INPUTS = [...STANDARD_INPUTS, ...CHAINABLE_ACTIONS];
|
|
32
|
+
exports.NODE_CONNECTIONS = {
|
|
33
|
+
// ── Source nodes ──
|
|
34
|
+
endpoint: { acceptsInputFrom: [], canOutputTo: PROCESSING_OUTPUTS },
|
|
35
|
+
scheduledWebhook: { acceptsInputFrom: [], canOutputTo: PROCESSING_OUTPUTS },
|
|
36
|
+
// ── Pipeline processing nodes ──
|
|
37
|
+
filter: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
38
|
+
transform: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
39
|
+
schemaValidator: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
40
|
+
conditional: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS, special: { hasBranches: true } },
|
|
41
|
+
delay: { acceptsInputFrom: ['endpoint', 'filter', 'transform', 'cache', 'rateLimiter', 'aggregator', 'conditional', 'delay', 'schemaValidator'], canOutputTo: PROCESSING_OUTPUTS },
|
|
42
|
+
rateLimiter: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
43
|
+
aggregator: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
44
|
+
cache: { acceptsInputFrom: STANDARD_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
45
|
+
ai: { acceptsInputFrom: [...ACTION_INPUTS], canOutputTo: PROCESSING_OUTPUTS },
|
|
46
|
+
// ── Flow control nodes ──
|
|
47
|
+
merge: { acceptsInputFrom: ['endpoint', 'filter', 'transform', 'cache', 'rateLimiter', 'aggregator', 'conditional', 'delay', 'schemaValidator'], canOutputTo: PROCESSING_OUTPUTS },
|
|
48
|
+
approval: { acceptsInputFrom: ['endpoint', 'filter', 'transform'], canOutputTo: ['endpoint', 'filter', 'transform', 'emailAction', 'httpAction', 'mongoAction', 'notificationAction', 'sheetsAction'], special: { hasRejectionOutputNodes: true } },
|
|
49
|
+
// ── Routing nodes ──
|
|
50
|
+
router: { acceptsInputFrom: ['endpoint', 'scheduledWebhook', 'filter', 'transform'], canOutputTo: ['endpoint', 'notificationAction', 'filter', 'transform', 'emailAction', 'httpAction', 'mongoAction', 'sheetsAction'] },
|
|
51
|
+
fanout: { acceptsInputFrom: ['endpoint'], canOutputTo: [] },
|
|
52
|
+
// ── Action nodes ──
|
|
53
|
+
emailAction: { acceptsInputFrom: ACTION_INPUTS, canOutputTo: [], special: { isTerminal: true } },
|
|
54
|
+
httpAction: { acceptsInputFrom: ACTION_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
55
|
+
mongoAction: { acceptsInputFrom: ACTION_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
56
|
+
notificationAction: { acceptsInputFrom: ACTION_INPUTS, canOutputTo: [], special: { isTerminal: true } },
|
|
57
|
+
sheetsAction: { acceptsInputFrom: ACTION_INPUTS, canOutputTo: PROCESSING_OUTPUTS },
|
|
58
|
+
// ── Monitoring ──
|
|
59
|
+
alert: { acceptsInputFrom: ['endpoint', 'scheduledWebhook'], canOutputTo: [], special: { isTerminal: true } },
|
|
60
|
+
};
|
|
61
|
+
// ── Helper functions ──
|
|
62
|
+
function canReceiveFrom(targetType, sourceType) {
|
|
63
|
+
return exports.NODE_CONNECTIONS[targetType]?.acceptsInputFrom.includes(sourceType) ?? false;
|
|
64
|
+
}
|
|
65
|
+
function canReceiveFromNodes(nodeType) {
|
|
66
|
+
return (exports.NODE_CONNECTIONS[nodeType]?.acceptsInputFrom.length ?? 0) > 0;
|
|
67
|
+
}
|
|
68
|
+
function canSendToNodes(nodeType) {
|
|
69
|
+
return (exports.NODE_CONNECTIONS[nodeType]?.canOutputTo.length ?? 0) > 0;
|
|
70
|
+
}
|
|
71
|
+
function isTerminal(nodeType) {
|
|
72
|
+
return exports.NODE_CONNECTIONS[nodeType]?.special?.isTerminal ?? false;
|
|
73
|
+
}
|
|
74
|
+
function isNodeType(type) {
|
|
75
|
+
return type in exports.NODE_CONNECTIONS;
|
|
76
|
+
}
|
|
77
|
+
/** All valid node type strings */
|
|
78
|
+
exports.ALL_NODE_TYPES = Object.keys(exports.NODE_CONNECTIONS);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API dispatch config — service names, collection names, filter support.
|
|
3
|
+
* Only imported by the API. Broker and Dashboard don't need this.
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeType, NodeDispatchConfig } from './types';
|
|
6
|
+
export declare const NODE_DISPATCH: Record<NodeType, NodeDispatchConfig>;
|
|
7
|
+
/** Get all MongoDB collection names for cascade cleanup */
|
|
8
|
+
export declare function getAllNodeCollections(): string[];
|
|
9
|
+
/** Find dispatch config by node type */
|
|
10
|
+
export declare function getNodeDispatchConfig(type: string): NodeDispatchConfig | undefined;
|
package/dist/dispatch.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API dispatch config — service names, collection names, filter support.
|
|
4
|
+
* Only imported by the API. Broker and Dashboard don't need this.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.NODE_DISPATCH = void 0;
|
|
8
|
+
exports.getAllNodeCollections = getAllNodeCollections;
|
|
9
|
+
exports.getNodeDispatchConfig = getNodeDispatchConfig;
|
|
10
|
+
exports.NODE_DISPATCH = {
|
|
11
|
+
// ── Pipeline processing (generic dispatch) ──
|
|
12
|
+
filter: { service: 'filterNodesService', collection: 'filternodes', hasFilters: true, outputFields: ['outputNodes'], customDispatch: false },
|
|
13
|
+
transform: { service: 'transformNodesService', collection: 'transformnodes', hasFilters: false, outputFields: ['outputNodes'], customDispatch: false },
|
|
14
|
+
schemaValidator: { service: 'schemaValidatorsService', collection: 'schemavalidators', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
15
|
+
delay: { service: 'delayNodesService', collection: 'delaynodes', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
16
|
+
rateLimiter: { service: 'rateLimiterNodesService', collection: 'ratelimiternodes', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
17
|
+
aggregator: { service: 'aggregatorNodesService', collection: 'aggregatornodes', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
18
|
+
cache: { service: 'cacheNodesService', collection: 'cachenodes', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
19
|
+
ai: { service: 'aiNodesService', collection: 'ainodes', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
20
|
+
// ── Flow control ──
|
|
21
|
+
conditional: { service: 'conditionalNodesService', collection: 'conditionalnodes', hasFilters: false, outputFields: ['outputNodes', 'elseOutputNodes'], customDispatch: true },
|
|
22
|
+
merge: { service: 'mergeNodesService', collection: 'mergenodes', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
23
|
+
approval: { service: 'approvalNodesService', collection: 'approvalnodes', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
24
|
+
// ── Routing ──
|
|
25
|
+
router: { service: 'routersService', collection: 'routers', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
26
|
+
// ── Action nodes ──
|
|
27
|
+
emailAction: { service: 'emailActionsService', collection: 'emailactions', hasFilters: true, outputFields: [], customDispatch: true },
|
|
28
|
+
httpAction: { service: 'httpActionsService', collection: 'httpactions', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
29
|
+
mongoAction: { service: 'mongoActionsService', collection: 'mongoactions', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
30
|
+
notificationAction: { service: 'notificationActionsService', collection: 'notificationactions', hasFilters: true, outputFields: [], customDispatch: true },
|
|
31
|
+
sheetsAction: { service: 'sheetsActionsService', collection: 'sheetsactions', hasFilters: true, outputFields: ['outputNodes'], customDispatch: true },
|
|
32
|
+
// ── Source + monitoring ──
|
|
33
|
+
fanout: { service: 'fanOutService', collection: 'fanouts', hasFilters: true, outputFields: [], customDispatch: true },
|
|
34
|
+
alert: { service: 'alertService', collection: 'alerts', hasFilters: false, outputFields: [], customDispatch: true },
|
|
35
|
+
endpoint: { service: 'endpointsService', collection: 'endpoints', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
36
|
+
scheduledWebhook: { service: 'scheduledWebhooksService', collection: 'scheduledwebhooks', hasFilters: false, outputFields: ['outputNodes'], customDispatch: true },
|
|
37
|
+
};
|
|
38
|
+
/** Get all MongoDB collection names for cascade cleanup */
|
|
39
|
+
function getAllNodeCollections() {
|
|
40
|
+
return Object.values(exports.NODE_DISPATCH).map(n => n.collection);
|
|
41
|
+
}
|
|
42
|
+
/** Find dispatch config by node type */
|
|
43
|
+
function getNodeDispatchConfig(type) {
|
|
44
|
+
return exports.NODE_DISPATCH[type];
|
|
45
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { NodeType, NodeRole, HandlePosition, NodeConnectionConfig, NodeUIConfig, NodeDispatchConfig, PrefixMapping, } from './types';
|
|
2
|
+
export { NODE_CONNECTIONS, canReceiveFrom, canReceiveFromNodes, canSendToNodes, isTerminal, isNodeType, ALL_NODE_TYPES, } from './connections';
|
|
3
|
+
export { NODE_UI, PREFIX_TO_TYPE, resolveNodeId, } from './ui';
|
|
4
|
+
export { NODE_DISPATCH, getAllNodeCollections, getNodeDispatchConfig, } from './dispatch';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
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 = void 0;
|
|
4
|
+
// ── Connection rules (used by ALL repos) ──
|
|
5
|
+
var connections_1 = require("./connections");
|
|
6
|
+
Object.defineProperty(exports, "NODE_CONNECTIONS", { enumerable: true, get: function () { return connections_1.NODE_CONNECTIONS; } });
|
|
7
|
+
Object.defineProperty(exports, "canReceiveFrom", { enumerable: true, get: function () { return connections_1.canReceiveFrom; } });
|
|
8
|
+
Object.defineProperty(exports, "canReceiveFromNodes", { enumerable: true, get: function () { return connections_1.canReceiveFromNodes; } });
|
|
9
|
+
Object.defineProperty(exports, "canSendToNodes", { enumerable: true, get: function () { return connections_1.canSendToNodes; } });
|
|
10
|
+
Object.defineProperty(exports, "isTerminal", { enumerable: true, get: function () { return connections_1.isTerminal; } });
|
|
11
|
+
Object.defineProperty(exports, "isNodeType", { enumerable: true, get: function () { return connections_1.isNodeType; } });
|
|
12
|
+
Object.defineProperty(exports, "ALL_NODE_TYPES", { enumerable: true, get: function () { return connections_1.ALL_NODE_TYPES; } });
|
|
13
|
+
// ── UI config (Dashboard only) ──
|
|
14
|
+
var ui_1 = require("./ui");
|
|
15
|
+
Object.defineProperty(exports, "NODE_UI", { enumerable: true, get: function () { return ui_1.NODE_UI; } });
|
|
16
|
+
Object.defineProperty(exports, "PREFIX_TO_TYPE", { enumerable: true, get: function () { return ui_1.PREFIX_TO_TYPE; } });
|
|
17
|
+
Object.defineProperty(exports, "resolveNodeId", { enumerable: true, get: function () { return ui_1.resolveNodeId; } });
|
|
18
|
+
// ── Dispatch config (API only) ──
|
|
19
|
+
var dispatch_1 = require("./dispatch");
|
|
20
|
+
Object.defineProperty(exports, "NODE_DISPATCH", { enumerable: true, get: function () { return dispatch_1.NODE_DISPATCH; } });
|
|
21
|
+
Object.defineProperty(exports, "getAllNodeCollections", { enumerable: true, get: function () { return dispatch_1.getAllNodeCollections; } });
|
|
22
|
+
Object.defineProperty(exports, "getNodeDispatchConfig", { enumerable: true, get: function () { return dispatch_1.getNodeDispatchConfig; } });
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** All valid node type identifiers */
|
|
2
|
+
export type NodeType = 'endpoint' | 'scheduledWebhook' | 'filter' | 'transform' | 'schemaValidator' | 'conditional' | 'delay' | 'rateLimiter' | 'aggregator' | 'cache' | 'ai' | 'merge' | 'approval' | 'router' | 'fanout' | 'emailAction' | 'httpAction' | 'mongoAction' | 'notificationAction' | 'sheetsAction' | 'alert';
|
|
3
|
+
/** Node role in the pipeline */
|
|
4
|
+
export type NodeRole = 'source' | 'processing' | 'flowControl' | 'routing' | 'action' | 'monitoring';
|
|
5
|
+
/** Handle positions on the canvas node */
|
|
6
|
+
export type HandlePosition = 'left' | 'right' | 'top' | 'bottom';
|
|
7
|
+
/** Connection rules — which node types can connect to/from this node */
|
|
8
|
+
export interface NodeConnectionConfig {
|
|
9
|
+
acceptsInputFrom: NodeType[];
|
|
10
|
+
canOutputTo: NodeType[];
|
|
11
|
+
special?: {
|
|
12
|
+
hasRejectionOutputNodes?: boolean;
|
|
13
|
+
hasBranches?: boolean;
|
|
14
|
+
isTerminal?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** UI-specific config for the dashboard canvas */
|
|
18
|
+
export interface NodeUIConfig {
|
|
19
|
+
fromNodes: boolean;
|
|
20
|
+
toNodes: boolean;
|
|
21
|
+
isSource?: boolean;
|
|
22
|
+
inputHandles?: HandlePosition[];
|
|
23
|
+
outputHandles?: HandlePosition[];
|
|
24
|
+
dotHandles?: {
|
|
25
|
+
input?: string[];
|
|
26
|
+
output?: string[];
|
|
27
|
+
};
|
|
28
|
+
special?: {
|
|
29
|
+
rejectionEndpoints?: string;
|
|
30
|
+
hasBranches?: boolean;
|
|
31
|
+
isTerminal?: boolean;
|
|
32
|
+
connectModal?: 'branch' | 'rule';
|
|
33
|
+
routerTargetLabel?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** API dispatch config — how the event pipeline processes each node */
|
|
37
|
+
export interface NodeDispatchConfig {
|
|
38
|
+
service: string;
|
|
39
|
+
collection: string;
|
|
40
|
+
hasFilters: boolean;
|
|
41
|
+
outputFields: string[];
|
|
42
|
+
customDispatch: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Canvas prefix → node type mapping */
|
|
45
|
+
export interface PrefixMapping {
|
|
46
|
+
prefix: string;
|
|
47
|
+
type: NodeType;
|
|
48
|
+
}
|
package/dist/types.js
ADDED
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard UI config — handle positions, dot visibility, canvas prefixes.
|
|
3
|
+
* Only imported by the Dashboard. Broker and API don't need this.
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeType, NodeUIConfig, PrefixMapping } from './types';
|
|
6
|
+
export declare const NODE_UI: Record<NodeType, NodeUIConfig>;
|
|
7
|
+
/** Canvas prefix → node type mapping (used by FlowCanvas to identify node type from XYFlow node ID) */
|
|
8
|
+
export declare const PREFIX_TO_TYPE: PrefixMapping[];
|
|
9
|
+
/** Resolve canvas node ID to { type, entityId } */
|
|
10
|
+
export declare function resolveNodeId(canvasId: string): {
|
|
11
|
+
type: NodeType;
|
|
12
|
+
entityId: string;
|
|
13
|
+
} | null;
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dashboard UI config — handle positions, dot visibility, canvas prefixes.
|
|
4
|
+
* Only imported by the Dashboard. Broker and API don't need this.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PREFIX_TO_TYPE = exports.NODE_UI = void 0;
|
|
8
|
+
exports.resolveNodeId = resolveNodeId;
|
|
9
|
+
exports.NODE_UI = {
|
|
10
|
+
// ── Source nodes ──
|
|
11
|
+
endpoint: { fromNodes: true, toNodes: true, isSource: true, inputHandles: ['left', 'top'], outputHandles: ['right', 'bottom'] },
|
|
12
|
+
scheduledWebhook: { fromNodes: false, toNodes: true, isSource: true, outputHandles: ['right', 'bottom'], dotHandles: { output: ['right-out', 'bottom-out'] } },
|
|
13
|
+
// ── Pipeline processing nodes ──
|
|
14
|
+
filter: { fromNodes: true, toNodes: true },
|
|
15
|
+
transform: { fromNodes: true, toNodes: true },
|
|
16
|
+
schemaValidator: { fromNodes: true, toNodes: true },
|
|
17
|
+
conditional: { fromNodes: true, toNodes: true, outputHandles: ['right', 'bottom'], special: { hasBranches: true, connectModal: 'branch' } },
|
|
18
|
+
delay: { fromNodes: true, toNodes: true },
|
|
19
|
+
rateLimiter: { fromNodes: true, toNodes: true },
|
|
20
|
+
aggregator: { fromNodes: true, toNodes: true },
|
|
21
|
+
cache: { fromNodes: true, toNodes: true },
|
|
22
|
+
ai: { fromNodes: true, toNodes: true },
|
|
23
|
+
// ── Flow control nodes ──
|
|
24
|
+
merge: { fromNodes: true, toNodes: true, inputHandles: ['left', 'top'] },
|
|
25
|
+
approval: { fromNodes: true, toNodes: true, outputHandles: ['right', 'bottom'], special: { rejectionEndpoints: 'rejectionEndpointIds' } },
|
|
26
|
+
// ── Routing nodes ──
|
|
27
|
+
router: { fromNodes: true, toNodes: true, outputHandles: ['right', 'bottom'], dotHandles: { output: ['right-out', 'bottom-out'] }, special: { connectModal: 'rule' } },
|
|
28
|
+
fanout: { fromNodes: true, toNodes: false },
|
|
29
|
+
// ── Action nodes ──
|
|
30
|
+
emailAction: { fromNodes: true, toNodes: false, inputHandles: ['left', 'top'], dotHandles: { input: ['left-in', 'top-in'] }, special: { isTerminal: true, routerTargetLabel: 'email' } },
|
|
31
|
+
httpAction: { fromNodes: true, toNodes: true, inputHandles: ['left', 'top'], dotHandles: { input: ['left-in', 'top-in'], output: ['right-out', 'bottom-out'] } },
|
|
32
|
+
mongoAction: { fromNodes: true, toNodes: true, inputHandles: ['left', 'top'], dotHandles: { input: ['left-in', 'top-in'], output: ['right-out', 'bottom-out'] } },
|
|
33
|
+
notificationAction: { fromNodes: true, toNodes: false, inputHandles: ['left', 'top'], dotHandles: { input: ['left-in', 'top-in'] }, special: { isTerminal: true, routerTargetLabel: 'notification' } },
|
|
34
|
+
sheetsAction: { fromNodes: true, toNodes: true, inputHandles: ['left', 'top'], dotHandles: { input: ['left-in', 'top-in'], output: ['right-out', 'bottom-out'] } },
|
|
35
|
+
// ── Monitoring ──
|
|
36
|
+
alert: { fromNodes: true, toNodes: false, inputHandles: ['bottom'], special: { isTerminal: true } },
|
|
37
|
+
};
|
|
38
|
+
/** Canvas prefix → node type mapping (used by FlowCanvas to identify node type from XYFlow node ID) */
|
|
39
|
+
exports.PREFIX_TO_TYPE = [
|
|
40
|
+
{ prefix: 'ep-', type: 'endpoint' },
|
|
41
|
+
{ prefix: 'sw-', type: 'scheduledWebhook' },
|
|
42
|
+
{ prefix: 'fo-', type: 'fanout' },
|
|
43
|
+
{ prefix: 'al-', type: 'alert' },
|
|
44
|
+
{ prefix: 'ea-', type: 'emailAction' },
|
|
45
|
+
{ prefix: 'ha-', type: 'httpAction' },
|
|
46
|
+
{ prefix: 'ma-', type: 'mongoAction' },
|
|
47
|
+
{ prefix: 'na-', type: 'notificationAction' },
|
|
48
|
+
{ prefix: 'ro-', type: 'router' },
|
|
49
|
+
{ prefix: 'fi-', type: 'filter' },
|
|
50
|
+
{ prefix: 'tr-', type: 'transform' },
|
|
51
|
+
{ prefix: 'sv-', type: 'schemaValidator' },
|
|
52
|
+
{ prefix: 'delay-', type: 'delay' },
|
|
53
|
+
{ prefix: 'sheet-', type: 'sheetsAction' },
|
|
54
|
+
{ prefix: 'appr-', type: 'approval' },
|
|
55
|
+
{ prefix: 'merge-', type: 'merge' },
|
|
56
|
+
{ prefix: 'cond-', type: 'conditional' },
|
|
57
|
+
{ prefix: 'rl-', type: 'rateLimiter' },
|
|
58
|
+
{ prefix: 'agg-', type: 'aggregator' },
|
|
59
|
+
{ prefix: 'cache-', type: 'cache' },
|
|
60
|
+
{ prefix: 'ai-', type: 'ai' },
|
|
61
|
+
];
|
|
62
|
+
/** Resolve canvas node ID to { type, entityId } */
|
|
63
|
+
function resolveNodeId(canvasId) {
|
|
64
|
+
// Sort by prefix length descending so longer prefixes match first
|
|
65
|
+
const sorted = [...exports.PREFIX_TO_TYPE].sort((a, b) => b.prefix.length - a.prefix.length);
|
|
66
|
+
for (const { prefix, type } of sorted) {
|
|
67
|
+
if (canvasId.startsWith(prefix)) {
|
|
68
|
+
return { type, entityId: canvasId.slice(prefix.length) };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hostwebhook/node-types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared node type definitions, connection rules, and dispatch config for HostWebhook",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["hostwebhook", "nodes", "registry"],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.0.0"
|
|
16
|
+
}
|
|
17
|
+
}
|