@iveri/contracts 0.135.0 → 0.136.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 +3 -0
- package/dist/api/identity/auth.type.d.ts +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -308,6 +308,9 @@ Conduit's outbox.
|
|
|
308
308
|
- Version `0.135.0` adds `conduit:dispatch:send-any` and `unibox:realtime:publish-any`, and an optional `tenantId` on
|
|
309
309
|
`SubmitDispatchBody` and `PublishConversationEventBody`, so Unibox sends replies and inbox hints for the company a
|
|
310
310
|
request names.
|
|
311
|
+
- Version `0.136.0` adds `Principal.emailVerifiedAt` (required, null until the address is confirmed) and the email
|
|
312
|
+
confirmation bodies `RegisterShopperBody`, `RequestEmailConfirmationBody` and `ConfirmEmailBody` under
|
|
313
|
+
`@iveri/contracts/identity`.
|
|
311
314
|
- Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
|
|
312
315
|
and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
|
|
313
316
|
- Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UserPermission } from '../../enum/user-permission.enum.js';
|
|
2
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
3
|
import type { Nullable } from '../../type/nil.type.js';
|
|
3
4
|
import type { UUID } from '../../type/uuid.type.js';
|
|
4
5
|
import type { MembershipStatus } from './membership-status.enum.js';
|
|
@@ -25,6 +26,42 @@ export interface LoginBody {
|
|
|
25
26
|
email: string;
|
|
26
27
|
password: string;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* `POST /auth/register` — somebody creates their own account in a company that opened registration (a shopper, a
|
|
31
|
+
* diner). There is deliberately no role field: the request cannot name one.
|
|
32
|
+
*
|
|
33
|
+
* Registering emails a link that confirms the address, in `localeCode`'s language. Until it is used the address is an
|
|
34
|
+
* identifier and not a proven contact: see {@link Principal.emailVerifiedAt}.
|
|
35
|
+
*/
|
|
36
|
+
export interface RegisterShopperBody {
|
|
37
|
+
tenantSlug: string;
|
|
38
|
+
email: string;
|
|
39
|
+
password: string;
|
|
40
|
+
firstName: string;
|
|
41
|
+
lastName: string;
|
|
42
|
+
/** The language of the confirmation email. Unset falls back to the workspace's source locale. */
|
|
43
|
+
localeCode?: Nullable<string>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `POST /auth/me/email-confirmation` — the signed-in person asks for a new confirmation link for their own address.
|
|
47
|
+
* Answered 202 with no body. A spent or expired link is replaced by asking here; a newer link spends the older ones.
|
|
48
|
+
* Asking when the address is already confirmed sends nothing and still answers 202.
|
|
49
|
+
*/
|
|
50
|
+
export interface RequestEmailConfirmationBody {
|
|
51
|
+
/** The language of the email. Unset falls back to the workspace's source locale. */
|
|
52
|
+
localeCode?: Nullable<string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `POST /auth/email-confirmation/confirm` — confirm an address from the emailed link. Public: the link may be opened
|
|
56
|
+
* on another device, signed out. Answered 204. Every bad link (unknown, spent by a newer one, expired, or for an
|
|
57
|
+
* address the account no longer has) is one 401, except a link whose address is already confirmed, which answers
|
|
58
|
+
* 204 again, so pressing the link twice is not an error.
|
|
59
|
+
*/
|
|
60
|
+
export interface ConfirmEmailBody {
|
|
61
|
+
/** The workspace the link names. Resolves the tenant before the token is looked up within it. */
|
|
62
|
+
tenantSlug: string;
|
|
63
|
+
confirmationToken: string;
|
|
64
|
+
}
|
|
28
65
|
/** `POST /auth/refresh` and `POST /auth/logout`. */
|
|
29
66
|
export interface RefreshTokenBody {
|
|
30
67
|
refreshToken: string;
|
|
@@ -108,6 +145,16 @@ export interface Principal {
|
|
|
108
145
|
/** Null for an API-key principal. */
|
|
109
146
|
userId: Nullable<UUID>;
|
|
110
147
|
email: Nullable<string>;
|
|
148
|
+
/**
|
|
149
|
+
* When the person proved they receive mail at {@link email}, or null while they have not (and for an API key).
|
|
150
|
+
*
|
|
151
|
+
* Set by using an emailed confirmation link, by accepting an invitation (somebody in the company typed the address,
|
|
152
|
+
* and the person holds the link), and by completing an emailed password reset. **Until it is set the address is an
|
|
153
|
+
* identifier, not a contact**: anybody may register with an address that is not theirs, so nothing may send an
|
|
154
|
+
* order confirmation, a receipt or anything else personal to it. Read from the database on every `GET /auth/me`,
|
|
155
|
+
* so it changes without signing in again; the copy inside a session is as of when it was issued.
|
|
156
|
+
*/
|
|
157
|
+
emailVerifiedAt: Nullable<IsoDateTime>;
|
|
111
158
|
firstName: Nullable<string>;
|
|
112
159
|
lastName: Nullable<string>;
|
|
113
160
|
/**
|