feat(n8n-webhook): expand action bus starter workflow

This commit is contained in:
zap
2026-03-12 17:22:58 +00:00
parent 2757527957
commit 9dcc477a98
13 changed files with 386 additions and 97 deletions

View File

@@ -21,6 +21,38 @@ EXPECTED_TYPES = {
'Respond to Webhook': 'n8n-nodes-base.respondToWebhook',
}
SAMPLE_FILES = [
'test-append-log.json',
'test-notify.json',
'test-send-email-draft.json',
'test-create-calendar-event.json',
'test-fetch-and-normalize-url.json',
'test-approval-queue-list.json',
'test-inbound-event-filter.json',
]
ROUTER_SNIPPETS = [
'append_log',
'get_logs',
'notify',
'send_email_draft',
'create_calendar_event',
'approval_queue_add',
'approval_queue_list',
'approval_queue_resolve',
'fetch_and_normalize_url',
'inbound_event_filter',
'unknown_action',
'invalid_request',
'$getWorkflowStaticData',
'approvalQueue',
'approvalHistory',
'inboundEvents',
'eventDedup',
'notify_text',
'fetch(',
]
def fail(msg: str):
print(f'ERROR: {msg}', file=sys.stderr)
@@ -72,7 +104,7 @@ def main():
router = by_name['route-action'].get('parameters', {})
js_code = router.get('jsCode', '')
for snippet in ('append_log', 'get_logs', 'notify', 'unknown_action', 'invalid_request', '$getWorkflowStaticData', 'actionLog', 'retained_entries', 'notify_text', 'entries.length', 'Math.min(50'):
for snippet in ROUTER_SNIPPETS:
if snippet not in js_code:
fail(f'route-action jsCode missing expected snippet: {snippet!r}')
@@ -94,7 +126,8 @@ def main():
if responder.get('respondWith') != 'json':
fail('Respond to Webhook must respondWith json')
for sample in (path.parent / 'test-append-log.json', path.parent / 'test-notify.json'):
for sample_name in SAMPLE_FILES:
sample = path.parent / sample_name
sample_data = load_json(sample)
if not isinstance(sample_data, dict) or 'action' not in sample_data or 'args' not in sample_data:
fail(f'sample payload missing action/args: {sample}')
@@ -102,8 +135,8 @@ def main():
print('OK: workflow asset structure looks consistent')
print(f'- workflow: {path}')
print(f'- nodes: {len(nodes)}')
print('- routes: append_log + get_logs via workflow static data, notify via Telegram + Discord, fallback -> JSON error')
print('- samples: test-append-log.json, test-notify.json')
print('- routes: notify via Telegram + Discord; queue/log/fetch/filter handled in route-action code')
print('- samples: ' + ', '.join(SAMPLE_FILES))
if __name__ == '__main__':