@standardbeagle/edit-db 0.3.159

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.
@@ -0,0 +1,19 @@
1
+ import { Component, ErrorInfo, ReactNode } from 'react';
2
+ interface ErrorBoundaryProps {
3
+ children: ReactNode;
4
+ fallback?: ReactNode;
5
+ onError?: (error: Error, errorInfo: ErrorInfo) => void;
6
+ section?: string;
7
+ }
8
+ interface ErrorBoundaryState {
9
+ hasError: boolean;
10
+ error: Error | null;
11
+ }
12
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
13
+ constructor(props: ErrorBoundaryProps);
14
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
15
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
16
+ handleRetry: () => void;
17
+ render(): ReactNode;
18
+ }
19
+ export {};
@@ -0,0 +1 @@
1
+ export default function ErrorPage(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function Header(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { Table } from '../types/schema';
2
+ import { TableColumn, SortOrder } from 'react-data-table-component';
3
+ interface RowData {
4
+ id?: number | string;
5
+ [key: string]: unknown;
6
+ }
7
+ interface DataTableColumn {
8
+ sortField?: string;
9
+ }
10
+ interface TableQueryData {
11
+ data: RowData[];
12
+ total: number;
13
+ offset: number;
14
+ limit: number;
15
+ }
16
+ interface QueryData {
17
+ [tableName: string]: TableQueryData;
18
+ }
19
+ interface UseDataTableResult {
20
+ tableColumns: TableColumn<RowData>[];
21
+ offset: number;
22
+ limit: number;
23
+ handleSort: (column: DataTableColumn, sortDirection: SortOrder) => void;
24
+ handlePage: (page: number) => void;
25
+ handlePageSize: (size: number) => void;
26
+ loading: boolean;
27
+ error: Error | null;
28
+ data: QueryData | undefined;
29
+ }
30
+ export declare function useDataTable(table: Table | null, id?: string, filterTable?: string): UseDataTableResult;
31
+ export {};
@@ -0,0 +1,47 @@
1
+ import { default as React, ReactElement, ReactNode } from 'react';
2
+ interface NavContext {
3
+ path: string;
4
+ history: string[];
5
+ location: number;
6
+ }
7
+ interface RouteParams {
8
+ [key: string]: string | undefined;
9
+ }
10
+ interface NavigationState extends NavContext {
11
+ navigate: (path: string) => void;
12
+ back: (count?: number) => void;
13
+ forward: (count?: number) => void;
14
+ hasBack: boolean;
15
+ }
16
+ interface SearchParamsResult {
17
+ search: URLSearchParams;
18
+ hash: string;
19
+ }
20
+ interface RouteError {
21
+ message?: string;
22
+ status?: number;
23
+ }
24
+ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
25
+ to: string;
26
+ children?: ReactNode;
27
+ }
28
+ export declare function usePath(): string;
29
+ export declare function useHistory(): string[];
30
+ export declare function useNavigate(): (url: string) => void;
31
+ export declare function useNavigation(): NavigationState;
32
+ export declare function useParams<T extends RouteParams = RouteParams>(): T;
33
+ export declare function useSearchParams(): SearchParamsResult;
34
+ export declare function useRouteError(): RouteError;
35
+ export declare function PathProvider({ path, children }: {
36
+ path: string;
37
+ children: ReactNode;
38
+ }): import("react/jsx-runtime").JSX.Element;
39
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
40
+ export declare function Routes({ children }: {
41
+ children: ReactNode;
42
+ }): import("react/jsx-runtime").JSX.Element;
43
+ export declare function Route({ path, element }: {
44
+ path: string;
45
+ element: ReactElement;
46
+ }): ReactElement;
47
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { Schema } from '../types/schema';
3
+ export declare const SchemaProvider: ({ children }: {
4
+ children: ReactNode;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function useSchema(): Schema;
@@ -0,0 +1,12 @@
1
+ import { Table, Column } from '../types/schema';
2
+ interface ColumnJoin {
3
+ column: Column;
4
+ }
5
+ export interface UseTableMutationResult {
6
+ update: (detail: Record<string, unknown>) => Promise<unknown>;
7
+ insert: (detail: Record<string, unknown>) => Promise<unknown>;
8
+ isPending: boolean;
9
+ error: Error | null;
10
+ }
11
+ export declare function useTableMutation(table: Table, editColumns: ColumnJoin[], idColumns: Column[], editId?: string): UseTableMutationResult;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Schema } from '../types/schema';
2
+ export declare function useTableRef(schema: Schema, tableName: string, columnName: string): TableRef;
3
+ export interface TableRefValue {
4
+ key: string;
5
+ label: string;
6
+ }
7
+ export interface TableRef {
8
+ loading: boolean;
9
+ error: unknown;
10
+ data: TableRefValue[];
11
+ }
@@ -0,0 +1,7 @@
1
+ import { Editor } from './editor';
2
+ export default Editor;
3
+ export { Editor };
4
+ export type { GraphQLFetcher } from './common/fetcher';
5
+ export { HttpGraphQLFetcher } from './common/fetcher';
6
+ export { useTableMutation } from './hooks/useTableMutation';
7
+ export type { UseTableMutationResult } from './hooks/useTableMutation';
@@ -0,0 +1,5 @@
1
+ interface MainFrameProps {
2
+ onLocate?: (location: string) => void;
3
+ }
4
+ export declare function MainFrame({ onLocate }: MainFrameProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export declare function TableList(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ export interface TableMetadata {
2
+ type?: {
3
+ type: 'lookup';
4
+ id: string;
5
+ label: string;
6
+ };
7
+ [key: string]: any;
8
+ }
9
+ export interface LookupMetadata {
10
+ type: 'lookup';
11
+ id: string;
12
+ label: string;
13
+ }
14
+ export interface ColumnMetadata {
15
+ [key: string]: string | LookupMetadata | undefined;
16
+ }
17
+ export interface Column {
18
+ dbName: string;
19
+ graphQlName: string;
20
+ name: string;
21
+ label: string;
22
+ paramType: string;
23
+ isPrimaryKey: boolean;
24
+ isIdentity: boolean;
25
+ isNullable: boolean;
26
+ isReadOnly: boolean;
27
+ metadata: ColumnMetadata;
28
+ }
29
+ export interface Join {
30
+ name: string;
31
+ sourceColumnNames: string[];
32
+ destinationTable: string;
33
+ destinationColumnNames: string[];
34
+ }
35
+ export interface Table {
36
+ dbName: string;
37
+ graphQlName: string;
38
+ name: string;
39
+ label: string;
40
+ labelColumn: string;
41
+ primaryKeys: string[];
42
+ isEditable: boolean;
43
+ metadata: TableMetadata;
44
+ columns: Column[];
45
+ multiJoins: Join[];
46
+ singleJoins: Join[];
47
+ }
48
+ export interface Schema {
49
+ loading: boolean;
50
+ error: {
51
+ message: string;
52
+ } | null;
53
+ data: Table[];
54
+ findTable: (tableName: string) => Table | undefined;
55
+ }
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@standardbeagle/edit-db",
3
+ "private": false,
4
+ "version": "0.3.159",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build --mode production",
9
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
+ "preview": "vite preview",
11
+ "storybook": "storybook dev -p 6006",
12
+ "storybook-build": "storybook build",
13
+ "ts": "tsc"
14
+ },
15
+ "dependencies": {
16
+ "@tanstack/react-query": "^5.62.0",
17
+ "react": "^18.3.1",
18
+ "react-data-table-component": "^7.6.2",
19
+ "react-dom": "^18.3.1",
20
+ "redux-actions": "^3.0.0",
21
+ "styled-components": "^6.1.11"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/core": "^7.24.6",
25
+ "@storybook/addon-actions": "^9.0.8",
26
+ "@storybook/addon-essentials": "^8.6.14",
27
+ "@storybook/addon-interactions": "^8.6.14",
28
+ "@storybook/addon-links": "^10.2.7",
29
+ "@storybook/react": "^10.2.7",
30
+ "@storybook/react-vite": "^10.2.7",
31
+ "@types/react": "^18.3.28",
32
+ "@types/react-dom": "^18.3.7",
33
+ "@types/redux-actions": "^2.6.5",
34
+ "@typescript-eslint/eslint-plugin": "^7.12.0",
35
+ "@typescript-eslint/parser": "^7.12.0",
36
+ "@vitejs/plugin-react-swc": "^4.2.3",
37
+ "ajv": "^8.17.1",
38
+ "babel-loader": "^9.1.3",
39
+ "browserslist": "^4.28.1",
40
+ "eslint": "^8.55.0",
41
+ "eslint-plugin-react-hooks": "^4.6.2",
42
+ "eslint-plugin-react-refresh": "^0.4.7",
43
+ "sass": "^1.97.3",
44
+ "storybook": "^10.2.7",
45
+ "stylelint": "^17.1.1",
46
+ "typescript": "^5.9.3",
47
+ "vite": "^7.3.1",
48
+ "vite-plugin-browser-sync": "^3.0.2",
49
+ "vite-plugin-dts": "^4.5.4"
50
+ },
51
+ "peerDependencies": {
52
+ "@tanstack/react-query": "^5.0.0"
53
+ },
54
+ "files": [
55
+ "dist"
56
+ ],
57
+ "main": "./dist/editor.umd.cjs",
58
+ "module": "./dist/editor.es.js",
59
+ "types": "./dist/index.d.ts",
60
+ "exports": {
61
+ ".": {
62
+ "import": {
63
+ "types": "./dist/index.d.ts",
64
+ "default": "./dist/editor.es.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/index.d.ts",
68
+ "default": "./dist/editor.umd.cjs"
69
+ }
70
+ }
71
+ }
72
+ }