@useatlas/create 0.0.2 → 0.0.3
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 +4 -18
- package/index.ts +191 -31
- package/package.json +1 -1
- package/templates/docker/.env.example +3 -3
- package/templates/docker/Dockerfile.sidecar +28 -0
- package/templates/docker/bin/__tests__/plugin-cli.test.ts +9 -9
- package/templates/docker/bin/atlas.ts +108 -44
- package/templates/docker/data/demo-semantic/catalog.yml +51 -27
- package/templates/docker/data/demo-semantic/entities/accounts.yml +95 -103
- package/templates/docker/data/demo-semantic/entities/companies.yml +88 -152
- package/templates/docker/data/demo-semantic/entities/people.yml +82 -95
- package/templates/docker/data/demo-semantic/glossary.yml +104 -8
- package/templates/docker/data/demo-semantic/metrics/accounts.yml +62 -23
- package/templates/docker/data/demo-semantic/metrics/companies.yml +52 -78
- package/templates/docker/docker-compose.yml +1 -1
- package/templates/docker/docs/deploy.md +2 -39
- package/templates/docker/package.json +17 -1
- package/templates/docker/semantic/catalog.yml +62 -3
- package/templates/docker/semantic/entities/accounts.yml +162 -0
- package/templates/docker/semantic/entities/companies.yml +143 -0
- package/templates/docker/semantic/entities/people.yml +132 -0
- package/templates/docker/semantic/glossary.yml +116 -4
- package/templates/docker/semantic/metrics/accounts.yml +77 -0
- package/templates/docker/semantic/metrics/companies.yml +63 -0
- package/templates/docker/sidecar/Dockerfile +5 -6
- package/templates/docker/sidecar/railway.json +1 -2
- package/templates/docker/src/api/__tests__/admin.test.ts +7 -7
- package/templates/docker/src/api/__tests__/health-plugin.test.ts +7 -0
- package/templates/docker/src/api/__tests__/health.test.ts +30 -8
- package/templates/docker/src/api/routes/admin.ts +549 -8
- package/templates/docker/src/api/routes/chat.ts +5 -20
- package/templates/docker/src/api/routes/health.ts +39 -27
- package/templates/docker/src/api/routes/openapi.ts +1329 -74
- package/templates/docker/src/api/routes/query.ts +2 -1
- package/templates/docker/src/api/server.ts +27 -0
- package/templates/docker/src/app/api/[...route]/route.ts +2 -2
- package/templates/docker/src/app/globals.css +13 -12
- package/templates/docker/src/app/layout.tsx +9 -2
- package/templates/docker/src/components/ui/alert-dialog.tsx +196 -0
- package/templates/docker/src/components/ui/badge.tsx +48 -0
- package/templates/docker/src/components/ui/button.tsx +64 -0
- package/templates/docker/src/components/ui/card.tsx +92 -0
- package/templates/docker/src/components/ui/collapsible.tsx +33 -0
- package/templates/docker/src/components/ui/command.tsx +184 -0
- package/templates/docker/src/components/ui/dialog.tsx +158 -0
- package/templates/docker/src/components/ui/dropdown-menu.tsx +257 -0
- package/templates/docker/src/components/ui/input.tsx +21 -0
- package/templates/docker/src/components/ui/scroll-area.tsx +58 -0
- package/templates/docker/src/components/ui/select.tsx +190 -0
- package/templates/docker/src/components/ui/separator.tsx +28 -0
- package/templates/docker/src/components/ui/sheet.tsx +143 -0
- package/templates/docker/src/components/ui/sidebar.tsx +726 -0
- package/templates/docker/src/components/ui/skeleton.tsx +13 -0
- package/templates/docker/src/components/ui/table.tsx +116 -0
- package/templates/docker/src/components/ui/tabs.tsx +91 -0
- package/templates/docker/src/components/ui/toggle-group.tsx +83 -0
- package/templates/docker/src/components/ui/toggle.tsx +47 -0
- package/templates/docker/src/components/ui/tooltip.tsx +57 -0
- package/templates/docker/src/hooks/use-mobile.ts +19 -0
- package/templates/docker/src/lib/__tests__/agent-cache.test.ts +2 -0
- package/templates/docker/src/lib/__tests__/agent-dialect.test.ts +17 -0
- package/templates/docker/src/lib/__tests__/agent-health-annotations.test.ts +2 -0
- package/templates/docker/src/lib/__tests__/agent-integration.test.ts +2 -0
- package/templates/docker/src/lib/__tests__/config.test.ts +69 -19
- package/templates/docker/src/lib/__tests__/plugin-aware-validation.test.ts +321 -0
- package/templates/docker/src/lib/__tests__/providers.test.ts +32 -1
- package/templates/docker/src/lib/__tests__/startup-actions.test.ts +9 -0
- package/templates/docker/src/lib/__tests__/startup-first-run.test.ts +429 -0
- package/templates/docker/src/lib/__tests__/startup.test.ts +5 -0
- package/templates/docker/src/lib/agent-query.ts +5 -23
- package/templates/docker/src/lib/agent.ts +32 -112
- package/templates/docker/src/lib/auth/__tests__/migrate.test.ts +5 -3
- package/templates/docker/src/lib/auth/middleware.ts +30 -4
- package/templates/docker/src/lib/auth/migrate.ts +97 -0
- package/templates/docker/src/lib/auth/server.ts +12 -1
- package/templates/docker/src/lib/config.ts +37 -39
- package/templates/docker/src/lib/db/__tests__/connection.test.ts +89 -14
- package/templates/docker/src/lib/db/__tests__/registry-health.test.ts +1 -18
- package/templates/docker/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -19
- package/templates/docker/src/lib/db/__tests__/registry.test.ts +11 -208
- package/templates/docker/src/lib/db/connection.ts +87 -265
- package/templates/docker/src/lib/db/internal.ts +6 -1
- package/templates/docker/src/lib/plugins/__tests__/hooks-integration.test.ts +3 -1
- package/templates/docker/src/lib/plugins/__tests__/hooks.test.ts +2 -2
- package/templates/docker/src/lib/plugins/__tests__/migrate.test.ts +355 -1
- package/templates/docker/src/lib/plugins/__tests__/registry.test.ts +32 -5
- package/templates/docker/src/lib/plugins/__tests__/wiring.test.ts +228 -14
- package/templates/docker/src/lib/plugins/index.ts +4 -1
- package/templates/docker/src/lib/plugins/migrate.ts +103 -0
- package/templates/docker/src/lib/plugins/registry.ts +12 -6
- package/templates/docker/src/lib/plugins/wiring.ts +113 -4
- package/templates/docker/src/lib/providers.ts +6 -1
- package/templates/docker/src/lib/security.ts +24 -0
- package/templates/docker/src/lib/semantic.ts +2 -0
- package/templates/docker/src/lib/sidecar-types.ts +12 -1
- package/templates/docker/src/lib/startup.ts +71 -101
- package/templates/docker/src/lib/tools/__tests__/custom-validation.test.ts +2 -0
- package/templates/docker/src/lib/tools/__tests__/explore-nsjail.test.ts +32 -18
- package/templates/docker/src/lib/tools/__tests__/explore-plugin.test.ts +14 -14
- package/templates/docker/src/lib/tools/__tests__/explore-sidecar.test.ts +5 -3
- package/templates/docker/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
- package/templates/docker/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
- package/templates/docker/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
- package/templates/docker/src/lib/tools/__tests__/python.test.ts +331 -0
- package/templates/docker/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
- package/templates/docker/src/lib/tools/__tests__/registry.test.ts +38 -31
- package/templates/docker/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
- package/templates/docker/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
- package/templates/docker/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
- package/templates/docker/src/lib/tools/__tests__/sql.test.ts +5 -308
- package/templates/docker/src/lib/tools/explore-nsjail.ts +17 -12
- package/templates/docker/src/lib/tools/explore-sidecar.ts +25 -0
- package/templates/docker/src/lib/tools/explore.ts +28 -32
- package/templates/docker/src/lib/tools/python-nsjail.ts +396 -0
- package/templates/docker/src/lib/tools/python-sandbox.ts +476 -0
- package/templates/docker/src/lib/tools/python-sidecar.ts +150 -0
- package/templates/docker/src/lib/tools/python.ts +367 -0
- package/templates/docker/src/lib/tools/registry.ts +49 -22
- package/templates/docker/src/lib/tools/sql.ts +88 -88
- package/templates/docker/src/types/vercel-sandbox.d.ts +7 -0
- package/templates/docker/src/ui/components/admin/admin-layout.tsx +77 -8
- package/templates/docker/src/ui/components/admin/admin-sidebar.tsx +25 -17
- package/templates/docker/src/ui/components/admin/change-password-dialog.tsx +128 -0
- package/templates/docker/src/ui/components/admin/entity-detail.tsx +3 -3
- package/templates/docker/src/ui/components/admin/semantic-file-tree.tsx +159 -0
- package/templates/docker/src/ui/components/atlas-chat.tsx +64 -12
- package/templates/docker/src/ui/components/chart/result-chart.tsx +25 -15
- package/templates/docker/src/ui/components/chat/markdown.tsx +88 -42
- package/templates/docker/src/ui/components/chat/python-result-card.tsx +244 -0
- package/templates/docker/src/ui/components/chat/sql-block.tsx +39 -15
- package/templates/docker/src/ui/components/chat/sql-result-card.tsx +6 -1
- package/templates/docker/src/ui/components/chat/tool-part.tsx +12 -3
- package/templates/docker/src/ui/components/chat/typing-indicator.tsx +5 -2
- package/templates/docker/src/ui/components/conversations/conversation-item.tsx +25 -20
- package/templates/docker/src/ui/context.tsx +1 -1
- package/templates/docker/src/ui/hooks/use-conversations.ts +3 -3
- package/templates/docker/src/ui/hooks/use-dark-mode.ts +17 -10
- package/templates/docker/tsconfig.json +2 -2
- package/templates/nextjs-standalone/.env.example +1 -1
- package/templates/nextjs-standalone/bin/__tests__/plugin-cli.test.ts +9 -9
- package/templates/nextjs-standalone/bin/atlas.ts +108 -44
- package/templates/nextjs-standalone/data/demo-semantic/catalog.yml +51 -27
- package/templates/nextjs-standalone/data/demo-semantic/entities/accounts.yml +95 -103
- package/templates/nextjs-standalone/data/demo-semantic/entities/companies.yml +88 -152
- package/templates/nextjs-standalone/data/demo-semantic/entities/people.yml +82 -95
- package/templates/nextjs-standalone/data/demo-semantic/glossary.yml +104 -8
- package/templates/nextjs-standalone/data/demo-semantic/metrics/accounts.yml +62 -23
- package/templates/nextjs-standalone/data/demo-semantic/metrics/companies.yml +52 -78
- package/templates/nextjs-standalone/docs/deploy.md +2 -39
- package/templates/nextjs-standalone/package.json +11 -2
- package/templates/nextjs-standalone/scripts/migrate-auth.ts +25 -0
- package/templates/nextjs-standalone/scripts/seed-demo.ts +94 -0
- package/templates/nextjs-standalone/semantic/catalog.yml +62 -3
- package/templates/nextjs-standalone/semantic/entities/accounts.yml +162 -0
- package/templates/nextjs-standalone/semantic/entities/companies.yml +143 -0
- package/templates/nextjs-standalone/semantic/entities/people.yml +132 -0
- package/templates/nextjs-standalone/semantic/glossary.yml +116 -4
- package/templates/nextjs-standalone/semantic/metrics/accounts.yml +77 -0
- package/templates/nextjs-standalone/semantic/metrics/companies.yml +63 -0
- package/templates/nextjs-standalone/src/api/__tests__/admin.test.ts +7 -7
- package/templates/nextjs-standalone/src/api/__tests__/health-plugin.test.ts +7 -0
- package/templates/nextjs-standalone/src/api/__tests__/health.test.ts +30 -8
- package/templates/nextjs-standalone/src/api/routes/admin.ts +549 -8
- package/templates/nextjs-standalone/src/api/routes/chat.ts +5 -20
- package/templates/nextjs-standalone/src/api/routes/health.ts +39 -27
- package/templates/nextjs-standalone/src/api/routes/openapi.ts +1329 -74
- package/templates/nextjs-standalone/src/api/routes/query.ts +2 -1
- package/templates/nextjs-standalone/src/api/server.ts +27 -0
- package/templates/nextjs-standalone/src/app/api/[...route]/route.ts +2 -2
- package/templates/nextjs-standalone/src/app/globals.css +13 -12
- package/templates/nextjs-standalone/src/app/layout.tsx +9 -2
- package/templates/nextjs-standalone/src/components/ui/alert-dialog.tsx +196 -0
- package/templates/nextjs-standalone/src/components/ui/badge.tsx +48 -0
- package/templates/nextjs-standalone/src/components/ui/button.tsx +64 -0
- package/templates/nextjs-standalone/src/components/ui/card.tsx +92 -0
- package/templates/nextjs-standalone/src/components/ui/collapsible.tsx +33 -0
- package/templates/nextjs-standalone/src/components/ui/command.tsx +184 -0
- package/templates/nextjs-standalone/src/components/ui/dialog.tsx +158 -0
- package/templates/nextjs-standalone/src/components/ui/dropdown-menu.tsx +257 -0
- package/templates/nextjs-standalone/src/components/ui/input.tsx +21 -0
- package/templates/nextjs-standalone/src/components/ui/scroll-area.tsx +58 -0
- package/templates/nextjs-standalone/src/components/ui/select.tsx +190 -0
- package/templates/nextjs-standalone/src/components/ui/separator.tsx +28 -0
- package/templates/nextjs-standalone/src/components/ui/sheet.tsx +143 -0
- package/templates/nextjs-standalone/src/components/ui/sidebar.tsx +726 -0
- package/templates/nextjs-standalone/src/components/ui/skeleton.tsx +13 -0
- package/templates/nextjs-standalone/src/components/ui/table.tsx +116 -0
- package/templates/nextjs-standalone/src/components/ui/tabs.tsx +91 -0
- package/templates/nextjs-standalone/src/components/ui/toggle-group.tsx +83 -0
- package/templates/nextjs-standalone/src/components/ui/toggle.tsx +47 -0
- package/templates/nextjs-standalone/src/components/ui/tooltip.tsx +57 -0
- package/templates/nextjs-standalone/src/hooks/use-mobile.ts +19 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-cache.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-dialect.test.ts +17 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-health-annotations.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-integration.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/__tests__/config.test.ts +69 -19
- package/templates/nextjs-standalone/src/lib/__tests__/plugin-aware-validation.test.ts +321 -0
- package/templates/nextjs-standalone/src/lib/__tests__/providers.test.ts +32 -1
- package/templates/nextjs-standalone/src/lib/__tests__/startup-actions.test.ts +9 -0
- package/templates/nextjs-standalone/src/lib/__tests__/startup-first-run.test.ts +429 -0
- package/templates/nextjs-standalone/src/lib/__tests__/startup.test.ts +5 -0
- package/templates/nextjs-standalone/src/lib/agent-query.ts +5 -23
- package/templates/nextjs-standalone/src/lib/agent.ts +32 -112
- package/templates/nextjs-standalone/src/lib/auth/__tests__/migrate.test.ts +5 -3
- package/templates/nextjs-standalone/src/lib/auth/middleware.ts +30 -4
- package/templates/nextjs-standalone/src/lib/auth/migrate.ts +97 -0
- package/templates/nextjs-standalone/src/lib/auth/server.ts +12 -1
- package/templates/nextjs-standalone/src/lib/config.ts +37 -39
- package/templates/nextjs-standalone/src/lib/db/__tests__/connection.test.ts +89 -14
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-health.test.ts +1 -18
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -19
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry.test.ts +11 -208
- package/templates/nextjs-standalone/src/lib/db/connection.ts +87 -265
- package/templates/nextjs-standalone/src/lib/db/internal.ts +6 -1
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks-integration.test.ts +3 -1
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks.test.ts +2 -2
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/migrate.test.ts +355 -1
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/registry.test.ts +32 -5
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/wiring.test.ts +228 -14
- package/templates/nextjs-standalone/src/lib/plugins/index.ts +4 -1
- package/templates/nextjs-standalone/src/lib/plugins/migrate.ts +103 -0
- package/templates/nextjs-standalone/src/lib/plugins/registry.ts +12 -6
- package/templates/nextjs-standalone/src/lib/plugins/wiring.ts +113 -4
- package/templates/nextjs-standalone/src/lib/providers.ts +6 -1
- package/templates/nextjs-standalone/src/lib/security.ts +24 -0
- package/templates/nextjs-standalone/src/lib/semantic.ts +2 -0
- package/templates/nextjs-standalone/src/lib/sidecar-types.ts +12 -1
- package/templates/nextjs-standalone/src/lib/startup.ts +71 -101
- package/templates/nextjs-standalone/src/lib/tools/__tests__/custom-validation.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-nsjail.test.ts +32 -18
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-plugin.test.ts +14 -14
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sidecar.test.ts +5 -3
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-nsjail.test.ts +515 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sandbox.test.ts +397 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sidecar.test.ts +365 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python.test.ts +331 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry-actions.test.ts +1 -13
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry.test.ts +38 -31
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-audit.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-ratelimit.test.ts +2 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql.test.ts +5 -308
- package/templates/nextjs-standalone/src/lib/tools/explore-nsjail.ts +17 -12
- package/templates/nextjs-standalone/src/lib/tools/explore-sidecar.ts +25 -0
- package/templates/nextjs-standalone/src/lib/tools/explore.ts +28 -32
- package/templates/nextjs-standalone/src/lib/tools/python-nsjail.ts +396 -0
- package/templates/nextjs-standalone/src/lib/tools/python-sandbox.ts +476 -0
- package/templates/nextjs-standalone/src/lib/tools/python-sidecar.ts +150 -0
- package/templates/nextjs-standalone/src/lib/tools/python.ts +367 -0
- package/templates/nextjs-standalone/src/lib/tools/registry.ts +49 -22
- package/templates/nextjs-standalone/src/lib/tools/sql.ts +88 -88
- package/templates/nextjs-standalone/src/ui/components/admin/admin-layout.tsx +77 -8
- package/templates/nextjs-standalone/src/ui/components/admin/admin-sidebar.tsx +25 -17
- package/templates/nextjs-standalone/src/ui/components/admin/change-password-dialog.tsx +128 -0
- package/templates/nextjs-standalone/src/ui/components/admin/entity-detail.tsx +3 -3
- package/templates/nextjs-standalone/src/ui/components/admin/semantic-file-tree.tsx +159 -0
- package/templates/nextjs-standalone/src/ui/components/atlas-chat.tsx +64 -12
- package/templates/nextjs-standalone/src/ui/components/chart/result-chart.tsx +25 -15
- package/templates/nextjs-standalone/src/ui/components/chat/markdown.tsx +88 -42
- package/templates/nextjs-standalone/src/ui/components/chat/python-result-card.tsx +244 -0
- package/templates/nextjs-standalone/src/ui/components/chat/sql-block.tsx +39 -15
- package/templates/nextjs-standalone/src/ui/components/chat/sql-result-card.tsx +6 -1
- package/templates/nextjs-standalone/src/ui/components/chat/tool-part.tsx +12 -3
- package/templates/nextjs-standalone/src/ui/components/chat/typing-indicator.tsx +5 -2
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-item.tsx +25 -20
- package/templates/nextjs-standalone/src/ui/context.tsx +1 -1
- package/templates/nextjs-standalone/src/ui/hooks/use-conversations.ts +3 -3
- package/templates/nextjs-standalone/src/ui/hooks/use-dark-mode.ts +17 -10
- package/templates/nextjs-standalone/tsconfig.json +0 -1
- package/templates/nextjs-standalone/vercel.json +4 -1
- package/templates/docker/render.yaml +0 -34
- package/templates/docker/semantic/entities/.gitkeep +0 -0
- package/templates/docker/semantic/metrics/.gitkeep +0 -0
- package/templates/docker/src/lib/db/__tests__/duckdb.test.ts +0 -141
- package/templates/docker/src/lib/db/__tests__/salesforce.test.ts +0 -339
- package/templates/docker/src/lib/db/__tests__/snowflake.test.ts +0 -217
- package/templates/docker/src/lib/db/duckdb.ts +0 -122
- package/templates/docker/src/lib/db/salesforce.ts +0 -342
- package/templates/docker/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
- package/templates/docker/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
- package/templates/docker/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
- package/templates/docker/src/lib/tools/salesforce.ts +0 -138
- package/templates/docker/src/lib/tools/soql-validation.ts +0 -172
- package/templates/nextjs-standalone/semantic/entities/.gitkeep +0 -0
- package/templates/nextjs-standalone/semantic/metrics/.gitkeep +0 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/duckdb.test.ts +0 -141
- package/templates/nextjs-standalone/src/lib/db/__tests__/salesforce.test.ts +0 -339
- package/templates/nextjs-standalone/src/lib/db/__tests__/snowflake.test.ts +0 -217
- package/templates/nextjs-standalone/src/lib/db/duckdb.ts +0 -122
- package/templates/nextjs-standalone/src/lib/db/salesforce.ts +0 -342
- package/templates/nextjs-standalone/src/lib/tools/__tests__/salesforce-tool.test.ts +0 -154
- package/templates/nextjs-standalone/src/lib/tools/__tests__/soql-validation.test.ts +0 -303
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-duckdb.test.ts +0 -233
- package/templates/nextjs-standalone/src/lib/tools/salesforce.ts +0 -138
- package/templates/nextjs-standalone/src/lib/tools/soql-validation.ts +0 -172
|
@@ -1,28 +1,95 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for detectDBType from connection.ts.
|
|
2
|
+
* Tests for detectDBType and resolveDatasourceUrl from connection.ts.
|
|
3
3
|
*
|
|
4
4
|
* sql.test.ts registers a global mock.module for @/lib/db/connection which
|
|
5
5
|
* persists across bun's test runner. To test the real implementation, we
|
|
6
6
|
* import the source file via a cache-busting query string that bypasses the mock.
|
|
7
7
|
*/
|
|
8
|
-
import { describe, it, expect, beforeEach } from "bun:test";
|
|
8
|
+
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
|
|
9
9
|
import { resolve } from "path";
|
|
10
10
|
|
|
11
11
|
const modulePath = resolve(__dirname, "../connection.ts");
|
|
12
12
|
const mod = await import(`${modulePath}?t=${Date.now()}`);
|
|
13
|
-
const detectDBType = mod.detectDBType as (url?: string) => "postgres" | "mysql"
|
|
13
|
+
const detectDBType = mod.detectDBType as (url?: string) => "postgres" | "mysql";
|
|
14
|
+
const resolveDatasourceUrl = mod.resolveDatasourceUrl as () => string | undefined;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
// Env vars touched by tests — save/restore
|
|
17
|
+
const MANAGED_VARS = [
|
|
18
|
+
"ATLAS_DATASOURCE_URL",
|
|
19
|
+
"ATLAS_DEMO_DATA",
|
|
20
|
+
"DATABASE_URL",
|
|
21
|
+
"DATABASE_URL_UNPOOLED",
|
|
22
|
+
] as const;
|
|
23
|
+
const savedEnv: Record<string, string | undefined> = {};
|
|
24
|
+
|
|
25
|
+
function saveEnv() {
|
|
26
|
+
for (const key of MANAGED_VARS) savedEnv[key] = process.env[key];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function restoreEnv() {
|
|
30
|
+
for (const key of MANAGED_VARS) {
|
|
31
|
+
if (savedEnv[key] !== undefined) process.env[key] = savedEnv[key];
|
|
32
|
+
else delete process.env[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("resolveDatasourceUrl", () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
saveEnv();
|
|
39
|
+
for (const key of MANAGED_VARS) delete process.env[key];
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(restoreEnv);
|
|
43
|
+
|
|
44
|
+
it("returns ATLAS_DATASOURCE_URL when set", () => {
|
|
45
|
+
process.env.ATLAS_DATASOURCE_URL = "postgresql://explicit@localhost/db";
|
|
46
|
+
expect(resolveDatasourceUrl()).toBe("postgresql://explicit@localhost/db");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("returns ATLAS_DATASOURCE_URL even when ATLAS_DEMO_DATA=true", () => {
|
|
50
|
+
process.env.ATLAS_DATASOURCE_URL = "postgresql://explicit@localhost/db";
|
|
51
|
+
process.env.ATLAS_DEMO_DATA = "true";
|
|
52
|
+
process.env.DATABASE_URL = "postgresql://fallback@localhost/db";
|
|
53
|
+
expect(resolveDatasourceUrl()).toBe("postgresql://explicit@localhost/db");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("returns DATABASE_URL_UNPOOLED when ATLAS_DEMO_DATA=true and both fallbacks set", () => {
|
|
57
|
+
process.env.ATLAS_DEMO_DATA = "true";
|
|
58
|
+
process.env.DATABASE_URL_UNPOOLED = "postgresql://unpooled@localhost/db";
|
|
59
|
+
process.env.DATABASE_URL = "postgresql://pooled@localhost/db";
|
|
60
|
+
expect(resolveDatasourceUrl()).toBe("postgresql://unpooled@localhost/db");
|
|
61
|
+
});
|
|
17
62
|
|
|
63
|
+
it("returns DATABASE_URL when ATLAS_DEMO_DATA=true and only DATABASE_URL set", () => {
|
|
64
|
+
process.env.ATLAS_DEMO_DATA = "true";
|
|
65
|
+
process.env.DATABASE_URL = "postgresql://pooled@localhost/db";
|
|
66
|
+
expect(resolveDatasourceUrl()).toBe("postgresql://pooled@localhost/db");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("returns undefined when nothing is configured", () => {
|
|
70
|
+
expect(resolveDatasourceUrl()).toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("returns undefined when ATLAS_DEMO_DATA is not exactly 'true'", () => {
|
|
74
|
+
process.env.ATLAS_DEMO_DATA = "TRUE";
|
|
75
|
+
process.env.DATABASE_URL = "postgresql://fallback@localhost/db";
|
|
76
|
+
expect(resolveDatasourceUrl()).toBeUndefined();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("returns undefined when ATLAS_DEMO_DATA=true but no DATABASE_URL vars set", () => {
|
|
80
|
+
process.env.ATLAS_DEMO_DATA = "true";
|
|
81
|
+
expect(resolveDatasourceUrl()).toBeUndefined();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("detectDBType", () => {
|
|
18
86
|
beforeEach(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} else {
|
|
22
|
-
delete process.env.ATLAS_DATASOURCE_URL;
|
|
23
|
-
}
|
|
87
|
+
saveEnv();
|
|
88
|
+
for (const key of MANAGED_VARS) delete process.env[key];
|
|
24
89
|
});
|
|
25
90
|
|
|
91
|
+
afterEach(restoreEnv);
|
|
92
|
+
|
|
26
93
|
it("detects postgresql:// as postgres", () => {
|
|
27
94
|
expect(detectDBType("postgresql://user:pass@localhost:5432/db")).toBe("postgres");
|
|
28
95
|
});
|
|
@@ -53,12 +120,20 @@ describe("detectDBType", () => {
|
|
|
53
120
|
expect(() => detectDBType("")).toThrow("No database URL provided");
|
|
54
121
|
});
|
|
55
122
|
|
|
56
|
-
it("
|
|
57
|
-
expect(detectDBType("duckdb://:memory:")).
|
|
123
|
+
it("throws for non-core adapter URLs with plugin migration hint", () => {
|
|
124
|
+
expect(() => detectDBType("duckdb://:memory:")).toThrow("now a plugin");
|
|
125
|
+
expect(() => detectDBType("clickhouse://localhost:8123/default")).toThrow("now a plugin");
|
|
126
|
+
expect(() => detectDBType("snowflake://user:pass@account/db")).toThrow("now a plugin");
|
|
127
|
+
expect(() => detectDBType("salesforce://user:pass@login.salesforce.com")).toThrow("now a plugin");
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("suggests correct plugin name for TLS scheme variants", () => {
|
|
131
|
+
expect(() => detectDBType("clickhouses://localhost:8443/default")).toThrow("@useatlas/clickhouse");
|
|
58
132
|
});
|
|
59
133
|
|
|
60
|
-
it("
|
|
61
|
-
expect(detectDBType("duckdb
|
|
134
|
+
it("includes the detected scheme in the error message", () => {
|
|
135
|
+
expect(() => detectDBType("duckdb://:memory:")).toThrow("duckdb://");
|
|
136
|
+
expect(() => detectDBType("clickhouse://localhost")).toThrow("clickhouse://");
|
|
62
137
|
});
|
|
63
138
|
|
|
64
139
|
it("unrecognized URL throws an error", () => {
|
|
@@ -24,24 +24,7 @@ mock.module("mysql2/promise", () => ({
|
|
|
24
24
|
}),
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
-
mock
|
|
28
|
-
DuckDBInstance: {
|
|
29
|
-
async create() {
|
|
30
|
-
return {
|
|
31
|
-
async connect() {
|
|
32
|
-
return {
|
|
33
|
-
async runAndReadAll() {
|
|
34
|
-
return { columnNames: () => [], getRowObjects: () => [] };
|
|
35
|
-
},
|
|
36
|
-
async run() {},
|
|
37
|
-
async close() {},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
async close() {},
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
}));
|
|
27
|
+
// Note: DuckDB mock removed — adapter is now a plugin.
|
|
45
28
|
|
|
46
29
|
// Cache-busting import
|
|
47
30
|
const connModPath = resolve(__dirname, "../connection.ts");
|
|
@@ -26,25 +26,6 @@ mock.module("mysql2/promise", () => ({
|
|
|
26
26
|
}),
|
|
27
27
|
}));
|
|
28
28
|
|
|
29
|
-
mock.module("@duckdb/node-api", () => ({
|
|
30
|
-
DuckDBInstance: {
|
|
31
|
-
async create() {
|
|
32
|
-
return {
|
|
33
|
-
async connect() {
|
|
34
|
-
return {
|
|
35
|
-
async runAndReadAll() {
|
|
36
|
-
return { columnNames: () => [], getRowObjects: () => [] };
|
|
37
|
-
},
|
|
38
|
-
async run() {},
|
|
39
|
-
async close() {},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
async close() {},
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
29
|
// Cache-busting import
|
|
49
30
|
const connModPath = resolve(__dirname, "../connection.ts");
|
|
50
31
|
const connMod = await import(`${connModPath}?t=${Date.now()}`);
|
|
@@ -40,70 +40,8 @@ mock.module("mysql2/promise", () => ({
|
|
|
40
40
|
}),
|
|
41
41
|
}));
|
|
42
42
|
|
|
43
|
-
// ClickHouse
|
|
44
|
-
|
|
45
|
-
let lastQueryOpts: Record<string, unknown> | null = null;
|
|
46
|
-
let mockJsonResponse: { meta: { name: string }[]; data: Record<string, unknown>[] } = {
|
|
47
|
-
meta: [],
|
|
48
|
-
data: [],
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
mock.module("@clickhouse/client", () => ({
|
|
52
|
-
createClient: (opts: Record<string, unknown>) => {
|
|
53
|
-
lastCreateClientOpts = opts;
|
|
54
|
-
return {
|
|
55
|
-
async query(qOpts: Record<string, unknown>) {
|
|
56
|
-
lastQueryOpts = qOpts;
|
|
57
|
-
return {
|
|
58
|
-
async json() {
|
|
59
|
-
return mockJsonResponse;
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
async close() {},
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
}));
|
|
67
|
-
|
|
68
|
-
mock.module("@duckdb/node-api", () => ({
|
|
69
|
-
DuckDBInstance: {
|
|
70
|
-
async create() {
|
|
71
|
-
return {
|
|
72
|
-
async connect() {
|
|
73
|
-
return {
|
|
74
|
-
async runAndReadAll() {
|
|
75
|
-
return {
|
|
76
|
-
columnNames: () => [],
|
|
77
|
-
getRowObjects: () => [],
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
async run() {},
|
|
81
|
-
async close() {},
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
async close() {},
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}));
|
|
89
|
-
|
|
90
|
-
mock.module("snowflake-sdk", () => ({
|
|
91
|
-
configure: () => {},
|
|
92
|
-
createPool: () => ({
|
|
93
|
-
use: async (fn: (conn: unknown) => Promise<unknown>) => {
|
|
94
|
-
const mockConn = {
|
|
95
|
-
execute: (opts: { sqlText: string; complete: (err: null, stmt: unknown, rows: unknown[]) => void }) => {
|
|
96
|
-
opts.complete(null, {
|
|
97
|
-
getColumns: () => [],
|
|
98
|
-
}, []);
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
return fn(mockConn);
|
|
102
|
-
},
|
|
103
|
-
drain: async () => {},
|
|
104
|
-
clear: async () => {},
|
|
105
|
-
}),
|
|
106
|
-
}));
|
|
43
|
+
// Note: ClickHouse, DuckDB, Snowflake adapter mocks removed — those
|
|
44
|
+
// adapters are now plugins. See plugins/{clickhouse,duckdb,snowflake}-datasource/.
|
|
107
45
|
|
|
108
46
|
// Cache-busting import to get a fresh module instance
|
|
109
47
|
const connModPath = resolve(__dirname, "../connection.ts");
|
|
@@ -113,7 +51,6 @@ const ConnectionRegistry = connMod.ConnectionRegistry as typeof import("../conne
|
|
|
113
51
|
const connections = connMod.connections as import("../connection").ConnectionRegistry;
|
|
114
52
|
const getDB = connMod.getDB as typeof import("../connection").getDB;
|
|
115
53
|
const detectDBType = connMod.detectDBType as typeof import("../connection").detectDBType;
|
|
116
|
-
const rewriteClickHouseUrl = connMod.rewriteClickHouseUrl as typeof import("../connection").rewriteClickHouseUrl;
|
|
117
54
|
|
|
118
55
|
// Import semantic module with cache-busting too
|
|
119
56
|
const semModPath = resolve(__dirname, "../../semantic.ts");
|
|
@@ -129,9 +66,6 @@ describe("ConnectionRegistry", () => {
|
|
|
129
66
|
connections._reset();
|
|
130
67
|
delete process.env.ATLAS_DATASOURCE_URL;
|
|
131
68
|
delete process.env.ATLAS_SCHEMA;
|
|
132
|
-
lastCreateClientOpts = null;
|
|
133
|
-
lastQueryOpts = null;
|
|
134
|
-
mockJsonResponse = { meta: [], data: [] };
|
|
135
69
|
});
|
|
136
70
|
|
|
137
71
|
afterEach(() => {
|
|
@@ -284,28 +218,10 @@ describe("ConnectionRegistry", () => {
|
|
|
284
218
|
expect(connections.get("my")).toBeDefined();
|
|
285
219
|
});
|
|
286
220
|
|
|
287
|
-
it("
|
|
288
|
-
connections.register("ch", {
|
|
289
|
-
|
|
290
|
-
});
|
|
291
|
-
const conn = connections.get("ch");
|
|
292
|
-
expect(conn).toBeDefined();
|
|
293
|
-
expect(conn.query).toBeFunction();
|
|
294
|
-
expect(conn.close).toBeFunction();
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it("creates snowflake connection for snowflake:// URLs", () => {
|
|
298
|
-
connections.register("sf", {
|
|
299
|
-
url: "snowflake://user:pass@account123/mydb/myschema?warehouse=WH",
|
|
300
|
-
});
|
|
301
|
-
expect(connections.get("sf")).toBeDefined();
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it("creates duckdb connection for duckdb:// URLs", () => {
|
|
305
|
-
connections.register("dk", {
|
|
306
|
-
url: "duckdb://:memory:",
|
|
307
|
-
});
|
|
308
|
-
expect(connections.get("dk")).toBeDefined();
|
|
221
|
+
it("throws for non-core adapter URLs with plugin migration hint", () => {
|
|
222
|
+
expect(() => connections.register("ch", { url: "clickhouse://user:pass@localhost:8123/default" })).toThrow("plugin");
|
|
223
|
+
expect(() => connections.register("sf", { url: "snowflake://user:pass@account123/mydb" })).toThrow("plugin");
|
|
224
|
+
expect(() => connections.register("dk", { url: "duckdb://:memory:" })).toThrow("plugin");
|
|
309
225
|
});
|
|
310
226
|
|
|
311
227
|
it("throws for unrecognized URL scheme", () => {
|
|
@@ -335,21 +251,12 @@ describe("ConnectionRegistry", () => {
|
|
|
335
251
|
expect(connections.getDBType("my")).toBe("mysql");
|
|
336
252
|
});
|
|
337
253
|
|
|
338
|
-
it("returns correct type for
|
|
339
|
-
|
|
254
|
+
it("returns correct type for plugin-registered connection", async () => {
|
|
255
|
+
const conn = { async query() { return { columns: [], rows: [] }; }, async close() {} };
|
|
256
|
+
await connections.registerDirect("ch", conn, "clickhouse");
|
|
340
257
|
expect(connections.getDBType("ch")).toBe("clickhouse");
|
|
341
258
|
});
|
|
342
259
|
|
|
343
|
-
it("returns correct type for snowflake connection", () => {
|
|
344
|
-
connections.register("sf", { url: "snowflake://user:pass@account123/mydb/myschema?warehouse=WH" });
|
|
345
|
-
expect(connections.getDBType("sf")).toBe("snowflake");
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
it("returns correct type for duckdb connection", () => {
|
|
349
|
-
connections.register("dk", { url: "duckdb://:memory:" });
|
|
350
|
-
expect(connections.getDBType("dk")).toBe("duckdb");
|
|
351
|
-
});
|
|
352
|
-
|
|
353
260
|
it("throws for unregistered connection ID", () => {
|
|
354
261
|
expect(() => connections.getDBType("nonexistent")).toThrow(
|
|
355
262
|
'Connection "nonexistent" is not registered.'
|
|
@@ -426,10 +333,6 @@ describe("ConnectionRegistry", () => {
|
|
|
426
333
|
});
|
|
427
334
|
|
|
428
335
|
describe("detectDBType", () => {
|
|
429
|
-
it("returns 'clickhouse' for clickhouse:// URLs", () => {
|
|
430
|
-
expect(detectDBType("clickhouse://user:pass@localhost:8123/default")).toBe("clickhouse");
|
|
431
|
-
});
|
|
432
|
-
|
|
433
336
|
it("returns 'postgres' for postgresql:// URLs", () => {
|
|
434
337
|
expect(detectDBType("postgresql://user:pass@localhost:5432/db")).toBe("postgres");
|
|
435
338
|
});
|
|
@@ -438,8 +341,8 @@ describe("ConnectionRegistry", () => {
|
|
|
438
341
|
expect(detectDBType("mysql://user:pass@localhost:3306/db")).toBe("mysql");
|
|
439
342
|
});
|
|
440
343
|
|
|
441
|
-
it("
|
|
442
|
-
expect(detectDBType("
|
|
344
|
+
it("throws for non-core URL schemes with plugin suggestion", () => {
|
|
345
|
+
expect(() => detectDBType("clickhouse://user:pass@localhost:8123/default")).toThrow("plugin");
|
|
443
346
|
});
|
|
444
347
|
|
|
445
348
|
it("throws for unsupported URL scheme", () => {
|
|
@@ -447,106 +350,6 @@ describe("ConnectionRegistry", () => {
|
|
|
447
350
|
});
|
|
448
351
|
});
|
|
449
352
|
|
|
450
|
-
describe("ClickHouse adapter", () => {
|
|
451
|
-
it("passes readonly: 1 and max_execution_time in query settings", async () => {
|
|
452
|
-
connections.register("ch", {
|
|
453
|
-
url: "clickhouse://user:pass@localhost:8123/default",
|
|
454
|
-
});
|
|
455
|
-
const conn = connections.get("ch");
|
|
456
|
-
await conn.query("SELECT 1", 30000);
|
|
457
|
-
|
|
458
|
-
expect(lastQueryOpts).toBeDefined();
|
|
459
|
-
const settings = (lastQueryOpts as Record<string, unknown>)
|
|
460
|
-
.clickhouse_settings as Record<string, unknown>;
|
|
461
|
-
expect(settings.readonly).toBe(1);
|
|
462
|
-
expect(settings.max_execution_time).toBe(Math.ceil(30000 / 1000));
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
it("computes max_execution_time correctly from timeout", async () => {
|
|
466
|
-
connections.register("ch", {
|
|
467
|
-
url: "clickhouse://user:pass@localhost:8123/default",
|
|
468
|
-
});
|
|
469
|
-
const conn = connections.get("ch");
|
|
470
|
-
// 7500ms → ceil(7.5) = 8 seconds
|
|
471
|
-
await conn.query("SELECT 1", 7500);
|
|
472
|
-
|
|
473
|
-
const settings = (lastQueryOpts as Record<string, unknown>)
|
|
474
|
-
.clickhouse_settings as Record<string, unknown>;
|
|
475
|
-
expect(settings.max_execution_time).toBe(8);
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
it("rewrites clickhouse:// URL to http:// for createClient", () => {
|
|
479
|
-
connections.register("ch", {
|
|
480
|
-
url: "clickhouse://user:pass@host:8123/db",
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
expect(lastCreateClientOpts).toBeDefined();
|
|
484
|
-
expect((lastCreateClientOpts as Record<string, unknown>).url).toBe(
|
|
485
|
-
"http://user:pass@host:8123/db"
|
|
486
|
-
);
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
it("rewrites clickhouses:// URL to https:// for createClient", () => {
|
|
490
|
-
connections.register("chs", {
|
|
491
|
-
url: "clickhouses://user:pass@host:8443/db",
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
expect(lastCreateClientOpts).toBeDefined();
|
|
495
|
-
expect((lastCreateClientOpts as Record<string, unknown>).url).toBe(
|
|
496
|
-
"https://user:pass@host:8443/db"
|
|
497
|
-
);
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
it("extracts columns and rows from ClickHouse JSON response", async () => {
|
|
501
|
-
mockJsonResponse = {
|
|
502
|
-
meta: [{ name: "id" }, { name: "name" }],
|
|
503
|
-
data: [{ id: 1, name: "test" }],
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
connections.register("ch", {
|
|
507
|
-
url: "clickhouse://user:pass@localhost:8123/default",
|
|
508
|
-
});
|
|
509
|
-
const conn = connections.get("ch");
|
|
510
|
-
const result = await conn.query("SELECT id, name FROM companies");
|
|
511
|
-
|
|
512
|
-
expect(result.columns).toEqual(["id", "name"]);
|
|
513
|
-
expect(result.rows).toEqual([{ id: 1, name: "test" }]);
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
it("describe() reports dbType as 'clickhouse' with description", () => {
|
|
517
|
-
connections.register("ch", {
|
|
518
|
-
url: "clickhouse://user:pass@localhost:8123/default",
|
|
519
|
-
description: "Analytics warehouse",
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
const meta = connections.describe();
|
|
523
|
-
const chMeta = meta.find((m) => m.id === "ch");
|
|
524
|
-
expect(chMeta).toBeDefined();
|
|
525
|
-
expect(chMeta!.dbType).toBe("clickhouse");
|
|
526
|
-
expect(chMeta!.description).toBe("Analytics warehouse");
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
describe("rewriteClickHouseUrl", () => {
|
|
531
|
-
it("rewrites clickhouse:// to http://", () => {
|
|
532
|
-
expect(rewriteClickHouseUrl("clickhouse://user:pass@host:8123/db")).toBe(
|
|
533
|
-
"http://user:pass@host:8123/db"
|
|
534
|
-
);
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
it("rewrites clickhouses:// to https://", () => {
|
|
538
|
-
expect(rewriteClickHouseUrl("clickhouses://user:pass@host:8443/db")).toBe(
|
|
539
|
-
"https://user:pass@host:8443/db"
|
|
540
|
-
);
|
|
541
|
-
});
|
|
542
|
-
});
|
|
543
|
-
|
|
544
|
-
describe("detectDBType — ClickHouse schemes", () => {
|
|
545
|
-
it("returns 'clickhouse' for clickhouses:// URLs", () => {
|
|
546
|
-
expect(detectDBType("clickhouses://user:pass@host:8443/db")).toBe("clickhouse");
|
|
547
|
-
});
|
|
548
|
-
});
|
|
549
|
-
|
|
550
353
|
describe("constructor creates independent instances", () => {
|
|
551
354
|
it("new ConnectionRegistry is independent", () => {
|
|
552
355
|
const reg = new ConnectionRegistry();
|