windmill-client 1.813.0 → 1.815.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.
@@ -29,7 +29,7 @@ const OpenAPI = {
29
29
  PASSWORD: void 0,
30
30
  TOKEN: getEnv("WM_TOKEN"),
31
31
  USERNAME: void 0,
32
- VERSION: "1.813.0",
32
+ VERSION: "1.815.0",
33
33
  WITH_CREDENTIALS: !getEnv("WM_RAW_APP"),
34
34
  interceptors: {
35
35
  request: new Interceptors(),
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.813.0",
129
+ VERSION: "1.815.0",
130
130
  WITH_CREDENTIALS: !getEnv$1("WM_RAW_APP"),
131
131
  interceptors: {
132
132
  request: new Interceptors(),
@@ -725,6 +725,20 @@ var UserService = class {
725
725
  });
726
726
  }
727
727
  /**
728
+ * consume a single-use login link from its confirmation page, set the session cookie and answer where to go
729
+ * @param data The data for the request.
730
+ * @param data.token
731
+ * @returns unknown the post-login destination, or /user/login_link_expired when the link is used, expired or unknown
732
+ * @throws ApiError
733
+ */
734
+ static confirmLoginLink(data) {
735
+ return request(OpenAPI, {
736
+ method: "POST",
737
+ url: "/auth/login_link/{token}",
738
+ path: { token: data.token }
739
+ });
740
+ }
741
+ /**
728
742
  * reset password using token
729
743
  * @param data The data for the request.
730
744
  * @param data.requestBody token and new password
@@ -3102,6 +3116,63 @@ var WorkspaceService = class {
3102
3116
  });
3103
3117
  }
3104
3118
  /**
3119
+ * get who may connect to a data table as which role
3120
+ * @param data The data for the request.
3121
+ * @param data.workspace
3122
+ * @param data.datatableName
3123
+ * @returns DatatablePermissions the data table's roles and their tenants
3124
+ * @throws ApiError
3125
+ */
3126
+ static getDatatablePermissions(data) {
3127
+ return request(OpenAPI, {
3128
+ method: "GET",
3129
+ url: "/w/{workspace}/workspaces/datatable_permissions/{datatable_name}",
3130
+ path: {
3131
+ workspace: data.workspace,
3132
+ datatable_name: data.datatableName
3133
+ }
3134
+ });
3135
+ }
3136
+ /**
3137
+ * set who may connect to a data table as which role
3138
+ * @param data The data for the request.
3139
+ * @param data.workspace
3140
+ * @param data.datatableName
3141
+ * @param data.requestBody
3142
+ * @returns string status
3143
+ * @throws ApiError
3144
+ */
3145
+ static setDatatablePermissions(data) {
3146
+ return request(OpenAPI, {
3147
+ method: "POST",
3148
+ url: "/w/{workspace}/workspaces/datatable_permissions/{datatable_name}",
3149
+ path: {
3150
+ workspace: data.workspace,
3151
+ datatable_name: data.datatableName
3152
+ },
3153
+ body: data.requestBody,
3154
+ mediaType: "application/json"
3155
+ });
3156
+ }
3157
+ /**
3158
+ * list the data table roles the caller may connect as
3159
+ * @param data The data for the request.
3160
+ * @param data.workspace
3161
+ * @param data.datatableName
3162
+ * @returns unknown usable roles
3163
+ * @throws ApiError
3164
+ */
3165
+ static listUsableDatatableRoles(data) {
3166
+ return request(OpenAPI, {
3167
+ method: "GET",
3168
+ url: "/w/{workspace}/workspaces/datatable_usable_roles/{datatable_name}",
3169
+ path: {
3170
+ workspace: data.workspace,
3171
+ datatable_name: data.datatableName
3172
+ }
3173
+ });
3174
+ }
3175
+ /**
3105
3176
  * list schemas of all connected Datatables
3106
3177
  * @param data The data for the request.
3107
3178
  * @param data.workspace
@@ -3628,6 +3699,24 @@ var WorkspaceService = class {
3628
3699
  });
3629
3700
  }
3630
3701
  /**
3702
+ * choose whether new forks of this workspace start with its admins and developers
3703
+ * When on, every fork created from this workspace gets the workspace's admins and developers as members, with the role they hold here; operators, disabled users and service accounts are left out. The setting is copied into each fork, so forks of a fork follow it too. Off by default. Workspace-admin gated.
3704
+ * @param data The data for the request.
3705
+ * @param data.workspace
3706
+ * @param data.requestBody Whether new forks start with this workspace's admins and developers
3707
+ * @returns string status
3708
+ * @throws ApiError
3709
+ */
3710
+ static editAddAdminsAndDevelopersToForks(data) {
3711
+ return request(OpenAPI, {
3712
+ method: "POST",
3713
+ url: "/w/{workspace}/workspaces/edit_add_admins_and_developers_to_forks",
3714
+ path: { workspace: data.workspace },
3715
+ body: data.requestBody,
3716
+ mediaType: "application/json"
3717
+ });
3718
+ }
3719
+ /**
3631
3720
  * set the key guest JWTs are verified against for this workspace
3632
3721
  * A guest JWT (`jwt_guest_`) is minted by the embedding customer's own backend and verified against this key: a PEM public key (RS/ES family, HS* refused) or a JWKS URL, at most one. Both empty clears the workspace key; off cloud, verification then falls back to the instance issuer (`JWT_EXT_JWKS_URL`) if one is set, else no guest JWT is accepted (`guest_access_enabled` is the on/off switch). Workspace-admin gated. The key is validated before it is stored. Setting a key is refused with a 400 where guests are unavailable (the shared cloud); clearing one always works.
3633
3722
  * @param data The data for the request.
@@ -4146,6 +4235,63 @@ var SettingService = class {
4146
4235
  });
4147
4236
  }
4148
4237
  /**
4238
+ * list the instance's data table roles
4239
+ * @returns InstanceDatatableRole the instance role catalog
4240
+ * @throws ApiError
4241
+ */
4242
+ static listInstanceDatatableRoles() {
4243
+ return request(OpenAPI, {
4244
+ method: "GET",
4245
+ url: "/settings/datatable_roles"
4246
+ });
4247
+ }
4248
+ /**
4249
+ * create a data table role on the instance's Postgres cluster
4250
+ * @param data The data for the request.
4251
+ * @param data.requestBody
4252
+ * @returns InstanceDatatableRole the created role
4253
+ * @throws ApiError
4254
+ */
4255
+ static createInstanceDatatableRole(data) {
4256
+ return request(OpenAPI, {
4257
+ method: "POST",
4258
+ url: "/settings/datatable_roles",
4259
+ body: data.requestBody,
4260
+ mediaType: "application/json"
4261
+ });
4262
+ }
4263
+ /**
4264
+ * rename a data table role or turn its login on and off
4265
+ * @param data The data for the request.
4266
+ * @param data.id
4267
+ * @param data.requestBody
4268
+ * @returns InstanceDatatableRole the updated role
4269
+ * @throws ApiError
4270
+ */
4271
+ static updateInstanceDatatableRole(data) {
4272
+ return request(OpenAPI, {
4273
+ method: "POST",
4274
+ url: "/settings/datatable_roles/{id}",
4275
+ path: { id: data.id },
4276
+ body: data.requestBody,
4277
+ mediaType: "application/json"
4278
+ });
4279
+ }
4280
+ /**
4281
+ * drop a data table role from the cluster and from every workspace that named it
4282
+ * @param data The data for the request.
4283
+ * @param data.id
4284
+ * @returns unknown deleted
4285
+ * @throws ApiError
4286
+ */
4287
+ static deleteInstanceDatatableRole(data) {
4288
+ return request(OpenAPI, {
4289
+ method: "DELETE",
4290
+ url: "/settings/datatable_roles/{id}",
4291
+ path: { id: data.id }
4292
+ });
4293
+ }
4294
+ /**
4149
4295
  * Runs CREATE DATABASE on the Windmill Postgres and grants access to the custom_instance_user
4150
4296
  * @param data The data for the request.
4151
4297
  * @param data.name The name of the database to create
@@ -8780,7 +8926,7 @@ var JobService = class {
8780
8926
  *
8781
8927
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8782
8928
  * @param data.skipPreprocessor skip the preprocessor
8783
- * @param data.memoryId memory ID for chat-enabled flows
8929
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8784
8930
  * @returns unknown job result
8785
8931
  * @throws ApiError
8786
8932
  */
@@ -8816,7 +8962,7 @@ var JobService = class {
8816
8962
  *
8817
8963
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8818
8964
  * @param data.skipPreprocessor skip the preprocessor
8819
- * @param data.memoryId memory ID for chat-enabled flows
8965
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8820
8966
  * @returns unknown job result
8821
8967
  * @throws ApiError
8822
8968
  */
@@ -8854,7 +9000,7 @@ var JobService = class {
8854
9000
  *
8855
9001
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8856
9002
  * @param data.skipPreprocessor skip the preprocessor
8857
- * @param data.memoryId memory ID for chat-enabled flows
9003
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8858
9004
  * @returns unknown job result
8859
9005
  * @throws ApiError
8860
9006
  */
@@ -8889,7 +9035,7 @@ var JobService = class {
8889
9035
  *
8890
9036
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8891
9037
  * @param data.skipPreprocessor skip the preprocessor
8892
- * @param data.memoryId memory ID for chat-enabled flows
9038
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8893
9039
  * @param data.pollDelayMs delay between polling for job updates in milliseconds
8894
9040
  * @returns string server-sent events stream of job updates
8895
9041
  * @throws ApiError
@@ -8929,7 +9075,7 @@ var JobService = class {
8929
9075
  *
8930
9076
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8931
9077
  * @param data.skipPreprocessor skip the preprocessor
8932
- * @param data.memoryId memory ID for chat-enabled flows
9078
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8933
9079
  * @param data.pollDelayMs delay between polling for job updates in milliseconds
8934
9080
  * @returns string server-sent events stream of job updates
8935
9081
  * @throws ApiError
@@ -8966,7 +9112,7 @@ var JobService = class {
8966
9112
  *
8967
9113
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
8968
9114
  * @param data.skipPreprocessor skip the preprocessor
8969
- * @param data.memoryId memory ID for chat-enabled flows
9115
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
8970
9116
  * @param data.pollDelayMs delay between polling for job updates in milliseconds
8971
9117
  * @returns string server-sent events stream of job updates
8972
9118
  * @throws ApiError
@@ -9006,7 +9152,7 @@ var JobService = class {
9006
9152
  *
9007
9153
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
9008
9154
  * @param data.skipPreprocessor skip the preprocessor
9009
- * @param data.memoryId memory ID for chat-enabled flows
9155
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
9010
9156
  * @param data.pollDelayMs delay between polling for job updates in milliseconds
9011
9157
  * @returns string server-sent events stream of job updates
9012
9158
  * @throws ApiError
@@ -9276,7 +9422,7 @@ var JobService = class {
9276
9422
  * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key
9277
9423
  *
9278
9424
  * @param data.invisibleToOwner make the run invisible to the the flow owner (default false)
9279
- * @param data.memoryId memory ID for chat-enabled flows
9425
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
9280
9426
  * @returns string job created
9281
9427
  * @throws ApiError
9282
9428
  */
@@ -9319,7 +9465,7 @@ var JobService = class {
9319
9465
  * Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key
9320
9466
  *
9321
9467
  * @param data.invisibleToOwner make the run invisible to the the flow owner (default false)
9322
- * @param data.memoryId memory ID for chat-enabled flows
9468
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
9323
9469
  * @returns string job created
9324
9470
  * @throws ApiError
9325
9471
  */
@@ -9634,7 +9780,7 @@ var JobService = class {
9634
9780
  *
9635
9781
  * @param data.invisibleToOwner make the run invisible to the the script owner (default false)
9636
9782
  * @param data.jobId The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
9637
- * @param data.memoryId memory ID for chat-enabled flows
9783
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
9638
9784
  * @returns string job created
9639
9785
  * @throws ApiError
9640
9786
  */
@@ -9658,7 +9804,7 @@ var JobService = class {
9658
9804
  * @param data The data for the request.
9659
9805
  * @param data.workspace
9660
9806
  * @param data.requestBody preview
9661
- * @param data.memoryId memory ID for chat-enabled flows
9807
+ * @param data.memoryId Memory id for the flow's AI agent steps. A uuid is used as is; any other string is hashed within the workspace and flow, so the same string always names the same memory of that flow.
9662
9808
  * @returns unknown job result
9663
9809
  * @throws ApiError
9664
9810
  */
@@ -11433,6 +11579,7 @@ var FlowConversationsService = class {
11433
11579
  * @param data.page which page to return (start at 1, default 1)
11434
11580
  * @param data.perPage number of items to return for a given page (default 30, max 100)
11435
11581
  * @param data.flowPath filter conversations by flow path
11582
+ * @param data.kind which conversations to list - the flow editor's test chats, the deployed flow's own (the default), or both
11436
11583
  * @returns FlowConversation flow conversations list
11437
11584
  * @throws ApiError
11438
11585
  */
@@ -11444,11 +11591,33 @@ var FlowConversationsService = class {
11444
11591
  query: {
11445
11592
  page: data.page,
11446
11593
  per_page: data.perPage,
11447
- flow_path: data.flowPath
11594
+ flow_path: data.flowPath,
11595
+ kind: data.kind
11448
11596
  }
11449
11597
  });
11450
11598
  }
11451
11599
  /**
11600
+ * rename flow conversation
11601
+ * @param data The data for the request.
11602
+ * @param data.workspace
11603
+ * @param data.conversationId conversation id
11604
+ * @param data.requestBody
11605
+ * @returns string flow conversation updated
11606
+ * @throws ApiError
11607
+ */
11608
+ static updateFlowConversation(data) {
11609
+ return request(OpenAPI, {
11610
+ method: "POST",
11611
+ url: "/w/{workspace}/flow_conversations/update/{conversation_id}",
11612
+ path: {
11613
+ workspace: data.workspace,
11614
+ conversation_id: data.conversationId
11615
+ },
11616
+ body: data.requestBody,
11617
+ mediaType: "application/json"
11618
+ });
11619
+ }
11620
+ /**
11452
11621
  * delete flow conversation
11453
11622
  * @param data The data for the request.
11454
11623
  * @param data.workspace
@@ -18193,11 +18362,14 @@ var RawSql = class {
18193
18362
  this.value = value;
18194
18363
  }
18195
18364
  };
18196
- function datatableProvider(name, schema) {
18365
+ const ROLE_NAME_RE = /^[A-Za-z0-9_-]{1,63}$/;
18366
+ function datatableProvider(name, schema, role) {
18367
+ if (role !== void 0 && !ROLE_NAME_RE.test(role)) throw new Error(`Invalid data table role '${role}': only letters, digits, '_' and '-' are allowed`);
18197
18368
  return {
18198
18369
  providerName: "datatable",
18199
18370
  language: "postgresql",
18200
18371
  extraArgs: { database: `datatable://${name}` },
18372
+ annotations: () => role !== void 0 ? `-- role ${role}\n` : "",
18201
18373
  formatArgDecl: (argNum) => `-- $${argNum} arg${argNum}`,
18202
18374
  formatArgUsage: (argNum, explicitType, inferredType) => explicitType !== void 0 ? `$${argNum}` : `$${argNum}::${inferredType}`,
18203
18375
  preamble: () => schema ? `SET search_path TO "${schema}";\n` : ""
@@ -18208,6 +18380,7 @@ function ducklakeProvider(name, schema) {
18208
18380
  providerName: "ducklake",
18209
18381
  language: "duckdb",
18210
18382
  extraArgs: {},
18383
+ annotations: () => "",
18211
18384
  formatArgDecl: (argNum, argType) => `-- $arg${argNum} (${argType})`,
18212
18385
  formatArgUsage: (argNum) => `$arg${argNum}`,
18213
18386
  preamble: () => `ATTACH 'ducklake://${name}' AS dl;USE dl${schema ? `."${schema}"` : ""};\n`
@@ -18295,7 +18468,8 @@ function buildSqlTemplateFunction(provider) {
18295
18468
  let argType = parseTypeAnnotation(strings[info.originalIndex], strings[info.originalIndex + 1]) || inferSqlType(info.value);
18296
18469
  return provider.formatArgDecl(info.argNum, argType);
18297
18470
  });
18298
- let content = argDecls.length ? argDecls.join("\n") + "\n" : "";
18471
+ let content = provider.annotations();
18472
+ content += argDecls.length ? argDecls.join("\n") + "\n" : "";
18299
18473
  content += provider.preamble();
18300
18474
  let contentBody = "";
18301
18475
  for (let i = 0; i < strings.length; i++) {
@@ -18323,6 +18497,8 @@ function buildSqlTemplateFunction(provider) {
18323
18497
  /**
18324
18498
  * Create a SQL template function for PostgreSQL/datatable queries
18325
18499
  * @param name - Database/datatable name (default: "main")
18500
+ * @param opts.role - Connect as this data table role instead of the data table's default one.
18501
+ * Only meaningful on a data table under roles, and only for a role you are a tenant of.
18326
18502
  * @returns SQL template function for building parameterized queries
18327
18503
  * @example
18328
18504
  * let sql = wmill.datatable()
@@ -18332,15 +18508,18 @@ function buildSqlTemplateFunction(provider) {
18332
18508
  * SELECT * FROM friends
18333
18509
  * WHERE name = ${name} AND age = ${age}::int
18334
18510
  * `.fetch()
18511
+ * @example
18512
+ * // Read through a restricted role
18513
+ * let sql = wmill.datatable("main", { role: "analytics" })
18335
18514
  */
18336
- function datatable(name = "main") {
18515
+ function datatable(name = "main", opts) {
18337
18516
  let { name: n, schema } = parseName(name);
18338
- let provider = datatableProvider(n, schema);
18517
+ let provider = datatableProvider(n, schema, opts?.role);
18339
18518
  let sqlFn = buildSqlTemplateFunction(provider);
18340
18519
  sqlFn.query = (sqlString, ...params) => {
18341
18520
  let argDecls = params.map((v, i) => `-- $${i + 1} arg${i + 1} (${inferSqlType(v)})`).join("\n");
18342
18521
  let contentBody = sqlString;
18343
- let content = (argDecls ? argDecls + "\n" : "") + provider.preamble() + sqlString;
18522
+ let content = provider.annotations() + (argDecls ? argDecls + "\n" : "") + provider.preamble() + sqlString;
18344
18523
  let args = {
18345
18524
  ...Object.fromEntries(params.map((v, i) => [`arg${i + 1}`, serializeArgValue(v)])),
18346
18525
  ...provider.extraArgs