windmill-client 1.595.0 → 1.596.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +1 -1
- package/dist/core/OpenAPI.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/sqlUtils.d.ts +18 -7
- package/dist/sqlUtils.js +2 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DenoS3LightClientSettings, S3ObjectRecord, type S3Object } from "./s3Types";
|
|
2
2
|
export { type S3Object, type S3ObjectRecord, type S3ObjectURI, } from "./s3Types";
|
|
3
|
-
export { datatable, ducklake, type SqlTemplateFunction } from "./sqlUtils";
|
|
3
|
+
export { datatable, ducklake, type SqlTemplateFunction, type DatatableSqlTemplateFunction, } from "./sqlUtils";
|
|
4
4
|
export { AdminService, AuditService, FlowService, GranularAclService, GroupService, JobService, ResourceService, VariableService, ScriptService, ScheduleService, SettingsService, UserService, WorkspaceService, TeamsService, } from "./index";
|
|
5
5
|
export type Sql = string;
|
|
6
6
|
export type Email = string;
|
package/dist/core/OpenAPI.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI';
|
|
|
4
4
|
export * from './services.gen';
|
|
5
5
|
export * from './types.gen';
|
|
6
6
|
export type { DenoS3LightClientSettings } from "./s3Types";
|
|
7
|
-
export { type Base64, setClient, getVariable, setVariable, getResource, setResource, getResumeUrls, setState, setProgress, getProgress, getState, getIdToken, denoS3LightClientSettings, loadS3FileStream, loadS3File, writeS3File, signS3Objects, signS3Object, getPresignedS3PublicUrls, getPresignedS3PublicUrl, task, runScript, runScriptAsync, runScriptByPath, runScriptByHash, runScriptByPathAsync, runScriptByHashAsync, runFlow, runFlowAsync, waitJob, getRootJobId, setFlowUserState, getFlowUserState, usernameToEmail, requestInteractiveSlackApproval, Sql, requestInteractiveTeamsApproval, appendToResultStream, streamResult, datatable, ducklake, type SqlTemplateFunction, type S3Object, type S3ObjectRecord, type S3ObjectURI } from "./client";
|
|
7
|
+
export { type Base64, setClient, getVariable, setVariable, getResource, setResource, getResumeUrls, setState, setProgress, getProgress, getState, getIdToken, denoS3LightClientSettings, loadS3FileStream, loadS3File, writeS3File, signS3Objects, signS3Object, getPresignedS3PublicUrls, getPresignedS3PublicUrl, task, runScript, runScriptAsync, runScriptByPath, runScriptByHash, runScriptByPathAsync, runScriptByHashAsync, runFlow, runFlowAsync, waitJob, getRootJobId, setFlowUserState, getFlowUserState, usernameToEmail, requestInteractiveSlackApproval, Sql, requestInteractiveTeamsApproval, appendToResultStream, streamResult, datatable, ducklake, type DatatableSqlTemplateFunction, type SqlTemplateFunction, type S3Object, type S3ObjectRecord, type S3ObjectURI } from "./client";
|
package/dist/sqlUtils.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ type ResultCollection = "last_statement_all_rows" | "last_statement_first_row" |
|
|
|
2
2
|
type FetchParams<ResultCollectionT extends ResultCollection> = {
|
|
3
3
|
resultCollection?: ResultCollectionT;
|
|
4
4
|
};
|
|
5
|
-
type SqlResult<ResultCollectionT extends ResultCollection> = ResultCollectionT extends "last_statement_first_row" ?
|
|
5
|
+
type SqlResult<T, ResultCollectionT extends ResultCollection> = ResultCollectionT extends "last_statement_first_row" ? T | null : ResultCollectionT extends "all_statements_first_row" ? T[] : ResultCollectionT extends "last_statement_all_rows" ? T[] : ResultCollectionT extends "all_statements_all_rows" ? T[][] : ResultCollectionT extends "last_statement_all_rows_scalar" ? T[keyof T][] : ResultCollectionT extends "all_statements_all_rows_scalar" ? T[keyof T][][] : ResultCollectionT extends "last_statement_first_row_scalar" ? T[keyof T] | null : ResultCollectionT extends "all_statements_first_row_scalar" ? T[keyof T][] : unknown;
|
|
6
6
|
/**
|
|
7
7
|
* SQL statement object with query content, arguments, and execution methods
|
|
8
8
|
*/
|
|
9
|
-
export type SqlStatement = {
|
|
9
|
+
export type SqlStatement<T> = {
|
|
10
10
|
/** Raw SQL content with formatted arguments */
|
|
11
11
|
content: string;
|
|
12
12
|
/** Argument values keyed by parameter name */
|
|
@@ -16,22 +16,33 @@ export type SqlStatement = {
|
|
|
16
16
|
* @param params - Optional parameters including result collection mode
|
|
17
17
|
* @returns Query results based on the result collection mode
|
|
18
18
|
*/
|
|
19
|
-
fetch<ResultCollectionT extends ResultCollection = "last_statement_all_rows">(params?: FetchParams<ResultCollectionT | ResultCollection>): Promise<SqlResult<ResultCollectionT>>;
|
|
19
|
+
fetch<ResultCollectionT extends ResultCollection = "last_statement_all_rows">(params?: FetchParams<ResultCollectionT | ResultCollection>): Promise<SqlResult<T, ResultCollectionT>>;
|
|
20
20
|
/**
|
|
21
21
|
* Execute the SQL query and return only the first row
|
|
22
22
|
* @param params - Optional parameters
|
|
23
23
|
* @returns First row of the query result
|
|
24
24
|
*/
|
|
25
|
-
fetchOne(params?: Omit<FetchParams<"last_statement_first_row">, "resultCollection">): Promise<SqlResult<"last_statement_first_row">>;
|
|
25
|
+
fetchOne(params?: Omit<FetchParams<"last_statement_first_row">, "resultCollection">): Promise<SqlResult<T, "last_statement_first_row">>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute the SQL query and return only the first row as a scalar value
|
|
28
|
+
* @param params - Optional parameters
|
|
29
|
+
* @returns First row of the query result
|
|
30
|
+
*/
|
|
31
|
+
fetchOneScalar(params?: Omit<FetchParams<"last_statement_first_row_scalar">, "resultCollection">): Promise<SqlResult<T, "last_statement_first_row_scalar">>;
|
|
32
|
+
/**
|
|
33
|
+
* Execute the SQL query without fetching rows
|
|
34
|
+
* @param params - Optional parameters
|
|
35
|
+
*/
|
|
36
|
+
execute(params?: Omit<FetchParams<"last_statement_first_row">, "resultCollection">): Promise<void>;
|
|
26
37
|
};
|
|
27
38
|
/**
|
|
28
39
|
* Template tag function for creating SQL statements with parameterized values
|
|
29
40
|
*/
|
|
30
41
|
export interface SqlTemplateFunction {
|
|
31
|
-
(strings: TemplateStringsArray, ...values: any[]): SqlStatement
|
|
42
|
+
<T = any>(strings: TemplateStringsArray, ...values: any[]): SqlStatement<T>;
|
|
32
43
|
}
|
|
33
|
-
interface DatatableSqlTemplateFunction extends SqlTemplateFunction {
|
|
34
|
-
query(sql: string, ...params: any[]): SqlStatement
|
|
44
|
+
export interface DatatableSqlTemplateFunction extends SqlTemplateFunction {
|
|
45
|
+
query<T = any>(sql: string, ...params: any[]): SqlStatement<T>;
|
|
35
46
|
}
|
|
36
47
|
/**
|
|
37
48
|
* Create a SQL template function for PostgreSQL/datatable queries
|
package/dist/sqlUtils.js
CHANGED
|
@@ -116,6 +116,8 @@ function sqlProviderImpl(provider, { name, schema }) {
|
|
|
116
116
|
args,
|
|
117
117
|
fetch,
|
|
118
118
|
fetchOne: (params) => fetch(Object.assign(Object.assign({}, params), { resultCollection: "last_statement_first_row" })),
|
|
119
|
+
fetchOneScalar: (params) => fetch(Object.assign(Object.assign({}, params), { resultCollection: "last_statement_first_row_scalar" })),
|
|
120
|
+
execute: (params) => fetch(params),
|
|
119
121
|
};
|
|
120
122
|
};
|
|
121
123
|
if (provider === "datatable") {
|