@railtownai/railtracks-visualizer 0.0.3 → 0.0.5

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 (55) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +52 -23
  3. package/dist/cjs/index.js +55 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/esm/index.js +55 -0
  6. package/dist/esm/index.js.map +1 -0
  7. package/dist/{AgenticFlowVisualizer.d.ts → types/src/AgenticFlowVisualizer.d.ts} +2 -2
  8. package/dist/types/src/AgenticFlowVisualizer.d.ts.map +1 -0
  9. package/dist/types/src/App.d.ts.map +1 -0
  10. package/dist/types/src/Visualizer.d.ts +9 -0
  11. package/dist/types/src/Visualizer.d.ts.map +1 -0
  12. package/dist/types/src/components/Edge.d.ts.map +1 -0
  13. package/dist/types/src/components/FileSelector.d.ts.map +1 -0
  14. package/dist/types/src/components/Node.d.ts.map +1 -0
  15. package/dist/types/src/components/Timeline.d.ts.map +1 -0
  16. package/dist/types/src/components/VerticalTimeline.d.ts.map +1 -0
  17. package/dist/types/src/hooks/index.d.ts.map +1 -0
  18. package/dist/types/src/hooks/useApi.d.ts.map +1 -0
  19. package/dist/types/src/hooks/useFlowData.d.ts.map +1 -0
  20. package/dist/{index.d.ts → types/src/index.d.ts} +1 -2
  21. package/dist/types/src/index.d.ts.map +1 -0
  22. package/dist/types/tests/setup.d.ts +2 -0
  23. package/dist/types/tests/setup.d.ts.map +1 -0
  24. package/package.json +93 -75
  25. package/dist/AgenticFlowVisualizer.d.ts.map +0 -1
  26. package/dist/AgenticFlowVisualizer.js +0 -710
  27. package/dist/App.d.ts.map +0 -1
  28. package/dist/App.js +0 -89
  29. package/dist/components/Edge.d.ts.map +0 -1
  30. package/dist/components/Edge.js +0 -74
  31. package/dist/components/FileSelector.d.ts.map +0 -1
  32. package/dist/components/FileSelector.js +0 -24
  33. package/dist/components/Node.d.ts.map +0 -1
  34. package/dist/components/Node.js +0 -100
  35. package/dist/components/Timeline.d.ts.map +0 -1
  36. package/dist/components/Timeline.js +0 -118
  37. package/dist/components/VerticalTimeline.d.ts.map +0 -1
  38. package/dist/components/VerticalTimeline.js +0 -156
  39. package/dist/hooks/index.d.ts.map +0 -1
  40. package/dist/hooks/index.js +0 -2
  41. package/dist/hooks/useApi.d.ts.map +0 -1
  42. package/dist/hooks/useApi.js +0 -95
  43. package/dist/hooks/useFlowData.d.ts.map +0 -1
  44. package/dist/hooks/useFlowData.js +0 -66
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/index.js +0 -13
  47. /package/dist/{App.d.ts → types/src/App.d.ts} +0 -0
  48. /package/dist/{components → types/src/components}/Edge.d.ts +0 -0
  49. /package/dist/{components → types/src/components}/FileSelector.d.ts +0 -0
  50. /package/dist/{components → types/src/components}/Node.d.ts +0 -0
  51. /package/dist/{components → types/src/components}/Timeline.d.ts +0 -0
  52. /package/dist/{components → types/src/components}/VerticalTimeline.d.ts +0 -0
  53. /package/dist/{hooks → types/src/hooks}/index.d.ts +0 -0
  54. /package/dist/{hooks → types/src/hooks}/useApi.d.ts +0 -0
  55. /package/dist/{hooks → types/src/hooks}/useFlowData.d.ts +0 -0
