mirror of https://github.com/buster-so/buster.git
Merge branch 'staging' into nate/upgrade-core-biome2
This commit is contained in:
commit
c2f289e5d9
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"extends": ["../../biome.json"],
|
||||
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
|
||||
"extends": ["../../biome2.json"],
|
||||
"files": {
|
||||
"include": ["src/**/*"]
|
||||
"includes": ["src/**/*"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
"@buster/env-utils": "workspace:*",
|
||||
"@buster/typescript-config": "workspace:*",
|
||||
"@buster/vitest-config": "workspace:*",
|
||||
"lru-cache": "^11.1.0",
|
||||
"@biomejs/biome": "2.2.5",
|
||||
"lru-cache": "^11.2.2",
|
||||
"node-sql-parser": "^5.3.12",
|
||||
"yaml": "^2.8.1",
|
||||
"zod": "catalog:",
|
||||
|
|
|
@ -464,11 +464,8 @@ export async function hasAllDatasetsAccess(userId: string, datasetIds: string[])
|
|||
// --- Step 3: Check specific permissions for each dataset ---
|
||||
for (const datasetId of input.datasetIds) {
|
||||
const datasetOrgId = datasetInfos.find(
|
||||
(info: {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
deletedAt: string | null;
|
||||
}) => info.id === datasetId
|
||||
(info: { id: string; organizationId: string; deletedAt: string | null }) =>
|
||||
info.id === datasetId
|
||||
)?.organizationId;
|
||||
|
||||
if (!datasetOrgId) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import {
|
||||
clearAllCaches,
|
||||
getCacheStats,
|
||||
getCachedCascadingPermission,
|
||||
getCachedPermission,
|
||||
getCacheStats,
|
||||
invalidateAsset,
|
||||
invalidateOnPermissionChange,
|
||||
invalidateUser,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { User } from '@buster/database/queries';
|
||||
import {
|
||||
checkChatsContainingAsset,
|
||||
checkCollectionsContainingAsset,
|
||||
checkDashboardsContainingMetric,
|
||||
checkReportsContainingMetric,
|
||||
} from '@buster/database/queries';
|
||||
import type { User } from '@buster/database/queries';
|
||||
import type { AssetType } from '@buster/database/schema-types';
|
||||
import type { AssetPermissionRole, WorkspaceSharing } from '../types/asset-permissions';
|
||||
import { AccessControlError } from '../types/errors';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { checkPermission, computeEffectivePermission } from './checks';
|
||||
import type { AssetPermissionResult } from './checks';
|
||||
import { checkPermission, computeEffectivePermission } from './checks';
|
||||
|
||||
// Mock database queries
|
||||
vi.mock('@buster/database/queries', () => ({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { User } from '@buster/database/queries';
|
||||
import {
|
||||
type CheckAssetPermissionParams,
|
||||
checkAssetPermission as checkDbAssetPermission,
|
||||
getUserOrganizationsByUserId,
|
||||
} from '@buster/database/queries';
|
||||
import type { User } from '@buster/database/queries';
|
||||
import type { AssetType } from '@buster/database/schema-types';
|
||||
import type { AssetPermissionRole, OrganizationMembership, WorkspaceSharing } from '../types';
|
||||
import { getHighestPermission, isPermissionSufficient } from '../types/asset-permissions';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Asset permissions module exports
|
||||
|
||||
export * from './permissions';
|
||||
export * from './checks';
|
||||
export * from './cascading-permissions';
|
||||
export * from './cache';
|
||||
export * from './cascading-permissions';
|
||||
export * from './checks';
|
||||
export * from './permissions';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { checkPermission } from './checks';
|
||||
import type { AssetPermissionCheck } from './checks';
|
||||
import { checkPermission } from './checks';
|
||||
|
||||
/**
|
||||
* Cached version of hasAssetPermission
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {
|
||||
type ListAssetPermissionsParams,
|
||||
type RemoveAssetPermissionParams,
|
||||
bulkCreateAssetPermissions,
|
||||
createAssetPermission,
|
||||
findUserByEmail,
|
||||
type ListAssetPermissionsParams,
|
||||
listAssetPermissions,
|
||||
type RemoveAssetPermissionParams,
|
||||
removeAssetPermission,
|
||||
} from '@buster/database/queries';
|
||||
import type { AssetType } from '@buster/database/schema-types';
|
||||
|
|
|
@ -2,9 +2,9 @@ import { beforeEach, describe, expect, it } from 'vitest';
|
|||
import type { PermissionedDataset } from '../types/dataset-permissions';
|
||||
import {
|
||||
clearAllCaches,
|
||||
getCacheStats,
|
||||
getCachedDatasetAccess,
|
||||
getCachedPermissionedDatasets,
|
||||
getCacheStats,
|
||||
invalidateDataset,
|
||||
invalidateOnPermissionChange,
|
||||
invalidateUser,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Dataset permissions module exports
|
||||
|
||||
export * from './permissions';
|
||||
export * from './cache';
|
||||
export * from './permissions';
|
||||
|
|
|
@ -1,89 +1,80 @@
|
|||
// Export all types
|
||||
export * from './types';
|
||||
|
||||
// Export asset permissions (excluding cache functions to avoid conflicts)
|
||||
export {
|
||||
// From permissions.ts
|
||||
hasAssetPermission,
|
||||
createPermission,
|
||||
createPermissionByEmail,
|
||||
removePermission,
|
||||
removePermissionByEmail,
|
||||
listPermissions,
|
||||
// From checks.ts
|
||||
checkPermission,
|
||||
computeEffectivePermission,
|
||||
type AssetPermissionCheck,
|
||||
type AssetPermissionResult,
|
||||
// From cascading-permissions.ts
|
||||
checkCascadingPermissions,
|
||||
checkMetricDashboardAccess,
|
||||
checkMetricChatAccess,
|
||||
checkMetricCollectionAccess,
|
||||
checkMetricReportAccess,
|
||||
checkDashboardChatAccess,
|
||||
checkDashboardCollectionAccess,
|
||||
} from './assets';
|
||||
|
||||
// Export dataset permissions
|
||||
export * from './datasets';
|
||||
|
||||
// Export user utilities
|
||||
export * from './users';
|
||||
|
||||
// Export SQL permissions
|
||||
export * from './sql-permissions';
|
||||
|
||||
// Export cache functions separately
|
||||
export {
|
||||
clearAllCaches,
|
||||
invalidateUser,
|
||||
invalidateOnPermissionChange,
|
||||
getCacheStats as getAssetCacheStats,
|
||||
} from './assets/cache';
|
||||
|
||||
// Export legacy access control functionality (for backward compatibility)
|
||||
export {
|
||||
AccessControlsError,
|
||||
type Permission,
|
||||
type Role,
|
||||
type AccessControlOptions,
|
||||
} from './types';
|
||||
|
||||
// Export legacy access control functions
|
||||
export {
|
||||
checkPermission as legacyCheckPermission,
|
||||
hasRole,
|
||||
validateAccess,
|
||||
getPermissionedDatasets as legacyGetPermissionedDatasets,
|
||||
hasDatasetAccess as legacyHasDatasetAccess,
|
||||
hasAllDatasetsAccess as legacyHasAllDatasetsAccess,
|
||||
hasDatasetAccess as legacyHasDatasetAccess,
|
||||
hasRole,
|
||||
type PermissionedDataset as LegacyPermissionedDataset,
|
||||
validateAccess,
|
||||
} from './access-controls';
|
||||
|
||||
// Export asset permissions (excluding cache functions to avoid conflicts)
|
||||
export {
|
||||
type AssetPermissionCheck,
|
||||
type AssetPermissionResult,
|
||||
// From cascading-permissions.ts
|
||||
checkCascadingPermissions,
|
||||
checkDashboardChatAccess,
|
||||
checkDashboardCollectionAccess,
|
||||
checkMetricChatAccess,
|
||||
checkMetricCollectionAccess,
|
||||
checkMetricDashboardAccess,
|
||||
checkMetricReportAccess,
|
||||
// From checks.ts
|
||||
checkPermission,
|
||||
computeEffectivePermission,
|
||||
createPermission,
|
||||
createPermissionByEmail,
|
||||
// From permissions.ts
|
||||
hasAssetPermission,
|
||||
listPermissions,
|
||||
removePermission,
|
||||
removePermissionByEmail,
|
||||
} from './assets';
|
||||
// Export cache functions separately
|
||||
export {
|
||||
clearAllCaches,
|
||||
getCacheStats as getAssetCacheStats,
|
||||
invalidateOnPermissionChange,
|
||||
invalidateUser,
|
||||
} from './assets/cache';
|
||||
export { canUserAccessChat } from './chats';
|
||||
|
||||
// Export cached version and cache management functions
|
||||
export {
|
||||
canUserAccessChatCached,
|
||||
getCacheStats,
|
||||
resetCacheStats,
|
||||
clearCache,
|
||||
getCacheStats,
|
||||
invalidateAccess,
|
||||
invalidateUserAccess,
|
||||
invalidateChatAccess,
|
||||
invalidateUserAccess,
|
||||
resetCacheStats,
|
||||
} from './chats-cached';
|
||||
|
||||
// Export utility functions
|
||||
export { formatPermissionName, buildAccessQuery } from './utils';
|
||||
|
||||
// Export dataset permissions
|
||||
export * from './datasets';
|
||||
// Export SQL permissions
|
||||
export * from './sql-permissions';
|
||||
export * from './types';
|
||||
// Export legacy access control functionality (for backward compatibility)
|
||||
export {
|
||||
type AccessControlOptions,
|
||||
AccessControlsError,
|
||||
type Permission,
|
||||
type Role,
|
||||
} from './types';
|
||||
// Export user organization functions
|
||||
export {
|
||||
checkUserInOrganization,
|
||||
getUserOrganizations,
|
||||
checkEmailDomainForOrganization,
|
||||
getOrganizationWithDefaults,
|
||||
checkUserInOrganization,
|
||||
createUserInOrganization,
|
||||
type UserOrganizationInfo,
|
||||
getOrganizationWithDefaults,
|
||||
getUserOrganizations,
|
||||
type OrganizationWithDefaults,
|
||||
type UserOrganizationInfo,
|
||||
} from './user-organizations';
|
||||
// Export user utilities
|
||||
export * from './users';
|
||||
// Export utility functions
|
||||
export { buildAccessQuery, formatPermissionName } from './utils';
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from './execute-with-permission-check';
|
||||
export * from './parser-helpers';
|
||||
export * from './validator';
|
||||
export * from './execute-with-permission-check';
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import pkg from 'node-sql-parser';
|
||||
|
||||
const { Parser } = pkg;
|
||||
|
||||
import type { BaseFrom, ColumnRefItem, Join, Select } from 'node-sql-parser';
|
||||
import * as yaml from 'yaml';
|
||||
|
||||
export type { QueryTypeCheckResult } from '@buster/data-source';
|
||||
// Import checkQueryIsReadOnly from data-source package
|
||||
export { checkQueryIsReadOnly } from '@buster/data-source';
|
||||
export type { QueryTypeCheckResult } from '@buster/data-source';
|
||||
|
||||
export interface ParsedTable {
|
||||
database?: string;
|
||||
|
@ -155,7 +158,7 @@ export function extractPhysicalTables(sql: string, dataSourceSyntax?: string): P
|
|||
*/
|
||||
export function parseTableReference(tableRef: string): ParsedTable {
|
||||
// Remove any quotes and trim
|
||||
let cleanRef = tableRef.replace(/["'`\[\]]/g, '').trim();
|
||||
let cleanRef = tableRef.replace(/["'`[\]]/g, '').trim();
|
||||
|
||||
// Handle node-sql-parser format: "type::database::table" or "type::table"
|
||||
if (cleanRef.includes('::')) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { getPermissionedDatasets } from '../datasets/permissions';
|
||||
import {
|
||||
type ParsedDataset,
|
||||
type ParsedTable,
|
||||
checkQueryIsReadOnly,
|
||||
extractColumnReferences,
|
||||
extractDatasetsFromYml,
|
||||
extractPhysicalTables,
|
||||
extractTablesFromYml,
|
||||
type ParsedDataset,
|
||||
type ParsedTable,
|
||||
tablesMatch,
|
||||
validateWildcardUsage,
|
||||
} from './parser-helpers';
|
||||
|
|
|
@ -2,8 +2,8 @@ import { z } from 'zod';
|
|||
|
||||
// Re-export all internal types
|
||||
export * from './types/asset-permissions';
|
||||
export * from './types/dataset-permissions';
|
||||
export * from './types/cascading-permissions';
|
||||
export * from './types/dataset-permissions';
|
||||
export * from './types/errors';
|
||||
|
||||
// Custom error class for access control operations (legacy - use AccessControlError instead)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"extends": ["../../biome.json"],
|
||||
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
|
||||
"extends": ["../../biome2.json"],
|
||||
"files": {
|
||||
"include": ["src/**/*"],
|
||||
"ignore": ["scripts/**/*"]
|
||||
"includes": ["src/**/*", "scripts/**/*"]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["**/*.ts", "**/*.test.ts"],
|
||||
"includes": ["**/*.ts", "**/*.test.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
|
@ -20,15 +19,25 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"include": ["**/*.ts"],
|
||||
"includes": ["**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"suspicious": {
|
||||
"noConsoleLog": "off",
|
||||
"noConsole": "off",
|
||||
"noExplicitAny": "warn"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"includes": ["scripts/**/*"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -5696,26 +5696,12 @@
|
|||
"public.asset_permission_role_enum": {
|
||||
"name": "asset_permission_role_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"owner",
|
||||
"viewer",
|
||||
"full_access",
|
||||
"can_edit",
|
||||
"can_filter",
|
||||
"can_view"
|
||||
]
|
||||
"values": ["owner", "viewer", "full_access", "can_edit", "can_filter", "can_view"]
|
||||
},
|
||||
"public.asset_type_enum": {
|
||||
"name": "asset_type_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"dashboard",
|
||||
"thread",
|
||||
"collection",
|
||||
"chat",
|
||||
"metric_file",
|
||||
"dashboard_file"
|
||||
]
|
||||
"values": ["dashboard", "thread", "collection", "chat", "metric_file", "dashboard_file"]
|
||||
},
|
||||
"public.data_source_onboarding_status_enum": {
|
||||
"name": "data_source_onboarding_status_enum",
|
||||
|
@ -5765,13 +5751,7 @@
|
|||
"public.table_type_enum": {
|
||||
"name": "table_type_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"TABLE",
|
||||
"VIEW",
|
||||
"MATERIALIZED_VIEW",
|
||||
"EXTERNAL_TABLE",
|
||||
"TEMPORARY_TABLE"
|
||||
]
|
||||
"values": ["TABLE", "VIEW", "MATERIALIZED_VIEW", "EXTERNAL_TABLE", "TEMPORARY_TABLE"]
|
||||
},
|
||||
"public.team_role_enum": {
|
||||
"name": "team_role_enum",
|
||||
|
@ -5781,13 +5761,7 @@
|
|||
"public.user_organization_role_enum": {
|
||||
"name": "user_organization_role_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"workspace_admin",
|
||||
"data_admin",
|
||||
"querier",
|
||||
"restricted_querier",
|
||||
"viewer"
|
||||
]
|
||||
"values": ["workspace_admin", "data_admin", "querier", "restricted_querier", "viewer"]
|
||||
},
|
||||
"public.user_organization_status_enum": {
|
||||
"name": "user_organization_status_enum",
|
||||
|
@ -5797,13 +5771,7 @@
|
|||
"public.verification_enum": {
|
||||
"name": "verification_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"verified",
|
||||
"backlogged",
|
||||
"inReview",
|
||||
"requested",
|
||||
"notRequested"
|
||||
]
|
||||
"values": ["verified", "backlogged", "inReview", "requested", "notRequested"]
|
||||
},
|
||||
"public.workspace_sharing_enum": {
|
||||
"name": "workspace_sharing_enum",
|
||||
|
|
|
@ -5587,26 +5587,12 @@
|
|||
"public.asset_permission_role_enum": {
|
||||
"name": "asset_permission_role_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"owner",
|
||||
"viewer",
|
||||
"full_access",
|
||||
"can_edit",
|
||||
"can_filter",
|
||||
"can_view"
|
||||
]
|
||||
"values": ["owner", "viewer", "full_access", "can_edit", "can_filter", "can_view"]
|
||||
},
|
||||
"public.asset_type_enum": {
|
||||
"name": "asset_type_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"dashboard",
|
||||
"thread",
|
||||
"collection",
|
||||
"chat",
|
||||
"metric_file",
|
||||
"dashboard_file"
|
||||
]
|
||||
"values": ["dashboard", "thread", "collection", "chat", "metric_file", "dashboard_file"]
|
||||
},
|
||||
"public.data_source_onboarding_status_enum": {
|
||||
"name": "data_source_onboarding_status_enum",
|
||||
|
@ -5656,13 +5642,7 @@
|
|||
"public.table_type_enum": {
|
||||
"name": "table_type_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"TABLE",
|
||||
"VIEW",
|
||||
"MATERIALIZED_VIEW",
|
||||
"EXTERNAL_TABLE",
|
||||
"TEMPORARY_TABLE"
|
||||
]
|
||||
"values": ["TABLE", "VIEW", "MATERIALIZED_VIEW", "EXTERNAL_TABLE", "TEMPORARY_TABLE"]
|
||||
},
|
||||
"public.team_role_enum": {
|
||||
"name": "team_role_enum",
|
||||
|
@ -5672,13 +5652,7 @@
|
|||
"public.user_organization_role_enum": {
|
||||
"name": "user_organization_role_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"workspace_admin",
|
||||
"data_admin",
|
||||
"querier",
|
||||
"restricted_querier",
|
||||
"viewer"
|
||||
]
|
||||
"values": ["workspace_admin", "data_admin", "querier", "restricted_querier", "viewer"]
|
||||
},
|
||||
"public.user_organization_status_enum": {
|
||||
"name": "user_organization_status_enum",
|
||||
|
@ -5688,13 +5662,7 @@
|
|||
"public.verification_enum": {
|
||||
"name": "verification_enum",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"verified",
|
||||
"backlogged",
|
||||
"inReview",
|
||||
"requested",
|
||||
"notRequested"
|
||||
]
|
||||
"values": ["verified", "backlogged", "inReview", "requested", "notRequested"]
|
||||
}
|
||||
},
|
||||
"schemas": {},
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -836,4 +836,4 @@
|
|||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
export {};
|
||||
|
|
|
@ -51,11 +51,12 @@
|
|||
"@buster/typescript-config": "workspace:*",
|
||||
"@buster/vitest-config": "workspace:*",
|
||||
"@buster-app/supabase": "workspace:*",
|
||||
"@biomejs/biome": "2.2.5",
|
||||
"ai": "catalog:",
|
||||
"drizzle-kit": "^0.31.4",
|
||||
"drizzle-kit": "^0.31.5",
|
||||
"drizzle-orm": "catalog:",
|
||||
"drizzle-zod": "^0.8.3",
|
||||
"lru-cache": "^11.2.1",
|
||||
"lru-cache": "^11.2.2",
|
||||
"postgres": "^3.4.7",
|
||||
"zod": "catalog:"
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
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 { getTableName, sql } from 'drizzle-orm';
|
||||
import { getTableConfig } from 'drizzle-orm/pg-core';
|
||||
import { db } from '../src/connection';
|
||||
import * as schema from '../src/schema';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
/** biome-ignore-all lint/suspicious/noExplicitAny: I guess this is okay? */
|
||||
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 { eq, getTableName, sql } from 'drizzle-orm';
|
||||
import { db } from '../src/connection';
|
||||
import * as schema from '../src/schema';
|
||||
|
||||
|
@ -80,7 +80,7 @@ async function upsertData(tx: any, tableName: string, table: any, data: any[]) {
|
|||
} else {
|
||||
// For regular tables with id field, use onConflictDoUpdate
|
||||
for (const record of batch) {
|
||||
const { id, createdAt, ...updateFields } = record;
|
||||
const { id, ...updateFields } = record;
|
||||
|
||||
// Most tables have an 'id' column as primary key
|
||||
if (id && table.id) {
|
||||
|
@ -326,6 +326,7 @@ async function seed() {
|
|||
) as secret_id
|
||||
`);
|
||||
|
||||
// @ts-expect-error biome-ignore lint/suspicious/noExplicitAny: Need dallin to check...
|
||||
const secretId = result?.rows?.[0]?.secret_id;
|
||||
|
||||
if (secretId) {
|
||||
|
|
|
@ -9,8 +9,8 @@ const __dirname = path.dirname(__filename);
|
|||
// Load environment variables from root .env file
|
||||
config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
|
||||
import { drizzle } from 'drizzle-orm/postgres-js';
|
||||
import type { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
||||
import { drizzle } from 'drizzle-orm/postgres-js';
|
||||
import postgres from 'postgres';
|
||||
|
||||
// Global pool instance
|
||||
|
@ -52,7 +52,7 @@ export function initializePool<T extends Record<string, postgres.PostgresType>>(
|
|||
const connectionString = validateEnvironment();
|
||||
|
||||
const poolSize = process.env.DATABASE_POOL_SIZE
|
||||
? Number.parseInt(process.env.DATABASE_POOL_SIZE)
|
||||
? Number.parseInt(process.env.DATABASE_POOL_SIZE, 10)
|
||||
: 100;
|
||||
|
||||
if (globalPool && globalDb) {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// Export common Drizzle utilities
|
||||
export {
|
||||
eq,
|
||||
and,
|
||||
or,
|
||||
not,
|
||||
isNull,
|
||||
isNotNull,
|
||||
inArray,
|
||||
notInArray,
|
||||
exists,
|
||||
notExists,
|
||||
desc,
|
||||
asc,
|
||||
sql,
|
||||
count,
|
||||
desc,
|
||||
eq,
|
||||
exists,
|
||||
gt,
|
||||
lt,
|
||||
gte,
|
||||
inArray,
|
||||
isNotNull,
|
||||
isNull,
|
||||
lt,
|
||||
lte,
|
||||
not,
|
||||
notExists,
|
||||
notInArray,
|
||||
or,
|
||||
sql,
|
||||
} from 'drizzle-orm';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import { db } from '../../connection';
|
||||
import { assetPermissions } from '../../schema';
|
||||
import type { AssetPermissionRole, AssetType, IdentityType } from '../../schema-types';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Asset permission query exports
|
||||
|
||||
export * from './check-asset-permission';
|
||||
export * from './create-asset-permission';
|
||||
export * from './list-asset-permissions';
|
||||
export * from './remove-asset-permission';
|
||||
export * from './check-asset-permission';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, isNull, sql } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, isNull, sql } from 'drizzle-orm';
|
||||
import { db } from '../../connection';
|
||||
import { assetPermissions, users } from '../../schema';
|
||||
import type { AssetType, IdentityType } from '../../schema-types';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, inArray, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, inArray, isNull } from 'drizzle-orm';
|
||||
import { db } from '../../connection';
|
||||
import { assetPermissions } from '../../schema';
|
||||
import type { AssetType, IdentityType } from '../../schema-types';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, inArray, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, inArray, isNull } from 'drizzle-orm';
|
||||
import { z } from 'zod';
|
||||
import { db } from '../../connection';
|
||||
import { dashboardFiles, messages, messagesToFiles, metricFiles, reportFiles } from '../../schema';
|
||||
|
|
|
@ -1,59 +1,51 @@
|
|||
// Export all asset-related functionality
|
||||
export {
|
||||
generateAssetMessages,
|
||||
createMessageFileAssociation,
|
||||
GenerateAssetMessagesInputSchema,
|
||||
type GenerateAssetMessagesInput,
|
||||
getAssetDetailsById,
|
||||
GetAssetDetailsInputSchema,
|
||||
type GetAssetDetailsInput,
|
||||
type AssetDetailsResult,
|
||||
} from './assets';
|
||||
|
||||
export type { DatabaseAssetType } from './assets';
|
||||
|
||||
export {
|
||||
getAssetPermission,
|
||||
type GetAssetPermissionInput,
|
||||
} from './asset-permission-check';
|
||||
|
||||
export type { GetAssetAncestorsForAssetsInput } from './asset-ancestors';
|
||||
export {
|
||||
getAssetAncestors,
|
||||
getAssetAncestorsForAssets,
|
||||
getAssetAncestorsWithTransaction,
|
||||
getAssetChatAncestors,
|
||||
getAssetCollectionAncestors,
|
||||
getMetricDashboardAncestors,
|
||||
getMetricReportAncestors,
|
||||
getAssetAncestors,
|
||||
getAssetAncestorsForAssets,
|
||||
getAssetAncestorsWithTransaction,
|
||||
} from './asset-ancestors';
|
||||
|
||||
export type { GetAssetAncestorsForAssetsInput } from './asset-ancestors';
|
||||
|
||||
export {
|
||||
getAssetLatestVersion,
|
||||
GetAssetLatestVersionInputSchema,
|
||||
type GetAssetLatestVersionInput,
|
||||
} from './get-asset-latest-version';
|
||||
|
||||
type GetAssetPermissionInput,
|
||||
getAssetPermission,
|
||||
} from './asset-permission-check';
|
||||
export type { DatabaseAssetType } from './assets';
|
||||
export {
|
||||
getUsersWithAssetPermissions,
|
||||
GetUsersWithAssetPermissionsInputSchema,
|
||||
type GetUsersWithAssetPermissionsInput,
|
||||
type GetUsersWithAssetPermissionsResult,
|
||||
} from './get-users-with-asset-permissions';
|
||||
|
||||
export {
|
||||
updateAssetScreenshotBucketKey,
|
||||
UpdateAssetScreenshotBucketKeyInputSchema,
|
||||
type UpdateAssetScreenshotBucketKeyInput,
|
||||
} from './update-asset-screenshot-bucket-key';
|
||||
|
||||
export {
|
||||
getAssetScreenshotBucketKey,
|
||||
GetAssetScreenshotBucketKeyInputSchema,
|
||||
type GetAssetScreenshotBucketKeyInput,
|
||||
} from './get-asset-screenshot-bucket-key';
|
||||
|
||||
type AssetDetailsResult,
|
||||
createMessageFileAssociation,
|
||||
type GenerateAssetMessagesInput,
|
||||
GenerateAssetMessagesInputSchema,
|
||||
type GetAssetDetailsInput,
|
||||
GetAssetDetailsInputSchema,
|
||||
generateAssetMessages,
|
||||
getAssetDetailsById,
|
||||
} from './assets';
|
||||
export { bulkUpdateLibraryField } from './bulk-update-asset-library-field';
|
||||
|
||||
export {
|
||||
type GetAssetLatestVersionInput,
|
||||
GetAssetLatestVersionInputSchema,
|
||||
getAssetLatestVersion,
|
||||
} from './get-asset-latest-version';
|
||||
export {
|
||||
type GetAssetScreenshotBucketKeyInput,
|
||||
GetAssetScreenshotBucketKeyInputSchema,
|
||||
getAssetScreenshotBucketKey,
|
||||
} from './get-asset-screenshot-bucket-key';
|
||||
export {
|
||||
type GetUsersWithAssetPermissionsInput,
|
||||
GetUsersWithAssetPermissionsInputSchema,
|
||||
type GetUsersWithAssetPermissionsResult,
|
||||
getUsersWithAssetPermissions,
|
||||
} from './get-users-with-asset-permissions';
|
||||
export { listPermissionedLibraryAssets } from './list-permissioned-library-assets';
|
||||
export {
|
||||
type UpdateAssetScreenshotBucketKeyInput,
|
||||
UpdateAssetScreenshotBucketKeyInputSchema,
|
||||
updateAssetScreenshotBucketKey,
|
||||
} from './update-asset-screenshot-bucket-key';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
type SQL,
|
||||
and,
|
||||
count,
|
||||
desc,
|
||||
|
@ -12,6 +11,7 @@ import {
|
|||
ne,
|
||||
not,
|
||||
or,
|
||||
type SQL,
|
||||
sql,
|
||||
} from 'drizzle-orm';
|
||||
import { db } from '../../connection';
|
||||
|
@ -24,12 +24,12 @@ import {
|
|||
users,
|
||||
} from '../../schema';
|
||||
import {
|
||||
createPaginatedResponse,
|
||||
type LibraryAssetListItem,
|
||||
type LibraryAssetType,
|
||||
type ListPermissionedLibraryAssetsInput,
|
||||
ListPermissionedLibraryAssetsInputSchema,
|
||||
type ListPermissionedLibraryAssetsResponse,
|
||||
createPaginatedResponse,
|
||||
} from '../../schema-types';
|
||||
|
||||
export async function listPermissionedLibraryAssets(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export * from './check-dashboards-containing-metric';
|
||||
export * from './check-chats-containing-asset';
|
||||
export * from './check-collections-containing-asset';
|
||||
export * from './check-dashboards-containing-metric';
|
||||
export * from './check-reports-containing-metric';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import { z } from 'zod';
|
||||
import { db } from '../../connection';
|
||||
import { chats, messages, userFavorites, users } from '../../schema';
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
// Export all chat-related functionality
|
||||
export {
|
||||
createChat,
|
||||
updateChat,
|
||||
getChatWithDetails,
|
||||
createMessage,
|
||||
updateChatSharing,
|
||||
getChatById,
|
||||
CreateChatInputSchema,
|
||||
GetChatInputSchema,
|
||||
CreateMessageInputSchema,
|
||||
type CreateChatInput,
|
||||
type GetChatInput,
|
||||
type CreateMessageInput,
|
||||
type Chat,
|
||||
type CreateChatInput,
|
||||
CreateChatInputSchema,
|
||||
type CreateMessageInput,
|
||||
CreateMessageInputSchema,
|
||||
createChat,
|
||||
createMessage,
|
||||
type GetChatInput,
|
||||
GetChatInputSchema,
|
||||
getChatById,
|
||||
getChatWithDetails,
|
||||
updateChat,
|
||||
updateChatSharing,
|
||||
} from './chats';
|
||||
|
||||
export {
|
||||
getChatTitle,
|
||||
GetChatTitleInputSchema,
|
||||
type GetChatTitleInput,
|
||||
GetChatTitleInputSchema,
|
||||
getChatTitle,
|
||||
} from './get-chat-title';
|
||||
|
||||
export {
|
||||
listChats,
|
||||
ListChatsRequestSchema,
|
||||
type ListChatsRequest,
|
||||
ListChatsRequestSchema,
|
||||
type ListChatsResponse,
|
||||
listChats,
|
||||
} from './list-chats';
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
usersToOrganizations,
|
||||
} from '../../schema';
|
||||
import type { ChatListItem, PaginatedResponse } from '../../schema-types';
|
||||
import { PaginationInputSchema, createPaginatedResponse } from '../../schema-types';
|
||||
import { createPaginatedResponse, PaginationInputSchema } from '../../schema-types';
|
||||
|
||||
export const ListChatsRequestSchema = z
|
||||
.object({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export {
|
||||
getCollectionTitle,
|
||||
GetCollectionTitleInputSchema,
|
||||
type GetCollectionTitleInput,
|
||||
GetCollectionTitleInputSchema,
|
||||
getCollectionTitle,
|
||||
} from './get-collection-title';
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
export {
|
||||
getChatDashboardFiles,
|
||||
type DashboardFileContext,
|
||||
type DashboardFile,
|
||||
type DashboardFileContext,
|
||||
getChatDashboardFiles,
|
||||
} from './dashboards';
|
||||
|
||||
export {
|
||||
getDashboardTitle,
|
||||
GetDashboardTitleInputSchema,
|
||||
type GetDashboardTitleInput,
|
||||
} from './get-dashboard-title';
|
||||
|
||||
export {
|
||||
getDashboardById,
|
||||
GetDashboardByIdInputSchema,
|
||||
type GetDashboardByIdInput,
|
||||
} from './get-dashboard-by-id';
|
||||
|
||||
export { updateDashboard } from './update-dashboard';
|
||||
|
||||
export {
|
||||
getCollectionsAssociatedWithDashboard,
|
||||
type AssociatedCollection,
|
||||
getCollectionsAssociatedWithDashboard,
|
||||
} from './get-collections-associated-with-dashboard';
|
||||
|
||||
export {
|
||||
type GetDashboardByIdInput,
|
||||
GetDashboardByIdInputSchema,
|
||||
getDashboardById,
|
||||
} from './get-dashboard-by-id';
|
||||
export {
|
||||
type GetDashboardTitleInput,
|
||||
GetDashboardTitleInputSchema,
|
||||
getDashboardTitle,
|
||||
} from './get-dashboard-title';
|
||||
export { updateDashboard } from './update-dashboard';
|
||||
|
|
|
@ -95,7 +95,9 @@ export async function getPermissionedDatasets(
|
|||
isNull(datasetPermissions.deletedAt)
|
||||
)
|
||||
);
|
||||
directUserDatasets.forEach((d) => accessibleDatasetIds.add(d.datasetId));
|
||||
directUserDatasets.forEach((d) => {
|
||||
accessibleDatasetIds.add(d.datasetId);
|
||||
});
|
||||
|
||||
// Path 2: User → permission group → dataset
|
||||
const userGroupDatasets = await db
|
||||
|
@ -118,7 +120,9 @@ export async function getPermissionedDatasets(
|
|||
)
|
||||
)
|
||||
.where(isNull(datasetsToPermissionGroups.deletedAt));
|
||||
userGroupDatasets.forEach((d) => accessibleDatasetIds.add(d.datasetId));
|
||||
userGroupDatasets.forEach((d) => {
|
||||
accessibleDatasetIds.add(d.datasetId);
|
||||
});
|
||||
|
||||
// Get user's teams
|
||||
const userTeams = await db
|
||||
|
@ -139,7 +143,9 @@ export async function getPermissionedDatasets(
|
|||
isNull(datasetPermissions.deletedAt)
|
||||
)
|
||||
);
|
||||
teamDirectDatasets.forEach((d) => accessibleDatasetIds.add(d.datasetId));
|
||||
teamDirectDatasets.forEach((d) => {
|
||||
accessibleDatasetIds.add(d.datasetId);
|
||||
});
|
||||
|
||||
// Path 4: User → team → permission group → dataset
|
||||
const teamGroupDatasets = await db
|
||||
|
@ -162,7 +168,9 @@ export async function getPermissionedDatasets(
|
|||
)
|
||||
)
|
||||
.where(isNull(datasetsToPermissionGroups.deletedAt));
|
||||
teamGroupDatasets.forEach((d) => accessibleDatasetIds.add(d.datasetId));
|
||||
teamGroupDatasets.forEach((d) => {
|
||||
accessibleDatasetIds.add(d.datasetId);
|
||||
});
|
||||
}
|
||||
|
||||
// Path 5: User → org → default permission group → dataset
|
||||
|
@ -184,7 +192,9 @@ export async function getPermissionedDatasets(
|
|||
)
|
||||
.where(isNull(datasetsToPermissionGroups.deletedAt));
|
||||
|
||||
defaultGroupDatasets.forEach((d) => accessibleDatasetIds.add(d.datasetId));
|
||||
defaultGroupDatasets.forEach((d) => {
|
||||
accessibleDatasetIds.add(d.datasetId);
|
||||
});
|
||||
}
|
||||
|
||||
if (accessibleDatasetIds.size === 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Dataset permission query exports
|
||||
|
||||
export * from './get-permissioned-datasets';
|
||||
export * from './check-dataset-access';
|
||||
export * from './get-permissioned-datasets';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// Export all dataset-related database queries
|
||||
export { deployDatasetsBatch, type BatchDeployResult } from './deploy-batch';
|
||||
export { upsertDataset } from './upsert-dataset';
|
||||
export { softDeleteDatasetsNotIn, getOrganizationDatasets } from './soft-delete-datasets';
|
||||
export { type BatchDeployResult, deployDatasetsBatch } from './deploy-batch';
|
||||
export { getDataSourceByName, userHasDataSourceAccess } from './get-data-source';
|
||||
export { getDatasetsWithYml, getDatasetsWithYmlByOrganization } from './get-datasets-with-yml';
|
||||
export { getDatasetById, type Dataset } from './get-dataset-by-id';
|
||||
export { getDataSourceWithDetails } from './get-data-source-with-details';
|
||||
export { updateDatasetMetadata } from './update-dataset-metadata';
|
||||
export { type Dataset, getDatasetById } from './get-dataset-by-id';
|
||||
export { getDatasetMetadata } from './get-dataset-metadata';
|
||||
export { getDatasetsWithYml, getDatasetsWithYmlByOrganization } from './get-datasets-with-yml';
|
||||
export { getOrganizationDatasets, softDeleteDatasetsNotIn } from './soft-delete-datasets';
|
||||
export { updateDatasetMetadata } from './update-dataset-metadata';
|
||||
export { upsertDataset } from './upsert-dataset';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { type MockedFunction, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { beforeEach, describe, expect, it, type MockedFunction, vi } from 'vitest';
|
||||
import {
|
||||
GetOrganizationAnalystDocParamsSchema,
|
||||
getOrganizationAnalystDoc,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export * from './upsert-doc';
|
||||
export * from './get-doc';
|
||||
export * from './list-docs';
|
||||
export * from './update-doc';
|
||||
export * from './delete-doc';
|
||||
export * from './get-doc';
|
||||
export * from './get-organization-analyst-doc';
|
||||
export * from './get-organization-docs';
|
||||
export * from './list-docs';
|
||||
export * from './update-doc';
|
||||
export * from './upsert-doc';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import { db } from '../../connection';
|
||||
import { githubIntegrations } from '../../schema';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export { createGithubIntegration } from './create-github-integration';
|
||||
export { getActiveGithubIntegration } from './get-active-github-integration';
|
||||
export { getGithubIntegrationByInstallationId } from './get-github-integration-by-installation-id';
|
||||
export { updateGithubIntegration } from './update-github-integration';
|
||||
export { softDeleteGithubIntegration } from './soft-delete-github-integration';
|
||||
export { markGithubIntegrationAsFailed } from './mark-github-integration-as-failed';
|
||||
export { softDeleteGithubIntegration } from './soft-delete-github-integration';
|
||||
export { updateGithubIntegration } from './update-github-integration';
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
export * from './api-keys';
|
||||
export * from './messages';
|
||||
export * from './users';
|
||||
export * from './data-sources';
|
||||
export * from './datasets';
|
||||
export * from './assets';
|
||||
export * from './asset-permissions';
|
||||
export * from './dataset-permissions';
|
||||
export * from './metadata';
|
||||
export * from './chats';
|
||||
export * from './organizations';
|
||||
export * from './dashboards';
|
||||
export * from './metrics';
|
||||
export * from './collections';
|
||||
export * from './reports';
|
||||
export * from './docs';
|
||||
export * from './s3-integrations';
|
||||
export * from './vault';
|
||||
export * from './assets';
|
||||
export * from './cascading-permissions';
|
||||
export * from './chats';
|
||||
export * from './collections';
|
||||
export * from './dashboards';
|
||||
export * from './data-sources';
|
||||
export * from './dataset-permissions';
|
||||
export * from './datasets';
|
||||
export * from './docs';
|
||||
export * from './github-integrations';
|
||||
export * from './shortcuts';
|
||||
export * from './search';
|
||||
export * from './metrics-to-reports';
|
||||
export * from './vault';
|
||||
export * from './logs-writeback';
|
||||
export * from './messages';
|
||||
export * from './metadata';
|
||||
export * from './metrics';
|
||||
export * from './metrics-to-reports';
|
||||
export * from './organizations';
|
||||
export * from './reports';
|
||||
export * from './s3-integrations';
|
||||
export * from './search';
|
||||
export * from './shortcuts';
|
||||
export * from './users';
|
||||
export * from './vault';
|
||||
export * from './vault';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Export all logs writeback configuration query functions
|
||||
|
||||
export * from './delete-logs-writeback-config';
|
||||
export * from './get-logs-writeback-config';
|
||||
export * from './upsert-logs-writeback-config';
|
||||
export * from './delete-logs-writeback-config';
|
||||
|
|
|
@ -192,7 +192,7 @@ function convertToolResultPart(part: unknown): unknown | unknown[] | null {
|
|||
|
||||
// Only convert if we have 'result' field but not 'output' (v4 format)
|
||||
if ('result' in p && !('output' in p)) {
|
||||
const { result, experimental_content, isError, ...rest } = p;
|
||||
const { result, isError, ...rest } = p;
|
||||
|
||||
// Validate toolCallId exists and matches Anthropic's pattern
|
||||
const toolCallId = rest.toolCallId;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// Export all message-related functionality
|
||||
export * from './messages';
|
||||
|
||||
export * from './chatConversationHistory';
|
||||
export { fetchMessageEntries } from './helpers/fetch-message-entries';
|
||||
export * from './messageContext';
|
||||
export * from './messages';
|
||||
export * from './update-message-entries';
|
||||
export * from './user-recent-messages';
|
||||
export { fetchMessageEntries } from './helpers/fetch-message-entries';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Export all metadata-related functionality
|
||||
export {
|
||||
getBraintrustMetadata,
|
||||
BraintrustMetadataInputSchema,
|
||||
BraintrustMetadataOutputSchema,
|
||||
type BraintrustMetadataInput,
|
||||
BraintrustMetadataInputSchema,
|
||||
type BraintrustMetadataOutput,
|
||||
BraintrustMetadataOutputSchema,
|
||||
getBraintrustMetadata,
|
||||
} from './braintrustMetadata';
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from './update-metrics-to-reports';
|
||||
export * from './get-metrics-in-report';
|
||||
export * from './update-metrics-to-reports';
|
||||
|
|
|
@ -1,43 +1,39 @@
|
|||
export {
|
||||
getMetricTitle,
|
||||
GetMetricTitleInputSchema,
|
||||
type GetMetricTitleInput,
|
||||
} from './get-metric-title';
|
||||
|
||||
export {
|
||||
getMetricForExport,
|
||||
GetMetricForExportInputSchema,
|
||||
type GetMetricForExportInput,
|
||||
type MetricForExport,
|
||||
} from './get-metric-for-export';
|
||||
|
||||
export {
|
||||
getMetricWithDataSource,
|
||||
extractSqlFromMetricContent,
|
||||
getLatestMetricVersion,
|
||||
// Schemas (Zod-first)
|
||||
GetMetricWithDataSourceInputSchema,
|
||||
MetricContentSchema,
|
||||
VersionHistoryEntrySchema,
|
||||
MetricWithDataSourceSchema,
|
||||
// Types (derived from schemas)
|
||||
type GetMetricWithDataSourceInput,
|
||||
type MetricWithDataSource,
|
||||
type MetricContent,
|
||||
type VersionHistoryEntry,
|
||||
} from './get-metric-with-data-source';
|
||||
|
||||
export {
|
||||
getMetricFileById,
|
||||
type MetricFile,
|
||||
} from './get-metric-by-id';
|
||||
|
||||
export { updateMetric } from './update-metric';
|
||||
|
||||
export {
|
||||
getDashboardsAssociatedWithMetric,
|
||||
getCollectionsAssociatedWithMetric,
|
||||
getAssetsAssociatedWithMetric,
|
||||
type AssociatedAsset,
|
||||
type GetMetricForExportInput,
|
||||
GetMetricForExportInputSchema,
|
||||
getMetricForExport,
|
||||
type MetricForExport,
|
||||
} from './get-metric-for-export';
|
||||
export {
|
||||
type GetMetricTitleInput,
|
||||
GetMetricTitleInputSchema,
|
||||
getMetricTitle,
|
||||
} from './get-metric-title';
|
||||
export {
|
||||
extractSqlFromMetricContent,
|
||||
// Types (derived from schemas)
|
||||
type GetMetricWithDataSourceInput,
|
||||
// Schemas (Zod-first)
|
||||
GetMetricWithDataSourceInputSchema,
|
||||
getLatestMetricVersion,
|
||||
getMetricWithDataSource,
|
||||
type MetricContent,
|
||||
MetricContentSchema,
|
||||
type MetricWithDataSource,
|
||||
MetricWithDataSourceSchema,
|
||||
type VersionHistoryEntry,
|
||||
VersionHistoryEntrySchema,
|
||||
} from './get-metric-with-data-source';
|
||||
export {
|
||||
type AssetsAssociatedWithMetric,
|
||||
type AssociatedAsset,
|
||||
getAssetsAssociatedWithMetric,
|
||||
getCollectionsAssociatedWithMetric,
|
||||
getDashboardsAssociatedWithMetric,
|
||||
} from './get-permissioned-asset-associations';
|
||||
export { updateMetric } from './update-metric';
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
// Export all organization-related functionality
|
||||
export {
|
||||
getUserOrganizationId,
|
||||
GetUserOrganizationInputSchema,
|
||||
getOrganization,
|
||||
GetOrganizationInputSchema,
|
||||
type GetUserOrganizationInput,
|
||||
type GetOrganizationInput,
|
||||
type UserToOrganization,
|
||||
} from './organizations';
|
||||
|
||||
export { updateOrganization, type DEFAULT_COLOR_PALETTE_ID } from './update-organization';
|
||||
|
||||
export { getOrganizationMemberCount } from './organization-member-count';
|
||||
export {
|
||||
type GetOrganizationInput,
|
||||
GetOrganizationInputSchema,
|
||||
type GetUserOrganizationInput,
|
||||
GetUserOrganizationInputSchema,
|
||||
getOrganization,
|
||||
getUserOrganizationId,
|
||||
type UserToOrganization,
|
||||
} from './organizations';
|
||||
export { type DEFAULT_COLOR_PALETTE_ID, updateOrganization } from './update-organization';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import { z } from 'zod';
|
||||
import { db } from '../../connection';
|
||||
import { organizations, usersToOrganizations } from '../../schema';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue