import { z } from "zod"; import type { DataSourceCatalog as ProtoDataSourceCatalog, DataSourceAuthorizeQueryInput as ProtoAuthorizeQueryInput, DataSourceAuthorizeQueryOutput as ProtoAuthorizeQueryOutput, DataSourceColumn as ProtoDataSourceColumn, DataSourceDescribeTableInput as ProtoDescribeTableInput, DataSourceDescribeTableOutput as ProtoDescribeTableOutput, DataSourceListCatalogsInput as ProtoListCatalogsInput, DataSourceListCatalogsOutput as ProtoListCatalogsOutput, DataSourceManagerPermission as ProtoDataSourceManagerPermission, DataSourceListTablesInput as ProtoListTablesInput, DataSourceListTablesOutput as ProtoListTablesOutput, DataSourceQueryFilter as ProtoDataSourceQueryFilter, DataSourceQueryTableAccess as ProtoDataSourceQueryTableAccess, DataSourceTable as ProtoDataSourceTable, DataSourceTableDefinition as ProtoDataSourceTableDefinition, DataSourceTableListing as ProtoDataSourceTableListing } from "../gen/channel/app/sdk/v1/extension.js"; import type { Context } from "../types/context.js"; import type { ExtensionDefinition } from "../types/extension.js"; type ProtoBacked = T & Proto; export declare const DataSourceDialectSchema: z.ZodEnum<["postgresql", "bigquery", "mysql"]>; export type DataSourceDialect = z.infer; export declare const DataSourceTableTypeSchema: z.ZodEnum<["table", "view", "materialized_view", "external"]>; export type DataSourceTableType = z.infer; export declare const DataSourceManagerAccessSchema: z.ZodEnum<["all", "owner"]>; export type DataSourceManagerAccess = z.infer; export declare const DataSourceManagerPermissionSchema: z.ZodObject<{ action: z.ZodString; scope: z.ZodString; }, "strict", z.ZodTypeAny, { action: string; scope: string; }, { action: string; scope: string; }>; export type DataSourceManagerPermission = ProtoBacked, ProtoDataSourceManagerPermission>; export declare const DataSourceCatalogSchema: z.ZodObject<{ alias: z.ZodString; displayName: z.ZodOptional; dialect: z.ZodEnum<["postgresql", "bigquery", "mysql"]>; active: z.ZodOptional; }, "strip", z.ZodTypeAny, { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }, { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }>; export type DataSourceCatalog = ProtoBacked, ProtoDataSourceCatalog>; export declare const DataSourceTableSchema: z.ZodObject<{ name: z.ZodString; localCatalogAlias: z.ZodOptional; description: z.ZodOptional; estimatedRowCount: z.ZodOptional; updatedAt: z.ZodOptional; tableType: z.ZodOptional>; managerAccess: z.ZodOptional>; permissions: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }>; export type DataSourceTable = ProtoBacked, ProtoDataSourceTable>; export declare const DataSourceColumnSchema: z.ZodObject<{ name: z.ZodString; type: z.ZodString; nullable: z.ZodBoolean; description: z.ZodOptional; partitionKey: z.ZodOptional; precision: z.ZodOptional; scale: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }>; export type DataSourceColumn = ProtoBacked, ProtoDataSourceColumn>; export declare const DataSourceTableDefinitionSchema: z.ZodObject<{ table: z.ZodObject<{ name: z.ZodString; localCatalogAlias: z.ZodOptional; description: z.ZodOptional; estimatedRowCount: z.ZodOptional; updatedAt: z.ZodOptional; tableType: z.ZodOptional>; managerAccess: z.ZodOptional>; permissions: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }>; columns: z.ZodArray; partitionKey: z.ZodOptional; precision: z.ZodOptional; scale: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }>, "many">; primaryKey: z.ZodOptional>; }, "strip", z.ZodTypeAny, { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }, { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }>; export type DataSourceTableDefinition = ProtoBacked, ProtoDataSourceTableDefinition>; export declare const DataSourceTableListingSchema: z.ZodObject<{ table: z.ZodObject<{ name: z.ZodString; localCatalogAlias: z.ZodOptional; description: z.ZodOptional; estimatedRowCount: z.ZodOptional; updatedAt: z.ZodOptional; tableType: z.ZodOptional>; managerAccess: z.ZodOptional>; permissions: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }>; searchText: z.ZodOptional; tags: z.ZodOptional>; }, "strip", z.ZodTypeAny, { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }, { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }>; export type DataSourceTableListing = ProtoBacked, ProtoDataSourceTableListing>; export type SearchedTable = DataSourceTableListing; export declare const ListCatalogsInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>; export type ListCatalogsInput = ProtoBacked, ProtoListCatalogsInput>; export declare const ListCatalogsOutputSchema: z.ZodObject<{ catalogs: z.ZodArray; dialect: z.ZodEnum<["postgresql", "bigquery", "mysql"]>; active: z.ZodOptional; }, "strip", z.ZodTypeAny, { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }, { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { catalogs: { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }[]; }, { catalogs: { alias: string; dialect: "postgresql" | "bigquery" | "mysql"; displayName?: string | undefined; active?: boolean | undefined; }[]; }>; export type ListCatalogsOutput = ProtoBacked, ProtoListCatalogsOutput>; export declare const ListTablesInputSchema: z.ZodObject<{ localCatalogAlias: z.ZodOptional; updatedAfter: z.ZodOptional; limit: z.ZodOptional; pageToken: z.ZodOptional; }, "strip", z.ZodTypeAny, { limit?: number | undefined; localCatalogAlias?: string | undefined; updatedAfter?: string | undefined; pageToken?: string | undefined; }, { limit?: number | undefined; localCatalogAlias?: string | undefined; updatedAfter?: string | undefined; pageToken?: string | undefined; }>; export type ListTablesInput = ProtoBacked, ProtoListTablesInput>; export declare const ListTablesOutputSchema: z.ZodObject<{ tables: z.ZodArray; description: z.ZodOptional; estimatedRowCount: z.ZodOptional; updatedAt: z.ZodOptional; tableType: z.ZodOptional>; managerAccess: z.ZodOptional>; permissions: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }>; searchText: z.ZodOptional; tags: z.ZodOptional>; }, "strip", z.ZodTypeAny, { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }, { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }>, "many">; nextPageToken: z.ZodOptional; metadataVersion: z.ZodOptional; }, "strip", z.ZodTypeAny, { tables: { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }[]; nextPageToken?: string | undefined; metadataVersion?: string | undefined; }, { tables: { table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; searchText?: string | undefined; tags?: string[] | undefined; }[]; nextPageToken?: string | undefined; metadataVersion?: string | undefined; }>; export type ListTablesOutput = ProtoBacked, ProtoListTablesOutput>; export declare const DescribeTableInputSchema: z.ZodObject<{ localCatalogAlias: z.ZodOptional; tableName: z.ZodString; includeSample: z.ZodOptional; }, "strip", z.ZodTypeAny, { tableName: string; localCatalogAlias?: string | undefined; includeSample?: boolean | undefined; }, { tableName: string; localCatalogAlias?: string | undefined; includeSample?: boolean | undefined; }>; export type DescribeTableInput = ProtoBacked, ProtoDescribeTableInput>; export declare const DescribeTableOutputSchema: z.ZodObject<{ definition: z.ZodObject<{ table: z.ZodObject<{ name: z.ZodString; localCatalogAlias: z.ZodOptional; description: z.ZodOptional; estimatedRowCount: z.ZodOptional; updatedAt: z.ZodOptional; tableType: z.ZodOptional>; managerAccess: z.ZodOptional>; permissions: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }, { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }>; columns: z.ZodArray; partitionKey: z.ZodOptional; precision: z.ZodOptional; scale: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }, { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }>, "many">; primaryKey: z.ZodOptional>; }, "strip", z.ZodTypeAny, { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }, { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }>; sample: z.ZodOptional, "many">>; metadataVersion: z.ZodOptional; }, "strip", z.ZodTypeAny, { definition: { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }; metadataVersion?: string | undefined; sample?: Record[] | undefined; }, { definition: { columns: { type: string; name: string; nullable: boolean; description?: string | undefined; partitionKey?: boolean | undefined; precision?: number | undefined; scale?: number | undefined; }[]; table: { name: string; description?: string | undefined; updatedAt?: number | undefined; localCatalogAlias?: string | undefined; estimatedRowCount?: number | undefined; tableType?: "external" | "table" | "view" | "materialized_view" | undefined; managerAccess?: "all" | "owner" | undefined; permissions?: { action: string; scope: string; }[] | undefined; }; primaryKey?: string[] | undefined; }; metadataVersion?: string | undefined; sample?: Record[] | undefined; }>; export type DescribeTableOutput = ProtoBacked, ProtoDescribeTableOutput>; export declare const DataSourceQueryAuthorizationPolicy: { readonly maxTables: 64; readonly maxColumnsPerTable: 256; readonly maxFilters: 64; readonly maxValuesPerFilter: 1000; readonly maxOutputBytes: number; }; export declare const DataSourceQueryTableAccessSchema: z.ZodObject<{ name: z.ZodString; columns: z.ZodEffects, string[], string[]>; }, "strict", z.ZodTypeAny, { name: string; columns: string[]; }, { name: string; columns: string[]; }>; export type DataSourceQueryTableAccess = ProtoBacked, ProtoDataSourceQueryTableAccess>; export declare const AuthorizeQueryInputSchema: z.ZodObject<{ localCatalogAlias: z.ZodString; tables: z.ZodEffects, string[], string[]>; }, "strict", z.ZodTypeAny, { name: string; columns: string[]; }, { name: string; columns: string[]; }>, "many">, { name: string; columns: string[]; }[], { name: string; columns: string[]; }[]>; }, "strict", z.ZodTypeAny, { localCatalogAlias: string; tables: { name: string; columns: string[]; }[]; }, { localCatalogAlias: string; tables: { name: string; columns: string[]; }[]; }>; export type AuthorizeQueryInput = ProtoBacked, ProtoAuthorizeQueryInput>; export declare const DataSourceQueryFilterSchema: z.ZodObject<{ table: z.ZodString; column: z.ZodString; values: z.ZodEffects, string[], string[]>; }, "strict", z.ZodTypeAny, { values: string[]; column: string; table: string; }, { values: string[]; column: string; table: string; }>; export type DataSourceQueryFilter = ProtoBacked, ProtoDataSourceQueryFilter>; export declare const AuthorizeQueryOutputSchema: z.ZodEffects, string[], string[]>; }, "strict", z.ZodTypeAny, { values: string[]; column: string; table: string; }, { values: string[]; column: string; table: string; }>, "many">, { values: string[]; column: string; table: string; }[], { values: string[]; column: string; table: string; }[]>>; }, "strict", z.ZodTypeAny, { authorized: boolean; filters?: { values: string[]; column: string; table: string; }[] | undefined; }, { authorized: boolean; filters?: { values: string[]; column: string; table: string; }[] | undefined; }>, { authorized: boolean; filters?: { values: string[]; column: string; table: string; }[] | undefined; }, { authorized: boolean; filters?: { values: string[]; column: string; table: string; }[] | undefined; }>; export type AuthorizeQueryOutput = ProtoBacked, ProtoAuthorizeQueryOutput>; export type DataSourceQueryAuthorizer = (ctx: Context, input: AuthorizeQueryInput) => AuthorizeQueryOutput | Promise; export interface DataSourceMetadataProvider { listCatalogs(ctx: Context, input: ListCatalogsInput): ListCatalogsOutput | Promise; listTables(ctx: Context, input: ListTablesInput): ListTablesOutput | Promise; describeTable(ctx: Context, input: DescribeTableInput): DescribeTableOutput | Promise; authorizeQuery?: DataSourceQueryAuthorizer; } export interface StaticDataSourceMetadata { catalogs: DataSourceCatalog[]; tables: DataSourceTableListing[]; definitions: DataSourceTableDefinition[]; samples?: Record[]>; } export declare const DataSourceSamplePolicy: { readonly maxRows: 10; readonly maxBytes: number; }; export type DataSourceIngestionEventRow> = Row & { channel_id: string; dedup_key: string; source_updated_at: string; event_type: string; source?: string; raw?: unknown; }; export interface CreateDataSourceIngestionEventRowInput> { channelId: string; logicalId: string; eventType: string; sourceUpdatedAt: string | Date; row?: Row; raw?: unknown; source?: string; kind?: string; dedupKeyParts?: readonly unknown[]; } export declare function createDataSourceIngestionEventRow>(input: CreateDataSourceIngestionEventRowInput): DataSourceIngestionEventRow; export declare function createDataSourceDedupKey(input: { channelId: string; logicalId: string; eventType: string; sourceUpdatedAt: string | Date; kind?: string; fingerprint?: readonly unknown[]; }): string; export declare function normalizeDataSourceTimestamp(value: string | Date): string; export declare function validateDataSourceSample(definition: DataSourceTableDefinition, sample: Record[]): void; export declare function createDataSourceExtension(provider: DataSourceMetadataProvider): ExtensionDefinition; export declare function createStaticDataSourceExtension(metadata: StaticDataSourceMetadata): ExtensionDefinition; export {}; //# sourceMappingURL=datasource.d.ts.map