import {z} from 'zod' export type RedshiftAuthenticationType = 'password' | 'iam' | 'iam_browser'; export type WeekDay = number; export type WarehouseTypesREDSHIFT = 'redshift'; export type CreateRedshiftCredentials = {sshTunnelPrivateKey?: string | undefined, sshTunnelPublicKey?: string | undefined, sshTunnelUser?: string | undefined, sshTunnelPort?: number | undefined, sshTunnelHost?: string | undefined, useSshTunnel?: boolean | undefined, awsSsoRoleName?: string | undefined, awsSsoAccountId?: string | undefined, awsSsoRegion?: string | undefined, awsSsoStartUrl?: string | undefined, assumeRoleExternalId?: string | undefined, assumeRoleArn?: string | undefined, sessionToken?: string | undefined, secretAccessKey?: string | undefined, accessKeyId?: string | undefined, dbGroups?: Array | undefined, autoCreate?: boolean | undefined, workgroupName?: string | undefined, clusterIdentifier?: string | undefined, isServerless?: boolean | undefined, region?: string | undefined, authenticationType?: RedshiftAuthenticationType | undefined, timeoutSeconds?: number | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, ra3Node?: boolean | undefined, sslmode?: string | undefined, keepalivesIdle?: number | undefined, threads?: number | undefined, schema: string, dbname: string, port: number, requireUserCredentials?: boolean | undefined, password?: string | undefined, user: string, host: string, type: WarehouseTypesREDSHIFT}; export type BigqueryAuthenticationType = 'sso' | 'private_key' | 'adc'; export type WarehouseTypesBIGQUERY = 'bigquery'; export type CreateBigqueryCredentials = {accessUrl?: string | undefined, executionProject?: string | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, maximumBytesBilled?: number | undefined, location?: string | undefined, retries?: number | undefined, requireUserCredentials?: boolean | undefined, keyfileContents: {[key: string]: string}, authenticationType?: BigqueryAuthenticationType | undefined, priority?: ('interactive' | 'batch') | undefined, timeoutSeconds?: number | undefined, threads?: number | undefined, dataset: string, project: string, type: WarehouseTypesBIGQUERY}; export type WarehouseTypesPOSTGRES = 'postgres'; export type CreatePostgresCredentials = {sshTunnelPrivateKey?: string | undefined, sshTunnelPublicKey?: string | undefined, sshTunnelUser?: string | undefined, sshTunnelPort?: number | undefined, sshTunnelHost?: string | undefined, useSshTunnel?: boolean | undefined, sslrootcert?: (string | null) | undefined, sslrootcertFileName?: string | undefined, sslkey?: (string | null) | undefined, sslkeyFileName?: string | undefined, sslcert?: (string | null) | undefined, sslcertFileName?: string | undefined, sslmode?: string | undefined, timeoutSeconds?: number | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, role?: string | undefined, searchPath?: string | undefined, keepalivesIdle?: number | undefined, threads?: number | undefined, schema: string, dbname: string, port: number, requireUserCredentials?: boolean | undefined, password: string, user: string, host: string, type: WarehouseTypesPOSTGRES}; export type SnowflakeAuthenticationType = 'password' | 'private_key' | 'sso' | 'external_browser' | 'oauth_authorization_code' | 'none'; export type WarehouseTypesSNOWFLAKE = 'snowflake'; export type CreateSnowflakeCredentials = {organizationWarehouseCredentialsUuid?: string | undefined, override?: boolean | undefined, timeoutSeconds?: number | undefined, disableTimestampConversion?: boolean | undefined, quotedIdentifiersIgnoreCase?: boolean | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, accessUrl?: string | undefined, queryTag?: string | undefined, clientSessionKeepAlive?: boolean | undefined, threads?: number | undefined, schema: string, warehouse: string, database: string, role?: string | undefined, token?: string | undefined, refreshToken?: string | undefined, authenticationType?: SnowflakeAuthenticationType | undefined, privateKeyPass?: string | undefined, privateKey?: string | undefined, requireUserCredentials?: boolean | undefined, password?: string | undefined, user: string, account: string, type: WarehouseTypesSNOWFLAKE}; export type DatabricksAuthenticationType = 'personal_access_token' | 'oauth_m2m' | 'oauth_u2m'; export type WarehouseTypesDATABRICKS = 'databricks'; export type CreateDatabricksCredentials = {compute?: Array<{httpPath: string, name: string}> | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, requireUserCredentials?: boolean | undefined, oauthClientSecret?: string | undefined, oauthClientId?: string | undefined, token?: string | undefined, refreshToken?: string | undefined, personalAccessToken?: string | undefined, authenticationType?: DatabricksAuthenticationType | undefined, httpPath: string, serverHostName: string, database: string, catalog?: string | undefined, type: WarehouseTypesDATABRICKS}; export type WarehouseTypesTRINO = 'trino'; export type CreateTrinoCredentials = {dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, source?: string | undefined, http_scheme: string, schema: string, dbname: string, port: number, requireUserCredentials?: boolean | undefined, password: string, user: string, host: string, type: WarehouseTypesTRINO}; export type WarehouseTypesCLICKHOUSE = 'clickhouse'; export type CreateClickhouseCredentials = {timeoutSeconds?: number | undefined, dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, secure?: boolean | undefined, schema: string, port: number, requireUserCredentials?: boolean | undefined, password: string, user: string, host: string, type: WarehouseTypesCLICKHOUSE}; export type AthenaAuthenticationType = 'access_key' | 'iam_role'; export type WarehouseTypesATHENA = 'athena'; export type CreateAthenaCredentials = {dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, requireUserCredentials?: boolean | undefined, numRetries?: number | undefined, threads?: number | undefined, workGroup?: string | undefined, assumeRoleExternalId?: string | undefined, assumeRoleArn?: string | undefined, sessionToken?: string | undefined, secretAccessKey?: string | undefined, accessKeyId?: string | undefined, authenticationType?: AthenaAuthenticationType | undefined, s3DataDir?: string | undefined, s3StagingDir: string, schema: string, database: string, region: string, type: WarehouseTypesATHENA}; export type DuckdbConnectionTypeMOTHERDUCK = 'motherduck'; export type WarehouseTypesDUCKDB = 'duckdb'; export type CreateDuckdbMotherduckCredentials = {dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, requireUserCredentials?: boolean | undefined, threads?: number | undefined, token: string, schema: string, database: string, connectionType: DuckdbConnectionTypeMOTHERDUCK, type: WarehouseTypesDUCKDB}; export type DucklakeDataPathTypeS3 = 's3'; export type CreateDucklakeDataPathS3 = {useSsl?: boolean | undefined, forcePathStyle?: boolean | undefined, secretAccessKey?: string | undefined, accessKeyId?: string | undefined, region?: string | undefined, endpoint?: string | undefined, url: string, type: DucklakeDataPathTypeS3}; export type DucklakeDataPathTypeGCS = 'gcs'; export type CreateDucklakeDataPathGcs = {hmacSecret?: string | undefined, hmacKeyId?: string | undefined, url: string, type: DucklakeDataPathTypeGCS}; export type DucklakeDataPathTypeAZURE = 'azure'; export type CreateDucklakeDataPathAzure = {accountKey?: string | undefined, accountName?: string | undefined, connectionString?: string | undefined, url: string, type: DucklakeDataPathTypeAZURE}; export type DucklakeDataPathTypeLOCAL = 'local'; export type CreateDucklakeDataPathLocal = {path: string, type: DucklakeDataPathTypeLOCAL}; export type CreateDucklakeDataPath = CreateDucklakeDataPathS3 | CreateDucklakeDataPathGcs | CreateDucklakeDataPathAzure | CreateDucklakeDataPathLocal; export type DucklakeCatalogTypePOSTGRES = 'postgres'; export type CreateDucklakeCatalogPostgres = {password: string, user: string, database: string, port: number, host: string, type: DucklakeCatalogTypePOSTGRES}; export type DucklakeCatalogTypeSQLITE = 'sqlite'; export type CreateDucklakeCatalogSqlite = {path: string, type: DucklakeCatalogTypeSQLITE}; export type DucklakeCatalogTypeDUCKDB = 'duckdb'; export type CreateDucklakeCatalogDuckdb = {path: string, type: DucklakeCatalogTypeDUCKDB}; export type CreateDucklakeCatalog = CreateDucklakeCatalogPostgres | CreateDucklakeCatalogSqlite | CreateDucklakeCatalogDuckdb; export type DuckdbConnectionTypeDUCKLAKE = 'ducklake'; export type CreateDuckdbDucklakeCredentials = {dataTimezone?: string | undefined, startOfWeek?: (WeekDay | null) | undefined, requireUserCredentials?: boolean | undefined, threads?: number | undefined, catalogAlias?: string | undefined, schema: string, dataPath: CreateDucklakeDataPath, catalog: CreateDucklakeCatalog, connectionType: DuckdbConnectionTypeDUCKLAKE, type: WarehouseTypesDUCKDB}; export type DuckdbConnectionTypeEMBEDDED = 'embedded'; export type CreateDuckdbEmbeddedCredentials = {schema?: string | undefined, startOfWeek?: number | undefined, dataTimezone?: string | undefined, requireUserCredentials?: boolean | undefined, dataset: string, connectionType: DuckdbConnectionTypeEMBEDDED, type: WarehouseTypesDUCKDB}; export type CreateDuckdbCredentials = CreateDuckdbMotherduckCredentials | CreateDuckdbDucklakeCredentials | CreateDuckdbEmbeddedCredentials; export type CreateWarehouseCredentials = CreateRedshiftCredentials | CreateBigqueryCredentials | CreatePostgresCredentials | CreateSnowflakeCredentials | CreateDatabricksCredentials | CreateTrinoCredentials | CreateClickhouseCredentials | CreateAthenaCredentials | CreateDuckdbCredentials; export type UpdateOrganizationWarehouseCredentials = {credentials?: CreateWarehouseCredentials | undefined, description?: (string | null) | undefined, name?: string | undefined}; export type PatchApiApiV1OrgWarehouseCredentialsCredentialsUuidArgs = {credentialsUuid: string, body: UpdateOrganizationWarehouseCredentials}; export type PatchApiApiV1OrgWarehouseCredentialsCredentialsUuidOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; export const warehouseTypesSNOWFLAKE = z.literal("snowflake"); export const snowflakeAuthenticationType = z.enum(["password", "private_key", "sso", "external_browser", "oauth_authorization_code", "none"]); export const weekDay = z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(4), z.literal(5), z.literal(6)]); export const pickCreateSnowflakeCredentialsExcludeKeyofCreateSnowflakeCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesSNOWFLAKE, account: z.string(), requireUserCredentials: z.boolean().optional(), authenticationType: snowflakeAuthenticationType.optional(), role: z.string().optional(), database: z.string(), warehouse: z.string(), schema: z.string(), threads: z.number().optional(), clientSessionKeepAlive: z.boolean().optional(), queryTag: z.string().optional(), accessUrl: z.string().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), quotedIdentifiersIgnoreCase: z.boolean().optional(), disableTimestampConversion: z.boolean().optional(), timeoutSeconds: z.number().optional(), override: z.boolean().optional(), organizationWarehouseCredentialsUuid: z.string().optional()}); export const snowflakeCredentials = pickCreateSnowflakeCredentialsExcludeKeyofCreateSnowflakeCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesREDSHIFT = z.literal("redshift"); export const redshiftAuthenticationType = z.enum(["password", "iam", "iam_browser"]); export const pickCreateRedshiftCredentialsExcludeKeyofCreateRedshiftCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesREDSHIFT, requireUserCredentials: z.boolean().optional(), authenticationType: redshiftAuthenticationType.optional(), schema: z.string(), threads: z.number().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), timeoutSeconds: z.number().optional(), useSshTunnel: z.boolean().optional(), sshTunnelHost: z.string().optional(), sshTunnelPort: z.number().optional(), sshTunnelUser: z.string().optional(), sshTunnelPublicKey: z.string().optional(), host: z.string(), port: z.number(), dbname: z.string(), keepalivesIdle: z.number().optional(), sslmode: z.string().optional(), ra3Node: z.boolean().optional(), region: z.string().optional(), isServerless: z.boolean().optional(), clusterIdentifier: z.string().optional(), workgroupName: z.string().optional(), autoCreate: z.boolean().optional(), dbGroups: z.array(z.string()).optional(), assumeRoleArn: z.string().optional(), assumeRoleExternalId: z.string().optional(), awsSsoStartUrl: z.string().optional(), awsSsoRegion: z.string().optional(), awsSsoAccountId: z.string().optional(), awsSsoRoleName: z.string().optional()}); export const redshiftCredentials = pickCreateRedshiftCredentialsExcludeKeyofCreateRedshiftCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesPOSTGRES = z.literal("postgres"); export const pickCreatePostgresCredentialsExcludeKeyofCreatePostgresCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesPOSTGRES, requireUserCredentials: z.boolean().optional(), role: z.string().optional(), schema: z.string(), threads: z.number().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), timeoutSeconds: z.number().optional(), useSshTunnel: z.boolean().optional(), sshTunnelHost: z.string().optional(), sshTunnelPort: z.number().optional(), sshTunnelUser: z.string().optional(), sshTunnelPublicKey: z.string().optional(), host: z.string(), port: z.number(), dbname: z.string(), keepalivesIdle: z.number().optional(), sslmode: z.string().optional(), sslcertFileName: z.string().optional(), sslkeyFileName: z.string().optional(), sslrootcertFileName: z.string().optional(), searchPath: z.string().optional()}); export const postgresCredentials = pickCreatePostgresCredentialsExcludeKeyofCreatePostgresCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesBIGQUERY = z.literal("bigquery"); export const bigqueryAuthenticationType = z.enum(["sso", "private_key", "adc"]); export const pickCreateBigqueryCredentialsExcludeKeyofCreateBigqueryCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesBIGQUERY, requireUserCredentials: z.boolean().optional(), authenticationType: bigqueryAuthenticationType.optional(), threads: z.number().optional(), accessUrl: z.string().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), timeoutSeconds: z.number().optional(), project: z.string(), dataset: z.string(), priority: z.enum(["interactive", "batch"]).optional(), retries: z.number().optional(), location: z.string().optional(), maximumBytesBilled: z.number().optional(), executionProject: z.string().optional()}); export const bigqueryCredentials = pickCreateBigqueryCredentialsExcludeKeyofCreateBigqueryCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesDATABRICKS = z.literal("databricks"); export const databricksAuthenticationType = z.enum(["personal_access_token", "oauth_m2m", "oauth_u2m"]); export const pickCreateDatabricksCredentialsExcludeKeyofCreateDatabricksCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesDATABRICKS, catalog: z.string().optional(), requireUserCredentials: z.boolean().optional(), authenticationType: databricksAuthenticationType.optional(), database: z.string(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), serverHostName: z.string(), httpPath: z.string(), compute: z.array(z.object({httpPath: z.string(), name: z.string()})).optional()}); export const databricksCredentials = pickCreateDatabricksCredentialsExcludeKeyofCreateDatabricksCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesTRINO = z.literal("trino"); export const pickCreateTrinoCredentialsExcludeKeyofCreateTrinoCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesTRINO, requireUserCredentials: z.boolean().optional(), schema: z.string(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), host: z.string(), port: z.number(), dbname: z.string(), http_scheme: z.string(), source: z.string().optional()}); export const trinoCredentials = pickCreateTrinoCredentialsExcludeKeyofCreateTrinoCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesCLICKHOUSE = z.literal("clickhouse"); export const pickCreateClickhouseCredentialsExcludeKeyofCreateClickhouseCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesCLICKHOUSE, requireUserCredentials: z.boolean().optional(), schema: z.string(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), timeoutSeconds: z.number().optional(), host: z.string(), port: z.number(), secure: z.boolean().optional()}); export const clickhouseCredentials = pickCreateClickhouseCredentialsExcludeKeyofCreateClickhouseCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesATHENA = z.literal("athena"); export const athenaAuthenticationType = z.enum(["access_key", "iam_role"]); export const pickCreateAthenaCredentialsExcludeKeyofCreateAthenaCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesATHENA, requireUserCredentials: z.boolean().optional(), authenticationType: athenaAuthenticationType.optional(), database: z.string(), schema: z.string(), threads: z.number().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), region: z.string(), assumeRoleArn: z.string().optional(), assumeRoleExternalId: z.string().optional(), s3StagingDir: z.string(), s3DataDir: z.string().optional(), workGroup: z.string().optional(), numRetries: z.number().optional()}); export const athenaCredentials = pickCreateAthenaCredentialsExcludeKeyofCreateAthenaCredentialsSensitiveCredentialsFieldNames; export const warehouseTypesDUCKDB = z.literal("duckdb"); export const duckdbConnectionTypeMOTHERDUCK = z.literal("motherduck"); export const pickCreateDuckdbMotherduckCredentialsExcludeKeyofCreateDuckdbMotherduckCredentialsSensitiveCredentialsFieldNames = z.object({type: warehouseTypesDUCKDB, requireUserCredentials: z.boolean().optional(), database: z.string(), schema: z.string(), threads: z.number().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), connectionType: duckdbConnectionTypeMOTHERDUCK}); export const duckdbMotherduckCredentials = pickCreateDuckdbMotherduckCredentialsExcludeKeyofCreateDuckdbMotherduckCredentialsSensitiveCredentialsFieldNames; export const duckdbConnectionTypeDUCKLAKE = z.literal("ducklake"); export const ducklakeDataPathTypeS3 = z.literal("s3"); export const pickCreateDucklakeDataPathS3ExcludeKeyofCreateDucklakeDataPathS3AccessKeyIdOrSecretAccessKey = z.object({type: ducklakeDataPathTypeS3, url: z.string(), region: z.string().optional(), endpoint: z.string().optional(), forcePathStyle: z.boolean().optional(), useSsl: z.boolean().optional()}); export const ducklakeDataPathS3 = pickCreateDucklakeDataPathS3ExcludeKeyofCreateDucklakeDataPathS3AccessKeyIdOrSecretAccessKey; export const ducklakeDataPathTypeGCS = z.literal("gcs"); export const pickCreateDucklakeDataPathGcsExcludeKeyofCreateDucklakeDataPathGcsHmacKeyIdOrHmacSecret = z.object({type: ducklakeDataPathTypeGCS, url: z.string()}); export const ducklakeDataPathGcs = pickCreateDucklakeDataPathGcsExcludeKeyofCreateDucklakeDataPathGcsHmacKeyIdOrHmacSecret; export const ducklakeDataPathTypeAZURE = z.literal("azure"); export const pickCreateDucklakeDataPathAzureExcludeKeyofCreateDucklakeDataPathAzureConnectionStringOrAccountKey = z.object({type: ducklakeDataPathTypeAZURE, url: z.string(), accountName: z.string().optional()}); export const ducklakeDataPathAzure = pickCreateDucklakeDataPathAzureExcludeKeyofCreateDucklakeDataPathAzureConnectionStringOrAccountKey; export const ducklakeDataPathTypeLOCAL = z.literal("local"); export const ducklakeDataPathLocal = z.object({path: z.string(), type: ducklakeDataPathTypeLOCAL}); export const ducklakeDataPath = z.union([ducklakeDataPathS3, ducklakeDataPathGcs, ducklakeDataPathAzure, ducklakeDataPathLocal]); export const ducklakeCatalogTypePOSTGRES = z.literal("postgres"); export const pickCreateDucklakeCatalogPostgresExcludeKeyofCreateDucklakeCatalogPostgresUserOrPassword = z.object({type: ducklakeCatalogTypePOSTGRES, database: z.string(), host: z.string(), port: z.number()}); export const ducklakeCatalogPostgres = pickCreateDucklakeCatalogPostgresExcludeKeyofCreateDucklakeCatalogPostgresUserOrPassword; export const ducklakeCatalogTypeSQLITE = z.literal("sqlite"); export const ducklakeCatalogSqlite = z.object({path: z.string(), type: ducklakeCatalogTypeSQLITE}); export const ducklakeCatalogTypeDUCKDB = z.literal("duckdb"); export const ducklakeCatalogDuckdb = z.object({path: z.string(), type: ducklakeCatalogTypeDUCKDB}); export const ducklakeCatalog = z.union([ducklakeCatalogPostgres, ducklakeCatalogSqlite, ducklakeCatalogDuckdb]); export const duckdbDucklakeCredentials = z.object({type: warehouseTypesDUCKDB, requireUserCredentials: z.boolean().optional(), schema: z.string(), threads: z.number().optional(), startOfWeek: weekDay.nullable().optional(), dataTimezone: z.string().optional(), connectionType: duckdbConnectionTypeDUCKLAKE, catalogAlias: z.string().optional(), dataPath: ducklakeDataPath, catalog: ducklakeCatalog}); export const duckdbConnectionTypeEMBEDDED = z.literal("embedded"); export const duckdbEmbeddedCredentials = z.object({schema: z.string().optional(), startOfWeek: z.number().optional(), dataTimezone: z.string().optional(), requireUserCredentials: z.boolean().optional(), dataset: z.string(), connectionType: duckdbConnectionTypeEMBEDDED, type: warehouseTypesDUCKDB}); export const duckdbCredentials = z.union([duckdbMotherduckCredentials, duckdbDucklakeCredentials, duckdbEmbeddedCredentials]); export const warehouseCredentials = z.union([snowflakeCredentials, redshiftCredentials, postgresCredentials, bigqueryCredentials, databricksCredentials, trinoCredentials, clickhouseCredentials, athenaCredentials, duckdbCredentials]); export const warehouseTypes = z.enum(["bigquery", "postgres", "redshift", "snowflake", "databricks", "trino", "clickhouse", "athena", "duckdb"]); export const organizationWarehouseCredentials = z.object({credentials: warehouseCredentials, createdByUserUuid: z.string().nullable(), createdAt: z.string(), warehouseType: warehouseTypes, description: z.string().nullable(), name: z.string(), organizationUuid: z.string(), organizationWarehouseCredentialsUuid: z.string()}); export const apiOrganizationWarehouseCredentialsResponse = z.object({results: organizationWarehouseCredentials, status: z.literal("ok")}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Update warehouse credentials * * PATCH /api/v1/org/warehouse-credentials/{credentialsUuid} */ export const patchApiApiV1OrgWarehouseCredentialsCredentialsUuid = async (args: PatchApiApiV1OrgWarehouseCredentialsCredentialsUuidArgs, options: PatchApiApiV1OrgWarehouseCredentialsCredentialsUuidOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/org/warehouse-credentials/${encodeURIComponent(String(args.credentialsUuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(apiOrganizationWarehouseCredentialsResponse, await res.json()) };