@vectros-ai/mcp-server 0.12.0 → 0.14.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/index.mjs CHANGED
@@ -62,6 +62,7 @@ __export(api_exports, {
62
62
  TooManyRequestsError: () => TooManyRequestsError,
63
63
  TruncationWarningEvent: () => TruncationWarningEvent,
64
64
  UnauthorizedError: () => UnauthorizedError,
65
+ UserExistsResponse: () => UserExistsResponse,
65
66
  UserRequest: () => UserRequest,
66
67
  UserResponse: () => UserResponse,
67
68
  auth: () => auth_exports,
@@ -738,6 +739,14 @@ var TruncationWarningEvent;
738
739
  ContextWindowBudget: "context_window_budget"
739
740
  };
740
741
  })(TruncationWarningEvent || (TruncationWarningEvent = {}));
742
+ var UserExistsResponse;
743
+ ((UserExistsResponse2) => {
744
+ UserExistsResponse2.Status = {
745
+ Active: "ACTIVE",
746
+ Suspended: "SUSPENDED",
747
+ Pending: "PENDING"
748
+ };
749
+ })(UserExistsResponse || (UserExistsResponse = {}));
741
750
  var UserRequest;
742
751
  ((UserRequest2) => {
743
752
  UserRequest2.Status = {
@@ -2430,7 +2439,7 @@ var AuthClient = class {
2430
2439
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/access-log");
2431
2440
  }
2432
2441
  /**
2433
- * Lists all of your scoped API keys (`ssk_*`) across both your live and test environments. Revoked keys are excluded. Requires the `keys:r` scope.
2442
+ * Lists your scoped API keys (`ssk_*`) in your credential's own environment — a live key lists live keys, a test key lists test keys. Revoked keys are excluded. Requires the `keys:r` scope.
2434
2443
  *
2435
2444
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
2436
2445
  *
@@ -2481,7 +2490,7 @@ var AuthClient = class {
2481
2490
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
2482
2491
  }
2483
2492
  /**
2484
- * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope.
2493
+ * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. A root API key (`sk_`) is exempt from both bounds.
2485
2494
  *
2486
2495
  * @param {Vectros.CreateScopedKeyRequest} request
2487
2496
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2813,7 +2822,7 @@ var AuthClient = class {
2813
2822
  );
2814
2823
  }
2815
2824
  /**
2816
- * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2825
+ * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2817
2826
  *
2818
2827
  * @param {Vectros.CreateAccessProfileRequest} request
2819
2828
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3231,11 +3240,12 @@ var AuthClient = class {
3231
3240
  );
3232
3241
  }
3233
3242
  /**
3234
- * Updates an access profile. This is a partial update: any field you omit (or send as null) keeps its existing value. A profile must reference either inline `scopes` or a `roleId`, never both — so setting `scopes` clears any `roleId`, and setting `roleId` clears any inline `scopes`. The `contextId` and `principalId` are immutable. Status changes (for example active to suspended) take effect within about five minutes. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:u` scope.
3243
+ * Updates an access profile. This is a partial update: any field you omit (or send as null) keeps its existing value. A profile must reference either inline `scopes` or a `roleId`, never both — so setting `scopes` clears any `roleId`, and setting `roleId` clears any inline `scopes`. The `contextId` and `principalId` are immutable. Status changes (for example active to suspended) take effect within about five minutes. If you use a scoped credential, the profile's effective scopes may not exceed your own, and its `identityOverrides` are bounded twice: you may only set a value your own identity holds, and you may only change or clear a value the profile already holds if that value is yours as well. Repointing or clearing another principal's established identity therefore returns 403. A root API key (`sk_`) is exempt. If you set `roleId`, it must reference a role that already exists in this context. Requires the `profiles:u` scope.
3235
3244
  *
3236
3245
  * @param {Vectros.UpdateAccessProfileRequest} request
3237
3246
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3238
3247
  *
3248
+ * @throws {@link Vectros.BadRequestError}
3239
3249
  * @throws {@link Vectros.ForbiddenError}
3240
3250
  * @throws {@link Vectros.NotFoundError}
3241
3251
  * @throws {@link Vectros.TooManyRequestsError}
@@ -3282,6 +3292,8 @@ var AuthClient = class {
3282
3292
  }
3283
3293
  if (_response.error.reason === "status-code") {
3284
3294
  switch (_response.error.statusCode) {
3295
+ case 400:
3296
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
3285
3297
  case 403:
3286
3298
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
3287
3299
  case 404:
@@ -3304,7 +3316,7 @@ var AuthClient = class {
3304
3316
  );
3305
3317
  }
3306
3318
  /**
3307
- * Deletes an access profile. Within about five minutes (the access-profile cache lifetime), token minting for this principal in this context will be denied. Requires the `profiles:d` scope.
3319
+ * Deletes an access profile. Within about five minutes (the access-profile cache lifetime), token minting for this principal in this context will be denied. If you use a scoped credential and the profile carries `identityOverrides`, you may only delete it when you hold those values yourself — deleting a profile removes its identity, so the same bound applies as when clearing it. A profile with no `identityOverrides` is unaffected, and a root API key (`sk_`) is exempt. Requires the `profiles:d` scope.
3308
3320
  *
3309
3321
  * @param {Vectros.DeleteAccessProfileRequest} request
3310
3322
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3973,6 +3985,254 @@ var AuthClient = class {
3973
3985
  }
3974
3986
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3975
3987
  }
3988
+ /**
3989
+ * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
3990
+ *
3991
+ * @param {Vectros.GetIssuerRequest} request
3992
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3993
+ *
3994
+ * @throws {@link Vectros.ForbiddenError}
3995
+ * @throws {@link Vectros.NotFoundError}
3996
+ *
3997
+ * @example
3998
+ * await client.auth.getIssuer({
3999
+ * issuerId: "auth0-prod"
4000
+ * })
4001
+ */
4002
+ getIssuer(request, requestOptions) {
4003
+ return HttpResponsePromise.fromPromise(this.__getIssuer(request, requestOptions));
4004
+ }
4005
+ async __getIssuer(request, requestOptions) {
4006
+ const { issuerId } = request;
4007
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4008
+ const _headers = mergeHeaders(
4009
+ _authRequest.headers,
4010
+ this._options?.headers,
4011
+ requestOptions?.headers
4012
+ );
4013
+ const _response = await fetcher({
4014
+ url: url_exports.join(
4015
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4016
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4017
+ ),
4018
+ method: "GET",
4019
+ headers: _headers,
4020
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4021
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4022
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4023
+ abortSignal: requestOptions?.abortSignal,
4024
+ fetchFn: this._options?.fetch,
4025
+ logging: this._options.logging
4026
+ });
4027
+ if (_response.ok) {
4028
+ return { data: _response.body, rawResponse: _response.rawResponse };
4029
+ }
4030
+ if (_response.error.reason === "status-code") {
4031
+ switch (_response.error.statusCode) {
4032
+ case 403:
4033
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4034
+ case 404:
4035
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4036
+ default:
4037
+ throw new VectrosError({
4038
+ statusCode: _response.error.statusCode,
4039
+ body: _response.error.body,
4040
+ rawResponse: _response.rawResponse
4041
+ });
4042
+ }
4043
+ }
4044
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4045
+ }
4046
+ /**
4047
+ * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. Unconditional — unlike some other registry deletes on this API, this does not check for or block on any downstream reference. Any user account already created via this issuer (by a prior self-signup or accepted invite) is NOT deleted or modified, but that user can no longer obtain a NEW token this way once you deregister the issuer — every `POST /v1/auth/token/exchange` call against it will 404, with no distinction between an unknown issuer and one you just deregistered. Register a replacement issuer, or restore this one, before your users' current tokens expire if you want their access to continue uninterrupted.
4048
+ *
4049
+ * @param {Vectros.DeleteIssuerRequest} request
4050
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4051
+ *
4052
+ * @throws {@link Vectros.ForbiddenError}
4053
+ * @throws {@link Vectros.NotFoundError}
4054
+ * @throws {@link Vectros.TooManyRequestsError}
4055
+ *
4056
+ * @example
4057
+ * await client.auth.deleteIssuer({
4058
+ * issuerId: "auth0-prod"
4059
+ * })
4060
+ */
4061
+ deleteIssuer(request, requestOptions) {
4062
+ return HttpResponsePromise.fromPromise(this.__deleteIssuer(request, requestOptions));
4063
+ }
4064
+ async __deleteIssuer(request, requestOptions) {
4065
+ const { issuerId } = request;
4066
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4067
+ const _headers = mergeHeaders(
4068
+ _authRequest.headers,
4069
+ this._options?.headers,
4070
+ requestOptions?.headers
4071
+ );
4072
+ const _response = await fetcher({
4073
+ url: url_exports.join(
4074
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4075
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4076
+ ),
4077
+ method: "DELETE",
4078
+ headers: _headers,
4079
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4080
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4081
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4082
+ abortSignal: requestOptions?.abortSignal,
4083
+ fetchFn: this._options?.fetch,
4084
+ logging: this._options.logging
4085
+ });
4086
+ if (_response.ok) {
4087
+ return { data: void 0, rawResponse: _response.rawResponse };
4088
+ }
4089
+ if (_response.error.reason === "status-code") {
4090
+ switch (_response.error.statusCode) {
4091
+ case 403:
4092
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4093
+ case 404:
4094
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4095
+ case 429:
4096
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4097
+ default:
4098
+ throw new VectrosError({
4099
+ statusCode: _response.error.statusCode,
4100
+ body: _response.error.body,
4101
+ rawResponse: _response.rawResponse
4102
+ });
4103
+ }
4104
+ }
4105
+ return handleNonStatusCodeError(
4106
+ _response.error,
4107
+ _response.rawResponse,
4108
+ "DELETE",
4109
+ "/v1/auth/issuers/{issuerId}"
4110
+ );
4111
+ }
4112
+ /**
4113
+ * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4114
+ *
4115
+ * @param {Vectros.ListIssuersRequest} request
4116
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4117
+ *
4118
+ * @throws {@link Vectros.ForbiddenError}
4119
+ *
4120
+ * @example
4121
+ * await client.auth.listIssuers()
4122
+ */
4123
+ listIssuers(request = {}, requestOptions) {
4124
+ return HttpResponsePromise.fromPromise(this.__listIssuers(request, requestOptions));
4125
+ }
4126
+ async __listIssuers(request = {}, requestOptions) {
4127
+ const { startFrom, limit } = request;
4128
+ const _queryParams = {
4129
+ startFrom,
4130
+ limit
4131
+ };
4132
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4133
+ const _headers = mergeHeaders(
4134
+ _authRequest.headers,
4135
+ this._options?.headers,
4136
+ requestOptions?.headers
4137
+ );
4138
+ const _response = await fetcher({
4139
+ url: url_exports.join(
4140
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4141
+ "v1/auth/issuers"
4142
+ ),
4143
+ method: "GET",
4144
+ headers: _headers,
4145
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
4146
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4147
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4148
+ abortSignal: requestOptions?.abortSignal,
4149
+ fetchFn: this._options?.fetch,
4150
+ logging: this._options.logging
4151
+ });
4152
+ if (_response.ok) {
4153
+ return { data: _response.body, rawResponse: _response.rawResponse };
4154
+ }
4155
+ if (_response.error.reason === "status-code") {
4156
+ switch (_response.error.statusCode) {
4157
+ case 403:
4158
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4159
+ default:
4160
+ throw new VectrosError({
4161
+ statusCode: _response.error.statusCode,
4162
+ body: _response.error.body,
4163
+ rawResponse: _response.rawResponse
4164
+ });
4165
+ }
4166
+ }
4167
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4168
+ }
4169
+ /**
4170
+ * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant.
4171
+ *
4172
+ * @param {Vectros.IssuerRequest} request
4173
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4174
+ *
4175
+ * @throws {@link Vectros.BadRequestError}
4176
+ * @throws {@link Vectros.ForbiddenError}
4177
+ * @throws {@link Vectros.TooManyRequestsError}
4178
+ *
4179
+ * @example
4180
+ * await client.auth.registerIssuer({
4181
+ * issuerId: "auth0-prod",
4182
+ * issuer: "https://your-tenant.us.auth0.com/",
4183
+ * jwksUri: "https://your-tenant.us.auth0.com/.well-known/jwks.json",
4184
+ * audience: "https://api.your-app.example.com",
4185
+ * contextId: "casework"
4186
+ * })
4187
+ */
4188
+ registerIssuer(request, requestOptions) {
4189
+ return HttpResponsePromise.fromPromise(this.__registerIssuer(request, requestOptions));
4190
+ }
4191
+ async __registerIssuer(request, requestOptions) {
4192
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4193
+ const _headers = mergeHeaders(
4194
+ _authRequest.headers,
4195
+ this._options?.headers,
4196
+ requestOptions?.headers
4197
+ );
4198
+ const _response = await fetcher({
4199
+ url: url_exports.join(
4200
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4201
+ "v1/auth/issuers"
4202
+ ),
4203
+ method: "POST",
4204
+ headers: _headers,
4205
+ contentType: "application/json",
4206
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4207
+ requestType: "json",
4208
+ body: request,
4209
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4210
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4211
+ abortSignal: requestOptions?.abortSignal,
4212
+ fetchFn: this._options?.fetch,
4213
+ logging: this._options.logging
4214
+ });
4215
+ if (_response.ok) {
4216
+ return { data: _response.body, rawResponse: _response.rawResponse };
4217
+ }
4218
+ if (_response.error.reason === "status-code") {
4219
+ switch (_response.error.statusCode) {
4220
+ case 400:
4221
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4222
+ case 403:
4223
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4224
+ case 429:
4225
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4226
+ default:
4227
+ throw new VectrosError({
4228
+ statusCode: _response.error.statusCode,
4229
+ body: _response.error.body,
4230
+ rawResponse: _response.rawResponse
4231
+ });
4232
+ }
4233
+ }
4234
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/issuers");
4235
+ }
3976
4236
  /**
3977
4237
  * Returns the identity bound to your credential — your account, principal type, key id, and scope details — so you can confirm who you are authenticated as and that the credential is valid. MCP clients use this to render "signed in as ..." in a chat UI without a separate identity endpoint.
3978
4238
  *
@@ -4158,7 +4418,7 @@ var AuthClient = class {
4158
4418
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token");
4159
4419
  }
4160
4420
  /**
4161
- * Invite a new member to one of your app contexts by email. Creates a pending user with a pre-resolved access profile (their permissions on accept) and signs an invitation token. This call is idempotent on the combination of context and email: re-inviting the same email in the same context rotates the token and resends the invitation rather than creating a duplicate. Returns HTTP 201 on a new invite or a successful resend. Returns 409 if that email already belongs to an active or suspended member of the app context, or already has an identity elsewhere in your account (an email can currently belong to only one tenant per account, i.e. your test and live environments cannot share an email). When `sendEmail` is false, the response includes the raw token and a ready-to-use accept link so you can deliver the invitation through your own email provider. Requires the `admin:users` scope.
4421
+ * Invite a new member to one of your app contexts by email. Creates a pending user with a pre-resolved access profile (their permissions on accept) and signs an invitation token. This call is idempotent on the combination of context and email: re-inviting the same email in the same context rotates the token and resends the invitation rather than creating a duplicate — this requires the `users:r` and `users:u` scopes in addition to `users:c`, because resending rotates a credential on an existing invitation and invalidates any link already sent. Without them the collision returns 409 instead, with no invitation details and no change to the outstanding invitation. Returns HTTP 201 on a new invite or a successful resend. Returns 409 if that email already belongs to an active or suspended member of the app context, or already has an identity elsewhere in your account (an email can currently belong to only one tenant per account, i.e. your test and live environments cannot share an email). When `sendEmail` is false, the response includes the raw token and a ready-to-use accept link so you can deliver the invitation through your own email provider. Requires the `users:c` scope.
4162
4422
  *
4163
4423
  * @param {Vectros.CreateInviteRequest} request
4164
4424
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4229,7 +4489,7 @@ var AuthClient = class {
4229
4489
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite");
4230
4490
  }
4231
4491
  /**
4232
- * Resend an outstanding invitation, identified by its email and app context. Rotates the invitation token and extends its expiry, then (when `sendEmail` is true) re-delivers the email. Rotating the token invalidates any previously issued link for this invitation, so only the newest link works. The invitee's pending permissions are left unchanged. Requires the `admin:users` scope.
4492
+ * Resend an outstanding invitation, identified by its email and app context. Rotates the invitation token and extends its expiry, then (when `sendEmail` is true) re-delivers the email. Rotating the token invalidates any previously issued link for this invitation, so only the newest link works. The invitee's pending permissions are left unchanged. Because this rotates a credential on an existing invitation, it requires the `users:c`, `users:r` and `users:u` scopes.
4233
4493
  *
4234
4494
  * @param {Vectros.CreateInviteRequest} request
4235
4495
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4296,6 +4556,72 @@ var AuthClient = class {
4296
4556
  }
4297
4557
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4298
4558
  }
4559
+ /**
4560
+ * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4561
+ *
4562
+ * @param {Vectros.TokenExchangeRequest} request
4563
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4564
+ *
4565
+ * @throws {@link Vectros.BadRequestError}
4566
+ * @throws {@link Vectros.UnauthorizedError}
4567
+ * @throws {@link Vectros.ForbiddenError}
4568
+ * @throws {@link Vectros.NotFoundError}
4569
+ * @throws {@link Vectros.TooManyRequestsError}
4570
+ *
4571
+ * @example
4572
+ * await client.auth.exchangeToken({
4573
+ * grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
4574
+ * subject_token: "subject_token",
4575
+ * subject_token_type: "urn:ietf:params:oauth:token-type:jwt"
4576
+ * })
4577
+ */
4578
+ exchangeToken(request, requestOptions) {
4579
+ return HttpResponsePromise.fromPromise(this.__exchangeToken(request, requestOptions));
4580
+ }
4581
+ async __exchangeToken(request, requestOptions) {
4582
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
4583
+ const _response = await fetcher({
4584
+ url: url_exports.join(
4585
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4586
+ "v1/auth/token/exchange"
4587
+ ),
4588
+ method: "POST",
4589
+ headers: _headers,
4590
+ contentType: "application/json",
4591
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4592
+ requestType: "json",
4593
+ body: request,
4594
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4595
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4596
+ abortSignal: requestOptions?.abortSignal,
4597
+ fetchFn: this._options?.fetch,
4598
+ logging: this._options.logging
4599
+ });
4600
+ if (_response.ok) {
4601
+ return { data: _response.body, rawResponse: _response.rawResponse };
4602
+ }
4603
+ if (_response.error.reason === "status-code") {
4604
+ switch (_response.error.statusCode) {
4605
+ case 400:
4606
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4607
+ case 401:
4608
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
4609
+ case 403:
4610
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4611
+ case 404:
4612
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4613
+ case 429:
4614
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4615
+ default:
4616
+ throw new VectrosError({
4617
+ statusCode: _response.error.statusCode,
4618
+ body: _response.error.body,
4619
+ rawResponse: _response.rawResponse
4620
+ });
4621
+ }
4622
+ }
4623
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/exchange");
4624
+ }
4299
4625
  };
4300
4626
  var ComplianceClient = class {
4301
4627
  constructor(options) {
@@ -4563,7 +4889,7 @@ var DocumentsClient = class {
4563
4889
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4564
4890
  * scope: "group:eng-team",
4565
4891
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4566
- * startFrom: "doc_prev123"
4892
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
4567
4893
  * })
4568
4894
  */
4569
4895
  listDocuments(request = {}, requestOptions) {
@@ -4873,6 +5199,7 @@ var DocumentsClient = class {
4873
5199
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
4874
5200
  *
4875
5201
  * @throws {@link Vectros.BadRequestError}
5202
+ * @throws {@link Vectros.ForbiddenError}
4876
5203
  * @throws {@link Vectros.NotFoundError}
4877
5204
  * @throws {@link Vectros.ConflictError}
4878
5205
  * @throws {@link Vectros.TooManyRequestsError}
@@ -4920,6 +5247,8 @@ var DocumentsClient = class {
4920
5247
  switch (_response.error.statusCode) {
4921
5248
  case 400:
4922
5249
  throw new BadRequestError(_response.error.body, _response.rawResponse);
5250
+ case 403:
5251
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4923
5252
  case 404:
4924
5253
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4925
5254
  case 409:
@@ -4950,7 +5279,7 @@ var DocumentsClient = class {
4950
5279
  * field: "po_number",
4951
5280
  * value: "PO-1001",
4952
5281
  * prefix: "PO-2024",
4953
- * startFrom: "550e8400-e29b-41d4-a716-446655440000",
5282
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl",
4954
5283
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4955
5284
  * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
4956
5285
  * })
@@ -5326,7 +5655,7 @@ var FoldersClient = class {
5326
5655
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5327
5656
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5328
5657
  * scope: "group:eng-team",
5329
- * startFrom: "fld_prev123"
5658
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
5330
5659
  * })
5331
5660
  */
5332
5661
  listFolders(request = {}, requestOptions) {
@@ -5503,6 +5832,7 @@ var FoldersClient = class {
5503
5832
  * @param {Vectros.UpdateFolderRequest} request
5504
5833
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
5505
5834
  *
5835
+ * @throws {@link Vectros.ForbiddenError}
5506
5836
  * @throws {@link Vectros.NotFoundError}
5507
5837
  * @throws {@link Vectros.TooManyRequestsError}
5508
5838
  *
@@ -5547,6 +5877,8 @@ var FoldersClient = class {
5547
5877
  }
5548
5878
  if (_response.error.reason === "status-code") {
5549
5879
  switch (_response.error.statusCode) {
5880
+ case 403:
5881
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
5550
5882
  case 404:
5551
5883
  throw new NotFoundError(_response.error.body, _response.rawResponse);
5552
5884
  case 429:
@@ -5629,6 +5961,7 @@ var FoldersClient = class {
5629
5961
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
5630
5962
  *
5631
5963
  * @throws {@link Vectros.BadRequestError}
5964
+ * @throws {@link Vectros.ForbiddenError}
5632
5965
  * @throws {@link Vectros.NotFoundError}
5633
5966
  * @throws {@link Vectros.ConflictError}
5634
5967
  * @throws {@link Vectros.TooManyRequestsError}
@@ -5676,6 +6009,8 @@ var FoldersClient = class {
5676
6009
  switch (_response.error.statusCode) {
5677
6010
  case 400:
5678
6011
  throw new BadRequestError(_response.error.body, _response.rawResponse);
6012
+ case 403:
6013
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
5679
6014
  case 404:
5680
6015
  throw new NotFoundError(_response.error.body, _response.rawResponse);
5681
6016
  case 409:
@@ -5763,7 +6098,8 @@ var IdentityClient = class {
5763
6098
  *
5764
6099
  * @example
5765
6100
  * await client.identity.listEntities({
5766
- * namespace: "team"
6101
+ * namespace: "team",
6102
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
5767
6103
  * })
5768
6104
  */
5769
6105
  listEntities(request, requestOptions) {
@@ -6527,7 +6863,7 @@ var IdentityClient = class {
6527
6863
  * @example
6528
6864
  * await client.identity.listUsers({
6529
6865
  * externalId: "usr_12345",
6530
- * startFrom: "550e8400-e29b-41d4-a716-446655440000",
6866
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl",
6531
6867
  * type: "person_v1",
6532
6868
  * field: "team",
6533
6869
  * value: "engineering",
@@ -6708,11 +7044,12 @@ var IdentityClient = class {
6708
7044
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/{id}");
6709
7045
  }
6710
7046
  /**
6711
- * Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. Requires the `users:u` scope.
7047
+ * Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation, and `email` cannot be changed while an invitation to that user is still outstanding — revoke the invitation, or invite the new address instead. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. Requires the `users:u` scope.
6712
7048
  *
6713
7049
  * @param {Vectros.UpdateUserRequest} request
6714
7050
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6715
7051
  *
7052
+ * @throws {@link Vectros.BadRequestError}
6716
7053
  * @throws {@link Vectros.NotFoundError}
6717
7054
  * @throws {@link Vectros.TooManyRequestsError}
6718
7055
  *
@@ -6757,6 +7094,8 @@ var IdentityClient = class {
6757
7094
  }
6758
7095
  if (_response.error.reason === "status-code") {
6759
7096
  switch (_response.error.statusCode) {
7097
+ case 400:
7098
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6760
7099
  case 404:
6761
7100
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6762
7101
  case 429:
@@ -6890,6 +7229,69 @@ var IdentityClient = class {
6890
7229
  }
6891
7230
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/lookup");
6892
7231
  }
7232
+ /**
7233
+ * Answers "does a user with this email hold an ACTIVE access profile in this app context" — a narrow existence check, not a general lookup. `exists` is false for a member whose access to this context has been suspended, not only for a member who was never granted it. The answer is scoped to the `contextId` you supply: it does not reveal whether the email exists elsewhere in your tenant or account, only whether it belongs to an active member of the named context. Returns `{exists, userId, status}` — never the full user record — so a caller asking "does X exist" cannot receive that user's payload/schema binding/etc. as a side effect. Useful for resolving an email you were handed (for example, by an org-admin adding an existing member to another org) to a `userId`, without paging through the full context membership. Requires the `users:r` scope.
7234
+ *
7235
+ * @param {Vectros.UserExistsByEmailRequest} request
7236
+ * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7237
+ *
7238
+ * @throws {@link Vectros.BadRequestError}
7239
+ * @throws {@link Vectros.ForbiddenError}
7240
+ *
7241
+ * @example
7242
+ * await client.identity.userExistsByEmail({
7243
+ * email: "user@example.com",
7244
+ * contextId: "myapp"
7245
+ * })
7246
+ */
7247
+ userExistsByEmail(request = {}, requestOptions) {
7248
+ return HttpResponsePromise.fromPromise(this.__userExistsByEmail(request, requestOptions));
7249
+ }
7250
+ async __userExistsByEmail(request = {}, requestOptions) {
7251
+ const { email, contextId } = request;
7252
+ const _queryParams = {
7253
+ email,
7254
+ contextId
7255
+ };
7256
+ const _authRequest = await this._options.authProvider.getAuthRequest();
7257
+ const _headers = mergeHeaders(
7258
+ _authRequest.headers,
7259
+ this._options?.headers,
7260
+ requestOptions?.headers
7261
+ );
7262
+ const _response = await fetcher({
7263
+ url: url_exports.join(
7264
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
7265
+ "v1/users/exists-by-email"
7266
+ ),
7267
+ method: "GET",
7268
+ headers: _headers,
7269
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
7270
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
7271
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
7272
+ abortSignal: requestOptions?.abortSignal,
7273
+ fetchFn: this._options?.fetch,
7274
+ logging: this._options.logging
7275
+ });
7276
+ if (_response.ok) {
7277
+ return { data: _response.body, rawResponse: _response.rawResponse };
7278
+ }
7279
+ if (_response.error.reason === "status-code") {
7280
+ switch (_response.error.statusCode) {
7281
+ case 400:
7282
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7283
+ case 403:
7284
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
7285
+ default:
7286
+ throw new VectrosError({
7287
+ statusCode: _response.error.statusCode,
7288
+ body: _response.error.body,
7289
+ rawResponse: _response.rawResponse
7290
+ });
7291
+ }
7292
+ }
7293
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/exists-by-email");
7294
+ }
6893
7295
  /**
6894
7296
  * Returns the audit trail of changes to a user, most recent first. Identity history is always recorded and always available. Sensitive field values are redacted in every historical version. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope.
6895
7297
  *
@@ -7404,7 +7806,7 @@ var RecordsClient = class {
7404
7806
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7405
7807
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7406
7808
  * scope: "group:eng-team",
7407
- * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7809
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
7408
7810
  * })
7409
7811
  */
7410
7812
  listRecords(request = {}, requestOptions) {
@@ -7592,6 +7994,7 @@ var RecordsClient = class {
7592
7994
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
7593
7995
  *
7594
7996
  * @throws {@link Vectros.BadRequestError}
7997
+ * @throws {@link Vectros.ForbiddenError}
7595
7998
  * @throws {@link Vectros.NotFoundError}
7596
7999
  * @throws {@link Vectros.ConflictError}
7597
8000
  * @throws {@link Vectros.TooManyRequestsError}
@@ -7640,6 +8043,8 @@ var RecordsClient = class {
7640
8043
  switch (_response.error.statusCode) {
7641
8044
  case 400:
7642
8045
  throw new BadRequestError(_response.error.body, _response.rawResponse);
8046
+ case 403:
8047
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
7643
8048
  case 404:
7644
8049
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7645
8050
  case 409:
@@ -7721,6 +8126,7 @@ var RecordsClient = class {
7721
8126
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
7722
8127
  *
7723
8128
  * @throws {@link Vectros.BadRequestError}
8129
+ * @throws {@link Vectros.ForbiddenError}
7724
8130
  * @throws {@link Vectros.NotFoundError}
7725
8131
  * @throws {@link Vectros.ConflictError}
7726
8132
  * @throws {@link Vectros.TooManyRequestsError}
@@ -7771,6 +8177,8 @@ var RecordsClient = class {
7771
8177
  switch (_response.error.statusCode) {
7772
8178
  case 400:
7773
8179
  throw new BadRequestError(_response.error.body, _response.rawResponse);
8180
+ case 403:
8181
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
7774
8182
  case 404:
7775
8183
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7776
8184
  case 409:
@@ -7788,7 +8196,15 @@ var RecordsClient = class {
7788
8196
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/records/{id}");
7789
8197
  }
7790
8198
  /**
7791
- * Finds records by the value of a lookup field declared on the type's schema. Provide exactly one lookup mode: `value` (exact match), `from`+`to` (inclusive range, ascending by value), or `prefix` (string fields only, ascending). Range and prefix lookups are not supported on a sensitive field, because its value is stored as a blind index and has no sortable order. An exact-`value` lookup on a sensitive field is also rejected on this GET endpoint — the value must not appear in the URL — so use the `POST /v1/records/lookup` body variant for sensitive fields. Results are paginated: set `limit` for the page size and pass the returned `nextCursor` back as `startFrom` for the next page. Requires the `records:r:<type>` scope.
8199
+ * Finds records by the value of a lookup field declared on the type's schema. Provide exactly one lookup mode: `value` (exact match), `from`+`to` (inclusive range, ascending by value), or `prefix` (string fields only, ascending). Range and prefix lookups are not supported on a sensitive field, because its value is stored as a blind index and has no sortable order. An exact-`value` lookup on a sensitive field is also rejected on this GET endpoint — the value must not appear in the URL — so use the `POST /v1/records/lookup` body variant for sensitive fields.
8200
+ *
8201
+ * A `value` lookup can additionally be narrowed to a window of the lookup field's **sort key** using `sortFrom` and/or `sortTo` (inclusive) — for example, one session's records created since a timestamp. The sort key is whatever the schema declares as that lookup's `sortBy` (`createdAt` by default, `lastUpdated`, or another field), and bounds are given in that field's own units — epoch milliseconds for the two timestamp options. **Records that have no value for the sorted field are never included in a bounded window** — they are ordered ahead of every record that does have one, and a `sortFrom`/`sortTo` window only ever selects from records carrying a value. The sorted field does not have to be `required`.
8202
+ *
8203
+ * Narrowing is available on any lookup field your schema declares for fast equality lookup, and on `externalId` — which is always ordered by creation time, so its bounds are epoch milliseconds whatever the schema says. It is rejected (`400`) for a field declared with `rangeEnabled`, for a field declared beyond the schema's fast-lookup budget, for a lookup whose `sortBy` names a sensitive field (a sensitive value is stored as a blind index and has no order), and for a window whose start is after its end. Ownership fields are not lookup fields on this endpoint at all — see the `field` parameter.
8204
+ *
8205
+ * While paging a narrowed lookup, keep every other parameter identical. The cursor is valid only for the exact query that returned it — changing `order`, `sortFrom`, `sortTo`, or dropping them altogether, is rejected rather than silently resumed at a position that means something different in the new query.
8206
+ *
8207
+ * Results are paginated: set `limit` for the page size and pass the returned `nextCursor` back as `startFrom` for the next page. **Keep paging until `nextCursor` is null** — a page can come back empty or shorter than `limit` while more results remain, so an empty page is not the end of the results. Requires the `records:r:<type>` scope.
7792
8208
  *
7793
8209
  * @param {Vectros.LookupRecordsRequest} request
7794
8210
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7800,22 +8216,40 @@ var RecordsClient = class {
7800
8216
  * type: "intake_form",
7801
8217
  * field: "email",
7802
8218
  * value: "jane@example.com",
8219
+ * values: ["open"],
7803
8220
  * prefix: "jane",
7804
- * startFrom: "550e8400-e29b-41d4-a716-446655440000"
8221
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
7805
8222
  * })
7806
8223
  */
7807
8224
  lookupRecords(request, requestOptions) {
7808
8225
  return HttpResponsePromise.fromPromise(this.__lookupRecords(request, requestOptions));
7809
8226
  }
7810
8227
  async __lookupRecords(request, requestOptions) {
7811
- const { type: type_, field, value, from: from_, to, prefix, startFrom, limit, includePayload, order } = request;
8228
+ const {
8229
+ type: type_,
8230
+ field,
8231
+ value,
8232
+ values,
8233
+ from: from_,
8234
+ to,
8235
+ prefix,
8236
+ sortFrom,
8237
+ sortTo,
8238
+ startFrom,
8239
+ limit,
8240
+ includePayload,
8241
+ order
8242
+ } = request;
7812
8243
  const _queryParams = {
7813
8244
  type: type_,
7814
8245
  field,
7815
8246
  value,
8247
+ values,
7816
8248
  from: from_,
7817
8249
  to,
7818
8250
  prefix,
8251
+ sortFrom,
8252
+ sortTo,
7819
8253
  startFrom,
7820
8254
  limit,
7821
8255
  includePayload,
@@ -7859,7 +8293,7 @@ var RecordsClient = class {
7859
8293
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/records/lookup");
7860
8294
  }
7861
8295
  /**
7862
- * Body-based equivalent of `GET /v1/records/lookup`. Use this when looking up by a sensitive field: the value travels in the request body (and is blind-indexed server-side) instead of in the URL query string, so it never lands in access, CDN, or proxy logs. The GET variant rejects an exact-value lookup on a sensitive field and directs you here. Non-sensitive exact-value, range (`from`+`to`), and prefix lookups also work here. Returns the same `{data, nextCursor}` envelope and uses the same pagination as the GET variant. Requires the `records:r:<type>` scope.
8296
+ * Body-based equivalent of `GET /v1/records/lookup`. Use this when looking up by a sensitive field: the value travels in the request body (and is blind-indexed server-side) instead of in the URL query string, so it never lands in access, CDN, or proxy logs. The GET variant rejects an exact-value lookup on a sensitive field and directs you here. Non-sensitive exact-value, range (`from`+`to`), and prefix lookups also work here, as does narrowing a `value` lookup by the field's sort key with `sortFrom`/`sortTo` — see the GET variant for what the sort key is and when narrowing by it is available. Returns the same `{data, nextCursor}` envelope and uses the same pagination as the GET variant; keep paging until `nextCursor` is null rather than stopping on an empty page. Requires the `records:r:<type>` scope.
7863
8297
  *
7864
8298
  * @param {Vectros.RecordLookupRequest} request
7865
8299
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8054,7 +8488,7 @@ var SchemasClient = class {
8054
8488
  * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8055
8489
  * surface: "document",
8056
8490
  * recordType: "intake_form",
8057
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
8491
+ * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
8058
8492
  * })
8059
8493
  */
8060
8494
  listSchemas(request = {}, requestOptions) {
@@ -8258,6 +8692,7 @@ var SchemasClient = class {
8258
8692
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
8259
8693
  *
8260
8694
  * @throws {@link Vectros.BadRequestError}
8695
+ * @throws {@link Vectros.ForbiddenError}
8261
8696
  * @throws {@link Vectros.NotFoundError}
8262
8697
  * @throws {@link Vectros.TooManyRequestsError}
8263
8698
  *
@@ -8306,6 +8741,8 @@ var SchemasClient = class {
8306
8741
  switch (_response.error.statusCode) {
8307
8742
  case 400:
8308
8743
  throw new BadRequestError(_response.error.body, _response.rawResponse);
8744
+ case 403:
8745
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
8309
8746
  case 404:
8310
8747
  throw new NotFoundError(_response.error.body, _response.rawResponse);
8311
8748
  case 429:
@@ -8616,15 +9053,15 @@ function warnOnSuboptimalKey(key, log) {
8616
9053
  } else if (key.prefix === "st") {
8617
9054
  log.warn(
8618
9055
  { prefix: key.prefix, env: key.env },
8619
- "short-lived token (st_*) will expire mid-session (1h default, 24h max). For long-running MCP installs, prefer a long-lived ssk_* key."
9056
+ "short-lived token (st_*) will expire mid-session (1h max). For long-running MCP installs, prefer a long-lived ssk_* key."
8620
9057
  );
8621
9058
  }
8622
9059
  }
8623
9060
 
8624
9061
  // src/build-info.ts
8625
9062
  var BUILD_INFO = {
8626
- mcpServer: true ? "0.12.0" : "dev",
8627
- sdk: true ? "0.37.0" : "dev"
9063
+ mcpServer: true ? "0.14.0" : "dev",
9064
+ sdk: true ? "0.39.0" : "dev"
8628
9065
  };
8629
9066
 
8630
9067
  // src/log.ts
@@ -8664,7 +9101,9 @@ async function resolveIdentity({
8664
9101
  const derived = {
8665
9102
  status: "ok",
8666
9103
  environment: deriveEnvironment(environment),
8667
- principalType: derivePrincipalType(apiKey)
9104
+ principalType: derivePrincipalType(apiKey),
9105
+ mcpServerVersion: BUILD_INFO.mcpServer,
9106
+ sdkVersion: BUILD_INFO.sdk
8668
9107
  };
8669
9108
  if (!apiKey || !environment) {
8670
9109
  log.debug({ component: "identity", mode: "derived-only" }, "identity derived (no fetch)");
@@ -8692,7 +9131,13 @@ async function resolveIdentity({
8692
9131
  );
8693
9132
  }
8694
9133
  }
8695
- const merged = { ...derived, ...extended, status: "ok" };
9134
+ const merged = {
9135
+ ...derived,
9136
+ ...extended,
9137
+ status: "ok",
9138
+ mcpServerVersion: derived.mcpServerVersion,
9139
+ sdkVersion: derived.sdkVersion
9140
+ };
8696
9141
  log.debug(
8697
9142
  {
8698
9143
  component: "identity",
@@ -9014,14 +9459,23 @@ import { z as z2 } from "zod";
9014
9459
  function pageItems(page) {
9015
9460
  return page.data ?? [];
9016
9461
  }
9462
+ var MAX_PAGES = 100;
9463
+ var MAX_ROWS = 1e6;
9017
9464
  async function drainPages(fetchPage) {
9018
9465
  const all = [];
9019
9466
  let startFrom;
9467
+ let pages = 0;
9020
9468
  for (; ; ) {
9021
9469
  const page = await fetchPage(startFrom);
9022
- if (page.data?.length) all.push(...page.data);
9470
+ pages++;
9471
+ if (page.data?.length) for (const item of page.data) all.push(item);
9023
9472
  const next = page.nextCursor;
9024
9473
  if (!next) break;
9474
+ if (pages > MAX_PAGES || all.length > MAX_ROWS) {
9475
+ throw new Error(
9476
+ `drainPages: exceeded the runaway guard (${all.length} rows over ${pages} pages, limits ${MAX_ROWS}/${MAX_PAGES}) without the cursor going null. Refusing to return a partial result \u2014 the backend may be returning empty pages with a live cursor.`
9477
+ );
9478
+ }
9025
9479
  startFrom = next;
9026
9480
  }
9027
9481
  return all;
@@ -9032,14 +9486,23 @@ var MCP_DEFAULT_LIMIT2 = 3;
9032
9486
  var MCP_MAX_LIMIT2 = 100;
9033
9487
  var inputSchema2 = {
9034
9488
  type: z2.string().min(1, "type (record type) is required").describe('Record type / schema name (e.g. "patient", "clinical_note").'),
9035
- // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
9489
+ // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | values | from+to | prefix.
9036
9490
  field: z2.string().optional().describe(
9037
- 'Lookup mode: name of the lookup-indexed field to query by. `externalId` is always queryable \u2014 e.g. `{type:"control", field:"externalId", value:"ctrl-scoped-key"}` finds the record you created under that externalId. (record_get / record_update also accept externalId directly.)'
9491
+ 'Lookup mode: name of the lookup-indexed field to query by. `externalId` is always queryable \u2014 e.g. `{type:"control", field:"externalId", value:"ctrl-scoped-key"}` finds the record you created under that externalId. (record_get / record_update also accept externalId directly.) For a SCHEMA-declared composite lookup \u2014 check list_schemas\' lookupFields for a fieldNames entry, not any two fields you pick \u2014 give those field names comma-joined in the declared order (e.g. "status,area"). Use `values` to match on several of those fields at once, or `value` to match on just the FIRST field named (equivalent to a one-element `values`); range/prefix are not valid on a composite field.'
9492
+ ),
9493
+ value: z2.string().optional().describe(
9494
+ "Lookup mode (equality): exact-match value for `field`. Also valid when `field` names a SCHEMA-declared composite lookup \u2014 matches just the first named field, grouping by the rest (equivalent to `values` with one entry)."
9495
+ ),
9496
+ values: z2.array(z2.string()).min(1).max(3).optional().describe(
9497
+ 'Lookup mode (composite equality): only valid against a lookup the SCHEMA declares over several fields together (a fieldNames entry in list_schemas \u2014 you cannot combine two ordinary single-field lookups this way). One value per field, in the order the schema declares them (e.g. field="status,area", values=["open","billing"]). Mutually exclusive with `value`; a single-element array is exactly `value` written uniformly. Supplying FEWER values than the lookup declares is allowed \u2014 as long as they\'re a leading run of its fields \u2014 and returns records grouped by the fields left unspecified; `order` then sorts within each group, not across them. Record lookups only (not documents/users/entities).'
9038
9498
  ),
9039
- value: z2.string().optional().describe("Lookup mode (equality): exact-match value for `field`."),
9040
9499
  from: z2.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
9041
9500
  to: z2.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
9042
9501
  prefix: z2.string().optional().describe("Lookup mode (prefix): match values starting with this. String, non-sensitive fields only."),
9502
+ sortFrom: z2.string().optional().describe(
9503
+ "Lookup mode (equality/composite only): inclusive lower bound on the lookup field's sort key, narrowing a `value`/`values` match to a window instead of paging the whole match. Give the bound in the sort field's own units (epoch milliseconds for `createdAt`/`lastUpdated`). With `values`, requires every value be supplied (no grouping) for one continuous ordering. Not valid with `from`/`to`/`prefix`."
9504
+ ),
9505
+ sortTo: z2.string().optional().describe("Lookup mode (equality/composite only): inclusive upper bound on the sort key; pairs with `sortFrom`."),
9043
9506
  order: z2.enum(["asc", "desc"]).optional().describe(
9044
9507
  "Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc` \u2014 use `desc` with a range/prefix lookup to get the most-recent / highest values first (e.g. latest-N). Ignored in list mode."
9045
9508
  ),
@@ -9056,54 +9519,106 @@ var inputSchema2 = {
9056
9519
  var recordQuery = ({ client, log }) => ({
9057
9520
  name: "record_query",
9058
9521
  title: "Record query (list or lookup)",
9059
- description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9522
+ description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `values` (exact, composite \u2014 one value per field; a single-element array is the same as `value`), `from`+`to` (range), or `prefix`. `values` with more than one entry, or a comma-joined `field`, ONLY works for a lookup the schema itself declared over several fields together \u2014 check list_schemas' lookupFields for a fieldNames entry, then pass those field names comma-joined as `field`; `from`/`to`/`prefix` are not valid there. Works on sensitive fields too. Optionally narrow an exact match to a window with `sortFrom`/`sortTo`.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. A composite lookup given fewer than its full field count returns records grouped by the unspecified fields, ordered within each group. Mode is auto-detected from the arguments present.",
9060
9523
  inputSchema: inputSchema2,
9061
9524
  handler: async (args) => {
9062
9525
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
9063
9526
  const type = args.type;
9064
9527
  const field = args.field;
9065
9528
  const value = args.value;
9529
+ const values = args.values;
9066
9530
  const from = args.from;
9067
9531
  const to = args.to;
9068
9532
  const prefix = args.prefix;
9533
+ const sortFrom = args.sortFrom;
9534
+ const sortTo = args.sortTo;
9069
9535
  const startFrom = args.startFrom;
9536
+ if (!field && (value !== void 0 || values !== void 0 || from !== void 0 || to !== void 0 || prefix !== void 0 || sortFrom !== void 0 || sortTo !== void 0)) {
9537
+ return toolError(
9538
+ "record_query",
9539
+ new Error(
9540
+ "'value'/'values'/'from'/'to'/'prefix'/'sortFrom'/'sortTo' require 'field' \u2014 without it, list mode runs and silently ignores them. Pass 'field' to run a lookup, or drop these to list by type."
9541
+ )
9542
+ );
9543
+ }
9070
9544
  try {
9071
9545
  let page;
9072
9546
  if (field) {
9547
+ const fieldNames = field.split(",").map((f) => f.trim()).filter(Boolean);
9548
+ const normalizedField = fieldNames.join(",");
9549
+ const isCompositeField = fieldNames.length > 1;
9073
9550
  const hasEquality = value !== void 0;
9551
+ const hasComposite = values !== void 0;
9074
9552
  const hasRange = from !== void 0 || to !== void 0;
9075
9553
  const hasPrefix = prefix !== void 0;
9076
- const modes = Number(hasEquality) + Number(hasRange) + Number(hasPrefix);
9554
+ const modes = Number(hasEquality) + Number(hasComposite) + Number(hasRange) + Number(hasPrefix);
9077
9555
  if (modes === 0) {
9078
9556
  return toolError(
9079
9557
  "record_query",
9080
9558
  new Error(
9081
- `lookup on field '${field}' needs one of: 'value' (exact), 'from'+'to' (range), or 'prefix'.`
9559
+ `lookup on field '${field}' needs one of: 'value' (exact), 'values' (composite exact), 'from'+'to' (range), or 'prefix'.`
9082
9560
  )
9083
9561
  );
9084
9562
  }
9085
9563
  if (modes > 1) {
9086
9564
  return toolError(
9087
9565
  "record_query",
9088
- new Error("'value', 'from'/'to', and 'prefix' are mutually exclusive \u2014 provide exactly one.")
9566
+ new Error(
9567
+ "'value', 'values', 'from'/'to', and 'prefix' are mutually exclusive \u2014 provide exactly one."
9568
+ )
9089
9569
  );
9090
9570
  }
9091
9571
  if (hasRange && !(from !== void 0 && to !== void 0)) {
9092
9572
  return toolError("record_query", new Error("range lookup requires both 'from' and 'to'."));
9093
9573
  }
9574
+ if (isCompositeField && (hasRange || hasPrefix)) {
9575
+ return toolError(
9576
+ "record_query",
9577
+ new Error(
9578
+ `'field' names ${fieldNames.length} fields ('${normalizedField}') \u2014 a composite lookup is exact-match only ('value' or 'values'), not 'from'/'to'/'prefix'.`
9579
+ )
9580
+ );
9581
+ }
9582
+ if (hasComposite && values.length > fieldNames.length) {
9583
+ return toolError(
9584
+ "record_query",
9585
+ new Error(
9586
+ `'values' has ${values.length} entries but 'field' names only ${fieldNames.length} field(s) ('${normalizedField}') \u2014 supply at most one value per field, in order (fewer only as a leading run).`
9587
+ )
9588
+ );
9589
+ }
9590
+ if (sortFrom !== void 0 || sortTo !== void 0) {
9591
+ if (!(hasEquality || hasComposite)) {
9592
+ return toolError(
9593
+ "record_query",
9594
+ new Error("'sortFrom'/'sortTo' narrow a 'value' or 'values' match only \u2014 not 'from'/'to'/'prefix'.")
9595
+ );
9596
+ }
9597
+ if (hasComposite && values.length < fieldNames.length) {
9598
+ return toolError(
9599
+ "record_query",
9600
+ new Error(
9601
+ `'sortFrom'/'sortTo' with 'values' requires a value for every field named in 'field' (got ${values.length} of ${fieldNames.length}) \u2014 a partial/grouped match has no single continuous ordering to window.`
9602
+ )
9603
+ );
9604
+ }
9605
+ }
9094
9606
  page = await client.records.lookupRecordsByBody({
9095
9607
  type,
9096
- field,
9608
+ field: normalizedField,
9097
9609
  value,
9610
+ values,
9098
9611
  from,
9099
9612
  to,
9100
9613
  prefix,
9614
+ sortFrom,
9615
+ sortTo,
9101
9616
  order: args.order,
9102
9617
  startFrom,
9103
9618
  limit
9104
9619
  });
9105
9620
  log.debug(
9106
- { tool: "record_query", mode: "lookup", type, field, returned: pageItems(page).length },
9621
+ { tool: "record_query", mode: "lookup", type, field: normalizedField, returned: pageItems(page).length },
9107
9622
  "record_query lookup ok"
9108
9623
  );
9109
9624
  } else {
@@ -10042,7 +10557,7 @@ var inputSchema18 = {
10042
10557
  var currentIdentity = ({ log, apiKey, environment }) => ({
10043
10558
  name: "current_identity",
10044
10559
  title: "Current identity (tenant + principal scope)",
10045
- description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood.",
10560
+ description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Also reports mcpServerVersion (this server's own package version) and sdkVersion (the bundled @vectros-ai/sdk version) so a caller can tell what build it's talking to. Use this when the user asks 'what can you do here?', 'what tenant am I in?', or 'what version is this?'. Calls GET /v1/ping under the hood.",
10046
10561
  inputSchema: inputSchema18,
10047
10562
  handler: async () => {
10048
10563
  try {
@@ -10520,7 +11035,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10520
11035
  name: "identity",
10521
11036
  uri: "vectros://identity",
10522
11037
  title: "Current identity (tenant + principal scope)",
10523
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, and (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). The /v1/ping backing call ships this extended shape today.",
11038
+ description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }), plus mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
10524
11039
  mimeType: "application/json",
10525
11040
  read: async () => {
10526
11041
  const identity = await resolveIdentity({ log, apiKey, environment });