@iveri/contracts 0.134.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
CHANGED
|
@@ -305,6 +305,12 @@ Conduit's outbox.
|
|
|
305
305
|
`localization:render` permissions.
|
|
306
306
|
- Version `0.100.0` adds `notification:send-any`, the password-reset bodies and Conduit's usage metrics.
|
|
307
307
|
- Version `0.101.0` adds `UsageHistory`, a company's closed months of a product by metric.
|
|
308
|
+
- Version `0.135.0` adds `conduit:dispatch:send-any` and `unibox:realtime:publish-any`, and an optional `tenantId` on
|
|
309
|
+
`SubmitDispatchBody` and `PublishConversationEventBody`, so Unibox sends replies and inbox hints for the company a
|
|
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`.
|
|
308
314
|
- Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
|
|
309
315
|
and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
|
|
310
316
|
- Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
|
|
@@ -117,6 +117,12 @@ export interface GetDispatchesQuery {
|
|
|
117
117
|
* target. Accepting a URL would make this an authenticated open proxy sitting inside our network.
|
|
118
118
|
*/
|
|
119
119
|
export interface SubmitDispatchBody {
|
|
120
|
+
/**
|
|
121
|
+
* The company to send for, when it is not the token's own. Accepted only from a token holding
|
|
122
|
+
* `conduit:dispatch:send-any` issued in Iveri's operator workspace; anything else naming one is a 403. The connection
|
|
123
|
+
* is looked up in the company named, so a dispatch can only ever leave through that company's own connections.
|
|
124
|
+
*/
|
|
125
|
+
tenantId?: UUID;
|
|
120
126
|
/** Which connection to send through, by its tenant-scoped key. */
|
|
121
127
|
connectionKey: string;
|
|
122
128
|
/** Which of the connector's operations to invoke, by key. */
|
|
@@ -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
|
/**
|
|
@@ -23,12 +23,14 @@ export declare const MAX_REALTIME_EVENT_NAME_LENGTH = 128;
|
|
|
23
23
|
/**
|
|
24
24
|
* The body a publishing service POSTs to `unibox-realtime`.
|
|
25
25
|
*
|
|
26
|
-
* **
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* **The tenant comes from the publisher's own access token**, so a company's own credential can only ever reach that
|
|
27
|
+
* company's subscribers. `tenantId` is the one exception, and it is not a body field anyone may fill: it is accepted
|
|
28
|
+
* only from a token holding `unibox:realtime:publish-any` issued in Iveri's operator workspace, and anything else naming
|
|
29
|
+
* one is a 403 rather than an event quietly published for the token's own company.
|
|
30
30
|
*/
|
|
31
31
|
export interface PublishConversationEventBody {
|
|
32
|
+
/** The company whose inbox hears the event, when it is not the token's own. See the interface comment. */
|
|
33
|
+
tenantId?: UUID;
|
|
32
34
|
conversationId: UUID;
|
|
33
35
|
event: RealtimeConversationEvent;
|
|
34
36
|
/** Identifiers only. Never message content — see {@link RealtimeConversationEvent}. */
|
|
@@ -148,6 +148,13 @@ export declare enum UserPermission {
|
|
|
148
148
|
CONDUIT_DISPATCH_SEND = "conduit:dispatch:send",
|
|
149
149
|
/** Redrive a dead-lettered dispatch, or cancel one still pending. */
|
|
150
150
|
CONDUIT_DISPATCH_OPERATE = "conduit:dispatch:operate",
|
|
151
|
+
/**
|
|
152
|
+
* Submit an outbound request for a company the request names in `tenantId`, rather than the token's own. A platform
|
|
153
|
+
* permission, held beside {@link UserPermission.CONDUIT_DISPATCH_SEND} only by a service credential in Iveri's
|
|
154
|
+
* operator workspace, so one product (`unibox-api`) sends each company's replies through that company's own
|
|
155
|
+
* connections. The connection is looked up in the named company, so it can never reach another company's.
|
|
156
|
+
*/
|
|
157
|
+
CONDUIT_DISPATCH_SEND_ANY = "conduit:dispatch:send-any",
|
|
151
158
|
/** Read the tenant's product catalog, including prices and availability. */
|
|
152
159
|
COMMERCE_CATALOG_READ = "commerce:catalog:read",
|
|
153
160
|
/** Create, edit, archive or restore products in the tenant's catalog. */
|
|
@@ -228,6 +235,12 @@ export declare enum UserPermission {
|
|
|
228
235
|
* reading the inbox over HTTP, because it is the same data arriving by another route.
|
|
229
236
|
*/
|
|
230
237
|
UNIBOX_REALTIME_PUBLISH = "unibox:realtime:publish",
|
|
238
|
+
/**
|
|
239
|
+
* Publish a conversation event into a company the request names in `tenantId`, rather than the token's own. A
|
|
240
|
+
* platform permission, held beside {@link UserPermission.UNIBOX_REALTIME_PUBLISH} only by `unibox-api`'s credential in
|
|
241
|
+
* Iveri's operator workspace, so each company's inbox hears its own conversations from one key.
|
|
242
|
+
*/
|
|
243
|
+
UNIBOX_REALTIME_PUBLISH_ANY = "unibox:realtime:publish-any",
|
|
231
244
|
/** Allows a trusted service principal to submit bounded conversation context for generation. */
|
|
232
245
|
UNIBOX_AI_RUN = "unibox:ai:run",
|
|
233
246
|
/** Read tenant MCP server metadata; credential values are never returned. */
|
|
@@ -167,6 +167,13 @@ export var UserPermission;
|
|
|
167
167
|
UserPermission["CONDUIT_DISPATCH_SEND"] = "conduit:dispatch:send";
|
|
168
168
|
/** Redrive a dead-lettered dispatch, or cancel one still pending. */
|
|
169
169
|
UserPermission["CONDUIT_DISPATCH_OPERATE"] = "conduit:dispatch:operate";
|
|
170
|
+
/**
|
|
171
|
+
* Submit an outbound request for a company the request names in `tenantId`, rather than the token's own. A platform
|
|
172
|
+
* permission, held beside {@link UserPermission.CONDUIT_DISPATCH_SEND} only by a service credential in Iveri's
|
|
173
|
+
* operator workspace, so one product (`unibox-api`) sends each company's replies through that company's own
|
|
174
|
+
* connections. The connection is looked up in the named company, so it can never reach another company's.
|
|
175
|
+
*/
|
|
176
|
+
UserPermission["CONDUIT_DISPATCH_SEND_ANY"] = "conduit:dispatch:send-any";
|
|
170
177
|
// ══ commerce-api ═════════════════════════════════════════════════════════
|
|
171
178
|
// ── Catalog ─────────────────────────────────────────────────────────────
|
|
172
179
|
/** Read the tenant's product catalog, including prices and availability. */
|
|
@@ -274,6 +281,12 @@ export var UserPermission;
|
|
|
274
281
|
* reading the inbox over HTTP, because it is the same data arriving by another route.
|
|
275
282
|
*/
|
|
276
283
|
UserPermission["UNIBOX_REALTIME_PUBLISH"] = "unibox:realtime:publish";
|
|
284
|
+
/**
|
|
285
|
+
* Publish a conversation event into a company the request names in `tenantId`, rather than the token's own. A
|
|
286
|
+
* platform permission, held beside {@link UserPermission.UNIBOX_REALTIME_PUBLISH} only by `unibox-api`'s credential in
|
|
287
|
+
* Iveri's operator workspace, so each company's inbox hears its own conversations from one key.
|
|
288
|
+
*/
|
|
289
|
+
UserPermission["UNIBOX_REALTIME_PUBLISH_ANY"] = "unibox:realtime:publish-any";
|
|
277
290
|
// ── AI runtime ──────────────────────────────────────────────────────────
|
|
278
291
|
/** Allows a trusted service principal to submit bounded conversation context for generation. */
|
|
279
292
|
UserPermission["UNIBOX_AI_RUN"] = "unibox:ai:run";
|
|
@@ -826,6 +839,8 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
|
|
|
826
839
|
UserPermission.MOBILITY_DISPATCH_READ_ANY,
|
|
827
840
|
UserPermission.MOBILITY_DISPATCH_CREATE_ANY,
|
|
828
841
|
UserPermission.MOBILITY_DISPATCH_OPERATE_ANY,
|
|
842
|
+
UserPermission.CONDUIT_DISPATCH_SEND_ANY,
|
|
843
|
+
UserPermission.UNIBOX_REALTIME_PUBLISH_ANY,
|
|
829
844
|
UserPermission.DELIVERY_JOB_READ_ANY,
|
|
830
845
|
UserPermission.DELIVERY_JOB_CREATE_ANY,
|
|
831
846
|
UserPermission.DELIVERY_JOB_OPERATE_ANY,
|