@canopy-io/node 0.17.0 → 0.18.1

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.d.cts CHANGED
@@ -67,7 +67,11 @@ interface CanopyClientOptions {
67
67
  apiKey?: string;
68
68
  /** Identity or portal JWT, sent as `Authorization: Bearer`. */
69
69
  accessToken?: string;
70
- /** Defaults to Canopy's hosted API. Set this for a self-hosted instance. */
70
+ /**
71
+ * Defaults to Canopy's hosted API, or to `CANOPY_BASE_URL` when that
72
+ * environment variable is set. Set this, or the variable, for a self-hosted
73
+ * instance.
74
+ */
71
75
  baseUrl?: string;
72
76
  /** Per-attempt deadline. Defaults to 30s; 0 disables. */
73
77
  timeoutMs?: number;
@@ -500,7 +504,7 @@ interface paths {
500
504
  };
501
505
  /**
502
506
  * Get an identity
503
- * @description Returns a single identity by id, scoped to the current Environment. The response carries profile metadata only (id, email, name, `external_id`, `is_active`, `created_at`); use the detail endpoint for role assignments. Returns `404` when the id does not resolve to an identity with membership in this Environment.
507
+ * @description Returns a single identity by id, scoped to the current Environment. The response carries profile metadata (id, email, name, `external_id`, `is_active`, `created_at`) and `social_links`, the social provider accounts the identity signs in with (read-only; the identity links and unlinks them on its security page); use the detail endpoint for role assignments. Returns `404` when the id does not resolve to an identity with membership in this Environment.
504
508
  */
505
509
  get: operations["ApiIdentitiesController_getIdentity"];
506
510
  put?: never;
@@ -528,7 +532,7 @@ interface paths {
528
532
  };
529
533
  /**
530
534
  * Get identity detail with role assignments
531
- * @description Returns an enriched view of a single identity in the current Environment: profile fields plus `email_verified`, `metadata`, and the identity's role assignments resolved to role and node names. Also returns `can_manage`, reflecting whether the calling principal holds `identity.manage` in this Application. Returns `404` when the identity has no membership in this Environment.
535
+ * @description Returns an enriched view of a single identity in the current Environment: profile fields plus `email_verified`, `metadata`, the identity's role assignments resolved to role and node names, and `social_links`, the social provider accounts it signs in with. Also returns `can_manage`, reflecting whether the calling principal holds `identity.manage` in this Application. Returns `404` when the identity has no membership in this Environment.
532
536
  */
533
537
  get: operations["ApiIdentitiesController_getIdentityDetail"];
534
538
  put?: never;
@@ -669,7 +673,7 @@ interface paths {
669
673
  get?: never;
670
674
  put?: never;
671
675
  /**
672
- * Force-reset an identity's MFA — admin recovery action
676
+ * Force-reset an identity's MFA, as an admin recovery action
673
677
  * @description Force-resets an identity's MFA enrollment (server-to-server admin), clearing all enrolled factors across the Account so the identity must re-enroll on next sign-in. Gated by an Environment-scoped membership check and audited. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
674
678
  */
675
679
  post: operations["ApiIdentitiesController_resetIdentityMfa"];
@@ -3543,6 +3547,40 @@ interface components {
3543
3547
  ApiBulkCreateIdentitiesDto: {
3544
3548
  identities: components["schemas"]["ApiCreateIdentityDto"][];
3545
3549
  };
3550
+ IdentitySocialLinkResponseDto: {
3551
+ id: string;
3552
+ /** @description The provider's name as the sign-in page shows it, or, when the provider has been removed, the host the account signed in at. */
3553
+ label: string;
3554
+ /** @description The slug of the provider it signs in through, or null when the provider has been removed. */
3555
+ slug?: string | null;
3556
+ /**
3557
+ * @description The provider's kind, `oidc` for a custom OpenID Connect provider, or null when the provider has been removed.
3558
+ * @enum {string|null}
3559
+ */
3560
+ kind?: "google" | "github" | "microsoft" | "apple" | "oidc" | null;
3561
+ /** @description The email the provider reported when the account was linked. It need not match the identity's. */
3562
+ email?: string | null;
3563
+ /** Format: date-time */
3564
+ linked_at: string;
3565
+ /**
3566
+ * Format: date-time
3567
+ * @description The last time the identity signed in with this account.
3568
+ */
3569
+ last_used_at?: string | null;
3570
+ };
3571
+ IdentityWithSocialLinksResponseDto: {
3572
+ id: string;
3573
+ email: string;
3574
+ first_name: string;
3575
+ last_name: string;
3576
+ avatar_url?: string | null;
3577
+ external_id?: string | null;
3578
+ is_active: boolean;
3579
+ /** Format: date-time */
3580
+ created_at: string;
3581
+ /** @description The social provider accounts the identity signs in with, oldest first. Linked and unlinked by the identity on its security page. */
3582
+ social_links: components["schemas"]["IdentitySocialLinkResponseDto"][];
3583
+ };
3546
3584
  IdentityDetailResponseDto: {
3547
3585
  id: string;
3548
3586
  email: string;
@@ -3555,6 +3593,7 @@ interface components {
3555
3593
  is_active: boolean;
3556
3594
  email_verified: boolean;
3557
3595
  roles: components["schemas"]["IdentityRoleDto"][];
3596
+ social_links: components["schemas"]["IdentitySocialLinkResponseDto"][];
3558
3597
  can_manage: boolean;
3559
3598
  /** Format: date-time */
3560
3599
  created_at: string;
@@ -3604,6 +3643,14 @@ interface components {
3604
3643
  */
3605
3644
  webauthn_rp_id: string | null;
3606
3645
  };
3646
+ MfaRequiredEnvironmentResponseDto: {
3647
+ /** Format: uuid */
3648
+ environment_id: string;
3649
+ /** @example production */
3650
+ environment_slug: string;
3651
+ /** @example ledger */
3652
+ application_slug: string;
3653
+ };
3607
3654
  AccountIdentityMfaResponseDto: {
3608
3655
  factors: components["schemas"]["MfaFactorResponseDto"][];
3609
3656
  /** @description Generation number of the active recovery-code batch. 0 means no batch has ever been issued; 1+ tracks regenerations. */
@@ -3615,6 +3662,8 @@ interface components {
3615
3662
  * @description Timestamp of the most recent admin force-reset. `null` if MFA has never been reset for this identity.
3616
3663
  */
3617
3664
  mfa_admin_reset_at?: string | null;
3665
+ /** @description The Environments where the identity's next sign-in asks for a second factor: the Environment requires MFA, or an organization the identity belongs to there does. Empty when MFA is required nowhere they sign in, so after a reset they sign in without one. On the public API it lists the key's own Environment at most. */
3666
+ mfa_required_in: components["schemas"]["MfaRequiredEnvironmentResponseDto"][];
3618
3667
  };
3619
3668
  IdentityAuthStateResponseDto: {
3620
3669
  /** @description Master kill-switch — false means the identity cannot sign in. */
@@ -4306,10 +4355,18 @@ interface components {
4306
4355
  mfa_factor_allowlist: ("totp" | "webauthn" | "email_otp")[];
4307
4356
  /** @enum {string} */
4308
4357
  mfa_after_sso: "exempt" | "require";
4309
- /** @description The sign-in methods on offer: on the Environment, the ones it has turned on; on the effective policy, those narrowed by the organization, and `["sso"]` alone while it requires SSO. */
4310
- allowed_sign_in_methods: ("password" | "email_otp" | "sso")[];
4358
+ /** @description The sign-in methods on offer: on the Environment, the ones it has turned on; on the effective policy, those narrowed by the organization, and `["sso"]` alone while it requires SSO. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4359
+ allowed_sign_in_methods: string[];
4311
4360
  require_sso: boolean;
4312
4361
  };
4362
+ PolicySocialProviderDto: {
4363
+ /** @description The sign-in method the provider adds: its kind, or `oidc:<slug>` for a custom provider. */
4364
+ method: string;
4365
+ /** @enum {string} */
4366
+ kind: "google" | "github" | "microsoft" | "apple" | "oidc";
4367
+ /** @description The provider's name as the sign-in page shows it. */
4368
+ label: string;
4369
+ };
4313
4370
  OrganizationPolicyResponseDto: {
4314
4371
  /** @description The organization this policy belongs to. */
4315
4372
  organization_id: string;
@@ -4317,8 +4374,8 @@ interface components {
4317
4374
  mfa_factor_allowlist?: ("totp" | "webauthn" | "email_otp")[] | null;
4318
4375
  /** @enum {string|null} */
4319
4376
  mfa_after_sso?: "exempt" | "require" | null;
4320
- /** @description The methods the organization keeps of the Environment's, or null to inherit them all. */
4321
- allowed_sign_in_methods?: ("password" | "email_otp" | "sso")[] | null;
4377
+ /** @description The methods the organization keeps of the Environment's, or null to inherit them all. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4378
+ allowed_sign_in_methods?: string[] | null;
4322
4379
  require_sso: boolean;
4323
4380
  /**
4324
4381
  * @description Whether the Environment's staff (identities holding a role at the Environment root) may enter this organization. `allowed` until the organization refuses them.
@@ -4327,6 +4384,8 @@ interface components {
4327
4384
  staff_entry: "allowed" | "refused";
4328
4385
  /** @description The Environment's own settings, the floor this organization's policy tightens from. */
4329
4386
  environment: components["schemas"]["EffectiveOrganizationPolicyDto"];
4387
+ /** @description The Environment's enabled social providers, in the order they are offered, naming the methods they add to `allowed_sign_in_methods`. */
4388
+ social_providers: components["schemas"]["PolicySocialProviderDto"][];
4330
4389
  /** @description The policy the organization's members sign in under. */
4331
4390
  effective: components["schemas"]["EffectiveOrganizationPolicyDto"];
4332
4391
  /** @description Optimistic-concurrency version. 0 until the organization sets a policy of its own. */
@@ -4348,8 +4407,8 @@ interface components {
4348
4407
  * @enum {string|null}
4349
4408
  */
4350
4409
  mfa_after_sso?: "exempt" | "require" | null;
4351
- /** @description The sign-in methods this organization's members may use. A non-empty subset of the methods the Environment offers (`password` unless the Environment turned it off, `email_otp` where the Environment turned it on, and `sso`); a method the Environment does not offer is refused with `organization.policy_loosens`. `null` inherits the Environment's. While `require_sso` is on, SSO is the only method whatever this says. */
4352
- allowed_sign_in_methods?: ("password" | "email_otp" | "sso")[] | null;
4410
+ /** @description The sign-in methods this organization's members may use. A non-empty subset of the methods the Environment offers (`password` unless the Environment turned it off, `email_otp` where the Environment turned it on, each social provider it enabled, and `sso`); a method the Environment does not offer is refused with `organization.policy_loosens`. `null` inherits the Environment's. While `require_sso` is on, SSO is the only method whatever this says. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4411
+ allowed_sign_in_methods?: string[] | null;
4353
4412
  /** @description Members must sign in through SSO. Password and email-code logins are refused for the organization's members and for any email whose domain routes to a connection bound to this organization. */
4354
4413
  require_sso?: boolean;
4355
4414
  /**
@@ -5319,6 +5378,11 @@ interface components {
5319
5378
  metadata: Record<string, unknown>;
5320
5379
  /** Format: date-time */
5321
5380
  created_at: string;
5381
+ /**
5382
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5383
+ * @enum {string|null}
5384
+ */
5385
+ channel?: "mcp" | null;
5322
5386
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5323
5387
  actor_label?: string | null;
5324
5388
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5405,6 +5469,11 @@ interface components {
5405
5469
  severity?: "info" | "notice" | "warning" | "critical";
5406
5470
  /** @enum {string} */
5407
5471
  outcome?: "success" | "failure" | "denied";
5472
+ /**
5473
+ * @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server.
5474
+ * @enum {string}
5475
+ */
5476
+ channel?: "mcp";
5408
5477
  /** Format: uuid */
5409
5478
  actor_id?: string;
5410
5479
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
@@ -5447,6 +5516,11 @@ interface components {
5447
5516
  metadata: Record<string, unknown>;
5448
5517
  /** Format: date-time */
5449
5518
  created_at: string;
5519
+ /**
5520
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5521
+ * @enum {string|null}
5522
+ */
5523
+ channel?: "mcp" | null;
5450
5524
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5451
5525
  actor_label?: string | null;
5452
5526
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5854,7 +5928,7 @@ interface components {
5854
5928
  */
5855
5929
  access_mode: "scoped" | "full_access";
5856
5930
  /** @description Permission scopes this key is authorized for, each one the platform offers (`GET .../api-keys/scopes`). Required and must be non-empty when `access_mode` is `scoped`. Must be omitted when `access_mode` is `full_access`. */
5857
- scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "branding.view" | "branding.manage")[];
5931
+ scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "audit.view" | "branding.view" | "branding.manage")[];
5858
5932
  /** @description Expiration date (ISO 8601). Omit for no expiration. */
5859
5933
  expires_at?: string;
5860
5934
  };
@@ -6017,6 +6091,32 @@ interface components {
6017
6091
  };
6018
6092
  };
6019
6093
  };
6094
+ /** @description A delivery of the `identity.social_link.added` webhook event. */
6095
+ WebhookIdentitySocialLinkAddedEvent: {
6096
+ /** @enum {string} */
6097
+ event: "identity.social_link.added";
6098
+ data: components["schemas"]["ChangeEventDataDto"] & {
6099
+ /** @enum {string} */
6100
+ resource_type: "identity";
6101
+ metadata: {
6102
+ /** @description The sign-in method the link adds: google, github, microsoft, apple, or oidc:<name> for a custom provider. */
6103
+ method: string;
6104
+ };
6105
+ };
6106
+ };
6107
+ /** @description A delivery of the `identity.social_link.removed` webhook event. */
6108
+ WebhookIdentitySocialLinkRemovedEvent: {
6109
+ /** @enum {string} */
6110
+ event: "identity.social_link.removed";
6111
+ data: components["schemas"]["ChangeEventDataDto"] & {
6112
+ /** @enum {string} */
6113
+ resource_type: "identity";
6114
+ metadata: {
6115
+ /** @description The sign-in method the identity no longer has: google, github, microsoft, apple, or oidc:<name> for a custom provider. */
6116
+ method: string;
6117
+ };
6118
+ };
6119
+ };
6020
6120
  /** @description A delivery of the `identity.env_membership.added` webhook event. */
6021
6121
  WebhookIdentityEnvMembershipAddedEvent: {
6022
6122
  /** @enum {string} */
@@ -7184,8 +7284,8 @@ interface components {
7184
7284
  * @enum {string|null}
7185
7285
  */
7186
7286
  mfa_after_sso: "exempt" | "require" | null;
7187
- /** @description The sign-in methods members may use, or null to inherit the Environment's. */
7188
- allowed_sign_in_methods: ("password" | "email_otp" | "sso")[] | null;
7287
+ /** @description The sign-in methods members may use, or null to inherit the Environment's. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
7288
+ allowed_sign_in_methods: string[] | null;
7189
7289
  /** @description Whether members must sign in with SSO. */
7190
7290
  require_sso: boolean;
7191
7291
  /**
@@ -8924,7 +9024,7 @@ interface operations {
8924
9024
  };
8925
9025
  content: {
8926
9026
  "application/json": {
8927
- data: components["schemas"]["IdentityResponseDto"];
9027
+ data: components["schemas"]["IdentityWithSocialLinksResponseDto"];
8928
9028
  };
8929
9029
  };
8930
9030
  };
@@ -9884,7 +9984,7 @@ interface operations {
9884
9984
  };
9885
9985
  requestBody?: never;
9886
9986
  responses: {
9887
- /** @description Returns the identity's enrolled factors (TOTP and WebAuthn rows with redacted secrets), the current recovery-code generation count + remaining count, and the most-recent admin-reset timestamp. */
9987
+ /** @description Returns the identity's enrolled factors (TOTP and WebAuthn rows with redacted secrets), the current recovery-code generation count + remaining count, the most-recent admin-reset timestamp, and the Environments where their next sign-in asks for a second factor. */
9888
9988
  200: {
9889
9989
  headers: {
9890
9990
  [name: string]: unknown;
@@ -26538,6 +26638,8 @@ interface operations {
26538
26638
  category?: "auth" | "identity" | "admin_user" | "tenancy" | "hierarchy" | "organization" | "rbac" | "authorization" | "api_keys" | "oauth" | "webhooks" | "invites" | "mfa" | "audit" | "billing" | "sso" | "unknown";
26539
26639
  severity?: "info" | "notice" | "warning" | "critical";
26540
26640
  outcome?: "success" | "failure" | "denied";
26641
+ /** @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server. */
26642
+ channel?: "mcp";
26541
26643
  actor_id?: string;
26542
26644
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
26543
26645
  actor_type?: string;
@@ -31497,8 +31599,9 @@ interface TokenVerifierOptions {
31497
31599
  /**
31498
31600
  * The Environment whose tokens are accepted. Every Environment is its own
31499
31601
  * issuer with its own signing keys, at
31500
- * `https://auth.canopy-io.com/environments/<id>`, so on hosted Canopy this is
31501
- * all verification needs. A token from any other Environment fails.
31602
+ * `https://auth.canopy-io.com/environments/<id>` (or under `CANOPY_BASE_URL`
31603
+ * when that environment variable is set), so on hosted Canopy this is all
31604
+ * verification needs. A token from any other Environment fails.
31502
31605
  *
31503
31606
  * Set exactly one of `environmentId` and `issuer`; the constructor throws
31504
31607
  * with neither or both.
package/dist/index.d.ts CHANGED
@@ -67,7 +67,11 @@ interface CanopyClientOptions {
67
67
  apiKey?: string;
68
68
  /** Identity or portal JWT, sent as `Authorization: Bearer`. */
69
69
  accessToken?: string;
70
- /** Defaults to Canopy's hosted API. Set this for a self-hosted instance. */
70
+ /**
71
+ * Defaults to Canopy's hosted API, or to `CANOPY_BASE_URL` when that
72
+ * environment variable is set. Set this, or the variable, for a self-hosted
73
+ * instance.
74
+ */
71
75
  baseUrl?: string;
72
76
  /** Per-attempt deadline. Defaults to 30s; 0 disables. */
73
77
  timeoutMs?: number;
@@ -500,7 +504,7 @@ interface paths {
500
504
  };
501
505
  /**
502
506
  * Get an identity
503
- * @description Returns a single identity by id, scoped to the current Environment. The response carries profile metadata only (id, email, name, `external_id`, `is_active`, `created_at`); use the detail endpoint for role assignments. Returns `404` when the id does not resolve to an identity with membership in this Environment.
507
+ * @description Returns a single identity by id, scoped to the current Environment. The response carries profile metadata (id, email, name, `external_id`, `is_active`, `created_at`) and `social_links`, the social provider accounts the identity signs in with (read-only; the identity links and unlinks them on its security page); use the detail endpoint for role assignments. Returns `404` when the id does not resolve to an identity with membership in this Environment.
504
508
  */
505
509
  get: operations["ApiIdentitiesController_getIdentity"];
506
510
  put?: never;
@@ -528,7 +532,7 @@ interface paths {
528
532
  };
529
533
  /**
530
534
  * Get identity detail with role assignments
531
- * @description Returns an enriched view of a single identity in the current Environment: profile fields plus `email_verified`, `metadata`, and the identity's role assignments resolved to role and node names. Also returns `can_manage`, reflecting whether the calling principal holds `identity.manage` in this Application. Returns `404` when the identity has no membership in this Environment.
535
+ * @description Returns an enriched view of a single identity in the current Environment: profile fields plus `email_verified`, `metadata`, the identity's role assignments resolved to role and node names, and `social_links`, the social provider accounts it signs in with. Also returns `can_manage`, reflecting whether the calling principal holds `identity.manage` in this Application. Returns `404` when the identity has no membership in this Environment.
532
536
  */
533
537
  get: operations["ApiIdentitiesController_getIdentityDetail"];
534
538
  put?: never;
@@ -669,7 +673,7 @@ interface paths {
669
673
  get?: never;
670
674
  put?: never;
671
675
  /**
672
- * Force-reset an identity's MFA — admin recovery action
676
+ * Force-reset an identity's MFA, as an admin recovery action
673
677
  * @description Force-resets an identity's MFA enrollment (server-to-server admin), clearing all enrolled factors across the Account so the identity must re-enroll on next sign-in. Gated by an Environment-scoped membership check and audited. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
674
678
  */
675
679
  post: operations["ApiIdentitiesController_resetIdentityMfa"];
@@ -3543,6 +3547,40 @@ interface components {
3543
3547
  ApiBulkCreateIdentitiesDto: {
3544
3548
  identities: components["schemas"]["ApiCreateIdentityDto"][];
3545
3549
  };
3550
+ IdentitySocialLinkResponseDto: {
3551
+ id: string;
3552
+ /** @description The provider's name as the sign-in page shows it, or, when the provider has been removed, the host the account signed in at. */
3553
+ label: string;
3554
+ /** @description The slug of the provider it signs in through, or null when the provider has been removed. */
3555
+ slug?: string | null;
3556
+ /**
3557
+ * @description The provider's kind, `oidc` for a custom OpenID Connect provider, or null when the provider has been removed.
3558
+ * @enum {string|null}
3559
+ */
3560
+ kind?: "google" | "github" | "microsoft" | "apple" | "oidc" | null;
3561
+ /** @description The email the provider reported when the account was linked. It need not match the identity's. */
3562
+ email?: string | null;
3563
+ /** Format: date-time */
3564
+ linked_at: string;
3565
+ /**
3566
+ * Format: date-time
3567
+ * @description The last time the identity signed in with this account.
3568
+ */
3569
+ last_used_at?: string | null;
3570
+ };
3571
+ IdentityWithSocialLinksResponseDto: {
3572
+ id: string;
3573
+ email: string;
3574
+ first_name: string;
3575
+ last_name: string;
3576
+ avatar_url?: string | null;
3577
+ external_id?: string | null;
3578
+ is_active: boolean;
3579
+ /** Format: date-time */
3580
+ created_at: string;
3581
+ /** @description The social provider accounts the identity signs in with, oldest first. Linked and unlinked by the identity on its security page. */
3582
+ social_links: components["schemas"]["IdentitySocialLinkResponseDto"][];
3583
+ };
3546
3584
  IdentityDetailResponseDto: {
3547
3585
  id: string;
3548
3586
  email: string;
@@ -3555,6 +3593,7 @@ interface components {
3555
3593
  is_active: boolean;
3556
3594
  email_verified: boolean;
3557
3595
  roles: components["schemas"]["IdentityRoleDto"][];
3596
+ social_links: components["schemas"]["IdentitySocialLinkResponseDto"][];
3558
3597
  can_manage: boolean;
3559
3598
  /** Format: date-time */
3560
3599
  created_at: string;
@@ -3604,6 +3643,14 @@ interface components {
3604
3643
  */
3605
3644
  webauthn_rp_id: string | null;
3606
3645
  };
3646
+ MfaRequiredEnvironmentResponseDto: {
3647
+ /** Format: uuid */
3648
+ environment_id: string;
3649
+ /** @example production */
3650
+ environment_slug: string;
3651
+ /** @example ledger */
3652
+ application_slug: string;
3653
+ };
3607
3654
  AccountIdentityMfaResponseDto: {
3608
3655
  factors: components["schemas"]["MfaFactorResponseDto"][];
3609
3656
  /** @description Generation number of the active recovery-code batch. 0 means no batch has ever been issued; 1+ tracks regenerations. */
@@ -3615,6 +3662,8 @@ interface components {
3615
3662
  * @description Timestamp of the most recent admin force-reset. `null` if MFA has never been reset for this identity.
3616
3663
  */
3617
3664
  mfa_admin_reset_at?: string | null;
3665
+ /** @description The Environments where the identity's next sign-in asks for a second factor: the Environment requires MFA, or an organization the identity belongs to there does. Empty when MFA is required nowhere they sign in, so after a reset they sign in without one. On the public API it lists the key's own Environment at most. */
3666
+ mfa_required_in: components["schemas"]["MfaRequiredEnvironmentResponseDto"][];
3618
3667
  };
3619
3668
  IdentityAuthStateResponseDto: {
3620
3669
  /** @description Master kill-switch — false means the identity cannot sign in. */
@@ -4306,10 +4355,18 @@ interface components {
4306
4355
  mfa_factor_allowlist: ("totp" | "webauthn" | "email_otp")[];
4307
4356
  /** @enum {string} */
4308
4357
  mfa_after_sso: "exempt" | "require";
4309
- /** @description The sign-in methods on offer: on the Environment, the ones it has turned on; on the effective policy, those narrowed by the organization, and `["sso"]` alone while it requires SSO. */
4310
- allowed_sign_in_methods: ("password" | "email_otp" | "sso")[];
4358
+ /** @description The sign-in methods on offer: on the Environment, the ones it has turned on; on the effective policy, those narrowed by the organization, and `["sso"]` alone while it requires SSO. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4359
+ allowed_sign_in_methods: string[];
4311
4360
  require_sso: boolean;
4312
4361
  };
4362
+ PolicySocialProviderDto: {
4363
+ /** @description The sign-in method the provider adds: its kind, or `oidc:<slug>` for a custom provider. */
4364
+ method: string;
4365
+ /** @enum {string} */
4366
+ kind: "google" | "github" | "microsoft" | "apple" | "oidc";
4367
+ /** @description The provider's name as the sign-in page shows it. */
4368
+ label: string;
4369
+ };
4313
4370
  OrganizationPolicyResponseDto: {
4314
4371
  /** @description The organization this policy belongs to. */
4315
4372
  organization_id: string;
@@ -4317,8 +4374,8 @@ interface components {
4317
4374
  mfa_factor_allowlist?: ("totp" | "webauthn" | "email_otp")[] | null;
4318
4375
  /** @enum {string|null} */
4319
4376
  mfa_after_sso?: "exempt" | "require" | null;
4320
- /** @description The methods the organization keeps of the Environment's, or null to inherit them all. */
4321
- allowed_sign_in_methods?: ("password" | "email_otp" | "sso")[] | null;
4377
+ /** @description The methods the organization keeps of the Environment's, or null to inherit them all. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4378
+ allowed_sign_in_methods?: string[] | null;
4322
4379
  require_sso: boolean;
4323
4380
  /**
4324
4381
  * @description Whether the Environment's staff (identities holding a role at the Environment root) may enter this organization. `allowed` until the organization refuses them.
@@ -4327,6 +4384,8 @@ interface components {
4327
4384
  staff_entry: "allowed" | "refused";
4328
4385
  /** @description The Environment's own settings, the floor this organization's policy tightens from. */
4329
4386
  environment: components["schemas"]["EffectiveOrganizationPolicyDto"];
4387
+ /** @description The Environment's enabled social providers, in the order they are offered, naming the methods they add to `allowed_sign_in_methods`. */
4388
+ social_providers: components["schemas"]["PolicySocialProviderDto"][];
4330
4389
  /** @description The policy the organization's members sign in under. */
4331
4390
  effective: components["schemas"]["EffectiveOrganizationPolicyDto"];
4332
4391
  /** @description Optimistic-concurrency version. 0 until the organization sets a policy of its own. */
@@ -4348,8 +4407,8 @@ interface components {
4348
4407
  * @enum {string|null}
4349
4408
  */
4350
4409
  mfa_after_sso?: "exempt" | "require" | null;
4351
- /** @description The sign-in methods this organization's members may use. A non-empty subset of the methods the Environment offers (`password` unless the Environment turned it off, `email_otp` where the Environment turned it on, and `sso`); a method the Environment does not offer is refused with `organization.policy_loosens`. `null` inherits the Environment's. While `require_sso` is on, SSO is the only method whatever this says. */
4352
- allowed_sign_in_methods?: ("password" | "email_otp" | "sso")[] | null;
4410
+ /** @description The sign-in methods this organization's members may use. A non-empty subset of the methods the Environment offers (`password` unless the Environment turned it off, `email_otp` where the Environment turned it on, each social provider it enabled, and `sso`); a method the Environment does not offer is refused with `organization.policy_loosens`. `null` inherits the Environment's. While `require_sso` is on, SSO is the only method whatever this says. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
4411
+ allowed_sign_in_methods?: string[] | null;
4353
4412
  /** @description Members must sign in through SSO. Password and email-code logins are refused for the organization's members and for any email whose domain routes to a connection bound to this organization. */
4354
4413
  require_sso?: boolean;
4355
4414
  /**
@@ -5319,6 +5378,11 @@ interface components {
5319
5378
  metadata: Record<string, unknown>;
5320
5379
  /** Format: date-time */
5321
5380
  created_at: string;
5381
+ /**
5382
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5383
+ * @enum {string|null}
5384
+ */
5385
+ channel?: "mcp" | null;
5322
5386
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5323
5387
  actor_label?: string | null;
5324
5388
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5405,6 +5469,11 @@ interface components {
5405
5469
  severity?: "info" | "notice" | "warning" | "critical";
5406
5470
  /** @enum {string} */
5407
5471
  outcome?: "success" | "failure" | "denied";
5472
+ /**
5473
+ * @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server.
5474
+ * @enum {string}
5475
+ */
5476
+ channel?: "mcp";
5408
5477
  /** Format: uuid */
5409
5478
  actor_id?: string;
5410
5479
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
@@ -5447,6 +5516,11 @@ interface components {
5447
5516
  metadata: Record<string, unknown>;
5448
5517
  /** Format: date-time */
5449
5518
  created_at: string;
5519
+ /**
5520
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5521
+ * @enum {string|null}
5522
+ */
5523
+ channel?: "mcp" | null;
5450
5524
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5451
5525
  actor_label?: string | null;
5452
5526
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5854,7 +5928,7 @@ interface components {
5854
5928
  */
5855
5929
  access_mode: "scoped" | "full_access";
5856
5930
  /** @description Permission scopes this key is authorized for, each one the platform offers (`GET .../api-keys/scopes`). Required and must be non-empty when `access_mode` is `scoped`. Must be omitted when `access_mode` is `full_access`. */
5857
- scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "branding.view" | "branding.manage")[];
5931
+ scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "audit.view" | "branding.view" | "branding.manage")[];
5858
5932
  /** @description Expiration date (ISO 8601). Omit for no expiration. */
5859
5933
  expires_at?: string;
5860
5934
  };
@@ -6017,6 +6091,32 @@ interface components {
6017
6091
  };
6018
6092
  };
6019
6093
  };
6094
+ /** @description A delivery of the `identity.social_link.added` webhook event. */
6095
+ WebhookIdentitySocialLinkAddedEvent: {
6096
+ /** @enum {string} */
6097
+ event: "identity.social_link.added";
6098
+ data: components["schemas"]["ChangeEventDataDto"] & {
6099
+ /** @enum {string} */
6100
+ resource_type: "identity";
6101
+ metadata: {
6102
+ /** @description The sign-in method the link adds: google, github, microsoft, apple, or oidc:<name> for a custom provider. */
6103
+ method: string;
6104
+ };
6105
+ };
6106
+ };
6107
+ /** @description A delivery of the `identity.social_link.removed` webhook event. */
6108
+ WebhookIdentitySocialLinkRemovedEvent: {
6109
+ /** @enum {string} */
6110
+ event: "identity.social_link.removed";
6111
+ data: components["schemas"]["ChangeEventDataDto"] & {
6112
+ /** @enum {string} */
6113
+ resource_type: "identity";
6114
+ metadata: {
6115
+ /** @description The sign-in method the identity no longer has: google, github, microsoft, apple, or oidc:<name> for a custom provider. */
6116
+ method: string;
6117
+ };
6118
+ };
6119
+ };
6020
6120
  /** @description A delivery of the `identity.env_membership.added` webhook event. */
6021
6121
  WebhookIdentityEnvMembershipAddedEvent: {
6022
6122
  /** @enum {string} */
@@ -7184,8 +7284,8 @@ interface components {
7184
7284
  * @enum {string|null}
7185
7285
  */
7186
7286
  mfa_after_sso: "exempt" | "require" | null;
7187
- /** @description The sign-in methods members may use, or null to inherit the Environment's. */
7188
- allowed_sign_in_methods: ("password" | "email_otp" | "sso")[] | null;
7287
+ /** @description The sign-in methods members may use, or null to inherit the Environment's. Each is `password`, `email_otp`, `sso`, a social provider (`google`, `github`, `microsoft`, `apple`), or `oidc:<slug>` for a custom OpenID Connect provider. */
7288
+ allowed_sign_in_methods: string[] | null;
7189
7289
  /** @description Whether members must sign in with SSO. */
7190
7290
  require_sso: boolean;
7191
7291
  /**
@@ -8924,7 +9024,7 @@ interface operations {
8924
9024
  };
8925
9025
  content: {
8926
9026
  "application/json": {
8927
- data: components["schemas"]["IdentityResponseDto"];
9027
+ data: components["schemas"]["IdentityWithSocialLinksResponseDto"];
8928
9028
  };
8929
9029
  };
8930
9030
  };
@@ -9884,7 +9984,7 @@ interface operations {
9884
9984
  };
9885
9985
  requestBody?: never;
9886
9986
  responses: {
9887
- /** @description Returns the identity's enrolled factors (TOTP and WebAuthn rows with redacted secrets), the current recovery-code generation count + remaining count, and the most-recent admin-reset timestamp. */
9987
+ /** @description Returns the identity's enrolled factors (TOTP and WebAuthn rows with redacted secrets), the current recovery-code generation count + remaining count, the most-recent admin-reset timestamp, and the Environments where their next sign-in asks for a second factor. */
9888
9988
  200: {
9889
9989
  headers: {
9890
9990
  [name: string]: unknown;
@@ -26538,6 +26638,8 @@ interface operations {
26538
26638
  category?: "auth" | "identity" | "admin_user" | "tenancy" | "hierarchy" | "organization" | "rbac" | "authorization" | "api_keys" | "oauth" | "webhooks" | "invites" | "mfa" | "audit" | "billing" | "sso" | "unknown";
26539
26639
  severity?: "info" | "notice" | "warning" | "critical";
26540
26640
  outcome?: "success" | "failure" | "denied";
26641
+ /** @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server. */
26642
+ channel?: "mcp";
26541
26643
  actor_id?: string;
26542
26644
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
26543
26645
  actor_type?: string;
@@ -31497,8 +31599,9 @@ interface TokenVerifierOptions {
31497
31599
  /**
31498
31600
  * The Environment whose tokens are accepted. Every Environment is its own
31499
31601
  * issuer with its own signing keys, at
31500
- * `https://auth.canopy-io.com/environments/<id>`, so on hosted Canopy this is
31501
- * all verification needs. A token from any other Environment fails.
31602
+ * `https://auth.canopy-io.com/environments/<id>` (or under `CANOPY_BASE_URL`
31603
+ * when that environment variable is set), so on hosted Canopy this is all
31604
+ * verification needs. A token from any other Environment fails.
31502
31605
  *
31503
31606
  * Set exactly one of `environmentId` and `issuer`; the constructor throws
31504
31607
  * with neither or both.
package/dist/index.js CHANGED
@@ -93,11 +93,18 @@ function withoutTrailingSlashes(value) {
93
93
  return value.slice(0, end);
94
94
  }
95
95
 
96
+ // src/origin.ts
97
+ var HOSTED_ORIGIN = "https://auth.canopy-io.com";
98
+ function hostedOrigin() {
99
+ const env = globalThis.process?.env;
100
+ const configured = env?.["CANOPY_BASE_URL"]?.trim();
101
+ return withoutTrailingSlashes(configured || HOSTED_ORIGIN);
102
+ }
103
+
96
104
  // src/client.ts
97
105
  function isCursorPagination(pagination) {
98
106
  return "next_cursor" in pagination;
99
107
  }
100
- var DEFAULT_BASE_URL = "https://auth.canopy-io.com";
101
108
  var DEFAULT_TIMEOUT_MS = 3e4;
102
109
  var DEFAULT_MAX_RETRIES = 2;
103
110
  var DEFAULT_MAX_BACKOFF_MS = 3e4;
@@ -117,7 +124,7 @@ var CanopyClient = class {
117
124
  "CanopyClient requires either `apiKey` (server-to-server) or `accessToken` (a user or identity JWT)."
118
125
  );
119
126
  }
120
- this.baseUrl = withoutTrailingSlashes(options.baseUrl ?? DEFAULT_BASE_URL);
127
+ this.baseUrl = withoutTrailingSlashes(options.baseUrl ?? hostedOrigin());
121
128
  this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
122
129
  this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
123
130
  this.maxBackoffMs = options.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS;
@@ -1203,6 +1210,9 @@ var NO_ACCESS_CHANGE = /* @__PURE__ */ new Set([
1203
1210
  "organization.policy.updated",
1204
1211
  "organization.sso_connection.bound",
1205
1212
  "organization.sso_connection.unbound",
1213
+ // How an identity signs in, not what it may do.
1214
+ "identity.social_link.added",
1215
+ "identity.social_link.removed",
1206
1216
  // A pushed group grants nothing until it is mapped, which is its own event.
1207
1217
  "scim.group.created"
1208
1218
  ]);
@@ -2201,7 +2211,6 @@ function authorizationErrorStatus(error) {
2201
2211
  }
2202
2212
 
2203
2213
  // src/verify.ts
2204
- var HOSTED_ORIGIN = "https://auth.canopy-io.com";
2205
2214
  var DEFAULT_JWKS_CACHE_MAX_AGE_MS = 10 * 60 * 1e3;
2206
2215
  var DEFAULT_JWKS_MIN_REFETCH_INTERVAL_MS = 30 * 1e3;
2207
2216
  var DEFAULT_JWKS_TIMEOUT_MS = 5e3;
@@ -2224,7 +2233,7 @@ function resolveIssuer(options) {
2224
2233
  return withoutTrailingSlashes(issuer);
2225
2234
  }
2226
2235
  if (environmentId) {
2227
- return `${HOSTED_ORIGIN}/environments/${environmentId}`;
2236
+ return `${hostedOrigin()}/environments/${environmentId}`;
2228
2237
  }
2229
2238
  throw new TypeError(
2230
2239
  "TokenVerifier needs environmentId (the Environment your tokens come from) or, on a custom auth domain or self-hosted instance, issuer."