elysia-rack 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -0
  3. package/dist/Dashboard-xpstr7fr.js +172 -0
  4. package/dist/Panel-fbp3wrsw.js +738 -0
  5. package/dist/index-37x76zdn.js +4 -0
  6. package/dist/index-zc7rgvmm.js +13 -0
  7. package/dist/panel-app.js +1 -0
  8. package/dist/panel-theme.js +1 -0
  9. package/dist/panel.css +1 -0
  10. package/dist/rack/adapter.d.ts +5 -0
  11. package/dist/rack/adapters/drizzle.d.ts +2 -0
  12. package/dist/rack/adapters/index.d.ts +59 -0
  13. package/dist/rack/adapters/prisma.d.ts +2 -0
  14. package/dist/rack/authorization.d.ts +23 -0
  15. package/dist/rack/idempotency.d.ts +9 -0
  16. package/dist/rack/index.d.ts +40 -0
  17. package/dist/rack/index.js +1362 -0
  18. package/dist/rack/models/drizzle.d.ts +4 -0
  19. package/dist/rack/models/index.d.ts +24 -0
  20. package/dist/rack/models/prisma.d.ts +4 -0
  21. package/dist/rack/openapi.d.ts +6 -0
  22. package/dist/rack/page.d.ts +33 -0
  23. package/dist/rack/query.d.ts +22 -0
  24. package/dist/rack/registry.d.ts +20 -0
  25. package/dist/rack/types/authorization.d.ts +16 -0
  26. package/dist/rack/types/idempotency.d.ts +46 -0
  27. package/dist/rack/types/index.d.ts +89 -0
  28. package/dist/rack/types/metadata.d.ts +36 -0
  29. package/dist/rack/types/openapi.d.ts +22 -0
  30. package/dist/rack/types/operations.d.ts +14 -0
  31. package/dist/rack/types/page.d.ts +41 -0
  32. package/dist/rack/types/query.d.ts +30 -0
  33. package/dist/rack/types/validation.d.ts +19 -0
  34. package/dist/react/index.d.ts +64 -0
  35. package/dist/react/index.js +126 -0
  36. package/dist/react/page/Dashboard.d.ts +7 -0
  37. package/dist/react/page/Panel.d.ts +36 -0
  38. package/dist/react/page/client/panel.d.ts +1 -0
  39. package/dist/react/page/client/theme.d.ts +1 -0
  40. package/dist/react/page/components/Breadcrumb.d.ts +7 -0
  41. package/dist/react/page/components/DataTable.d.ts +10 -0
  42. package/dist/react/page/components/Masthead.d.ts +7 -0
  43. package/dist/react/page/components/Pagination.d.ts +10 -0
  44. package/dist/react/page/components/Sidebar.d.ts +16 -0
  45. package/dist/react/page/components/Toolbar.d.ts +7 -0
  46. package/dist/react/page/components/href.d.ts +10 -0
  47. package/dist/react/page/components/panelForm.d.ts +9 -0
  48. package/dist/react/render.d.ts +2 -0
  49. package/dist/react/types.d.ts +16 -0
  50. package/package.json +89 -0
@@ -0,0 +1 @@
1
+ export declare function toggleTheme(): void;
@@ -0,0 +1,7 @@
1
+ export interface BreadcrumbItem {
2
+ label: string;
3
+ href?: string;
4
+ }
5
+ export declare function Breadcrumb({ trail }: {
6
+ trail: BreadcrumbItem[];
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ export interface DataTableProps {
2
+ columns: string[];
3
+ rows: Record<string, unknown>[];
4
+ sortable?: readonly string[];
5
+ params: Record<string, unknown>;
6
+ selectable?: boolean;
7
+ editable?: boolean;
8
+ primaryKey?: string;
9
+ }
10
+ export declare function DataTable({ columns, rows, sortable, params, selectable, editable, primaryKey, }: DataTableProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export interface MastheadProps {
2
+ title: string;
3
+ group?: string;
4
+ resource?: string;
5
+ total?: number;
6
+ }
7
+ export declare function Masthead({ title, group, resource, total }: MastheadProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { pageWindow } from "./href";
2
+ export interface PaginationProps {
3
+ page: number;
4
+ totalPages: number;
5
+ total: number;
6
+ limit: number;
7
+ params: Record<string, unknown>;
8
+ }
9
+ export { pageWindow };
10
+ export declare function Pagination({ page, totalPages, total, limit, params }: PaginationProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ export interface SidebarItem {
2
+ id: string;
3
+ label: string;
4
+ icon?: string;
5
+ href: string;
6
+ active?: boolean;
7
+ }
8
+ export interface SidebarGroup {
9
+ name: string;
10
+ items: SidebarItem[];
11
+ }
12
+ export interface SidebarProps {
13
+ title: string;
14
+ groups: SidebarGroup[];
15
+ }
16
+ export declare function Sidebar({ title, groups }: SidebarProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export interface ToolbarProps {
2
+ searchable?: readonly string[];
3
+ filterable?: readonly string[];
4
+ sortable?: readonly string[];
5
+ params: Record<string, unknown>;
6
+ }
7
+ export declare function Toolbar({ searchable, filterable, sortable, params }: ToolbarProps): import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Build a panel link preserving current params with overrides.
3
+ * Empty values drop the key (e.g. resetting to page 1).
4
+ */
5
+ export declare function href(params: Record<string, unknown>, over?: Record<string, unknown>): string;
6
+ /**
7
+ * Page numbers with ellipsis for pagination.
8
+ * Shared by the server renderer and the browser client.
9
+ */
10
+ export declare function pageWindow(page: number, total: number): (number | "…")[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Panel form logic: collect the body from a form and fill a form from a row.
3
+ * Used directly by the browser bundle (client/panel.ts).
4
+ */
5
+ export declare function collectFormBody(form: any): {
6
+ body?: Record<string, unknown>;
7
+ error?: string;
8
+ };
9
+ export declare function fillForm(form: any, row: Record<string, unknown>): void;
@@ -0,0 +1,2 @@
1
+ import type { ReactRack } from "./types";
2
+ export declare function createRenderer(pages: ReactRack.PageRegistry): (path: string, props: unknown) => Promise<Response>;
@@ -0,0 +1,16 @@
1
+ import type { ComponentType } from "react";
2
+ export declare namespace ReactRack {
3
+ const PAGE: unique symbol;
4
+ interface PageDescriptor<Props = unknown> {
5
+ [PAGE]: true;
6
+ path: string;
7
+ props?: Props;
8
+ }
9
+ type PageComponent<Props = any> = ComponentType<Props>;
10
+ type PageRegistry = Record<string, () => Promise<{
11
+ default: PageComponent;
12
+ }>>;
13
+ interface ReactPluginOptions {
14
+ pages: PageRegistry;
15
+ }
16
+ }
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "elysia-rack",
3
+ "version": "0.1.1",
4
+ "description": "Model-driven CRUD rack for Elysia: REST + QUERY routes, validation, authorization, OpenAPI metadata, and React panel rendering.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "notoofly",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/notoofly/elysia-rack.git"
11
+ },
12
+ "homepage": "https://github.com/notoofly/elysia-rack#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/notoofly/elysia-rack/issues"
15
+ },
16
+ "keywords": [
17
+ "elysia",
18
+ "bun",
19
+ "crud",
20
+ "panel",
21
+ "admin",
22
+ "react",
23
+ "openapi"
24
+ ],
25
+ "packageManager": "bun@1.3.10",
26
+ "engines": {
27
+ "bun": ">=1.0.0",
28
+ "node": ">=20.0.0"
29
+ },
30
+ "main": "./dist/rack/index.js",
31
+ "module": "./dist/rack/index.js",
32
+ "types": "./dist/rack/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/rack/index.d.ts",
36
+ "default": "./dist/rack/index.js"
37
+ },
38
+ "./react": {
39
+ "types": "./dist/react/index.d.ts",
40
+ "default": "./dist/react/index.js"
41
+ },
42
+ "./package.json": "./package.json"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md",
47
+ "LICENSE"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org/"
52
+ },
53
+ "scripts": {
54
+ "dev": "bun run build:assets && bun run src/playground.ts",
55
+ "test": "bun test --coverage",
56
+ "typecheck": "tsc --noEmit",
57
+ "build": "bun run build:assets && bun run build:js && bun run build:dts",
58
+ "build:assets": "vite build",
59
+ "build:js": "bun build ./src/rack/index.ts ./src/react/index.ts --outdir ./dist --target node --format esm --splitting --external elysia --external react --external react-dom",
60
+ "build:dts": "tsc -p tsconfig.build.json",
61
+ "prepublishOnly": "bun run typecheck && bun run build"
62
+ },
63
+ "peerDependencies": {
64
+ "elysia": "^1.4.0",
65
+ "react": ">=18",
66
+ "react-dom": ">=18",
67
+ "drizzle-orm": "^0.45.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "drizzle-orm": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "devDependencies": {
75
+ "@electric-sql/pglite": "^0.5.8",
76
+ "@tailwindcss/vite": "^4.3.3",
77
+ "@types/bun": "latest",
78
+ "@types/react": "^19.2.18",
79
+ "@types/react-dom": "^19.2.5",
80
+ "@vitejs/plugin-react": "^6.1.1",
81
+ "drizzle-orm": "^0.45.2",
82
+ "elysia": "^1.4.30",
83
+ "react": "^19.2.8",
84
+ "react-dom": "^19.2.8",
85
+ "tailwindcss": "^4.3.3",
86
+ "typescript": "^5",
87
+ "vite": "^8.2.2"
88
+ }
89
+ }