@mastra/client-js 1.21.2-alpha.2 → 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/dist/index.js CHANGED
@@ -3180,6 +3180,35 @@ var Run = class extends BaseResource {
3180
3180
  }
3181
3181
  }).then(deserializeWorkflowError);
3182
3182
  }
3183
+ /**
3184
+ * Resumes a suspended workflow step without waiting for the workflow to complete (fire-and-forget)
3185
+ * and returns immediately with the runId. The workflow continues executing in the background.
3186
+ *
3187
+ * Use this when you want to dispatch a resume and return immediately (e.g. an HTTP handler that
3188
+ * never needs the resolved result inline). For Inngest-backed workflows this also avoids the
3189
+ * `getRunOutput()` polling race that `resumeAsync()` can hit.
3190
+ *
3191
+ * TODO(v2): in Mastra v2 this fire-and-forget behavior should become the behavior of
3192
+ * `resumeAsync()` (to mirror `start`/`resume` fire-and-forget semantics), and this method
3193
+ * should be removed. Kept as a separate method in v1 to avoid a breaking contract change.
3194
+ *
3195
+ * @param params - Object containing the step, resumeData and requestContext
3196
+ * @returns Promise containing the runId of the resumed workflow run
3197
+ */
3198
+ resumeNoWait(params) {
3199
+ const requestContext = parseClientRequestContext(params.requestContext);
3200
+ return this.request(`/workflows/${this.workflowId}/resume-no-wait?runId=${this.runId}`, {
3201
+ method: "POST",
3202
+ body: {
3203
+ step: params.step,
3204
+ resumeData: params.resumeData,
3205
+ requestContext,
3206
+ tracingOptions: params.tracingOptions,
3207
+ perStep: params.perStep,
3208
+ forEachIndex: params.forEachIndex
3209
+ }
3210
+ });
3211
+ }
3183
3212
  /**
3184
3213
  * Resumes a suspended workflow step that uses stream asynchronously and returns a promise that resolves when the workflow is complete
3185
3214
  * @param params - Object containing the step, resumeData and requestContext
@@ -5209,16 +5238,13 @@ var ToolProvider = class extends BaseResource {
5209
5238
  }
5210
5239
  providerId;
5211
5240
  /**
5212
- * Lists available toolkits from this provider
5213
- * @returns Promise containing list of toolkits
5241
+ * Lists available toolkits from this provider.
5214
5242
  */
5215
5243
  listToolkits() {
5216
5244
  return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/toolkits`);
5217
5245
  }
5218
5246
  /**
5219
- * Lists available tools from this provider, with optional filtering
5220
- * @param params - Optional filtering and pagination parameters
5221
- * @returns Promise containing list of tools
5247
+ * Lists available tools from this provider, with optional filtering.
5222
5248
  */
5223
5249
  listTools(params) {
5224
5250
  const searchParams = new URLSearchParams();
@@ -5240,15 +5266,125 @@ var ToolProvider = class extends BaseResource {
5240
5266
  );
5241
5267
  }
5242
5268
  /**
5243
- * Gets the input schema for a specific tool
5244
- * @param toolSlug - The slug of the tool
5245
- * @returns Promise containing the tool's JSON schema
5269
+ * Gets the input schema for a specific tool.
5246
5270
  */
5247
5271
  getToolSchema(toolSlug) {
5248
5272
  return this.request(
5249
5273
  `/tool-providers/${encodeURIComponent(this.providerId)}/tools/${encodeURIComponent(toolSlug)}/schema`
5250
5274
  );
5251
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
+ }
5252
5388
  };
5253
5389
 
5254
5390
  // src/resources/processor-provider.ts