@mastra/client-js 1.22.0-alpha.3 → 1.22.0-alpha.4
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 +97 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +115 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +115 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/tool-provider.d.ts +57 -10
- package/dist/resources/tool-provider.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +773 -1
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +73 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5238,16 +5238,13 @@ var ToolProvider = class extends BaseResource {
|
|
|
5238
5238
|
}
|
|
5239
5239
|
providerId;
|
|
5240
5240
|
/**
|
|
5241
|
-
* Lists available toolkits from this provider
|
|
5242
|
-
* @returns Promise containing list of toolkits
|
|
5241
|
+
* Lists available toolkits from this provider.
|
|
5243
5242
|
*/
|
|
5244
5243
|
listToolkits() {
|
|
5245
5244
|
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/toolkits`);
|
|
5246
5245
|
}
|
|
5247
5246
|
/**
|
|
5248
|
-
* Lists available tools from this provider, with optional filtering
|
|
5249
|
-
* @param params - Optional filtering and pagination parameters
|
|
5250
|
-
* @returns Promise containing list of tools
|
|
5247
|
+
* Lists available tools from this provider, with optional filtering.
|
|
5251
5248
|
*/
|
|
5252
5249
|
listTools(params) {
|
|
5253
5250
|
const searchParams = new URLSearchParams();
|
|
@@ -5269,15 +5266,125 @@ var ToolProvider = class extends BaseResource {
|
|
|
5269
5266
|
);
|
|
5270
5267
|
}
|
|
5271
5268
|
/**
|
|
5272
|
-
* Gets the input schema for a specific tool
|
|
5273
|
-
* @param toolSlug - The slug of the tool
|
|
5274
|
-
* @returns Promise containing the tool's JSON schema
|
|
5269
|
+
* Gets the input schema for a specific tool.
|
|
5275
5270
|
*/
|
|
5276
5271
|
getToolSchema(toolSlug) {
|
|
5277
5272
|
return this.request(
|
|
5278
5273
|
`/tool-providers/${encodeURIComponent(this.providerId)}/tools/${encodeURIComponent(toolSlug)}/schema`
|
|
5279
5274
|
);
|
|
5280
5275
|
}
|
|
5276
|
+
/**
|
|
5277
|
+
* Starts an OAuth flow for a (toolkit, connectionId) pair. Returns a
|
|
5278
|
+
* redirect URL and an opaque auth handle to poll with `getAuthStatus`.
|
|
5279
|
+
*/
|
|
5280
|
+
authorize(params) {
|
|
5281
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/authorize`, {
|
|
5282
|
+
method: "POST",
|
|
5283
|
+
body: params
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5286
|
+
/**
|
|
5287
|
+
* Polls the OAuth flow status for an outstanding authorize call.
|
|
5288
|
+
*/
|
|
5289
|
+
getAuthStatus(authId) {
|
|
5290
|
+
return this.request(
|
|
5291
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/auth-status/${encodeURIComponent(authId)}`
|
|
5292
|
+
);
|
|
5293
|
+
}
|
|
5294
|
+
/**
|
|
5295
|
+
* Batch-checks whether a set of (connectionId, toolkit) tuples are
|
|
5296
|
+
* currently connected.
|
|
5297
|
+
*/
|
|
5298
|
+
getConnectionStatus(params) {
|
|
5299
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/connection-status`, {
|
|
5300
|
+
method: "POST",
|
|
5301
|
+
body: params
|
|
5302
|
+
});
|
|
5303
|
+
}
|
|
5304
|
+
/**
|
|
5305
|
+
* Lists existing provider connections, scoped to a toolkit.
|
|
5306
|
+
*
|
|
5307
|
+
* Default: the connection owner is resolved server-side from the request's
|
|
5308
|
+
* auth context. Admin callers (with `tool-providers:admin` permission) may
|
|
5309
|
+
* pass `authorId` to target a specific author, or omit it to receive
|
|
5310
|
+
* connections across all authors known to `tool_provider_connections` for
|
|
5311
|
+
* this provider/toolkit. Pagination is page-based via `page` (1-indexed)
|
|
5312
|
+
* and `perPage` (default 50, max 200).
|
|
5313
|
+
*/
|
|
5314
|
+
listConnections(params) {
|
|
5315
|
+
const searchParams = new URLSearchParams();
|
|
5316
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5317
|
+
if (params.authorId) {
|
|
5318
|
+
searchParams.set("authorId", params.authorId);
|
|
5319
|
+
}
|
|
5320
|
+
if (params.page !== void 0 && params.page !== null) {
|
|
5321
|
+
searchParams.set("page", String(params.page));
|
|
5322
|
+
}
|
|
5323
|
+
if (params.perPage !== void 0 && params.perPage !== null) {
|
|
5324
|
+
searchParams.set("perPage", String(params.perPage));
|
|
5325
|
+
}
|
|
5326
|
+
if (params.scope) {
|
|
5327
|
+
searchParams.set("scope", params.scope);
|
|
5328
|
+
}
|
|
5329
|
+
return this.request(
|
|
5330
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections?${searchParams.toString()}`
|
|
5331
|
+
);
|
|
5332
|
+
}
|
|
5333
|
+
/**
|
|
5334
|
+
* Lists provider-specific fields the picker should collect before
|
|
5335
|
+
* initiating a new connection (e.g. Confluence subdomain). Most toolkits
|
|
5336
|
+
* return an empty array.
|
|
5337
|
+
*/
|
|
5338
|
+
listConnectionFields(params) {
|
|
5339
|
+
const searchParams = new URLSearchParams();
|
|
5340
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5341
|
+
return this.request(
|
|
5342
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connection-fields?${searchParams.toString()}`
|
|
5343
|
+
);
|
|
5344
|
+
}
|
|
5345
|
+
/**
|
|
5346
|
+
* Disconnects (revokes + deletes) a persisted connection.
|
|
5347
|
+
*
|
|
5348
|
+
* Without `force: true` the server refuses if any agent still pins the
|
|
5349
|
+
* connection. With `force: true` the provider-side revoke is best-effort
|
|
5350
|
+
* (errors are tolerated) and the local row is always removed.
|
|
5351
|
+
*/
|
|
5352
|
+
disconnectConnection(connectionId, params) {
|
|
5353
|
+
const searchParams = new URLSearchParams();
|
|
5354
|
+
if (params?.toolkit) {
|
|
5355
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5356
|
+
}
|
|
5357
|
+
if (params?.force) {
|
|
5358
|
+
searchParams.set("force", "true");
|
|
5359
|
+
}
|
|
5360
|
+
const queryString = searchParams.toString();
|
|
5361
|
+
return this.request(
|
|
5362
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}${queryString ? `?${queryString}` : ""}`,
|
|
5363
|
+
{
|
|
5364
|
+
method: "DELETE"
|
|
5365
|
+
}
|
|
5366
|
+
);
|
|
5367
|
+
}
|
|
5368
|
+
/**
|
|
5369
|
+
* Lists the agents that currently pin a given connection. Used by the
|
|
5370
|
+
* picker to warn the user before disconnecting a shared account.
|
|
5371
|
+
*/
|
|
5372
|
+
getConnectionUsage(connectionId, params) {
|
|
5373
|
+
const searchParams = new URLSearchParams();
|
|
5374
|
+
if (params?.toolkit) {
|
|
5375
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5376
|
+
}
|
|
5377
|
+
const queryString = searchParams.toString();
|
|
5378
|
+
return this.request(
|
|
5379
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}/usage${queryString ? `?${queryString}` : ""}`
|
|
5380
|
+
);
|
|
5381
|
+
}
|
|
5382
|
+
/**
|
|
5383
|
+
* Returns provider-level health (config, reachability, etc.).
|
|
5384
|
+
*/
|
|
5385
|
+
getHealth() {
|
|
5386
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/health`);
|
|
5387
|
+
}
|
|
5281
5388
|
};
|
|
5282
5389
|
|
|
5283
5390
|
// src/resources/processor-provider.ts
|