@notmrabhi/flowforge 0.1.34 → 0.1.36

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.
Files changed (38) hide show
  1. package/README.md +52 -0
  2. package/dist/{SchemaBuilderDrawer-BbkOK4Xc.js → SchemaBuilderDrawer-CUzYWGCN.js} +2 -2
  3. package/dist/{SchemaBuilderDrawer-BbkOK4Xc.js.map → SchemaBuilderDrawer-CUzYWGCN.js.map} +1 -1
  4. package/dist/{SchemaBuilderDrawer-BcaULxqB.js → SchemaBuilderDrawer-CiSdfXzJ.js} +2 -2
  5. package/dist/{SchemaBuilderDrawer-BcaULxqB.js.map → SchemaBuilderDrawer-CiSdfXzJ.js.map} +1 -1
  6. package/dist/canvas.cjs +1 -1
  7. package/dist/canvas.d.ts +101 -0
  8. package/dist/canvas.js +1 -1
  9. package/dist/core.d.ts +61 -0
  10. package/dist/form.cjs +1 -1
  11. package/dist/form.d.ts +12 -0
  12. package/dist/form.js +2 -2
  13. package/dist/{index-CEg1wTCw.js → index-B74jTc2b.js} +869 -862
  14. package/dist/{index-CEg1wTCw.js.map → index-B74jTc2b.js.map} +1 -1
  15. package/dist/{index-CYdDPwd2.js → index-B8-KKaH_.js} +2 -2
  16. package/dist/{index-CYdDPwd2.js.map → index-B8-KKaH_.js.map} +1 -1
  17. package/dist/{index-dhI8qsmP.js → index-Buv1ylwP.js} +2 -2
  18. package/dist/{index-dhI8qsmP.js.map → index-Buv1ylwP.js.map} +1 -1
  19. package/dist/{index-fcb3uyVA.js → index-CiU9_8f1.js} +2 -2
  20. package/dist/{index-fcb3uyVA.js.map → index-CiU9_8f1.js.map} +1 -1
  21. package/dist/{index-x1DrmceO.js → index-CqMPyOkL.js} +5 -5
  22. package/dist/{index-x1DrmceO.js.map → index-CqMPyOkL.js.map} +1 -1
  23. package/dist/{index-B9W10Fvn.js → index-DjKhaaWf.js} +2 -2
  24. package/dist/{index-B9W10Fvn.js.map → index-DjKhaaWf.js.map} +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.ts +61 -0
  27. package/dist/index.js +3 -3
  28. package/dist/nodeRegistry.d.ts +18 -0
  29. package/dist/templateRegistry.cjs +1 -1
  30. package/dist/templateRegistry.cjs.map +1 -1
  31. package/dist/templateRegistry.d.ts +49 -0
  32. package/dist/templateRegistry.js +63 -20
  33. package/dist/templateRegistry.js.map +1 -1
  34. package/dist/{templateSkeletons-CY4tkEp2.js → templateSkeletons-BTC2fk5u.js} +2 -2
  35. package/dist/{templateSkeletons-CY4tkEp2.js.map → templateSkeletons-BTC2fk5u.js.map} +1 -1
  36. package/dist/{templateSkeletons-BPIZ_EHv.js → templateSkeletons-DCvfog6-.js} +2 -2
  37. package/dist/{templateSkeletons-BPIZ_EHv.js.map → templateSkeletons-DCvfog6-.js.map} +1 -1
  38. package/package.json +1 -1
package/README.md CHANGED
@@ -46,6 +46,58 @@ export function Builder() {
46
46
  }
47
47
  ```
48
48
 
49
+ ## Loading templates from a backend
50
+
51
+ Instead of hardcoding `templateRegistry.register({...})` calls, fetch templates
52
+ from your API and bulk-register them. The package accepts the backend wire
53
+ shape directly via `registerFromApi`:
54
+
55
+ ```ts
56
+ import { templateRegistry } from '@miniorange/flowforge/templates';
57
+ import type { ApiWorkflowTemplate } from '@miniorange/flowforge/canvas';
58
+
59
+ async function loadTemplates() {
60
+ const res = await fetch('/api/v1/workflow-template');
61
+ const list: ApiWorkflowTemplate[] = await res.json();
62
+ templateRegistry.clear().registerFromApi(list);
63
+ }
64
+ ```
65
+
66
+ Expected payload shape per row (the backend's persistence model + a `templateUI`
67
+ JSON column for UI fields):
68
+
69
+ ```jsonc
70
+ {
71
+ "key": "END_USER_CREATION",
72
+ "name": "New User Registration",
73
+ "description": "…",
74
+ "state": "PUBLISHED",
75
+ "allowedTasks": ["USER_CREATION", "USER_GROUP_ASSIGNMENT", "USER_ROLE_ASSIGNMENT"],
76
+ "allowedSources": ["SIGNUP_FLOW", "ADMIN_CREATION_FLOW"],
77
+ "configuration": { /* runtime BPMN — ignored by the canvas */ },
78
+ "templateUI": {
79
+ "triggerCategory": "event",
80
+ "icon": "user-plus",
81
+ "tags": ["onboarding"],
82
+ "category": "User Lifecycle",
83
+ "author": "miniOrange",
84
+ "popularity": 100,
85
+ "source": "system",
86
+ "product": "IAM",
87
+ "maxTasks": 10,
88
+ "taskLabels": { "USER_GROUP_ASSIGNMENT": "Assign Groups" },
89
+ "skeletonState": {
90
+ "slots": [ /* CanvasSlot[] — pre-seeded canvas chain */ ],
91
+ "branches": {}
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ `registerFromApi` normalises `allowedTasks → availableTasks` automatically.
98
+ Bad rows (missing `key`) are skipped with a DEV-mode warning, so a single
99
+ malformed template doesn't blank the picker.
100
+
49
101
  ## Entry points
50
102
 
51
103
  | Import | Contents |
@@ -1,6 +1,6 @@
1
1
  import { useMemo as P, useState as T, useRef as M, useEffect as de, useCallback as te } from "react";
2
2
  import { useFormik as ke } from "formik";
3
- import { k as pe, C as Ne, g as oe, a as ue, b as ie, v as se, E as ze, d as Te, V as we } from "./index-CEg1wTCw.js";
3
+ import { k as pe, C as Ne, g as oe, a as ue, b as ie, v as se, E as ze, d as Te, V as we } from "./index-B74jTc2b.js";
4
4
  import { jsxs as t, Fragment as q, jsx as e } from "react/jsx-runtime";
5
5
  import { Box as n, Collapse as Ie, Tooltip as A, Dialog as he, Typography as S, IconButton as Y, Stepper as Fe, Step as Oe, StepLabel as Re, Drawer as Ee, Chip as We, Divider as Ae } from "@mui/material";
6
6
  import { MdCheck as G, MdClose as _, MdAdd as J, MdArrowBack as fe, MdEdit as De, MdDeleteOutline as Pe, MdSettings as be, MdArrowForward as Me } from "react-icons/md";
@@ -1134,4 +1134,4 @@ export {
1134
1134
  cl as a,
1135
1135
  sl as u
1136
1136
  };
1137
- //# sourceMappingURL=SchemaBuilderDrawer-BbkOK4Xc.js.map
1137
+ //# sourceMappingURL=SchemaBuilderDrawer-CUzYWGCN.js.map