chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:39:12 +08:00
commit d8dcd5f6d1
8604 changed files with 2479390 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* Welcome Banner Plugin — PoC demonstrating the OmniRoute plugin system.
*
* Adds a banner message to request metadata on every request.
* Logs a delivery confirmation on every response.
*
* @module welcome-banner
*/
/**
* onRequest hook — injects banner text into request metadata.
*
* @param {object} ctx - Plugin context
* @param {object} [ctx.config] - Plugin configuration
* @param {object} [ctx.metadata] - Request metadata (mutable)
*/
export function onRequest(ctx) {
const config = ctx?.config || {};
const enabled = config.enabled !== false; // default true
if (!enabled) return;
const bannerText = config.bannerText || "Welcome to OmniRoute!";
if (ctx.metadata) {
ctx.metadata.banner = bannerText;
}
}
/**
* onResponse hook — fire-and-forget banner delivery log.
*
* @param {object} ctx - Plugin context
* @param {object} response - Upstream response
*/
export function onResponse() {
// No-op — banner is request-side only
}
@@ -0,0 +1,29 @@
{
"name": "welcome-banner",
"version": "1.0.0",
"description": "Adds a welcome banner to API responses",
"author": "OmniRoute",
"license": "MIT",
"main": "index.mjs",
"source": "local",
"tags": ["demo", "banner"],
"hooks": {
"onRequest": true,
"onResponse": true,
"onError": false
},
"permissions": [],
"enabledByDefault": true,
"configSchema": {
"bannerText": {
"type": "string",
"default": "Welcome to OmniRoute!",
"description": "Banner message to display"
},
"enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the banner"
}
}
}