()
| 26 | ]; |
| 27 | |
| 28 | export function buildAllObjectsQuery() { |
| 29 | return queryBuilder |
| 30 | .selectFrom("mz_object_fully_qualified_names as ofqn") |
| 31 | .innerJoin("mz_objects as o", "o.id", "ofqn.id") |
| 32 | .leftJoin("mz_sources as s", "s.id", "ofqn.id") |
| 33 | .leftJoin("mz_webhook_sources as ws", "ws.id", "ofqn.id") |
| 34 | .leftJoin("mz_clusters as mc", "mc.id", "ofqn.cluster_id") |
| 35 | .select([ |
| 36 | "ofqn.id", |
| 37 | "ofqn.name", |
| 38 | "ofqn.object_type as objectType", |
| 39 | "ofqn.schema_id as schemaId", |
| 40 | "ofqn.schema_name as schemaName", |
| 41 | "ofqn.database_id as databaseId", |
| 42 | "ofqn.database_name as databaseName", |
| 43 | "s.type as sourceType", |
| 44 | sql<string | null>` |
| 45 | CASE |
| 46 | WHEN |
| 47 | ws.id IS NOT NULL |
| 48 | THEN true ELSE false |
| 49 | END |
| 50 | `.as("isWebhookTable"), |
| 51 | "o.cluster_id as clusterId", |
| 52 | "mc.name as clusterName", |
| 53 | ]) |
| 54 | .where("ofqn.object_type", "in", ALLOWED_OBJECT_TYPES); |
| 55 | } |
| 56 | |
| 57 | export type DatabaseObject = InferResult< |
| 58 | ReturnType<typeof buildAllObjectsQuery> |
no test coverage detected