@gblikas/querykit 0.0.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/.cursor/BUGBOT.md +21 -0
- package/.cursor/rules/01-project-structure.mdc +77 -0
- package/.cursor/rules/02-typescript-standards.mdc +105 -0
- package/.cursor/rules/03-testing-standards.mdc +78 -0
- package/.cursor/rules/04-query-language.mdc +79 -0
- package/.cursor/rules/05-solid-principles.mdc +118 -0
- package/.cursor/rules/liqe-readme-docs.mdc +438 -0
- package/.devcontainer/devcontainer.json +25 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +39 -0
- package/.github/dependabot.yml +12 -0
- package/.github/workflows/ci.yml +114 -0
- package/.github/workflows/publish.yml +61 -0
- package/.husky/pre-commit +30 -0
- package/.prettierrc +10 -0
- package/CONTRIBUTING.md +187 -0
- package/LICENSE +674 -0
- package/README.md +237 -0
- package/dist/adapters/drizzle/index.d.ts +122 -0
- package/dist/adapters/drizzle/index.js +166 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.js +25 -0
- package/dist/adapters/types.d.ts +60 -0
- package/dist/adapters/types.js +8 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +118 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.js +18 -0
- package/dist/parser/parser.d.ts +51 -0
- package/dist/parser/parser.js +201 -0
- package/dist/parser/types.d.ts +68 -0
- package/dist/parser/types.js +5 -0
- package/dist/query/builder.d.ts +61 -0
- package/dist/query/builder.js +188 -0
- package/dist/query/index.d.ts +2 -0
- package/dist/query/index.js +18 -0
- package/dist/query/types.d.ts +79 -0
- package/dist/query/types.js +2 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +18 -0
- package/dist/security/types.d.ts +181 -0
- package/dist/security/types.js +43 -0
- package/dist/security/validator.d.ts +191 -0
- package/dist/security/validator.js +344 -0
- package/dist/translators/drizzle/index.d.ts +73 -0
- package/dist/translators/drizzle/index.js +260 -0
- package/dist/translators/index.d.ts +8 -0
- package/dist/translators/index.js +27 -0
- package/dist/translators/sql/index.d.ts +108 -0
- package/dist/translators/sql/index.js +252 -0
- package/dist/translators/types.d.ts +39 -0
- package/dist/translators/types.js +8 -0
- package/examples/qk-next/README.md +35 -0
- package/examples/qk-next/app/favicon.ico +0 -0
- package/examples/qk-next/app/globals.css +122 -0
- package/examples/qk-next/app/layout.tsx +121 -0
- package/examples/qk-next/app/page.tsx +813 -0
- package/examples/qk-next/app/providers.tsx +80 -0
- package/examples/qk-next/components/aurora-background.tsx +12 -0
- package/examples/qk-next/components/github-stars.tsx +51 -0
- package/examples/qk-next/components/mode-toggle.tsx +27 -0
- package/examples/qk-next/components/reactbits/blocks/Backgrounds/Aurora/Aurora.tsx +217 -0
- package/examples/qk-next/components/reactbits/blocks/Backgrounds/LightRays/LightRays.tsx +474 -0
- package/examples/qk-next/components/theme-provider.tsx +11 -0
- package/examples/qk-next/components/ui/card.tsx +92 -0
- package/examples/qk-next/components/ui/command.tsx +184 -0
- package/examples/qk-next/components/ui/dialog.tsx +143 -0
- package/examples/qk-next/components/ui/drawer.tsx +135 -0
- package/examples/qk-next/components/ui/hover-card.tsx +44 -0
- package/examples/qk-next/components/ui/icons.tsx +148 -0
- package/examples/qk-next/components/ui/sonner.tsx +26 -0
- package/examples/qk-next/components/ui/table.tsx +117 -0
- package/examples/qk-next/components.json +21 -0
- package/examples/qk-next/eslint.config.mjs +21 -0
- package/examples/qk-next/jsrepo.json +13 -0
- package/examples/qk-next/lib/utils.ts +6 -0
- package/examples/qk-next/next.config.ts +8 -0
- package/examples/qk-next/package.json +48 -0
- package/examples/qk-next/pnpm-lock.yaml +5558 -0
- package/examples/qk-next/postcss.config.mjs +5 -0
- package/examples/qk-next/public/file.svg +1 -0
- package/examples/qk-next/public/globe.svg +1 -0
- package/examples/qk-next/public/next.svg +1 -0
- package/examples/qk-next/public/vercel.svg +1 -0
- package/examples/qk-next/public/window.svg +1 -0
- package/examples/qk-next/tsconfig.json +42 -0
- package/examples/qk-next/types/sonner.d.ts +3 -0
- package/jest.config.js +26 -0
- package/package.json +51 -0
- package/src/adapters/drizzle/drizzle-adapter.test.ts +115 -0
- package/src/adapters/drizzle/index.ts +299 -0
- package/src/adapters/index.ts +11 -0
- package/src/adapters/types.ts +72 -0
- package/src/index.ts +194 -0
- package/src/integration.test.ts +202 -0
- package/src/parser/index.ts +2 -0
- package/src/parser/parser.test.ts +1056 -0
- package/src/parser/parser.ts +268 -0
- package/src/parser/types.ts +97 -0
- package/src/query/builder.test.ts +272 -0
- package/src/query/builder.ts +274 -0
- package/src/query/index.ts +2 -0
- package/src/query/types.ts +107 -0
- package/src/security/index.ts +2 -0
- package/src/security/types.ts +210 -0
- package/src/security/validator.test.ts +459 -0
- package/src/security/validator.ts +395 -0
- package/src/security.test.ts +366 -0
- package/src/translators/drizzle/drizzle-translator.test.ts +128 -0
- package/src/translators/drizzle/index.test.ts +45 -0
- package/src/translators/drizzle/index.ts +346 -0
- package/src/translators/index.ts +14 -0
- package/src/translators/sql/index.test.ts +45 -0
- package/src/translators/sql/index.ts +331 -0
- package/src/translators/sql/sql-translator.test.ts +419 -0
- package/src/translators/types.ts +44 -0
- package/src/types/sonner.d.ts +3 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueryKit Translator Types
|
|
4
|
+
*
|
|
5
|
+
* These are the core interfaces for translators, which convert QueryKit's
|
|
6
|
+
* internal AST representation into formats that specific data sources can understand.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### QueryKit Demo (Next.js)
|
|
2
|
+
|
|
3
|
+
This is the demo website for QueryKit. It showcases the QueryKit DSL running in the browser, translating human-friendly filters to Drizzle/SQL and querying an in-browser Postgres (PGlite).
|
|
4
|
+
|
|
5
|
+
For full docs, API, and examples, visit the QueryKit repository: [github.com/gblikas/querykit](https://github.com/gblikas/querykit)
|
|
6
|
+
|
|
7
|
+
### Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd examples/qk-next
|
|
11
|
+
pnpm dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Open http://localhost:3000.
|
|
15
|
+
|
|
16
|
+
### Build and run
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd examples/qk-next
|
|
20
|
+
pnpm build
|
|
21
|
+
pnpm start
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Optional environment
|
|
25
|
+
|
|
26
|
+
- Set `NEXT_PUBLIC_SITE_URL` to your site URL to improve canonical metadata.
|
|
27
|
+
|
|
28
|
+
### Tech
|
|
29
|
+
|
|
30
|
+
- Next.js App Router
|
|
31
|
+
- QueryKit (DSL → Drizzle/SQL)
|
|
32
|
+
- Drizzle ORM + PGlite (in-browser Postgres)
|
|
33
|
+
- Tailwind CSS
|
|
34
|
+
|
|
35
|
+
License: See the repository root for licensing information.
|
|
Binary file
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
--color-background: var(--background);
|
|
8
|
+
--color-foreground: var(--foreground);
|
|
9
|
+
--font-sans: var(--font-geist-sans);
|
|
10
|
+
--font-mono: var(--font-geist-mono);
|
|
11
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
12
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
13
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
14
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
15
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
16
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
17
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
18
|
+
--color-sidebar: var(--sidebar);
|
|
19
|
+
--color-chart-5: var(--chart-5);
|
|
20
|
+
--color-chart-4: var(--chart-4);
|
|
21
|
+
--color-chart-3: var(--chart-3);
|
|
22
|
+
--color-chart-2: var(--chart-2);
|
|
23
|
+
--color-chart-1: var(--chart-1);
|
|
24
|
+
--color-ring: var(--ring);
|
|
25
|
+
--color-input: var(--input);
|
|
26
|
+
--color-border: var(--border);
|
|
27
|
+
--color-destructive: var(--destructive);
|
|
28
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
29
|
+
--color-accent: var(--accent);
|
|
30
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
31
|
+
--color-muted: var(--muted);
|
|
32
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
33
|
+
--color-secondary: var(--secondary);
|
|
34
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
35
|
+
--color-primary: var(--primary);
|
|
36
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
37
|
+
--color-popover: var(--popover);
|
|
38
|
+
--color-card-foreground: var(--card-foreground);
|
|
39
|
+
--color-card: var(--card);
|
|
40
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
41
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
42
|
+
--radius-lg: var(--radius);
|
|
43
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:root {
|
|
47
|
+
--radius: 0.625rem;
|
|
48
|
+
--card: oklch(1 0 0);
|
|
49
|
+
--card-foreground: oklch(0.145 0 0);
|
|
50
|
+
--popover: oklch(1 0 0);
|
|
51
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
52
|
+
--primary: oklch(0.205 0 0);
|
|
53
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
54
|
+
--secondary: oklch(0.97 0 0);
|
|
55
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
56
|
+
--muted: oklch(0.97 0 0);
|
|
57
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
58
|
+
--accent: oklch(0.97 0 0);
|
|
59
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
60
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
61
|
+
--border: oklch(0.922 0 0);
|
|
62
|
+
--input: oklch(0.922 0 0);
|
|
63
|
+
--ring: oklch(0.708 0 0);
|
|
64
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
65
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
66
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
67
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
68
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
69
|
+
--sidebar: oklch(0.985 0 0);
|
|
70
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
71
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
72
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
73
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
74
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
75
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
76
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
77
|
+
--background: oklch(1 0 0);
|
|
78
|
+
--foreground: oklch(0.145 0 0);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dark {
|
|
82
|
+
--background: oklch(0.145 0 0);
|
|
83
|
+
--foreground: oklch(0.985 0 0);
|
|
84
|
+
--card: oklch(0.205 0 0);
|
|
85
|
+
--card-foreground: oklch(0.985 0 0);
|
|
86
|
+
--popover: oklch(0.205 0 0);
|
|
87
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
88
|
+
--primary: oklch(0.922 0 0);
|
|
89
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
90
|
+
--secondary: oklch(0.269 0 0);
|
|
91
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
92
|
+
--muted: oklch(0.269 0 0);
|
|
93
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
94
|
+
--accent: oklch(0.269 0 0);
|
|
95
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
96
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
97
|
+
--border: oklch(1 0 0 / 10%);
|
|
98
|
+
--input: oklch(1 0 0 / 15%);
|
|
99
|
+
--ring: oklch(0.556 0 0);
|
|
100
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
101
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
102
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
103
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
104
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
105
|
+
--sidebar: oklch(0.205 0 0);
|
|
106
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
107
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
108
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
109
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
110
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
111
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
112
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@layer base {
|
|
116
|
+
* {
|
|
117
|
+
@apply border-border outline-ring/50;
|
|
118
|
+
}
|
|
119
|
+
body {
|
|
120
|
+
@apply bg-background text-foreground;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import { Geist, Geist_Mono } from 'next/font/google';
|
|
3
|
+
import './globals.css';
|
|
4
|
+
import { Toaster } from '@/components/ui/sonner';
|
|
5
|
+
import { Providers } from '@/app/providers';
|
|
6
|
+
import { ThemeProvider } from '@/components/theme-provider';
|
|
7
|
+
import { GitHubStars } from '@/components/github-stars';
|
|
8
|
+
import AuroraBackground from '@/components/aurora-background';
|
|
9
|
+
import { JSX } from 'react';
|
|
10
|
+
|
|
11
|
+
const geistSans = Geist({
|
|
12
|
+
variable: '--font-geist-sans',
|
|
13
|
+
subsets: ['latin']
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const geistMono = Geist_Mono({
|
|
17
|
+
variable: '--font-geist-mono',
|
|
18
|
+
subsets: ['latin']
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const metadata: Metadata = {
|
|
22
|
+
metadataBase: new URL(
|
|
23
|
+
process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'
|
|
24
|
+
),
|
|
25
|
+
title: {
|
|
26
|
+
default: 'QueryKit · Next.js Demo',
|
|
27
|
+
template: '%s · QueryKit'
|
|
28
|
+
},
|
|
29
|
+
applicationName: 'QueryKit',
|
|
30
|
+
description:
|
|
31
|
+
'Interactive demo for QueryKit — a type-safe DSL that translates human-friendly filters into Drizzle/SQL for both server and client.',
|
|
32
|
+
keywords: [
|
|
33
|
+
'QueryKit',
|
|
34
|
+
'query dsl',
|
|
35
|
+
'filter language',
|
|
36
|
+
'sql translation',
|
|
37
|
+
'drizzle orm',
|
|
38
|
+
'pglite',
|
|
39
|
+
'typescript',
|
|
40
|
+
'next.js'
|
|
41
|
+
],
|
|
42
|
+
authors: [{ name: 'gblikas', url: 'https://github.com/gblikas' }],
|
|
43
|
+
creator: 'QueryKit',
|
|
44
|
+
publisher: 'QueryKit',
|
|
45
|
+
category: 'software',
|
|
46
|
+
generator: 'Next.js',
|
|
47
|
+
referrer: 'origin-when-cross-origin',
|
|
48
|
+
formatDetection: {
|
|
49
|
+
email: false,
|
|
50
|
+
address: false,
|
|
51
|
+
telephone: false
|
|
52
|
+
},
|
|
53
|
+
openGraph: {
|
|
54
|
+
title: 'QueryKit · Next.js Demo',
|
|
55
|
+
description:
|
|
56
|
+
'Filter tasks using the QueryKit DSL and inspect the generated SQL and EXPLAIN ANALYZE.',
|
|
57
|
+
url: '/',
|
|
58
|
+
siteName: 'QueryKit',
|
|
59
|
+
locale: 'en_US',
|
|
60
|
+
type: 'website'
|
|
61
|
+
},
|
|
62
|
+
twitter: {
|
|
63
|
+
card: 'summary',
|
|
64
|
+
title: 'QueryKit · Next.js Demo',
|
|
65
|
+
description:
|
|
66
|
+
'Filter tasks using the QueryKit DSL and inspect the generated SQL and EXPLAIN ANALYZE.',
|
|
67
|
+
creator: '@querykit'
|
|
68
|
+
},
|
|
69
|
+
robots: {
|
|
70
|
+
index: true,
|
|
71
|
+
follow: true
|
|
72
|
+
},
|
|
73
|
+
alternates: {
|
|
74
|
+
canonical: '/'
|
|
75
|
+
},
|
|
76
|
+
themeColor: [
|
|
77
|
+
{ media: '(prefers-color-scheme: dark)', color: '#0B0B0E' },
|
|
78
|
+
{ media: '(prefers-color-scheme: light)', color: '#ffffff' }
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default function RootLayout({
|
|
83
|
+
children
|
|
84
|
+
}: {
|
|
85
|
+
children: React.ReactNode;
|
|
86
|
+
}): JSX.Element {
|
|
87
|
+
return (
|
|
88
|
+
<html lang="en" suppressHydrationWarning className="min-h-screen">
|
|
89
|
+
<body
|
|
90
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen`}
|
|
91
|
+
>
|
|
92
|
+
<ThemeProvider
|
|
93
|
+
attribute="class"
|
|
94
|
+
defaultTheme="dark"
|
|
95
|
+
enableSystem={false}
|
|
96
|
+
disableTransitionOnChange
|
|
97
|
+
>
|
|
98
|
+
<div className="relative min-h-screen">
|
|
99
|
+
{/* Global Aurora background behind header and content */}
|
|
100
|
+
<div className="fixed inset-0 -z-10 pointer-events-none">
|
|
101
|
+
<AuroraBackground />
|
|
102
|
+
</div>
|
|
103
|
+
<div className="fixed top-3 right-3 z-40">
|
|
104
|
+
<a
|
|
105
|
+
href="https://github.com/gblikas/querykit"
|
|
106
|
+
target="_blank"
|
|
107
|
+
rel="noreferrer"
|
|
108
|
+
className="inline-flex h-9 items-center justify-center gap-2 rounded-md border px-3 text-xs hover:bg-accent transition-colors"
|
|
109
|
+
aria-label="GitHub stars"
|
|
110
|
+
>
|
|
111
|
+
<GitHubStars />
|
|
112
|
+
</a>
|
|
113
|
+
</div>
|
|
114
|
+
<Providers>{children}</Providers>
|
|
115
|
+
<Toaster />
|
|
116
|
+
</div>
|
|
117
|
+
</ThemeProvider>
|
|
118
|
+
</body>
|
|
119
|
+
</html>
|
|
120
|
+
);
|
|
121
|
+
}
|