@loopstack/loopstack-studio 0.23.1 → 0.24.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 (62) hide show
  1. package/dist/api/index.js +12 -10
  2. package/dist/api/secrets.js +16 -0
  3. package/dist/components/dynamic-form/ArrayController.js +68 -64
  4. package/dist/components/dynamic-form/Form.js +46 -40
  5. package/dist/components/dynamic-form/FormElement.js +1 -1
  6. package/dist/components/dynamic-form/FormElementHeader.js +2 -2
  7. package/dist/components/dynamic-form/ObjectController.js +24 -21
  8. package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
  9. package/dist/components/dynamic-form/fields/InputField.js +20 -19
  10. package/dist/components/dynamic-form/fields/RadioField.js +18 -18
  11. package/dist/components/dynamic-form/fields/SelectField.js +19 -19
  12. package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
  13. package/dist/components/layout/MainLayout.js +18 -31
  14. package/dist/components/layout/StudioSidebar.js +168 -108
  15. package/dist/components/page/PageBreadcrumbs.js +79 -32
  16. package/dist/components/ui-widgets/UiWidget.js +36 -27
  17. package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
  18. package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
  19. package/dist/features/documents/components/DocumentList.js +5 -1
  20. package/dist/features/documents/renderers/AiMessage.js +11 -11
  21. package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
  22. package/dist/features/workbench/components/WorkbenchFilesPanel.js +32 -25
  23. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
  24. package/dist/features/workbench/components/WorkbenchIconSidebar.js +46 -34
  25. package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
  26. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +132 -117
  27. package/dist/hooks/index.js +1 -1
  28. package/dist/hooks/query-keys.js +41 -34
  29. package/dist/hooks/useSecrets.js +69 -0
  30. package/dist/index.d.ts +43 -0
  31. package/dist/index.js +2 -2
  32. package/dist/pages/DashboardPage.js +87 -35
  33. package/dist/pages/EmbedWorkbenchPage.js +43 -39
  34. package/dist/types/ai.types.js +13 -0
  35. package/package.json +2 -3
  36. package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
  37. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
  38. package/dist/node_modules/ai/dist/index.js +0 -1083
  39. package/dist/node_modules/zod/v3/ZodError.js +0 -79
  40. package/dist/node_modules/zod/v3/errors.js +0 -6
  41. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
  42. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
  43. package/dist/node_modules/zod/v3/helpers/util.js +0 -72
  44. package/dist/node_modules/zod/v3/locales/en.js +0 -58
  45. package/dist/node_modules/zod/v3/types.js +0 -2425
  46. package/dist/node_modules/zod/v4/classic/errors.js +0 -21
  47. package/dist/node_modules/zod/v4/classic/iso.js +0 -29
  48. package/dist/node_modules/zod/v4/classic/parse.js +0 -4
  49. package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
  50. package/dist/node_modules/zod/v4/core/api.js +0 -532
  51. package/dist/node_modules/zod/v4/core/checks.js +0 -283
  52. package/dist/node_modules/zod/v4/core/core.js +0 -44
  53. package/dist/node_modules/zod/v4/core/doc.js +0 -21
  54. package/dist/node_modules/zod/v4/core/errors.js +0 -40
  55. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
  56. package/dist/node_modules/zod/v4/core/parse.js +0 -66
  57. package/dist/node_modules/zod/v4/core/regexes.js +0 -28
  58. package/dist/node_modules/zod/v4/core/registries.js +0 -38
  59. package/dist/node_modules/zod/v4/core/schemas.js +0 -863
  60. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
  61. package/dist/node_modules/zod/v4/core/util.js +0 -267
  62. package/dist/node_modules/zod/v4/core/versions.js +0 -6
@@ -2,135 +2,150 @@ import { c } from "react/compiler-runtime";
2
2
  import { createContext, useCallback, useContext, useMemo, useState } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { useQuery, useQueryClient } from "@tanstack/react-query";
5
+ function getBaseUrl() {
6
+ return "http://localhost:8000";
7
+ }
8
+ async function refreshToken() {
9
+ return (await fetch(`${getBaseUrl()}/api/v1/auth/refresh`, {
10
+ method: "POST",
11
+ credentials: "include"
12
+ })).ok;
13
+ }
14
+ async function fetchWithRefresh(e, l) {
15
+ let u = await fetch(e, l);
16
+ return (u.status === 401 || u.status === 403) && await refreshToken() ? fetch(e, l) : u;
17
+ }
5
18
  var RemoteFileExplorerContext = createContext(null);
