@iveri/contracts 0.134.0 → 0.135.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,9 @@ 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.
308
311
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
309
312
  and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
310
313
  - 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. */
@@ -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
- * **There is no `tenantId` field, and that absence is the security model.** The tenant comes
27
- * from the publisher's own access token, so a compromised or buggy publisher cannot address
28
- * another tenant's subscribers — it can only ever reach its own. A body field would make
29
- * cross-tenant delivery a validation rule someone has to remember to write.
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.134.0",
3
+ "version": "0.135.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {