@loopstack/loopstack-studio 0.34.0 → 0.35.0

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 (133) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +18 -24
  2. package/dist/components/layout/StudioSidebar.js +34 -34
  3. package/dist/events/api-client-events.js +13 -1
  4. package/dist/events/index.js +1 -0
  5. package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
  6. package/dist/features/code-explorer/index.js +0 -3
  7. package/dist/features/dashboard/AppLauncher.js +1 -1
  8. package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
  9. package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
  10. package/dist/features/documents/components/DocumentList.js +1 -1
  11. package/dist/features/documents/document-details/DocumentDetails.js +0 -5
  12. package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
  13. package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
  14. package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
  15. package/dist/features/feature-registry/FeatureRegistryProvider.js +2 -1
  16. package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
  17. package/dist/features/file-explorer/components/FileTree.js +1 -1
  18. package/dist/features/file-explorer/hooks/useFileExplorer.js +36 -31
  19. package/dist/features/file-explorer/providers/FileExplorerProvider.js +94 -92
  20. package/dist/features/git/components/WorkbenchGitPanel.js +6 -9
  21. package/dist/features/git/hooks/useGit.js +55 -57
  22. package/dist/features/health/LocalHealthCheck.js +46 -47
  23. package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
  24. package/dist/features/runs/Runs.js +3 -2
  25. package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
  26. package/dist/features/workbench/WorkflowItem.js +5 -8
  27. package/dist/features/workbench/components/NewRunDialog.js +172 -170
  28. package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
  29. package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
  30. package/dist/features/workbench/components/WorkflowForms.js +1 -1
  31. package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
  32. package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
  33. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
  34. package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
  35. package/dist/features/workspaces/Workspaces.js +4 -2
  36. package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
  37. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
  38. package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
  39. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  40. package/dist/hooks/index.js +5 -5
  41. package/dist/hooks/useAuth.js +14 -53
  42. package/dist/hooks/useConfig.js +13 -37
  43. package/dist/hooks/useDocuments.js +5 -30
  44. package/dist/hooks/useEnvironments.js +34 -24
  45. package/dist/hooks/useProcessor.js +2 -31
  46. package/dist/hooks/useSecrets.js +78 -24
  47. package/dist/hooks/useWorkflows.js +43 -172
  48. package/dist/hooks/useWorkspaces.js +24 -130
  49. package/dist/index.d.ts +130 -488
  50. package/dist/index.js +10 -12
  51. package/dist/packages/client/dist/client.js +35 -0
  52. package/dist/packages/client/dist/http.js +47 -0
  53. package/dist/packages/client/dist/index.js +15 -0
  54. package/dist/packages/client/dist/queries/query-keys.js +94 -0
  55. package/dist/packages/client/dist/queries/query-options.js +97 -0
  56. package/dist/packages/client/dist/resources/auth.js +10 -0
  57. package/dist/packages/client/dist/resources/config.js +11 -0
  58. package/dist/packages/client/dist/resources/dashboard.js +4 -0
  59. package/dist/packages/client/dist/resources/documents.js +7 -0
  60. package/dist/packages/client/dist/resources/processor.js +7 -0
  61. package/dist/packages/client/dist/resources/workflows.js +13 -0
  62. package/dist/packages/client/dist/resources/workspaces.js +12 -0
  63. package/dist/packages/client/dist/stream/invalidations.js +20 -0
  64. package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
  65. package/dist/packages/client/dist/stream/sse-parser.js +40 -0
  66. package/dist/packages/client/dist/stream/stream.js +147 -0
  67. package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
  68. package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
  69. package/dist/packages/contracts/dist/events/index.js +6 -0
  70. package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
  71. package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
  72. package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
  73. package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
  74. package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
  75. package/dist/packages/react/dist/hooks/mutations.js +175 -0
  76. package/dist/packages/react/dist/hooks/queries.js +139 -0
  77. package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
  78. package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
  79. package/dist/packages/react/dist/index.js +5 -0
  80. package/dist/packages/react/dist/provider.js +15 -0
  81. package/dist/pages/DashboardPage.js +2 -1
  82. package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
  83. package/dist/pages/DebugWorkflowsPage.js +2 -1
  84. package/dist/pages/EmbedWorkbenchPage.js +5 -4
  85. package/dist/pages/PreviewWorkbenchPage.js +60 -59
  86. package/dist/pages/StudioLandingPage.js +1 -1
  87. package/dist/pages/WorkbenchPage.js +3 -2
  88. package/dist/pages/WorkflowDebugPage.js +3 -2
  89. package/dist/pages/WorkspacePage.js +3 -2
  90. package/dist/pages/WorkspaceRunsPage.js +2 -1
  91. package/dist/providers/LoopstackClientProvider.js +31 -0
  92. package/dist/services/createApiClient.js +9 -3
  93. package/dist/services/index.js +0 -1
  94. package/dist/services/reporting-fetch.js +13 -0
  95. package/package.json +4 -3
  96. package/dist/api/auth.js +0 -10
  97. package/dist/api/client.js +0 -13
  98. package/dist/api/config.js +0 -11
  99. package/dist/api/dashboard.js +0 -4
  100. package/dist/api/documents.js +0 -7
  101. package/dist/api/environments.js +0 -8
  102. package/dist/api/index.js +0 -31
  103. package/dist/api/processor.js +0 -7
  104. package/dist/api/secrets.js +0 -16
  105. package/dist/api/workflows.js +0 -15
  106. package/dist/api/workspaces.js +0 -12
  107. package/dist/events/sse-client-events.js +0 -15
  108. package/dist/features/code-explorer/CodeExplorer.js +0 -6
  109. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
  110. package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
  111. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
  112. package/dist/features/file-explorer/api/files.js +0 -12
  113. package/dist/features/git/api/git.js +0 -9
  114. package/dist/hooks/query-keys.js +0 -145
  115. package/dist/hooks/useApi.js +0 -15
  116. package/dist/hooks/useFiles.js +0 -3
  117. package/dist/node_modules/lodash/_Symbol.js +0 -7
  118. package/dist/node_modules/lodash/_baseGetTag.js +0 -13
  119. package/dist/node_modules/lodash/_baseTrim.js +0 -11
  120. package/dist/node_modules/lodash/_freeGlobal.js +0 -6
  121. package/dist/node_modules/lodash/_getRawTag.js +0 -17
  122. package/dist/node_modules/lodash/_objectToString.js +0 -10
  123. package/dist/node_modules/lodash/_root.js +0 -8
  124. package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
  125. package/dist/node_modules/lodash/debounce.js +0 -53
  126. package/dist/node_modules/lodash/isObject.js +0 -10
  127. package/dist/node_modules/lodash/isObjectLike.js +0 -9
  128. package/dist/node_modules/lodash/isSymbol.js +0 -12
  129. package/dist/node_modules/lodash/now.js +0 -10
  130. package/dist/node_modules/lodash/toNumber.js +0 -22
  131. package/dist/providers/InvalidationEventsProvider.js +0 -43
  132. package/dist/providers/SseProvider.js +0 -37
  133. package/dist/services/eventEmitter.js +0 -12
