@loopstack/loopstack-studio 0.33.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.
- package/dist/app/EnvironmentEmbedRoot.js +17 -25
- package/dist/components/layout/StudioSidebar.js +34 -34
- package/dist/components/messages/CompletionMessagePaper.js +25 -29
- package/dist/events/api-client-events.js +13 -1
- package/dist/events/index.js +1 -0
- package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
- package/dist/features/code-explorer/index.js +0 -3
- package/dist/features/dashboard/AppLauncher.js +111 -64
- package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
- package/dist/features/documents/DocumentRenderer.js +42 -42
- package/dist/features/documents/components/DocumentList.js +1 -1
- package/dist/features/documents/document-details/DocumentDetails.js +0 -5
- package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
- package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
- package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
- package/dist/features/feature-registry/FeatureRegistryProvider.js +17 -18
- package/dist/features/feature-registry/available-features.js +3 -2
- package/dist/features/feature-registry/index.js +1 -1
- package/dist/features/file-explorer/components/FileExplorerPanel.js +64 -43
- package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
- package/dist/features/file-explorer/components/FileTree.js +1 -1
- package/dist/features/file-explorer/file-explorer-feature.js +15 -7
- package/dist/features/file-explorer/hooks/useFileExplorer.js +41 -34
- package/dist/features/file-explorer/index.js +1 -1
- package/dist/features/file-explorer/providers/FileExplorerProvider.js +91 -89
- package/dist/features/git/components/WorkbenchGitPanel.js +7 -10
- package/dist/features/git/hooks/useGit.js +55 -57
- package/dist/features/health/LocalHealthCheck.js +46 -47
- package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
- package/dist/features/runs/Runs.js +3 -2
- package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
- package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
- package/dist/features/workbench/Workbench.js +16 -16
- package/dist/features/workbench/WorkflowItem.js +5 -8
- package/dist/features/workbench/components/NewRunDialog.js +173 -171
- package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
- package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
- package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
- package/dist/features/workbench/components/WorkflowForms.js +1 -1
- package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
- package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
- package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
- package/dist/features/workbench/index.js +1 -1
- package/dist/features/workspaces/Workspaces.js +5 -3
- package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
- package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
- package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
- package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/useAuth.js +14 -53
- package/dist/hooks/useConfig.js +13 -37
- package/dist/hooks/useDocuments.js +5 -30
- package/dist/hooks/useEnvironments.js +34 -24
- package/dist/hooks/useProcessor.js +2 -31
- package/dist/hooks/useSecrets.js +71 -53
- package/dist/hooks/useWorkflows.js +43 -172
- package/dist/hooks/useWorkspaces.js +24 -130
- package/dist/index.d.ts +137 -481
- package/dist/index.js +15 -17
- package/dist/loopstack-studio.css +1 -1
- package/dist/packages/client/dist/client.js +35 -0
- package/dist/packages/client/dist/http.js +47 -0
- package/dist/packages/client/dist/index.js +15 -0
- package/dist/packages/client/dist/queries/query-keys.js +94 -0
- package/dist/packages/client/dist/queries/query-options.js +97 -0
- package/dist/packages/client/dist/resources/auth.js +10 -0
- package/dist/packages/client/dist/resources/config.js +11 -0
- package/dist/packages/client/dist/resources/dashboard.js +4 -0
- package/dist/packages/client/dist/resources/documents.js +7 -0
- package/dist/packages/client/dist/resources/processor.js +7 -0
- package/dist/packages/client/dist/resources/workflows.js +13 -0
- package/dist/packages/client/dist/resources/workspaces.js +12 -0
- package/dist/packages/client/dist/stream/invalidations.js +20 -0
- package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
- package/dist/packages/client/dist/stream/sse-parser.js +40 -0
- package/dist/packages/client/dist/stream/stream.js +147 -0
- package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
- package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
- package/dist/packages/contracts/dist/events/index.js +6 -0
- package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
- package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
- package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
- package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
- package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
- package/dist/packages/react/dist/hooks/mutations.js +175 -0
- package/dist/packages/react/dist/hooks/queries.js +139 -0
- package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
- package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
- package/dist/packages/react/dist/index.js +5 -0
- package/dist/packages/react/dist/provider.js +15 -0
- package/dist/pages/DashboardPage.js +2 -1
- package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
- package/dist/pages/DebugWorkflowsPage.js +2 -1
- package/dist/pages/EmbedWorkbenchPage.js +50 -43
- package/dist/pages/PreviewWorkbenchPage.js +60 -59
- package/dist/pages/StudioLandingPage.js +1 -1
- package/dist/pages/WorkbenchPage.js +53 -47
- package/dist/pages/WorkflowDebugPage.js +3 -2
- package/dist/pages/WorkspacePage.js +42 -27
- package/dist/pages/WorkspaceRunsPage.js +36 -27
- package/dist/providers/LoopstackClientProvider.js +31 -0
- package/dist/services/createApiClient.js +9 -3
- package/dist/services/index.js +0 -1
- package/dist/services/reporting-fetch.js +13 -0
- package/package.json +4 -3
- package/dist/api/auth.js +0 -10
- package/dist/api/client.js +0 -13
- package/dist/api/config.js +0 -11
- package/dist/api/dashboard.js +0 -4
- package/dist/api/documents.js +0 -7
- package/dist/api/environments.js +0 -8
- package/dist/api/index.js +0 -28
- package/dist/api/processor.js +0 -7
- package/dist/api/secrets.js +0 -16
- package/dist/api/workflows.js +0 -15
- package/dist/api/workspaces.js +0 -12
- package/dist/events/sse-client-events.js +0 -13
- package/dist/features/code-explorer/CodeExplorer.js +0 -6
- package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
- package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
- package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
- package/dist/features/file-explorer/api/files.js +0 -7
- package/dist/features/git/api/git.js +0 -9
- package/dist/hooks/query-keys.js +0 -145
- package/dist/hooks/useApi.js +0 -15
- package/dist/hooks/useFiles.js +0 -3
- package/dist/node_modules/lodash/_Symbol.js +0 -7
- package/dist/node_modules/lodash/_baseGetTag.js +0 -13
- package/dist/node_modules/lodash/_baseTrim.js +0 -11
- package/dist/node_modules/lodash/_freeGlobal.js +0 -6
- package/dist/node_modules/lodash/_getRawTag.js +0 -17
- package/dist/node_modules/lodash/_objectToString.js +0 -10
- package/dist/node_modules/lodash/_root.js +0 -8
- package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
- package/dist/node_modules/lodash/debounce.js +0 -53
- package/dist/node_modules/lodash/isObject.js +0 -10
- package/dist/node_modules/lodash/isObjectLike.js +0 -9
- package/dist/node_modules/lodash/isSymbol.js +0 -12
- package/dist/node_modules/lodash/now.js +0 -10
- package/dist/node_modules/lodash/toNumber.js +0 -22
- package/dist/providers/InvalidationEventsProvider.js +0 -41
- package/dist/providers/SseProvider.js +0 -37
- package/dist/services/eventEmitter.js +0 -12
package/dist/hooks/useApi.js
DELETED
|
@@ -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 };
|
package/dist/hooks/useFiles.js
DELETED
|
@@ -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,41 +0,0 @@
|
|
|
1
|
-
import { __toESM } from "../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { getChildWorkflowsCacheKey, getDocumentsCacheKey, 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, s) {
|
|
13
|
-
return (0, import_debounce.default)(() => {
|
|
14
|
-
e.invalidateQueries({ queryKey: s });
|
|
15
|
-
}, DEBOUNCE_MS);
|
|
16
|
-
}
|
|
17
|
-
function InvalidationEventsProvider() {
|
|
18
|
-
let e = c(5), { environment: d } = useStudio(), h = useQueryClient(), _;
|
|
19
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ new Map(), e[0] = _) : _ = e[0];
|
|
20
|
-
let v = useRef(_), y, b;
|
|
21
|
-
return e[1] !== d.id || e[2] !== h ? (y = () => {
|
|
22
|
-
if (!d.id) return;
|
|
23
|
-
let e = d.id, u = v.current, f = function(e) {
|
|
24
|
-
let s = JSON.stringify(e);
|
|
25
|
-
u.has(s) || u.set(s, createDebouncedInvalidator(h, e)), u.get(s)();
|
|
26
|
-
}, p = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (l) => {
|
|
27
|
-
l.parentId && f(getChildWorkflowsCacheKey(e, l.parentId));
|
|
28
|
-
}), m = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (l) => {
|
|
29
|
-
l.id && (f(getWorkflowCacheKey(e, l.id)), f(getWorkflowStatusCacheKey(e, l.id))), l.parentId && f(getChildWorkflowsCacheKey(e, l.parentId));
|
|
30
|
-
}), g = eventBus.on(SseClientEvents.DOCUMENT_CREATED, (s) => {
|
|
31
|
-
s.workflowId && f(getDocumentsCacheKey(e, s.workflowId));
|
|
32
|
-
});
|
|
33
|
-
return () => {
|
|
34
|
-
p(), m(), g(), u.forEach(_temp), u.clear();
|
|
35
|
-
};
|
|
36
|
-
}, b = [h, d.id], e[1] = d.id, e[2] = h, e[3] = y, e[4] = b) : (y = e[3], b = e[4]), useEffect(y, b), null;
|
|
37
|
-
}
|
|
38
|
-
function _temp(e) {
|
|
39
|
-
return e.cancel();
|
|
40
|
-
}
|
|
41
|
-
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 };
|