Skip to content

@sqlrooms/room-config / DataSource

Type Alias: DataSource

DataSource: { tableName: string; type: "file"; fileName: string; loadOptions: objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">; } | { tableName: string; type: "url"; url: string; loadOptions: objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">; httpMethod: string; headers: Record<string, string>; } | { tableName: string; type: "sql"; sqlQuery: string; }

Union type representing all possible data source configurations Discriminated union based on the 'type' field

Type declaration

{ tableName: string; type: "file"; fileName: string; loadOptions: objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">; }

NameTypeDescription
tableNamestringUnique table name used to store the data loaded from the data source. This name will be used to reference the data in SQL queries.
type"file"-
fileNamestringPath to the data file
loadOptions?objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">Optional configuration for file loading

{ tableName: string; type: "url"; url: string; loadOptions: objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">; httpMethod: string; headers: Record<string, string>; }

NameTypeDescription
tableNamestringUnique table name used to store the data loaded from the data source. This name will be used to reference the data in SQL queries.
type"url"-
urlstringURL from which to fetch the data
loadOptions?objectOutputType<object & object & object, ZodUnknown, "strip"> | objectOutputType<object & object, ZodUnknown, "strip">Optional configuration for file loading
httpMethod?stringOptional HTTP method to use for the request
headers?Record<string, string>Optional headers to include in the request

{ tableName: string; type: "sql"; sqlQuery: string; }

NameTypeDescription
tableNamestringUnique table name used to store the data loaded from the data source. This name will be used to reference the data in SQL queries.
type"sql"-
sqlQuerystringSQL query to execute for data retrieval