@rebasepro/studio 0.17.3 → 0.18.1
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/LICENSE +0 -1
- package/README.md +12 -4
- package/dist/{ApiKeysView-DiCurTEU.js → ApiKeysView-EIvegrUk.js} +54 -39
- package/dist/ApiKeysView-EIvegrUk.js.map +1 -0
- package/dist/{BackupsView-DNS6LdVg.js → BackupsView-DVkKzaPR.js} +29 -31
- package/dist/BackupsView-DVkKzaPR.js.map +1 -0
- package/dist/{BranchesView-CM3B-ER3.js → BranchesView-Df8hQ8wE.js} +85 -24
- package/dist/BranchesView-Df8hQ8wE.js.map +1 -0
- package/dist/{CronJobsView-BHtJZeJZ.js → CronJobsView-CLOGjb-L.js} +32 -27
- package/dist/CronJobsView-CLOGjb-L.js.map +1 -0
- package/dist/{RLSEditor-CBX4uD66.js → RLSEditor-Sa1D34ny.js} +724 -615
- package/dist/RLSEditor-Sa1D34ny.js.map +1 -0
- package/dist/{SQLEditor-ByecwX8B.js → SQLEditor-BfNA8xM3.js} +9 -4
- package/dist/{SQLEditor-ByecwX8B.js.map → SQLEditor-BfNA8xM3.js.map} +1 -1
- package/dist/{SchemaVisualizer-D6tMZgeC.js → SchemaVisualizer-DTDMYL6o.js} +84 -110
- package/dist/SchemaVisualizer-DTDMYL6o.js.map +1 -0
- package/dist/{StorageView-BGDeC5GI.js → StorageView-Ed9Q_VlB.js} +5 -32
- package/dist/StorageView-Ed9Q_VlB.js.map +1 -0
- package/dist/components/RLSEditor/saveRules.d.ts +38 -0
- package/dist/components/RebaseStudio.d.ts +1 -1
- package/dist/components/SchemaVisualizer/schema-visualizer.utils.d.ts +5 -2
- package/dist/components/SchemaVisualizer/useSchemaGraph.d.ts +0 -4
- package/dist/components/load-failure-view.d.ts +17 -0
- package/dist/components/load-failure.d.ts +47 -0
- package/dist/index.es.js +56 -36
- package/dist/index.es.js.map +1 -1
- package/dist/load-failure-C6OMJSGC.js +31 -0
- package/dist/load-failure-C6OMJSGC.js.map +1 -0
- package/dist/load-failure-view-CBTB_h-h.js +48 -0
- package/dist/load-failure-view-CBTB_h-h.js.map +1 -0
- package/package.json +36 -21
- package/dist/ApiKeysView-DiCurTEU.js.map +0 -1
- package/dist/BackupsView-DNS6LdVg.js.map +0 -1
- package/dist/BranchesView-CM3B-ER3.js.map +0 -1
- package/dist/CronJobsView-BHtJZeJZ.js.map +0 -1
- package/dist/RLSEditor-CBX4uD66.js.map +0 -1
- package/dist/SchemaVisualizer-D6tMZgeC.js.map +0 -1
- package/dist/StorageView-BGDeC5GI.js.map +0 -1
- package/dist/components/StorageView/storage-failure.d.ts +0 -34
- package/src/components/ApiExplorer/ApiExplorer.tsx +0 -299
- package/src/components/ApiExplorer/EndpointDetail.tsx +0 -279
- package/src/components/ApiExplorer/TryItPanel.tsx +0 -499
- package/src/components/ApiExplorer/parseSpec.ts +0 -104
- package/src/components/ApiExplorer/types.ts +0 -84
- package/src/components/ApiKeys/ApiKeysView.tsx +0 -479
- package/src/components/ApiKeys/CreateApiKeyDialog.tsx +0 -711
- package/src/components/ApiKeys/permissions.ts +0 -145
- package/src/components/AuthSimulationSelector.tsx +0 -72
- package/src/components/Backups/BackupsView.tsx +0 -185
- package/src/components/Branches/BranchesView.tsx +0 -386
- package/src/components/CronJobs/CronJobsView.tsx +0 -413
- package/src/components/JSEditor/JSEditor.tsx +0 -1100
- package/src/components/JSEditor/JSEditorSidebar.tsx +0 -350
- package/src/components/JSEditor/JSMonacoEditor.tsx +0 -410
- package/src/components/LogsExplorer/LogsExplorer.tsx +0 -273
- package/src/components/LogsExplorer/useLogTail.ts +0 -356
- package/src/components/RLSEditor/PolicyEditor.tsx +0 -399
- package/src/components/RLSEditor/RLSEditor.tsx +0 -1128
- package/src/components/RLSEditor/index.ts +0 -1
- package/src/components/RLSEditor/policy-presets.ts +0 -176
- package/src/components/RLSEditor/saveSecurityRules.ts +0 -48
- package/src/components/RebaseStudio.tsx +0 -174
- package/src/components/SQLEditor/ExplainVisualizer.tsx +0 -128
- package/src/components/SQLEditor/MonacoEditor.tsx +0 -203
- package/src/components/SQLEditor/SQLEditor.tsx +0 -1518
- package/src/components/SQLEditor/SQLEditorSidebar.tsx +0 -173
- package/src/components/SQLEditor/SchemaBrowser.tsx +0 -168
- package/src/components/SQLEditor/sql_editor_types.ts +0 -18
- package/src/components/SchemaVisualizer/RelationEdge.tsx +0 -102
- package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +0 -710
- package/src/components/SchemaVisualizer/TableNode.tsx +0 -257
- package/src/components/SchemaVisualizer/schema-visualizer.utils.ts +0 -140
- package/src/components/SchemaVisualizer/useLiveRls.ts +0 -86
- package/src/components/SchemaVisualizer/useSchemaGraph.ts +0 -426
- package/src/components/StorageView/StorageView.tsx +0 -1588
- package/src/components/StorageView/storage-failure.ts +0 -63
- package/src/components/StudioHomePage.tsx +0 -430
- package/src/index.ts +0 -31
- package/src/utils/parseSpec.test.ts +0 -309
- package/src/utils/sql_utils.test.ts +0 -265
- package/src/utils/sql_utils.ts +0 -291
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
ArrowRightFromLineIcon,
|
|
4
|
-
Chip,
|
|
5
|
-
cls,
|
|
6
|
-
defaultBorderMixin,
|
|
7
|
-
iconSize,
|
|
8
|
-
SlidersHorizontalIcon,
|
|
9
|
-
Typography,
|
|
10
|
-
UploadIcon
|
|
11
|
-
} from "@rebasepro/ui";
|
|
12
|
-
import type { ParsedEndpoint, OpenApiSpec, OpenApiSchema } from "./types";
|
|
13
|
-
import { resolveRef, resolveRefName } from "./parseSpec";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Renders the documentation view for a single API endpoint:
|
|
17
|
-
* parameters, request body schema, response schemas.
|
|
18
|
-
*/
|
|
19
|
-
export function EndpointDetail({ endpoint, spec }: { endpoint: ParsedEndpoint; spec: OpenApiSpec }) {
|
|
20
|
-
return (
|
|
21
|
-
<div className="p-6 space-y-8 max-w-4xl">
|
|
22
|
-
{/* Summary / Description */}
|
|
23
|
-
{(endpoint.summary || endpoint.description) && (
|
|
24
|
-
<div>
|
|
25
|
-
{endpoint.summary && (
|
|
26
|
-
<Typography variant="h6" className="font-semibold mb-1">
|
|
27
|
-
{endpoint.summary}
|
|
28
|
-
</Typography>
|
|
29
|
-
)}
|
|
30
|
-
{endpoint.description && (
|
|
31
|
-
<Typography variant="body2" className="text-text-secondary dark:text-text-secondary-dark">
|
|
32
|
-
{endpoint.description}
|
|
33
|
-
</Typography>
|
|
34
|
-
)}
|
|
35
|
-
</div>
|
|
36
|
-
)}
|
|
37
|
-
|
|
38
|
-
{/* Parameters */}
|
|
39
|
-
{endpoint.parameters.length > 0 && (
|
|
40
|
-
<section>
|
|
41
|
-
<SectionHeading icon={<SlidersHorizontalIcon size={iconSize.small} className="text-text-secondary dark:text-text-secondary-dark" />} title="Parameters"/>
|
|
42
|
-
<div className={cls("rounded-lg border overflow-hidden", defaultBorderMixin)}>
|
|
43
|
-
<table className="w-full text-sm">
|
|
44
|
-
<thead>
|
|
45
|
-
<tr className="bg-surface-100 dark:bg-surface-900 text-left">
|
|
46
|
-
<th className="px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark">
|
|
47
|
-
Name
|
|
48
|
-
</th>
|
|
49
|
-
<th className="px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark">
|
|
50
|
-
In
|
|
51
|
-
</th>
|
|
52
|
-
<th className="px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark">
|
|
53
|
-
Type
|
|
54
|
-
</th>
|
|
55
|
-
<th className="px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark">
|
|
56
|
-
Description
|
|
57
|
-
</th>
|
|
58
|
-
</tr>
|
|
59
|
-
</thead>
|
|
60
|
-
<tbody>
|
|
61
|
-
{endpoint.parameters.map((p, i) => (
|
|
62
|
-
<tr
|
|
63
|
-
key={p.name + i}
|
|
64
|
-
className={cls("border-t", defaultBorderMixin)}
|
|
65
|
-
>
|
|
66
|
-
<td className="px-4 py-2.5">
|
|
67
|
-
<code className="text-xs font-mono font-semibold">{p.name}</code>
|
|
68
|
-
{p.required && <span className="text-red-500 ml-1 text-xs">*</span>}
|
|
69
|
-
</td>
|
|
70
|
-
<td className="px-4 py-2.5">
|
|
71
|
-
<Chip
|
|
72
|
-
size="smallest"
|
|
73
|
-
colorScheme={p.in === "path" ? "orangeDarker" : "cyanDarker"}
|
|
74
|
-
>
|
|
75
|
-
{p.in}
|
|
76
|
-
</Chip>
|
|
77
|
-
</td>
|
|
78
|
-
<td className="px-4 py-2.5 text-xs font-mono text-text-secondary dark:text-text-secondary-dark">
|
|
79
|
-
{schemaTypeLabel(p.schema)}
|
|
80
|
-
</td>
|
|
81
|
-
<td className="px-4 py-2.5 text-xs text-text-secondary dark:text-text-secondary-dark">
|
|
82
|
-
{p.description ?? "—"}
|
|
83
|
-
</td>
|
|
84
|
-
</tr>
|
|
85
|
-
))}
|
|
86
|
-
</tbody>
|
|
87
|
-
</table>
|
|
88
|
-
</div>
|
|
89
|
-
</section>
|
|
90
|
-
)}
|
|
91
|
-
|
|
92
|
-
{/* Request Body */}
|
|
93
|
-
{endpoint.requestBody && (
|
|
94
|
-
<section>
|
|
95
|
-
<SectionHeading icon={<UploadIcon size={iconSize.small} className="text-text-secondary dark:text-text-secondary-dark" />} title="Request Body"/>
|
|
96
|
-
{Object.entries(endpoint.requestBody.content ?? {}).map(([contentType, media]) => (
|
|
97
|
-
<div key={contentType}>
|
|
98
|
-
<Chip size="smallest" colorScheme="blueDarker" className="mb-3">
|
|
99
|
-
{contentType}
|
|
100
|
-
</Chip>
|
|
101
|
-
{media.schema && <SchemaBlock schema={media.schema} spec={spec} depth={0}/>}
|
|
102
|
-
</div>
|
|
103
|
-
))}
|
|
104
|
-
</section>
|
|
105
|
-
)}
|
|
106
|
-
|
|
107
|
-
{/* Responses */}
|
|
108
|
-
<section>
|
|
109
|
-
<SectionHeading icon={<ArrowRightFromLineIcon size={iconSize.small} className="text-text-secondary dark:text-text-secondary-dark" />} title="Responses"/>
|
|
110
|
-
<div className="space-y-3">
|
|
111
|
-
{Object.entries(endpoint.responses).map(([code, res]) => (
|
|
112
|
-
<div
|
|
113
|
-
key={code}
|
|
114
|
-
className={cls("rounded-lg border overflow-hidden", defaultBorderMixin)}
|
|
115
|
-
>
|
|
116
|
-
<div
|
|
117
|
-
className={cls(
|
|
118
|
-
"flex items-center gap-3 px-4 py-2.5",
|
|
119
|
-
"bg-surface-50 dark:bg-surface-900/50"
|
|
120
|
-
)}
|
|
121
|
-
>
|
|
122
|
-
<StatusBadge code={code}/>
|
|
123
|
-
<Typography
|
|
124
|
-
variant="body2"
|
|
125
|
-
className="text-text-secondary dark:text-text-secondary-dark text-xs"
|
|
126
|
-
>
|
|
127
|
-
{res.description}
|
|
128
|
-
</Typography>
|
|
129
|
-
</div>
|
|
130
|
-
{res.content &&
|
|
131
|
-
Object.entries(res.content).map(
|
|
132
|
-
([ct, media]) =>
|
|
133
|
-
media.schema && (
|
|
134
|
-
<div
|
|
135
|
-
key={ct}
|
|
136
|
-
className={cls("px-4 py-3 border-t", defaultBorderMixin)}
|
|
137
|
-
>
|
|
138
|
-
<SchemaBlock schema={media.schema} spec={spec} depth={0}/>
|
|
139
|
-
</div>
|
|
140
|
-
)
|
|
141
|
-
)}
|
|
142
|
-
</div>
|
|
143
|
-
))}
|
|
144
|
-
</div>
|
|
145
|
-
</section>
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* ── Schema Block ─────────────────────────────────────────────────── */
|
|
151
|
-
|
|
152
|
-
function SchemaBlock({ schema, spec, depth }: { schema: OpenApiSchema; spec: OpenApiSpec; depth: number }) {
|
|
153
|
-
// Resolve $ref
|
|
154
|
-
if (schema.$ref) {
|
|
155
|
-
const name = resolveRefName(schema.$ref);
|
|
156
|
-
const resolved = resolveRef(spec, schema.$ref) as OpenApiSchema;
|
|
157
|
-
return (
|
|
158
|
-
<div>
|
|
159
|
-
<Typography
|
|
160
|
-
variant="caption"
|
|
161
|
-
className="text-primary dark:text-primary-dark font-mono text-xs mb-2 block"
|
|
162
|
-
>
|
|
163
|
-
{name}
|
|
164
|
-
</Typography>
|
|
165
|
-
<SchemaBlock schema={resolved} spec={spec} depth={depth}/>
|
|
166
|
-
</div>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Object with properties
|
|
171
|
-
if (schema.properties) {
|
|
172
|
-
const required = new Set(schema.required ?? []);
|
|
173
|
-
return (
|
|
174
|
-
<div
|
|
175
|
-
className={cls(
|
|
176
|
-
"rounded-lg overflow-hidden",
|
|
177
|
-
depth > 0 && `border ml-4 mt-1 ${defaultBorderMixin}`
|
|
178
|
-
)}
|
|
179
|
-
>
|
|
180
|
-
<table className="w-full text-xs">
|
|
181
|
-
<tbody>
|
|
182
|
-
{Object.entries(schema.properties).map(([key, prop]) => (
|
|
183
|
-
<tr
|
|
184
|
-
key={key}
|
|
185
|
-
className={cls("border-t first:border-t-0", defaultBorderMixin)}
|
|
186
|
-
>
|
|
187
|
-
<td className="px-3 py-2 align-top w-36">
|
|
188
|
-
<code className="font-mono font-semibold text-text-primary dark:text-text-primary-dark">
|
|
189
|
-
{key}
|
|
190
|
-
</code>
|
|
191
|
-
{required.has(key) && <span className="text-red-500 ml-0.5">*</span>}
|
|
192
|
-
{prop.readOnly && (
|
|
193
|
-
<span className="ml-1.5 text-[9px] text-text-secondary dark:text-text-secondary-dark italic">
|
|
194
|
-
read-only
|
|
195
|
-
</span>
|
|
196
|
-
)}
|
|
197
|
-
</td>
|
|
198
|
-
<td className="px-3 py-2 align-top w-28">
|
|
199
|
-
<span className="font-mono text-text-secondary dark:text-text-secondary-dark">
|
|
200
|
-
{schemaTypeLabel(prop)}
|
|
201
|
-
</span>
|
|
202
|
-
</td>
|
|
203
|
-
<td className="px-3 py-2 align-top text-text-secondary dark:text-text-secondary-dark">
|
|
204
|
-
{prop.description ?? ""}
|
|
205
|
-
{prop.enum && (
|
|
206
|
-
<div className="flex flex-wrap gap-1 mt-1">
|
|
207
|
-
{prop.enum.map((v) => (
|
|
208
|
-
<span
|
|
209
|
-
key={String(v)}
|
|
210
|
-
className="px-1.5 py-0.5 rounded bg-surface-200 dark:bg-surface-800 text-[10px] font-mono"
|
|
211
|
-
>
|
|
212
|
-
{String(v)}
|
|
213
|
-
</span>
|
|
214
|
-
))}
|
|
215
|
-
</div>
|
|
216
|
-
)}
|
|
217
|
-
{prop.properties && <SchemaBlock schema={prop} spec={spec} depth={depth + 1}/>}
|
|
218
|
-
{prop.$ref && <SchemaBlock schema={prop} spec={spec} depth={depth + 1}/>}
|
|
219
|
-
</td>
|
|
220
|
-
</tr>
|
|
221
|
-
))}
|
|
222
|
-
</tbody>
|
|
223
|
-
</table>
|
|
224
|
-
</div>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Array
|
|
229
|
-
if (schema.type === "array" && schema.items) {
|
|
230
|
-
return (
|
|
231
|
-
<div>
|
|
232
|
-
<span className="font-mono text-xs text-text-secondary dark:text-text-secondary-dark">Array of:</span>
|
|
233
|
-
<SchemaBlock schema={schema.items} spec={spec} depth={depth + 1}/>
|
|
234
|
-
</div>
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Primitive
|
|
239
|
-
return (
|
|
240
|
-
<span className="font-mono text-xs text-text-secondary dark:text-text-secondary-dark">
|
|
241
|
-
{schemaTypeLabel(schema)}
|
|
242
|
-
</span>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/* ── Helpers ──────────────────────────────────────────────────────── */
|
|
247
|
-
|
|
248
|
-
function schemaTypeLabel(schema?: OpenApiSchema): string {
|
|
249
|
-
if (!schema) return "any";
|
|
250
|
-
if (schema.$ref) return resolveRefName(schema.$ref);
|
|
251
|
-
if (schema.type === "array") return `${schemaTypeLabel(schema.items)}[]`;
|
|
252
|
-
if (schema.format) return `${schema.type} (${schema.format})`;
|
|
253
|
-
return schema.type ?? "object";
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function SectionHeading({ icon, title }: { icon: React.ReactNode; title: string }) {
|
|
257
|
-
return (
|
|
258
|
-
<div className="flex items-center gap-2 mb-3">
|
|
259
|
-
{icon}
|
|
260
|
-
<Typography variant="subtitle2" className="font-semibold text-sm">
|
|
261
|
-
{title}
|
|
262
|
-
</Typography>
|
|
263
|
-
</div>
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function StatusBadge({ code }: { code: string }) {
|
|
268
|
-
const n = parseInt(code, 10);
|
|
269
|
-
const color =
|
|
270
|
-
n < 300
|
|
271
|
-
? "text-emerald-600 dark:text-emerald-400"
|
|
272
|
-
: n < 400
|
|
273
|
-
? "text-blue-600 dark:text-blue-400"
|
|
274
|
-
: n < 500
|
|
275
|
-
? "text-amber-600 dark:text-amber-400"
|
|
276
|
-
: "text-red-600 dark:text-red-400";
|
|
277
|
-
|
|
278
|
-
return <span className={cls("text-xs font-semibold font-mono", color)}>{code}</span>;
|
|
279
|
-
}
|