@rebasepro/studio 0.35.0 → 0.36.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/README.md +1 -1
- package/dist/{ApiExplorer-C61w8gCc.js → ApiExplorer-BVQHAjHB.js} +3 -2
- package/dist/{ApiExplorer-C61w8gCc.js.map → ApiExplorer-BVQHAjHB.js.map} +1 -1
- package/dist/{useRunAsUsers-CF7tkGzj.js → AuthSimulationSelector-XogpkeXC.js} +4 -68
- package/dist/AuthSimulationSelector-XogpkeXC.js.map +1 -0
- package/dist/{CronJobsView-DUuyzkJK.js → CronJobsView-DyX9MINh.js} +2 -2
- package/dist/{CronJobsView-DUuyzkJK.js.map → CronJobsView-DyX9MINh.js.map} +1 -1
- package/dist/DatabaseView-Bi0NZS90.js +1897 -0
- package/dist/DatabaseView-Bi0NZS90.js.map +1 -0
- package/dist/{JSEditor-Bi2Aol-Y.js → JSEditor-B4Lazm-z.js} +4 -3
- package/dist/{JSEditor-Bi2Aol-Y.js.map → JSEditor-B4Lazm-z.js.map} +1 -1
- package/dist/RLSEditor-CcHkWFNg.js +973 -0
- package/dist/RLSEditor-CcHkWFNg.js.map +1 -0
- package/dist/{SQLEditor-DRo5kW1h.js → SQLEditorRoute-f5j_ZKdj.js} +1472 -320
- package/dist/SQLEditorRoute-f5j_ZKdj.js.map +1 -0
- package/dist/SchemaDiagramView-CckQobIZ.js +98 -0
- package/dist/SchemaDiagramView-CckQobIZ.js.map +1 -0
- package/dist/{StorageView-D0D8z4lI.js → StorageView-B7QHjEGY.js} +2 -2
- package/dist/{StorageView-D0D8z4lI.js.map → StorageView-B7QHjEGY.js.map} +1 -1
- package/dist/TableEditorView-BRZNvD6U.js +3615 -0
- package/dist/TableEditorView-BRZNvD6U.js.map +1 -0
- package/dist/TablePolicies-C1-tbC8x.js +1740 -0
- package/dist/TablePolicies-C1-tbC8x.js.map +1 -0
- package/dist/{SchemaVisualizer-Dy4kWKT5.js → TablesDiagram-RTJfwVEN.js} +651 -489
- package/dist/TablesDiagram-RTJfwVEN.js.map +1 -0
- package/dist/{UsersAndRolesView-CKw4SJPj.js → UsersAndRolesView-Cx6xtMVH.js} +2 -2
- package/dist/{UsersAndRolesView-CKw4SJPj.js.map → UsersAndRolesView-Cx6xtMVH.js.map} +1 -1
- package/dist/{WebhooksView-CFPY-N9h.js → WebhooksView-Bn9KB7xG.js} +2 -2
- package/dist/{WebhooksView-CFPY-N9h.js.map → WebhooksView-Bn9KB7xG.js.map} +1 -1
- package/dist/{adminFetch-BfOnfRgU.js → adminFetch-C7Ra8rpP.js} +26 -1
- package/dist/{adminFetch-BfOnfRgU.js.map → adminFetch-C7Ra8rpP.js.map} +1 -1
- package/dist/components/Database/ActivitySection.d.ts +9 -0
- package/dist/components/Database/AdvisorsSection.d.ts +17 -0
- package/dist/components/Database/DatabaseView.d.ts +13 -0
- package/dist/components/Database/ExtensionsSection.d.ts +2 -0
- package/dist/components/Database/FunctionsSection.d.ts +2 -0
- package/dist/components/Database/QueriesSection.d.ts +3 -0
- package/dist/components/Database/TriggersSection.d.ts +2 -0
- package/dist/components/Database/TypesSection.d.ts +2 -0
- package/dist/components/Database/format.d.ts +6 -0
- package/dist/components/Database/links.d.ts +11 -0
- package/dist/components/Database/shared.d.ts +35 -0
- package/dist/components/Database/source.d.ts +12 -0
- package/dist/components/Database/useCatalogList.d.ts +13 -0
- package/dist/components/RLSEditor/RLSEditor.d.ts +2 -0
- package/dist/components/RLSEditor/TablePolicies.d.ts +54 -0
- package/dist/components/SQLEditor/ExplainVisualizer.d.ts +8 -20
- package/dist/components/SQLEditor/ResultChart.d.ts +18 -0
- package/dist/components/SQLEditor/SQLEditor.d.ts +13 -1
- package/dist/components/SQLEditor/SQLEditorRoute.d.ts +13 -0
- package/dist/components/SQLEditor/SQLEditorSidebar.d.ts +7 -1
- package/dist/components/SQLEditor/SqlParamsPanel.d.ts +16 -0
- package/dist/components/SQLEditor/useSqlSnippets.d.ts +47 -0
- package/dist/components/SchemaVisualizer/SchemaDiagramView.d.ts +12 -0
- package/dist/components/SchemaVisualizer/TablesDiagram.d.ts +23 -0
- package/dist/components/SchemaVisualizer/useSchemaGraph.d.ts +32 -1
- package/dist/components/TableEditor/CreateTableDialog.d.ts +8 -0
- package/dist/components/TableEditor/DdlConfirm.d.ts +23 -0
- package/dist/components/TableEditor/SqlBlock.d.ts +7 -0
- package/dist/components/TableEditor/TableDdlSheet.d.ts +9 -0
- package/dist/components/TableEditor/TableEditorView.d.ts +7 -0
- package/dist/components/TableEditor/tableModel.d.ts +210 -0
- package/dist/components/TableEditor/tabs/DataTab.d.ts +12 -0
- package/dist/components/TableEditor/tabs/PoliciesTab.d.ts +8 -0
- package/dist/components/TableEditor/tabs/RelationsTab.d.ts +8 -0
- package/dist/components/TableEditor/tabs/SettingsTab.d.ts +11 -0
- package/dist/components/TableEditor/tabs/StatsTab.d.ts +8 -0
- package/dist/components/TableEditor/tabs/StructureTab.d.ts +12 -0
- package/dist/index.es.js +29 -15
- package/dist/index.es.js.map +1 -1
- package/dist/{sql_utils-CYcgpgam.js → sql_utils-DkMYltfq.js} +27 -3
- package/dist/sql_utils-DkMYltfq.js.map +1 -0
- package/dist/useRunAsUsers-GPFCxcBC.js +69 -0
- package/dist/useRunAsUsers-GPFCxcBC.js.map +1 -0
- package/dist/utils/adminFetch.d.ts +1 -0
- package/dist/utils/csv_parse.d.ts +11 -0
- package/dist/utils/explain_plan.d.ts +70 -0
- package/dist/utils/sql_params.d.ts +51 -0
- package/dist/utils/sql_utils.d.ts +16 -0
- package/package.json +11 -9
- package/dist/RLSEditor-CTG3jLE7.js +0 -2572
- package/dist/RLSEditor-CTG3jLE7.js.map +0 -1
- package/dist/SQLEditor-DRo5kW1h.js.map +0 -1
- package/dist/SchemaVisualizer-Dy4kWKT5.js.map +0 -1
- package/dist/TableEditorView-BKhSBG-K.js +0 -1694
- package/dist/TableEditorView-BKhSBG-K.js.map +0 -1
- package/dist/components/SchemaVisualizer/SchemaVisualizer.d.ts +0 -3
- package/dist/policy-presets-CJKzAvQp.js +0 -167
- package/dist/policy-presets-CJKzAvQp.js.map +0 -1
- package/dist/sql_utils-CYcgpgam.js.map +0 -1
- package/dist/useRunAsUsers-CF7tkGzj.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { s as useAdminFetch } from "./adminFetch-C7Ra8rpP.js";
|
|
2
|
+
import { n as SchemaSourceProblemView, r as schemaSourceProblem } from "./schema-source-C4ekB7WU.js";
|
|
3
|
+
import { _ as tablesLink, h as parseTablesResponse, t as TablesDiagram } from "./TablesDiagram-RTJfwVEN.js";
|
|
4
|
+
import { useTableDescriptors, useTranslation } from "@rebasepro/app";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { CircularProgress, Typography, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useNavigate } from "react-router";
|
|
9
|
+
//#region src/components/SchemaVisualizer/SchemaDiagramView.tsx
|
|
10
|
+
/**
|
|
11
|
+
* The schema diagram as a page of its own: for a host without the Tables view
|
|
12
|
+
* (the hosted console), and for links to the diagram's own route.
|
|
13
|
+
*
|
|
14
|
+
* The database's catalog is read from `/api/admin/db/tables` when the backend
|
|
15
|
+
* serves it; a backend that does not still gets the diagram of the tables it
|
|
16
|
+
* declares.
|
|
17
|
+
*/
|
|
18
|
+
function SchemaDiagramView({ linksToTables }) {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const { requestJson } = useAdminFetch();
|
|
22
|
+
const descriptors = useTableDescriptors();
|
|
23
|
+
const [catalog, setCatalog] = useState(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
let current = true;
|
|
26
|
+
requestJson("/admin/db/tables").then((raw) => {
|
|
27
|
+
if (current) setCatalog(parseTablesResponse(raw));
|
|
28
|
+
}).catch(() => {
|
|
29
|
+
if (current) setCatalog([]);
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
current = false;
|
|
33
|
+
};
|
|
34
|
+
}, [requestJson]);
|
|
35
|
+
const problem = schemaSourceProblem(descriptors);
|
|
36
|
+
const hasDeclared = descriptors.tables.some((table) => table.kind === "table");
|
|
37
|
+
const hasCatalog = (catalog ?? []).some((table) => table.kind === "table");
|
|
38
|
+
if (problem && !hasDeclared && !hasCatalog && catalog !== null) return /* @__PURE__ */ jsx(SchemaSourceProblemView, { problem });
|
|
39
|
+
if (catalog === null || descriptors.status === "loading" && !hasCatalog) return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: "flex items-center justify-center h-full w-full",
|
|
41
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "text-center flex flex-col items-center gap-3",
|
|
43
|
+
children: [/* @__PURE__ */ jsx(CircularProgress, { size: "small" }), /* @__PURE__ */ jsx(Typography, {
|
|
44
|
+
variant: "body2",
|
|
45
|
+
color: "secondary",
|
|
46
|
+
children: t("studio_schema_loading")
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
if (!hasDeclared && !hasCatalog) return /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "flex items-center justify-center h-full w-full p-6",
|
|
52
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "max-w-md text-center flex flex-col gap-2",
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
56
|
+
variant: "subtitle2",
|
|
57
|
+
children: t("studio_schema_no_tables_declared")
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
60
|
+
variant: "body2",
|
|
61
|
+
color: "secondary",
|
|
62
|
+
children: t("studio_schema_no_tables_declared_body")
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
65
|
+
variant: "body2",
|
|
66
|
+
color: "secondary",
|
|
67
|
+
children: t("studio_schema_introspect_hint")
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
const schema = catalog[0]?.schema ?? "public";
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex flex-col h-full w-full bg-surface-card overflow-hidden",
|
|
75
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: cls("flex flex-col justify-center px-4 border-b bg-surface-sheet h-[42px] shrink-0", defaultBorderMixin),
|
|
77
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
78
|
+
variant: "subtitle2",
|
|
79
|
+
children: t("studio_tool_schema_visualizer")
|
|
80
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
81
|
+
variant: "caption",
|
|
82
|
+
color: "secondary",
|
|
83
|
+
className: "truncate",
|
|
84
|
+
children: hasCatalog ? t("studio_tables_diagram_source_catalog") : t("studio_schema_visualizer_source")
|
|
85
|
+
})]
|
|
86
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "flex-1 min-h-0",
|
|
88
|
+
children: /* @__PURE__ */ jsx(TablesDiagram, {
|
|
89
|
+
catalog,
|
|
90
|
+
onOpenTable: linksToTables ? (name) => navigate(tablesLink(`${schema}.${name}`)) : void 0
|
|
91
|
+
})
|
|
92
|
+
})]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { SchemaDiagramView };
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=SchemaDiagramView-CckQobIZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaDiagramView-CckQobIZ.js","names":[],"sources":["../src/components/SchemaVisualizer/SchemaDiagramView.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport { useNavigate } from \"react-router\";\nimport { CircularProgress, cls, defaultBorderMixin, Typography } from \"@rebasepro/ui\";\nimport { useTableDescriptors, useTranslation } from \"@rebasepro/app\";\nimport { useAdminFetch } from \"../../utils/adminFetch\";\nimport { parseTablesResponse, tablesLink, type DbTableInfo } from \"../TableEditor/tableModel\";\nimport { schemaSourceProblem, SchemaSourceProblemView } from \"../schema-source\";\nimport { TablesDiagram } from \"./TablesDiagram\";\n\n/**\n * The schema diagram as a page of its own: for a host without the Tables view\n * (the hosted console), and for links to the diagram's own route.\n *\n * The database's catalog is read from `/api/admin/db/tables` when the backend\n * serves it; a backend that does not still gets the diagram of the tables it\n * declares.\n */\nexport function SchemaDiagramView({ linksToTables }: { linksToTables: boolean }) {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { requestJson } = useAdminFetch();\n const descriptors = useTableDescriptors();\n const [catalog, setCatalog] = useState<DbTableInfo[] | null>(null);\n\n useEffect(() => {\n let current = true;\n requestJson(\"/admin/db/tables\")\n .then(raw => { if (current) setCatalog(parseTablesResponse(raw)); })\n // No catalog route on this backend: the declared tables are the diagram.\n .catch(() => { if (current) setCatalog([]); });\n return () => {\n current = false;\n };\n }, [requestJson]);\n\n const problem = schemaSourceProblem(descriptors);\n const hasDeclared = descriptors.tables.some(table => table.kind === \"table\");\n const hasCatalog = (catalog ?? []).some(table => table.kind === \"table\");\n\n if (problem && !hasDeclared && !hasCatalog && catalog !== null) {\n return <SchemaSourceProblemView problem={problem}/>;\n }\n // Still loading and nothing to draw are different answers.\n if (catalog === null || (descriptors.status === \"loading\" && !hasCatalog)) {\n return (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div className=\"text-center flex flex-col items-center gap-3\">\n <CircularProgress size=\"small\"/>\n <Typography variant=\"body2\" color=\"secondary\">{t(\"studio_schema_loading\")}</Typography>\n </div>\n </div>\n );\n }\n if (!hasDeclared && !hasCatalog) {\n return (\n <div className=\"flex items-center justify-center h-full w-full p-6\">\n <div className=\"max-w-md text-center flex flex-col gap-2\">\n <Typography variant=\"subtitle2\">{t(\"studio_schema_no_tables_declared\")}</Typography>\n <Typography variant=\"body2\" color=\"secondary\">{t(\"studio_schema_no_tables_declared_body\")}</Typography>\n <Typography variant=\"body2\" color=\"secondary\">{t(\"studio_schema_introspect_hint\")}</Typography>\n </div>\n </div>\n );\n }\n\n const schema = catalog[0]?.schema ?? \"public\";\n return (\n <div className=\"flex flex-col h-full w-full bg-surface-card overflow-hidden\">\n <div className={cls(\"flex flex-col justify-center px-4 border-b bg-surface-sheet h-[42px] shrink-0\", defaultBorderMixin)}>\n <Typography variant=\"subtitle2\">{t(\"studio_tool_schema_visualizer\")}</Typography>\n <Typography variant=\"caption\" color=\"secondary\" className=\"truncate\">\n {hasCatalog ? t(\"studio_tables_diagram_source_catalog\") : t(\"studio_schema_visualizer_source\")}\n </Typography>\n </div>\n <div className=\"flex-1 min-h-0\">\n <TablesDiagram\n catalog={catalog}\n onOpenTable={linksToTables ? (name) => navigate(tablesLink(`${schema}.${name}`)) : undefined}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,iBAA6C;CAC7E,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,gBAAgB,cAAc;CACtC,MAAM,cAAc,oBAAoB;CACxC,MAAM,CAAC,SAAS,cAAc,SAA+B,IAAI;CAEjE,gBAAgB;EACZ,IAAI,UAAU;EACd,YAAY,kBAAkB,CAAC,CAC1B,MAAK,QAAO;GAAE,IAAI,SAAS,WAAW,oBAAoB,GAAG,CAAC;EAAG,CAAC,CAAC,CAEnE,YAAY;GAAE,IAAI,SAAS,WAAW,CAAC,CAAC;EAAG,CAAC;EACjD,aAAa;GACT,UAAU;EACd;CACJ,GAAG,CAAC,WAAW,CAAC;CAEhB,MAAM,UAAU,oBAAoB,WAAW;CAC/C,MAAM,cAAc,YAAY,OAAO,MAAK,UAAS,MAAM,SAAS,OAAO;CAC3E,MAAM,cAAc,WAAW,CAAC,EAAA,CAAG,MAAK,UAAS,MAAM,SAAS,OAAO;CAEvE,IAAI,WAAW,CAAC,eAAe,CAA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ecord, r as asNumber, s as useAdminFetch, t as asBoolean } from "./adminFetch-
|
|
1
|
+
import { a as asStringArray, i as asString, o as isRecord, r as asNumber, s as useAdminFetch, t as asBoolean } from "./adminFetch-C7Ra8rpP.js";
|
|
2
2
|
import { t as classifyLoadFailure } from "./load-failure-Bd8lFIO7.js";
|
|
3
3
|
import { ErrorView, useApiBase, useApiConfig, useSnackbarController, useStorageSource, useStorageSources, useTranslation } from "@rebasepro/app";
|
|
4
4
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -2367,4 +2367,4 @@ var StorageFilesBrowser = () => {
|
|
|
2367
2367
|
//#endregion
|
|
2368
2368
|
export { StorageView };
|
|
2369
2369
|
|
|
2370
|
-
//# sourceMappingURL=StorageView-
|
|
2370
|
+
//# sourceMappingURL=StorageView-B7QHjEGY.js.map
|