import * as API from "@distilled.cloud/core/api";
// AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-tinybird/specs/api-reference). Do not edit.
import * as S from "@distilled.cloud/core/schema-lite";
import * as __L from "@distilled.cloud/core/schema-lite";
import type * as Redacted from "effect/Redacted";
import { TinybirdServiceErrors } from "../errors.ts";
import { TinybirdProtocol, type TinybirdOpError, type TinybirdOpContext } from "../protocol.ts";
import * as Retry from "../retry.ts";
import * as T from "../traits.ts";
// Schema table, filled on first reach (see __S at the end).
const __s: any[] = [];
export type { TinybirdOpError, TinybirdOpContext };
/** Span facts shared by every operation (com.distilled.telemetry#service). */
const TELEMETRY = {
system: "tinybird-api",
responseHeaders: [
{ header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
{ header: "request-id", name: "http.response.header.request-id", transform: "list" },
],
prefix: "Tinybird",
service: "Datasource",
labels: "tinybird",
propagate: "w3c",
} as const;
export interface AlterDatasourceRequest {
datasource: string;
/** Optional. Set the whole schema that adds new columns to the existing ones of a Data Source. */
schema?: string | undefined;
/** Optional. Sets the description of the Data Source. */
description?: string | undefined;
/** Optional. Default: false. When set to true, the 'value' column of a Kafka Data Source will save the JSON as a raw string. */
kafka_store_raw_value?: boolean | undefined;
/** Optional. Default: false. When set to true, the 'headers' of a Kafka Data Source will be saved as a binary map. */
kafka_store_headers?: boolean | undefined;
/** Optional. Set to any value accepted in ClickHouse for a TTL or to 'false' to remove the TTL. See example below. */
ttl?: string | undefined;
/** Optional. Default: false. Set to true to show what would be modified in the Data Source, without running any modification at all. */
dry?: boolean | undefined;
}
export type AlterDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type AlterDatasourceResponse = AlterDatasourceResponseBodyMap;
export interface CreateDatasourceRequest {
/** Default: `create`. Other modes: `append` and `replace`.
The `create` mode creates a new Data Source and attempts to import the data of the CSV if a URL is provided or the body contains any data.
The `append` mode inserts the new rows provided into an existing Data Source (it will also create it if it does not exist yet).
The `replace` mode will remove the previous Data Source and its data and replace it with the new one; Pipes or queries pointing to this Data Source will immediately start returning data from the new one and without disruption once the replace operation is complete.
The `create` mode will automatically name the Data Source if no `name` parameter is provided; for the `append` and `replace` modes to work, the `name` parameter must be provided and the schema must be compatible. */
mode?: string | undefined;
/** Optional. Name of the Data Source to create, append or replace data. This parameter is mandatory when using the `append` or `replace` modes. */
name?: string | undefined;
/** Optional. The URL of the CSV with the data to be imported */
url?: string | undefined;
/** Optional. The one-character string separating the fields. We try to guess the delimiter based on the CSV contents using some statistics, but sometimes we fail to identify the correct one. If you know your CSV's field delimiter, you can use this parameter to explicitly define it. */
dialect_delimiter?: string | undefined;
/** Optional. The one- or two-character string separating the records. We try to guess the delimiter based on the CSV contents using some statistics, but sometimes we fail to identify the correct one. If you know your CSV's record delimiter, you can use this parameter to explicitly define it. */
dialect_new_line?: string | undefined;
/** Optional. The escapechar removes any special meaning from the following character. This is useful if the CSV does not use double quotes to encapsulate a column but uses double quotes in the content of a column and it is escaped with, e.g. a backslash. */
dialect_escapechar?: string | undefined;
/** Optional. Data Source schema in the format 'column_name Type, column_name_2 Type2...'. When creating a Data Source with format `ndjson` the `schema` must include the `jsonpath` for each column, see the `JSONPaths` section for more details. */
schema?: string | undefined;
/** Optional. Index definitions, one per line, to create alongside the Data Source. */
indexes?: string | undefined;
/** Optional. Engine for the underlying data. Requires the `schema` parameter. */
engine?: string | undefined;
/** Default: `false`. When using `true` and sending the data in the request body, Tinybird will return block status while loading using Line-delimited JSON. */
progress?: string | undefined;
/** Auth token with create or append permissions. Required only if no Bearer Authorization header is found */
token?: string | Redacted.Redacted | undefined;
/** Default: `true` The `type_guessing` parameter is not taken into account when replacing or appending data to an existing Data Source. When using `false` all columns are created as `String` otherwise it tries to guess the column types based on the CSV contents. Sometimes you are not familiar with the data and the first step is to get familiar with it: by disabling the type guessing, we enable you to quickly import everything as strings that you can explore with SQL and cast to the right type or shape in whatever way you see fit via a Pipe. */
type_guessing?: string | undefined;
/** Optional. Enables returning debug information from logs. It can include `blocks`, `block_log` and/or `hook_log` */
debug?: string | undefined;
/** Optional. When used in combination with the `replace` mode it allows you to replace a portion of your Data Source that matches the `replace_condition` SQL statement with the contents of the `url` or query passed as a parameter. See this [guide](https://www.tinybird.co/guide/replacing-and-deleting-data#replace-data-selectively) to learn more. */
replace_condition?: string | undefined;
/** Optional. When `true` and using `mode=replace`, incompatible rows that do not match the partition key are skipped instead of failing the operation. */
skip_incompatible_partition_key?: boolean | undefined;
/** Default: `csv`. Indicates the format of the data to be ingested in the Data Source. By default is `csv` and you should specify `format=ndjson` for NDJSON format, and `format=parquet` for Parquet files. */
format?: string | undefined;
/** Optional. Connector service used for managed imports. Supported values: `s3`, `s3_iamrole`, `gcs` or `dynamodb`. */
service?: string | undefined;
/** Optional. Connector identifier to use together with `service` when importing from external sources (required for S3/GCS/DynamoDB). */
connector?: string | undefined;
/** Required when `service` is `s3`, `s3_iamrole` or `gcs`. URI of the bucket to ingest from, following the provider naming rules. */
bucket_uri?: string | undefined;
/** Optional when using a bucket `service`. ISO 8601 timestamp that sets the earliest object modification time to ingest. */
from_time?: string | undefined;
/** Optional when using a bucket `service`. ISO 8601 timestamp that sets the latest object modification time to ingest. For @auto ingestion from blob storages, it is ignored. */
to_time?: string | undefined;
/** Required when `service` is `dynamodb`. ARN of the DynamoDB table to ingest. */
dynamodb_table_arn?: string | undefined;
/** A local CSV file to import (multipart part `csv`). */
csv?: Uint8Array | undefined;
/** A local NDJSON file to import (multipart part `ndjson`). */
ndjson?: Uint8Array | undefined;
/** Engine sorting key (`ORDER BY`). */
engine_sorting_key?: string | undefined;
/** ReplacingMergeTree version column. */
engine_ver?: string | undefined;
/** Engine settings, e.g. `index_granularity=2048, ttl_only_drop_parts=false`. */
engine_settings?: string | undefined;
}
export type CreateDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type CreateDatasourceResponse = CreateDatasourceResponseBodyMap;
export interface DeleteDatasourceRequest {
datasource: string;
/** Default: `false` . The `force` parameter is taken into account when trying to delete Materialized Views. By default, when using `false` the deletion will not be carried out; you can enable it by setting it to `true`. If the given Data Source is being used as the trigger of a Materialized Node, it will not be deleted in any case. */
force?: string | undefined;
/** Default: `false`. It allows you to test the deletion. When using `true` it will execute all deletion validations and return the possible affected materializations and other dependencies of a given Data Source. */
dry_run?: string | undefined;
/** Auth token. Only required if no Bearer Authorization header is sent. It must have `DROP:datasource_name` scope for the given Data Source. */
token?: string | Redacted.Redacted | undefined;
}
export type DeleteDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type DeleteDatasourceResponse = DeleteDatasourceResponseBodyMap;
export interface DeleteDatasourceRowsRequest {
datasource: string;
/** Mandatory. A string representing the WHERE SQL clause you'd add to a regular DELETE FROM WHERE statement. Most of the times you might want to write a simple `delete_condition` such as `column_name=value` but any valid SQL statement including conditional operators is valid */
delete_condition: string;
/** Default: `false`. It allows you to test the deletion. When using `true` it will execute all deletion validations and return number of matched `rows_to_be_deleted`. */
dry_run?: string | undefined;
}
export type DeleteDatasourceRowsResponseBodyMap = { [key: string]: unknown | undefined };
export type DeleteDatasourceRowsResponse = DeleteDatasourceRowsResponseBodyMap;
export interface GetDatasourceRequest {
datasource: string;
/** comma separated list of the Data Source attributes to return in the response. Example: `attrs=name,id,engine`. Leave empty to return a full response */
attrs?: string | undefined;
}
export type GetDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type GetDatasourceResponse = GetDatasourceResponseBodyMap;
export interface ListDatasourcesRequest {
/** comma separated list of the Data Source attributes to return in the response. Example: `attrs=name,id,engine`. Leave empty to return a full response */
attrs?: string | undefined;
}
export type ListDatasourcesResponseBodyMap = { [key: string]: unknown | undefined };
export type ListDatasourcesResponse = ListDatasourcesResponseBodyMap;
export interface TruncateDatasourceRequest {
datasource: string;
}
export type TruncateDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type TruncateDatasourceResponse = TruncateDatasourceResponseBodyMap;
export interface UpdateDatasourceRequest {
datasource: string;
/** new name for the Data Source */
name?: string | undefined;
/** Auth token. Only required if no Bearer Authorization header is sent. It should have `DATASOURCES:CREATE` scope for the given Data Source */
token?: string | Redacted.Redacted | undefined;
/** Connector ID to link it to */
connector?: string | undefined;
/** Optional: custom query to collect from the external data source */
query?: string | undefined;
}
export type UpdateDatasourceResponseBodyMap = { [key: string]: unknown | undefined };
export type UpdateDatasourceResponse = UpdateDatasourceResponseBodyMap;
export type AlterDatasourceError = TinybirdOpError;
/** Modify the Data Source schema. This endpoint supports the operation to alter the following fields of a Data Source: The schema parameter can be used to add new columns at the end of the existing ones in a Data Source. Be aware that currently we don't validate if the change will affect the existing MVs (Materialized Views) attached to the Data Source to be modified, so this change may break existing MVs. For example, avoid changing a Data Source that has a MV created with something like `SELECT * FROM Data Source ...`. If you want to have forward compatible MVs with column additions, create them especifying the columns instead of using the `*` operator. Also, take in account that, for now, the only engines supporting adding new columns are those inside the MergeTree family. To add a column to a Data Source, call this endpoint with the Data Source name and the new schema definition. For example, having a Data Source created like this: if you want to add a new column 'concept String', you need to call this endpoint with the new schema: If everything went ok, you will get the operations done in the response: You can also view the inferred operations without executing them adding `dry=true` in the parameters. - To modify the description of a Data Source: - To save in the "value" column of a Kafka Data Source the JSON as a raw string: - To modify the TTL of a Data Source: - Use a time-based column from the datasource schema (e.g. a DateTime column). - Express the TTL in valid ClickHouse syntax using toInterval*() functions. - URL-encode the expression to ensure it's parsed correctly. Supported intervals include toIntervalMinute(), toIntervalHour(), toIntervalDay(), toIntervalMonth(), etc. - To remove the TTL of a Data Source: - To add default values to the columns of a Data Source: - To add default values to the columns of a NDJSON Data Source, add the default definition after the jsonpath definition: - To make a column nullable, change the type of the column adding the Nullable type prefix to old one: - To drop a column, just remove the column from the schema definition. It will not be possible removing columns that are part of the primary or partition key: You can also alter the JSONPaths of existing Data Sources. In that case you have to specify the [JSONPath](/docs/guides/ingesting-data/ingest-ndjson-data) in the schema in the same way as when you created the Data Source. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const alterDatasource: API.OperationMethod<
AlterDatasourceRequest,
AlterDatasourceResponse,
AlterDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(0, __c0, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "AlterDatasource",
}));
export type CreateDatasourceError = TinybirdOpError;
/** This endpoint supports 3 modes to enable 3 distinct operations, depending on the parameters provided: - Create a new Data Source with a schema - Append data to an existing Data Source - Replace data in an existing Data Source The mode is controlled by setting the `mode` parameter, for example, `-d "mode=create"`. Each mode has different [rate limits](/docs/api-reference/overview#limits). When importing remote files by URL, if the server hosting the remote file supports HTTP Range headers, the import process will be parallelized. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const createDatasource: API.OperationMethod<
CreateDatasourceRequest,
CreateDatasourceResponse,
CreateDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(4, __c2, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "CreateDatasource",
}));
export type DeleteDatasourceError = TinybirdOpError;
/** Drops a Data Source from your account. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const deleteDatasource: API.OperationMethod<
DeleteDatasourceRequest,
DeleteDatasourceResponse,
DeleteDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(6, __c3, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "DeleteDatasource",
}));
export type DeleteDatasourceRowsError = TinybirdOpError;
/** Deletes rows from a Data Source in your account given a SQL condition. Auth token in use must have the `DATASOURCES:CREATE` scope. When deleting rows from a Data Source, the response will not be the final result of the deletion but a Job. You can check the job status and progress using the [Jobs API](/docs/api-reference/jobs-api). In the response, `id`, `job_id`, and `delete_id` should have the same value: To check on the progress of the delete job, use the `job_id` from the Delete API response to query the [Jobs API](/docs/api-reference/jobs-api). For example, to check on the status of the above delete job: Would respond with: Tinybird uses ClickHouse as the underlying storage technology. ClickHouse features different strategies to store data, these different strategies define not only where and how the data is stored but what kind of data access, queries, and availability your data has. In ClickHouse terms, a Tinybird Data Source uses a [Table Engine](https://clickhouse.tech/docs/en/engines/table_engines/) that determines those factors. Currently, Tinybird supports deleting data for data sources with the following Engines: - MergeTree - ReplacingMergeTree - SummingMergeTree - AggregatingMergeTree - CollapsingMergeTree - VersionedCollapsingMergeTree If the Data Source has dependent Materialized Views, those won't be cascade deleted. In case you want to delete data from other dependent Materialized Views, you'll have to do a subsequent call to this method for the affected view with a proper `delete_condition`. This applies as well to the associated `quarantine` Data Source. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const deleteDatasourceRows: API.OperationMethod<
DeleteDatasourceRowsRequest,
DeleteDatasourceRowsResponse,
DeleteDatasourceRowsError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(8, __c4, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "DeleteDatasourceRows",
}));
export type GetDatasourceError = TinybirdOpError;
/** Get Data Source information and stats. The token provided must have read access to the Data Source. `id` and `name` are two ways to refer to the Data Source in SQL queries and API endpoints. The only difference is that the `id` never changes; it will work even if you change the `name` (which is the name used to display the Data Source in the UI). In general you can use `id` or `name` indistinctively: Using the above response as an example: `select count(1) from events_table` is equivalent to `select count(1) from t_bd1c62b5e67142bd9bf9a7f113a2b6ea` The id `t_bd1c62b5e67142bd9bf9a7f113a2b6ea` is not a descriptive name so you can add a description like `t_my_events_datasource.bd1c62b5e67142bd9bf9a7f113a2b6ea` The `statistics` property contains information about the table. Those numbers are an estimation: `bytes` is the estimated data size on disk and `row_count` the estimated number of rows. These statistics are updated whenever data is appended to the Data Source. The `used_by` property contains the list of pipes that are using this data source. Only Pipe `id` and `name` are sent. The `type` property indicates the `format` used when the Data Source was created. Available formats are `csv`, `ndjson`, and `parquet`. The Data Source `type` indicates what file format you can use to ingest data. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const getDatasource: API.OperationMethod<
GetDatasourceRequest,
GetDatasourceResponse,
GetDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(10, __c5, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "GetDatasource",
}));
export type ListDatasourcesError = TinybirdOpError;
/** Get a list of the Data Sources in your account. The token you use to query the available Data Sources will determine what Data Sources get returned: only those accessible with the token you are using will be returned in the response. Note that the `statistics`'s `bytes` and `row_count` attributes might be `null` depending on how the Data Source was created. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const listDatasources: API.OperationMethod<
ListDatasourcesRequest,
ListDatasourcesResponse,
ListDatasourcesError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(12, __c6, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "ListDatasources",
}));
export type TruncateDatasourceError = TinybirdOpError;
/** Truncates a Data Source in your account. If the Data Source has dependent Materialized Views, those **won't** be truncated in cascade. In case you want to delete data from other dependent Materialized Views, you'll have to do a subsequent call to this method. Auth token in use must have the `DATASOURCES:CREATE` scope. This works as well for the `quarantine` table of a Data Source. Remember that the quarantine table for a Data Source has the same name but with the "_quarantine" suffix. Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const truncateDatasource: API.OperationMethod<
TruncateDatasourceRequest,
TruncateDatasourceResponse,
TruncateDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(14, __c7, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "TruncateDatasource",
}));
export type UpdateDatasourceError = TinybirdOpError;
/** Update Data Source attributes Reference: https://www.tinybird.co/docs/api-reference/datasource-api */
export const updateDatasource: API.OperationMethod<
UpdateDatasourceRequest,
UpdateDatasourceResponse,
UpdateDatasourceError,
TinybirdOpContext
> = /*@__PURE__*/ API.make(() => ({
input: __S(16, __c8, 0) as any as S.Schema,
output: __S(3, __c1, 1) as any as S.Schema,
errors: [],
serviceErrors: TinybirdServiceErrors,
protocol: TinybirdProtocol,
retry: Retry.Retry,
telemetry: TELEMETRY,
span: "UpdateDatasource",
}));
// Schema builders: each runs one schema initializer, on that schema's first use.
function __c0(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
schema: S.optional(S.String.pipe(T.Query())),
description: S.optional(S.String.pipe(T.Query())),
kafka_store_raw_value: S.optional(S.Boolean.pipe(T.Query())),
kafka_store_headers: S.optional(S.Boolean.pipe(T.Query())),
ttl: S.optional(S.String.pipe(T.Query())),
dry: S.optional(S.Boolean.pipe(T.Query())),
}).pipe(T.Http({ method: "POST", uri: "/v0/datasources/{datasource}/alter", code: 200 })),
).annotate({ identifier: "AlterDatasourceRequest" });
}
}
function __c1(j: number): any {
switch (j) {
case 0:
return S.Record(S.String, S.Unknown);
case 1:
return S.suspend(() => __S(2, __c1, 0).pipe(T.RawResponseRoot())).annotate({
identifier: "AlterDatasourceResponse",
});
}
}
function __c2(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
mode: S.optional(S.String.pipe(T.Query())),
name: S.optional(S.String.pipe(T.Query())),
url: S.optional(S.String.pipe(T.Query())),
dialect_delimiter: S.optional(S.String.pipe(T.Query())),
dialect_new_line: S.optional(S.String.pipe(T.Query())),
dialect_escapechar: S.optional(S.String.pipe(T.Query())),
schema: S.optional(S.String.pipe(T.Query())),
indexes: S.optional(S.String.pipe(T.Query())),
engine: S.optional(S.String.pipe(T.Query())),
progress: S.optional(S.String.pipe(T.Query())),
token: S.optional(S.String.pipe(T.Query(), T.SensitiveValue({}))),
type_guessing: S.optional(S.String.pipe(T.Query())),
debug: S.optional(S.String.pipe(T.Query())),
replace_condition: S.optional(S.String.pipe(T.Query())),
skip_incompatible_partition_key: S.optional(S.Boolean.pipe(T.Query())),
format: S.optional(S.String.pipe(T.Query())),
service: S.optional(S.String.pipe(T.Query())),
connector: S.optional(S.String.pipe(T.Query())),
bucket_uri: S.optional(S.String.pipe(T.Query())),
from_time: S.optional(S.String.pipe(T.Query())),
to_time: S.optional(S.String.pipe(T.Query())),
dynamodb_table_arn: S.optional(S.String.pipe(T.Query())),
csv: S.optional(S.instanceOf(Uint8Array)),
ndjson: S.optional(S.instanceOf(Uint8Array)),
engine_sorting_key: S.optional(S.String.pipe(T.Query())),
engine_ver: S.optional(S.String.pipe(T.Query())),
engine_settings: S.optional(S.String.pipe(T.Query())),
}).pipe(
T.Http({ method: "POST", uri: "/v0/datasources", code: 200, contentType: "multipart" }),
),
).annotate({ identifier: "CreateDatasourceRequest" });
}
}
function __c3(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
force: S.optional(S.String.pipe(T.Query())),
dry_run: S.optional(S.String.pipe(T.Query())),
token: S.optional(S.String.pipe(T.Query(), T.SensitiveValue({}))),
}).pipe(T.Http({ method: "DELETE", uri: "/v0/datasources/{datasource}", code: 200 })),
).annotate({ identifier: "DeleteDatasourceRequest" });
}
}
function __c4(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
delete_condition: S.String.pipe(T.Query()),
dry_run: S.optional(S.String.pipe(T.Query())),
}).pipe(T.Http({ method: "POST", uri: "/v0/datasources/{datasource}/delete", code: 200 })),
).annotate({ identifier: "DeleteDatasourceRowsRequest" });
}
}
function __c5(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
attrs: S.optional(S.String.pipe(T.Query())),
}).pipe(T.Http({ method: "GET", uri: "/v0/datasources/{datasource}", code: 200 })),
).annotate({ identifier: "GetDatasourceRequest" });
}
}
function __c6(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
attrs: S.optional(S.String.pipe(T.Query())),
}).pipe(T.Http({ method: "GET", uri: "/v0/datasources", code: 200 })),
).annotate({ identifier: "ListDatasourcesRequest" });
}
}
function __c7(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
}).pipe(
T.Http({ method: "POST", uri: "/v0/datasources/{datasource}/truncate", code: 200 }),
),
).annotate({ identifier: "TruncateDatasourceRequest" });
}
}
function __c8(j: number): any {
switch (j) {
case 0:
return S.suspend(() =>
S.Struct({
datasource: S.String.pipe(T.Label()),
name: S.optional(S.String.pipe(T.Query())),
token: S.optional(S.String.pipe(T.Query(), T.SensitiveValue({}))),
connector: S.optional(S.String.pipe(T.Query())),
query: S.optional(S.String.pipe(T.Query())),
}).pipe(T.Http({ method: "PUT", uri: "/v0/datasources/{datasource}", code: 200 })),
).annotate({ identifier: "UpdateDatasourceRequest" });
}
}
// Schema table: entry i is schema j of builder f, made on first reach.
function __S(i: number, f: (j: number) => unknown, j: number): any {
return (__s[i] ??= __L.at(f, j));
}