@mastra/client-js 1.3.0 → 1.4.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/CHANGELOG.md +234 -0
- package/dist/client.d.ts +182 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +384 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +384 -6
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +1 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/stored-mcp-client.d.ts +30 -0
- package/dist/resources/stored-mcp-client.d.ts.map +1 -0
- package/dist/resources/tool-provider.d.ts +27 -0
- package/dist/resources/tool-provider.d.ts.map +1 -0
- package/dist/resources/workflow.d.ts +8 -0
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/types.d.ts +315 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1126,7 +1126,8 @@ function parseClientRequestContext(requestContext$1) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
function base64RequestContext(requestContext) {
|
|
1128
1128
|
if (requestContext) {
|
|
1129
|
-
|
|
1129
|
+
const bytes = new TextEncoder().encode(JSON.stringify(requestContext));
|
|
1130
|
+
return btoa(Array.from(bytes, (byte) => String.fromCharCode(byte)).join(""));
|
|
1130
1131
|
}
|
|
1131
1132
|
return void 0;
|
|
1132
1133
|
}
|
|
@@ -1284,7 +1285,7 @@ var BaseResource = class {
|
|
|
1284
1285
|
const response = await fetchFn(`${baseUrl.replace(/\/$/, "")}${fullPath}`, {
|
|
1285
1286
|
...options,
|
|
1286
1287
|
headers: {
|
|
1287
|
-
...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT" || options.method === "PATCH") ? { "content-type": "application/json" } : {},
|
|
1288
|
+
...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT" || options.method === "PATCH" || options.method === "DELETE") ? { "content-type": "application/json" } : {},
|
|
1288
1289
|
...headers,
|
|
1289
1290
|
...options.headers
|
|
1290
1291
|
// TODO: Bring this back once we figure out what we/users need to do to make this work with cross-origin requests
|
|
@@ -2247,12 +2248,18 @@ var Agent = class extends BaseResource {
|
|
|
2247
2248
|
return response;
|
|
2248
2249
|
}
|
|
2249
2250
|
async network(messages, params) {
|
|
2251
|
+
const processedParams = {
|
|
2252
|
+
...params,
|
|
2253
|
+
messages,
|
|
2254
|
+
requestContext: parseClientRequestContext(params.requestContext),
|
|
2255
|
+
structuredOutput: params.structuredOutput ? {
|
|
2256
|
+
...params.structuredOutput,
|
|
2257
|
+
schema: zodToJsonSchema2(params.structuredOutput.schema)
|
|
2258
|
+
} : void 0
|
|
2259
|
+
};
|
|
2250
2260
|
const response = await this.request(`/agents/${this.agentId}/network`, {
|
|
2251
2261
|
method: "POST",
|
|
2252
|
-
body:
|
|
2253
|
-
messages,
|
|
2254
|
-
...params
|
|
2255
|
-
},
|
|
2262
|
+
body: processedParams,
|
|
2256
2263
|
stream: true
|
|
2257
2264
|
});
|
|
2258
2265
|
if (!response.body) {
|
|
@@ -3314,6 +3321,17 @@ var Workflow = class extends BaseResource {
|
|
|
3314
3321
|
method: "DELETE"
|
|
3315
3322
|
});
|
|
3316
3323
|
}
|
|
3324
|
+
/**
|
|
3325
|
+
* Retrieves the input/output schema for the workflow
|
|
3326
|
+
* @returns Promise containing parsed inputSchema and outputSchema, or null if not defined
|
|
3327
|
+
*/
|
|
3328
|
+
async getSchema() {
|
|
3329
|
+
const details = await this.details();
|
|
3330
|
+
return {
|
|
3331
|
+
inputSchema: details.inputSchema ? JSON.parse(details.inputSchema) : null,
|
|
3332
|
+
outputSchema: details.outputSchema ? JSON.parse(details.outputSchema) : null
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3317
3335
|
/**
|
|
3318
3336
|
* Creates a new workflow run
|
|
3319
3337
|
* @param params - Optional object containing the optional runId
|
|
@@ -4072,6 +4090,52 @@ var StoredAgent = class extends BaseResource {
|
|
|
4072
4090
|
}
|
|
4073
4091
|
};
|
|
4074
4092
|
|
|
4093
|
+
// src/resources/stored-mcp-client.ts
|
|
4094
|
+
var StoredMCPClient = class extends BaseResource {
|
|
4095
|
+
constructor(options, storedMCPClientId) {
|
|
4096
|
+
super(options);
|
|
4097
|
+
this.storedMCPClientId = storedMCPClientId;
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* Retrieves details about the stored MCP client
|
|
4101
|
+
* @param requestContext - Optional request context to pass as query parameter
|
|
4102
|
+
* @returns Promise containing stored MCP client details
|
|
4103
|
+
*/
|
|
4104
|
+
details(requestContext) {
|
|
4105
|
+
return this.request(
|
|
4106
|
+
`/stored/mcp-clients/${encodeURIComponent(this.storedMCPClientId)}${requestContextQueryString(requestContext)}`
|
|
4107
|
+
);
|
|
4108
|
+
}
|
|
4109
|
+
/**
|
|
4110
|
+
* Updates the stored MCP client with the provided fields
|
|
4111
|
+
* @param params - Fields to update
|
|
4112
|
+
* @param requestContext - Optional request context to pass as query parameter
|
|
4113
|
+
* @returns Promise containing the updated stored MCP client
|
|
4114
|
+
*/
|
|
4115
|
+
update(params, requestContext) {
|
|
4116
|
+
return this.request(
|
|
4117
|
+
`/stored/mcp-clients/${encodeURIComponent(this.storedMCPClientId)}${requestContextQueryString(requestContext)}`,
|
|
4118
|
+
{
|
|
4119
|
+
method: "PATCH",
|
|
4120
|
+
body: params
|
|
4121
|
+
}
|
|
4122
|
+
);
|
|
4123
|
+
}
|
|
4124
|
+
/**
|
|
4125
|
+
* Deletes the stored MCP client
|
|
4126
|
+
* @param requestContext - Optional request context to pass as query parameter
|
|
4127
|
+
* @returns Promise containing deletion confirmation
|
|
4128
|
+
*/
|
|
4129
|
+
delete(requestContext) {
|
|
4130
|
+
return this.request(
|
|
4131
|
+
`/stored/mcp-clients/${encodeURIComponent(this.storedMCPClientId)}${requestContextQueryString(requestContext)}`,
|
|
4132
|
+
{
|
|
4133
|
+
method: "DELETE"
|
|
4134
|
+
}
|
|
4135
|
+
);
|
|
4136
|
+
}
|
|
4137
|
+
};
|
|
4138
|
+
|
|
4075
4139
|
// src/resources/stored-scorer.ts
|
|
4076
4140
|
var StoredScorer = class extends BaseResource {
|
|
4077
4141
|
constructor(options, storedScorerId) {
|
|
@@ -4118,6 +4182,55 @@ var StoredScorer = class extends BaseResource {
|
|
|
4118
4182
|
}
|
|
4119
4183
|
};
|
|
4120
4184
|
|
|
4185
|
+
// src/resources/tool-provider.ts
|
|
4186
|
+
var ToolProvider = class extends BaseResource {
|
|
4187
|
+
constructor(options, providerId) {
|
|
4188
|
+
super(options);
|
|
4189
|
+
this.providerId = providerId;
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* Lists available toolkits from this provider
|
|
4193
|
+
* @returns Promise containing list of toolkits
|
|
4194
|
+
*/
|
|
4195
|
+
listToolkits() {
|
|
4196
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/toolkits`);
|
|
4197
|
+
}
|
|
4198
|
+
/**
|
|
4199
|
+
* Lists available tools from this provider, with optional filtering
|
|
4200
|
+
* @param params - Optional filtering and pagination parameters
|
|
4201
|
+
* @returns Promise containing list of tools
|
|
4202
|
+
*/
|
|
4203
|
+
listTools(params) {
|
|
4204
|
+
const searchParams = new URLSearchParams();
|
|
4205
|
+
if (params?.toolkit) {
|
|
4206
|
+
searchParams.set("toolkit", params.toolkit);
|
|
4207
|
+
}
|
|
4208
|
+
if (params?.search) {
|
|
4209
|
+
searchParams.set("search", params.search);
|
|
4210
|
+
}
|
|
4211
|
+
if (params?.page !== void 0) {
|
|
4212
|
+
searchParams.set("page", String(params.page));
|
|
4213
|
+
}
|
|
4214
|
+
if (params?.perPage !== void 0) {
|
|
4215
|
+
searchParams.set("perPage", String(params.perPage));
|
|
4216
|
+
}
|
|
4217
|
+
const queryString = searchParams.toString();
|
|
4218
|
+
return this.request(
|
|
4219
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/tools${queryString ? `?${queryString}` : ""}`
|
|
4220
|
+
);
|
|
4221
|
+
}
|
|
4222
|
+
/**
|
|
4223
|
+
* Gets the input schema for a specific tool
|
|
4224
|
+
* @param toolSlug - The slug of the tool
|
|
4225
|
+
* @returns Promise containing the tool's JSON schema
|
|
4226
|
+
*/
|
|
4227
|
+
getToolSchema(toolSlug) {
|
|
4228
|
+
return this.request(
|
|
4229
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/tools/${encodeURIComponent(toolSlug)}/schema`
|
|
4230
|
+
);
|
|
4231
|
+
}
|
|
4232
|
+
};
|
|
4233
|
+
|
|
4121
4234
|
// src/resources/workspace.ts
|
|
4122
4235
|
var WorkspaceSkillResource = class extends BaseResource {
|
|
4123
4236
|
constructor(options, workspaceId, skillName) {
|
|
@@ -5050,6 +5163,76 @@ var MastraClient = class extends BaseResource {
|
|
|
5050
5163
|
return new StoredScorer(this.options, storedScorerId);
|
|
5051
5164
|
}
|
|
5052
5165
|
// ============================================================================
|
|
5166
|
+
// Stored MCP Clients
|
|
5167
|
+
// ============================================================================
|
|
5168
|
+
/**
|
|
5169
|
+
* Lists all stored MCP clients with optional pagination
|
|
5170
|
+
* @param params - Optional pagination and ordering parameters
|
|
5171
|
+
* @returns Promise containing paginated list of stored MCP clients
|
|
5172
|
+
*/
|
|
5173
|
+
listStoredMCPClients(params) {
|
|
5174
|
+
const searchParams = new URLSearchParams();
|
|
5175
|
+
if (params?.page !== void 0) {
|
|
5176
|
+
searchParams.set("page", String(params.page));
|
|
5177
|
+
}
|
|
5178
|
+
if (params?.perPage !== void 0) {
|
|
5179
|
+
searchParams.set("perPage", String(params.perPage));
|
|
5180
|
+
}
|
|
5181
|
+
if (params?.orderBy) {
|
|
5182
|
+
if (params.orderBy.field) {
|
|
5183
|
+
searchParams.set("orderBy[field]", params.orderBy.field);
|
|
5184
|
+
}
|
|
5185
|
+
if (params.orderBy.direction) {
|
|
5186
|
+
searchParams.set("orderBy[direction]", params.orderBy.direction);
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5189
|
+
if (params?.authorId) {
|
|
5190
|
+
searchParams.set("authorId", params.authorId);
|
|
5191
|
+
}
|
|
5192
|
+
if (params?.metadata) {
|
|
5193
|
+
searchParams.set("metadata", JSON.stringify(params.metadata));
|
|
5194
|
+
}
|
|
5195
|
+
const queryString = searchParams.toString();
|
|
5196
|
+
return this.request(`/stored/mcp-clients${queryString ? `?${queryString}` : ""}`);
|
|
5197
|
+
}
|
|
5198
|
+
/**
|
|
5199
|
+
* Creates a new stored MCP client
|
|
5200
|
+
* @param params - MCP client configuration
|
|
5201
|
+
* @returns Promise containing the created stored MCP client
|
|
5202
|
+
*/
|
|
5203
|
+
createStoredMCPClient(params) {
|
|
5204
|
+
return this.request("/stored/mcp-clients", {
|
|
5205
|
+
method: "POST",
|
|
5206
|
+
body: params
|
|
5207
|
+
});
|
|
5208
|
+
}
|
|
5209
|
+
/**
|
|
5210
|
+
* Gets a stored MCP client instance by ID for further operations (details, update, delete)
|
|
5211
|
+
* @param storedMCPClientId - ID of the stored MCP client
|
|
5212
|
+
* @returns StoredMCPClient instance
|
|
5213
|
+
*/
|
|
5214
|
+
getStoredMCPClient(storedMCPClientId) {
|
|
5215
|
+
return new StoredMCPClient(this.options, storedMCPClientId);
|
|
5216
|
+
}
|
|
5217
|
+
// ============================================================================
|
|
5218
|
+
// Tool Providers
|
|
5219
|
+
// ============================================================================
|
|
5220
|
+
/**
|
|
5221
|
+
* Lists all registered tool providers
|
|
5222
|
+
* @returns Promise containing list of tool provider info
|
|
5223
|
+
*/
|
|
5224
|
+
listToolProviders() {
|
|
5225
|
+
return this.request("/tool-providers");
|
|
5226
|
+
}
|
|
5227
|
+
/**
|
|
5228
|
+
* Gets a tool provider instance by ID for further operations (listToolkits, listTools, getToolSchema)
|
|
5229
|
+
* @param providerId - ID of the tool provider
|
|
5230
|
+
* @returns ToolProvider instance
|
|
5231
|
+
*/
|
|
5232
|
+
getToolProvider(providerId) {
|
|
5233
|
+
return new ToolProvider(this.options, providerId);
|
|
5234
|
+
}
|
|
5235
|
+
// ============================================================================
|
|
5053
5236
|
// System
|
|
5054
5237
|
// ============================================================================
|
|
5055
5238
|
/**
|
|
@@ -5094,6 +5277,201 @@ var MastraClient = class extends BaseResource {
|
|
|
5094
5277
|
listEmbedders() {
|
|
5095
5278
|
return this.request("/embedders");
|
|
5096
5279
|
}
|
|
5280
|
+
// ============================================================================
|
|
5281
|
+
// Datasets
|
|
5282
|
+
// ============================================================================
|
|
5283
|
+
/**
|
|
5284
|
+
* Lists all datasets with optional pagination
|
|
5285
|
+
*/
|
|
5286
|
+
listDatasets(pagination) {
|
|
5287
|
+
const searchParams = new URLSearchParams();
|
|
5288
|
+
if (pagination?.page !== void 0) searchParams.set("page", String(pagination.page));
|
|
5289
|
+
if (pagination?.perPage !== void 0) searchParams.set("perPage", String(pagination.perPage));
|
|
5290
|
+
const qs = searchParams.toString();
|
|
5291
|
+
return this.request(`/datasets${qs ? `?${qs}` : ""}`);
|
|
5292
|
+
}
|
|
5293
|
+
/**
|
|
5294
|
+
* Gets a single dataset by ID
|
|
5295
|
+
*/
|
|
5296
|
+
getDataset(datasetId) {
|
|
5297
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}`);
|
|
5298
|
+
}
|
|
5299
|
+
/**
|
|
5300
|
+
* Creates a new dataset
|
|
5301
|
+
*/
|
|
5302
|
+
createDataset(params) {
|
|
5303
|
+
return this.request("/datasets", { method: "POST", body: params });
|
|
5304
|
+
}
|
|
5305
|
+
/**
|
|
5306
|
+
* Updates a dataset
|
|
5307
|
+
*/
|
|
5308
|
+
updateDataset(params) {
|
|
5309
|
+
const { datasetId, ...body } = params;
|
|
5310
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}`, {
|
|
5311
|
+
method: "PATCH",
|
|
5312
|
+
body
|
|
5313
|
+
});
|
|
5314
|
+
}
|
|
5315
|
+
/**
|
|
5316
|
+
* Deletes a dataset
|
|
5317
|
+
*/
|
|
5318
|
+
deleteDataset(datasetId) {
|
|
5319
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}`, {
|
|
5320
|
+
method: "DELETE"
|
|
5321
|
+
});
|
|
5322
|
+
}
|
|
5323
|
+
// ============================================================================
|
|
5324
|
+
// Dataset Items
|
|
5325
|
+
// ============================================================================
|
|
5326
|
+
/**
|
|
5327
|
+
* Lists items in a dataset with optional pagination, search, and version filter
|
|
5328
|
+
*/
|
|
5329
|
+
listDatasetItems(datasetId, params) {
|
|
5330
|
+
const searchParams = new URLSearchParams();
|
|
5331
|
+
if (params?.page !== void 0) searchParams.set("page", String(params.page));
|
|
5332
|
+
if (params?.perPage !== void 0) searchParams.set("perPage", String(params.perPage));
|
|
5333
|
+
if (params?.search) searchParams.set("search", params.search);
|
|
5334
|
+
if (params?.version != null) {
|
|
5335
|
+
searchParams.set("version", String(params.version));
|
|
5336
|
+
}
|
|
5337
|
+
const qs = searchParams.toString();
|
|
5338
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items${qs ? `?${qs}` : ""}`);
|
|
5339
|
+
}
|
|
5340
|
+
/**
|
|
5341
|
+
* Gets a single dataset item by ID
|
|
5342
|
+
*/
|
|
5343
|
+
getDatasetItem(datasetId, itemId) {
|
|
5344
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/${encodeURIComponent(itemId)}`);
|
|
5345
|
+
}
|
|
5346
|
+
/**
|
|
5347
|
+
* Adds an item to a dataset
|
|
5348
|
+
*/
|
|
5349
|
+
addDatasetItem(params) {
|
|
5350
|
+
const { datasetId, ...body } = params;
|
|
5351
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items`, {
|
|
5352
|
+
method: "POST",
|
|
5353
|
+
body
|
|
5354
|
+
});
|
|
5355
|
+
}
|
|
5356
|
+
/**
|
|
5357
|
+
* Updates a dataset item
|
|
5358
|
+
*/
|
|
5359
|
+
updateDatasetItem(params) {
|
|
5360
|
+
const { datasetId, itemId, ...body } = params;
|
|
5361
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/${encodeURIComponent(itemId)}`, {
|
|
5362
|
+
method: "PATCH",
|
|
5363
|
+
body
|
|
5364
|
+
});
|
|
5365
|
+
}
|
|
5366
|
+
/**
|
|
5367
|
+
* Deletes a dataset item
|
|
5368
|
+
*/
|
|
5369
|
+
deleteDatasetItem(datasetId, itemId) {
|
|
5370
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/${encodeURIComponent(itemId)}`, {
|
|
5371
|
+
method: "DELETE"
|
|
5372
|
+
});
|
|
5373
|
+
}
|
|
5374
|
+
/**
|
|
5375
|
+
* Batch inserts items to a dataset
|
|
5376
|
+
*/
|
|
5377
|
+
batchInsertDatasetItems(params) {
|
|
5378
|
+
const { datasetId, ...body } = params;
|
|
5379
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/batch`, {
|
|
5380
|
+
method: "POST",
|
|
5381
|
+
body
|
|
5382
|
+
});
|
|
5383
|
+
}
|
|
5384
|
+
/**
|
|
5385
|
+
* Batch deletes items from a dataset
|
|
5386
|
+
*/
|
|
5387
|
+
batchDeleteDatasetItems(params) {
|
|
5388
|
+
const { datasetId, ...body } = params;
|
|
5389
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/batch`, {
|
|
5390
|
+
method: "DELETE",
|
|
5391
|
+
body
|
|
5392
|
+
});
|
|
5393
|
+
}
|
|
5394
|
+
// ============================================================================
|
|
5395
|
+
// Dataset Item Versions
|
|
5396
|
+
// ============================================================================
|
|
5397
|
+
/**
|
|
5398
|
+
* Lists versions for a dataset item
|
|
5399
|
+
*/
|
|
5400
|
+
getItemHistory(datasetId, itemId) {
|
|
5401
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/items/${encodeURIComponent(itemId)}/history`);
|
|
5402
|
+
}
|
|
5403
|
+
/**
|
|
5404
|
+
* Gets a specific version of a dataset item
|
|
5405
|
+
*/
|
|
5406
|
+
getDatasetItemVersion(datasetId, itemId, datasetVersion) {
|
|
5407
|
+
return this.request(
|
|
5408
|
+
`/datasets/${encodeURIComponent(datasetId)}/items/${encodeURIComponent(itemId)}/versions/${datasetVersion}`
|
|
5409
|
+
);
|
|
5410
|
+
}
|
|
5411
|
+
// ============================================================================
|
|
5412
|
+
// Dataset Versions
|
|
5413
|
+
// ============================================================================
|
|
5414
|
+
/**
|
|
5415
|
+
* Lists versions for a dataset
|
|
5416
|
+
*/
|
|
5417
|
+
listDatasetVersions(datasetId, pagination) {
|
|
5418
|
+
const searchParams = new URLSearchParams();
|
|
5419
|
+
if (pagination?.page !== void 0) searchParams.set("page", String(pagination.page));
|
|
5420
|
+
if (pagination?.perPage !== void 0) searchParams.set("perPage", String(pagination.perPage));
|
|
5421
|
+
const qs = searchParams.toString();
|
|
5422
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/versions${qs ? `?${qs}` : ""}`);
|
|
5423
|
+
}
|
|
5424
|
+
// ============================================================================
|
|
5425
|
+
// Dataset Experiments
|
|
5426
|
+
// ============================================================================
|
|
5427
|
+
/**
|
|
5428
|
+
* Lists experiments for a dataset
|
|
5429
|
+
*/
|
|
5430
|
+
listDatasetExperiments(datasetId, pagination) {
|
|
5431
|
+
const searchParams = new URLSearchParams();
|
|
5432
|
+
if (pagination?.page !== void 0) searchParams.set("page", String(pagination.page));
|
|
5433
|
+
if (pagination?.perPage !== void 0) searchParams.set("perPage", String(pagination.perPage));
|
|
5434
|
+
const qs = searchParams.toString();
|
|
5435
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/experiments${qs ? `?${qs}` : ""}`);
|
|
5436
|
+
}
|
|
5437
|
+
/**
|
|
5438
|
+
* Gets a single dataset experiment by ID
|
|
5439
|
+
*/
|
|
5440
|
+
getDatasetExperiment(datasetId, experimentId) {
|
|
5441
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/experiments/${encodeURIComponent(experimentId)}`);
|
|
5442
|
+
}
|
|
5443
|
+
/**
|
|
5444
|
+
* Lists results for a dataset experiment
|
|
5445
|
+
*/
|
|
5446
|
+
listDatasetExperimentResults(datasetId, experimentId, pagination) {
|
|
5447
|
+
const searchParams = new URLSearchParams();
|
|
5448
|
+
if (pagination?.page !== void 0) searchParams.set("page", String(pagination.page));
|
|
5449
|
+
if (pagination?.perPage !== void 0) searchParams.set("perPage", String(pagination.perPage));
|
|
5450
|
+
const qs = searchParams.toString();
|
|
5451
|
+
return this.request(
|
|
5452
|
+
`/datasets/${encodeURIComponent(datasetId)}/experiments/${encodeURIComponent(experimentId)}/results${qs ? `?${qs}` : ""}`
|
|
5453
|
+
);
|
|
5454
|
+
}
|
|
5455
|
+
/**
|
|
5456
|
+
* Triggers a new dataset experiment
|
|
5457
|
+
*/
|
|
5458
|
+
triggerDatasetExperiment(params) {
|
|
5459
|
+
const { datasetId, ...body } = params;
|
|
5460
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/experiments`, {
|
|
5461
|
+
method: "POST",
|
|
5462
|
+
body
|
|
5463
|
+
});
|
|
5464
|
+
}
|
|
5465
|
+
/**
|
|
5466
|
+
* Compares two dataset experiments for regression detection
|
|
5467
|
+
*/
|
|
5468
|
+
compareExperiments(params) {
|
|
5469
|
+
const { datasetId, ...body } = params;
|
|
5470
|
+
return this.request(`/datasets/${encodeURIComponent(datasetId)}/compare`, {
|
|
5471
|
+
method: "POST",
|
|
5472
|
+
body
|
|
5473
|
+
});
|
|
5474
|
+
}
|
|
5097
5475
|
};
|
|
5098
5476
|
|
|
5099
5477
|
// src/tools.ts
|