Files
jerapah-flow/packages/shared/src/workflow-path.js
T
nsrbandCursor 368a2ca365 feat(shared): extract client/server pure helpers into @jerapah-flow/shared
Share profile merge, workflow filename/path helpers, HTTP_METHODS (with OPTIONS), and isPlainObject so web and server stop drifting. Core script sandboxes keep local isPlainObject copies.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 06:01:42 +07:00

14 lines
533 B
JavaScript

export const HTTP_METHODS = ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
export function namespacedPath(owner, triggerPath) {
const cleaned = String(triggerPath ?? "").replace(/^\/+/, "").trim();
return `/u/${owner}/${cleaned}`;
}
export function hasWorkflowTrigger(workflow) {
if (!workflow || typeof workflow !== "object") return false;
const triggers = workflow.triggers;
if (!Array.isArray(triggers)) return false;
return triggers.some((t) => String(t?.type ?? "").toLowerCase() === "workflow");
}