fix lint build and tests

This commit is contained in:
dal 2025-09-20 15:22:28 -06:00
parent 189dedd32e
commit 0e89b502ea
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
26 changed files with 116 additions and 299 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { sql } from 'drizzle-orm';
import { getTableName } from 'drizzle-orm';
import { getTableConfig } from 'drizzle-orm/pg-core';

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { eq, sql } from 'drizzle-orm';
import { getTableName } from 'drizzle-orm';
import { db } from '../src/connection';
@ -17,7 +17,7 @@ function getAllTables(): Record<string, any> {
for (const [key, value] of Object.entries(schema)) {
if (value && typeof value === 'object' && Symbol.for('drizzle:IsDrizzleTable') in value) {
try {
const tableName = getTableName(value);
const _tableName = getTableName(value);
tables[key] = value;
} catch {
// Not a table, skip
@ -203,9 +203,9 @@ async function seed() {
const seedData: Record<string, any[]> = {};
// Load auth data from files (but we'll use hardcoded instead)
const authUsers = await loadJsonFile(path.join(dataDir, 'auth.users.json'));
const authIdentities = await loadJsonFile(path.join(dataDir, 'auth.identities.json'));
const vaultSecrets = await loadJsonFile(path.join(dataDir, 'vault.secrets.json'));
const _authUsers = await loadJsonFile(path.join(dataDir, 'auth.users.json'));
const _authIdentities = await loadJsonFile(path.join(dataDir, 'auth.identities.json'));
const _vaultSecrets = await loadJsonFile(path.join(dataDir, 'vault.secrets.json'));
// Load public schema data
for (const tableName of tableOrder) {
@ -220,7 +220,7 @@ async function seed() {
console.log('=== Upserting seed data (no deletion needed) ===\n');
// Generate auth users for all public users in the seed data
const publicUsers = seedData['users'] || [];
const publicUsers = seedData.users || [];
const authUsers = publicUsers.map(generateAuthUser);
const authIdentities = publicUsers.map(generateAuthIdentity);
@ -294,7 +294,7 @@ async function seed() {
}
// After all data is inserted, create vault secrets for data sources
const dataSources = seedData['dataSources'] || [];
const dataSources = seedData.dataSources || [];
if (dataSources.length > 0) {
console.log('\n=== Creating vault secrets for data sources ===\n');
for (const dataSource of dataSources) {
@ -307,7 +307,7 @@ async function seed() {
DELETE FROM vault.secrets WHERE name = ${dataSource.id}
`);
console.log(`Deleted existing vault secret for ${dataSource.name}`);
} catch (deleteError) {
} catch (_deleteError) {
// It's fine if the delete fails, it might not exist
}
@ -323,11 +323,13 @@ async function seed() {
if (secretId) {
// Update the data source with the new secret ID
console.log(`Updating data source ${dataSource.name} with new secret ID: ${secretId}`);
console.log(
`Updating data source ${dataSource.name} with new secret ID: ${secretId}`
);
await tx
.update(tables['dataSources'])
.update(tables.dataSources)
.set({ secretId: secretId })
.where(eq(tables['dataSources'].id, dataSource.id));
.where(eq(tables.dataSources.id, dataSource.id));
console.log(`Successfully linked vault secret to data source ${dataSource.name}`);
}
} catch (vaultError: any) {
@ -343,8 +345,8 @@ async function seed() {
// Show summary
console.log('\nSummary:');
const publicUserCount = (seedData['users'] || []).length;
const dataSourceCount = (seedData['dataSources'] || []).length;
const publicUserCount = (seedData.users || []).length;
const dataSourceCount = (seedData.dataSources || []).length;
const totalRecords =
Object.values(seedData).reduce((sum, data) => sum + data.length, 0) + publicUserCount * 2; // x2 for auth users + identities
console.log(`Total records upserted: ${totalRecords}`);
@ -381,7 +383,7 @@ if (isDryRun) {
console.log('Seed operation plan:\n');
console.log('Tables will be seeded in this order:');
if (metadata && metadata.tables) {
if (metadata?.tables) {
metadata.tables.forEach((table: any, index: number) => {
const deps =
table.dependencies?.length > 0 ? ` (depends on: ${table.dependencies.join(', ')})` : '';

View File

@ -15,17 +15,12 @@
{
"name": "apiKeys",
"recordCount": 1,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
},
{
"name": "assetPermissions",
"recordCount": 6,
"dependencies": [
"users"
]
"dependencies": ["users"]
},
{
"name": "assetSearch",
@ -35,134 +30,87 @@
{
"name": "chats",
"recordCount": 3,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
},
{
"name": "dataSources",
"recordCount": 1,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
},
{
"name": "datasetGroups",
"recordCount": 2,
"dependencies": [
"organizations"
]
"dependencies": ["organizations"]
},
{
"name": "datasetGroupsPermissions",
"recordCount": 1,
"dependencies": [
"datasetGroups",
"organizations"
]
"dependencies": ["datasetGroups", "organizations"]
},
{
"name": "datasets",
"recordCount": 102,
"dependencies": [
"dataSources",
"organizations",
"users"
]
"dependencies": ["dataSources", "organizations", "users"]
},
{
"name": "datasetPermissions",
"recordCount": 4,
"dependencies": [
"organizations",
"datasets"
]
"dependencies": ["organizations", "datasets"]
},
{
"name": "datasetsToDatasetGroups",
"recordCount": 18,
"dependencies": [
"datasets",
"datasetGroups"
]
"dependencies": ["datasets", "datasetGroups"]
},
{
"name": "permissionGroups",
"recordCount": 3,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
},
{
"name": "docs",
"recordCount": 1,
"dependencies": [
"organizations"
]
"dependencies": ["organizations"]
},
{
"name": "messages",
"recordCount": 3,
"dependencies": [
"chats",
"users"
]
"dependencies": ["chats", "users"]
},
{
"name": "messagesToFiles",
"recordCount": 2,
"dependencies": [
"messages"
]
"dependencies": ["messages"]
},
{
"name": "metricFiles",
"recordCount": 2,
"dependencies": [
"users",
"dataSources"
]
"dependencies": ["users", "dataSources"]
},
{
"name": "permissionGroupsToIdentities",
"recordCount": 5,
"dependencies": [
"users"
]
"dependencies": ["users"]
},
{
"name": "teams",
"recordCount": 2,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
},
{
"name": "teamsToUsers",
"recordCount": 2,
"dependencies": [
"teams",
"users"
]
"dependencies": ["teams", "users"]
},
{
"name": "textSearch",
"recordCount": 58,
"dependencies": [
"organizations"
]
"dependencies": ["organizations"]
},
{
"name": "usersToOrganizations",
"recordCount": 6,
"dependencies": [
"organizations",
"users"
]
"dependencies": ["organizations", "users"]
}
],
"tableOrder": [
@ -206,140 +154,43 @@
"usersToOrganizations"
],
"dependencies": {
"apiKeys": [
"organizations",
"users"
],
"assetPermissions": [
"users"
],
"apiKeys": ["organizations", "users"],
"assetPermissions": ["users"],
"assetSearch": [],
"chats": [
"organizations",
"users"
],
"collections": [
"organizations",
"users"
],
"collectionsToAssets": [
"users"
],
"dashboardFiles": [
"users"
],
"dataSources": [
"organizations",
"users"
],
"datasetGroups": [
"organizations"
],
"datasetGroupsPermissions": [
"datasetGroups",
"organizations"
],
"datasetPermissions": [
"organizations",
"datasets"
],
"datasets": [
"dataSources",
"organizations",
"users"
],
"datasetsToDatasetGroups": [
"datasets",
"datasetGroups"
],
"datasetsToPermissionGroups": [
"datasets",
"permissionGroups"
],
"docs": [
"organizations"
],
"githubIntegrations": [
"organizations",
"users"
],
"messages": [
"chats",
"users"
],
"messagesToFiles": [
"messages"
],
"messagesToSlackMessages": [
"messages",
"slackMessageTracking"
],
"metricFiles": [
"users",
"dataSources"
],
"metricFilesToDashboardFiles": [
"metricFiles",
"dashboardFiles",
"users"
],
"metricFilesToDatasets": [
"metricFiles",
"datasets"
],
"metricFilesToReportFiles": [
"metricFiles",
"reportFiles",
"users"
],
"chats": ["organizations", "users"],
"collections": ["organizations", "users"],
"collectionsToAssets": ["users"],
"dashboardFiles": ["users"],
"dataSources": ["organizations", "users"],
"datasetGroups": ["organizations"],
"datasetGroupsPermissions": ["datasetGroups", "organizations"],
"datasetPermissions": ["organizations", "datasets"],
"datasets": ["dataSources", "organizations", "users"],
"datasetsToDatasetGroups": ["datasets", "datasetGroups"],
"datasetsToPermissionGroups": ["datasets", "permissionGroups"],
"docs": ["organizations"],
"githubIntegrations": ["organizations", "users"],
"messages": ["chats", "users"],
"messagesToFiles": ["messages"],
"messagesToSlackMessages": ["messages", "slackMessageTracking"],
"metricFiles": ["users", "dataSources"],
"metricFilesToDashboardFiles": ["metricFiles", "dashboardFiles", "users"],
"metricFilesToDatasets": ["metricFiles", "datasets"],
"metricFilesToReportFiles": ["metricFiles", "reportFiles", "users"],
"organizations": [],
"permissionGroups": [
"organizations",
"users"
],
"permissionGroupsToIdentities": [
"users"
],
"permissionGroupsToUsers": [
"permissionGroups",
"users"
],
"reportFiles": [
"users",
"organizations"
],
"s3Integrations": [
"organizations"
],
"shortcuts": [
"users",
"organizations"
],
"slackIntegrations": [
"organizations",
"users"
],
"slackMessageTracking": [
"slackIntegrations"
],
"teams": [
"organizations",
"users"
],
"teamsToUsers": [
"teams",
"users"
],
"textSearch": [
"organizations"
],
"userFavorites": [
"users"
],
"permissionGroups": ["organizations", "users"],
"permissionGroupsToIdentities": ["users"],
"permissionGroupsToUsers": ["permissionGroups", "users"],
"reportFiles": ["users", "organizations"],
"s3Integrations": ["organizations"],
"shortcuts": ["users", "organizations"],
"slackIntegrations": ["organizations", "users"],
"slackMessageTracking": ["slackIntegrations"],
"teams": ["organizations", "users"],
"teamsToUsers": ["teams", "users"],
"textSearch": ["organizations"],
"userFavorites": ["users"],
"users": [],
"usersToOrganizations": [
"organizations",
"users"
]
"usersToOrganizations": ["organizations", "users"]
}
}

View File

@ -43,9 +43,7 @@
},
"title": "Broke down your request",
"status": "completed",
"file_ids": [
"todos-1758311476502-hd3fotv7z1m"
],
"file_ids": ["todos-1758311476502-hd3fotv7z1m"],
"secondary_title": "3.9 seconds"
},
{
@ -73,9 +71,7 @@
},
"title": "Ran 2 validation queries",
"status": "completed",
"file_ids": [
"sql-toolu_01Q5bAwXiG9nGmMN9D1gJtzm"
],
"file_ids": ["sql-toolu_01Q5bAwXiG9nGmMN9D1gJtzm"],
"secondary_title": "2.5 seconds"
},
{
@ -103,9 +99,7 @@
},
"title": "Ran 2 validation queries, 1 failed",
"status": "failed",
"file_ids": [
"sql-toolu_01NFn7mND7tK8UQg16cH27uq"
],
"file_ids": ["sql-toolu_01NFn7mND7tK8UQg16cH27uq"],
"secondary_title": "4.5 seconds"
},
{
@ -133,9 +127,7 @@
},
"title": "Ran 1 validation query",
"status": "completed",
"file_ids": [
"sql-toolu_01SkTSCXsVqEbwAZhgYit3r6"
],
"file_ids": ["sql-toolu_01SkTSCXsVqEbwAZhgYit3r6"],
"secondary_title": "3.0 seconds"
},
{
@ -163,9 +155,7 @@
},
"title": "Created 1 metric_file",
"status": "completed",
"file_ids": [
"8005c5dd-b5fe-4378-b6e4-781167a66faa"
],
"file_ids": ["8005c5dd-b5fe-4378-b6e4-781167a66faa"],
"secondary_title": "8.5 seconds"
}
],
@ -522,9 +512,7 @@
},
"title": "Broke down your request",
"status": "completed",
"file_ids": [
"todos-1758316028374-sy337pwvhj"
],
"file_ids": ["todos-1758316028374-sy337pwvhj"],
"secondary_title": "2.6 seconds"
},
{
@ -552,9 +540,7 @@
},
"title": "Ran 3 validation queries",
"status": "completed",
"file_ids": [
"sql-toolu_01WovP2oMwhW6UWFD7TM8mNL"
],
"file_ids": ["sql-toolu_01WovP2oMwhW6UWFD7TM8mNL"],
"secondary_title": "2.2 seconds"
},
{
@ -582,9 +568,7 @@
},
"title": "Created 1 metric_file",
"status": "completed",
"file_ids": [
"c76d39e5-c1b0-4882-ba99-f3b96039c7c7"
],
"file_ids": ["c76d39e5-c1b0-4882-ba99-f3b96039c7c7"],
"secondary_title": "5.5 seconds"
}
],
@ -828,9 +812,7 @@
},
"title": "Broke down your request",
"status": "completed",
"file_ids": [
"todos-1758315939202-jbd1dtn9t5"
],
"file_ids": ["todos-1758315939202-jbd1dtn9t5"],
"secondary_title": "2.5 seconds"
},
{
@ -858,9 +840,7 @@
},
"title": "Generated 3 validation queries",
"status": "completed",
"file_ids": [
"sql-toolu_01BgQm1j8ggahsvqpRZgEKaY"
]
"file_ids": ["sql-toolu_01BgQm1j8ggahsvqpRZgEKaY"]
},
{
"id": "toolu_01S5QUiwN6uy2RNg1MAiwgKR",
@ -887,9 +867,7 @@
},
"title": "Failed to create 1 metric_file",
"status": "failed",
"file_ids": [
"6e7ed83e-0232-498c-9657-1147c21163ec"
],
"file_ids": ["6e7ed83e-0232-498c-9657-1147c21163ec"],
"secondary_title": "5.1 seconds"
},
{
@ -909,9 +887,7 @@
},
"title": "Failed to create 1 metric_file",
"status": "failed",
"file_ids": [
"337ecb09-377a-4179-a0cd-7f98ba16d172"
],
"file_ids": ["337ecb09-377a-4179-a0cd-7f98ba16d172"],
"secondary_title": "1.8 seconds"
}
],

View File

@ -64,10 +64,7 @@
},
"disableTooltip": false,
"metricColumnId": "metric_clv_all_time",
"scatterDotSize": [
3,
15
],
"scatterDotSize": [3, 15],
"xAxisAxisTitle": null,
"yAxisAxisTitle": null,
"yAxisScaleType": "linear",
@ -238,10 +235,7 @@
},
"disableTooltip": false,
"metricColumnId": "metric_clv_all_time",
"scatterDotSize": [
3,
15
],
"scatterDotSize": [3, 15],
"xAxisAxisTitle": null,
"yAxisAxisTitle": null,
"yAxisScaleType": "linear",
@ -438,10 +432,7 @@
},
"disableTooltip": false,
"metricColumnId": "total_customers",
"scatterDotSize": [
3,
15
],
"scatterDotSize": [3, 15],
"xAxisAxisTitle": null,
"yAxisAxisTitle": null,
"yAxisScaleType": "linear",
@ -570,10 +561,7 @@
},
"disableTooltip": false,
"metricColumnId": "total_customers",
"scatterDotSize": [
3,
15
],
"scatterDotSize": [3, 15],
"xAxisAxisTitle": null,
"yAxisAxisTitle": null,
"yAxisScaleType": "linear",

View File

@ -19535,7 +19535,7 @@ snapshots:
magic-string: 0.30.17
sirv: 3.0.1
tinyrainbow: 2.0.0
vitest: 3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@24.3.1)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(jiti@2.5.1)(jsdom@27.0.0(postcss@8.5.6))(lightningcss@1.30.1)(msw@2.11.2(@types/node@24.3.1)(typescript@5.9.2))(sass@1.92.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1)
vitest: 3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@24.3.1)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(jiti@2.5.1)(jsdom@26.1.0)(lightningcss@1.30.1)(msw@2.11.2(@types/node@24.3.1)(typescript@5.9.2))(sass@1.92.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1)
ws: 8.18.3
optionalDependencies:
playwright: 1.55.0
@ -19560,7 +19560,7 @@ snapshots:
std-env: 3.9.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
vitest: 3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@24.3.1)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(jiti@2.5.1)(jsdom@27.0.0(postcss@8.5.6))(lightningcss@1.30.1)(msw@2.11.2(@types/node@24.3.1)(typescript@5.9.2))(sass@1.92.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1)
vitest: 3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@24.3.1)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(jiti@2.5.1)(jsdom@26.1.0)(lightningcss@1.30.1)(msw@2.11.2(@types/node@24.3.1)(typescript@5.9.2))(sass@1.92.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1)
optionalDependencies:
'@vitest/browser': 3.2.4(msw@2.11.2(@types/node@24.3.1)(typescript@5.9.2))(playwright@1.55.0)(vite@7.1.4(@types/node@24.3.1)(jiti@2.5.1)(lightningcss@1.30.1)(sass@1.92.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1))(vitest@3.2.4)
transitivePeerDependencies: