@rebasepro/studio 0.6.0 → 0.7.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/ApiKeysView-D-_FSlNL.js +684 -0
- package/dist/ApiKeysView-D-_FSlNL.js.map +1 -0
- package/dist/{BranchesView-DncIRcZt.js → BranchesView-Dlg78EQ8.js} +4 -5
- package/dist/{BranchesView-DncIRcZt.js.map → BranchesView-Dlg78EQ8.js.map} +1 -1
- package/dist/{JSEditor-BhAbEjCP.js → JSEditor-DSucz6wV.js} +4 -4
- package/dist/{JSEditor-BhAbEjCP.js.map → JSEditor-DSucz6wV.js.map} +1 -1
- package/dist/{LogsExplorer-CqtKILj8.js → LogsExplorer-J4xfsuv3.js} +49 -83
- package/dist/LogsExplorer-J4xfsuv3.js.map +1 -0
- package/dist/{RLSEditor-CTxYbBdW.js → RLSEditor-BM64laoW.js} +483 -289
- package/dist/RLSEditor-BM64laoW.js.map +1 -0
- package/dist/{SQLEditor-BLuq_zDM.js → SQLEditor-CuAhR-zr.js} +4 -4
- package/dist/{SQLEditor-BLuq_zDM.js.map → SQLEditor-CuAhR-zr.js.map} +1 -1
- package/dist/{SchemaVisualizer-BJK2u3C0.js → SchemaVisualizer-OibKoD3g.js} +2 -2
- package/dist/{SchemaVisualizer-BJK2u3C0.js.map → SchemaVisualizer-OibKoD3g.js.map} +1 -1
- package/dist/{StorageView-nDaC2foF.js → StorageView-CvrnHmDG.js} +89 -76
- package/dist/StorageView-CvrnHmDG.js.map +1 -0
- package/dist/components/ApiKeys/ApiKeysView.d.ts +2 -0
- package/dist/index.es.js +38 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1358 -489
- package/dist/index.umd.js.map +1 -1
- package/package.json +17 -17
- package/src/components/ApiKeys/ApiKeysView.tsx +580 -0
- package/src/components/Branches/BranchesView.tsx +3 -4
- package/src/components/JSEditor/JSEditorSidebar.tsx +3 -3
- package/src/components/LogsExplorer/LogsExplorer.tsx +46 -84
- package/src/components/RLSEditor/PolicyEditor.tsx +1 -0
- package/src/components/RLSEditor/RLSEditor.tsx +354 -117
- package/src/components/RebaseStudio.tsx +10 -1
- package/src/components/SQLEditor/SchemaBrowser.tsx +3 -3
- package/src/components/StorageView/StorageView.tsx +3 -3
- package/src/components/StudioHomePage.tsx +5 -1
- package/dist/LogsExplorer-CqtKILj8.js.map +0 -1
- package/dist/RLSEditor-CTxYbBdW.js.map +0 -1
- package/dist/StorageView-nDaC2foF.js.map +0 -1
|
@@ -249,7 +249,7 @@ export const JSEditorSidebar = ({
|
|
|
249
249
|
[...history].reverse().map((code, i) => (
|
|
250
250
|
<div
|
|
251
251
|
key={i}
|
|
252
|
-
className="p-2 py-1.5 rounded hover:bg-surface-100 dark:hover:bg-surface-
|
|
252
|
+
className="p-2 py-1.5 rounded hover:bg-surface-100 dark:hover:bg-surface-900 cursor-pointer group transition-colors flex items-start"
|
|
253
253
|
onClick={() => onSelectSnippet(code)}
|
|
254
254
|
>
|
|
255
255
|
<svg className="w-3 h-3 mt-1 mr-2 text-text-disabled dark:text-text-disabled-dark group-hover:text-primary transition-colors flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
@@ -277,7 +277,7 @@ function CollectionItem({ collection, onInsertCode }: { collection: CollectionIn
|
|
|
277
277
|
return (
|
|
278
278
|
<div>
|
|
279
279
|
<div
|
|
280
|
-
className="flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-
|
|
280
|
+
className="flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-900 rounded transition-colors group relative"
|
|
281
281
|
onClick={() => setExpanded(!expanded)}
|
|
282
282
|
>
|
|
283
283
|
<svg
|
|
@@ -310,7 +310,7 @@ function CollectionItem({ collection, onInsertCode }: { collection: CollectionIn
|
|
|
310
310
|
{collection.properties.map(prop => (
|
|
311
311
|
<div
|
|
312
312
|
key={prop}
|
|
313
|
-
className="flex items-center p-1 pl-2 hover:bg-surface-50 dark:hover:bg-surface-
|
|
313
|
+
className="flex items-center p-1 pl-2 hover:bg-surface-50 dark:hover:bg-surface-900 rounded-r cursor-pointer transition-colors group/prop relative min-h-[28px]"
|
|
314
314
|
onClick={() => onInsertCode(`"${prop}"`)}
|
|
315
315
|
>
|
|
316
316
|
<svg className="w-3 h-3 mr-1.5 text-text-disabled dark:text-text-disabled-dark shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 4.5v15m6-15v15m-10.5-1.5h15c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125h-15c-.621 0-1.125.504-1.125 1.125v12.75c0 .621.504 1.125 1.125 1.125Z"/></svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
2
|
-
import { Select, SelectItem, TextField, Checkbox, Label } from "@rebasepro/ui";
|
|
2
|
+
import { Select, SelectItem, TextField, Checkbox, Label, Typography, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
3
3
|
|
|
4
4
|
interface LogEntry {
|
|
5
5
|
id: string;
|
|
@@ -11,32 +11,32 @@ interface LogEntry {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const LEVEL_COLORS: Record<string, string> = {
|
|
14
|
-
debug: "
|
|
15
|
-
info: "
|
|
16
|
-
warn: "
|
|
17
|
-
error: "
|
|
14
|
+
debug: "text-surface-500",
|
|
15
|
+
info: "text-blue-600 dark:text-blue-500",
|
|
16
|
+
warn: "text-amber-600 dark:text-amber-500",
|
|
17
|
+
error: "text-red-600 dark:text-red-500"
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const SOURCE_COLORS: Record<string, string> = {
|
|
21
|
-
api: "
|
|
22
|
-
auth: "
|
|
23
|
-
storage: "
|
|
24
|
-
realtime: "
|
|
25
|
-
system: "
|
|
21
|
+
api: "text-sky-600 dark:text-sky-400",
|
|
22
|
+
auth: "text-purple-600 dark:text-purple-400",
|
|
23
|
+
storage: "text-green-600 dark:text-green-500",
|
|
24
|
+
realtime: "text-orange-600 dark:text-orange-400",
|
|
25
|
+
system: "text-surface-600 dark:text-surface-400"
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export function LogsExplorer() {
|
|
29
29
|
const [logs, setLogs] = useState<LogEntry[]>([]);
|
|
30
|
-
const [level, setLevel] = useState<string>("");
|
|
31
|
-
const [source, setSource] = useState<string>("");
|
|
30
|
+
const [level, setLevel] = useState<string>("all");
|
|
31
|
+
const [source, setSource] = useState<string>("all");
|
|
32
32
|
const [search, setSearch] = useState("");
|
|
33
33
|
const [autoScroll, setAutoScroll] = useState(true);
|
|
34
34
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
35
35
|
const fetchLogs = useCallback(async () => {
|
|
36
36
|
try {
|
|
37
37
|
const params = new URLSearchParams();
|
|
38
|
-
if (level) params.set("level", level);
|
|
39
|
-
if (source) params.set("source", source);
|
|
38
|
+
if (level && level !== "all") params.set("level", level);
|
|
39
|
+
if (source && source !== "all") params.set("source", source);
|
|
40
40
|
if (search) params.set("search", search);
|
|
41
41
|
params.set("limit", "200");
|
|
42
42
|
|
|
@@ -88,38 +88,20 @@ export function LogsExplorer() {
|
|
|
88
88
|
}
|
|
89
89
|
}, [logs, autoScroll]);
|
|
90
90
|
|
|
91
|
-
const selectStyle: React.CSSProperties = {
|
|
92
|
-
background: "#313244",
|
|
93
|
-
color: "#cdd6f4",
|
|
94
|
-
border: "1px solid #45475a",
|
|
95
|
-
borderRadius: 4,
|
|
96
|
-
padding: "4px 8px"
|
|
97
|
-
};
|
|
98
|
-
|
|
99
91
|
return (
|
|
100
|
-
<div
|
|
101
|
-
display: "flex",
|
|
102
|
-
flexDirection: "column",
|
|
103
|
-
height: "calc(100vh - 64px)",
|
|
104
|
-
background: "#1e1e2e",
|
|
105
|
-
color: "#cdd6f4"
|
|
106
|
-
}}>
|
|
92
|
+
<div className="flex flex-col h-[calc(100vh-64px)] w-full bg-surface-50 dark:bg-surface-800">
|
|
107
93
|
{/* Toolbar */}
|
|
108
|
-
<div
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
borderBottom: "1px solid #313244",
|
|
113
|
-
alignItems: "center",
|
|
114
|
-
flexWrap: "wrap"
|
|
115
|
-
}}>
|
|
94
|
+
<div className={cls(
|
|
95
|
+
"flex gap-2 p-3 border-b items-center flex-wrap shrink-0",
|
|
96
|
+
defaultBorderMixin
|
|
97
|
+
)}>
|
|
116
98
|
<Select
|
|
117
99
|
value={level}
|
|
118
100
|
onValueChange={setLevel}
|
|
119
101
|
size="small"
|
|
120
102
|
placeholder="All Levels"
|
|
121
103
|
>
|
|
122
|
-
<SelectItem value="">All Levels</SelectItem>
|
|
104
|
+
<SelectItem value="all">All Levels</SelectItem>
|
|
123
105
|
<SelectItem value="debug">Debug</SelectItem>
|
|
124
106
|
<SelectItem value="info">Info</SelectItem>
|
|
125
107
|
<SelectItem value="warn">Warn</SelectItem>
|
|
@@ -131,7 +113,7 @@ export function LogsExplorer() {
|
|
|
131
113
|
size="small"
|
|
132
114
|
placeholder="All Sources"
|
|
133
115
|
>
|
|
134
|
-
<SelectItem value="">All Sources</SelectItem>
|
|
116
|
+
<SelectItem value="all">All Sources</SelectItem>
|
|
135
117
|
<SelectItem value="api">API</SelectItem>
|
|
136
118
|
<SelectItem value="auth">Auth</SelectItem>
|
|
137
119
|
<SelectItem value="storage">Storage</SelectItem>
|
|
@@ -145,7 +127,7 @@ export function LogsExplorer() {
|
|
|
145
127
|
onChange={e => setSearch(e.target.value)}
|
|
146
128
|
className="flex-1 min-w-[200px]"
|
|
147
129
|
/>
|
|
148
|
-
<div className="flex items-center gap-1.5 cursor-pointer">
|
|
130
|
+
<div className="flex items-center gap-1.5 cursor-pointer ml-2">
|
|
149
131
|
<Checkbox
|
|
150
132
|
id="auto-scroll"
|
|
151
133
|
checked={autoScroll}
|
|
@@ -155,70 +137,50 @@ export function LogsExplorer() {
|
|
|
155
137
|
/>
|
|
156
138
|
<Label
|
|
157
139
|
htmlFor="auto-scroll"
|
|
158
|
-
className="text-xs select-none cursor-pointer"
|
|
140
|
+
className="text-xs select-none cursor-pointer text-surface-600 dark:text-surface-400"
|
|
159
141
|
>
|
|
160
142
|
Auto-scroll
|
|
161
143
|
</Label>
|
|
162
144
|
</div>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
145
|
+
<div className="ml-auto pl-4">
|
|
146
|
+
<Typography variant="caption" color="secondary">
|
|
147
|
+
{logs.length} entries
|
|
148
|
+
</Typography>
|
|
149
|
+
</div>
|
|
167
150
|
</div>
|
|
151
|
+
|
|
168
152
|
{/* Log entries */}
|
|
169
153
|
<div
|
|
170
154
|
ref={containerRef}
|
|
171
|
-
|
|
172
|
-
flex: 1,
|
|
173
|
-
overflow: "auto",
|
|
174
|
-
fontFamily: "monospace",
|
|
175
|
-
fontSize: 12,
|
|
176
|
-
padding: "8px 0"
|
|
177
|
-
}}
|
|
155
|
+
className="flex-1 overflow-auto py-2"
|
|
178
156
|
>
|
|
179
157
|
{logs.map(log => (
|
|
180
158
|
<div
|
|
181
159
|
key={log.id}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
borderBottom: "1px solid #181825"
|
|
187
|
-
}}
|
|
160
|
+
className={cls(
|
|
161
|
+
"flex gap-4 px-4 py-[6px] border-b hover:bg-surface-100 dark:hover:bg-surface-900 transition-colors",
|
|
162
|
+
defaultBorderMixin
|
|
163
|
+
)}
|
|
188
164
|
>
|
|
189
|
-
<
|
|
190
|
-
flexShrink: 0 }}>
|
|
165
|
+
<Typography variant="body2" color="secondary" className="w-[72px] shrink-0 font-mono">
|
|
191
166
|
{new Date(log.timestamp).toLocaleTimeString()}
|
|
192
|
-
</
|
|
193
|
-
<
|
|
194
|
-
color: LEVEL_COLORS[log.level] || "#cdd6f4",
|
|
195
|
-
width: 40,
|
|
196
|
-
flexShrink: 0,
|
|
197
|
-
textTransform: "uppercase",
|
|
198
|
-
fontWeight: 600
|
|
199
|
-
}}>
|
|
167
|
+
</Typography>
|
|
168
|
+
<Typography variant="body2" className={cls("w-[48px] shrink-0 uppercase font-semibold font-mono", LEVEL_COLORS[log.level] || "text-surface-500")}>
|
|
200
169
|
{log.level}
|
|
201
|
-
</
|
|
202
|
-
<
|
|
203
|
-
color: SOURCE_COLORS[log.source] || "#cdd6f4",
|
|
204
|
-
width: 64,
|
|
205
|
-
flexShrink: 0
|
|
206
|
-
}}>
|
|
170
|
+
</Typography>
|
|
171
|
+
<Typography variant="body2" className={cls("w-[80px] shrink-0 font-mono", SOURCE_COLORS[log.source] || "text-surface-500")}>
|
|
207
172
|
[{log.source}]
|
|
208
|
-
</
|
|
209
|
-
<
|
|
210
|
-
flex: 1 }}>
|
|
173
|
+
</Typography>
|
|
174
|
+
<Typography variant="body2" className="flex-1 font-mono break-all whitespace-pre-wrap text-surface-900 dark:text-surface-100">
|
|
211
175
|
{log.message}
|
|
212
|
-
</
|
|
176
|
+
</Typography>
|
|
213
177
|
</div>
|
|
214
178
|
))}
|
|
215
179
|
{logs.length === 0 && (
|
|
216
|
-
<div
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}}>
|
|
221
|
-
No log entries yet. Logs will appear here as requests come in.
|
|
180
|
+
<div className="p-8 text-center">
|
|
181
|
+
<Typography variant="body2" color="secondary">
|
|
182
|
+
No log entries yet. Logs will appear here as requests come in.
|
|
183
|
+
</Typography>
|
|
222
184
|
</div>
|
|
223
185
|
)}
|
|
224
186
|
</div>
|
|
@@ -358,6 +358,7 @@ export const PolicyEditor = ({
|
|
|
358
358
|
</DialogActions>
|
|
359
359
|
|
|
360
360
|
<Dialog open={helpOpen} onOpenChange={setHelpOpen} maxWidth="3xl">
|
|
361
|
+
<DialogTitle hidden>Row-Level Security Help</DialogTitle>
|
|
361
362
|
<DialogContent className="p-4 sm:p-6 lg:p-8 flex flex-col gap-6">
|
|
362
363
|
<div>
|
|
363
364
|
<Typography variant="h5" className="mb-2">{t("studio_policy_help_title")}</Typography>
|