@@ -1,12 +0,0 @@
1
- function createWorkspacesApi(e) {
2
- return {
3
- getById: (t) => e.get(`/api/v1/workspaces/${t.id}`).then((e) => e.data),
4
- getAll: (t) => e.get("/api/v1/workspaces", { params: t }).then((e) => e.data),
5
- create: (t) => e.post("/api/v1/workspaces", t.workspaceCreateDto).then((e) => e.data),
6
- update: (t) => e.put(`/api/v1/workspaces/${t.id}`, t.workspaceUpdateDto).then((e) => e.data),
7
- delete: (t) => e.delete(`/api/v1/workspaces/id/${t.id}`).then((e) => e.data),
8
- batchDelete: (t) => e.delete("/api/v1/workspaces/batch", { data: { ids: t.ids } }).then((e) => e.data),
9
- setFavourite: (t) => e.patch(`/api/v1/workspaces/${t.id}/favourite`, t.workspaceFavouriteDto).then((e) => e.data)
10
- };
11
- }
12
- export { createWorkspacesApi };
@@ -1,15 +0,0 @@
1
- const SseClientEvents = {
2
- WORKFLOW_CREATED: "workflow.created",
3
- WORKFLOW_UPDATED: "workflow.updated",
4
- DOCUMENT_CREATED: "document.created",
5
- SECRET_UPSERTED: "secret.upserted",
6
- SECRET_DELETED: "secret.deleted",
7
- SSE_CONNECTED: "sse.connected",
8
- LLM_RESPONSE_START: "llm.response.start",
9
- LLM_RESPONSE_TEXT_DELTA: "llm.response.text_delta",
10
- LLM_RESPONSE_THINKING_DELTA: "llm.response.thinking_delta",
11
- LLM_RESPONSE_TOOL_CALL: "llm.response.tool_call",
12
- LLM_RESPONSE_DONE: "llm.response.done",
13
- LLM_RESPONSE_ERROR: "llm.response.error"
14
- };
15
- export { SseClientEvents };
@@ -1,6 +0,0 @@
1
- import "../../lib/utils.js";
2
- import "../../components/ui/input.js";
3
- import "./providers/CodeExplorerProvider.js";
4
- import "./components/CodeExplorerTree.js";
5
- import { c } from "react/compiler-runtime";
6
- import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +0,0 @@
1
- import "../../../components/ui/scroll-area.js";
2
- import "../providers/CodeExplorerProvider.js";
3
- import "./CodeExplorerTreeNode.js";
4
- import { c } from "react/compiler-runtime";
5
- import { useMemo } from "react";
6
- import { jsx } from "react/jsx-runtime";
@@ -1,4 +0,0 @@
1
- import "../providers/CodeExplorerProvider.js";
2
- import "./FileTabsBarBase.js";
3
- import { c } from "react/compiler-runtime";
4
- import { jsx } from "react/jsx-runtime";
@@ -1,5 +0,0 @@
1
- import "../../../hooks/useFiles.js";
2
- import { c } from "react/compiler-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- createContext(null);
@@ -1,12 +0,0 @@
1
- var VARIANT_BASE_PATH = {
2
- local: "local-files",
3
- remote: "remote-files"
4
- };
5
- function createFilesApi(t, n) {
6
- let r = VARIANT_BASE_PATH[n];
7
- return {
8
- getTree: (e) => t.get(`/api/v1/workspaces/${e.workspaceId}/${r}/tree`, { params: e.path ? { path: e.path } : void 0 }).then((e) => e.data),
9
- readFile: (e) => t.get(`/api/v1/workspaces/${e.workspaceId}/${r}/read`, { params: { path: e.path } }).then((e) => e.data)
10
- };
11
- }
12
- export { createFilesApi };
@@ -1,9 +0,0 @@
1
- function createGitApi(e) {
2
- return {
3
- getStatus: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/status`).then((e) => e.data),
4
- getLog: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/log`, { params: t.limit ? { limit: t.limit } : void 0 }).then((e) => e.data),
5
- getRemote: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/remote`).then((e) => e.data),
6
- removeRemote: (t) => e.delete(`/api/v1/workspaces/${t.workspaceId}/git/remote`).then((e) => e.data)
7
- };
8
- }
9
- export { createGitApi };
@@ -1,145 +0,0 @@
1
- function getMeCacheKey(e) {
2
- return ["me", e];
3
- }
4
- function getHealthCacheKey(e) {
5
- return ["health", e];
6
- }
7
- function getAppTypesCacheKey(e) {
8
- return ["app-types", e];
9
- }
10
- function getWorkflowTypesCacheKey(e, C) {
11
- return [
12
- "workflowTypes",
13
- e,
14
- C
15
- ];
16
- }
17
- function getStudioAppsCacheKey(e) {
18
- return ["studio-apps", e];
19
- }
20
- function getAvailableEnvironmentsCacheKey(e) {
21
- return ["available-environments", e];
22
- }
23
- function getDashboardStatsCacheKey(e) {
24
- return [
25
- "dashboard",
26
- "stats",
27
- e
28
- ];
29
- }
30
- function getWorkflowCacheKey(e, C) {
31
- return [
32
- "workflow",
33
- e,
34
- C
35
- ];
36
- }
37
- function getWorkflowStatusCacheKey(e, C) {
38
- return [
39
- "workflowStatus",
40
- e,
41
- C
42
- ];
43
- }
44
- function getWorkflowsCacheKey(e) {
45
- return ["workflows", e];
46
- }
47
- function getChildWorkflowsCacheKey(e, C) {
48
- return [
49
- "childWorkflows",
50
- e,
51
- C
52
- ];
53
- }
54
- function getToolConfigsCacheKey(e) {
55
- return ["toolConfigs", e];
56
- }
57
- function getToolConfigCacheKey(e, C) {
58
- return [
59
- "toolConfig",
60
- e,
61
- C
62
- ];
63
- }
64
- function getWorkflowConfigCacheKey(e, C) {
65
- return [
66
- "workflowConfig",
67
- e,
68
- C
69
- ];
70
- }
71
- function getWorkflowSourceCacheKey(e, C) {
72
- return [
73
- "workflowSource",
74
- e,
75
- C
76
- ];
77
- }
78
- function getWorkspaceCacheKey(e, C) {
79
- return [
80
- "workspace",
81
- e,
82
- C
83
- ];
84
- }
85
- function getWorkspacesCacheKey(e) {
86
- return ["workspaces", e];
87
- }
88
- function getDocumentCacheKey(e, C) {
89
- return [
90
- "document",
91
- e,
92
- C
93
- ];
94
- }
95
- function getDocumentsCacheKey(e, C) {
96
- return [
97
- "documents",
98
- e,
99
- C
100
- ];
101
- }
102
- function getSecretsCacheKey(e, C) {
103
- return [
104
- "secrets",
105
- e,
106
- C
107
- ];
108
- }
109
- function getGitStatusCacheKey(e, C) {
110
- return [
111
- "gitStatus",
112
- e,
113
- C
114
- ];
115
- }
116
- function getGitLogCacheKey(e, C) {
117
- return [
118
- "gitLog",
119
- e,
120
- C
121
- ];
122
- }
123
- function getGitRemoteCacheKey(e, C) {
124
- return [
125
- "gitRemote",
126
- e,
127
- C
128
- ];
129
- }
130
- function getFileTreeCacheKey(e, C) {
131
- return [
132
- "fileTree",
133
- e,
134
- C
135
- ];
136
- }
137
- function getFileContentCacheKey(e, C, w) {
138
- return [
139
- "fileContent",
140
- e,
141
- C,
142
- w
143
- ];
144
- }
145
- export { getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowStatusCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey };
@@ -1,15 +0,0 @@
1
- import { createAxiosClient } from "../api/client.js";
2
- import { createApi } from "../api/index.js";
3
- import { useStudio } from "../providers/StudioProvider.js";
4
- import { c } from "react/compiler-runtime";
5
- import { useMemo } from "react";
6
- function useApiClient() {
7
- let i = c(6), { environment: a } = useStudio(), o;
8
- i[0] !== a.id || i[1] !== a.url ? (o = createApi(createAxiosClient(a.url, a.id)), i[0] = a.id, i[1] = a.url, i[2] = o) : o = i[2];
9
- let s = o, l;
10
- return i[3] !== s || i[4] !== a.id ? (l = {
11
- envKey: a.id,
12
- api: s
13
- }, i[3] = s, i[4] = a.id, i[5] = l) : l = i[5], l;
14
- }
15
- export { useApiClient };
@@ -1,3 +0,0 @@
1
- import "./useApi.js";
2
- import { c } from "react/compiler-runtime";
3
- import { useQuery } from "@tanstack/react-query";
@@ -1,7 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__root } from "./_root.js";
3
- var require__Symbol = /* @__PURE__ */ __commonJSMin(((e, n) => {
4
- n.exports = require__root().Symbol;
5
- }));
6
- export default require__Symbol();
7
- export { require__Symbol };
@@ -1,13 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__Symbol } from "./_Symbol.js";
3
- import { require__getRawTag } from "./_getRawTag.js";
4
- import { require__objectToString } from "./_objectToString.js";
5
- var require__baseGetTag = /* @__PURE__ */ __commonJSMin(((e, i) => {
6
- var a = require__Symbol(), o = require__getRawTag(), s = require__objectToString(), c = "[object Null]", l = "[object Undefined]", u = a ? a.toStringTag : void 0;
7
- function d(e) {
8
- return e == null ? e === void 0 ? l : c : u && u in Object(e) ? o(e) : s(e);
9
- }
10
- i.exports = d;
11
- }));
12
- export default require__baseGetTag();
13
- export { require__baseGetTag };
@@ -1,11 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__trimmedEndIndex } from "./_trimmedEndIndex.js";
3
- var require__baseTrim = /* @__PURE__ */ __commonJSMin(((e, n) => {
4
- var r = require__trimmedEndIndex(), i = /^\s+/;
5
- function a(e) {
6
- return e && e.slice(0, r(e) + 1).replace(i, "");
7
- }
8
- n.exports = a;
9
- }));
10
- export default require__baseTrim();
11
- export { require__baseTrim };
@@ -1,6 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- var require__freeGlobal = /* @__PURE__ */ __commonJSMin(((e, t) => {
3
- t.exports = typeof global == "object" && global && global.Object === Object && global;
4
- }));
5
- export default require__freeGlobal();
6
- export { require__freeGlobal };
@@ -1,17 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__Symbol } from "./_Symbol.js";
3
- var require__getRawTag = /* @__PURE__ */ __commonJSMin(((e, n) => {
4
- var r = require__Symbol(), i = Object.prototype, a = i.hasOwnProperty, o = i.toString, s = r ? r.toStringTag : void 0;
5
- function c(e) {
6
- var t = a.call(e, s), n = e[s];
7
- try {
8
- e[s] = void 0;
9
- var r = !0;
10
- } catch {}
11
- var i = o.call(e);
12
- return r && (t ? e[s] = n : delete e[s]), i;
13
- }
14
- n.exports = c;
15
- }));
16
- export default require__getRawTag();
17
- export { require__getRawTag };
@@ -1,10 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- var require__objectToString = /* @__PURE__ */ __commonJSMin(((e, t) => {
3
- var n = Object.prototype.toString;
4
- function r(e) {
5
- return n.call(e);
6
- }
7
- t.exports = r;
8
- }));
9
- export default require__objectToString();
10
- export { require__objectToString };
@@ -1,8 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__freeGlobal } from "./_freeGlobal.js";
3
- var require__root = /* @__PURE__ */ __commonJSMin(((e, n) => {
4
- var r = require__freeGlobal(), i = typeof self == "object" && self && self.Object === Object && self;
5
- n.exports = r || i || Function("return this")();
6
- }));
7
- export default require__root();
8
- export { require__root };
@@ -1,11 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- var require__trimmedEndIndex = /* @__PURE__ */ __commonJSMin(((e, t) => {
3
- var n = /\s/;
4
- function r(e) {
5
- for (var t = e.length; t-- && n.test(e.charAt(t)););
6
- return t;
7
- }
8
- t.exports = r;
9
- }));
10
- export default require__trimmedEndIndex();
11
- export { require__trimmedEndIndex };
@@ -1,53 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require_isObject } from "./isObject.js";
3
- import { require_now } from "./now.js";
4
- import { require_toNumber } from "./toNumber.js";
5
- var require_debounce = /* @__PURE__ */ __commonJSMin(((e, i) => {
6
- var a = require_isObject(), o = require_now(), s = require_toNumber(), c = "Expected a function", l = Math.max, u = Math.min;
7
- function d(e, t, n) {
8
- var r, i, d, f, p, m, h = 0, g = !1, _ = !1, v = !0;
9
- if (typeof e != "function") throw TypeError(c);
10
- t = s(t) || 0, a(n) && (g = !!n.leading, _ = "maxWait" in n, d = _ ? l(s(n.maxWait) || 0, t) : d, v = "trailing" in n ? !!n.trailing : v);
11
- function y(t) {
12
- var n = r, a = i;
13
- return r = i = void 0, h = t, f = e.apply(a, n), f;
14
- }
15
- function b(e) {
16
- return h = e, p = setTimeout(C, t), g ? y(e) : f;
17
- }
18
- function x(e) {
19
- var n = e - m, r = e - h, i = t - n;
20
- return _ ? u(i, d - r) : i;
21
- }
22
- function S(e) {
23
- var n = e - m, r = e - h;
24
- return m === void 0 || n >= t || n < 0 || _ && r >= d;
25
- }
26
- function C() {
27
- var e = o();
28
- if (S(e)) return w(e);
29
- p = setTimeout(C, x(e));
30
- }
31
- function w(e) {
32
- return p = void 0, v && r ? y(e) : (r = i = void 0, f);
33
- }
34
- function T() {
35
- p !== void 0 && clearTimeout(p), h = 0, r = m = i = p = void 0;
36
- }
37
- function E() {
38
- return p === void 0 ? f : w(o());
39
- }
40
- function D() {
41
- var e = o(), n = S(e);
42
- if (r = arguments, i = this, m = e, n) {
43
- if (p === void 0) return b(m);
44
- if (_) return clearTimeout(p), p = setTimeout(C, t), y(m);
45
- }
46
- return p === void 0 && (p = setTimeout(C, t)), f;
47
- }
48
- return D.cancel = T, D.flush = E, D;
49
- }
50
- i.exports = d;
51
- }));
52
- export default require_debounce();
53
- export { require_debounce };
@@ -1,10 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- var require_isObject = /* @__PURE__ */ __commonJSMin(((e, t) => {
3
- function n(e) {
4
- var t = typeof e;
5
- return e != null && (t == "object" || t == "function");
6
- }
7
- t.exports = n;
8
- }));
9
- export default require_isObject();
10
- export { require_isObject };
@@ -1,9 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- var require_isObjectLike = /* @__PURE__ */ __commonJSMin(((e, t) => {
3
- function n(e) {
4
- return typeof e == "object" && !!e;
5
- }
6
- t.exports = n;
7
- }));
8
- export default require_isObjectLike();
9
- export { require_isObjectLike };
@@ -1,12 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__baseGetTag } from "./_baseGetTag.js";
3
- import { require_isObjectLike } from "./isObjectLike.js";
4
- var require_isSymbol = /* @__PURE__ */ __commonJSMin(((e, r) => {
5
- var i = require__baseGetTag(), a = require_isObjectLike(), o = "[object Symbol]";
6
- function s(e) {
7
- return typeof e == "symbol" || a(e) && i(e) == o;
8
- }
9
- r.exports = s;
10
- }));
11
- export default require_isSymbol();
12
- export { require_isSymbol };
@@ -1,10 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require__root } from "./_root.js";
3
- var require_now = /* @__PURE__ */ __commonJSMin(((e, n) => {
4
- var r = require__root();
5
- n.exports = function() {
6
- return r.Date.now();
7
- };
8
- }));
9
- export default require_now();
10
- export { require_now };
@@ -1,22 +0,0 @@
1
- import { __commonJSMin } from "../../_virtual/rolldown_runtime.js";
2
- import { require_isObject } from "./isObject.js";
3
- import { require__baseTrim } from "./_baseTrim.js";
4
- import { require_isSymbol } from "./isSymbol.js";
5
- var require_toNumber = /* @__PURE__ */ __commonJSMin(((e, i) => {
6
- var a = require__baseTrim(), o = require_isObject(), s = require_isSymbol(), c = NaN, l = /^[-+]0x[0-9a-f]+$/i, u = /^0b[01]+$/i, d = /^0o[0-7]+$/i, f = parseInt;
7
- function p(e) {
8
- if (typeof e == "number") return e;
9
- if (s(e)) return c;
10
- if (o(e)) {
11
- var n = typeof e.valueOf == "function" ? e.valueOf() : e;
12
- e = o(n) ? n + "" : n;
13
- }
14
- if (typeof e != "string") return e === 0 ? e : +e;
15
- e = a(e);
16
- var r = u.test(e);
17
- return r || d.test(e) ? f(e.slice(2), r ? 2 : 8) : l.test(e) ? c : +e;
18
- }
19
- i.exports = p;
20
- }));
21
- export default require_toNumber();
22
- export { require_toNumber };
@@ -1,43 +0,0 @@
1
- import { __toESM } from "../_virtual/rolldown_runtime.js";
2
- import { getChildWorkflowsCacheKey, getDocumentsCacheKey, getSecretsCacheKey, getWorkflowCacheKey, getWorkflowStatusCacheKey } from "../hooks/query-keys.js";
3
- import { SseClientEvents } from "../events/sse-client-events.js";
4
- import { eventBus } from "../services/eventEmitter.js";
5
- import "../services/index.js";
6
- import { useStudio } from "./StudioProvider.js";
7
- import { require_debounce } from "../node_modules/lodash/debounce.js";
8
- import { c } from "react/compiler-runtime";
9
- import { useEffect, useRef } from "react";
10
- import { QueryClient, useQueryClient } from "@tanstack/react-query";
11
- var import_debounce = /* @__PURE__ */ __toESM(require_debounce(), 1), DEBOUNCE_MS = 300;
12
- function createDebouncedInvalidator(e, l) {
13
- return (0, import_debounce.default)(() => {
14
- e.invalidateQueries({ queryKey: l });
15
- }, DEBOUNCE_MS);
16
- }
17
- function InvalidationEventsProvider() {
18
- let e = c(5), { environment: f } = useStudio(), g = useQueryClient(), v;
19
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ new Map(), e[0] = v) : v = e[0];
20
- let y = useRef(v), b, x;
21
- return e[1] !== f.id || e[2] !== g ? (b = () => {
22
- if (!f.id) return;
23
- let e = f.id, d = y.current, p = function(e) {
24
- let l = JSON.stringify(e);
25
- d.has(l) || d.set(l, createDebouncedInvalidator(g, e)), d.get(l)();
26
- }, m = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (u) => {
27
- u.parentId && p(getChildWorkflowsCacheKey(e, u.parentId));
28
- }), h = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (u) => {
29
- u.id && (p(getWorkflowCacheKey(e, u.id)), p(getWorkflowStatusCacheKey(e, u.id))), u.parentId && p(getChildWorkflowsCacheKey(e, u.parentId));
30
- }), _ = eventBus.on(SseClientEvents.DOCUMENT_CREATED, (l) => {
31
- l.workflowId && p(getDocumentsCacheKey(e, l.workflowId));
32
- }), v = (l) => {
33
- l.workspaceId && p(getSecretsCacheKey(e, l.workspaceId));
34
- }, b = eventBus.on(SseClientEvents.SECRET_UPSERTED, v), x = eventBus.on(SseClientEvents.SECRET_DELETED, v);
35
- return () => {
36
- m(), h(), _(), b(), x(), d.forEach(_temp), d.clear();
37
- };
38
- }, x = [g, f.id], e[1] = f.id, e[2] = g, e[3] = b, e[4] = x) : (b = e[3], x = e[4]), useEffect(b, x), null;
39
- }
40
- function _temp(e) {
41
- return e.cancel();
42
- }
43
- export { InvalidationEventsProvider };
@@ -1,37 +0,0 @@
1
- import { eventBus } from "../services/eventEmitter.js";
2
- import "../services/index.js";
3
- import { useStudio } from "./StudioProvider.js";
4
- import { useMe } from "../hooks/useAuth.js";
5
- import { c } from "react/compiler-runtime";
6
- import { useEffect, useRef } from "react";
7
- function SseProvider() {
8
- let e = c(5), { environment: l } = useStudio(), { data: u, isSuccess: d } = useMe(), f = useRef(null), p, m;
9
- return e[0] !== l.url || e[1] !== d || e[2] !== u ? (p = () => {
10
- if (l.url && d && u) {
11
- f.current &&= (f.current.close(), null);
12
- let e = `${l.url}/api/v1/sse/stream`, o = new EventSource(e, { withCredentials: !0 });
13
- return f.current = o, o.onopen = _temp, o.onerror = () => {
14
- o.readyState === EventSource.CLOSED && console.warn("SSE connection closed. Refresh the page if it does not recover.");
15
- }, o.onmessage = _temp2, () => {
16
- o.close(), f.current = null;
17
- };
18
- }
19
- }, m = [
20
- l.url,
21
- d,
22
- u
23
- ], e[0] = l.url, e[1] = d, e[2] = u, e[3] = p, e[4] = m) : (p = e[3], m = e[4]), useEffect(p, m), null;
24
- }
25
- function _temp2(o) {
26
- try {
27
- let s = JSON.parse(o.data);
28
- eventBus.emit(s.type, s);
29
- } catch (e) {
30
- let o = e;
31
- console.error("Error parsing SSE event:", o);
32
- }
33
- }
34
- function _temp() {
35
- console.log("SSE connection established");
36
- }
37
- export { SseProvider };
@@ -1,12 +0,0 @@
1
- const eventBus = new class {
2
- events = {};
3
- on(e, t) {
4
- return this.events[e] || (this.events[e] = []), this.events[e].push(t), () => {
5
- this.events[e] = this.events[e].filter((e) => e !== t);
6
- };
7
- }
8
- emit(e, ...t) {
9
- this.events[e] && this.events[e].forEach((e) => e(...t));
10
- }
11
- }();
12
- export { eventBus };