Files
windmill/typescript-client/client.d.ts
T
Diego Imbert 9bbab3321e feat: Data tables (#7226)
* data tables settings ui

* install runed

* zod 4 fixes

* use new toJSONSchema

* Migrate ducklake catalogs to more generic custom instance databases

* fix compilation

* Safety conversion for old duckdb ffi

* data tables settings

* ts client basis

* inline run works

* datatables work

* Revert "datatables work"

This reverts commit 6e1588d59e.

* datatables work (without leaking pg credentials)

* println

* separate sqlUtils.ts

* nit

* Separate custom instance db Select and Wizard components

* nit

* nit wording

* add tags to custom instance dbs

* error when trying to use ducklake as datatable or opposite

* show status in dropdown

* data table instance setup works

* sqk function for ducklake

* factorize logic

* fix temp reactivity

* Data table assetexplore

* Migrate S3 permissions to modal

* Revert "Migrate S3 permissions to modal"

This reverts commit 0631d03cb0.

* nit query -> fetch

* Custom instance setup new look

* run_language_executor separate fn

* run_inline param

* nit wording

* Better typed client

* Data tables display as assets in frontend

* asset db icon

* nit

* cleaner errors

* nit

* Fix sed calls in mac

* run_inline_script_preview in python client

* basic python datatable client

* datatable and datalake parser in python

* ducklake client python

* nit fix

* Fix migration producing NULL instead of {} when no custom databases

* merge conflict fail

* python ducklake client arg fix

* parse or infer sql types in ts client

* ts asset parser, detect datatable & ducklake R/W

* fix sql repl for other read ops than select

* export type SqlTemplateFunction

* rename list_custom_instance_pg_databases

* typecheck datatable and ducklake name in Typescript

* Fix typecheck datatable and ducklake in TS

* declare module overriding instead of extending

* infer_sql_type in python client

* SqlQuery object in python

* fix merge conflicts

* update const_format

* CI fix

* factor out to var_identifiers

* sqlx prepare

* unnecessary security (admin is required)

* clearer comment

* ee repo ref

* nit snake case

* claude step 1: detect var declarations

* move detect_sql_access_type to common mod

* claude step 2: detect when saved vars are queried

* Revert "claude step 2: detect when saved vars are queried"

This reverts commit 1e1f930568.

* Revert "claude step 1: detect var declarations"

This reverts commit f866f4819d.

* remove ducklake/datatable and default

* detect data table assigns in var_identifiers

* Python parser successfully infers R/W/RW from ducklake / datatable

* still register ducklake/datatable if not used as unknown R/W

* Go to settings button in Assets Dropdown on not found

* nit

* sqlx prepare fail

* manual fix, somehow sqlx prepare won't do it

* fix frontend ci

* ee repo ref

* ducklake_user doesnt exist in unit tests

* nit fix

* ui nit

* nit

* nit missing clone

* fork ducklakes and datatables

* fix surface hover bug

* stupid mistake

* better deeply reactive mutable derived

* Ducklake picker

* Editor bar data tables

* DuckDB supports datatables

* datatable in duckdb asset parser

* duckdb asset parser var_identifiers

* Revert "duckdb asset parser var_identifiers"

This reverts commit 88068b1a77.

* sqlx prepare

* Box pin in test_workflow_as_code to fix stack overflow

* go to settings button

* ee repo ref

* fix compilation

* wording nit
2025-12-05 23:08:58 +00:00

217 lines
7.1 KiB
TypeScript

import { DenoS3LightClientSettings, type S3Object } from "./s3Types";
export {
AdminService,
AuditService,
FlowService,
GranularAclService,
GroupService,
JobService,
ResourceService,
VariableService,
ScriptService,
ScheduleService,
SettingsService,
UserService,
WorkspaceService,
} from "./index";
export { datatable, ducklake, type SqlTemplateFunction } from "./sqlUtils";
export type Sql = string;
export type Email = string;
export type Base64 = string;
export type Resource<S extends string> = any;
export declare const SHARED_FOLDER = "/shared";
export declare function setClient(token?: string, baseUrl?: string): void;
/**
* Create a client configuration from env variables
* @returns client configuration
*/
export declare function getWorkspace(): string;
/**
* Get a resource value by path
* @param path path of the resource, default to internal state path
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
* @returns resource value
*/
export declare function getResource(
path?: string,
undefinedIfEmpty?: boolean
): Promise<any>;
/**
* Get a resource value by path
* @param jobId job id to get the root job id from (default to current job)
* @returns root job id
*/
export declare function getRootJobId(jobId?: string): Promise<string>;
export declare function runScript(
path?: string | null,
hash_?: string | null,
args?: Record<string, any> | null,
verbose?: boolean
): Promise<any>;
export declare function waitJob(jobId: string, verbose?: boolean): Promise<any>;
export declare function getResult(jobId: string): Promise<any>;
export declare function getResultMaybe(jobId: string): Promise<any>;
export declare function task<P, T>(f: (_: P) => T): (_: P) => Promise<T>;
export declare function runScriptAsync(
path: string | null,
hash_: string | null,
args: Record<string, any> | null,
scheduledInSeconds?: number | null
): Promise<string>;
/**
* Resolve a resource value in case the default value was picked because the input payload was undefined
* @param obj resource value or path of the resource under the format `$res:path`
* @returns resource value
*/
export declare function resolveDefaultResource(obj: any): Promise<any>;
export declare function getStatePath(): string;
/**
* Set a resource value by path
* @param path path of the resource to set, default to state path
* @param value new value of the resource to set
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
*/
export declare function setResource(
value: any,
path?: string,
initializeToTypeIfNotExist?: string
): Promise<void>;
/**
* Set the state
* @param state state to set
* @deprecated use setState instead
*/
export declare function setInternalState(state: any): Promise<void>;
/**
* Set the state
* @param state state to set
*/
export declare function setState(state: any): Promise<void>;
/**
* Set a flow user state
* @param key key of the state
* @param value value of the state
*/
export declare function setFlowUserState(
key: string,
value: any,
errorIfNotPossible?: boolean
): Promise<void>;
/**
* Get a flow user state
* @param path path of the variable
*/
export declare function getFlowUserState(
key: string,
errorIfNotPossible?: boolean
): Promise<any>;
/**
* Get the internal state
* @deprecated use getState instead
*/
export declare function getInternalState(): Promise<any>;
/**
* Get the state shared across executions
*/
export declare function getState(): Promise<any>;
/**
* Get a variable by path
* @param path path of the variable
* @returns variable value
*/
export declare function getVariable(path: string): Promise<string>;
/**
* Set a variable by path, create if not exist
* @param path path of the variable
* @param value value of the variable
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
*/
export declare function setVariable(
path: string,
value: string,
isSecretIfNotExist?: boolean,
descriptionIfNotExist?: string
): Promise<void>;
export declare function databaseUrlFromResource(path: string): Promise<string>;
export declare function denoS3LightClientSettings(
s3_resource_path: string | undefined
): Promise<DenoS3LightClientSettings>;
/**
* Load the content of a file stored in S3. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
*
* ```typescript
* let fileContent = await wmill.loadS3FileContent(inputFile)
* // if the file is a raw text file, it can be decoded and printed directly:
* const text = new TextDecoder().decode(fileContentStream)
* console.log(text);
* ```
*/
export declare function loadS3File(
s3object: S3Object,
s3ResourcePath?: string | undefined
): Promise<Uint8Array | undefined>;
/**
* Load the content of a file stored in S3 as a stream. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
*
* ```typescript
* let fileContentBlob = await wmill.loadS3FileStream(inputFile)
* // if the content is plain text, the blob can be read directly:
* console.log(await fileContentBlob.text());
* ```
*/
export declare function loadS3FileStream(
s3object: S3Object,
s3ResourcePath?: string | undefined
): Promise<Blob | undefined>;
/**
* Persist a file to the S3 bucket. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
*
* ```typescript
* const s3object = await writeS3File(s3Object, "Hello Windmill!")
* const fileContentAsUtf8Str = (await s3object.toArray()).toString('utf-8')
* console.log(fileContentAsUtf8Str)
* ```
*/
export declare function writeS3File(
s3object: S3Object | undefined,
fileContent: string | Blob,
s3ResourcePath?: string | undefined
): Promise<S3Object>;
/**
* Get URLs needed for resuming a flow after this step
* @param approver approver name
* @returns approval page UI URL, resume and cancel API URLs for resuming the flow
*/
export declare function getResumeUrls(approver?: string): Promise<{
approvalPage: string;
resume: string;
cancel: string;
}>;
/**
* @deprecated use getResumeUrls instead
*/
export declare function getResumeEndpoints(approver?: string): Promise<{
approvalPage: string;
resume: string;
cancel: string;
}>;
/**
* Get an OIDC jwt token for auth to external services (e.g: Vault, AWS) (ee only)
* @param audience audience of the token
* @returns jwt token
*/
export declare function getIdToken(audience: string): Promise<string>;
export declare function base64ToUint8Array(data: string): Uint8Array;
export declare function uint8ArrayToBase64(arrayBuffer: Uint8Array): string;
/**
* Get email from workspace username
* This method is particularly useful for apps that require the email address of the viewer.
* Indeed, in the viewer context, WM_USERNAME is set to the username of the viewer but WM_EMAIL is set to the email of the creator of the app.
* @param username
* @returns email address
*/
export declare function usernameToEmail(username: string): Promise<string>;