@canopy-io/node 0.3.0 → 0.3.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
@@ -514,7 +514,7 @@ interface paths {
514
514
  head?: never;
515
515
  /**
516
516
  * Update an identity
517
- * @description Updates an identity's mutable profile fields (`first_name`, `last_name`, `is_active`, `metadata`) in the current Environment. `email` and `external_id` are immutable here — `external_id` is owned by the SSO/SCIM provisioning path and cannot be re-pointed through this endpoint. Returns the updated identity and writes an `identity.updated` audit row; returns `404` when the identity has no membership in this Environment.
517
+ * @description Updates an identity's mutable profile fields (`first_name`, `last_name`, `is_active`, `metadata`) in the current Environment. `email` and `external_id` are immutable here — `external_id` is owned by the SSO/SCIM provisioning path and cannot be re-pointed through this endpoint. Returns the updated identity and writes an `identity.updated` audit row for the profile fields; a change to `is_active` writes `identity.status_set` instead, the account-wide activation switch. Returns `404` when the identity has no membership in this Environment.
518
518
  */
519
519
  patch: operations["ApiIdentitiesController_updateIdentity"];
520
520
  trace?: never;
@@ -550,7 +550,7 @@ interface paths {
550
550
  put?: never;
551
551
  /**
552
552
  * Activate an identity
553
- * @description Reactivates an identity by setting `is_active = true` in the current Environment, allowing it to authenticate again. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
553
+ * @description Reactivates an identity by setting `is_active = true`, the account-wide switch, allowing it to authenticate again in every Environment it belongs to. Writes an `identity.status_set` audit row (the same event the Console's account route emits), delivered to the account's subscriptions and to those of every Environment the identity is a member of. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
554
554
  */
555
555
  post: operations["ApiIdentitiesController_activateIdentity"];
556
556
  delete?: never;
@@ -570,7 +570,7 @@ interface paths {
570
570
  put?: never;
571
571
  /**
572
572
  * Deactivate an identity
573
- * @description Deactivates an identity by setting `is_active = false` in the current Environment, blocking future sign-in. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
573
+ * @description Deactivates an identity by setting `is_active = false`, the account-wide switch, blocking future sign-in in every Environment it belongs to. Writes an `identity.status_set` audit row (the same event the Console's account route emits), delivered to the account's subscriptions and to those of every Environment the identity is a member of. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
574
574
  */
575
575
  post: operations["ApiIdentitiesController_deactivateIdentity"];
576
576
  delete?: never;
@@ -630,7 +630,7 @@ interface paths {
630
630
  put?: never;
631
631
  /**
632
632
  * Revoke all of an identity's sessions (admin)
633
- * @description Revokes all of an identity's sessions (server-to-server admin) by marking every active refresh token revoked, so the next refresh on any device returns `401` and the user must sign in again. In-flight access tokens remain valid until their short TTL lapses. Idempotent — revoking when no tokens are active is a no-op. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
633
+ * @description Revokes all of an identity's sessions (server-to-server admin) by marking every active refresh token revoked, so the next refresh on any device returns `401` and the user must sign in again. In-flight access tokens remain valid until their short TTL lapses. Idempotent — revoking when no tokens are active is a no-op. Audits twice: `identity.sessions.admin_revoked` for the identity's own security log, and `session.all_revoked`, the subscribable webhook event, so a revoke made here reaches subscribers exactly as one made from the Console does. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
634
634
  */
635
635
  post: operations["ApiIdentitiesController_revokeIdentitySessions"];
636
636
  delete?: never;
@@ -1084,13 +1084,13 @@ interface paths {
1084
1084
  };
1085
1085
  /**
1086
1086
  * List organizations
1087
- * @description Lists the Environment's organizations with `member_count` and `pending_invite_count` per row, paginated and searchable by name or slug (`q`). Empty while the Environment has organizations disabled. Requires the `hierarchy.view` permission.
1087
+ * @description Lists the Environment's organizations with `member_count` and `pending_invite_count` per row, paginated and searchable by name or slug (`q`), or looked up exactly by your own id (`external_id`). Empty while the Environment has organizations disabled. Requires the `hierarchy.view` permission.
1088
1088
  */
1089
1089
  get: operations["ApiOrganizationsController_listOrganizations"];
1090
1090
  put?: never;
1091
1091
  /**
1092
1092
  * Create an organization
1093
- * @description Creates an organization from a `name` (slug auto-derived, display-only) with optional `description` and `metadata`. The Environment must have organizations enabled (`409 organization.not_enabled` otherwise); the container is independent of the access model, so flat and hierarchy Environments both hold organizations. Requires the `hierarchy.manage` permission and emits `organization.created`.
1093
+ * @description Creates an organization from a `name` (slug auto-derived, display-only) with optional `description`, `metadata`, and `external_id` (your own id for it, unique per Environment; a repeat answers `409 organization.external_id_conflict`, so create-then-store is idempotent). The Environment must have organizations enabled (`409 organization.not_enabled` otherwise); the container is independent of the access model, so flat and hierarchy Environments both hold organizations. Requires the `hierarchy.manage` permission and emits `organization.created`.
1094
1094
  */
1095
1095
  post: operations["ApiOrganizationsController_createOrganization"];
1096
1096
  /**
@@ -1126,7 +1126,7 @@ interface paths {
1126
1126
  head?: never;
1127
1127
  /**
1128
1128
  * Update an organization
1129
- * @description Updates an organization's `name`, `description`, and/or `metadata` by `id`. The slug is frozen at create and never changes. Supports optimistic concurrency via the `If-Match` header carrying the organization's current version (`409` on a version mismatch). Requires the `hierarchy.manage` permission at the organization and emits `organization.updated`.
1129
+ * @description Updates an organization's `name`, `description`, `metadata`, and/or `external_id` (`null` clears it; a value already used by another organization in the Environment answers `409 organization.external_id_conflict`) by `id`. The slug is frozen at create and never changes. Supports optimistic concurrency via the `If-Match` header carrying the organization's current version (`409` on a version mismatch). Requires the `hierarchy.manage` permission at the organization and emits `organization.updated`.
1130
1130
  */
1131
1131
  patch: operations["ApiOrganizationsController_updateOrganization"];
1132
1132
  trace?: never;
@@ -1170,7 +1170,7 @@ interface paths {
1170
1170
  put?: never;
1171
1171
  /**
1172
1172
  * Bind an SSO connection to an organization
1173
- * @description Binds an `end_user` SSO connection to the organization: a login through the connection lands in this organization, joining as a member with `default_role_id` when the identity is provisioned or is not yet a member, and the session starts here. The connection must already be bound to the organization's Environment (that binding routes the email domain), and the role must belong to the Environment (`400` otherwise). A connection binds to one organization per Environment (`409`). Requires the `hierarchy.manage` permission at the organization and emits `organization.sso_connection.bound`.
1173
+ * @description Binds an `end_user` SSO connection to the organization: a login through the connection lands in this organization, joining as a member with `default_role_id` when the identity is provisioned or is not yet a member, and the session starts here. The connection must already be bound to the organization's Environment (that binding routes the email domain), and the role must be an active, non-system role of the Environment (`400` otherwise: `rbac.role_inactive` or `rbac.role_system_not_assignable`). A connection binds to one organization per Environment (`409`). Requires the `hierarchy.manage` permission at the organization and emits `organization.sso_connection.bound`.
1174
1174
  */
1175
1175
  post: operations["ApiOrganizationsController_bindSsoConnection"];
1176
1176
  delete?: never;
@@ -2372,6 +2372,8 @@ interface components {
2372
2372
  /** @description Display label derived from the name at create; frozen afterwards. Organizations are addressed by `id`. */
2373
2373
  slug: string;
2374
2374
  metadata: Record<string, unknown>;
2375
+ /** @description Your own id for this organization, unique per Environment. */
2376
+ external_id?: string | null;
2375
2377
  /** @description Members (one role each) in this organization. */
2376
2378
  member_count: number;
2377
2379
  /** @description Unexpired, unaccepted, unrevoked invitations. */
@@ -2390,6 +2392,8 @@ interface components {
2390
2392
  description?: string;
2391
2393
  /** @description Free-form metadata stored on the organization, returned as sent. */
2392
2394
  metadata?: Record<string, unknown>;
2395
+ /** @description Your own id for this organization (the account id in your database), unique per Environment. Look the organization up with `GET /api/v1/organizations?external_id=...`; a second create with the same value answers 409, so create-then-store is idempotent. */
2396
+ external_id?: string;
2393
2397
  };
2394
2398
  UpdateOrganizationDto: {
2395
2399
  /** @description New organization name. The slug does not change. */
@@ -2398,6 +2402,8 @@ interface components {
2398
2402
  description?: string;
2399
2403
  /** @description Free-form metadata stored on the organization, returned as sent. */
2400
2404
  metadata?: Record<string, unknown>;
2405
+ /** @description Your own id for this organization, unique per Environment. `null` clears it. */
2406
+ external_id?: string | null;
2401
2407
  };
2402
2408
  EffectiveOrganizationPolicyDto: {
2403
2409
  mfa_required: boolean;
@@ -2845,6 +2851,11 @@ interface components {
2845
2851
  };
2846
2852
  WebhookEventTypeDto: {
2847
2853
  event_type: string;
2854
+ /**
2855
+ * @description The subscription scope that takes this event. The public API lists both: everything an environment subscription accepts, then the account-only events, which need an account-scoped subscription from the Console or the portal API.
2856
+ * @enum {string}
2857
+ */
2858
+ scope: "environment" | "account";
2848
2859
  category: string;
2849
2860
  description: string;
2850
2861
  };
@@ -7171,6 +7182,8 @@ interface operations {
7171
7182
  sort_by?: string;
7172
7183
  /** @description Sort direction */
7173
7184
  order?: "asc" | "desc";
7185
+ /** @description Exact match on the organization's `external_id` (your own id for it). Answers one organization or none. */
7186
+ external_id?: string;
7174
7187
  };
7175
7188
  header?: never;
7176
7189
  path?: never;
@@ -8031,7 +8044,7 @@ interface operations {
8031
8044
  };
8032
8045
  };
8033
8046
  };
8034
- /** @description The connection is not an end-user connection bound to the organization's Environment, or the role is not in that Environment */
8047
+ /** @description The connection is not an end-user connection bound to the organization's Environment, or the role is not an active, assignable role in that Environment */
8035
8048
  400: {
8036
8049
  headers: {
8037
8050
  [name: string]: unknown;
@@ -8042,7 +8055,7 @@ interface operations {
8042
8055
  * "error": {
8043
8056
  * "statusCode": 400,
8044
8057
  * "code": null,
8045
- * "message": "The connection is not an end-user connection bound to the organization's Environment, or the role is not in that Environment",
8058
+ * "message": "The connection is not an end-user connection bound to the organization's Environment, or the role is not an active, assignable role in that Environment",
8046
8059
  * "timestamp": "2026-04-20T12:00:00.000Z",
8047
8060
  * "path": "/api/v1/organizations/{id}/sso-connections",
8048
8061
  * "method": "POST"
package/dist/index.d.ts CHANGED
@@ -514,7 +514,7 @@ interface paths {
514
514
  head?: never;
515
515
  /**
516
516
  * Update an identity
517
- * @description Updates an identity's mutable profile fields (`first_name`, `last_name`, `is_active`, `metadata`) in the current Environment. `email` and `external_id` are immutable here — `external_id` is owned by the SSO/SCIM provisioning path and cannot be re-pointed through this endpoint. Returns the updated identity and writes an `identity.updated` audit row; returns `404` when the identity has no membership in this Environment.
517
+ * @description Updates an identity's mutable profile fields (`first_name`, `last_name`, `is_active`, `metadata`) in the current Environment. `email` and `external_id` are immutable here — `external_id` is owned by the SSO/SCIM provisioning path and cannot be re-pointed through this endpoint. Returns the updated identity and writes an `identity.updated` audit row for the profile fields; a change to `is_active` writes `identity.status_set` instead, the account-wide activation switch. Returns `404` when the identity has no membership in this Environment.
518
518
  */
519
519
  patch: operations["ApiIdentitiesController_updateIdentity"];
520
520
  trace?: never;
@@ -550,7 +550,7 @@ interface paths {
550
550
  put?: never;
551
551
  /**
552
552
  * Activate an identity
553
- * @description Reactivates an identity by setting `is_active = true` in the current Environment, allowing it to authenticate again. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
553
+ * @description Reactivates an identity by setting `is_active = true`, the account-wide switch, allowing it to authenticate again in every Environment it belongs to. Writes an `identity.status_set` audit row (the same event the Console's account route emits), delivered to the account's subscriptions and to those of every Environment the identity is a member of. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
554
554
  */
555
555
  post: operations["ApiIdentitiesController_activateIdentity"];
556
556
  delete?: never;
@@ -570,7 +570,7 @@ interface paths {
570
570
  put?: never;
571
571
  /**
572
572
  * Deactivate an identity
573
- * @description Deactivates an identity by setting `is_active = false` in the current Environment, blocking future sign-in. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
573
+ * @description Deactivates an identity by setting `is_active = false`, the account-wide switch, blocking future sign-in in every Environment it belongs to. Writes an `identity.status_set` audit row (the same event the Console's account route emits), delivered to the account's subscriptions and to those of every Environment the identity is a member of. Returns a `200` message envelope. Returns `404` when the identity has no membership in this Environment.
574
574
  */
575
575
  post: operations["ApiIdentitiesController_deactivateIdentity"];
576
576
  delete?: never;
@@ -630,7 +630,7 @@ interface paths {
630
630
  put?: never;
631
631
  /**
632
632
  * Revoke all of an identity's sessions (admin)
633
- * @description Revokes all of an identity's sessions (server-to-server admin) by marking every active refresh token revoked, so the next refresh on any device returns `401` and the user must sign in again. In-flight access tokens remain valid until their short TTL lapses. Idempotent — revoking when no tokens are active is a no-op. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
633
+ * @description Revokes all of an identity's sessions (server-to-server admin) by marking every active refresh token revoked, so the next refresh on any device returns `401` and the user must sign in again. In-flight access tokens remain valid until their short TTL lapses. Idempotent — revoking when no tokens are active is a no-op. Audits twice: `identity.sessions.admin_revoked` for the identity's own security log, and `session.all_revoked`, the subscribable webhook event, so a revoke made here reaches subscribers exactly as one made from the Console does. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
634
634
  */
635
635
  post: operations["ApiIdentitiesController_revokeIdentitySessions"];
636
636
  delete?: never;
@@ -1084,13 +1084,13 @@ interface paths {
1084
1084
  };
1085
1085
  /**
1086
1086
  * List organizations
1087
- * @description Lists the Environment's organizations with `member_count` and `pending_invite_count` per row, paginated and searchable by name or slug (`q`). Empty while the Environment has organizations disabled. Requires the `hierarchy.view` permission.
1087
+ * @description Lists the Environment's organizations with `member_count` and `pending_invite_count` per row, paginated and searchable by name or slug (`q`), or looked up exactly by your own id (`external_id`). Empty while the Environment has organizations disabled. Requires the `hierarchy.view` permission.
1088
1088
  */
1089
1089
  get: operations["ApiOrganizationsController_listOrganizations"];
1090
1090
  put?: never;
1091
1091
  /**
1092
1092
  * Create an organization
1093
- * @description Creates an organization from a `name` (slug auto-derived, display-only) with optional `description` and `metadata`. The Environment must have organizations enabled (`409 organization.not_enabled` otherwise); the container is independent of the access model, so flat and hierarchy Environments both hold organizations. Requires the `hierarchy.manage` permission and emits `organization.created`.
1093
+ * @description Creates an organization from a `name` (slug auto-derived, display-only) with optional `description`, `metadata`, and `external_id` (your own id for it, unique per Environment; a repeat answers `409 organization.external_id_conflict`, so create-then-store is idempotent). The Environment must have organizations enabled (`409 organization.not_enabled` otherwise); the container is independent of the access model, so flat and hierarchy Environments both hold organizations. Requires the `hierarchy.manage` permission and emits `organization.created`.
1094
1094
  */
1095
1095
  post: operations["ApiOrganizationsController_createOrganization"];
1096
1096
  /**
@@ -1126,7 +1126,7 @@ interface paths {
1126
1126
  head?: never;
1127
1127
  /**
1128
1128
  * Update an organization
1129
- * @description Updates an organization's `name`, `description`, and/or `metadata` by `id`. The slug is frozen at create and never changes. Supports optimistic concurrency via the `If-Match` header carrying the organization's current version (`409` on a version mismatch). Requires the `hierarchy.manage` permission at the organization and emits `organization.updated`.
1129
+ * @description Updates an organization's `name`, `description`, `metadata`, and/or `external_id` (`null` clears it; a value already used by another organization in the Environment answers `409 organization.external_id_conflict`) by `id`. The slug is frozen at create and never changes. Supports optimistic concurrency via the `If-Match` header carrying the organization's current version (`409` on a version mismatch). Requires the `hierarchy.manage` permission at the organization and emits `organization.updated`.
1130
1130
  */
1131
1131
  patch: operations["ApiOrganizationsController_updateOrganization"];
1132
1132
  trace?: never;
@@ -1170,7 +1170,7 @@ interface paths {
1170
1170
  put?: never;
1171
1171
  /**
1172
1172
  * Bind an SSO connection to an organization
1173
- * @description Binds an `end_user` SSO connection to the organization: a login through the connection lands in this organization, joining as a member with `default_role_id` when the identity is provisioned or is not yet a member, and the session starts here. The connection must already be bound to the organization's Environment (that binding routes the email domain), and the role must belong to the Environment (`400` otherwise). A connection binds to one organization per Environment (`409`). Requires the `hierarchy.manage` permission at the organization and emits `organization.sso_connection.bound`.
1173
+ * @description Binds an `end_user` SSO connection to the organization: a login through the connection lands in this organization, joining as a member with `default_role_id` when the identity is provisioned or is not yet a member, and the session starts here. The connection must already be bound to the organization's Environment (that binding routes the email domain), and the role must be an active, non-system role of the Environment (`400` otherwise: `rbac.role_inactive` or `rbac.role_system_not_assignable`). A connection binds to one organization per Environment (`409`). Requires the `hierarchy.manage` permission at the organization and emits `organization.sso_connection.bound`.
1174
1174
  */
1175
1175
  post: operations["ApiOrganizationsController_bindSsoConnection"];
1176
1176
  delete?: never;
@@ -2372,6 +2372,8 @@ interface components {
2372
2372
  /** @description Display label derived from the name at create; frozen afterwards. Organizations are addressed by `id`. */
2373
2373
  slug: string;
2374
2374
  metadata: Record<string, unknown>;
2375
+ /** @description Your own id for this organization, unique per Environment. */
2376
+ external_id?: string | null;
2375
2377
  /** @description Members (one role each) in this organization. */
2376
2378
  member_count: number;
2377
2379
  /** @description Unexpired, unaccepted, unrevoked invitations. */
@@ -2390,6 +2392,8 @@ interface components {
2390
2392
  description?: string;
2391
2393
  /** @description Free-form metadata stored on the organization, returned as sent. */
2392
2394
  metadata?: Record<string, unknown>;
2395
+ /** @description Your own id for this organization (the account id in your database), unique per Environment. Look the organization up with `GET /api/v1/organizations?external_id=...`; a second create with the same value answers 409, so create-then-store is idempotent. */
2396
+ external_id?: string;
2393
2397
  };
2394
2398
  UpdateOrganizationDto: {
2395
2399
  /** @description New organization name. The slug does not change. */
@@ -2398,6 +2402,8 @@ interface components {
2398
2402
  description?: string;
2399
2403
  /** @description Free-form metadata stored on the organization, returned as sent. */
2400
2404
  metadata?: Record<string, unknown>;
2405
+ /** @description Your own id for this organization, unique per Environment. `null` clears it. */
2406
+ external_id?: string | null;
2401
2407
  };
2402
2408
  EffectiveOrganizationPolicyDto: {
2403
2409
  mfa_required: boolean;
@@ -2845,6 +2851,11 @@ interface components {
2845
2851
  };
2846
2852
  WebhookEventTypeDto: {
2847
2853
  event_type: string;
2854
+ /**
2855
+ * @description The subscription scope that takes this event. The public API lists both: everything an environment subscription accepts, then the account-only events, which need an account-scoped subscription from the Console or the portal API.
2856
+ * @enum {string}
2857
+ */
2858
+ scope: "environment" | "account";
2848
2859
  category: string;
2849
2860
  description: string;
2850
2861
  };
@@ -7171,6 +7182,8 @@ interface operations {
7171
7182
  sort_by?: string;
7172
7183
  /** @description Sort direction */
7173
7184
  order?: "asc" | "desc";
7185
+ /** @description Exact match on the organization's `external_id` (your own id for it). Answers one organization or none. */
7186
+ external_id?: string;
7174
7187
  };
7175
7188
  header?: never;
7176
7189
  path?: never;
@@ -8031,7 +8044,7 @@ interface operations {
8031
8044
  };
8032
8045
  };
8033
8046
  };
8034
- /** @description The connection is not an end-user connection bound to the organization's Environment, or the role is not in that Environment */
8047
+ /** @description The connection is not an end-user connection bound to the organization's Environment, or the role is not an active, assignable role in that Environment */
8035
8048
  400: {
8036
8049
  headers: {
8037
8050
  [name: string]: unknown;
@@ -8042,7 +8055,7 @@ interface operations {
8042
8055
  * "error": {
8043
8056
  * "statusCode": 400,
8044
8057
  * "code": null,
8045
- * "message": "The connection is not an end-user connection bound to the organization's Environment, or the role is not in that Environment",
8058
+ * "message": "The connection is not an end-user connection bound to the organization's Environment, or the role is not an active, assignable role in that Environment",
8046
8059
  * "timestamp": "2026-04-20T12:00:00.000Z",
8047
8060
  * "path": "/api/v1/organizations/{id}/sso-connections",
8048
8061
  * "method": "POST"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-io/node",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Official TypeScript SDK for Canopy — hierarchical identity and access management.",
5
5
  "license": "MIT",
6
6
  "author": "Canopy Identity Inc.",