@@ -1,95 +0,0 @@
1
- import { useState, useCallback } from "react";
2
- // Base URL for the API
3
- const API_BASE = "/api";
4
- export const useApi = () => {
5
- const [loading, setLoading] = useState(false);
6
- const [error, setError] = useState(null);
7
- // Function to list all JSON files in the .railtracks directory
8
- const listJsonFiles = useCallback(async () => {
9
- setLoading(true);
10
- setError(null);
11
- try {
12
- console.log("Fetching files from:", `${API_BASE}/files`);
13
- const response = await fetch(`${API_BASE}/files`);
14
- console.log("Response status:", response.status);
15
- if (!response.ok) {
16
- throw new Error(`HTTP error! status: ${response.status}`);
17
- }
18
- const files = await response.json();
19
- console.log("Files received:", files);
20
- return files;
21
- }
22
- catch (err) {
23
- console.error("Error fetching files:", err);
24
- const errorMessage = err instanceof Error ? err.message : "Unknown error occurred";
25
- const apiError = {
26
- message: errorMessage,
27
- status: err instanceof Error && "status" in err ? err.status : undefined
28
- };
29
- setError(apiError);
30
- return [];
31
- }
32
- finally {
33
- setLoading(false);
34
- }
35
- }, []);
36
- // Function to load a specific JSON file
37
- const loadJsonFile = useCallback(async (filename) => {
38
- setLoading(true);
39
- setError(null);
40
- try {
41
- const response = await fetch(`${API_BASE}/json/${filename}`);
42
- if (!response.ok) {
43
- throw new Error(`HTTP error! status: ${response.status}`);
44
- }
45
- const data = await response.json();
46
- return data;
47
- }
48
- catch (err) {
49
- const errorMessage = err instanceof Error ? err.message : "Unknown error occurred";
50
- const apiError = {
51
- message: errorMessage,
52
- status: err instanceof Error && "status" in err ? err.status : undefined
53
- };
54
- setError(apiError);
55
- return null;
56
- }
57
- finally {
58
- setLoading(false);
59
- }
60
- }, []);
61
- // Function to trigger a frontend refresh
62
- const triggerRefresh = useCallback(async () => {
63
- setLoading(true);
64
- setError(null);
65
- try {
66
- const response = await fetch(`${API_BASE}/refresh`, {
67
- method: "POST"
68
- });
69
- if (!response.ok) {
70
- throw new Error(`HTTP error! status: ${response.status}`);
71
- }
72
- const result = await response.json();
73
- return result;
74
- }
75
- catch (err) {
76
- const errorMessage = err instanceof Error ? err.message : "Unknown error occurred";
77
- const apiError = {
78
- message: errorMessage,
79
- status: err instanceof Error && "status" in err ? err.status : undefined
80
- };
81
- setError(apiError);
82
- return null;
83
- }
84
- finally {
85
- setLoading(false);
86
- }
87
- }, []);
88
- return {
89
- loading,
90
- error,
91
- listJsonFiles,
92
- loadJsonFile,
93
- triggerRefresh
94
- };
95
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFlowData.d.ts","sourceRoot":"","sources":["../../src/hooks/useFlowData.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG5C,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE;QACL,IAA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M,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,WAAW;;;yBAyBH,MAAM;;oBAhCT,QAAQ,EAAE;iBACb,MAAM,GAAG,IAAI;cAChB,iBAAiB,GAAG,IAAI;CA4EnC,CAAC"}
@@ -1,66 +0,0 @@
1
- import { useState, useEffect, useCallback } from "react";
2
- import { useApi } from "./useApi";
3
- export const useFlowData = () => {
4
- const { listJsonFiles, loadJsonFile, loading: apiLoading, error: apiError } = useApi();
5
- const [state, setState] = useState({
6
- availableFiles: [],
7
- currentFile: null,
8
- flowData: null,
9
- loading: false,
10
- error: null
11
- });
12
- // Load available files on mount
13
- useEffect(() => {
14
- loadAvailableFiles();
15
- }, []);
16
- const loadAvailableFiles = useCallback(async () => {
17
- const files = await listJsonFiles();
18
- setState((prev) => ({
19
- ...prev,
20
- availableFiles: files
21
- }));
22
- }, [listJsonFiles]);
23
- const loadFile = useCallback(async (filename) => {
24
- setState((prev) => ({
25
- ...prev,
26
- loading: true,
27
- error: null
28
- }));
29
- try {
30
- const data = await loadJsonFile(filename);
31
- if (data) {
32
- setState((prev) => ({
33
- ...prev,
34
- currentFile: filename,
35
- flowData: data,
36
- loading: false,
37
- error: null
38
- }));
39
- }
40
- else {
41
- setState((prev) => ({
42
- ...prev,
43
- loading: false,
44
- error: "Failed to load file data"
45
- }));
46
- }
47
- }
48
- catch (err) {
49
- setState((prev) => ({
50
- ...prev,
51
- loading: false,
52
- error: err instanceof Error ? err.message : "Unknown error occurred"
53
- }));
54
- }
55
- }, [loadJsonFile]);
56
- const refreshFiles = useCallback(async () => {
57
- await loadAvailableFiles();
58
- }, [loadAvailableFiles]);
59
- return {
60
- ...state,
61
- loading: state.loading || apiLoading,
62
- error: state.error || apiError?.message || null,
63
- loadFile,
64
- refreshFiles
65
- };
66
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
package/dist/index.js DELETED
@@ -1,13 +0,0 @@
1
- // Library entry point for npm package
2
- export { default as AgenticFlowVisualizer } from "./AgenticFlowVisualizer";
3
- export { default as App } from "./App";
4
- // Export components
5
- export { Edge } from "./components/Edge";
6
- export { FileSelector } from "./components/FileSelector";
7
- export { Node } from "./components/Node";
8
- export { Timeline } from "./components/Timeline";
9
- export { VerticalTimeline } from "./components/VerticalTimeline";
10
- // Export hooks
11
- export * from "./hooks";
12
- // Export types
13
- export * from "./types";
File without changes
File without changes
File without changes