@idp.global/interfaces 9.1.0 → 9.2.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/changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-07-08 - 9.2.0
4
+
5
+ ### Features
6
+
7
+ - add account deletion and org export contracts (governance)
8
+ - IReq_DeleteAccount: self-service deletion with re-authentication (password, or confirmEmail for passwordless accounts), 7-day grace window before purge; org ownership blocks deletion
9
+ - IReq_DeleteSuspendedUser: immediate admin purge of suspended accounts
10
+ - IReq_ExportOrgData: owner-only cursor-paged export streaming redacted DTOs (TOrgExportRecord union)
11
+ - IUser gains optional deletion {requestedAt, purgeAt}; TActivityAction gains account_deletion_requested/account_deletion_cancelled/account_purged
12
+
3
13
  ## 2026-07-08 - 9.1.0
4
14
 
5
15
  ### Features
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '9.1.0',
6
+ version: '9.2.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
@@ -1,4 +1,4 @@
1
- export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed';
1
+ export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed';
2
2
  export interface IActivityLog {
3
3
  id: string;
4
4
  data: {
@@ -22,6 +22,15 @@ export interface IUser {
22
22
  * field existed (derive from the Mongo ObjectId timestamp when missing)
23
23
  */
24
24
  createdAt?: number;
25
+ /**
26
+ * present while an account deletion is pending: the account is locked
27
+ * (status 'deleted') and housekeeping purges it after purgeAt.
28
+ * A global admin can cancel by reactivating the account within the window.
29
+ */
30
+ deletion?: {
31
+ requestedAt: number;
32
+ purgeAt: number;
33
+ };
25
34
  /**
26
35
  * a quick ref for which organizations might have roles for this user
27
36
  * speeds up lookup
@@ -94,3 +94,50 @@ export interface IReq_DeleteOrgRoleDefinition extends plugins.typedRequestInterf
94
94
  message?: string;
95
95
  };
96
96
  }
97
+ /**
98
+ * One typed record of an organization data export.
99
+ */
100
+ export type TOrgExportRecord = {
101
+ kind: 'organization';
102
+ payload: dto.IOrganizationDto;
103
+ } | {
104
+ kind: 'member';
105
+ payload: {
106
+ user: dto.IUserProfileDto;
107
+ roles: string[];
108
+ };
109
+ } | {
110
+ kind: 'invitation';
111
+ payload: dto.IUserInvitationDto;
112
+ } | {
113
+ kind: 'ssoConnection';
114
+ payload: dto.ISsoConnectionDto;
115
+ } | {
116
+ kind: 'scimToken';
117
+ payload: dto.IScimTokenDto;
118
+ } | {
119
+ kind: 'activity';
120
+ payload: dto.IActivityEventDto;
121
+ };
122
+ /**
123
+ * Cursor-paged export of an organization's data (data portability /
124
+ * compliance evidence). Owner-only. Streams redacted DTOs — never token
125
+ * hashes, certificates' private material, or member credentials. Iterate
126
+ * until nextCursor is absent.
127
+ */
128
+ export interface IReq_ExportOrgData extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_ExportOrgData> {
129
+ method: 'exportOrgData';
130
+ request: {
131
+ jwt: string;
132
+ organizationId: string;
133
+ /** opaque cursor from the previous page */
134
+ cursor?: string;
135
+ /** page size, capped server-side */
136
+ limit?: number;
137
+ };
138
+ response: {
139
+ records: TOrgExportRecord[];
140
+ /** absent when the export is complete */
141
+ nextCursor?: string;
142
+ };
143
+ }
@@ -77,6 +77,44 @@ export interface IReq_GetUserActivity extends plugins.typedRequestInterfaces.imp
77
77
  total: number;
78
78
  };
79
79
  }
80
+ /**
81
+ * Self-service account deletion. Requires re-authentication: the account
82
+ * password when one is set (SSO/passkey-only accounts pass confirmEmail
83
+ * instead). Owning any organization blocks deletion until ownership is
84
+ * transferred or the organization is deleted. On success the account is
85
+ * locked immediately (all sessions and JWTs revoked, sign-in rejected) and
86
+ * purged after a 7-day grace window; a global admin can cancel within the
87
+ * window by reactivating the account.
88
+ */
89
+ export interface IReq_DeleteAccount extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_DeleteAccount> {
90
+ method: 'deleteAccount';
91
+ request: {
92
+ jwt: string;
93
+ /** required when the account has a password */
94
+ password?: string;
95
+ /** required when the account has no password: must equal the account email */
96
+ confirmEmail?: string;
97
+ };
98
+ response: {
99
+ success: boolean;
100
+ /** epoch ms when the account will be purged */
101
+ purgeAt: number;
102
+ };
103
+ }
104
+ /**
105
+ * Immediate, irreversible purge of a suspended account (global admin only).
106
+ * The target must currently be suspended or in a pending-deletion state.
107
+ */
108
+ export interface IReq_DeleteSuspendedUser extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_DeleteSuspendedUser> {
109
+ method: 'deleteSuspendedUser';
110
+ request: {
111
+ jwt: string;
112
+ userId: string;
113
+ };
114
+ response: {
115
+ success: boolean;
116
+ };
117
+ }
80
118
  /**
81
119
  * Cursor-paged export of the authenticated user's full activity trail
82
120
  * (SOC2 audit evidence / data portability). Iterate until nextCursor is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idp.global/interfaces",
3
- "version": "9.1.0",
3
+ "version": "9.2.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.",
6
6
  "exports": {
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '9.1.0',
6
+ version: '9.2.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  }
@@ -27,6 +27,9 @@ export type TActivityAction =
27
27
  | 'app_disconnected'
28
28
  | 'user_suspended'
29
29
  | 'user_unsuspended'
30
+ | 'account_deletion_requested'
31
+ | 'account_deletion_cancelled'
32
+ | 'account_purged'
30
33
  | 'sso_connection_created'
31
34
  | 'sso_connection_updated'
32
35
  | 'sso_connection_deleted'
package/ts/data/user.ts CHANGED
@@ -26,6 +26,15 @@ export interface IUser {
26
26
  * field existed (derive from the Mongo ObjectId timestamp when missing)
27
27
  */
28
28
  createdAt?: number;
29
+ /**
30
+ * present while an account deletion is pending: the account is locked
31
+ * (status 'deleted') and housekeeping purges it after purgeAt.
32
+ * A global admin can cancel by reactivating the account within the window.
33
+ */
34
+ deletion?: {
35
+ requestedAt: number;
36
+ purgeAt: number;
37
+ };
29
38
  /**
30
39
  * a quick ref for which organizations might have roles for this user
31
40
  * speeds up lookup
@@ -130,3 +130,41 @@ export interface IReq_DeleteOrgRoleDefinition
130
130
  message?: string;
131
131
  };
132
132
  }
133
+
134
+ /**
135
+ * One typed record of an organization data export.
136
+ */
137
+ export type TOrgExportRecord =
138
+ | { kind: 'organization'; payload: dto.IOrganizationDto }
139
+ | { kind: 'member'; payload: { user: dto.IUserProfileDto; roles: string[] } }
140
+ | { kind: 'invitation'; payload: dto.IUserInvitationDto }
141
+ | { kind: 'ssoConnection'; payload: dto.ISsoConnectionDto }
142
+ | { kind: 'scimToken'; payload: dto.IScimTokenDto }
143
+ | { kind: 'activity'; payload: dto.IActivityEventDto };
144
+
145
+ /**
146
+ * Cursor-paged export of an organization's data (data portability /
147
+ * compliance evidence). Owner-only. Streams redacted DTOs — never token
148
+ * hashes, certificates' private material, or member credentials. Iterate
149
+ * until nextCursor is absent.
150
+ */
151
+ export interface IReq_ExportOrgData
152
+ extends plugins.typedRequestInterfaces.implementsTR<
153
+ plugins.typedRequestInterfaces.ITypedRequest,
154
+ IReq_ExportOrgData
155
+ > {
156
+ method: 'exportOrgData';
157
+ request: {
158
+ jwt: string;
159
+ organizationId: string;
160
+ /** opaque cursor from the previous page */
161
+ cursor?: string;
162
+ /** page size, capped server-side */
163
+ limit?: number;
164
+ };
165
+ response: {
166
+ records: TOrgExportRecord[];
167
+ /** absent when the export is complete */
168
+ nextCursor?: string;
169
+ };
170
+ }
@@ -109,6 +109,54 @@ export interface IReq_GetUserActivity
109
109
  };