6
- function RemoteFileExplorerProvider(s) {
7
- let l = c(45), { children: u } = s, d = useQueryClient(), f;
8
- l[0] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ new Set(), l[0] = f) : f = l[0];
9
- let [p, m] = useState(f), h;
10
- l[1] === Symbol.for("react.memo_cache_sentinel") ? (h = [], l[1] = h) : h = l[1];
11
- let [g, _] = useState(h), [v, y] = useState(null), b;
12
- l[2] === Symbol.for("react.memo_cache_sentinel") ? (b = {
19
+ function RemoteFileExplorerProvider(l) {
20
+ let u = c(45), { children: d } = l, f = useQueryClient(), p;
21
+ u[0] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ new Set(), u[0] = p) : p = u[0];
22
+ let [m, h] = useState(p), g;
23
+ u[1] === Symbol.for("react.memo_cache_sentinel") ? (g = [], u[1] = g) : g = u[1];
24
+ let [_, v] = useState(g), [y, b] = useState(null), x;
25
+ u[2] === Symbol.for("react.memo_cache_sentinel") ? (x = {
13
26
  queryKey: ["remote-agent-file-tree"],
14
27
  queryFn: _temp,
15
- staleTime: 3e4
16
- }, l[2] = b) : b = l[2];
17
- let x = useQuery(b), S = v?.path, C;
18
- l[3] === S ? C = l[4] : (C = ["remote-agent-file-content", S], l[3] = S, l[4] = C);
19
- let w;
20
- l[5] === v ? w = l[6] : (w = async () => {
21
- let e = new URL("http://localhost:8000/api/v1/files/read");
22
- e.searchParams.set("path", v.path);
23
- let s = await fetch(e.toString(), { credentials: "include" });
24
- if (!s.ok) {
25
- let e = await s.text();
26
- throw Error(`Failed to read file (${s.status}): ${e}`);
28
+ staleTime: 3e4,
29
+ retry: !1
30
+ }, u[2] = x) : x = u[2];
31
+ let S = useQuery(x), C = y?.path, w;
32
+ u[3] === C ? w = u[4] : (w = ["remote-agent-file-content", C], u[3] = C, u[4] = w);
33
+ let T;
34
+ u[5] === y ? T = u[6] : (T = async () => {
35
+ let e = getBaseUrl(), l = new URL(`${e}/api/v1/files/read`);
36
+ l.searchParams.set("path", y.path);
37
+ let u = await fetchWithRefresh(l.toString(), { credentials: "include" });
38
+ if (!u.ok) {
39
+ let e = await u.text();
40
+ throw Error(`Failed to read file (${u.status}): ${e}`);
27
41
  }
28
- return (await s.json()).content;
29
- }, l[5] = v, l[6] = w);
30
- let T = !!v && v.type === "file", E;
31
- l[7] !== C || l[8] !== w || l[9] !== T ? (E = {
32
- queryKey: C,
33
- queryFn: w,
34
- enabled: T,
35
- staleTime: 15e3
36
- }, l[7] = C, l[8] = w, l[9] = T, l[10] = E) : E = l[10];
37
- let D = useQuery(E), O;
38
- l[11] === Symbol.for("react.memo_cache_sentinel") ? (O = (e) => {
39
- m((s) => {
40
- let l = new Set(s);
41
- return l.has(e) ? l.delete(e) : l.add(e), l;
42
+ return (await u.json()).content;
43
+ }, u[5] = y, u[6] = T);
44
+ let E = !!y && y.type === "file", D;
45
+ u[7] !== w || u[8] !== T || u[9] !== E ? (D = {
46
+ queryKey: w,
47
+ queryFn: T,
48
+ enabled: E,
49
+ staleTime: 15e3,
50
+ retry: !1
51
+ }, u[7] = w, u[8] = T, u[9] = E, u[10] = D) : D = u[10];
52
+ let O = useQuery(D), k;
53
+ u[11] === Symbol.for("react.memo_cache_sentinel") ? (k = (e) => {
54
+ h((l) => {
55
+ let u = new Set(l);
56
+ return u.has(e) ? u.delete(e) : u.add(e), u;
42
57
  });
43
- }, l[11] = O) : O = l[11];
44
- let k = O, A;
45
- l[12] === Symbol.for("react.memo_cache_sentinel") ? (A = (e) => {
46
- e.type === "file" && (y(e), _((s) => s.some((s) => s.path === e.path) ? s : [...s, e]));
47
- }, l[12] = A) : A = l[12];
48
- let j = A, M;
49
- l[13] === v?.path ? M = l[14] : (M = (e) => {
50
- _((s) => {
51
- let l = s.filter((s) => s.path !== e.path);
52
- if (v?.path === e.path) if (l.length > 0) {
53
- let u = s.findIndex((s) => s.path === e.path);
54
- y(l[Math.max(0, u - 1)]);
55
- } else y(null);
56
- return l;
58
+ }, u[11] = k) : k = u[11];
59
+ let A = k, j;
60
+ u[12] === Symbol.for("react.memo_cache_sentinel") ? (j = (e) => {
61
+ e.type === "file" && (b(e), v((l) => l.some((l) => l.path === e.path) ? l : [...l, e]));
62
+ }, u[12] = j) : j = u[12];
63
+ let M = j, N;
64
+ u[13] === y?.path ? N = u[14] : (N = (e) => {
65
+ v((l) => {
66
+ let u = l.filter((l) => l.path !== e.path);
67
+ if (y?.path === e.path) if (u.length > 0) {
68
+ let d = l.findIndex((l) => l.path === e.path);
69
+ b(u[Math.max(0, d - 1)]);
70
+ } else b(null);
71
+ return u;
57
72
  });
58
- }, l[13] = v?.path, l[14] = M);
59
- let N = M, P;
60
- l[15] === v ? P = l[16] : (P = () => {
61
- v && _((e) => {
62
- let s = e.filter((e) => e.path !== v.path);
63
- if (s.length > 0) {
64
- let l = e.findIndex((e) => e.path === v.path);
65
- y(s[Math.max(0, l - 1)]);
66
- } else y(null);
67
- return s;
73
+ }, u[13] = y?.path, u[14] = N);
74
+ let P = N, F;
75
+ u[15] === y ? F = u[16] : (F = () => {
76
+ y && v((e) => {
77
+ let l = e.filter((e) => e.path !== y.path);
78
+ if (l.length > 0) {
79
+ let u = e.findIndex((e) => e.path === y.path);
80
+ b(l[Math.max(0, u - 1)]);
81
+ } else b(null);
82
+ return l;
68
83
  });
69
- }, l[15] = v, l[16] = P);
70
- let F = P, I;
71
- l[17] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
72
- _([]), y(null);
73
- }, l[17] = I) : I = l[17];
74
- let L = I, R;
75
- l[18] === Symbol.for("react.memo_cache_sentinel") ? (R = (e) => {
76
- _([e]), y(e);
77
- }, l[18] = R) : R = l[18];
78
- let z = R, B;
79
- l[19] === v ? B = l[20] : (B = (e) => {
80
- _((s) => {
81
- let l = s.findIndex((s) => s.path === e.path);
82
- if (l <= 0) return s;
83
- let u = s.slice(l);
84
- return v && s.findIndex((e) => e.path === v.path) < l && y(e), u;
84
+ }, u[15] = y, u[16] = F);
85
+ let I = F, L;
86
+ u[17] === Symbol.for("react.memo_cache_sentinel") ? (L = () => {
87
+ v([]), b(null);
88
+ }, u[17] = L) : L = u[17];
89
+ let R = L, z;
90
+ u[18] === Symbol.for("react.memo_cache_sentinel") ? (z = (e) => {
91
+ v([e]), b(e);
92
+ }, u[18] = z) : z = u[18];
93
+ let B = z, V;
94
+ u[19] === y ? V = u[20] : (V = (e) => {
95
+ v((l) => {
96
+ let u = l.findIndex((l) => l.path === e.path);
97
+ if (u <= 0) return l;
98
+ let d = l.slice(u);
99
+ return y && l.findIndex((e) => e.path === y.path) < u && b(e), d;
85
100
  });
86
- }, l[19] = v, l[20] = B);
87
- let V = B, H;
88
- l[21] === v ? H = l[22] : (H = (e) => {
89
- _((s) => {
90
- let l = s.findIndex((s) => s.path === e.path);
91
- if (l < 0 || l >= s.length - 1) return s;
92
- let u = s.slice(0, l + 1);
93
- return v && s.findIndex((e) => e.path === v.path) > l && y(e), u;
101
+ }, u[19] = y, u[20] = V);
102
+ let H = V, U;
103
+ u[21] === y ? U = u[22] : (U = (e) => {
104
+ v((l) => {
105
+ let u = l.findIndex((l) => l.path === e.path);
106
+ if (u < 0 || u >= l.length - 1) return l;
107
+ let d = l.slice(0, u + 1);
108
+ return y && l.findIndex((e) => e.path === y.path) > u && b(e), d;
94
109
  });
95
- }, l[21] = v, l[22] = H);
96
- let U = H, W;
97
- l[23] === d ? W = l[24] : (W = () => {
98
- d.invalidateQueries({ queryKey: ["remote-agent-file-tree"] });
99
- }, l[23] = d, l[24] = W);
100
- let G = W, K;
101
- l[25] === x.data ? K = l[26] : (K = x.data ?? [], l[25] = x.data, l[26] = K);
102
- let q = x.isLoading && !x.data, J = D.data ?? null, Y = D.isLoading && !!v, X;
103
- l[27] !== F || l[28] !== N || l[29] !== V || l[30] !== U || l[31] !== p || l[32] !== g || l[33] !== G || l[34] !== v || l[35] !== K || l[36] !== q || l[37] !== J || l[38] !== Y || l[39] !== x.error || l[40] !== x.isFetching ? (X = {
104
- nodes: K,
105
- isTreeLoading: q,
106
- treeError: x.error,
107
- openFiles: g,
108
- selectedFile: v,
109
- fileContent: J,
110
- isContentLoading: Y,
111
- expandedFolders: p,
112
- toggleFolder: k,
113
- selectFile: j,
114
- closeFile: N,
115
- closeAll: L,
116
- closeOthers: z,
117
- closeToLeft: V,
118
- closeToRight: U,
119
- clearSelection: F,
120
- refreshTree: G,
121
- isFetchingTree: x.isFetching
122
- }, l[27] = F, l[28] = N, l[29] = V, l[30] = U, l[31] = p, l[32] = g, l[33] = G, l[34] = v, l[35] = K, l[36] = q, l[37] = J, l[38] = Y, l[39] = x.error, l[40] = x.isFetching, l[41] = X) : X = l[41];
123
- let Z = X, Q;
124
- return l[42] !== u || l[43] !== Z ? (Q = /* @__PURE__ */ jsx(RemoteFileExplorerContext.Provider, {
125
- value: Z,
126
- children: u
127
- }), l[42] = u, l[43] = Z, l[44] = Q) : Q = l[44], Q;
110
+ }, u[21] = y, u[22] = U);
111
+ let W = U, G;
112
+ u[23] === f ? G = u[24] : (G = () => {
113
+ f.invalidateQueries({ queryKey: ["remote-agent-file-tree"] });
114
+ }, u[23] = f, u[24] = G);
115
+ let K = G, q;
116
+ u[25] === S.data ? q = u[26] : (q = S.data ?? [], u[25] = S.data, u[26] = q);
117
+ let J = S.isLoading && !S.data, Y = O.data ?? null, X = O.isLoading && !!y, Z;
118
+ u[27] !== I || u[28] !== P || u[29] !== H || u[30] !== W || u[31] !== m || u[32] !== _ || u[33] !== K || u[34] !== y || u[35] !== q || u[36] !== J || u[37] !== Y || u[38] !== X || u[39] !== S.error || u[40] !== S.isFetching ? (Z = {
119
+ nodes: q,
120
+ isTreeLoading: J,
121
+ treeError: S.error,
122
+ openFiles: _,
123
+ selectedFile: y,
124
+ fileContent: Y,
125
+ isContentLoading: X,
126
+ expandedFolders: m,
127
+ toggleFolder: A,
128
+ selectFile: M,
129
+ closeFile: P,
130
+ closeAll: R,
131
+ closeOthers: B,
132
+ closeToLeft: H,
133
+ closeToRight: W,
134
+ clearSelection: I,
135
+ refreshTree: K,
136
+ isFetchingTree: S.isFetching
137
+ }, u[27] = I, u[28] = P, u[29] = H, u[30] = W, u[31] = m, u[32] = _, u[33] = K, u[34] = y, u[35] = q, u[36] = J, u[37] = Y, u[38] = X, u[39] = S.error, u[40] = S.isFetching, u[41] = Z) : Z = u[41];
138
+ let Q = Z, $;
139
+ return u[42] !== d || u[43] !== Q ? ($ = /* @__PURE__ */ jsx(RemoteFileExplorerContext.Provider, {
140
+ value: Q,
141
+ children: d
142
+ }), u[42] = d, u[43] = Q, u[44] = $) : $ = u[44], $;
128
143
  }
129
144
  async function _temp() {
130
- let e = await fetch("http://localhost:8000/api/v1/files/tree?path=./src", { credentials: "include" });
145
+ let e = await fetchWithRefresh(`${getBaseUrl()}/api/v1/files/tree?path=./src`, { credentials: "include" });
131
146
  if (!e.ok) {
132
- let s = await e.text();
133
- throw Error(`Failed to load file tree (${e.status}): ${s}`);
147
+ let l = await e.text();
148
+ throw Error(`Failed to load file tree (${e.status}): ${l}`);
134
149
  }
135
150
  return await e.json();
136
151
  }
@@ -1,4 +1,4 @@
1
- import { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey } from "./query-keys.js";
1
+ import { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getSecretsCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey } from "./query-keys.js";
2
2
  import { useApiClient } from "./useApi.js";
3
3
  import { useIsMobile } from "./use-mobile.js";
4
4
  import { useAvailableEnvironments, usePipelineConfig, useWorkspaceConfig } from "./useConfig.js";
@@ -7,11 +7,11 @@ function getHealthCacheKey(e) {
7
7
  function getWorkspaceTypesCacheKey(e) {
8
8
  return ["workspace-types", e];
9
9
  }
10
- function getPipelineTypesCacheKey(e, x) {
10
+ function getPipelineTypesCacheKey(e, S) {
11
11
  return [
12
12
  "pipeline-types",
13
13
  e,
14
- x
14
+ S
15
15
  ];
16
16
  }
17
17
  function getAvailableEnvironmentsCacheKey(e) {
@@ -24,115 +24,122 @@ function getDashboardStatsCacheKey(e) {
24
24
  e
25
25
  ];
26
26
  }
27
- function getPipelineCacheKey(e, x) {
27
+ function getPipelineCacheKey(e, S) {
28
28
  return [
29
29
  "pipeline",
30
30
  e,
31
- x
31
+ S
32
32
  ];
33
33
  }
34
34
  function getPipelinesCacheKey(e) {
35
35
  return ["pipelines", e];
36
36
  }
37
- function getPipelinesChildrenCacheKey(e, x) {
37
+ function getPipelinesChildrenCacheKey(e, S) {
38
38
  return [
39
39
  "pipelines",
40
40
  "children",
41
41
  e,
42
- x
42
+ S
43
43
  ];
44
44
  }
45
- function getPipelineConfigCacheKey(e, x, S) {
45
+ function getPipelineConfigCacheKey(e, S, C) {
46
46
  return [
47
47
  "pipelineConfig",
48
48
  e,
49
- x,
50
- S
49
+ S,
50
+ C
51
51
  ];
52
52
  }
53
- function getPipelineSourceCacheKey(e, x, S) {
53
+ function getPipelineSourceCacheKey(e, S, C) {
54
54
  return [
55
55
  "pipelineSource",
56
56
  e,
57
- x,
58
- S
57
+ S,
58
+ C
59
59
  ];
60
60
  }
61
- function getWorkspaceCacheKey(e, x) {
61
+ function getWorkspaceCacheKey(e, S) {
62
62
  return [
63
63
  "workspace",
64
64
  e,
65
- x
65
+ S
66
66
  ];
67
67
  }
68
68
  function getWorkspacesCacheKey(e) {
69
69
  return ["workspaces", e];
70
70
  }
71
- function getWorkflowCacheKey(e, x) {
71
+ function getWorkflowCacheKey(e, S) {
72
72
  return [
73
73
  "workflow",
74
74
  e,
75
- x
75
+ S
76
76
  ];
77
77
  }
78
- function getWorkflowsCacheKey(e, x) {
78
+ function getWorkflowsCacheKey(e, S) {
79
79
  return [
80
80
  "workflows",
81
81
  e,
82
- x
82
+ S
83
83
  ];
84
84
  }
85
- function getWorkflowsByPipelineCacheKey(e, x) {
85
+ function getWorkflowsByPipelineCacheKey(e, S) {
86
86
  return [
87
87
  "workflows-by-pipeline",
88
88
  e,
89
- x
89
+ S
90
90
  ];
91
91
  }
92
92
  function getAllWorkflowsCacheKey(e) {
93
93
  return ["all-workflows", e];
94
94
  }
95
- function getNamespaceCacheKey(e, x) {
95
+ function getNamespaceCacheKey(e, S) {
96
96
  return [
97
97
  "namespace",
98
98
  e,
99
- x
99
+ S
100
100
  ];
101
101
  }
102
- function getNamespacesByPipelineCacheKey(e, x) {
102
+ function getNamespacesByPipelineCacheKey(e, S) {
103
103
  return [
104
104
  "namespaces",
105
105
  e,
106
- x
106
+ S
107
107
  ];
108
108
  }
109
- function getDocumentCacheKey(e, x) {
109
+ function getDocumentCacheKey(e, S) {
110
110
  return [
111
111
  "document",
112
112
  e,
113
- x
113
+ S
114
114
  ];
115
115
  }
116
- function getDocumentsCacheKey(e, x) {
116
+ function getDocumentsCacheKey(e, S) {
117
117
  return [
118
118
  "documents",
119
119
  e,
120
- x
120
+ S
121
+ ];
122
+ }
123
+ function getSecretsCacheKey(e, S) {
124
+ return [
125
+ "secrets",
126
+ e,
127
+ S
121
128
  ];
122
129
  }
123
- function getFileTreeCacheKey(e, x) {
130
+ function getFileTreeCacheKey(e, S) {
124
131
  return [
125
132
  "fileTree",
126
133
  e,
127
- x
134
+ S
128
135
  ];
129
136
  }
130
- function getFileContentCacheKey(e, x, S) {
137
+ function getFileContentCacheKey(e, S, C) {
131
138
  return [
132
139
  "fileContent",
133
140
  e,
134
- x,
135
- S
141
+ S,
142
+ C
136
143
  ];
137
144
  }
138
- export { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey };
145
+ export { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getSecretsCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey };
@@ -0,0 +1,69 @@
1
+ import { getSecretsCacheKey } from "./query-keys.js";
2
+ import { useApiClient } from "./useApi.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
+ function useWorkspaceSecrets(r) {
6
+ let a = c(10), { envKey: o, api: s } = useApiClient(), l;
7
+ a[0] !== o || a[1] !== r ? (l = getSecretsCacheKey(o, r), a[0] = o, a[1] = r, a[2] = l) : l = a[2];
8
+ let u;
9
+ a[3] !== s || a[4] !== r ? (u = () => s.secrets.getByWorkspaceId({ workspaceId: r }), a[3] = s, a[4] = r, a[5] = u) : u = a[5];
10
+ let d = !!r, f;
11
+ return a[6] !== l || a[7] !== u || a[8] !== d ? (f = {
12
+ queryKey: l,
13
+ queryFn: u,
14
+ enabled: d
15
+ }, a[6] = l, a[7] = u, a[8] = d, a[9] = f) : f = a[9], useQuery(f);
16
+ }
17
+ function useCreateSecret() {
18
+ let i = c(8), { envKey: o, api: s } = useApiClient(), l = useQueryClient(), u;
19
+ i[0] === s ? u = i[1] : (u = (e) => s.secrets.create(e), i[0] = s, i[1] = u);
20
+ let d;
21
+ i[2] !== o || i[3] !== l ? (d = (t, n) => {
22
+ l.invalidateQueries({ queryKey: getSecretsCacheKey(o, n.workspaceId) });
23
+ }, i[2] = o, i[3] = l, i[4] = d) : d = i[4];
24
+ let f;
25
+ return i[5] !== u || i[6] !== d ? (f = {
26
+ mutationFn: u,
27
+ onSuccess: d
28
+ }, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useMutation(f);
29
+ }
30
+ function useUpdateSecret() {
31
+ let i = c(8), { envKey: o, api: s } = useApiClient(), l = useQueryClient(), u;
32
+ i[0] === s ? u = i[1] : (u = (e) => s.secrets.update(e), i[0] = s, i[1] = u);
33
+ let d;
34
+ i[2] !== o || i[3] !== l ? (d = (t, n) => {
35
+ l.invalidateQueries({ queryKey: getSecretsCacheKey(o, n.workspaceId) });
36
+ }, i[2] = o, i[3] = l, i[4] = d) : d = i[4];
37
+ let f;
38
+ return i[5] !== u || i[6] !== d ? (f = {
39
+ mutationFn: u,
40
+ onSuccess: d
41
+ }, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useMutation(f);
42
+ }
43
+ function useUpsertSecret() {
44
+ let i = c(8), { envKey: o, api: s } = useApiClient(), l = useQueryClient(), u;
45
+ i[0] === s ? u = i[1] : (u = (e) => s.secrets.upsert(e), i[0] = s, i[1] = u);
46
+ let d;
47
+ i[2] !== o || i[3] !== l ? (d = (t, n) => {
48
+ l.invalidateQueries({ queryKey: getSecretsCacheKey(o, n.workspaceId) });
49
+ }, i[2] = o, i[3] = l, i[4] = d) : d = i[4];
50
+ let f;
51
+ return i[5] !== u || i[6] !== d ? (f = {
52
+ mutationFn: u,
53
+ onSuccess: d
54
+ }, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useMutation(f);
55
+ }
56
+ function useDeleteSecret() {
57
+ let i = c(8), { envKey: o, api: s } = useApiClient(), l = useQueryClient(), u;
58
+ i[0] === s ? u = i[1] : (u = (e) => s.secrets.delete(e), i[0] = s, i[1] = u);
59
+ let d;
60
+ i[2] !== o || i[3] !== l ? (d = (t, n) => {
61
+ l.invalidateQueries({ queryKey: getSecretsCacheKey(o, n.workspaceId) });
62
+ }, i[2] = o, i[3] = l, i[4] = d) : d = i[4];
63
+ let f;
64
+ return i[5] !== u || i[6] !== d ? (f = {
65
+ mutationFn: u,
66
+ onSuccess: d
67
+ }, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useMutation(f);
68
+ }
69
+ export { useCreateSecret, useDeleteSecret, useUpdateSecret, useUpsertSecret, useWorkspaceSecrets };
package/dist/index.d.ts CHANGED
@@ -334,6 +334,41 @@ declare function createApi(http: AxiosInstance): {
334
334
  force?: boolean;
335
335
  }) => Promise<void>;
336
336
  };
337
+ secrets: {
338
+ getByWorkspaceId: (params: {
339
+ workspaceId: string;
340
+ }) => Promise<SecretItem[]>;
341
+ create: (params: {
342
+ workspaceId: string;
343
+ key: string;
344
+ value: string;
345
+ }) => Promise<{
346
+ id: string;
347
+ key: string;
348
+ }>;
349
+ upsert: (params: {
350
+ workspaceId: string;
351
+ key: string;
352
+ value: string;
353
+ }) => Promise<{
354
+ id: string;
355
+ key: string;
356
+ }>;
357
+ update: (params: {
358
+ workspaceId: string;
359
+ id: string;
360
+ value?: string;
361
+ }) => Promise<{
362
+ id: string;
363
+ key: string;
364
+ }>;
365
+ delete: (params: {
366
+ workspaceId: string;
367
+ id: string;
368
+ }) => Promise<{
369
+ success: boolean;
370
+ }>;
371
+ };
337
372
  workflows: {
338
373
  getById: (params: {
339
374
  id: string;
@@ -725,6 +760,8 @@ export declare function getPipelineSourceCacheKey(envKey: string, workspaceBlock
725
760
 
726
761
  export declare function getPipelineTypesCacheKey(envKey: string, workspaceBlockName: string): string[];
727
762
 
763
+ export declare function getSecretsCacheKey(envKey: string, workspaceId: string): string[];
764
+
728
765
  export declare function getWorkflowCacheKey(envKey: string, workflowId: string): string[];
729
766
 
730
767
  export declare function getWorkflowsByPipelineCacheKey(envKey: string, pipelineId: string): string[];
@@ -955,6 +992,12 @@ export declare function ScrollArea({ className, children, ...props }: React_2.Co
955
992
 
956
993
  export declare function ScrollBar({ className, orientation, ...props }: React_2.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): JSX.Element;
957
994
 
995
+ declare interface SecretItem {
996
+ id: string;
997
+ key: string;
998
+ hasValue: boolean;
999
+ }
1000
+
958
1001
  export declare function Select({ ...props }: React_2.ComponentProps<typeof SelectPrimitive.Root>): JSX.Element;
959
1002
 
960
1003
  export declare function SelectContent({ className, children, position, align, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Content>): JSX.Element;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey } from "./hooks/query-keys.js";
1
+ import { getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getSecretsCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey } from "./hooks/query-keys.js";
2
2
  import { createApiClient } from "./services/createApiClient.js";
3
3
  import { eventBus } from "./services/eventEmitter.js";
4
4
  import "./services/index.js";
@@ -82,4 +82,4 @@ import LocalHealthCheck_default from "./features/health/LocalHealthCheck.js";
82
82
  import EnvironmentEmbedRoot from "./app/EnvironmentEmbedRoot.js";
83
83
  import { StudioSidebar } from "./components/layout/StudioSidebar.js";
84
84
  import "./features/health/index.js";
85
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, CompletionMessagePaper_default as CompletionMessagePaper, ComponentOverridesProvider, ConfirmDialog_default as ConfirmDialog, CreateWorkspace_default as CreateWorkspace, CustomListView_default as CustomItemListView, DashboardPage, DataList, DataTable, DataTableBatchAction_default as DataTableBatchActions, DataTableFilters_default as DataTableFilters, DataTablePagination_default as DataTablePagination, DataTableToolbar_default as DataTableToolbar, DebugPage_default as DebugPage, DebugWorkflowDetailsPage, DebugWorkflowsPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscordLogo, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmbedWorkbenchPage, EnvironmentEmbedRoot, EnvironmentSlotSelector, ErrorAlert_default as ErrorAlert, ErrorBoundary, ErrorSnackbar_default as ErrorSnackbar, GoogleLogo, Input, InvalidationEventsProvider, ListView_default as ItemListView, Label, LoadingCentered_default as LoadingCentered, LocalHealthCheck_default as LocalHealthCheck, LocalRouter, MainLayout_default as MainLayout, PageBreadcrumbs_default as PageBreadcrumbs, PipelineDebugPage_default as PipelineDebugPage, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreviewWorkbenchPage, RadioGroup, RadioGroupItem, RunsListPage, RunsPage, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarInsetDiv, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDiv, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Snackbar_default as Snackbar, SseProvider, StudioLandingPage, StudioProvider, StudioSidebar, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WorkbenchPage, WorkspacePage_default as WorkspacePage, WorkspaceRunsPage_default as WorkspaceRunsPage, WorkspacesPage, badgeVariants, buttonVariants, createApiClient, eventBus, getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey, useApiClient, useAvailableEnvironments, useBatchDeletePipeline, useBatchDeleteWorkspaces, useChildPipelines, useComponentOverrides, useCreatePipeline, useCreateWorkspace, useDeletePipeline, useDeleteWorkspace, useFilterPipelines, useFilterWorkspaces, useIsMobile, usePipeline, usePipelineConfig, usePipelineConfigByName, usePipelineSource, useRouter, useSetFavouriteWorkspace, useSidebar, useStudio, useStudioOptional, useUpdatePipeline, useUpdateWorkspace, useWorkspace, useWorkspaceConfig };
85
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, CompletionMessagePaper_default as CompletionMessagePaper, ComponentOverridesProvider, ConfirmDialog_default as ConfirmDialog, CreateWorkspace_default as CreateWorkspace, CustomListView_default as CustomItemListView, DashboardPage, DataList, DataTable, DataTableBatchAction_default as DataTableBatchActions, DataTableFilters_default as DataTableFilters, DataTablePagination_default as DataTablePagination, DataTableToolbar_default as DataTableToolbar, DebugPage_default as DebugPage, DebugWorkflowDetailsPage, DebugWorkflowsPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscordLogo, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmbedWorkbenchPage, EnvironmentEmbedRoot, EnvironmentSlotSelector, ErrorAlert_default as ErrorAlert, ErrorBoundary, ErrorSnackbar_default as ErrorSnackbar, GoogleLogo, Input, InvalidationEventsProvider, ListView_default as ItemListView, Label, LoadingCentered_default as LoadingCentered, LocalHealthCheck_default as LocalHealthCheck, LocalRouter, MainLayout_default as MainLayout, PageBreadcrumbs_default as PageBreadcrumbs, PipelineDebugPage_default as PipelineDebugPage, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreviewWorkbenchPage, RadioGroup, RadioGroupItem, RunsListPage, RunsPage, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarInsetDiv, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDiv, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Snackbar_default as Snackbar, SseProvider, StudioLandingPage, StudioProvider, StudioSidebar, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WorkbenchPage, WorkspacePage_default as WorkspacePage, WorkspaceRunsPage_default as WorkspaceRunsPage, WorkspacesPage, badgeVariants, buttonVariants, createApiClient, eventBus, getAllWorkflowsCacheKey, getAvailableEnvironmentsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getHealthCacheKey, getMeCacheKey, getNamespaceCacheKey, getNamespacesByPipelineCacheKey, getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelineTypesCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey, getSecretsCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspaceTypesCacheKey, getWorkspacesCacheKey, useApiClient, useAvailableEnvironments, useBatchDeletePipeline, useBatchDeleteWorkspaces, useChildPipelines, useComponentOverrides, useCreatePipeline, useCreateWorkspace, useDeletePipeline, useDeleteWorkspace, useFilterPipelines, useFilterWorkspaces, useIsMobile, usePipeline, usePipelineConfig, usePipelineConfigByName, usePipelineSource, useRouter, useSetFavouriteWorkspace, useSidebar, useStudio, useStudioOptional, useUpdatePipeline, useUpdateWorkspace, useWorkspace, useWorkspaceConfig };