@notmrabhi/flowforge 0.1.35 → 0.1.37

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.
@@ -1,44 +1,87 @@
1
- class l {
1
+ class o {
2
2
  constructor() {
3
3
  this.templates = /* @__PURE__ */ new Map();
4
4
  }
5
- register(e) {
5
+ /**
6
+ * Register a template. Normalises `allowedTasks` (the backend's name) →
7
+ * `availableTasks` (FlowForge's canonical name) so consumers can pass
8
+ * either without rewriting.
9
+ */
10
+ register(t) {
11
+ const e = {
12
+ ...t,
13
+ availableTasks: t.availableTasks ?? t.allowedTasks
14
+ };
6
15
  return this.templates.set(e.triggerKey, e), this;
7
16
  }
8
- lookup(e) {
9
- return this.templates.get(e);
17
+ /**
18
+ * Register a list of templates fetched from `GET /api/v1/workflow-template`.
19
+ *
20
+ * The API shape is:
21
+ * {
22
+ * key, name, description, allowedTasks, allowedSources,
23
+ * configuration, // runtime BPMN — ignored by the canvas
24
+ * templateUI: { // ← UI bag, spread onto the template
25
+ * triggerCategory, icon, tags, category, author, popularity,
26
+ * source, product, taskLabels, maxTasks, skeletonState, …
27
+ * }
28
+ * }
29
+ *
30
+ * Anything in `templateUI` overrides the top-level shorthand where there's
31
+ * an overlap. Bad rows (missing `key`) are skipped with a DEV warning
32
+ * rather than throwing, so one broken template doesn't blank the picker.
33
+ *
34
+ * Returns `this` for chaining and the count of templates registered.
35
+ */
36
+ registerFromApi(t) {
37
+ for (const e of t ?? [])
38
+ e != null && e.key && this.register({
39
+ triggerKey: e.key,
40
+ label: e.name ?? e.key,
41
+ description: e.description,
42
+ availableTasks: e.allowedTasks,
43
+ ...e.templateUI ?? {}
44
+ });
45
+ return this;
46
+ }
47
+ lookup(t) {
48
+ return this.templates.get(t);
10
49
  }
11
50
  list() {
12
51
  return [...this.templates.values()];
13
52
  }
14
- listByCategory(e) {
15
- return this.list().filter((t) => t.category === e);
53
+ listByCategory(t) {
54
+ return this.list().filter((e) => e.category === t);
16
55
  }
17
- listByTag(e) {
18
- return this.list().filter((t) => {
56
+ listByTag(t) {
57
+ return this.list().filter((e) => {
19
58
  var s;
20
- return (s = t.tags) == null ? void 0 : s.includes(e);
59
+ return (s = e.tags) == null ? void 0 : s.includes(t);
21
60
  });
22
61
  }
23
- search(e) {
24
- const t = e.toLowerCase();
62
+ search(t) {
63
+ const e = t.toLowerCase();
25
64
  return this.list().filter(
26
65
  (s) => {
27
- var r, i, a;
28
- return s.label.toLowerCase().includes(t) || ((r = s.description) == null ? void 0 : r.toLowerCase().includes(t)) || ((i = s.tags) == null ? void 0 : i.some((o) => o.toLowerCase().includes(t))) || ((a = s.category) == null ? void 0 : a.toLowerCase().includes(t));
66
+ var r, a, i;
67
+ return s.label.toLowerCase().includes(e) || ((r = s.description) == null ? void 0 : r.toLowerCase().includes(e)) || ((a = s.tags) == null ? void 0 : a.some((l) => l.toLowerCase().includes(e))) || ((i = s.category) == null ? void 0 : i.toLowerCase().includes(e));
29
68
  }
30
69
  );
31
70
  }
32
71
  categories() {
33
- const e = /* @__PURE__ */ new Set();
34
- return this.list().forEach((t) => {
35
- t.category && e.add(t.category);
36
- }), Array.from(e);
72
+ const t = /* @__PURE__ */ new Set();
73
+ return this.list().forEach((e) => {
74
+ e.category && t.add(e.category);
75
+ }), Array.from(t);
76
+ }
77
+ /** Remove every template — useful before re-loading from backend. */
78
+ clear() {
79
+ return this.templates.clear(), this;
37
80
  }
38
81
  }
39
- const n = new l();
82
+ const c = new o();
40
83
  export {
41
- l as TemplateRegistry,
42
- n as templateRegistry
84
+ o as TemplateRegistry,
85
+ c as templateRegistry
43
86
  };
44
87
  //# sourceMappingURL=templateRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templateRegistry.js","sources":["../src/templateRegistry/index.ts"],"sourcesContent":["import { WorkflowTemplate } from '../WorkflowCanvas/types';\r\n\r\nexport class TemplateRegistry {\r\n private templates = new Map<string, WorkflowTemplate>();\r\n\r\n register(template: WorkflowTemplate): this {\r\n this.templates.set(template.triggerKey, template);\r\n return this;\r\n }\r\n\r\n lookup(triggerKey: string): WorkflowTemplate | undefined {\r\n return this.templates.get(triggerKey);\r\n }\r\n\r\n list(): WorkflowTemplate[] {\r\n return [...this.templates.values()];\r\n }\r\n\r\n listByCategory(category: string): WorkflowTemplate[] {\r\n return this.list().filter((t) => t.category === category);\r\n }\r\n\r\n listByTag(tag: string): WorkflowTemplate[] {\r\n return this.list().filter((t) => t.tags?.includes(tag));\r\n }\r\n\r\n search(query: string): WorkflowTemplate[] {\r\n const q = query.toLowerCase();\r\n return this.list().filter(\r\n (t) =>\r\n t.label.toLowerCase().includes(q) ||\r\n t.description?.toLowerCase().includes(q) ||\r\n t.tags?.some((tag) => tag.toLowerCase().includes(q)) ||\r\n t.category?.toLowerCase().includes(q),\r\n );\r\n }\r\n\r\n categories(): string[] {\r\n const cats = new Set<string>();\r\n this.list().forEach((t) => { if (t.category) cats.add(t.category); });\r\n return Array.from(cats);\r\n }\r\n}\r\n\r\nexport const templateRegistry = new TemplateRegistry();\r\nexport type { WorkflowTemplate };\r\n"],"names":["TemplateRegistry","template","triggerKey","category","tag","_a","query","q","t","_b","_c","cats","templateRegistry"],"mappings":"AAEO,MAAMA,EAAiB;AAAA,EAAvB,cAAA;AACL,SAAQ,gCAAgB,IAAA;AAAA,EAA8B;AAAA,EAEtD,SAASC,GAAkC;AACzC,gBAAK,UAAU,IAAIA,EAAS,YAAYA,CAAQ,GACzC;AAAA,EACT;AAAA,EAEA,OAAOC,GAAkD;AACvD,WAAO,KAAK,UAAU,IAAIA,CAAU;AAAA,EACtC;AAAA,EAEA,OAA2B;AACzB,WAAO,CAAC,GAAG,KAAK,UAAU,QAAQ;AAAA,EACpC;AAAA,EAEA,eAAeC,GAAsC;AACnD,WAAO,KAAK,OAAO,OAAO,CAAC,MAAM,EAAE,aAAaA,CAAQ;AAAA,EAC1D;AAAA,EAEA,UAAUC,GAAiC;AACzC,WAAO,KAAK,KAAA,EAAO,OAAO,CAAC;AArBxB,UAAAC;AAqB8B,cAAAA,IAAA,EAAE,SAAF,gBAAAA,EAAQ,SAASD;AAAA,KAAI;AAAA,EACxD;AAAA,EAEA,OAAOE,GAAmC;AACxC,UAAMC,IAAID,EAAM,YAAA;AAChB,WAAO,KAAK,OAAO;AAAA,MACjB,CAACE,MAAA;AA3BA,YAAAH,GAAAI,GAAAC;AA4BC,eAAAF,EAAE,MAAM,cAAc,SAASD,CAAC,OAChCF,IAAAG,EAAE,gBAAF,gBAAAH,EAAe,cAAc,SAASE,SACtCE,IAAAD,EAAE,SAAF,gBAAAC,EAAQ,KAAK,CAACL,MAAQA,EAAI,cAAc,SAASG,CAAC,SAClDG,IAAAF,EAAE,aAAF,gBAAAE,EAAY,cAAc,SAASH;AAAA;AAAA,IAAC;AAAA,EAE1C;AAAA,EAEA,aAAuB;AACrB,UAAMI,wBAAW,IAAA;AACjB,gBAAK,KAAA,EAAO,QAAQ,CAAC,MAAM;AAAE,MAAI,EAAE,YAAUA,EAAK,IAAI,EAAE,QAAQ;AAAA,IAAG,CAAC,GAC7D,MAAM,KAAKA,CAAI;AAAA,EACxB;AACF;AAEO,MAAMC,IAAmB,IAAIZ,EAAA;"}
1
+ {"version":3,"file":"templateRegistry.js","sources":["../src/templateRegistry/index.ts"],"sourcesContent":["import type { WorkflowTemplate, ApiWorkflowTemplate } from '../WorkflowCanvas/types';\n\nexport class TemplateRegistry {\n private templates = new Map<string, WorkflowTemplate>();\n\n /**\n * Register a template. Normalises `allowedTasks` (the backend's name) →\n * `availableTasks` (FlowForge's canonical name) so consumers can pass\n * either without rewriting.\n */\n register(template: WorkflowTemplate): this {\n const normalised: WorkflowTemplate = {\n ...template,\n availableTasks: template.availableTasks ?? template.allowedTasks,\n };\n this.templates.set(normalised.triggerKey, normalised);\n return this;\n }\n\n /**\n * Register a list of templates fetched from `GET /api/v1/workflow-template`.\n *\n * The API shape is:\n * {\n * key, name, description, allowedTasks, allowedSources,\n * configuration, // runtime BPMN — ignored by the canvas\n * templateUI: { // ← UI bag, spread onto the template\n * triggerCategory, icon, tags, category, author, popularity,\n * source, product, taskLabels, maxTasks, skeletonState, …\n * }\n * }\n *\n * Anything in `templateUI` overrides the top-level shorthand where there's\n * an overlap. Bad rows (missing `key`) are skipped with a DEV warning\n * rather than throwing, so one broken template doesn't blank the picker.\n *\n * Returns `this` for chaining and the count of templates registered.\n */\n registerFromApi(list: ApiWorkflowTemplate[]): this {\n for (const t of list ?? []) {\n if (!t?.key) {\n if (import.meta.env?.DEV) {\n // eslint-disable-next-line no-console\n console.warn('[FlowForge] templateRegistry.registerFromApi: skipped row without `key`', t);\n }\n continue;\n }\n this.register({\n triggerKey: t.key,\n label: t.name ?? t.key,\n description: t.description,\n availableTasks: t.allowedTasks,\n ...(t.templateUI ?? {}),\n } as WorkflowTemplate);\n }\n return this;\n }\n\n lookup(triggerKey: string): WorkflowTemplate | undefined {\n return this.templates.get(triggerKey);\n }\n\n list(): WorkflowTemplate[] {\n return [...this.templates.values()];\n }\n\n listByCategory(category: string): WorkflowTemplate[] {\n return this.list().filter((t) => t.category === category);\n }\n\n listByTag(tag: string): WorkflowTemplate[] {\n return this.list().filter((t) => t.tags?.includes(tag));\n }\n\n search(query: string): WorkflowTemplate[] {\n const q = query.toLowerCase();\n return this.list().filter(\n (t) =>\n t.label.toLowerCase().includes(q) ||\n t.description?.toLowerCase().includes(q) ||\n t.tags?.some((tag) => tag.toLowerCase().includes(q)) ||\n t.category?.toLowerCase().includes(q),\n );\n }\n\n categories(): string[] {\n const cats = new Set<string>();\n this.list().forEach((t) => { if (t.category) cats.add(t.category); });\n return Array.from(cats);\n }\n\n /** Remove every template — useful before re-loading from backend. */\n clear(): this {\n this.templates.clear();\n return this;\n }\n}\n\nexport const templateRegistry = new TemplateRegistry();\nexport type { WorkflowTemplate, ApiWorkflowTemplate };\n"],"names":["TemplateRegistry","template","normalised","list","t","triggerKey","category","tag","_a","query","q","_b","_c","cats","templateRegistry"],"mappings":"AAEO,MAAMA,EAA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AAAG,GAAAC;AA4EC,eAAAR,EAAE,MAAM,cAAc,SAASM,CAAC,OAChCF,IAAAJ,EAAE,gBAAF,gBAAAI,EAAe,cAAc,SAASE,SACtCC,IAAAP,EAAE,SAAF,gBAAAO,EAAQ,KAAK,CAACJ,MAAQA,EAAI,cAAc,SAASG,CAAC,SAClDE,IAAAR,EAAE,aAAF,gBAAAQ,EAAY,cAAc,SAASF;AAAA;AAAA,IAAC;AAAA,EAE1C;AAAA,EAEA,aAAuB;AACrB,UAAMG,wBAAW,IAAA;AACjB,gBAAK,KAAA,EAAO,QAAQ,CAACT,MAAM;AAAE,MAAIA,EAAE,YAAUS,EAAK,IAAIT,EAAE,QAAQ;AAAA,IAAG,CAAC,GAC7D,MAAM,KAAKS,CAAI;AAAA,EACxB;AAAA;AAAA,EAGA,QAAc;AACZ,gBAAK,UAAU,MAAA,GACR;AAAA,EACT;AACF;AAEO,MAAMC,IAAmB,IAAId,EAAA;"}
@@ -2,7 +2,7 @@ import { jsxs as v, jsx as f, Fragment as ye } from "react/jsx-runtime";
2
2
  import G, { useRef as vt, useEffect as re, useState as M, useCallback as $, useMemo as Y } from "react";
3
3
  import In, { useStore as On, useReactFlow as Mn, Background as jn, Controls as Fn, MiniMap as zn } from "reactflow";
4
4
  import "reactflow/dist/style.css";
5
- import { e as Ln, G as An, E as Dn, P as Rn, L as Pn, d as Bn, f as Wn } from "./GatewayBranchEdge-Dxoy5B1A.js";
5
+ import { e as Ln, G as An, E as Dn, P as Rn, L as Pn, d as Bn, f as Wn } from "./GatewayBranchEdge-Diid9GtB.js";
6
6
  import { Dialog as Gn, Box as Q, Drawer as $n, IconButton as Et, Button as Ne, CircularProgress as Yn } from "@mui/material";
7
7
  import Kn from "react-select";
8
8
  import { MdClose as Un, MdCalendarToday as Vn, MdBolt as Hn, MdArrowBack as Wt, MdChevronRight as Gt, MdAddCircleOutline as qn, MdApps as Xn, MdErrorOutline as Jn, MdAccountTree as Zn, MdAdd as Qn, MdSearch as er, MdCategory as tr, MdCancel as $t, MdError as Yt, MdCheckCircle as Kt, MdPlayArrow as Ut, MdHourglassEmpty as nr, MdSchedule as kt, MdPerson as rr, MdExpandLess as or, MdExpandMore as ir } from "react-icons/md";
@@ -2952,4 +2952,4 @@ export {
2952
2952
  bs as u,
2953
2953
  ws as w
2954
2954
  };
2955
- //# sourceMappingURL=templateSkeletons-DCvfog6-.js.map
2955
+ //# sourceMappingURL=templateSkeletons-BB6jQ9r5.js.map