windmill-client 1.672.0 → 1.674.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 -0
- package/dist/client.mjs +4 -1
- package/dist/core/OpenAPI.mjs +1 -1
- package/dist/index.js +244 -77
- package/dist/services.gen.d.ts +63 -1
- package/dist/services.gen.mjs +133 -17
- package/dist/sqlUtils.d.ts +11 -0
- package/dist/sqlUtils.mjs +108 -60
- package/dist/types.gen.d.ts +359 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type Email = string;
|
|
|
6
6
|
export type Base64 = string;
|
|
7
7
|
export type Resource<S extends string> = any;
|
|
8
8
|
export declare const SHARED_FOLDER = "/shared";
|
|
9
|
+
export declare function workerHasInternalServer(): boolean;
|
|
9
10
|
/**
|
|
10
11
|
* Initialize the Windmill client with authentication token and base URL
|
|
11
12
|
* @param token - Authentication token (defaults to WM_TOKEN env variable)
|
package/dist/client.mjs
CHANGED
|
@@ -5,6 +5,9 @@ import { datatable, ducklake } from "./sqlUtils.mjs";
|
|
|
5
5
|
//#region src/client.ts
|
|
6
6
|
const SHARED_FOLDER = "/shared";
|
|
7
7
|
let mockedApi = void 0;
|
|
8
|
+
function workerHasInternalServer() {
|
|
9
|
+
return /^https?:\/\/(localhost|127\.0\.0\.1)(:|\/|$)/.test(OpenAPI.BASE ?? "");
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* Initialize the Windmill client with authentication token and base URL
|
|
10
13
|
* @param token - Authentication token (defaults to WM_TOKEN env variable)
|
|
@@ -1271,4 +1274,4 @@ async function commitKafkaOffsets(triggerPath, topic, partition, offset) {
|
|
|
1271
1274
|
}
|
|
1272
1275
|
|
|
1273
1276
|
//#endregion
|
|
1274
|
-
export { SHARED_FOLDER, StepSuspend, WorkflowCtx, _workflowCtx, appendToResultStream, base64ToUint8Array, commitKafkaOffsets, databaseUrlFromResource, denoS3LightClientSettings, getFlowUserState, getIdToken, getInternalState, getPresignedS3PublicUrl, getPresignedS3PublicUrls, getProgress, getResource, getResult, getResultMaybe, getResumeEndpoints, getResumeUrls, getRootJobId, getState, getStatePath, getVariable, getWorkspace, loadS3File, loadS3FileStream, parallel, parseS3Object, requestInteractiveSlackApproval, requestInteractiveTeamsApproval, resolveDefaultResource, runFlow, runFlowAsync, runScript, runScriptAsync, runScriptByHash, runScriptByHashAsync, runScriptByPath, runScriptByPathAsync, setClient, setFlowUserState, setInternalState, setProgress, setResource, setState, setVariable, setWorkflowCtx, signS3Object, signS3Objects, sleep, step, streamResult, task, taskFlow, taskScript, uint8ArrayToBase64, usernameToEmail, waitForApproval, waitJob, workflow, writeS3File };
|
|
1277
|
+
export { SHARED_FOLDER, StepSuspend, WorkflowCtx, _workflowCtx, appendToResultStream, base64ToUint8Array, commitKafkaOffsets, databaseUrlFromResource, denoS3LightClientSettings, getFlowUserState, getIdToken, getInternalState, getPresignedS3PublicUrl, getPresignedS3PublicUrls, getProgress, getResource, getResult, getResultMaybe, getResumeEndpoints, getResumeUrls, getRootJobId, getState, getStatePath, getVariable, getWorkspace, loadS3File, loadS3FileStream, parallel, parseS3Object, requestInteractiveSlackApproval, requestInteractiveTeamsApproval, resolveDefaultResource, runFlow, runFlowAsync, runScript, runScriptAsync, runScriptByHash, runScriptByHashAsync, runScriptByPath, runScriptByPathAsync, setClient, setFlowUserState, setInternalState, setProgress, setResource, setState, setVariable, setWorkflowCtx, signS3Object, signS3Objects, sleep, step, streamResult, task, taskFlow, taskScript, uint8ArrayToBase64, usernameToEmail, waitForApproval, waitJob, workerHasInternalServer, workflow, writeS3File };
|
package/dist/core/OpenAPI.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -126,7 +126,7 @@ const OpenAPI = {
|
|
|
126
126
|
PASSWORD: void 0,
|
|
127
127
|
TOKEN: getEnv$1("WM_TOKEN"),
|
|
128
128
|
USERNAME: void 0,
|
|
129
|
-
VERSION: "1.
|
|
129
|
+
VERSION: "1.674.0",
|
|
130
130
|
WITH_CREDENTIALS: true,
|
|
131
131
|
interceptors: {
|
|
132
132
|
request: new Interceptors(),
|
|
@@ -2976,6 +2976,21 @@ var SettingService = class {
|
|
|
2976
2976
|
});
|
|
2977
2977
|
}
|
|
2978
2978
|
/**
|
|
2979
|
+
* restart worker group
|
|
2980
|
+
* Send a restart signal to all workers in the specified worker group. Workers will gracefully shut down and are expected to be restarted by their supervisor. Requires devops role.
|
|
2981
|
+
* @param data The data for the request.
|
|
2982
|
+
* @param data.workerGroup the name of the worker group to restart
|
|
2983
|
+
* @returns string restart signal sent
|
|
2984
|
+
* @throws ApiError
|
|
2985
|
+
*/
|
|
2986
|
+
static restartWorkerGroup(data) {
|
|
2987
|
+
return request(OpenAPI, {
|
|
2988
|
+
method: "POST",
|
|
2989
|
+
url: "/settings/restart_worker_group/{worker_group}",
|
|
2990
|
+
path: { worker_group: data.workerGroup }
|
|
2991
|
+
});
|
|
2992
|
+
}
|
|
2993
|
+
/**
|
|
2979
2994
|
* get telemetry stats with HMAC signature (EE only)
|
|
2980
2995
|
* @returns unknown telemetry stats JSON with signature
|
|
2981
2996
|
* @throws ApiError
|
|
@@ -3145,6 +3160,51 @@ var SettingService = class {
|
|
|
3145
3160
|
});
|
|
3146
3161
|
}
|
|
3147
3162
|
/**
|
|
3163
|
+
* test Azure Key Vault connection
|
|
3164
|
+
* @param data The data for the request.
|
|
3165
|
+
* @param data.requestBody Azure Key Vault settings to test
|
|
3166
|
+
* @returns string connection successful
|
|
3167
|
+
* @throws ApiError
|
|
3168
|
+
*/
|
|
3169
|
+
static testAzureKvBackend(data) {
|
|
3170
|
+
return request(OpenAPI, {
|
|
3171
|
+
method: "POST",
|
|
3172
|
+
url: "/settings/test_azure_kv_backend",
|
|
3173
|
+
body: data.requestBody,
|
|
3174
|
+
mediaType: "application/json"
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* migrate secrets from database to Azure Key Vault
|
|
3179
|
+
* @param data The data for the request.
|
|
3180
|
+
* @param data.requestBody Azure Key Vault settings for migration target
|
|
3181
|
+
* @returns SecretMigrationReport migration report
|
|
3182
|
+
* @throws ApiError
|
|
3183
|
+
*/
|
|
3184
|
+
static migrateSecretsToAzureKv(data) {
|
|
3185
|
+
return request(OpenAPI, {
|
|
3186
|
+
method: "POST",
|
|
3187
|
+
url: "/settings/migrate_secrets_to_azure_kv",
|
|
3188
|
+
body: data.requestBody,
|
|
3189
|
+
mediaType: "application/json"
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
/**
|
|
3193
|
+
* migrate secrets from Azure Key Vault to database
|
|
3194
|
+
* @param data The data for the request.
|
|
3195
|
+
* @param data.requestBody Azure Key Vault settings for migration source
|
|
3196
|
+
* @returns SecretMigrationReport migration report
|
|
3197
|
+
* @throws ApiError
|
|
3198
|
+
*/
|
|
3199
|
+
static migrateSecretsFromAzureKv(data) {
|
|
3200
|
+
return request(OpenAPI, {
|
|
3201
|
+
method: "POST",
|
|
3202
|
+
url: "/settings/migrate_secrets_from_azure_kv",
|
|
3203
|
+
body: data.requestBody,
|
|
3204
|
+
mediaType: "application/json"
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
/**
|
|
3148
3208
|
* get secondary storage names
|
|
3149
3209
|
* @param data The data for the request.
|
|
3150
3210
|
* @param data.workspace
|
|
@@ -3456,6 +3516,7 @@ var VariableService = class {
|
|
|
3456
3516
|
* @param data.broadFilter broad search across multiple fields (case-insensitive substring match)
|
|
3457
3517
|
* @param data.page which page to return (start at 1, default 1)
|
|
3458
3518
|
* @param data.perPage number of items to return for a given page (default 30, max 100)
|
|
3519
|
+
* @param data.label Filter by label
|
|
3459
3520
|
* @returns ListableVariable variable list
|
|
3460
3521
|
* @throws ApiError
|
|
3461
3522
|
*/
|
|
@@ -3471,7 +3532,8 @@ var VariableService = class {
|
|
|
3471
3532
|
value: data.value,
|
|
3472
3533
|
broad_filter: data.broadFilter,
|
|
3473
3534
|
page: data.page,
|
|
3474
|
-
per_page: data.perPage
|
|
3535
|
+
per_page: data.perPage,
|
|
3536
|
+
label: data.label
|
|
3475
3537
|
}
|
|
3476
3538
|
});
|
|
3477
3539
|
}
|
|
@@ -3904,6 +3966,7 @@ var ResourceService = class {
|
|
|
3904
3966
|
* @param data.description pattern match filter for description field (case-insensitive)
|
|
3905
3967
|
* @param data.value JSONB subset match filter using base64 encoded JSON
|
|
3906
3968
|
* @param data.broadFilter broad search across multiple fields (case-insensitive substring match)
|
|
3969
|
+
* @param data.label Filter by label
|
|
3907
3970
|
* @returns ListableResource resource list
|
|
3908
3971
|
* @throws ApiError
|
|
3909
3972
|
*/
|
|
@@ -3921,7 +3984,8 @@ var ResourceService = class {
|
|
|
3921
3984
|
path: data.path,
|
|
3922
3985
|
description: data.description,
|
|
3923
3986
|
value: data.value,
|
|
3924
|
-
broad_filter: data.broadFilter
|
|
3987
|
+
broad_filter: data.broadFilter,
|
|
3988
|
+
label: data.label
|
|
3925
3989
|
}
|
|
3926
3990
|
});
|
|
3927
3991
|
}
|
|
@@ -4313,6 +4377,7 @@ var FlowService = class {
|
|
|
4313
4377
|
* If true, show only flows with dedicated_worker enabled.
|
|
4314
4378
|
* If false, show only flows with dedicated_worker disabled.
|
|
4315
4379
|
*
|
|
4380
|
+
* @param data.label Filter by label
|
|
4316
4381
|
* @returns unknown All flow
|
|
4317
4382
|
* @throws ApiError
|
|
4318
4383
|
*/
|
|
@@ -4333,7 +4398,8 @@ var FlowService = class {
|
|
|
4333
4398
|
include_draft_only: data.includeDraftOnly,
|
|
4334
4399
|
with_deployment_msg: data.withDeploymentMsg,
|
|
4335
4400
|
without_description: data.withoutDescription,
|
|
4336
|
-
dedicated_worker: data.dedicatedWorker
|
|
4401
|
+
dedicated_worker: data.dedicatedWorker,
|
|
4402
|
+
label: data.label
|
|
4337
4403
|
}
|
|
4338
4404
|
});
|
|
4339
4405
|
}
|
|
@@ -4750,6 +4816,7 @@ var AppService = class {
|
|
|
4750
4816
|
* @param data.withDeploymentMsg (default false)
|
|
4751
4817
|
* include deployment message
|
|
4752
4818
|
*
|
|
4819
|
+
* @param data.label Filter by label
|
|
4753
4820
|
* @returns ListableApp All apps
|
|
4754
4821
|
* @throws ApiError
|
|
4755
4822
|
*/
|
|
@@ -4767,7 +4834,8 @@ var AppService = class {
|
|
|
4767
4834
|
path_exact: data.pathExact,
|
|
4768
4835
|
starred_only: data.starredOnly,
|
|
4769
4836
|
include_draft_only: data.includeDraftOnly,
|
|
4770
|
-
with_deployment_msg: data.withDeploymentMsg
|
|
4837
|
+
with_deployment_msg: data.withDeploymentMsg,
|
|
4838
|
+
label: data.label
|
|
4771
4839
|
}
|
|
4772
4840
|
});
|
|
4773
4841
|
}
|
|
@@ -5374,6 +5442,7 @@ var ScriptService = class {
|
|
|
5374
5442
|
* If true, show only scripts with dedicated_worker enabled.
|
|
5375
5443
|
* If false, show only scripts with dedicated_worker disabled.
|
|
5376
5444
|
*
|
|
5445
|
+
* @param data.label Filter by label
|
|
5377
5446
|
* @returns Script All scripts
|
|
5378
5447
|
* @throws ApiError
|
|
5379
5448
|
*/
|
|
@@ -5401,7 +5470,8 @@ var ScriptService = class {
|
|
|
5401
5470
|
with_deployment_msg: data.withDeploymentMsg,
|
|
5402
5471
|
languages: data.languages,
|
|
5403
5472
|
without_description: data.withoutDescription,
|
|
5404
|
-
dedicated_worker: data.dedicatedWorker
|
|
5473
|
+
dedicated_worker: data.dedicatedWorker,
|
|
5474
|
+
label: data.label
|
|
5405
5475
|
}
|
|
5406
5476
|
});
|
|
5407
5477
|
}
|
|
@@ -8606,6 +8676,7 @@ var RawAppService = class {
|
|
|
8606
8676
|
* @param data.starredOnly (default false)
|
|
8607
8677
|
* show only the starred items
|
|
8608
8678
|
*
|
|
8679
|
+
* @param data.label Filter by label
|
|
8609
8680
|
* @returns ListableRawApp All raw apps
|
|
8610
8681
|
* @throws ApiError
|
|
8611
8682
|
*/
|
|
@@ -8621,7 +8692,8 @@ var RawAppService = class {
|
|
|
8621
8692
|
created_by: data.createdBy,
|
|
8622
8693
|
path_start: data.pathStart,
|
|
8623
8694
|
path_exact: data.pathExact,
|
|
8624
|
-
starred_only: data.starredOnly
|
|
8695
|
+
starred_only: data.starredOnly,
|
|
8696
|
+
label: data.label
|
|
8625
8697
|
}
|
|
8626
8698
|
});
|
|
8627
8699
|
}
|
|
@@ -8817,6 +8889,7 @@ var ScheduleService = class {
|
|
|
8817
8889
|
* @param data.description pattern match filter for description field (case-insensitive)
|
|
8818
8890
|
* @param data.summary pattern match filter for summary field (case-insensitive)
|
|
8819
8891
|
* @param data.broadFilter broad search across multiple fields (case-insensitive substring match)
|
|
8892
|
+
* @param data.label Filter by label
|
|
8820
8893
|
* @returns Schedule schedule list
|
|
8821
8894
|
* @throws ApiError
|
|
8822
8895
|
*/
|
|
@@ -8835,7 +8908,8 @@ var ScheduleService = class {
|
|
|
8835
8908
|
schedule_path: data.schedulePath,
|
|
8836
8909
|
description: data.description,
|
|
8837
8910
|
summary: data.summary,
|
|
8838
|
-
broad_filter: data.broadFilter
|
|
8911
|
+
broad_filter: data.broadFilter,
|
|
8912
|
+
label: data.label
|
|
8839
8913
|
}
|
|
8840
8914
|
});
|
|
8841
8915
|
}
|
|
@@ -9014,6 +9088,7 @@ var HttpTriggerService = class {
|
|
|
9014
9088
|
* @param data.path filter by path
|
|
9015
9089
|
* @param data.isFlow
|
|
9016
9090
|
* @param data.pathStart
|
|
9091
|
+
* @param data.label Filter by label
|
|
9017
9092
|
* @returns HttpTrigger http trigger list
|
|
9018
9093
|
* @throws ApiError
|
|
9019
9094
|
*/
|
|
@@ -9027,7 +9102,8 @@ var HttpTriggerService = class {
|
|
|
9027
9102
|
per_page: data.perPage,
|
|
9028
9103
|
path: data.path,
|
|
9029
9104
|
is_flow: data.isFlow,
|
|
9030
|
-
path_start: data.pathStart
|
|
9105
|
+
path_start: data.pathStart,
|
|
9106
|
+
label: data.label
|
|
9031
9107
|
}
|
|
9032
9108
|
});
|
|
9033
9109
|
}
|
|
@@ -9172,6 +9248,7 @@ var WebsocketTriggerService = class {
|
|
|
9172
9248
|
* @param data.path filter by path
|
|
9173
9249
|
* @param data.isFlow
|
|
9174
9250
|
* @param data.pathStart
|
|
9251
|
+
* @param data.label Filter by label
|
|
9175
9252
|
* @returns WebsocketTrigger websocket trigger list
|
|
9176
9253
|
* @throws ApiError
|
|
9177
9254
|
*/
|
|
@@ -9185,7 +9262,8 @@ var WebsocketTriggerService = class {
|
|
|
9185
9262
|
per_page: data.perPage,
|
|
9186
9263
|
path: data.path,
|
|
9187
9264
|
is_flow: data.isFlow,
|
|
9188
|
-
path_start: data.pathStart
|
|
9265
|
+
path_start: data.pathStart,
|
|
9266
|
+
label: data.label
|
|
9189
9267
|
}
|
|
9190
9268
|
});
|
|
9191
9269
|
}
|
|
@@ -9330,6 +9408,7 @@ var KafkaTriggerService = class {
|
|
|
9330
9408
|
* @param data.path filter by path
|
|
9331
9409
|
* @param data.isFlow
|
|
9332
9410
|
* @param data.pathStart
|
|
9411
|
+
* @param data.label Filter by label
|
|
9333
9412
|
* @returns KafkaTrigger kafka trigger list
|
|
9334
9413
|
* @throws ApiError
|
|
9335
9414
|
*/
|
|
@@ -9343,7 +9422,8 @@ var KafkaTriggerService = class {
|
|
|
9343
9422
|
per_page: data.perPage,
|
|
9344
9423
|
path: data.path,
|
|
9345
9424
|
is_flow: data.isFlow,
|
|
9346
|
-
path_start: data.pathStart
|
|
9425
|
+
path_start: data.pathStart,
|
|
9426
|
+
label: data.label
|
|
9347
9427
|
}
|
|
9348
9428
|
});
|
|
9349
9429
|
}
|
|
@@ -9527,6 +9607,7 @@ var NatsTriggerService = class {
|
|
|
9527
9607
|
* @param data.path filter by path
|
|
9528
9608
|
* @param data.isFlow
|
|
9529
9609
|
* @param data.pathStart
|
|
9610
|
+
* @param data.label Filter by label
|
|
9530
9611
|
* @returns NatsTrigger nats trigger list
|
|
9531
9612
|
* @throws ApiError
|
|
9532
9613
|
*/
|
|
@@ -9540,7 +9621,8 @@ var NatsTriggerService = class {
|
|
|
9540
9621
|
per_page: data.perPage,
|
|
9541
9622
|
path: data.path,
|
|
9542
9623
|
is_flow: data.isFlow,
|
|
9543
|
-
path_start: data.pathStart
|
|
9624
|
+
path_start: data.pathStart,
|
|
9625
|
+
label: data.label
|
|
9544
9626
|
}
|
|
9545
9627
|
});
|
|
9546
9628
|
}
|
|
@@ -9685,6 +9767,7 @@ var SqsTriggerService = class {
|
|
|
9685
9767
|
* @param data.path filter by path
|
|
9686
9768
|
* @param data.isFlow
|
|
9687
9769
|
* @param data.pathStart
|
|
9770
|
+
* @param data.label Filter by label
|
|
9688
9771
|
* @returns SqsTrigger sqs trigger list
|
|
9689
9772
|
* @throws ApiError
|
|
9690
9773
|
*/
|
|
@@ -9698,7 +9781,8 @@ var SqsTriggerService = class {
|
|
|
9698
9781
|
per_page: data.perPage,
|
|
9699
9782
|
path: data.path,
|
|
9700
9783
|
is_flow: data.isFlow,
|
|
9701
|
-
path_start: data.pathStart
|
|
9784
|
+
path_start: data.pathStart,
|
|
9785
|
+
label: data.label
|
|
9702
9786
|
}
|
|
9703
9787
|
});
|
|
9704
9788
|
}
|
|
@@ -10020,6 +10104,7 @@ var NativeTriggerService = class {
|
|
|
10020
10104
|
* @param data.perPage number of items to return for a given page (default 30, max 100)
|
|
10021
10105
|
* @param data.path filter by script path
|
|
10022
10106
|
* @param data.isFlow filter by is_flow
|
|
10107
|
+
* @param data.label Filter by label
|
|
10023
10108
|
* @returns NativeTrigger native triggers list
|
|
10024
10109
|
* @throws ApiError
|
|
10025
10110
|
*/
|
|
@@ -10035,7 +10120,8 @@ var NativeTriggerService = class {
|
|
|
10035
10120
|
page: data.page,
|
|
10036
10121
|
per_page: data.perPage,
|
|
10037
10122
|
path: data.path,
|
|
10038
|
-
is_flow: data.isFlow
|
|
10123
|
+
is_flow: data.isFlow,
|
|
10124
|
+
label: data.label
|
|
10039
10125
|
}
|
|
10040
10126
|
});
|
|
10041
10127
|
}
|
|
@@ -10252,6 +10338,7 @@ var MqttTriggerService = class {
|
|
|
10252
10338
|
* @param data.path filter by path
|
|
10253
10339
|
* @param data.isFlow
|
|
10254
10340
|
* @param data.pathStart
|
|
10341
|
+
* @param data.label Filter by label
|
|
10255
10342
|
* @returns MqttTrigger mqtt trigger list
|
|
10256
10343
|
* @throws ApiError
|
|
10257
10344
|
*/
|
|
@@ -10265,7 +10352,8 @@ var MqttTriggerService = class {
|
|
|
10265
10352
|
per_page: data.perPage,
|
|
10266
10353
|
path: data.path,
|
|
10267
10354
|
is_flow: data.isFlow,
|
|
10268
|
-
path_start: data.pathStart
|
|
10355
|
+
path_start: data.pathStart,
|
|
10356
|
+
label: data.label
|
|
10269
10357
|
}
|
|
10270
10358
|
});
|
|
10271
10359
|
}
|
|
@@ -10410,6 +10498,7 @@ var GcpTriggerService = class {
|
|
|
10410
10498
|
* @param data.path filter by path
|
|
10411
10499
|
* @param data.isFlow
|
|
10412
10500
|
* @param data.pathStart
|
|
10501
|
+
* @param data.label Filter by label
|
|
10413
10502
|
* @returns GcpTrigger gcp trigger list
|
|
10414
10503
|
* @throws ApiError
|
|
10415
10504
|
*/
|
|
@@ -10423,7 +10512,8 @@ var GcpTriggerService = class {
|
|
|
10423
10512
|
per_page: data.perPage,
|
|
10424
10513
|
path: data.path,
|
|
10425
10514
|
is_flow: data.isFlow,
|
|
10426
|
-
path_start: data.pathStart
|
|
10515
|
+
path_start: data.pathStart,
|
|
10516
|
+
label: data.label
|
|
10427
10517
|
}
|
|
10428
10518
|
});
|
|
10429
10519
|
}
|
|
@@ -10863,6 +10953,7 @@ var PostgresTriggerService = class {
|
|
|
10863
10953
|
* @param data.path filter by path
|
|
10864
10954
|
* @param data.isFlow
|
|
10865
10955
|
* @param data.pathStart
|
|
10956
|
+
* @param data.label Filter by label
|
|
10866
10957
|
* @returns PostgresTrigger postgres trigger list
|
|
10867
10958
|
* @throws ApiError
|
|
10868
10959
|
*/
|
|
@@ -10876,7 +10967,8 @@ var PostgresTriggerService = class {
|
|
|
10876
10967
|
per_page: data.perPage,
|
|
10877
10968
|
path: data.path,
|
|
10878
10969
|
is_flow: data.isFlow,
|
|
10879
|
-
path_start: data.pathStart
|
|
10970
|
+
path_start: data.pathStart,
|
|
10971
|
+
label: data.label
|
|
10880
10972
|
}
|
|
10881
10973
|
});
|
|
10882
10974
|
}
|
|
@@ -11021,6 +11113,7 @@ var EmailTriggerService = class {
|
|
|
11021
11113
|
* @param data.path filter by path
|
|
11022
11114
|
* @param data.isFlow
|
|
11023
11115
|
* @param data.pathStart
|
|
11116
|
+
* @param data.label Filter by label
|
|
11024
11117
|
* @returns EmailTrigger email trigger list
|
|
11025
11118
|
* @throws ApiError
|
|
11026
11119
|
*/
|
|
@@ -11034,7 +11127,8 @@ var EmailTriggerService = class {
|
|
|
11034
11127
|
per_page: data.perPage,
|
|
11035
11128
|
path: data.path,
|
|
11036
11129
|
is_flow: data.isFlow,
|
|
11037
|
-
path_start: data.pathStart
|
|
11130
|
+
path_start: data.pathStart,
|
|
11131
|
+
label: data.label
|
|
11038
11132
|
}
|
|
11039
11133
|
});
|
|
11040
11134
|
}
|
|
@@ -11740,6 +11834,28 @@ var ConfigService = class {
|
|
|
11740
11834
|
url: "/configs/list_available_python_versions"
|
|
11741
11835
|
});
|
|
11742
11836
|
}
|
|
11837
|
+
/**
|
|
11838
|
+
* list all workspace dependencies
|
|
11839
|
+
* @returns unknown a list of workspace dependency summaries
|
|
11840
|
+
* @throws ApiError
|
|
11841
|
+
*/
|
|
11842
|
+
static listAllWorkspaceDependencies() {
|
|
11843
|
+
return request(OpenAPI, {
|
|
11844
|
+
method: "GET",
|
|
11845
|
+
url: "/configs/list_all_workspace_dependencies"
|
|
11846
|
+
});
|
|
11847
|
+
}
|
|
11848
|
+
/**
|
|
11849
|
+
* list all dedicated scripts with their dependencies
|
|
11850
|
+
* @returns unknown a list of dedicated scripts with workspace dependencies
|
|
11851
|
+
* @throws ApiError
|
|
11852
|
+
*/
|
|
11853
|
+
static listAllDedicatedWithDeps() {
|
|
11854
|
+
return request(OpenAPI, {
|
|
11855
|
+
method: "GET",
|
|
11856
|
+
url: "/configs/list_all_dedicated_with_deps"
|
|
11857
|
+
});
|
|
11858
|
+
}
|
|
11743
11859
|
};
|
|
11744
11860
|
var AgentWorkersService = class {
|
|
11745
11861
|
/**
|
|
@@ -13261,81 +13377,94 @@ var McpOauthService = class {
|
|
|
13261
13377
|
//#endregion
|
|
13262
13378
|
//#region src/sqlUtils.ts
|
|
13263
13379
|
/**
|
|
13264
|
-
*
|
|
13265
|
-
*
|
|
13266
|
-
* @returns SQL template function for building parameterized queries
|
|
13267
|
-
* @example
|
|
13268
|
-
* let sql = wmill.datatable()
|
|
13269
|
-
* let name = 'Robin'
|
|
13270
|
-
* let age = 21
|
|
13271
|
-
* await sql`
|
|
13272
|
-
* SELECT * FROM friends
|
|
13273
|
-
* WHERE name = ${name} AND age = ${age}::int
|
|
13274
|
-
* `.fetch()
|
|
13380
|
+
* Wrapper for raw SQL fragments that should be inlined without parameterization.
|
|
13381
|
+
* Created via `sql.raw(value)`.
|
|
13275
13382
|
*/
|
|
13276
|
-
|
|
13277
|
-
|
|
13383
|
+
var RawSql = class {
|
|
13384
|
+
__brand = "RawSql";
|
|
13385
|
+
constructor(value) {
|
|
13386
|
+
this.value = value;
|
|
13387
|
+
}
|
|
13388
|
+
};
|
|
13389
|
+
function datatableProvider(name, schema) {
|
|
13390
|
+
return {
|
|
13391
|
+
providerName: "datatable",
|
|
13392
|
+
language: "postgresql",
|
|
13393
|
+
extraArgs: { database: `datatable://${name}` },
|
|
13394
|
+
formatArgDecl: (argNum) => `-- $${argNum} arg${argNum}`,
|
|
13395
|
+
formatArgUsage: (argNum, explicitType, inferredType) => explicitType !== void 0 ? `$${argNum}` : `$${argNum}::${inferredType}`,
|
|
13396
|
+
preamble: () => schema ? `SET search_path TO "${schema}";\n` : ""
|
|
13397
|
+
};
|
|
13278
13398
|
}
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
* SELECT * FROM friends
|
|
13289
|
-
* WHERE name = ${name} AND age = ${age}
|
|
13290
|
-
* `.fetch()
|
|
13291
|
-
*/
|
|
13292
|
-
function ducklake(name = "main") {
|
|
13293
|
-
return sqlProviderImpl("ducklake", { name });
|
|
13399
|
+
function ducklakeProvider(name) {
|
|
13400
|
+
return {
|
|
13401
|
+
providerName: "ducklake",
|
|
13402
|
+
language: "duckdb",
|
|
13403
|
+
extraArgs: {},
|
|
13404
|
+
formatArgDecl: (argNum, argType) => `-- $arg${argNum} (${argType})`,
|
|
13405
|
+
formatArgUsage: (argNum) => `$arg${argNum}`,
|
|
13406
|
+
preamble: () => `ATTACH 'ducklake://${name}' AS dl;USE dl;\n`
|
|
13407
|
+
};
|
|
13294
13408
|
}
|
|
13295
|
-
function
|
|
13409
|
+
function buildSqlTemplateFunction(provider) {
|
|
13296
13410
|
let sqlFn = (strings, ...values) => {
|
|
13297
|
-
let
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
}
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13411
|
+
let argIndex = 0;
|
|
13412
|
+
const valueInfos = values.map((v, i) => {
|
|
13413
|
+
if (v instanceof RawSql) return {
|
|
13414
|
+
raw: true,
|
|
13415
|
+
value: v.value,
|
|
13416
|
+
originalIndex: i
|
|
13417
|
+
};
|
|
13418
|
+
argIndex++;
|
|
13419
|
+
return {
|
|
13420
|
+
raw: false,
|
|
13421
|
+
value: v,
|
|
13422
|
+
originalIndex: i,
|
|
13423
|
+
argNum: argIndex
|
|
13424
|
+
};
|
|
13425
|
+
});
|
|
13426
|
+
let argDecls = valueInfos.filter((info) => !info.raw).map((info) => {
|
|
13427
|
+
let argType = parseTypeAnnotation(strings[info.originalIndex], strings[info.originalIndex + 1]) || inferSqlType(info.value);
|
|
13428
|
+
return provider.formatArgDecl(info.argNum, argType);
|
|
13429
|
+
});
|
|
13430
|
+
let content = argDecls.length ? argDecls.join("\n") + "\n" : "";
|
|
13431
|
+
content += provider.preamble();
|
|
13316
13432
|
let contentBody = "";
|
|
13317
13433
|
for (let i = 0; i < strings.length; i++) {
|
|
13318
13434
|
contentBody += strings[i];
|
|
13319
|
-
if (i
|
|
13435
|
+
if (i < valueInfos.length) {
|
|
13436
|
+
let info = valueInfos[i];
|
|
13437
|
+
if (info.raw) contentBody += info.value;
|
|
13438
|
+
else {
|
|
13439
|
+
let explicitType = parseTypeAnnotation(strings[info.originalIndex], strings[info.originalIndex + 1]);
|
|
13440
|
+
let inferredType = inferSqlType(info.value);
|
|
13441
|
+
contentBody += provider.formatArgUsage(info.argNum, explicitType, inferredType);
|
|
13442
|
+
}
|
|
13443
|
+
}
|
|
13320
13444
|
}
|
|
13321
13445
|
content += contentBody;
|
|
13322
13446
|
const args = {
|
|
13323
|
-
...Object.fromEntries(
|
|
13324
|
-
...provider
|
|
13447
|
+
...Object.fromEntries(valueInfos.filter((info) => !info.raw).map((info) => [`arg${info.argNum}`, info.value])),
|
|
13448
|
+
...provider.extraArgs
|
|
13325
13449
|
};
|
|
13326
|
-
const language = {
|
|
13327
|
-
datatable: "postgresql",
|
|
13328
|
-
ducklake: "duckdb"
|
|
13329
|
-
}[provider];
|
|
13330
13450
|
async function fetch$1({ resultCollection } = {}) {
|
|
13331
13451
|
if (resultCollection) content = `-- result_collection=${resultCollection}\n${content}`;
|
|
13332
13452
|
try {
|
|
13333
|
-
let result
|
|
13453
|
+
let result;
|
|
13454
|
+
if (workerHasInternalServer()) result = await JobService.runScriptPreviewInline({
|
|
13334
13455
|
workspace: getWorkspace(),
|
|
13335
13456
|
requestBody: {
|
|
13336
13457
|
args,
|
|
13337
13458
|
content,
|
|
13338
|
-
language
|
|
13459
|
+
language: provider.language
|
|
13460
|
+
}
|
|
13461
|
+
});
|
|
13462
|
+
else result = await JobService.runScriptPreviewAndWaitResult({
|
|
13463
|
+
workspace: getWorkspace(),
|
|
13464
|
+
requestBody: {
|
|
13465
|
+
args,
|
|
13466
|
+
content,
|
|
13467
|
+
language: provider.language
|
|
13339
13468
|
}
|
|
13340
13469
|
});
|
|
13341
13470
|
return result;
|
|
@@ -13346,7 +13475,7 @@ function sqlProviderImpl(provider, { name, schema }) {
|
|
|
13346
13475
|
if (body.startsWith("Internal:")) body = body.slice(9).trim();
|
|
13347
13476
|
if (body.startsWith("Error:")) body = body.slice(6).trim();
|
|
13348
13477
|
if (body.startsWith("datatable")) body = body.slice(9).trim();
|
|
13349
|
-
err = Error(`${provider} ${body}`);
|
|
13478
|
+
err = Error(`${provider.providerName} ${body}`);
|
|
13350
13479
|
err.query = contentBody;
|
|
13351
13480
|
err.request = e.request;
|
|
13352
13481
|
}
|
|
@@ -13368,12 +13497,47 @@ function sqlProviderImpl(provider, { name, schema }) {
|
|
|
13368
13497
|
execute: (params) => fetch$1(params)
|
|
13369
13498
|
};
|
|
13370
13499
|
};
|
|
13371
|
-
|
|
13500
|
+
sqlFn.raw = (value) => new RawSql(value);
|
|
13501
|
+
return sqlFn;
|
|
13502
|
+
}
|
|
13503
|
+
/**
|
|
13504
|
+
* Create a SQL template function for PostgreSQL/datatable queries
|
|
13505
|
+
* @param name - Database/datatable name (default: "main")
|
|
13506
|
+
* @returns SQL template function for building parameterized queries
|
|
13507
|
+
* @example
|
|
13508
|
+
* let sql = wmill.datatable()
|
|
13509
|
+
* let name = 'Robin'
|
|
13510
|
+
* let age = 21
|
|
13511
|
+
* await sql`
|
|
13512
|
+
* SELECT * FROM friends
|
|
13513
|
+
* WHERE name = ${name} AND age = ${age}::int
|
|
13514
|
+
* `.fetch()
|
|
13515
|
+
*/
|
|
13516
|
+
function datatable(name = "main") {
|
|
13517
|
+
let { name: n, schema } = parseName(name);
|
|
13518
|
+
let sqlFn = buildSqlTemplateFunction(datatableProvider(n, schema));
|
|
13519
|
+
sqlFn.query = (sqlString, ...params) => {
|
|
13372
13520
|
let arr = Object.assign([sqlString], { raw: [sqlString] });
|
|
13373
13521
|
return sqlFn(arr, ...params);
|
|
13374
13522
|
};
|
|
13375
13523
|
return sqlFn;
|
|
13376
13524
|
}
|
|
13525
|
+
/**
|
|
13526
|
+
* Create a SQL template function for DuckDB/ducklake queries
|
|
13527
|
+
* @param name - DuckDB database name (default: "main")
|
|
13528
|
+
* @returns SQL template function for building parameterized queries
|
|
13529
|
+
* @example
|
|
13530
|
+
* let sql = wmill.ducklake()
|
|
13531
|
+
* let name = 'Robin'
|
|
13532
|
+
* let age = 21
|
|
13533
|
+
* await sql`
|
|
13534
|
+
* SELECT * FROM friends
|
|
13535
|
+
* WHERE name = ${name} AND age = ${age}
|
|
13536
|
+
* `.fetch()
|
|
13537
|
+
*/
|
|
13538
|
+
function ducklake(name = "main") {
|
|
13539
|
+
return buildSqlTemplateFunction(ducklakeProvider(name));
|
|
13540
|
+
}
|
|
13377
13541
|
function inferSqlType(value) {
|
|
13378
13542
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
13379
13543
|
if (Number.isInteger(value)) return "BIGINT";
|
|
@@ -13405,6 +13569,9 @@ function parseName(name) {
|
|
|
13405
13569
|
//#region src/client.ts
|
|
13406
13570
|
const SHARED_FOLDER = "/shared";
|
|
13407
13571
|
let mockedApi = void 0;
|
|
13572
|
+
function workerHasInternalServer() {
|
|
13573
|
+
return /^https?:\/\/(localhost|127\.0\.0\.1)(:|\/|$)/.test(OpenAPI.BASE ?? "");
|
|
13574
|
+
}
|
|
13408
13575
|
/**
|
|
13409
13576
|
* Initialize the Windmill client with authentication token and base URL
|
|
13410
13577
|
* @param token - Authentication token (defaults to WM_TOKEN env variable)
|