@rebasepro/studio 0.15.0 → 0.16.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/{ApiExplorer-CDOlUQzk.js → ApiExplorer-9iwGvNnt.js} +5 -5
- package/dist/ApiExplorer-9iwGvNnt.js.map +1 -0
- package/dist/{JSEditor-BaSrzWhF.js → JSEditor-BZnvK1n6.js} +14 -14
- package/dist/JSEditor-BZnvK1n6.js.map +1 -0
- package/dist/{RLSEditor-CV8R1G3W.js → RLSEditor-CBX4uD66.js} +163 -49
- package/dist/RLSEditor-CBX4uD66.js.map +1 -0
- package/dist/{SQLEditor-BmI0iIWK.js → SQLEditor-ByecwX8B.js} +16 -16
- package/dist/SQLEditor-ByecwX8B.js.map +1 -0
- package/dist/{SchemaVisualizer-vxKSG80C.js → SchemaVisualizer-D6tMZgeC.js} +4 -4
- package/dist/SchemaVisualizer-D6tMZgeC.js.map +1 -0
- package/dist/{StorageView-CwDI4sBG.js → StorageView-CGm-cacx.js} +9 -9
- package/dist/StorageView-CGm-cacx.js.map +1 -0
- package/dist/components/RLSEditor/PolicyEditor.d.ts +9 -1
- package/dist/components/RLSEditor/policy-presets.d.ts +74 -0
- package/dist/index.es.js +6 -6
- package/package.json +9 -9
- package/src/components/ApiExplorer/ApiExplorer.tsx +2 -2
- package/src/components/ApiExplorer/EndpointDetail.tsx +1 -1
- package/src/components/ApiExplorer/TryItPanel.tsx +1 -1
- package/src/components/JSEditor/JSEditor.tsx +7 -7
- package/src/components/JSEditor/JSEditorSidebar.tsx +6 -6
- package/src/components/RLSEditor/PolicyEditor.tsx +31 -96
- package/src/components/RLSEditor/RLSEditor.tsx +46 -4
- package/src/components/RLSEditor/policy-presets.ts +176 -0
- package/src/components/SQLEditor/SQLEditor.tsx +10 -10
- package/src/components/SQLEditor/SQLEditorSidebar.tsx +4 -4
- package/src/components/SQLEditor/SchemaBrowser.tsx +1 -1
- package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +1 -1
- package/src/components/SchemaVisualizer/TableNode.tsx +2 -2
- package/src/components/StorageView/StorageView.tsx +8 -8
- package/dist/ApiExplorer-CDOlUQzk.js.map +0 -1
- package/dist/JSEditor-BaSrzWhF.js.map +0 -1
- package/dist/RLSEditor-CV8R1G3W.js.map +0 -1
- package/dist/SQLEditor-BmI0iIWK.js.map +0 -1
- package/dist/SchemaVisualizer-vxKSG80C.js.map +0 -1
- package/dist/StorageView-CwDI4sBG.js.map +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the RLS editor offers before the user types anything: the roles a `TO`
|
|
3
|
+
* list may name, and the ready-made policies.
|
|
4
|
+
*
|
|
5
|
+
* Separated from the component because these are the parts that have to agree
|
|
6
|
+
* with the *server*, not with the UI — and the ways they can silently disagree
|
|
7
|
+
* are the reason this file has tests.
|
|
8
|
+
*/
|
|
9
|
+
import { policy as policyExpr } from "@rebasepro/types";
|
|
10
|
+
import { policyToPostgres, REBASE_USER_ROLE } from "@rebasepro/common";
|
|
11
|
+
|
|
12
|
+
export type PolicyCommand = "ALL" | "SELECT" | "INSERT" | "UPDATE" | "DELETE";
|
|
13
|
+
|
|
14
|
+
export const COMMAND_OPTIONS: PolicyCommand[] = ["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The roles a policy's `TO` list can name when nothing better is known.
|
|
18
|
+
*
|
|
19
|
+
* Not `authenticated` / `anon` / `admin`, which is what this list used to be.
|
|
20
|
+
* The first two are Supabase's role names and Rebase never creates them, so
|
|
21
|
+
* `CREATE POLICY ... TO authenticated` — which is literally what the editor
|
|
22
|
+
* builds and executes — fails with `role "authenticated" does not exist`. The
|
|
23
|
+
* driver's `validatePolicyPgRoles` rejects the same three names in
|
|
24
|
+
* `SecurityRule.pgRoles` and says why: they are another platform's convention,
|
|
25
|
+
* and application roles belong in a condition, not in the `TO` list.
|
|
26
|
+
*
|
|
27
|
+
* `admin` was the more dangerous entry, because it is a plausible *application*
|
|
28
|
+
* role. Had one existed as a database role too, the policy would have been
|
|
29
|
+
* created successfully and then matched nothing at all: requests run as
|
|
30
|
+
* {@link REBASE_USER_ROLE} after a `SET LOCAL ROLE`, and a `TO` list naming a
|
|
31
|
+
* role the request never assumes filters every row without erroring.
|
|
32
|
+
*
|
|
33
|
+
* So: `public` (what the framework's own generator emits) and the role requests
|
|
34
|
+
* actually arrive as. "Signed-in users" and "admins" are not roles here — they
|
|
35
|
+
* are conditions over `rebase.uid()` and `rebase.roles()`, which is what the
|
|
36
|
+
* presets below now compile to.
|
|
37
|
+
*/
|
|
38
|
+
export const FALLBACK_ROLE_OPTIONS = ["public", REBASE_USER_ROLE];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The `TO` list the editor offers, given what the database reported and what
|
|
42
|
+
* the policy being edited already targets.
|
|
43
|
+
*
|
|
44
|
+
* Three sources, and each is there for a reason the others do not cover:
|
|
45
|
+
*
|
|
46
|
+
* - {@link FALLBACK_ROLE_OPTIONS} always, because `public` is a **keyword, not
|
|
47
|
+
* a row in `pg_roles`** — `fetchAvailableRoles` cannot return it, so seeding
|
|
48
|
+
* from the live fetch alone would drop the one role every generated policy
|
|
49
|
+
* targets.
|
|
50
|
+
* - the live roles, so an operator's own `app_read` is reachable without
|
|
51
|
+
* hand-editing SQL.
|
|
52
|
+
* - the edited policy's own roles, because a `MultiSelect` silently drops a
|
|
53
|
+
* value with no matching item. That value is the `TO` list of a policy
|
|
54
|
+
* already enforcing something, so opening an unrelated policy for a one-word
|
|
55
|
+
* rename would have quietly rewritten who it applies to.
|
|
56
|
+
*/
|
|
57
|
+
export function roleOptionsFor(
|
|
58
|
+
fetched: readonly string[] | undefined,
|
|
59
|
+
policyRoles: readonly string[] | undefined
|
|
60
|
+
): string[] {
|
|
61
|
+
return [...new Set([...FALLBACK_ROLE_OPTIONS, ...(fetched ?? []), ...(policyRoles ?? [])])];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Preset conditions, compiled by the framework's own policy compiler rather
|
|
66
|
+
* than written out here.
|
|
67
|
+
*
|
|
68
|
+
* `policyToPostgres` is the function `db push` generates policies with, so a
|
|
69
|
+
* preset cannot drift from what the framework emits — and the one that matters
|
|
70
|
+
* has drifted before: `authenticated()` used to compile to a bare
|
|
71
|
+
* `IS NOT NULL`, which is true for anonymous visitors, and any copy of that
|
|
72
|
+
* string sitting in a preset would still be handing out the old grant today.
|
|
73
|
+
*/
|
|
74
|
+
export const SIGNED_IN_SQL = policyToPostgres(policyExpr.authenticated());
|
|
75
|
+
export const IS_ADMIN_SQL = policyToPostgres(policyExpr.rolesOverlap(["admin"]));
|
|
76
|
+
export const OWNS_ROW_SQL = policyToPostgres(
|
|
77
|
+
policyExpr.compare(policyExpr.authUid(), "eq", policyExpr.field("uid"))
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export interface PolicyPreset {
|
|
81
|
+
id: string;
|
|
82
|
+
label: string;
|
|
83
|
+
description: string;
|
|
84
|
+
policyname: string;
|
|
85
|
+
cmd: PolicyCommand;
|
|
86
|
+
permissive: "PERMISSIVE" | "RESTRICTIVE";
|
|
87
|
+
roles: string[];
|
|
88
|
+
qual: string;
|
|
89
|
+
with_check: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Every preset targets `TO public`, which is what the framework's generator
|
|
94
|
+
* emits and what actually reaches a request running as `rebase_user`. The part
|
|
95
|
+
* that used to be expressed as a role — "authenticated", "admin" — is a
|
|
96
|
+
* condition now, so it is enforced where Postgres will actually evaluate it.
|
|
97
|
+
*/
|
|
98
|
+
export const POLICY_PRESETS: PolicyPreset[] = [
|
|
99
|
+
{
|
|
100
|
+
id: "public_read",
|
|
101
|
+
label: "Enable read access to everyone",
|
|
102
|
+
description: "Anyone can read data, regardless of authentication status.",
|
|
103
|
+
policyname: "Enable read access for all users",
|
|
104
|
+
cmd: "SELECT",
|
|
105
|
+
permissive: "PERMISSIVE",
|
|
106
|
+
roles: ["public"],
|
|
107
|
+
qual: "true",
|
|
108
|
+
with_check: ""
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "auth_read",
|
|
112
|
+
label: "Enable read access for signed-in users only",
|
|
113
|
+
description: "Only signed-in users are allowed to read data. Anonymous requests carry a sentinel uid, so the condition excludes them explicitly.",
|
|
114
|
+
policyname: "Enable read access for signed-in users",
|
|
115
|
+
cmd: "SELECT",
|
|
116
|
+
permissive: "PERMISSIVE",
|
|
117
|
+
roles: ["public"],
|
|
118
|
+
qual: SIGNED_IN_SQL,
|
|
119
|
+
with_check: ""
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "auth_insert",
|
|
123
|
+
label: "Enable insert for signed-in users only",
|
|
124
|
+
description: "Only signed-in users are allowed to insert new data.",
|
|
125
|
+
policyname: "Enable insert for signed-in users only",
|
|
126
|
+
cmd: "INSERT",
|
|
127
|
+
permissive: "PERMISSIVE",
|
|
128
|
+
roles: ["public"],
|
|
129
|
+
qual: "",
|
|
130
|
+
with_check: SIGNED_IN_SQL
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "admin_all",
|
|
134
|
+
label: "Admins can do anything",
|
|
135
|
+
description: "Restricted to users holding the `admin` application role, matched inside the policy via rebase.roles().",
|
|
136
|
+
policyname: "Admins have full access",
|
|
137
|
+
cmd: "ALL",
|
|
138
|
+
permissive: "PERMISSIVE",
|
|
139
|
+
roles: ["public"],
|
|
140
|
+
qual: IS_ADMIN_SQL,
|
|
141
|
+
with_check: IS_ADMIN_SQL
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "user_select_own",
|
|
145
|
+
label: "Users can read their own rows",
|
|
146
|
+
description: "Users can only read rows whose uid column matches their rebase.uid()",
|
|
147
|
+
policyname: "Users can select their own data",
|
|
148
|
+
cmd: "SELECT",
|
|
149
|
+
permissive: "PERMISSIVE",
|
|
150
|
+
roles: ["public"],
|
|
151
|
+
qual: OWNS_ROW_SQL,
|
|
152
|
+
with_check: ""
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "user_update_own",
|
|
156
|
+
label: "Users can update their own rows",
|
|
157
|
+
description: "Users can only update rows whose uid column matches their rebase.uid()",
|
|
158
|
+
policyname: "Users can update their own data",
|
|
159
|
+
cmd: "UPDATE",
|
|
160
|
+
permissive: "PERMISSIVE",
|
|
161
|
+
roles: ["public"],
|
|
162
|
+
qual: OWNS_ROW_SQL,
|
|
163
|
+
with_check: OWNS_ROW_SQL
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "user_delete_own",
|
|
167
|
+
label: "Users can delete their own rows",
|
|
168
|
+
description: "Users can only delete rows whose uid column matches their rebase.uid()",
|
|
169
|
+
policyname: "Users can delete their own data",
|
|
170
|
+
cmd: "DELETE",
|
|
171
|
+
permissive: "PERMISSIVE",
|
|
172
|
+
roles: ["public"],
|
|
173
|
+
qual: OWNS_ROW_SQL,
|
|
174
|
+
with_check: ""
|
|
175
|
+
}
|
|
176
|
+
];
|
|
@@ -1012,7 +1012,7 @@ role: selectedRole });
|
|
|
1012
1012
|
if (plan) {
|
|
1013
1013
|
return (
|
|
1014
1014
|
<div className="flex-grow overflow-auto p-4 bg-surface-50 dark:bg-surface-900 flex flex-col items-start">
|
|
1015
|
-
<Typography variant="caption" className="font-
|
|
1015
|
+
<Typography variant="caption" className="font-semibold text-text-secondary mb-4 tracking-wider uppercase">{t("studio_sql_visual_execution_plan")}</Typography>
|
|
1016
1016
|
<div className="pb-12">
|
|
1017
1017
|
<ExplainVisualizer plan={plan}/>
|
|
1018
1018
|
</div>
|
|
@@ -1083,7 +1083,7 @@ resizable: false }, ...dataColumns]
|
|
|
1083
1083
|
{actionableCollections.length > 0 && (
|
|
1084
1084
|
<div className={cls("px-4 py-1.5 border-b flex items-center gap-2 shrink-0 bg-surface-50 dark:bg-surface-900", defaultBorderMixin)}>
|
|
1085
1085
|
<Tooltip title={t("studio_sql_admin_collections_tooltip")}>
|
|
1086
|
-
<Typography variant="caption" className="text-[10px] font-
|
|
1086
|
+
<Typography variant="caption" className="text-[10px] font-semibold uppercase tracking-widest text-text-disabled dark:text-text-disabled-dark mr-1 shrink-0 cursor-help">{t("studio_sql_collections_label")}</Typography>
|
|
1087
1087
|
</Tooltip>
|
|
1088
1088
|
<div className="flex items-center gap-1.5 overflow-x-auto no-scrollbar">
|
|
1089
1089
|
{actionableCollections.map(mc => (
|
|
@@ -1207,11 +1207,11 @@ id: String(ra.entityId) })}
|
|
|
1207
1207
|
<div className={cls("p-2 px-4 border-t bg-surface-50 dark:bg-surface-900 flex justify-between items-center shrink-0", defaultBorderMixin)}>
|
|
1208
1208
|
<div className="flex space-x-4">
|
|
1209
1209
|
<div className="flex items-center text-[11px]">
|
|
1210
|
-
<span className="font-
|
|
1210
|
+
<span className="font-semibold text-text-disabled dark:text-text-disabled-dark mr-2 uppercase tracking-tighter">{t("studio_sql_rows")}</span>
|
|
1211
1211
|
<span className="font-mono text-text-secondary dark:text-text-secondary-dark">{results.length}</span>
|
|
1212
1212
|
</div>
|
|
1213
1213
|
<div className="flex items-center text-[11px]">
|
|
1214
|
-
<span className="font-
|
|
1214
|
+
<span className="font-semibold text-text-disabled dark:text-text-disabled-dark mr-2 uppercase tracking-tighter">{t("studio_sql_time")}</span>
|
|
1215
1215
|
<span className="font-mono text-text-secondary dark:text-text-secondary-dark">{execTime}ms</span>
|
|
1216
1216
|
</div>
|
|
1217
1217
|
</div>
|
|
@@ -1219,7 +1219,7 @@ id: String(ra.entityId) })}
|
|
|
1219
1219
|
<Button
|
|
1220
1220
|
size="small"
|
|
1221
1221
|
variant="text"
|
|
1222
|
-
className="text-[10px] uppercase font-
|
|
1222
|
+
className="text-[10px] uppercase font-semibold text-text-secondary dark:text-text-secondary-dark whitespace-nowrap"
|
|
1223
1223
|
onClick={handleExportMarkdown}
|
|
1224
1224
|
>
|
|
1225
1225
|
{t("studio_sql_copy_markdown")}
|
|
@@ -1227,7 +1227,7 @@ id: String(ra.entityId) })}
|
|
|
1227
1227
|
<Button
|
|
1228
1228
|
size="small"
|
|
1229
1229
|
variant="text"
|
|
1230
|
-
className="text-[10px] uppercase font-
|
|
1230
|
+
className="text-[10px] uppercase font-semibold text-text-secondary dark:text-text-secondary-dark whitespace-nowrap"
|
|
1231
1231
|
onClick={handleExportJSON}
|
|
1232
1232
|
>
|
|
1233
1233
|
{t("studio_sql_export_json")}
|
|
@@ -1235,7 +1235,7 @@ id: String(ra.entityId) })}
|
|
|
1235
1235
|
<Button
|
|
1236
1236
|
size="small"
|
|
1237
1237
|
variant="text"
|
|
1238
|
-
className="text-[10px] uppercase font-
|
|
1238
|
+
className="text-[10px] uppercase font-semibold text-text-secondary dark:text-text-secondary-dark whitespace-nowrap"
|
|
1239
1239
|
onClick={handleExportCSV}
|
|
1240
1240
|
>
|
|
1241
1241
|
{t("studio_sql_export_csv")}
|
|
@@ -1403,7 +1403,7 @@ isFavorite: !s.isFavorite } : s));
|
|
|
1403
1403
|
>
|
|
1404
1404
|
<div className="max-h-64 overflow-y-auto">
|
|
1405
1405
|
<div className="px-3 py-1.5 border-b border-surface-200 dark:border-surface-950 mb-1">
|
|
1406
|
-
<Typography variant="caption" className="font-
|
|
1406
|
+
<Typography variant="caption" className="font-semibold uppercase tracking-wider text-[9px] text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_database")}</Typography>
|
|
1407
1407
|
</div>
|
|
1408
1408
|
{isLoadingConfig ? (
|
|
1409
1409
|
<div className="flex items-center justify-center p-4">
|
|
@@ -1422,7 +1422,7 @@ isFavorite: !s.isFavorite } : s));
|
|
|
1422
1422
|
))}
|
|
1423
1423
|
|
|
1424
1424
|
<div className="px-3 py-1.5 border-y border-surface-200 dark:border-surface-950 mb-1 mt-1">
|
|
1425
|
-
<Typography variant="caption" className="font-
|
|
1425
|
+
<Typography variant="caption" className="font-semibold uppercase tracking-wider text-[9px] text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_role")}</Typography>
|
|
1426
1426
|
</div>
|
|
1427
1427
|
{availableRoles.map(role => (
|
|
1428
1428
|
<MenuItem key={role} dense onClick={() => handleRoleChange(role)} className={cls("text-xs", selectedRole === role && "text-primary dark:text-primary-dark")}>
|
|
@@ -1464,7 +1464,7 @@ isFavorite: !s.isFavorite } : s));
|
|
|
1464
1464
|
secondPanel={
|
|
1465
1465
|
<div className="h-full w-full flex flex-col bg-surface-50 dark:bg-surface-950 overflow-hidden min-h-0">
|
|
1466
1466
|
<div className={cls("p-2 px-4 bg-surface-100 dark:bg-surface-900 border-b shrink-0 flex items-center", defaultBorderMixin)}>
|
|
1467
|
-
<Typography variant="caption" className="font-
|
|
1467
|
+
<Typography variant="caption" className="font-semibold text-text-disabled dark:text-text-disabled-dark uppercase tracking-widest text-[10px]">{t("studio_sql_query_results")}</Typography>
|
|
1468
1468
|
</div>
|
|
1469
1469
|
<div className="flex-grow flex flex-col min-h-0 overflow-hidden">
|
|
1470
1470
|
{renderResults()}
|
|
@@ -65,7 +65,7 @@ export const SQLEditorSidebar = ({
|
|
|
65
65
|
return (
|
|
66
66
|
<div className="flex flex-col h-full">
|
|
67
67
|
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
68
|
-
<Typography variant="caption" className="font-
|
|
68
|
+
<Typography variant="caption" className="font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_snippets")}</Typography>
|
|
69
69
|
</div>
|
|
70
70
|
<div className="flex-grow overflow-y-auto p-2 space-y-2 no-scrollbar">
|
|
71
71
|
{snippets.length === 0 ? (
|
|
@@ -76,7 +76,7 @@ export const SQLEditorSidebar = ({
|
|
|
76
76
|
<>
|
|
77
77
|
{favorites.length > 0 && (
|
|
78
78
|
<div className="mb-4">
|
|
79
|
-
<Typography variant="caption" className="text-[10px] font-
|
|
79
|
+
<Typography variant="caption" className="text-[10px] font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark mb-2 px-1 flex items-center">
|
|
80
80
|
<svg className="w-3 h-3 mr-1 text-red-500" fill="currentColor" viewBox="0 0 20 20"><path fillRule="evenodd" d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clipRule="evenodd"/></svg>
|
|
81
81
|
Favorites
|
|
82
82
|
</Typography>
|
|
@@ -107,7 +107,7 @@ export const SQLEditorSidebar = ({
|
|
|
107
107
|
{others.length > 0 && (
|
|
108
108
|
<div>
|
|
109
109
|
{favorites.length > 0 && (
|
|
110
|
-
<Typography variant="caption" className="text-[10px] font-
|
|
110
|
+
<Typography variant="caption" className="text-[10px] font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark mb-2 px-1 mt-4">
|
|
111
111
|
Others
|
|
112
112
|
</Typography>
|
|
113
113
|
)}
|
|
@@ -145,7 +145,7 @@ export const SQLEditorSidebar = ({
|
|
|
145
145
|
{activeTab === "history" && (
|
|
146
146
|
<div className="flex flex-col h-full">
|
|
147
147
|
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
148
|
-
<Typography variant="caption" className="font-
|
|
148
|
+
<Typography variant="caption" className="font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_history")}</Typography>
|
|
149
149
|
</div>
|
|
150
150
|
<div className="flex-grow overflow-y-auto p-1 space-y-1 no-scrollbar">
|
|
151
151
|
{history.length === 0 ? (
|
|
@@ -44,7 +44,7 @@ export const SchemaBrowser = ({
|
|
|
44
44
|
return (
|
|
45
45
|
<div className="flex flex-col h-full overflow-hidden">
|
|
46
46
|
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
47
|
-
<Typography variant="caption" className="font-
|
|
47
|
+
<Typography variant="caption" className="font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_schema_tables")}</Typography>
|
|
48
48
|
<IconButton size="small" onClick={onRetrySchema} title="Refresh schema">
|
|
49
49
|
<RefreshCwIcon size={iconSize.smallest}/>
|
|
50
50
|
</IconButton>
|
|
@@ -263,7 +263,7 @@ duration: 400 }
|
|
|
263
263
|
>
|
|
264
264
|
<Typography
|
|
265
265
|
variant="caption"
|
|
266
|
-
className="font-
|
|
266
|
+
className="font-semibold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark"
|
|
267
267
|
>
|
|
268
268
|
Tables
|
|
269
269
|
</Typography>
|
|
@@ -187,12 +187,12 @@ icon }}
|
|
|
187
187
|
<span className="w-3 shrink-0 text-center">
|
|
188
188
|
{col.isPrimaryKey && (
|
|
189
189
|
<Tooltip title="Primary Key">
|
|
190
|
-
<span className="text-amber-500 text-[10px] font-
|
|
190
|
+
<span className="text-amber-500 text-[10px] font-semibold">🔑</span>
|
|
191
191
|
</Tooltip>
|
|
192
192
|
)}
|
|
193
193
|
{col.isForeignKey && !col.isPrimaryKey && (
|
|
194
194
|
<Tooltip title={`FK → ${col.relationName ?? "?"}`}>
|
|
195
|
-
<span className="text-blue-400 text-[10px] font-
|
|
195
|
+
<span className="text-blue-400 text-[10px] font-semibold">🔗</span>
|
|
196
196
|
</Tooltip>
|
|
197
197
|
)}
|
|
198
198
|
</span>
|
|
@@ -352,7 +352,7 @@ function FilePreviewPanel({
|
|
|
352
352
|
{/* Metadata */}
|
|
353
353
|
<div className="p-4 space-y-3">
|
|
354
354
|
<div>
|
|
355
|
-
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark text-[10px] uppercase tracking-wider font-
|
|
355
|
+
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark text-[10px] uppercase tracking-wider font-semibold mb-1 block">
|
|
356
356
|
File Info
|
|
357
357
|
</Typography>
|
|
358
358
|
</div>
|
|
@@ -992,9 +992,9 @@ message: e instanceof Error ? e.message : String(e) });
|
|
|
992
992
|
onCheckedChange={handleSelectAll}
|
|
993
993
|
/>
|
|
994
994
|
</th>
|
|
995
|
-
<th className="px-2 py-2 font-
|
|
996
|
-
<th className="px-4 py-2 font-
|
|
997
|
-
<th className="px-4 py-2 font-
|
|
995
|
+
<th className="px-2 py-2 font-semibold">Name</th>
|
|
996
|
+
<th className="px-4 py-2 font-semibold w-24">Type</th>
|
|
997
|
+
<th className="px-4 py-2 font-semibold w-24 text-right">Size</th>
|
|
998
998
|
<th className="px-2 py-2 w-10"/>
|
|
999
999
|
</tr>
|
|
1000
1000
|
</thead>
|
|
@@ -1124,7 +1124,7 @@ message: e instanceof Error ? e.message : String(e) });
|
|
|
1124
1124
|
{/* Folder cards */}
|
|
1125
1125
|
{folders.length > 0 && (
|
|
1126
1126
|
<div className="mb-4">
|
|
1127
|
-
<Typography variant="caption" className="text-[10px] uppercase tracking-wider font-
|
|
1127
|
+
<Typography variant="caption" className="text-[10px] uppercase tracking-wider font-semibold text-text-disabled dark:text-text-disabled-dark mb-2 block">
|
|
1128
1128
|
Folders
|
|
1129
1129
|
</Typography>
|
|
1130
1130
|
<div className="grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]">
|
|
@@ -1159,7 +1159,7 @@ message: e instanceof Error ? e.message : String(e) });
|
|
|
1159
1159
|
{/* FileIcon cards */}
|
|
1160
1160
|
{files.length > 0 && (
|
|
1161
1161
|
<div>
|
|
1162
|
-
<Typography variant="caption" className="text-[10px] uppercase tracking-wider font-
|
|
1162
|
+
<Typography variant="caption" className="text-[10px] uppercase tracking-wider font-semibold text-text-disabled dark:text-text-disabled-dark mb-2 block">
|
|
1163
1163
|
Files ({files.length})
|
|
1164
1164
|
</Typography>
|
|
1165
1165
|
<div className="grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]">
|
|
@@ -1198,7 +1198,7 @@ message: e instanceof Error ? e.message : String(e) });
|
|
|
1198
1198
|
|
|
1199
1199
|
{/* Extension badge */}
|
|
1200
1200
|
{getExtension(file.name) && (
|
|
1201
|
-
<div className="absolute bottom-1.5 right-1.5 px-1.5 py-0.5 rounded text-[9px] font-
|
|
1201
|
+
<div className="absolute bottom-1.5 right-1.5 px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase bg-black/50 text-white backdrop-blur-sm">
|
|
1202
1202
|
{getExtension(file.name)}
|
|
1203
1203
|
</div>
|
|
1204
1204
|
)}
|
|
@@ -1408,7 +1408,7 @@ message: e instanceof Error ? e.message : String(e) });
|
|
|
1408
1408
|
{/* Status bar */}
|
|
1409
1409
|
<div className={cls("px-4 py-1.5 border-t bg-surface-50 dark:bg-surface-800 flex items-center justify-between shrink-0", defaultBorderMixin)}>
|
|
1410
1410
|
<div className="flex items-center gap-4 text-[11px]">
|
|
1411
|
-
<span className="text-text-disabled dark:text-text-disabled-dark font-
|
|
1411
|
+
<span className="text-text-disabled dark:text-text-disabled-dark font-semibold uppercase tracking-tighter">
|
|
1412
1412
|
Path
|
|
1413
1413
|
</span>
|
|
1414
1414
|
<span className="font-mono text-text-secondary dark:text-text-secondary-dark">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiExplorer-CDOlUQzk.js","names":[],"sources":["../src/components/ApiExplorer/parseSpec.ts","../src/components/ApiExplorer/EndpointDetail.tsx","../src/components/ApiExplorer/TryItPanel.tsx","../src/components/ApiExplorer/ApiExplorer.tsx"],"sourcesContent":["import type { OpenApiSpec, ParsedEndpoint, EndpointGroup } from \"./types\";\n\n/**\n * Parse an OpenAPI 3.x spec into grouped, sorted endpoints for the sidebar.\n */\nexport function parseOpenApiSpec(spec: OpenApiSpec): {\n groups: EndpointGroup[];\n allEndpoints: ParsedEndpoint[];\n} {\n const allEndpoints: ParsedEndpoint[] = [];\n const tagMap = new Map<string, ParsedEndpoint[]>();\n\n // Build tag description lookup\n const tagDescriptions = new Map<string, string>();\n for (const t of spec.tags ?? []) {\n tagDescriptions.set(t.name, t.description ?? \"\");\n }\n\n for (const [path, methods] of Object.entries(spec.paths ?? {})) {\n for (const [method, op] of Object.entries(methods)) {\n if ([\"get\", \"post\", \"put\", \"patch\", \"delete\"].indexOf(method) === -1) continue;\n\n const tags = op.tags?.length ? op.tags : [\"Other\"];\n const shortPath = path.replace(/^\\/api\\/data/, \"\");\n\n const endpoint: ParsedEndpoint = {\n id: `${method}:${path}`,\n method,\n path,\n shortPath: shortPath || \"/\",\n summary: op.summary ?? \"\",\n description: op.description ?? \"\",\n tags,\n parameters: op.parameters ?? [],\n requestBody: op.requestBody,\n responses: op.responses ?? {},\n security: op.security,\n operationId: op.operationId\n };\n\n allEndpoints.push(endpoint);\n for (const tag of tags) {\n if (!tagMap.has(tag)) tagMap.set(tag, []);\n tagMap.get(tag)!.push(endpoint);\n }\n }\n }\n\n // Method sort order\n const ORDER: Record<string, number> = { get: 0,\npost: 1,\nput: 2,\npatch: 3,\ndelete: 4 };\n\n const groups: EndpointGroup[] = [];\n // Sort tags: use spec.tags order if available, else alphabetical\n const tagOrder = (spec.tags ?? []).map((t) => t.name);\n const sortedTags = [...tagMap.keys()].sort((a, b) => {\n const ai = tagOrder.indexOf(a);\n const bi = tagOrder.indexOf(b);\n if (ai !== -1 && bi !== -1) return ai - bi;\n if (ai !== -1) return -1;\n if (bi !== -1) return 1;\n return a.localeCompare(b);\n });\n\n for (const tag of sortedTags) {\n const endpoints = tagMap.get(tag)!;\n endpoints.sort((a, b) => {\n const pa = a.path.localeCompare(b.path);\n if (pa !== 0) return pa;\n return (ORDER[a.method] ?? 99) - (ORDER[b.method] ?? 99);\n });\n groups.push({\n tag,\n description: tagDescriptions.get(tag),\n endpoints\n });\n }\n\n return { groups,\nallEndpoints };\n}\n\n/**\n * Resolve a $ref string (e.g. \"#/components/schemas/Author\") to a schema name.\n */\nexport function resolveRefName(ref: string): string {\n const parts = ref.split(\"/\");\n return parts[parts.length - 1];\n}\n\n/**\n * Resolve a $ref to its actual schema from the spec.\n */\nexport function resolveRef(spec: OpenApiSpec, ref: string): unknown {\n const parts = ref.replace(\"#/\", \"\").split(\"/\");\n let current: unknown = spec;\n for (const part of parts) {\n current = (current as Record<string, unknown>)?.[part];\n }\n return current ?? {};\n}\n","import React from \"react\";\nimport {\n ArrowRightFromLineIcon,\n Chip,\n cls,\n defaultBorderMixin,\n iconSize,\n SlidersHorizontalIcon,\n Typography,\n UploadIcon\n} from \"@rebasepro/ui\";\nimport type { ParsedEndpoint, OpenApiSpec, OpenApiSchema } from \"./types\";\nimport { resolveRef, resolveRefName } from \"./parseSpec\";\n\n/**\n * Renders the documentation view for a single API endpoint:\n * parameters, request body schema, response schemas.\n */\nexport function EndpointDetail({ endpoint, spec }: { endpoint: ParsedEndpoint; spec: OpenApiSpec }) {\n return (\n <div className=\"p-6 space-y-8 max-w-4xl\">\n {/* Summary / Description */}\n {(endpoint.summary || endpoint.description) && (\n <div>\n {endpoint.summary && (\n <Typography variant=\"h6\" className=\"font-semibold mb-1\">\n {endpoint.summary}\n </Typography>\n )}\n {endpoint.description && (\n <Typography variant=\"body2\" className=\"text-text-secondary dark:text-text-secondary-dark\">\n {endpoint.description}\n </Typography>\n )}\n </div>\n )}\n\n {/* Parameters */}\n {endpoint.parameters.length > 0 && (\n <section>\n <SectionHeading icon={<SlidersHorizontalIcon size={iconSize.small} className=\"text-text-secondary dark:text-text-secondary-dark\" />} title=\"Parameters\"/>\n <div className={cls(\"rounded-lg border overflow-hidden\", defaultBorderMixin)}>\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"bg-surface-100 dark:bg-surface-900 text-left\">\n <th className=\"px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark\">\n Name\n </th>\n <th className=\"px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark\">\n In\n </th>\n <th className=\"px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark\">\n Type\n </th>\n <th className=\"px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark\">\n Description\n </th>\n </tr>\n </thead>\n <tbody>\n {endpoint.parameters.map((p, i) => (\n <tr\n key={p.name + i}\n className={cls(\"border-t\", defaultBorderMixin)}\n >\n <td className=\"px-4 py-2.5\">\n <code className=\"text-xs font-mono font-semibold\">{p.name}</code>\n {p.required && <span className=\"text-red-500 ml-1 text-xs\">*</span>}\n </td>\n <td className=\"px-4 py-2.5\">\n <Chip\n size=\"smallest\"\n colorScheme={p.in === \"path\" ? \"orangeDarker\" : \"cyanDarker\"}\n >\n {p.in}\n </Chip>\n </td>\n <td className=\"px-4 py-2.5 text-xs font-mono text-text-secondary dark:text-text-secondary-dark\">\n {schemaTypeLabel(p.schema)}\n </td>\n <td className=\"px-4 py-2.5 text-xs text-text-secondary dark:text-text-secondary-dark\">\n {p.description ?? \"—\"}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </section>\n )}\n\n {/* Request Body */}\n {endpoint.requestBody && (\n <section>\n <SectionHeading icon={<UploadIcon size={iconSize.small} className=\"text-text-secondary dark:text-text-secondary-dark\" />} title=\"Request Body\"/>\n {Object.entries(endpoint.requestBody.content ?? {}).map(([contentType, media]) => (\n <div key={contentType}>\n <Chip size=\"smallest\" colorScheme=\"blueDarker\" className=\"mb-3\">\n {contentType}\n </Chip>\n {media.schema && <SchemaBlock schema={media.schema} spec={spec} depth={0}/>}\n </div>\n ))}\n </section>\n )}\n\n {/* Responses */}\n <section>\n <SectionHeading icon={<ArrowRightFromLineIcon size={iconSize.small} className=\"text-text-secondary dark:text-text-secondary-dark\" />} title=\"Responses\"/>\n <div className=\"space-y-3\">\n {Object.entries(endpoint.responses).map(([code, res]) => (\n <div\n key={code}\n className={cls(\"rounded-lg border overflow-hidden\", defaultBorderMixin)}\n >\n <div\n className={cls(\n \"flex items-center gap-3 px-4 py-2.5\",\n \"bg-surface-50 dark:bg-surface-900/50\"\n )}\n >\n <StatusBadge code={code}/>\n <Typography\n variant=\"body2\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs\"\n >\n {res.description}\n </Typography>\n </div>\n {res.content &&\n Object.entries(res.content).map(\n ([ct, media]) =>\n media.schema && (\n <div\n key={ct}\n className={cls(\"px-4 py-3 border-t\", defaultBorderMixin)}\n >\n <SchemaBlock schema={media.schema} spec={spec} depth={0}/>\n </div>\n )\n )}\n </div>\n ))}\n </div>\n </section>\n </div>\n );\n}\n\n/* ── Schema Block ─────────────────────────────────────────────────── */\n\nfunction SchemaBlock({ schema, spec, depth }: { schema: OpenApiSchema; spec: OpenApiSpec; depth: number }) {\n // Resolve $ref\n if (schema.$ref) {\n const name = resolveRefName(schema.$ref);\n const resolved = resolveRef(spec, schema.$ref) as OpenApiSchema;\n return (\n <div>\n <Typography\n variant=\"caption\"\n className=\"text-primary dark:text-primary-dark font-mono text-xs mb-2 block\"\n >\n {name}\n </Typography>\n <SchemaBlock schema={resolved} spec={spec} depth={depth}/>\n </div>\n );\n }\n\n // Object with properties\n if (schema.properties) {\n const required = new Set(schema.required ?? []);\n return (\n <div\n className={cls(\n \"rounded-lg overflow-hidden\",\n depth > 0 && `border ml-4 mt-1 ${defaultBorderMixin}`\n )}\n >\n <table className=\"w-full text-xs\">\n <tbody>\n {Object.entries(schema.properties).map(([key, prop]) => (\n <tr\n key={key}\n className={cls(\"border-t first:border-t-0\", defaultBorderMixin)}\n >\n <td className=\"px-3 py-2 align-top w-36\">\n <code className=\"font-mono font-semibold text-text-primary dark:text-text-primary-dark\">\n {key}\n </code>\n {required.has(key) && <span className=\"text-red-500 ml-0.5\">*</span>}\n {prop.readOnly && (\n <span className=\"ml-1.5 text-[9px] text-text-secondary dark:text-text-secondary-dark italic\">\n read-only\n </span>\n )}\n </td>\n <td className=\"px-3 py-2 align-top w-28\">\n <span className=\"font-mono text-text-secondary dark:text-text-secondary-dark\">\n {schemaTypeLabel(prop)}\n </span>\n </td>\n <td className=\"px-3 py-2 align-top text-text-secondary dark:text-text-secondary-dark\">\n {prop.description ?? \"\"}\n {prop.enum && (\n <div className=\"flex flex-wrap gap-1 mt-1\">\n {prop.enum.map((v) => (\n <span\n key={String(v)}\n className=\"px-1.5 py-0.5 rounded bg-surface-200 dark:bg-surface-800 text-[10px] font-mono\"\n >\n {String(v)}\n </span>\n ))}\n </div>\n )}\n {prop.properties && <SchemaBlock schema={prop} spec={spec} depth={depth + 1}/>}\n {prop.$ref && <SchemaBlock schema={prop} spec={spec} depth={depth + 1}/>}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n }\n\n // Array\n if (schema.type === \"array\" && schema.items) {\n return (\n <div>\n <span className=\"font-mono text-xs text-text-secondary dark:text-text-secondary-dark\">Array of:</span>\n <SchemaBlock schema={schema.items} spec={spec} depth={depth + 1}/>\n </div>\n );\n }\n\n // Primitive\n return (\n <span className=\"font-mono text-xs text-text-secondary dark:text-text-secondary-dark\">\n {schemaTypeLabel(schema)}\n </span>\n );\n}\n\n/* ── Helpers ──────────────────────────────────────────────────────── */\n\nfunction schemaTypeLabel(schema?: OpenApiSchema): string {\n if (!schema) return \"any\";\n if (schema.$ref) return resolveRefName(schema.$ref);\n if (schema.type === \"array\") return `${schemaTypeLabel(schema.items)}[]`;\n if (schema.format) return `${schema.type} (${schema.format})`;\n return schema.type ?? \"object\";\n}\n\nfunction SectionHeading({ icon, title }: { icon: React.ReactNode; title: string }) {\n return (\n <div className=\"flex items-center gap-2 mb-3\">\n {icon}\n <Typography variant=\"subtitle2\" className=\"font-semibold text-sm\">\n {title}\n </Typography>\n </div>\n );\n}\n\nfunction StatusBadge({ code }: { code: string }) {\n const n = parseInt(code, 10);\n const color =\n n < 300\n ? \"text-emerald-600 dark:text-emerald-400\"\n : n < 400\n ? \"text-blue-600 dark:text-blue-400\"\n : n < 500\n ? \"text-amber-600 dark:text-amber-400\"\n : \"text-red-600 dark:text-red-400\";\n\n return <span className={cls(\"text-xs font-bold font-mono\", color)}>{code}</span>;\n}\n","import React, { useState, useCallback, useMemo, useEffect } from \"react\";\nimport {\n Button,\n cls,\n defaultBorderMixin,\n IconButton,\n iconSize,\n LoaderIcon,\n PlusIcon,\n SendIcon,\n TextField,\n Typography,\n XIcon\n} from \"@rebasepro/ui\";\nimport { useRebaseContext, UserSelectPopover, SelectableUser } from \"@rebasepro/app\";\nimport { AuthSimulationSelector } from \"../AuthSimulationSelector\";\nimport type { ParsedEndpoint } from \"./types\";\nimport type { User } from \"@rebasepro/types\";\n\ninterface TryItPanelProps {\n endpoint: ParsedEndpoint;\n apiUrl: string;\n getAuthToken: () => Promise<string | null | undefined>;\n user: User | null;\n basePath?: string;\n}\n\n/**\n * Interactive \"Try It\" panel that lets the user execute API requests\n * using their current JWT token directly from the Studio.\n */\nexport function TryItPanel({ endpoint, apiUrl, getAuthToken, user, basePath = \"\" }: TryItPanelProps) {\n const storageKey = `rebase_apiexplorer_${endpoint.method}_${endpoint.path}`;\n\n const [pathParams, setPathParams] = useState<Record<string, string>>(() => {\n try { const v = localStorage.getItem(`${storageKey}_path`); if (v) return JSON.parse(v); } catch { /* ignore */ }\n return {};\n });\n const [queryParams, setQueryParams] = useState<Record<string, string>>(() => {\n try { const v = localStorage.getItem(`${storageKey}_query`); if (v) return JSON.parse(v); } catch { /* ignore */ }\n return {};\n });\n const [customHeaders, setCustomHeaders] = useState<Array<{ key: string; value: string }>>(() => {\n try { const v = localStorage.getItem(`${storageKey}_headers`); if (v) return JSON.parse(v); } catch { /* ignore */ }\n return [{ key: \"rebase-branch\",\nvalue: \"\" }];\n });\n const [body, setBody] = useState(() => {\n try { const v = localStorage.getItem(`${storageKey}_body`); if (v) return JSON.parse(v); } catch { /* ignore */ }\n return buildBodyTemplate(endpoint);\n });\n const [response, setResponse] = useState<{ status: number; statusText: string; body: string; time: number } | null>(\n null\n );\n const [loading, setLoading] = useState(false);\n const [authMode, setAuthMode] = useState<\"jwt\" | \"none\">(\"jwt\");\n const [validationError, setValidationError] = useState<string | null>(null);\n\n const rebaseContext = useRebaseContext();\n const currentUser = rebaseContext.authController?.user;\n\n const users = useMemo((): SelectableUser[] => {\n const managed: SelectableUser[] = [];\n if (currentUser) {\n managed.push({\n uid: currentUser.uid,\n displayName: currentUser.displayName,\n email: currentUser.email,\n photoURL: currentUser.photoURL,\n roles: currentUser.roles\n });\n }\n return managed;\n }, [currentUser]);\n\n const currentSelectableUser = useMemo((): SelectableUser | null => {\n if (!currentUser) return null;\n return {\n uid: currentUser.uid,\n displayName: currentUser.displayName,\n email: currentUser.email,\n photoURL: currentUser.photoURL,\n roles: currentUser.roles\n };\n }, [currentUser]);\n\n const [selectedUser, setSelectedUser] = useState<SelectableUser | null>(null);\n\n useEffect(() => {\n localStorage.setItem(`${storageKey}_path`, JSON.stringify(pathParams));\n localStorage.setItem(`${storageKey}_query`, JSON.stringify(queryParams));\n localStorage.setItem(`${storageKey}_headers`, JSON.stringify(customHeaders));\n localStorage.setItem(`${storageKey}_body`, JSON.stringify(body));\n }, [storageKey, pathParams, queryParams, customHeaders, body]);\n\n // Build the final URL\n const resolvedUrl = useMemo(() => {\n const base = basePath.startsWith(\"/\") ? basePath : `/${basePath}`;\n const cleanBase = base === \"/\" ? \"\" : base;\n let url = `${apiUrl.replace(/\\/+$/, \"\")}${cleanBase}${endpoint.path}`;\n // Replace path params\n for (const [key, val] of Object.entries(pathParams)) {\n url = url.replace(`{${key}}`, encodeURIComponent(val));\n }\n // Append query params\n const qp = Object.entries(queryParams).filter(([, v]) => v.trim() !== \"\");\n if (qp.length > 0) {\n url += \"?\" + qp.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join(\"&\");\n }\n return url;\n }, [apiUrl, basePath, endpoint.path, pathParams, queryParams]);\n\n const pathParamDefs = endpoint.parameters.filter((p) => p.in === \"path\");\n const queryParamDefs = endpoint.parameters.filter((p) => p.in === \"query\");\n const hasBody = [\"post\", \"put\", \"patch\"].includes(endpoint.method);\n\n const execute = useCallback(async () => {\n setValidationError(null);\n if (hasBody && body.trim()) {\n try {\n JSON.parse(body);\n } catch (err: unknown) {\n setValidationError(`Invalid JSON: ${err instanceof Error ? err.message : String(err)}`);\n return;\n }\n }\n\n setLoading(true);\n setResponse(null);\n const start = performance.now();\n\n try {\n const headers: Record<string, string> = { \"Content-Type\": \"application/json\" };\n\n for (const h of customHeaders) {\n if (h.key.trim()) headers[h.key.trim()] = h.value;\n }\n\n if (authMode === \"jwt\") {\n const token = await getAuthToken();\n if (token) headers[\"Authorization\"] = `Bearer ${token}`;\n if (selectedUser && selectedUser.uid !== currentUser?.uid) {\n headers[\"x-rebase-impersonate\"] = selectedUser.uid;\n }\n }\n\n const res = await fetch(resolvedUrl, {\n method: endpoint.method.toUpperCase(),\n headers,\n body: hasBody && body.trim() ? body : undefined\n });\n\n const elapsed = Math.round(performance.now() - start);\n let text: string;\n\n const rawText = await res.text();\n try {\n const json = JSON.parse(rawText);\n text = JSON.stringify(json, null, 2);\n } catch {\n text = rawText;\n }\n\n setResponse({ status: res.status,\nstatusText: res.statusText,\nbody: text,\ntime: elapsed });\n } catch (err: unknown) {\n setResponse({\n status: 0,\n statusText: \"Network Error\",\n body: err instanceof Error ? err.message : \"Request failed\",\n time: Math.round(performance.now() - start)\n });\n } finally {\n setLoading(false);\n }\n }, [resolvedUrl, endpoint.method, hasBody, body, authMode, getAuthToken, customHeaders, selectedUser, currentUser?.uid]);\n\n return (\n <div className=\"flex flex-col h-full\">\n <div className=\"p-5 space-y-5 overflow-y-auto flex-1\">\n {/* Auth Mode */}\n <AuthSimulationSelector\n authMode={authMode}\n setAuthMode={setAuthMode}\n selectedUser={selectedUser}\n setSelectedUser={setSelectedUser}\n users={users}\n loading={false}\n currentUser={currentSelectableUser}\n />\n\n {/* Path Params */}\n {pathParamDefs.length > 0 && (\n <ParamSection\n title=\"Path Parameters\"\n params={pathParamDefs}\n values={pathParams}\n onChange={(k, v) => setPathParams((prev) => ({ ...prev,\n[k]: v }))}\n />\n )}\n\n {/* Query Params */}\n {queryParamDefs.length > 0 && (\n <ParamSection\n title=\"Query Parameters\"\n params={queryParamDefs}\n values={queryParams}\n onChange={(k, v) => setQueryParams((prev) => ({ ...prev,\n[k]: v }))}\n />\n )}\n\n {/* Custom Headers */}\n <CustomKeyValueSection\n title=\"Custom Headers\"\n values={customHeaders}\n onChange={(i, k, v) => {\n const next = [...customHeaders];\n next[i] = { key: k,\nvalue: v };\n setCustomHeaders(next);\n }}\n onAdd={() => setCustomHeaders((prev) => [...prev, { key: \"\",\nvalue: \"\" }])}\n onRemove={(i) => {\n const next = [...customHeaders];\n next.splice(i, 1);\n setCustomHeaders(next);\n }}\n />\n\n {/* Request Body */}\n {hasBody && (\n <div>\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider mb-2 block\"\n >\n Request Body\n </Typography>\n <TextField\n multiline\n minRows={10}\n aria-label=\"Request Body\"\n value={body}\n onChange={(e) => { setBody(e.target.value); setValidationError(null); }}\n spellCheck={false}\n error={!!validationError}\n className=\"w-full\"\n inputClassName=\"font-mono text-xs p-3 resize-y\"\n />\n {validationError && (\n <Typography variant=\"caption\" className=\"text-red-500 mt-1 block text-xs\">\n {validationError}\n </Typography>\n )}\n </div>\n )}\n\n {/* URL Preview */}\n <div className=\"rounded-lg bg-surface-100 dark:bg-surface-900 p-3\">\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-[10px] uppercase tracking-wider block mb-1\"\n >\n Request URL\n </Typography>\n <code className=\"text-xs font-mono text-text-primary dark:text-text-primary-dark break-all\">\n {resolvedUrl}\n </code>\n </div>\n\n {/* Execute Button */}\n <Button variant=\"filled\" onClick={execute} disabled={loading} className=\"w-full\">\n {loading ? (\n <span className=\"flex items-center gap-2\">\n <LoaderIcon size={iconSize.small} className=\"animate-spin\" />\n Sending…\n </span>\n ) : (\n <span className=\"flex items-center gap-2\">\n <SendIcon size={iconSize.small} />\n Send Request\n </span>\n )}\n </Button>\n\n {/* Response */}\n {response && (\n <div className={cls(\"rounded-lg border overflow-hidden\", defaultBorderMixin)}>\n <div\n className={cls(\n \"flex items-center justify-between px-4 py-2.5\",\n \"bg-surface-50 dark:bg-surface-900/50\"\n )}\n >\n <div className=\"flex items-center gap-3\">\n <ResponseBadge status={response.status}/>\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs\"\n >\n {response.statusText}\n </Typography>\n </div>\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs font-mono\"\n >\n {response.time}ms\n </Typography>\n </div>\n <pre\n className={cls(\n \"p-4 text-xs font-mono overflow-auto max-h-96\",\n \"bg-surface-950 text-emerald-400\",\n \"dark:bg-surface-900 dark:text-emerald-400\"\n )}\n >\n {response.body}\n </pre>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/* ── Param Section ────────────────────────────────────────────────── */\n\nfunction ParamSection({\n title,\n params,\n values,\n onChange\n}: {\n title: string;\n params: ParsedEndpoint[\"parameters\"];\n values: Record<string, string>;\n onChange: (_key: string, _value: string) => void;\n}) {\n const paramIdBase = React.useId();\n return (\n <div>\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider mb-2 block\"\n >\n {title}\n </Typography>\n <div className=\"space-y-2\">\n {params.map((p, index) => (\n <div key={p.name} className=\"flex items-center gap-3\">\n <label className=\"w-32 shrink-0\" htmlFor={`${paramIdBase}-${index}-param`}>\n <code className=\"text-xs font-mono font-semibold\">{p.name}</code>\n {p.required && <span className=\"text-red-500 ml-0.5 text-xs\">*</span>}\n </label>\n <TextField\n id={`${paramIdBase}-${index}-param`}\n size=\"small\"\n placeholder={p.description ?? p.name}\n value={values[p.name] ?? \"\"}\n onChange={(e) => onChange(p.name, e.target.value)}\n className=\"flex-1\"\n inputClassName=\"font-mono text-xs\"\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nfunction CustomKeyValueSection({\n title,\n values,\n onChange,\n onAdd,\n onRemove\n}: {\n title: string;\n values: Array<{ key: string; value: string }>;\n onChange: (index: number, key: string, value: string) => void;\n onAdd: () => void;\n onRemove: (index: number) => void;\n}) {\n return (\n <div>\n <div className=\"flex items-center justify-between mb-2\">\n <Typography\n variant=\"caption\"\n className=\"text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider block\"\n >\n {title}\n </Typography>\n <Button\n variant=\"text\"\n size=\"small\"\n color=\"primary\"\n onClick={onAdd}\n className=\"text-xs p-0 min-h-0\"\n >\n <PlusIcon size={iconSize.small} className=\"mr-1\" /> Add Header\n </Button>\n </div>\n <div className=\"space-y-2\">\n {values.map((v, i) => (\n <div key={i} className=\"flex items-center gap-2\">\n <TextField\n size=\"small\"\n aria-label={`Header ${i + 1} name`}\n placeholder=\"Header name\"\n value={v.key}\n onChange={(e) => onChange(i, e.target.value, v.value)}\n className=\"w-1/3\"\n inputClassName=\"font-mono text-xs\"\n />\n <TextField\n size=\"small\"\n aria-label={`Header ${i + 1} value`}\n placeholder=\"Value\"\n value={v.value}\n onChange={(e) => onChange(i, v.key, e.target.value)}\n className=\"flex-1\"\n inputClassName=\"font-mono text-xs\"\n />\n <IconButton\n size=\"small\"\n onClick={() => onRemove(i)}\n className=\"text-text-secondary hover:text-red-500 shrink-0\"\n title=\"Remove\"\n >\n <XIcon size={iconSize.small} />\n </IconButton>\n </div>\n ))}\n {values.length === 0 && (\n <Typography variant=\"caption\" className=\"text-text-secondary/50 italic text-xs\">\n No custom headers added.\n </Typography>\n )}\n </div>\n </div>\n );\n}\n\n/* ── Helpers ──────────────────────────────────────────────────────── */\n\nfunction ResponseBadge({ status }: { status: number }) {\n let colorClass = \"text-red-500\";\n if (status >= 200 && status < 300) colorClass = \"text-emerald-500\";\n else if (status >= 300 && status < 400) colorClass = \"text-blue-500\";\n else if (status >= 400 && status < 500) colorClass = \"text-amber-500\";\n\n return (\n <span className={cls(\"text-xs font-bold font-mono\", colorClass)}>\n {status || \"ERR\"}\n </span>\n );\n}\n\nfunction buildBodyTemplate(endpoint: ParsedEndpoint): string {\n if (!endpoint.requestBody?.content) return \"{\\n \\n}\";\n const json = endpoint.requestBody.content[\"application/json\"];\n if (!json?.schema?.properties) return \"{\\n \\n}\";\n\n const props = json.schema.properties;\n const lines: string[] = [\"{\"];\n const keys = Object.keys(props);\n keys.forEach((key, i) => {\n const prop = props[key];\n if (prop.readOnly) return;\n const comma = i < keys.length - 1 ? \",\" : \"\";\n const val = defaultValue(prop);\n lines.push(` \"${key}\": ${val}${comma}`);\n });\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\nfunction defaultValue(schema: { type?: string; format?: string; enum?: (string | number)[] }): string {\n if (schema.enum) return JSON.stringify(schema.enum[0]);\n switch (schema.type) {\n case \"string\":\n return schema.format === \"date-time\" ? `\"${new Date().toISOString()}\"` : '\"\"';\n case \"number\":\n case \"integer\":\n return \"0\";\n case \"boolean\":\n return \"false\";\n case \"array\":\n return \"[]\";\n default:\n return \"null\";\n }\n}\n","import React, { useState, useEffect, useMemo } from \"react\";\nimport { useApiBase, useApiConfig, useAuthController } from \"@rebasepro/app\";\nimport {\n CircularProgress,\n Typography,\n Alert,\n cls,\n Button,\n Chip,\n defaultBorderMixin,\n SearchBar,\n iconSize\n} from \"@rebasepro/ui\";\nimport { BookOpenIcon, PlayIcon } from \"@rebasepro/ui\";\nimport { EndpointDetail } from \"./EndpointDetail\";\nimport { TryItPanel } from \"./TryItPanel\";\nimport type { OpenApiSpec, ParsedEndpoint } from \"./types\";\nimport { parseOpenApiSpec } from \"./parseSpec\";\n\n/**\n * Custom-built API Explorer for Rebase Studio.\n * No external dependencies — renders the OpenAPI spec natively\n * with deep integration into the Rebase auth system.\n */\nexport function ApiExplorer() {\n const apiConfig = useApiConfig();\n const apiBase = useApiBase();\n const authController = useAuthController();\n const apiUrl = apiConfig?.apiUrl;\n\n const [spec, setSpec] = useState<OpenApiSpec | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n\n const [selectedEndpoint, setSelectedEndpoint] = useState<ParsedEndpoint | null>(null);\n const [sidebarFilter, setSidebarFilter] = useState(\"\");\n const [tryItOpen, setTryItOpen] = useState(false);\n\n // Fetch OpenAPI spec\n useEffect(() => {\n if (!apiUrl) return;\n let cancelled = false;\n const specUrl = `${apiBase}/docs`;\n\n (async () => {\n try {\n // The spec endpoint itself is public on a stock backend, but\n // `apiUrl` may route through an authenticated proxy (the\n // console's Studio embed) — carry the token like every other\n // request in this view, and like LogsExplorer does.\n const getAuthToken = apiConfig?.getAuthToken ?? authController.getAuthToken;\n const token = getAuthToken ? await getAuthToken() : null;\n const res = await fetch(specUrl, token ? { headers: { Authorization: `Bearer ${token}` } } : undefined);\n if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);\n const data = await res.json();\n if (!cancelled) {\n setSpec(data);\n setLoading(false);\n }\n } catch (err: unknown) {\n if (!cancelled) {\n setError(err instanceof Error ? err.message : \"Failed to load API spec\");\n setLoading(false);\n }\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [apiUrl, apiBase, apiConfig, authController]);\n\n // Parse spec into grouped endpoints\n const { groups, allEndpoints } = useMemo(() => {\n if (!spec) return { groups: [],\nallEndpoints: [] };\n return parseOpenApiSpec(spec);\n }, [spec]);\n\n // Filter\n const filteredGroups = useMemo(() => {\n if (!sidebarFilter.trim()) return groups;\n const q = sidebarFilter.toLowerCase();\n return groups\n .map((g) => ({\n ...g,\n endpoints: g.endpoints.filter(\n (e) =>\n e.path.toLowerCase().includes(q) ||\n e.summary.toLowerCase().includes(q) ||\n e.method.toLowerCase().includes(q)\n )\n }))\n .filter((g) => g.endpoints.length > 0);\n }, [groups, sidebarFilter]);\n\n // Auto-select first endpoint\n useEffect(() => {\n if (!selectedEndpoint && allEndpoints.length > 0) {\n setSelectedEndpoint(allEndpoints[0]);\n }\n }, [allEndpoints, selectedEndpoint]);\n\n // ── States ───────────────────────────────────────────────────────\n if (!apiUrl) {\n return (\n <div className=\"flex items-center justify-center h-full w-full p-8\">\n <Alert color=\"warning\">\n <Typography variant=\"body2\">\n No API URL configured. Ensure your app provides an{\" \"}\n <code className=\"font-mono text-xs\">apiUrl</code>.\n </Typography>\n </Alert>\n </div>\n );\n }\n\n if (loading) {\n return (\n <div className=\"flex flex-col items-center justify-center h-full w-full gap-4\">\n <CircularProgress size=\"medium\"/>\n <Typography variant=\"body2\" className=\"text-text-secondary dark:text-text-secondary-dark animate-pulse\">\n Loading API specification…\n </Typography>\n </div>\n );\n }\n\n if (error || !spec) {\n return (\n <div className=\"flex items-center justify-center h-full w-full p-8\">\n <Alert color=\"error\">\n <Typography variant=\"body2\">{error ?? \"Unknown error\"}</Typography>\n </Alert>\n </div>\n );\n }\n\n const METHOD_COLORS: Record<string, string> = {\n get: \"text-blue-600 dark:text-blue-400\",\n post: \"text-emerald-600 dark:text-emerald-400\",\n put: \"text-amber-600 dark:text-amber-400\",\n patch: \"text-orange-600 dark:text-orange-400\",\n delete: \"text-red-600 dark:text-red-400\"\n };\n\n return (\n <div className=\"flex h-full w-full overflow-hidden\">\n {/* ── Sidebar ──────────────────────────────────────── */}\n <div\n className={cls(\n \"w-72 min-w-[272px] flex flex-col h-full overflow-hidden border-r\",\n defaultBorderMixin,\n \"bg-surface-50 dark:bg-surface-900\"\n )}\n >\n {/* Header */}\n <div className=\"p-4 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <BookOpenIcon size={iconSize.medium} className=\"text-primary dark:text-primary-dark\" />\n <Typography variant=\"subtitle2\" className=\"font-semibold\">\n {spec.info?.title ?? \"API Reference\"}\n </Typography>\n </div>\n {spec.info?.version && (\n <Chip size=\"smallest\" colorScheme=\"cyanDarker\">\n v{spec.info.version}\n </Chip>\n )}\n {/* Search */}\n <div className=\"mb-2\">\n <SearchBar\n placeholder=\"Filter endpoints…\"\n size=\"small\"\n onTextSearch={(val) => setSidebarFilter(val ?? \"\")}\n />\n </div>\n\n {/* Auth status removed to avoid redundancy with the AuthSimulationSelector */}\n </div>\n\n {/* Endpoint list */}\n <div className=\"flex-1 overflow-y-auto px-2 pb-4\">\n {filteredGroups.map((group) => (\n <div key={group.tag} className=\"mb-3\">\n <Typography\n variant=\"caption\"\n className=\"px-2 py-1.5 text-text-secondary dark:text-text-secondary-dark uppercase tracking-wider font-semibold text-[10px]\"\n >\n {group.tag}\n </Typography>\n {group.endpoints.map((ep) => {\n const isSelected = selectedEndpoint?.id === ep.id;\n return (\n <Button\n key={ep.id}\n variant=\"text\"\n color=\"neutral\"\n fullWidth\n onClick={() => {\n setSelectedEndpoint(ep);\n setTryItOpen(false);\n }}\n className={cls(\n \"!justify-between !px-2.5 !py-1.5 !text-left !text-sm\",\n isSelected\n ? \"bg-surface-200 dark:bg-surface-800 font-medium\"\n : \"text-text-primary dark:text-text-primary-dark\"\n )}\n >\n <span className=\"truncate text-[13px] opacity-90\">{ep.summary || ep.shortPath}</span>\n <span\n className={cls(\n \"text-[10px] font-bold uppercase shrink-0\",\n METHOD_COLORS[ep.method] ?? \"text-text-secondary\"\n )}\n >\n {ep.method}\n </span>\n </Button>\n );\n })}\n </div>\n ))}\n {filteredGroups.length === 0 && (\n <Typography\n variant=\"body2\"\n className=\"text-center text-text-secondary dark:text-text-secondary-dark py-8\"\n >\n No endpoints match\n </Typography>\n )}\n </div>\n </div>\n\n {/* ── Main content ─────────────────────────────────── */}\n <div className=\"flex-1 flex flex-col h-full overflow-hidden\">\n {selectedEndpoint ? (\n <>\n {/* Top bar */}\n <div\n className={cls(\n \"flex items-center justify-between px-5 py-3 gap-4 shrink-0 border-b z-10\",\n defaultBorderMixin,\n \"bg-surface-50/80 dark:bg-surface-950/80 backdrop-blur-md sticky top-0\"\n )}\n >\n <div className=\"flex items-center gap-3 min-w-0\">\n <span\n className={cls(\n \"text-xs font-bold uppercase\",\n METHOD_COLORS[selectedEndpoint.method] ?? \"\"\n )}\n >\n {selectedEndpoint.method}\n </span>\n <code className=\"text-sm font-mono text-text-primary dark:text-text-primary-dark truncate\">\n {selectedEndpoint.path}\n </code>\n </div>\n <Button\n variant={tryItOpen ? \"filled\" : \"outlined\"}\n size=\"small\"\n onClick={() => setTryItOpen((v) => !v)}\n >\n <PlayIcon size={iconSize.small} className=\"mr-1\" />\n Try It\n </Button>\n </div>\n\n {/* Body */}\n <div className=\"flex-1 overflow-y-auto\">\n {tryItOpen ? (\n <TryItPanel\n key={selectedEndpoint.operationId || selectedEndpoint.path}\n endpoint={selectedEndpoint}\n apiUrl={apiUrl}\n getAuthToken={apiConfig?.getAuthToken ?? authController.getAuthToken}\n user={authController.user}\n basePath={spec?.servers?.[0]?.url || \"\"}\n />\n ) : (\n <EndpointDetail endpoint={selectedEndpoint} spec={spec}/>\n )}\n </div>\n </>\n ) : (\n <div className=\"flex items-center justify-center h-full\">\n <Typography variant=\"body2\" className=\"text-text-secondary dark:text-text-secondary-dark\">\n Select an endpoint from the sidebar\n </Typography>\n </div>\n )}\n </div>\n </div>\n );\n}\n\nApiExplorer.displayName = \"ApiExplorer\";\n\n"],"mappings":";;;;;;;;;AAKA,SAAgB,iBAAiB,MAG/B;CACE,MAAM,eAAiC,CAAC;CACxC,MAAM,yBAAS,IAAI,IAA8B;CAGjD,MAAM,kCAAkB,IAAI,IAAoB;CAChD,KAAK,MAAM,KAAK,KAAK,QAAQ,CAAC,GAC1B,gBAAgB,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE;CAGnD,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,GACzD,KAAK,MAAM,CAAC,QAAQ,OAAO,OAAO,QAAQ,OAAO,GAAG;EAChD,IAAI;GAAC;GAAO;GAAQ;GAAO;GAAS;EAAQ,CAAC,CAAC,QAAQ,MAAM,MAAM,IAAI;EAEtE,MAAM,OAAO,GAAG,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO;EACjD,MAAM,YAAY,KAAK,QAAQ,gBAAgB,EAAE;EAEjD,MAAM,WAA2B;GAC7B,IAAI,GAAG,OAAO,GAAG;GACjB;GACA;GACA,WAAW,aAAa;GACxB,SAAS,GAAG,WAAW;GAC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