@rebasepro/studio 0.30.0 → 0.31.0-canary.g902a0ce
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-Bqf6XYR1.js → ApiKeysView-9ZvwMPyh.js} +16 -6
- package/dist/ApiKeysView-9ZvwMPyh.js.map +1 -0
- package/dist/{JSEditor-DCnPXsx6.js → JSEditor-ojAVSkaU.js} +158 -100
- package/dist/JSEditor-ojAVSkaU.js.map +1 -0
- package/dist/{RLSEditor-zAat58U0.js → RLSEditor-BAwkENpj.js} +394 -206
- package/dist/RLSEditor-BAwkENpj.js.map +1 -0
- package/dist/{SQLEditor-DV_VEEpL.js → SQLEditor-DX9LfbU7.js} +10 -8
- package/dist/SQLEditor-DX9LfbU7.js.map +1 -0
- package/dist/{SchemaVisualizer-pCYQ_Ds6.js → SchemaVisualizer-C75TENPm.js} +196 -189
- package/dist/SchemaVisualizer-C75TENPm.js.map +1 -0
- package/dist/components/JSEditor/JSEditorSidebar.d.ts +3 -6
- package/dist/components/JSEditor/JSMonacoEditor.d.ts +10 -10
- package/dist/components/JSEditor/table_access.d.ts +39 -0
- package/dist/components/RLSEditor/policy-presets.d.ts +1 -1
- package/dist/components/RLSEditor/policyListing.d.ts +32 -12
- package/dist/components/RLSEditor/policyRules.d.ts +32 -14
- package/dist/components/RLSEditor/saveRules.d.ts +48 -18
- package/dist/components/RLSEditor/saveSecurityRules.d.ts +5 -4
- package/dist/components/SchemaVisualizer/useSchemaGraph.d.ts +13 -8
- package/dist/components/schema-source.d.ts +37 -0
- package/dist/index.es.js +9 -9
- package/dist/index.es.js.map +1 -1
- package/dist/schema-source-C4ekB7WU.js +93 -0
- package/dist/schema-source-C4ekB7WU.js.map +1 -0
- package/dist/{sql_utils-DXvmxiCq.js → sql_utils-CYcgpgam.js} +14 -12
- package/dist/sql_utils-CYcgpgam.js.map +1 -0
- package/dist/utils/sql_utils.d.ts +14 -10
- package/package.json +9 -9
- package/dist/ApiKeysView-Bqf6XYR1.js.map +0 -1
- package/dist/JSEditor-DCnPXsx6.js.map +0 -1
- package/dist/RLSEditor-zAat58U0.js.map +0 -1
- package/dist/SQLEditor-DV_VEEpL.js.map +0 -1
- package/dist/SchemaVisualizer-pCYQ_Ds6.js.map +0 -1
- package/dist/sql_utils-DXvmxiCq.js.map +0 -1
|
@@ -1,32 +1,62 @@
|
|
|
1
1
|
import type { StudioSchemaEditing } from "@rebasepro/app";
|
|
2
|
+
import type { RlsDescriptor, SecurityRule, TablePatch } from "@rebasepro/types";
|
|
3
|
+
import type { PolicyRule } from "./policyRules.js";
|
|
2
4
|
/**
|
|
3
|
-
* Where a
|
|
5
|
+
* Where a table's security rules go when the RLS editor saves them — the one
|
|
6
|
+
* function every RLS-editor write to the source goes through.
|
|
4
7
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The edit is sent as the rule operations it is (`TablePatch`): the rules the
|
|
9
|
+
* table declares, compared with the rules it should declare, by
|
|
10
|
+
* {@link rulePatches} — one `replaceRule` for an edited rule, one `addRule`
|
|
11
|
+
* for an imported one. A policy's name is a hash of its rule as written, so a
|
|
12
|
+
* rule the edit did not touch is never rewritten. A posture is `setRls`:
|
|
13
|
+
* removing the last rule is `"admin-only"`, never an empty list.
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* over the Studio bridge as {@link StudioSchemaEditing}, and `available` is
|
|
16
|
-
* false in the hosted console, where there is no source to edit and the direct
|
|
17
|
-
* write is the only thing there is.
|
|
15
|
+
* A table whose rules are inherited from `defaultRls` keeps `"inherit"`
|
|
16
|
+
* unless the person deliberately detaches it: `confirmDetach` asks (naming
|
|
17
|
+
* what happens), and saying no writes nothing.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* There are two doors onto one file. With a collection editor mounted, the
|
|
20
|
+
* write goes through its plan/apply flow — planned, shown as SQL, confirmed,
|
|
21
|
+
* applied to the database — arriving over the Studio bridge as
|
|
22
|
+
* {@link StudioSchemaEditing} (`@rebasepro/cms` is a *peer* of
|
|
23
|
+
* `@rebasepro/studio`, which has to run without it). Without one, it goes to
|
|
24
|
+
* the source-only schema editor directly.
|
|
25
|
+
*
|
|
26
|
+
* A separate module from the component so the decision can be asserted
|
|
27
|
+
* without a database and a rendered editor.
|
|
21
28
|
*/
|
|
22
29
|
export declare function saveRules(schemaEditing: StudioSchemaEditing, transport: {
|
|
23
30
|
apiBase: string;
|
|
24
31
|
getAuthToken?: () => Promise<string | null | undefined>;
|
|
25
|
-
},
|
|
32
|
+
}, table: {
|
|
33
|
+
slug: string;
|
|
34
|
+
rls: RlsDescriptor;
|
|
35
|
+
}, rules: readonly PolicyRule[], options: {
|
|
36
|
+
/** Asked before a table on `defaultRls` gets rules of its own; `false` keeps `"inherit"`. */
|
|
37
|
+
confirmDetach: (slug: string) => Promise<boolean>;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* A rule the policy editor built — its fields assigned one at a time, so
|
|
41
|
+
* wider than any one variant — as the `SecurityRule` variant its fields make
|
|
42
|
+
* it. Which fields go together is the variants' rule; the editor never sets
|
|
43
|
+
* two that exclude each other ({@link PolicyRule}).
|
|
44
|
+
*/
|
|
45
|
+
export declare function asSecurityRule(rule: PolicyRule): SecurityRule;
|
|
46
|
+
/**
|
|
47
|
+
* The operations that make `table` declare `rules`.
|
|
48
|
+
*
|
|
49
|
+
* Exported for the tests: the decision is the whole of what this module adds.
|
|
50
|
+
*/
|
|
51
|
+
export declare function rlsEdit(table: {
|
|
52
|
+
slug: string;
|
|
53
|
+
rls: RlsDescriptor;
|
|
54
|
+
}, rules: readonly SecurityRule[], confirmDetach: (slug: string) => Promise<boolean>): Promise<TablePatch[]>;
|
|
26
55
|
/**
|
|
27
|
-
* Was this rejection the person closing the plan dialog
|
|
56
|
+
* Was this rejection the person closing the plan dialog, or keeping a table's
|
|
57
|
+
* inherited rules?
|
|
28
58
|
*
|
|
29
|
-
*
|
|
59
|
+
* Either is an answer, not a failure, and a caller that treats every
|
|
30
60
|
* rejection as an error reports someone's own choice back to them in red — as
|
|
31
61
|
* the collection editor once did, with "Error persisting collection: The schema
|
|
32
62
|
* change was not applied."
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { TablePatch } from "@rebasepro/types";
|
|
1
2
|
/**
|
|
2
|
-
* Write a
|
|
3
|
+
* Write a table's rule edits to its source file: `{ patches }` to the
|
|
4
|
+
* source-only schema editor (`/admin/schema-editor/apply`).
|
|
3
5
|
*
|
|
4
6
|
* The schema-editor routes sit behind an admin gate that accepts a bearer token
|
|
5
7
|
* and nothing else — there is no cookie fallback — so a request without an
|
|
@@ -11,9 +13,8 @@
|
|
|
11
13
|
* It lives in its own module rather than inline in the component so that the
|
|
12
14
|
* header can be asserted without rendering the whole RLS editor.
|
|
13
15
|
*/
|
|
14
|
-
export declare function
|
|
16
|
+
export declare function postTablePatches(options: {
|
|
15
17
|
apiBase: string;
|
|
16
|
-
|
|
17
|
-
securityRules: unknown[];
|
|
18
|
+
patches: TablePatch[];
|
|
18
19
|
getAuthToken?: () => Promise<string | null | undefined>;
|
|
19
20
|
}): Promise<void>;
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import type { Node, Edge } from "@xyflow/react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TableDescriptor } from "@rebasepro/types";
|
|
3
3
|
export interface ColumnInfo {
|
|
4
|
+
/** The SQL column name: what the diagram shows, and what a foreign key's handle is named by. */
|
|
4
5
|
name: string;
|
|
6
|
+
/** The key on a JSON row, in the SDK and in filters. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** The Postgres type's kind (`uuid`, `text`, `enum`…). */
|
|
5
9
|
type: string;
|
|
6
|
-
/**
|
|
7
|
-
* The type the collection declares — `string`, `number`, `date`… — or
|
|
8
|
-
* `FK` for a relation's key. Not the database's column type: the diagram
|
|
9
|
-
* is drawn from the collections, and a property's column type depends on
|
|
10
|
-
* more than its `type` (`columnType`, `isId`, integer validation).
|
|
11
|
-
*/
|
|
10
|
+
/** The Postgres type as SQL spells it: `varchar(255)`, `integer[]`, `numeric(10, 2)`. */
|
|
12
11
|
typeLabel: string;
|
|
13
12
|
isPrimaryKey: boolean;
|
|
14
13
|
isForeignKey: boolean;
|
|
14
|
+
/** `NOT NULL`. */
|
|
15
15
|
isRequired: boolean;
|
|
16
|
+
/** A single-column `UNIQUE` constraint. */
|
|
17
|
+
isUnique: boolean;
|
|
18
|
+
/** A Postgres enum, or a closed value set (`.oneOf`). */
|
|
16
19
|
isEnum: boolean;
|
|
17
20
|
enumValues?: string[];
|
|
21
|
+
/** The `belongsTo` relation this column is the foreign key of. */
|
|
18
22
|
relationName?: string;
|
|
19
23
|
}
|
|
20
24
|
export interface TableNodeData {
|
|
21
25
|
tableName: string;
|
|
26
|
+
/** The name the table was defined under. */
|
|
22
27
|
collectionName: string;
|
|
23
28
|
slug: string;
|
|
24
29
|
columns: ColumnInfo[];
|
|
@@ -66,7 +71,7 @@ export interface UseSchemaGraphResult {
|
|
|
66
71
|
total: number;
|
|
67
72
|
} | null;
|
|
68
73
|
}
|
|
69
|
-
export declare const useSchemaGraph: (
|
|
74
|
+
export declare const useSchemaGraph: (descriptors: readonly TableDescriptor[] | undefined,
|
|
70
75
|
/**
|
|
71
76
|
* `schema.table` for every table the database reports RLS on, or `null`
|
|
72
77
|
* when there is no SQL capability to ask. See {@link useLiveRlsTables}.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type TableDescriptorsState } from "@rebasepro/app";
|
|
3
|
+
/**
|
|
4
|
+
* Why Studio has no tables to render from, when it has none: the project's
|
|
5
|
+
* runtime predates `GET /api/schema/tables`, the backend has no auth to
|
|
6
|
+
* describe them to, or the request failed. `undefined` when the tables are
|
|
7
|
+
* there (or still loading).
|
|
8
|
+
*
|
|
9
|
+
* The tables are the server's — `useTableDescriptors` from `@rebasepro/app`,
|
|
10
|
+
* with or without a CMS on the page — and there is no other source to fall
|
|
11
|
+
* back on: an older runtime is upgraded, not imitated.
|
|
12
|
+
*/
|
|
13
|
+
export type SchemaSourceProblem = {
|
|
14
|
+
kind: "outdated";
|
|
15
|
+
} | {
|
|
16
|
+
kind: "no-auth";
|
|
17
|
+
} | {
|
|
18
|
+
kind: "failed";
|
|
19
|
+
error: Error;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
};
|
|
22
|
+
/** The {@link SchemaSourceProblem} of a descriptors state, if there is one. */
|
|
23
|
+
export declare function schemaSourceProblem(state: TableDescriptorsState): SchemaSourceProblem | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A whole pane's worth of "there is no schema to draw from, and why" — for a
|
|
26
|
+
* view that renders nothing without the tables (the schema visualizer).
|
|
27
|
+
*/
|
|
28
|
+
export declare function SchemaSourceProblemView({ problem }: {
|
|
29
|
+
problem: SchemaSourceProblem;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* The same, as a banner above a view that still works without the tables —
|
|
33
|
+
* the RLS editor still lists what the database holds.
|
|
34
|
+
*/
|
|
35
|
+
export declare function SchemaSourceProblemAlert({ problem }: {
|
|
36
|
+
problem: SchemaSourceProblem;
|
|
37
|
+
}): React.JSX.Element;
|
package/dist/index.es.js
CHANGED
|
@@ -203,7 +203,7 @@ function StudioHomePage({ additionalActions, additionalChildrenStart, additional
|
|
|
203
203
|
color: "secondary",
|
|
204
204
|
className: "mb-4 max-w-2xl",
|
|
205
205
|
children: [
|
|
206
|
-
"Generate a fully-typed SDK from your
|
|
206
|
+
"Generate a fully-typed SDK from your tables with",
|
|
207
207
|
" ",
|
|
208
208
|
/* @__PURE__ */ jsx("code", {
|
|
209
209
|
className: "text-emerald-400 font-mono text-xs bg-emerald-400/10 px-1.5 py-0.5 rounded",
|
|
@@ -323,7 +323,7 @@ function SyntaxHighlightedSnippet({ baseUrl }) {
|
|
|
323
323
|
}),
|
|
324
324
|
/* @__PURE__ */ jsx("span", {
|
|
325
325
|
className: tx,
|
|
326
|
-
children: " {
|
|
326
|
+
children: " { tablesDictionary, "
|
|
327
327
|
}),
|
|
328
328
|
/* @__PURE__ */ jsx("span", {
|
|
329
329
|
className: kw,
|
|
@@ -414,7 +414,7 @@ function SyntaxHighlightedSnippet({ baseUrl }) {
|
|
|
414
414
|
"\n",
|
|
415
415
|
/* @__PURE__ */ jsx("span", {
|
|
416
416
|
className: tx,
|
|
417
|
-
children: "
|
|
417
|
+
children: " tables"
|
|
418
418
|
}),
|
|
419
419
|
/* @__PURE__ */ jsx("span", {
|
|
420
420
|
className: op,
|
|
@@ -422,7 +422,7 @@ function SyntaxHighlightedSnippet({ baseUrl }) {
|
|
|
422
422
|
}),
|
|
423
423
|
/* @__PURE__ */ jsx("span", {
|
|
424
424
|
className: tx,
|
|
425
|
-
children: "
|
|
425
|
+
children: "tablesDictionary"
|
|
426
426
|
}),
|
|
427
427
|
/* @__PURE__ */ jsx("span", {
|
|
428
428
|
className: op,
|
|
@@ -589,17 +589,17 @@ function SyntaxHighlightedSnippet({ baseUrl }) {
|
|
|
589
589
|
}
|
|
590
590
|
//#endregion
|
|
591
591
|
//#region src/components/RebaseStudio.tsx
|
|
592
|
-
var SQLEditor = lazyChunk(() => import("./SQLEditor-
|
|
593
|
-
var JSEditor = lazyChunk(() => import("./JSEditor-
|
|
594
|
-
var RLSEditor = lazyChunk(() => import("./RLSEditor-
|
|
592
|
+
var SQLEditor = lazyChunk(() => import("./SQLEditor-DX9LfbU7.js").then((m) => ({ default: m.SQLEditor })));
|
|
593
|
+
var JSEditor = lazyChunk(() => import("./JSEditor-ojAVSkaU.js").then((m) => ({ default: m.JSEditor })));
|
|
594
|
+
var RLSEditor = lazyChunk(() => import("./RLSEditor-BAwkENpj.js").then((m) => ({ default: m.RLSEditor })));
|
|
595
595
|
var StorageView = lazyChunk(() => import("./StorageView-CPkDKbsX.js").then((m) => ({ default: m.StorageView })));
|
|
596
596
|
var CronJobsView = lazyChunk(() => import("./CronJobsView-CMa1E-Tx.js").then((m) => ({ default: m.CronJobsView })));
|
|
597
|
-
var SchemaVisualizer = lazyChunk(() => import("./SchemaVisualizer-
|
|
597
|
+
var SchemaVisualizer = lazyChunk(() => import("./SchemaVisualizer-C75TENPm.js").then((m) => ({ default: m.SchemaVisualizer })));
|
|
598
598
|
var BranchesView = lazyChunk(() => import("./BranchesView-DqIfywjf.js").then((m) => ({ default: m.BranchesView })));
|
|
599
599
|
var BackupsView = lazyChunk(() => import("./BackupsView-BhOHB6iP.js").then((m) => ({ default: m.BackupsView })));
|
|
600
600
|
var ApiExplorer = lazyChunk(() => import("./ApiExplorer-CJQZnOcP.js").then((m) => ({ default: m.ApiExplorer })));
|
|
601
601
|
var LogsExplorer = lazyChunk(() => import("./LogsExplorer-C-bwDFIl.js").then((m) => ({ default: m.LogsExplorer })));
|
|
602
|
-
var ApiKeysView = lazyChunk(() => import("./ApiKeysView-
|
|
602
|
+
var ApiKeysView = lazyChunk(() => import("./ApiKeysView-9ZvwMPyh.js").then((m) => ({ default: m.ApiKeysView })));
|
|
603
603
|
/**
|
|
604
604
|
* Declarative component to configure the Studio in Rebase.
|
|
605
605
|
* Renders nothing — purely registers config into the RebaseRegistry.
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","names":[],"sources":["../src/components/StudioHomePage.tsx","../src/components/RebaseStudio.tsx"],"sourcesContent":["import type { AppView, HomePageSection, PluginGenericProps } from \"@rebasepro/cms-types\";\nimport { studioSchemaToolEnabled } from \"@rebasepro/cms-types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { Card, cls, Container, ExpandablePanel, Typography } from \"@rebasepro/ui\";\nimport { IconForView, useApiConfig, useNavigationGroupLabel, useRebaseContext, useRebaseRegistry, useRestoreScroll, useSlot, useTranslation } from \"@rebasepro/app\";\nimport { useNavigate } from \"react-router\";\nimport { useStudioBreadcrumbs, SchemaDriftBanner } from \"@rebasepro/app\";\n\n/* ═══════════════════════════════════════════════════════════════\n Studio tool sections, derived from the registered Studio views\n ═══════════════════════════════════════════════════════════════ */\n\ninterface StudioTool {\n path: string;\n name: string;\n description: string;\n icon?: string | React.ReactNode;\n}\n\ninterface StudioSection {\n label: string;\n tools: StudioTool[];\n}\n\n/** The view metadata the cards need — not the rendered `view` itself. */\ntype StudioViewMeta = Pick<AppView, \"slug\" | \"name\" | \"group\" | \"description\" | \"icon\" | \"hideFromNavigation\">;\n\n/** Group order for the home page; unknown groups are appended in view order. */\nconst GROUP_ORDER = [\"Database\", \"Compute\", \"Storage\", \"API\", \"Access Control\"];\n\nconst UNGROUPED_LABEL = \"Tools\";\n\n/**\n * Build the home page sections from the Studio views that are actually\n * registered, so a card exists if and only if its route does. A hand-written\n * list drifts: it used to advertise Users and Roles pages that 404, while\n * omitting the Backups view that does exist.\n */\nfunction buildSections(views: StudioViewMeta[]): StudioSection[] {\n const byGroup = new Map<string, StudioTool[]>();\n\n for (const view of views) {\n if (view.hideFromNavigation) continue;\n const label = view.group ?? UNGROUPED_LABEL;\n const tools = byGroup.get(label) ?? [];\n tools.push({\n path: `/${view.slug}`,\n name: view.name,\n description: view.description ?? \"\",\n icon: view.icon\n });\n byGroup.set(label, tools);\n }\n\n const ordered = [\n ...GROUP_ORDER.filter(g => byGroup.has(g)),\n ...[...byGroup.keys()].filter(g => !GROUP_ORDER.includes(g))\n ];\n\n return ordered.map(label => ({ label,\ntools: byGroup.get(label)! }));\n}\n\n/* ═══════════════════════════════════════════════════════════════ */\n\nconst COLLAPSED_STORAGE_KEY = \"rebase-studio-home-collapsed\";\n\nfunction useStudioCollapsedGroups(groupNames: string[]) {\n const [collapsed, setCollapsed] = useState<Set<string>>(() => {\n try {\n const stored = localStorage.getItem(COLLAPSED_STORAGE_KEY);\n return stored ? new Set(JSON.parse(stored)) : new Set<string>();\n } catch {\n return new Set<string>();\n }\n });\n\n const isGroupCollapsed = (name: string) => collapsed.has(name);\n\n const toggleGroupCollapsed = (name: string) => {\n setCollapsed(prev => {\n const next = new Set(prev);\n if (next.has(name)) {\n next.delete(name);\n } else {\n next.add(name);\n }\n try {\n localStorage.setItem(COLLAPSED_STORAGE_KEY, JSON.stringify([...next]));\n } catch { /* noop */ }\n return next;\n });\n };\n\n return { isGroupCollapsed, toggleGroupCollapsed };\n}\n\nexport function StudioHomePage({\n additionalActions,\n additionalChildrenStart,\n additionalChildrenEnd,\n sections,\n hiddenGroups\n}: {\n additionalActions?: React.ReactNode;\n additionalChildrenStart?: React.ReactNode;\n additionalChildrenEnd?: React.ReactNode;\n sections?: HomePageSection[];\n hiddenGroups?: string[];\n}) {\n const context = useRebaseContext();\n const breadcrumbs = useStudioBreadcrumbs();\n const navigate = useNavigate();\n const registry = useRebaseRegistry();\n const { t } = useTranslation();\n const apiConfig = useApiConfig();\n const apiUrl = absoluteApiUrl(apiConfig?.apiUrl);\n\n useEffect(() => {\n breadcrumbs.set({ breadcrumbs: [] });\n }, [breadcrumbs.set]);\n\n const { containerRef } = useRestoreScroll();\n\n const sectionProps: PluginGenericProps = { context };\n\n const pluginActions = useSlot(\"home.actions\", sectionProps);\n\n // The collection editor (\"schema\") is not part of `devViews` — RebaseNavigation\n // injects it when the admin enables a collection editor and the Studio's\n // tools include it. The same predicate, so the card tracks the route.\n const schemaEnabled = studioSchemaToolEnabled(registry);\n\n const filteredSections = useMemo(() => {\n const views: StudioViewMeta[] = [];\n if (schemaEnabled) {\n views.push({\n slug: \"schema\",\n name: t(\"studio_tool_schema\"),\n group: \"Database\",\n icon: \"LayoutList\",\n description: t(\"studio_tool_schema_description\")\n });\n }\n views.push(...(registry.studioConfig?.devViews ?? []));\n return buildSections(views).filter(s => !hiddenGroups?.includes(s.label));\n }, [registry.studioConfig?.devViews, schemaEnabled, hiddenGroups, t]);\n\n const groupNames = useMemo(\n () => filteredSections.map(s => s.label),\n [filteredSections]\n );\n\n const { isGroupCollapsed, toggleGroupCollapsed } = useStudioCollapsedGroups(groupNames);\n // The group name is the identifier this page orders and collapses by;\n // only what the reader sees is translated.\n const groupLabel = useNavigationGroupLabel();\n\n return (\n <div ref={containerRef} className=\"py-2 overflow-auto h-full w-full bg-surface-sheet\">\n <Container maxWidth=\"6xl\">\n <div className=\"mb-4 flex flex-col gap-2\">\n <SchemaDriftBanner />\n </div>\n\n {(additionalActions || pluginActions) && (\n <div className=\"w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4 justify-end\">\n {additionalActions}\n {pluginActions}\n </div>\n )}\n\n {additionalChildrenStart}\n\n {/* ── Tool sections ── */}\n {filteredSections.map((section) => {\n const sectionCollapsed = isGroupCollapsed(section.label);\n\n return (\n <div key={section.label} className=\"my-10\">\n <ExpandablePanel\n invisible\n expanded={!sectionCollapsed}\n onExpandedChange={(open) => {\n if (open !== !sectionCollapsed) {\n toggleGroupCollapsed(section.label);\n }\n }}\n className=\"mt-6\"\n titleClassName={cls(\n \"min-h-0 p-0 border-none\",\n \"rounded flex items-center justify-between w-full\",\n \"hover:bg-transparent\",\n \"cursor-pointer select-none\",\n sectionCollapsed && \"bg-surface-field\"\n )}\n innerClassName=\"mt-4 pt-0\"\n title={\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n {groupLabel(section.label)}\n </Typography>\n }\n >\n <div className=\"mt-4 pt-0\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4\">\n {section.tools.map((tool) => (\n <Card\n key={tool.path}\n onClick={() => {\n navigate(tool.path);\n context.analyticsController?.onAnalyticsEvent?.(\n \"home_navigate_to_view\",\n { path: tool.path }\n );\n }}\n className={cls(\n \"group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out\",\n \"hover:bg-surface-card-hover\"\n )}\n >\n <div className=\"flex flex-col h-full\">\n {/* Header: icon + title */}\n <div className=\"flex items-center w-full justify-between mb-1\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary\">\n <IconForView\n collectionOrView={{ slug: tool.path, name: tool.name, icon: tool.icon }}\n size=\"small\"\n />\n </div>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {tool.name}\n </Typography>\n </div>\n </div>\n\n {/* Description indented to align with title */}\n <div className=\"pl-8\">\n {tool.description && (\n <Typography variant=\"caption\" color=\"secondary\" component=\"div\">\n {tool.description}\n </Typography>\n )}\n </div>\n\n {/* Spacer */}\n <div className=\"grow\"/>\n </div>\n </Card>\n ))}\n </div>\n </div>\n </ExpandablePanel>\n </div>\n );\n })}\n\n {/* ── SDK Quick Start ── */}\n <div className=\"mt-10 mb-6\">\n <div className=\"flex items-center mb-1\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n Quick Start\n </Typography>\n </div>\n\n <Typography variant=\"body2\" color=\"secondary\" className=\"mb-4 max-w-2xl\">\n Generate a fully-typed SDK from your collections with{\" \"}\n <code className=\"text-emerald-400 font-mono text-xs bg-emerald-400/10 px-1.5 py-0.5 rounded\">\n npx rebase generate-sdk\n </code>\n {\" \"}and start querying your data with full TypeScript autocompletion.\n </Typography>\n\n <div className=\"rounded-lg border border-hairline bg-surface-card overflow-hidden\">\n {/* Title bar */}\n <div className=\"flex items-center justify-between px-4 py-2.5 border-b border-hairline bg-surface-sheet\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex gap-1.5\">\n <span className=\"w-2.5 h-2.5 rounded-full bg-red-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-amber-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-emerald-400/60\"/>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500 ml-1\">\n app.ts\n </span>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500\">\n TypeScript\n </span>\n </div>\n\n {/* Syntax-highlighted code */}\n <div className=\"px-5 py-4 overflow-x-auto text-[13px] leading-6 font-mono\">\n <SyntaxHighlightedSnippet baseUrl={apiUrl}/>\n </div>\n </div>\n </div>\n\n {/* ── Extra sections from props ── */}\n {sections?.map((s) => (\n <div key={s.key} className=\"my-10\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n {s.title}\n </Typography>\n <div className=\"mt-4\">{s.children}</div>\n </div>\n ))}\n\n {additionalChildrenEnd}\n </Container>\n </div>\n );\n}\n\n/* ═══════════════════════════════════════════════════════════════\n Hand-crafted syntax-highlighted code snippet.\n Uses inline spans with Tailwind color classes to avoid\n pulling in a syntax highlighting library.\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * The address the panel's API answers on, as a script would write it: absolute\n * (a same-origin panel is configured with a relative one) and without a\n * trailing slash. It is what `baseUrl` takes — the API's path is the client's.\n */\nfunction absoluteApiUrl(apiUrl: string | undefined): string {\n const page = typeof window !== \"undefined\" ? window.location.href : undefined;\n try {\n return new URL(apiUrl || \"/\", page).href.replace(/\\/+$/, \"\");\n } catch {\n return apiUrl ?? \"\";\n }\n}\n\n/** The quick-start client, pointed at `baseUrl`. */\nfunction SyntaxHighlightedSnippet({ baseUrl }: { baseUrl: string }) {\n const kw = \"text-violet-600 dark:text-violet-400\"; // keywords\n const str = \"text-emerald-600 dark:text-emerald-400\"; // strings\n const typ = \"text-amber-600 dark:text-amber-300\"; // types\n const fn = \"text-blue-600 dark:text-blue-400\"; // functions\n const cm = \"text-surface-500 dark:text-surface-400 italic\"; // comments\n const op = \"text-surface-500 dark:text-surface-400\"; // operators / punctuation\n const tx = \"text-surface-950 dark:text-surface-200\"; // plain text\n\n return (\n <pre className=\"m-0 whitespace-pre\">\n <span className={kw}>import</span>\n <span className={tx}>{\" { \"}</span>\n <span className={fn}>createRebaseClient</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'@rebasepro/client'</span>\n <span className={op}>;</span>\n {\"\\n\"}\n\n <span className={kw}>import</span>\n <span className={tx}>{\" { collectionsDictionary, \"}</span>\n <span className={kw}>type</span>\n <span className={tx}> </span>\n <span className={typ}>Database</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'./database.types'</span>\n <span className={op}>;</span>\n {\"\\n\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}> rebase </span>\n <span className={op}>= </span>\n <span className={fn}>createRebaseClient</span>\n <span className={op}>{\"<\"}</span>\n <span className={typ}>Database</span>\n <span className={op}>{\">(\"}</span>\n <span className={tx}>{\"{\"}</span>\n {\"\\n\"}\n <span className={tx}>{\" baseUrl\"}</span>\n <span className={op}>: </span>\n <span className={str}>'{baseUrl}'</span>\n <span className={op}>,</span>\n {\"\\n\"}\n {/* Maps each accessor back to its slug: without it a hyphenated\n slug is not reachable from the property name, and the copied\n client 404s on that collection. */}\n <span className={tx}>{\" collections\"}</span>\n <span className={op}>: </span>\n <span className={tx}>collectionsDictionary</span>\n <span className={op}>,</span>\n {\"\\n\"}\n <span className={tx}>{\"}\"}</span>\n <span className={op}>);</span>\n {\"\\n\\n\"}\n\n <span className={cm}>{\"// Fully typed — autocompletion for tables and columns\"}</span>\n {\"\\n\"}\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>users</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={tx}>users</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n {\"\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>posts</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={fn}>collection</span>\n <span className={op}>(</span>\n <span className={str}>'posts'</span>\n <span className={op}>)</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n </pre>\n );\n}\n","import React, { Suspense, useLayoutEffect, useMemo } from \"react\";\nimport { useRebaseEmbedHost, useRebaseRegistryDispatch, useTranslation } from \"@rebasepro/app\";\nimport type { RebaseStudioConfig, AppView } from \"@rebasepro/cms-types\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\n// Lazy-loaded studio tools — each fetched only when its route is visited.\n// This keeps Monaco, @xyflow/react, dagre, pgsql-ast-parser etc. out of the initial bundle.\nconst SQLEditor = lazyChunk(() => import(\"./SQLEditor/SQLEditor\").then(m => ({ default: m.SQLEditor })));\nconst JSEditor = lazyChunk(() => import(\"./JSEditor/JSEditor\").then(m => ({ default: m.JSEditor })));\nconst RLSEditor = lazyChunk(() => import(\"./RLSEditor/RLSEditor\").then(m => ({ default: m.RLSEditor })));\nconst StorageView = lazyChunk(() => import(\"./StorageView/StorageView\").then(m => ({ default: m.StorageView })));\nconst CronJobsView = lazyChunk(() => import(\"./CronJobs/CronJobsView\").then(m => ({ default: m.CronJobsView })));\nconst SchemaVisualizer = lazyChunk(() => import(\"./SchemaVisualizer/SchemaVisualizer\").then(m => ({ default: m.SchemaVisualizer })));\nconst BranchesView = lazyChunk(() => import(\"./Branches/BranchesView\").then(m => ({ default: m.BranchesView })));\nconst BackupsView = lazyChunk(() => import(\"./Backups/BackupsView\").then(m => ({ default: m.BackupsView })));\nconst ApiExplorer = lazyChunk(() => import(\"./ApiExplorer/ApiExplorer\").then(m => ({ default: m.ApiExplorer })));\nconst LogsExplorer = lazyChunk(() => import(\"./LogsExplorer/LogsExplorer\").then(m => ({ default: m.LogsExplorer })));\nconst ApiKeysView = lazyChunk(() => import(\"./ApiKeys/ApiKeysView\").then(m => ({ default: m.ApiKeysView })));\n\nimport { StudioHomePage } from \"./StudioHomePage\";\n\n/**\n * Declarative component to configure the Studio in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * The \"schema\" tool (collection editor view) is a Studio tool, but it is not\n * registered here: it ships from the panel package because it needs the project's\n * collection source to write back to. When `<RebaseCMS collectionEditor={...}>`\n * is used, the schema view is automatically injected into Studio — no manual\n * wiring needed. Where it is mounted from is an implementation detail; it is a\n * schema-editing tool and belongs beside SQL and RLS.\n */\nconst DEFAULT_HOME_PAGE = <StudioHomePage/>;\n\n/**\n * Studio: the developer tools, registered beside the admin.\n *\n * Not in an embedding (an MCP App view, `embed_host.ts` in `@rebasepro/app`):\n * there the app is shown to the person it runs as, and Studio's tools change\n * the project.\n */\nexport function RebaseStudio(props: RebaseStudioConfig) {\n const embed = useRebaseEmbedHost();\n return embed ? null : <RebaseStudioRegistration {...props}/>;\n}\n\nfunction RebaseStudioRegistration({ tools, homePage, devViews: extraViews }: RebaseStudioConfig) {\n const dispatch = useRebaseRegistryDispatch();\n const { t, i18n } = useTranslation();\n\n const resolvedHomePage = homePage ?? DEFAULT_HOME_PAGE;\n\n /**\n * The tool list reduced to a value, so that re-rendering the host does not\n * republish the registry.\n *\n * `tools` is an array, and callers write it inline — `tools={[...TOOLS]}`\n * in the hosted console. A fresh array every render meant a fresh\n * `devViews` every render, which meant the effect below unregistered and\n * re-registered on every render. Because each registration builds *new*\n * `<Suspense><SQLEditor/></Suspense>` elements, whatever view was on screen\n * was torn down and remounted each time: a half-typed SQL query, a storage\n * folder you had navigated into, an open policy editor — all discarded, and\n * every mount reissued the view's initial requests.\n */\n const toolsKey = tools ? tools.join(\",\") : \"\";\n\n const devViews: AppView[] = useMemo(() => {\n const views: AppView[] = [];\n const activeTools = tools ?? [\"sql\", \"js\", \"rls\", \"storage\", \"cron\", \"schema-visualizer\", \"branches\", \"backups\", \"api\", \"logs\", \"api-keys\"];\n const suspense = (el: React.ReactNode) => <Suspense fallback={<CircularProgressCenter/>}>{el}</Suspense>;\n\n if (activeTools.includes(\"sql\")) {\n views.push({ slug: \"sql\",\nname: t(\"studio_tool_sql\"),\ngroup: \"Database\",\nicon: \"terminal\",\ndescription: t(\"studio_tool_sql_description\"),\nview: suspense(<SQLEditor/>) });\n }\n if (activeTools.includes(\"js\")) {\n views.push({ slug: \"js\",\nname: t(\"studio_tool_js\"),\ngroup: \"Compute\",\nicon: \"code\",\ndescription: t(\"studio_tool_js_description\"),\nview: suspense(<JSEditor/>) });\n }\n if (activeTools.includes(\"rls\")) {\n views.push({ slug: \"rls\",\nname: t(\"studio_tool_rls\"),\ngroup: \"Database\",\nicon: \"ShieldCheck\",\ndescription: t(\"studio_tool_rls_description\"),\nview: suspense(<RLSEditor/>) });\n }\n if (activeTools.includes(\"storage\")) {\n views.push({ slug: \"storage\",\nname: t(\"studio_tool_storage\"),\ngroup: \"Storage\",\nicon: \"HardDrive\",\ndescription: t(\"studio_tool_storage_description\"),\nview: suspense(<StorageView/>) });\n }\n if (activeTools.includes(\"cron\")) {\n views.push({ slug: \"cron\",\nname: t(\"studio_tool_cron\"),\ngroup: \"Compute\",\nicon: \"Clock\",\ndescription: t(\"studio_tool_cron_description\"),\nview: suspense(<CronJobsView/>) });\n }\n if (activeTools.includes(\"schema-visualizer\")) {\n views.push({ slug: \"schema-visualizer\",\nname: t(\"studio_tool_schema_visualizer\"),\ngroup: \"Database\",\nicon: \"Network\",\ndescription: t(\"studio_tool_schema_visualizer_description\"),\nview: suspense(<SchemaVisualizer/>) });\n }\n if (activeTools.includes(\"branches\")) {\n views.push({ slug: \"branches\",\nname: t(\"studio_tool_branches\"),\ngroup: \"Database\",\nicon: \"GitBranch\",\ndescription: t(\"studio_tool_branches_description\"),\nview: suspense(<BranchesView/>) });\n }\n if (activeTools.includes(\"backups\")) {\n views.push({ slug: \"backups\",\nname: t(\"studio_tool_backups\"),\ngroup: \"Database\",\nicon: \"Database\",\ndescription: t(\"studio_tool_backups_description\"),\nview: suspense(<BackupsView/>) });\n }\n if (activeTools.includes(\"api\")) {\n views.push({ slug: \"api\",\nname: t(\"studio_tool_api\"),\ngroup: \"API\",\nicon: \"BookOpen\",\ndescription: t(\"studio_tool_api_description\"),\nview: suspense(<ApiExplorer/>) });\n }\n if (activeTools.includes(\"logs\")) {\n views.push({ slug: \"logs\",\nname: t(\"studio_tool_logs\"),\ngroup: \"Database\",\nicon: \"Activity\",\ndescription: t(\"studio_tool_logs_description\"),\nview: suspense(<LogsExplorer/>) });\n }\n if (activeTools.includes(\"api-keys\")) {\n views.push({ slug: \"api-keys\",\nname: t(\"studio_tool_api_keys\"),\ngroup: \"Access Control\",\nicon: \"KeyRound\",\ndescription: t(\"studio_tool_api_keys_description\"),\nview: suspense(<ApiKeysView/>) });\n }\n // Note: \"schema\" tool is auto-injected by RebaseShell when collectionEditor is enabled.\n // It is NOT registered here anymore.\n return views;\n // Keyed by the tool list's *contents*; see `toolsKey`. `tools` itself is\n // read inside, and is exactly determined by the key.\n // The strings are now translated, so the active language is part of\n // what this list is.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [toolsKey, t, i18n.language]);\n\n /**\n * Your own tools, keyed the same way `tools` is and for the same reason:\n * callers write `devViews={[…]}` inline, so the array is new on every\n * render. Re-registering would tear down and remount whichever Studio view\n * was on screen — a half-typed SQL query, an open policy editor.\n *\n * The key is the identity of each view, not its element: a view's `view` is\n * resolved by the router at render time, so a fresh element for the same\n * slug is not a configuration change.\n */\n const extraViewsKey = (extraViews ?? [])\n .map((v) => `${v.slug}|${v.name}|${v.group ?? \"\"}|${v.hideFromNavigation ?? false}`)\n .join(\",\");\n const extraViewsRef = React.useRef(extraViews);\n extraViewsRef.current = extraViews;\n\n const allDevViews: AppView[] = useMemo(\n () => [...devViews, ...(extraViewsRef.current ?? [])],\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [devViews, extraViewsKey]\n );\n\n // Use a ref for homePage so it never destabilizes the effect.\n // homePage is a React element — its identity doesn't matter for registration.\n const homePageRef = React.useRef(resolvedHomePage);\n homePageRef.current = resolvedHomePage;\n\n // Same reasoning for `tools`: it is registered as config, but a new array\n // with the same contents must not count as a change.\n const toolsRef = React.useRef(tools);\n toolsRef.current = tools;\n\n useLayoutEffect(() => {\n dispatch.registerStudio({ tools: toolsRef.current,\nhomePage: homePageRef.current,\ndevViews: allDevViews });\n return () => dispatch.unregisterStudio();\n }, [dispatch, allDevViews]);\n\n return null;\n}\n"],"mappings":";;;;;;;;AA4BA,IAAM,cAAc;CAAC;CAAY;CAAW;CAAW;CAAO;AAAgB;AAE9E,IAAM,kBAAkB;;;;;;;AAQxB,SAAS,cAAc,OAA0C;CAC7D,MAAM,0BAAU,IAAI,IAA0B;CAE9C,KAAK,MAAM,QAAQ,OAAO;EACtB,IAAI,KAAK,oBAAoB;EAC7B,MAAM,QAAQ,KAAK,SAAS;EAC5B,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,CAAC;EACrC,MAAM,KAAK;GACP,MAAM,IAAI,KAAK;GACf,MAAM,KAAK;GACX,aAAa,KAAK,eAAe;GACjC,MAAM,KAAK;EACf,CAAC;EACD,QAAQ,IAAI,OAAO,KAAK;CAC5B;CAOA,OAAO,CAJH,GAAG,YAAY,QAAO,MAAK,QAAQ,IAAI,CAAC,CAAC,GACzC,GAAG,CAAC,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,QAAO,MAAK,CAAC,YAAY,SAAS,CAAC,CAAC,CAGxD,CAAA,CAAQ,KAAI,W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Aa,CAAA,CAAC;EAAE,CAAC;EAIxB,OAAO;CAMX,GAAG;EAvGc,QAAQ,MAAM,KAAK,GAAG,IAAI;EAuG7B;EAAG,KAAK;CAAQ,CAAC;;;;;;;;;;;CAY/B,MAAM,iBAAiB,cAAc,CAAC,EAAA,CACjC,KAAK,MAAM,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,sBAAsB,OAAO,CAAC,CACnF,KAAK,GAAG;CACb,MAAM,gBAAgB,MAAM,OAAO,UAAU;CAC7C,cAAc,UAAU;CAExB,MAAM,cAAyB,cACrB,CAAC,GAAG,UAAU,GAAI,cAAc,WAAW,CAAC,CAAE,GAEpD,CAAC,UAAU,aAAa,CAC5B;CAIA,MAAM,cAAc,MAAM,OAAO,gBAAgB;CACjD,YAAY,UAAU;CAItB,MAAM,WAAW,MAAM,OAAO,KAAK;CACnC,SAAS,UAAU;CAEnB,sBAAsB;EAClB,SAAS,eAAe;GAAE,OAAO,SAAS;GAClD,UAAU,YAAY;GACtB,UAAU;EAAY,CAAC;EACf,aAAa,SAAS,iBAAiB;CAC3C,GAAG,CAAC,UAAU,WAAW,CAAC;CAE1B,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"index.es.js","names":[],"sources":["../src/components/StudioHomePage.tsx","../src/components/RebaseStudio.tsx"],"sourcesContent":["import type { AppView, HomePageSection, PluginGenericProps } from \"@rebasepro/cms-types\";\nimport { studioSchemaToolEnabled } from \"@rebasepro/cms-types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { Card, cls, Container, ExpandablePanel, Typography } from \"@rebasepro/ui\";\nimport { IconForView, useApiConfig, useNavigationGroupLabel, useRebaseContext, useRebaseRegistry, useRestoreScroll, useSlot, useTranslation } from \"@rebasepro/app\";\nimport { useNavigate } from \"react-router\";\nimport { useStudioBreadcrumbs, SchemaDriftBanner } from \"@rebasepro/app\";\n\n/* ═══════════════════════════════════════════════════════════════\n Studio tool sections, derived from the registered Studio views\n ═══════════════════════════════════════════════════════════════ */\n\ninterface StudioTool {\n path: string;\n name: string;\n description: string;\n icon?: string | React.ReactNode;\n}\n\ninterface StudioSection {\n label: string;\n tools: StudioTool[];\n}\n\n/** The view metadata the cards need — not the rendered `view` itself. */\ntype StudioViewMeta = Pick<AppView, \"slug\" | \"name\" | \"group\" | \"description\" | \"icon\" | \"hideFromNavigation\">;\n\n/** Group order for the home page; unknown groups are appended in view order. */\nconst GROUP_ORDER = [\"Database\", \"Compute\", \"Storage\", \"API\", \"Access Control\"];\n\nconst UNGROUPED_LABEL = \"Tools\";\n\n/**\n * Build the home page sections from the Studio views that are actually\n * registered, so a card exists if and only if its route does. A hand-written\n * list drifts: it used to advertise Users and Roles pages that 404, while\n * omitting the Backups view that does exist.\n */\nfunction buildSections(views: StudioViewMeta[]): StudioSection[] {\n const byGroup = new Map<string, StudioTool[]>();\n\n for (const view of views) {\n if (view.hideFromNavigation) continue;\n const label = view.group ?? UNGROUPED_LABEL;\n const tools = byGroup.get(label) ?? [];\n tools.push({\n path: `/${view.slug}`,\n name: view.name,\n description: view.description ?? \"\",\n icon: view.icon\n });\n byGroup.set(label, tools);\n }\n\n const ordered = [\n ...GROUP_ORDER.filter(g => byGroup.has(g)),\n ...[...byGroup.keys()].filter(g => !GROUP_ORDER.includes(g))\n ];\n\n return ordered.map(label => ({ label,\ntools: byGroup.get(label)! }));\n}\n\n/* ═══════════════════════════════════════════════════════════════ */\n\nconst COLLAPSED_STORAGE_KEY = \"rebase-studio-home-collapsed\";\n\nfunction useStudioCollapsedGroups(groupNames: string[]) {\n const [collapsed, setCollapsed] = useState<Set<string>>(() => {\n try {\n const stored = localStorage.getItem(COLLAPSED_STORAGE_KEY);\n return stored ? new Set(JSON.parse(stored)) : new Set<string>();\n } catch {\n return new Set<string>();\n }\n });\n\n const isGroupCollapsed = (name: string) => collapsed.has(name);\n\n const toggleGroupCollapsed = (name: string) => {\n setCollapsed(prev => {\n const next = new Set(prev);\n if (next.has(name)) {\n next.delete(name);\n } else {\n next.add(name);\n }\n try {\n localStorage.setItem(COLLAPSED_STORAGE_KEY, JSON.stringify([...next]));\n } catch { /* noop */ }\n return next;\n });\n };\n\n return { isGroupCollapsed, toggleGroupCollapsed };\n}\n\nexport function StudioHomePage({\n additionalActions,\n additionalChildrenStart,\n additionalChildrenEnd,\n sections,\n hiddenGroups\n}: {\n additionalActions?: React.ReactNode;\n additionalChildrenStart?: React.ReactNode;\n additionalChildrenEnd?: React.ReactNode;\n sections?: HomePageSection[];\n hiddenGroups?: string[];\n}) {\n const context = useRebaseContext();\n const breadcrumbs = useStudioBreadcrumbs();\n const navigate = useNavigate();\n const registry = useRebaseRegistry();\n const { t } = useTranslation();\n const apiConfig = useApiConfig();\n const apiUrl = absoluteApiUrl(apiConfig?.apiUrl);\n\n useEffect(() => {\n breadcrumbs.set({ breadcrumbs: [] });\n }, [breadcrumbs.set]);\n\n const { containerRef } = useRestoreScroll();\n\n const sectionProps: PluginGenericProps = { context };\n\n const pluginActions = useSlot(\"home.actions\", sectionProps);\n\n // The collection editor (\"schema\") is not part of `devViews` — RebaseNavigation\n // injects it when the admin enables a collection editor and the Studio's\n // tools include it. The same predicate, so the card tracks the route.\n const schemaEnabled = studioSchemaToolEnabled(registry);\n\n const filteredSections = useMemo(() => {\n const views: StudioViewMeta[] = [];\n if (schemaEnabled) {\n views.push({\n slug: \"schema\",\n name: t(\"studio_tool_schema\"),\n group: \"Database\",\n icon: \"LayoutList\",\n description: t(\"studio_tool_schema_description\")\n });\n }\n views.push(...(registry.studioConfig?.devViews ?? []));\n return buildSections(views).filter(s => !hiddenGroups?.includes(s.label));\n }, [registry.studioConfig?.devViews, schemaEnabled, hiddenGroups, t]);\n\n const groupNames = useMemo(\n () => filteredSections.map(s => s.label),\n [filteredSections]\n );\n\n const { isGroupCollapsed, toggleGroupCollapsed } = useStudioCollapsedGroups(groupNames);\n // The group name is the identifier this page orders and collapses by;\n // only what the reader sees is translated.\n const groupLabel = useNavigationGroupLabel();\n\n return (\n <div ref={containerRef} className=\"py-2 overflow-auto h-full w-full bg-surface-sheet\">\n <Container maxWidth=\"6xl\">\n <div className=\"mb-4 flex flex-col gap-2\">\n <SchemaDriftBanner />\n </div>\n\n {(additionalActions || pluginActions) && (\n <div className=\"w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4 justify-end\">\n {additionalActions}\n {pluginActions}\n </div>\n )}\n\n {additionalChildrenStart}\n\n {/* ── Tool sections ── */}\n {filteredSections.map((section) => {\n const sectionCollapsed = isGroupCollapsed(section.label);\n\n return (\n <div key={section.label} className=\"my-10\">\n <ExpandablePanel\n invisible\n expanded={!sectionCollapsed}\n onExpandedChange={(open) => {\n if (open !== !sectionCollapsed) {\n toggleGroupCollapsed(section.label);\n }\n }}\n className=\"mt-6\"\n titleClassName={cls(\n \"min-h-0 p-0 border-none\",\n \"rounded flex items-center justify-between w-full\",\n \"hover:bg-transparent\",\n \"cursor-pointer select-none\",\n sectionCollapsed && \"bg-surface-field\"\n )}\n innerClassName=\"mt-4 pt-0\"\n title={\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n {groupLabel(section.label)}\n </Typography>\n }\n >\n <div className=\"mt-4 pt-0\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4\">\n {section.tools.map((tool) => (\n <Card\n key={tool.path}\n onClick={() => {\n navigate(tool.path);\n context.analyticsController?.onAnalyticsEvent?.(\n \"home_navigate_to_view\",\n { path: tool.path }\n );\n }}\n className={cls(\n \"group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out\",\n \"hover:bg-surface-card-hover\"\n )}\n >\n <div className=\"flex flex-col h-full\">\n {/* Header: icon + title */}\n <div className=\"flex items-center w-full justify-between mb-1\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary\">\n <IconForView\n collectionOrView={{ slug: tool.path, name: tool.name, icon: tool.icon }}\n size=\"small\"\n />\n </div>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {tool.name}\n </Typography>\n </div>\n </div>\n\n {/* Description indented to align with title */}\n <div className=\"pl-8\">\n {tool.description && (\n <Typography variant=\"caption\" color=\"secondary\" component=\"div\">\n {tool.description}\n </Typography>\n )}\n </div>\n\n {/* Spacer */}\n <div className=\"grow\"/>\n </div>\n </Card>\n ))}\n </div>\n </div>\n </ExpandablePanel>\n </div>\n );\n })}\n\n {/* ── SDK Quick Start ── */}\n <div className=\"mt-10 mb-6\">\n <div className=\"flex items-center mb-1\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n Quick Start\n </Typography>\n </div>\n\n <Typography variant=\"body2\" color=\"secondary\" className=\"mb-4 max-w-2xl\">\n Generate a fully-typed SDK from your tables with{\" \"}\n <code className=\"text-emerald-400 font-mono text-xs bg-emerald-400/10 px-1.5 py-0.5 rounded\">\n npx rebase generate-sdk\n </code>\n {\" \"}and start querying your data with full TypeScript autocompletion.\n </Typography>\n\n <div className=\"rounded-lg border border-hairline bg-surface-card overflow-hidden\">\n {/* Title bar */}\n <div className=\"flex items-center justify-between px-4 py-2.5 border-b border-hairline bg-surface-sheet\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex gap-1.5\">\n <span className=\"w-2.5 h-2.5 rounded-full bg-red-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-amber-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-emerald-400/60\"/>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500 ml-1\">\n app.ts\n </span>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500\">\n TypeScript\n </span>\n </div>\n\n {/* Syntax-highlighted code */}\n <div className=\"px-5 py-4 overflow-x-auto text-[13px] leading-6 font-mono\">\n <SyntaxHighlightedSnippet baseUrl={apiUrl}/>\n </div>\n </div>\n </div>\n\n {/* ── Extra sections from props ── */}\n {sections?.map((s) => (\n <div key={s.key} className=\"my-10\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400\"\n )}\n >\n {s.title}\n </Typography>\n <div className=\"mt-4\">{s.children}</div>\n </div>\n ))}\n\n {additionalChildrenEnd}\n </Container>\n </div>\n );\n}\n\n/* ═══════════════════════════════════════════════════════════════\n Hand-crafted syntax-highlighted code snippet.\n Uses inline spans with Tailwind color classes to avoid\n pulling in a syntax highlighting library.\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * The address the panel's API answers on, as a script would write it: absolute\n * (a same-origin panel is configured with a relative one) and without a\n * trailing slash. It is what `baseUrl` takes — the API's path is the client's.\n */\nfunction absoluteApiUrl(apiUrl: string | undefined): string {\n const page = typeof window !== \"undefined\" ? window.location.href : undefined;\n try {\n return new URL(apiUrl || \"/\", page).href.replace(/\\/+$/, \"\");\n } catch {\n return apiUrl ?? \"\";\n }\n}\n\n/** The quick-start client, pointed at `baseUrl`. */\nfunction SyntaxHighlightedSnippet({ baseUrl }: { baseUrl: string }) {\n const kw = \"text-violet-600 dark:text-violet-400\"; // keywords\n const str = \"text-emerald-600 dark:text-emerald-400\"; // strings\n const typ = \"text-amber-600 dark:text-amber-300\"; // types\n const fn = \"text-blue-600 dark:text-blue-400\"; // functions\n const cm = \"text-surface-500 dark:text-surface-400 italic\"; // comments\n const op = \"text-surface-500 dark:text-surface-400\"; // operators / punctuation\n const tx = \"text-surface-950 dark:text-surface-200\"; // plain text\n\n return (\n <pre className=\"m-0 whitespace-pre\">\n <span className={kw}>import</span>\n <span className={tx}>{\" { \"}</span>\n <span className={fn}>createRebaseClient</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'@rebasepro/client'</span>\n <span className={op}>;</span>\n {\"\\n\"}\n\n <span className={kw}>import</span>\n <span className={tx}>{\" { tablesDictionary, \"}</span>\n <span className={kw}>type</span>\n <span className={tx}> </span>\n <span className={typ}>Database</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'./database.types'</span>\n <span className={op}>;</span>\n {\"\\n\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}> rebase </span>\n <span className={op}>= </span>\n <span className={fn}>createRebaseClient</span>\n <span className={op}>{\"<\"}</span>\n <span className={typ}>Database</span>\n <span className={op}>{\">(\"}</span>\n <span className={tx}>{\"{\"}</span>\n {\"\\n\"}\n <span className={tx}>{\" baseUrl\"}</span>\n <span className={op}>: </span>\n <span className={str}>'{baseUrl}'</span>\n <span className={op}>,</span>\n {\"\\n\"}\n {/* Maps each accessor back to its slug: without it a hyphenated\n slug is not reachable from the property name, and the copied\n client 404s on that table. */}\n <span className={tx}>{\" tables\"}</span>\n <span className={op}>: </span>\n <span className={tx}>tablesDictionary</span>\n <span className={op}>,</span>\n {\"\\n\"}\n <span className={tx}>{\"}\"}</span>\n <span className={op}>);</span>\n {\"\\n\\n\"}\n\n <span className={cm}>{\"// Fully typed — autocompletion for tables and columns\"}</span>\n {\"\\n\"}\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>users</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={tx}>users</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n {\"\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>posts</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={fn}>collection</span>\n <span className={op}>(</span>\n <span className={str}>'posts'</span>\n <span className={op}>)</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n </pre>\n );\n}\n","import React, { Suspense, useLayoutEffect, useMemo } from \"react\";\nimport { useRebaseEmbedHost, useRebaseRegistryDispatch, useTranslation } from \"@rebasepro/app\";\nimport type { RebaseStudioConfig, AppView } from \"@rebasepro/cms-types\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\n// Lazy-loaded studio tools — each fetched only when its route is visited.\n// This keeps Monaco, @xyflow/react, dagre, pgsql-ast-parser etc. out of the initial bundle.\nconst SQLEditor = lazyChunk(() => import(\"./SQLEditor/SQLEditor\").then(m => ({ default: m.SQLEditor })));\nconst JSEditor = lazyChunk(() => import(\"./JSEditor/JSEditor\").then(m => ({ default: m.JSEditor })));\nconst RLSEditor = lazyChunk(() => import(\"./RLSEditor/RLSEditor\").then(m => ({ default: m.RLSEditor })));\nconst StorageView = lazyChunk(() => import(\"./StorageView/StorageView\").then(m => ({ default: m.StorageView })));\nconst CronJobsView = lazyChunk(() => import(\"./CronJobs/CronJobsView\").then(m => ({ default: m.CronJobsView })));\nconst SchemaVisualizer = lazyChunk(() => import(\"./SchemaVisualizer/SchemaVisualizer\").then(m => ({ default: m.SchemaVisualizer })));\nconst BranchesView = lazyChunk(() => import(\"./Branches/BranchesView\").then(m => ({ default: m.BranchesView })));\nconst BackupsView = lazyChunk(() => import(\"./Backups/BackupsView\").then(m => ({ default: m.BackupsView })));\nconst ApiExplorer = lazyChunk(() => import(\"./ApiExplorer/ApiExplorer\").then(m => ({ default: m.ApiExplorer })));\nconst LogsExplorer = lazyChunk(() => import(\"./LogsExplorer/LogsExplorer\").then(m => ({ default: m.LogsExplorer })));\nconst ApiKeysView = lazyChunk(() => import(\"./ApiKeys/ApiKeysView\").then(m => ({ default: m.ApiKeysView })));\n\nimport { StudioHomePage } from \"./StudioHomePage\";\n\n/**\n * Declarative component to configure the Studio in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * The \"schema\" tool (collection editor view) is a Studio tool, but it is not\n * registered here: it ships from the panel package because it needs the project's\n * collection source to write back to. When `<RebaseCMS collectionEditor={...}>`\n * is used, the schema view is automatically injected into Studio — no manual\n * wiring needed. Where it is mounted from is an implementation detail; it is a\n * schema-editing tool and belongs beside SQL and RLS.\n */\nconst DEFAULT_HOME_PAGE = <StudioHomePage/>;\n\n/**\n * Studio: the developer tools, registered beside the admin.\n *\n * Not in an embedding (an MCP App view, `embed_host.ts` in `@rebasepro/app`):\n * there the app is shown to the person it runs as, and Studio's tools change\n * the project.\n */\nexport function RebaseStudio(props: RebaseStudioConfig) {\n const embed = useRebaseEmbedHost();\n return embed ? null : <RebaseStudioRegistration {...props}/>;\n}\n\nfunction RebaseStudioRegistration({ tools, homePage, devViews: extraViews }: RebaseStudioConfig) {\n const dispatch = useRebaseRegistryDispatch();\n const { t, i18n } = useTranslation();\n\n const resolvedHomePage = homePage ?? DEFAULT_HOME_PAGE;\n\n /**\n * The tool list reduced to a value, so that re-rendering the host does not\n * republish the registry.\n *\n * `tools` is an array, and callers write it inline — `tools={[...TOOLS]}`\n * in the hosted console. A fresh array every render meant a fresh\n * `devViews` every render, which meant the effect below unregistered and\n * re-registered on every render. Because each registration builds *new*\n * `<Suspense><SQLEditor/></Suspense>` elements, whatever view was on screen\n * was torn down and remounted each time: a half-typed SQL query, a storage\n * folder you had navigated into, an open policy editor — all discarded, and\n * every mount reissued the view's initial requests.\n */\n const toolsKey = tools ? tools.join(\",\") : \"\";\n\n const devViews: AppView[] = useMemo(() => {\n const views: AppView[] = [];\n const activeTools = tools ?? [\"sql\", \"js\", \"rls\", \"storage\", \"cron\", \"schema-visualizer\", \"branches\", \"backups\", \"api\", \"logs\", \"api-keys\"];\n const suspense = (el: React.ReactNode) => <Suspense fallback={<CircularProgressCenter/>}>{el}</Suspense>;\n\n if (activeTools.includes(\"sql\")) {\n views.push({ slug: \"sql\",\nname: t(\"studio_tool_sql\"),\ngroup: \"Database\",\nicon: \"terminal\",\ndescription: t(\"studio_tool_sql_description\"),\nview: suspense(<SQLEditor/>) });\n }\n if (activeTools.includes(\"js\")) {\n views.push({ slug: \"js\",\nname: t(\"studio_tool_js\"),\ngroup: \"Compute\",\nicon: \"code\",\ndescription: t(\"studio_tool_js_description\"),\nview: suspense(<JSEditor/>) });\n }\n if (activeTools.includes(\"rls\")) {\n views.push({ slug: \"rls\",\nname: t(\"studio_tool_rls\"),\ngroup: \"Database\",\nicon: \"ShieldCheck\",\ndescription: t(\"studio_tool_rls_description\"),\nview: suspense(<RLSEditor/>) });\n }\n if (activeTools.includes(\"storage\")) {\n views.push({ slug: \"storage\",\nname: t(\"studio_tool_storage\"),\ngroup: \"Storage\",\nicon: \"HardDrive\",\ndescription: t(\"studio_tool_storage_description\"),\nview: suspense(<StorageView/>) });\n }\n if (activeTools.includes(\"cron\")) {\n views.push({ slug: \"cron\",\nname: t(\"studio_tool_cron\"),\ngroup: \"Compute\",\nicon: \"Clock\",\ndescription: t(\"studio_tool_cron_description\"),\nview: suspense(<CronJobsView/>) });\n }\n if (activeTools.includes(\"schema-visualizer\")) {\n views.push({ slug: \"schema-visualizer\",\nname: t(\"studio_tool_schema_visualizer\"),\ngroup: \"Database\",\nicon: \"Network\",\ndescription: t(\"studio_tool_schema_visualizer_description\"),\nview: suspense(<SchemaVisualizer/>) });\n }\n if (activeTools.includes(\"branches\")) {\n views.push({ slug: \"branches\",\nname: t(\"studio_tool_branches\"),\ngroup: \"Database\",\nicon: \"GitBranch\",\ndescription: t(\"studio_tool_branches_description\"),\nview: suspense(<BranchesView/>) });\n }\n if (activeTools.includes(\"backups\")) {\n views.push({ slug: \"backups\",\nname: t(\"studio_tool_backups\"),\ngroup: \"Database\",\nicon: \"Database\",\ndescription: t(\"studio_tool_backups_description\"),\nview: suspense(<BackupsView/>) });\n }\n if (activeTools.includes(\"api\")) {\n views.push({ slug: \"api\",\nname: t(\"studio_tool_api\"),\ngroup: \"API\",\nicon: \"BookOpen\",\ndescription: t(\"studio_tool_api_description\"),\nview: suspense(<ApiExplorer/>) });\n }\n if (activeTools.includes(\"logs\")) {\n views.push({ slug: \"logs\",\nname: t(\"studio_tool_logs\"),\ngroup: \"Database\",\nicon: \"Activity\",\ndescription: t(\"studio_tool_logs_description\"),\nview: suspense(<LogsExplorer/>) });\n }\n if (activeTools.includes(\"api-keys\")) {\n views.push({ slug: \"api-keys\",\nname: t(\"studio_tool_api_keys\"),\ngroup: \"Access Control\",\nicon: \"KeyRound\",\ndescription: t(\"studio_tool_api_keys_description\"),\nview: suspense(<ApiKeysView/>) });\n }\n // Note: \"schema\" tool is auto-injected by RebaseShell when collectionEditor is enabled.\n // It is NOT registered here anymore.\n return views;\n // Keyed by the tool list's *contents*; see `toolsKey`. `tools` itself is\n // read inside, and is exactly determined by the key.\n // The strings are now translated, so the active language is part of\n // what this list is.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [toolsKey, t, i18n.language]);\n\n /**\n * Your own tools, keyed the same way `tools` is and for the same reason:\n * callers write `devViews={[…]}` inline, so the array is new on every\n * render. Re-registering would tear down and remount whichever Studio view\n * was on screen — a half-typed SQL query, an open policy editor.\n *\n * The key is the identity of each view, not its element: a view's `view` is\n * resolved by the router at render time, so a fresh element for the same\n * slug is not a configuration change.\n */\n const extraViewsKey = (extraViews ?? [])\n .map((v) => `${v.slug}|${v.name}|${v.group ?? \"\"}|${v.hideFromNavigation ?? false}`)\n .join(\",\");\n const extraViewsRef = React.useRef(extraViews);\n extraViewsRef.current = extraViews;\n\n const allDevViews: AppView[] = useMemo(\n () => [...devViews, ...(extraViewsRef.current ?? [])],\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [devViews, extraViewsKey]\n );\n\n // Use a ref for homePage so it never destabilizes the effect.\n // homePage is a React element — its identity doesn't matter for registration.\n const homePageRef = React.useRef(resolvedHomePage);\n homePageRef.current = resolvedHomePage;\n\n // Same reasoning for `tools`: it is registered as config, but a new array\n // with the same contents must not count as a change.\n const toolsRef = React.useRef(tools);\n toolsRef.current = tools;\n\n useLayoutEffect(() => {\n dispatch.registerStudio({ tools: toolsRef.current,\nhomePage: homePageRef.current,\ndevViews: allDevViews });\n return () => dispatch.unregisterStudio();\n }, [dispatch, allDevViews]);\n\n return null;\n}\n"],"mappings":";;;;;;;;AA4BA,IAAM,cAAc;CAAC;CAAY;CAAW;CAAW;CAAO;AAAgB;AAE9E,IAAM,kBAAkB;;;;;;;AAQxB,SAAS,cAAc,OAA0C;CAC7D,MAAM,0BAAU,IAAI,IAA0B;CAE9C,KAAK,MAAM,QAAQ,OAAO;EACtB,IAAI,KAAK,oBAAoB;EAC7B,MAAM,QAAQ,KAAK,SAAS;EAC5B,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,CAAC;EACrC,MAAM,KAAK;GACP,MAAM,IAAI,KAAK;GACf,MAAM,KAAK;GACX,aAAa,KAAK,eAAe;GACjC,MAAM,KAAK;EACf,CAAC;EACD,QAAQ,IAAI,OAAO,KAAK;CAC5B;CAOA,OAAO,CAJH,GAAG,YAAY,QAAO,MAAK,QAAQ,IAAI,CAAC,CAAC,GACzC,GAAG,CAAC,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,QAAO,MAAK,CAAC,YAAY,SAAS,CAAC,CAAC,CAGxD,CAAA,CAAQ,KAAI,WAAU;EAAE;EACnC,OAAO,QAAQ,IAAI,KAAK;CAAG,EAAE;AAC7B;AAIA,IAAM,wBAAwB;AAE9B,SAAS,yBAAyB,YAAsB;CACpD,MAAM,CAAC,W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;;;;;;;CAY/B,MAAM,iBAAiB,cAAc,CAAC,EAAA,CACjC,KAAK,MAAM,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,sBAAsB,OAAO,CAAC,CACnF,KAAK,GAAG;CACb,MAAM,gBAAgB,MAAM,OAAO,UAAU;CAC7C,cAAc,UAAU;CAExB,MAAM,cAAyB,cACrB,CAAC,GAAG,UAAU,GAAI,cAAc,WAAW,CAAC,CAAE,GAEpD,CAAC,UAAU,aAAa,CAC5B;CAIA,MAAM,cAAc,MAAM,OAAO,gBAAgB;CACjD,YAAY,UAAU;CAItB,MAAM,WAAW,MAAM,OAAO,KAAK;CACnC,SAAS,UAAU;CAEnB,sBAAsB;EAClB,SAAS,eAAe;GAAE,OAAO,SAAS;GAClD,UAAU,YAAY;GACtB,UAAU;EAAY,CAAC;EACf,aAAa,SAAS,iBAAiB;CAC3C,GAAG,CAAC,UAAU,WAAW,CAAC;CAE1B,OAAO;AACX"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ErrorView, useTranslation } from "@rebasepro/app";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Alert, Button, Typography } from "@rebasepro/ui";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/schema-source.tsx
|
|
6
|
+
/** The {@link SchemaSourceProblem} of a descriptors state, if there is one. */
|
|
7
|
+
function schemaSourceProblem(state) {
|
|
8
|
+
if (state.unavailable) return state.unavailableReason === "no-auth" ? { kind: "no-auth" } : { kind: "outdated" };
|
|
9
|
+
if (state.status === "error" && state.error) return {
|
|
10
|
+
kind: "failed",
|
|
11
|
+
error: state.error,
|
|
12
|
+
retry: state.reload
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function useProblemText(problem) {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
if (problem.kind === "no-auth") return {
|
|
18
|
+
title: t("studio_schema_no_auth_title"),
|
|
19
|
+
body: t("studio_schema_no_auth_body")
|
|
20
|
+
};
|
|
21
|
+
if (problem.kind === "outdated") return {
|
|
22
|
+
title: t("studio_schema_outdated_title"),
|
|
23
|
+
body: t("studio_schema_outdated_body")
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
title: t("studio_schema_load_failed"),
|
|
27
|
+
body: problem.error.message
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A whole pane's worth of "there is no schema to draw from, and why" — for a
|
|
32
|
+
* view that renders nothing without the tables (the schema visualizer).
|
|
33
|
+
*/
|
|
34
|
+
function SchemaSourceProblemView({ problem }) {
|
|
35
|
+
const { title, body } = useProblemText(problem);
|
|
36
|
+
if (problem.kind === "failed") return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "flex items-center justify-center h-full p-6 overflow-auto",
|
|
38
|
+
children: /* @__PURE__ */ jsx(ErrorView, {
|
|
39
|
+
title,
|
|
40
|
+
error: body,
|
|
41
|
+
onRetry: problem.retry
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsx("div", {
|
|
45
|
+
className: "flex items-center justify-center h-full p-6 overflow-auto",
|
|
46
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "max-w-md text-center",
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
49
|
+
variant: "subtitle2",
|
|
50
|
+
className: "block",
|
|
51
|
+
children: title
|
|
52
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
53
|
+
variant: "body2",
|
|
54
|
+
color: "secondary",
|
|
55
|
+
className: "block mt-2",
|
|
56
|
+
children: body
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The same, as a banner above a view that still works without the tables —
|
|
63
|
+
* the RLS editor still lists what the database holds.
|
|
64
|
+
*/
|
|
65
|
+
function SchemaSourceProblemAlert({ problem }) {
|
|
66
|
+
const { title, body } = useProblemText(problem);
|
|
67
|
+
return /* @__PURE__ */ jsxs(Alert, {
|
|
68
|
+
color: problem.kind === "failed" ? "error" : "warning",
|
|
69
|
+
action: problem.kind === "failed" ? /* @__PURE__ */ jsx(RetryLink, { onRetry: problem.retry }) : void 0,
|
|
70
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
71
|
+
variant: "body2",
|
|
72
|
+
className: "font-semibold",
|
|
73
|
+
children: title
|
|
74
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
75
|
+
variant: "caption",
|
|
76
|
+
className: "block mt-0.5",
|
|
77
|
+
children: body
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function RetryLink({ onRetry }) {
|
|
82
|
+
const { t } = useTranslation();
|
|
83
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
84
|
+
variant: "text",
|
|
85
|
+
size: "small",
|
|
86
|
+
onClick: onRetry,
|
|
87
|
+
children: t("studio_schema_retry")
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { SchemaSourceProblemView as n, schemaSourceProblem as r, SchemaSourceProblemAlert as t };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=schema-source-C4ekB7WU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-source-C4ekB7WU.js","names":[],"sources":["../src/components/schema-source.tsx"],"sourcesContent":["import React from \"react\";\nimport { ErrorView, useTranslation, type TableDescriptorsState } from \"@rebasepro/app\";\nimport { Alert, Button, Typography } from \"@rebasepro/ui\";\n\n/**\n * Why Studio has no tables to render from, when it has none: the project's\n * runtime predates `GET /api/schema/tables`, the backend has no auth to\n * describe them to, or the request failed. `undefined` when the tables are\n * there (or still loading).\n *\n * The tables are the server's — `useTableDescriptors` from `@rebasepro/app`,\n * with or without a CMS on the page — and there is no other source to fall\n * back on: an older runtime is upgraded, not imitated.\n */\nexport type SchemaSourceProblem =\n | { kind: \"outdated\" }\n | { kind: \"no-auth\" }\n | { kind: \"failed\"; error: Error; retry: () => void };\n\n/** The {@link SchemaSourceProblem} of a descriptors state, if there is one. */\nexport function schemaSourceProblem(state: TableDescriptorsState): SchemaSourceProblem | undefined {\n if (state.unavailable) {\n // A client with no `schema` is a client built before it existed: an\n // upgrade fixes it the same way.\n return state.unavailableReason === \"no-auth\" ? { kind: \"no-auth\" } : { kind: \"outdated\" };\n }\n if (state.status === \"error\" && state.error) return { kind: \"failed\", error: state.error, retry: state.reload };\n return undefined;\n}\n\nfunction useProblemText(problem: SchemaSourceProblem): { title: string; body: string } {\n const { t } = useTranslation();\n if (problem.kind === \"no-auth\") return { title: t(\"studio_schema_no_auth_title\"), body: t(\"studio_schema_no_auth_body\") };\n if (problem.kind === \"outdated\") return { title: t(\"studio_schema_outdated_title\"), body: t(\"studio_schema_outdated_body\") };\n return { title: t(\"studio_schema_load_failed\"), body: problem.error.message };\n}\n\n/**\n * A whole pane's worth of \"there is no schema to draw from, and why\" — for a\n * view that renders nothing without the tables (the schema visualizer).\n */\nexport function SchemaSourceProblemView({ problem }: { problem: SchemaSourceProblem }) {\n const { title, body } = useProblemText(problem);\n if (problem.kind === \"failed\") {\n return (\n <div className=\"flex items-center justify-center h-full p-6 overflow-auto\">\n <ErrorView title={title} error={body} onRetry={problem.retry}/>\n </div>\n );\n }\n return (\n <div className=\"flex items-center justify-center h-full p-6 overflow-auto\">\n <div className=\"max-w-md text-center\">\n <Typography variant=\"subtitle2\" className=\"block\">\n {title}\n </Typography>\n <Typography variant=\"body2\" color=\"secondary\" className=\"block mt-2\">\n {body}\n </Typography>\n </div>\n </div>\n );\n}\n\n/**\n * The same, as a banner above a view that still works without the tables —\n * the RLS editor still lists what the database holds.\n */\nexport function SchemaSourceProblemAlert({ problem }: { problem: SchemaSourceProblem }) {\n const { title, body } = useProblemText(problem);\n return (\n <Alert color={problem.kind === \"failed\" ? \"error\" : \"warning\"} action={problem.kind === \"failed\" ? <RetryLink onRetry={problem.retry}/> : undefined}>\n <Typography variant=\"body2\" className=\"font-semibold\">{title}</Typography>\n <Typography variant=\"caption\" className=\"block mt-0.5\">{body}</Typography>\n </Alert>\n );\n}\n\nfunction RetryLink({ onRetry }: { onRetry: () => void }) {\n const { t } = useTranslation();\n return (\n <Button variant=\"text\" size=\"small\" onClick={onRetry}>\n {t(\"studio_schema_retry\")}\n </Button>\n );\n}\n"],"mappings":";;;;;;AAoBA,SAAgB,oBAAoB,OAA+D;CAC/F,IAAI,MAAM,aAGN,OAAO,MAAM,sBAAsB,YAAY,EAAE,MAAM,UAAU,IAAI,EAAE,MAAM,WAAW;CAE5F,IAAI,MAAM,WAAW,WAAW,MAAM,OAAO,OAAO;EAAE,MAAM;EAAU,OAAO,MAAM;EAAO,OAAO,MAAM;CAAO;AAElH;AAEA,SAAS,eAAe,SAA+D;CACnF,MAAM,EAAE,MAAM,eAAe;CAC7B,IAAI,QAAQ,SAAS,WAAW,OAAO;EAAE,OAAO,EAAE,6BAA6B;EAAG,MAAM,EAAE,4BAA4B;CAAE;CACxH,IAAI,QAAQ,SAAS,YAAY,OAAO;EAAE,OAAO,EAAE,8BAA8B;EAAG,MAAM,EAAE,6BAA6B;CAAE;CAC3H,OAAO;EAAE,OAAO,EAAE,2BAA2B;EAAG,MAAM,QAAQ,MAAM;CAAQ;AAChF;;;;;AAMA,SAAgB,wBAAwB,EAAE,WAA6C;CACnF,MAAM,EAAE,OAAO,SAAS,eAAe,OAAO;CAC9C,IAAI,QAAQ,SAAS,UACjB,OACI,oBAAC,OAAD;EAAK,WAAU;YACX,oBAAC,WAAD;GAAkB;GAAO,OAAO;GAAM,SAAS,QAAQ;EAAO,CAAA;CAC7D,CAAA;CAGb,OACI,oBAAC,OAAD;EAAK,WAAU;YACX,qBAAC,OAAD;GAAK,WAAU;aAAf,CACI,oBAAC,YAAD;IAAY,SAAQ;IAAY,WAAU;cACrC;GACO,CAAA,GACZ,oBAAC,YAAD;IAAY,SAA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