110
110
  }
111
111
 
112
+ /**
113
+ * Self-service account deletion. Requires re-authentication: the account
114
+ * password when one is set (SSO/passkey-only accounts pass confirmEmail
115
+ * instead). Owning any organization blocks deletion until ownership is
116
+ * transferred or the organization is deleted. On success the account is
117
+ * locked immediately (all sessions and JWTs revoked, sign-in rejected) and
118
+ * purged after a 7-day grace window; a global admin can cancel within the
119
+ * window by reactivating the account.
120
+ */
121
+ export interface IReq_DeleteAccount
122
+ extends plugins.typedRequestInterfaces.implementsTR<
123
+ plugins.typedRequestInterfaces.ITypedRequest,
124
+ IReq_DeleteAccount
125
+ > {
126
+ method: 'deleteAccount';
127
+ request: {
128
+ jwt: string;
129
+ /** required when the account has a password */
130
+ password?: string;
131
+ /** required when the account has no password: must equal the account email */
132
+ confirmEmail?: string;
133
+ };
134
+ response: {
135
+ success: boolean;
136
+ /** epoch ms when the account will be purged */
137
+ purgeAt: number;
138
+ };
139
+ }
140
+
141
+ /**
142
+ * Immediate, irreversible purge of a suspended account (global admin only).
143
+ * The target must currently be suspended or in a pending-deletion state.
144
+ */
145
+ export interface IReq_DeleteSuspendedUser
146
+ extends plugins.typedRequestInterfaces.implementsTR<
147
+ plugins.typedRequestInterfaces.ITypedRequest,
148
+ IReq_DeleteSuspendedUser
149
+ > {
150
+ method: 'deleteSuspendedUser';
151
+ request: {
152
+ jwt: string;
153
+ userId: string;
154
+ };
155
+ response: {
156
+ success: boolean;
157
+ };
158
+ }
159
+
112
160
  /**
113
161
  * Cursor-paged export of the authenticated user's full activity trail
114
162
  * (SOC2 audit evidence / data portability). Iterate until nextCursor is