@iveri/contracts 0.139.0 → 0.140.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/README.md CHANGED
@@ -319,6 +319,8 @@ Conduit's outbox.
319
319
  `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
320
320
  - Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
321
321
  `GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
322
+ - Version `0.140.0` adds `DeleteOwnAccountBody` and the `IdentityRefusal` enum (`password-incorrect`,
323
+ `not-self-registered`) under `@iveri/contracts/identity`, for deleting one's own account at `DELETE /auth/me`.
322
324
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
323
325
  and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
324
326
  - Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
@@ -212,6 +212,17 @@ export interface UpdateProfileBody {
212
212
  lastName?: string;
213
213
  phone?: Nullable<string>;
214
214
  }
215
+ /**
216
+ * `DELETE /auth/me` — a person deletes the account they made for themselves (a shopper, a diner, a gym member).
217
+ *
218
+ * The current password is asked again, so a stolen access token cannot delete an account. Answered 204: the person is
219
+ * removed from the company and everything identifying them is erased, exactly as when a company removes somebody. Only
220
+ * an account made through `POST /auth/register` that holds nothing beyond that may be deleted this way; anybody else is
221
+ * refused with `IdentityRefusal.NOT_SELF_REGISTERED` and is removed by their company.
222
+ */
223
+ export interface DeleteOwnAccountBody {
224
+ password: string;
225
+ }
215
226
  /**
216
227
  * What one person may see about another. Returned by `GET /users/:userId/profile` behind
217
228
  * {@link UserPermission.PROFILE_READ}.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * An identity refusal a person can act on, sent as `details.reason` so an app says it in the reader's language rather
3
+ * than showing the API's English.
4
+ */
5
+ export declare enum IdentityRefusal {
6
+ /**
7
+ * `DELETE /auth/me`: the password given does not open this account, so nothing was deleted. Answered 403, never
8
+ * 401: a 401 tells a client its session has run out, and it would refresh and sign the person out for a typing
9
+ * mistake.
10
+ */
11
+ PASSWORD_INCORRECT = "password-incorrect",
12
+ /**
13
+ * `DELETE /auth/me`: the account is more than one the person made for themselves (staff of the company, an owner, or
14
+ * a self-registered account the company has since given a role), so only the company can remove it.
15
+ */
16
+ NOT_SELF_REGISTERED = "not-self-registered"
17
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * An identity refusal a person can act on, sent as `details.reason` so an app says it in the reader's language rather
3
+ * than showing the API's English.
4
+ */
5
+ export var IdentityRefusal;
6
+ (function (IdentityRefusal) {
7
+ /**
8
+ * `DELETE /auth/me`: the password given does not open this account, so nothing was deleted. Answered 403, never
9
+ * 401: a 401 tells a client its session has run out, and it would refresh and sign the person out for a typing
10
+ * mistake.
11
+ */
12
+ IdentityRefusal["PASSWORD_INCORRECT"] = "password-incorrect";
13
+ /**
14
+ * `DELETE /auth/me`: the account is more than one the person made for themselves (staff of the company, an owner, or
15
+ * a self-registered account the company has since given a role), so only the company can remove it.
16
+ */
17
+ IdentityRefusal["NOT_SELF_REGISTERED"] = "not-self-registered";
18
+ })(IdentityRefusal || (IdentityRefusal = {}));
@@ -1,5 +1,6 @@
1
1
  export * from './access-token-payload.interface.js';
2
2
  export * from './auth.type.js';
3
+ export * from './identity-refusal.enum.js';
3
4
  export * from './membership-status.enum.js';
4
5
  export * from './principal-type.enum.js';
5
6
  export * from './tenant-status.enum.js';
@@ -1,5 +1,6 @@
1
1
  export * from './access-token-payload.interface.js';
2
2
  export * from './auth.type.js';
3
+ export * from './identity-refusal.enum.js';
3
4
  export * from './membership-status.enum.js';
4
5
  export * from './principal-type.enum.js';
5
6
  export * from './tenant-status.enum.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.139.0",
3
+ "version": "0.140.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {