@iveri/contracts 0.125.0 → 0.126.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
@@ -306,6 +306,9 @@ Conduit's outbox.
306
306
  exist on npm.)
307
307
  - Version `0.120.0` adds `chat:embed:manage-any` and an optional `tenantId` on the embed requests, so HR opens every
308
308
  company's conversations from its operator-workspace key.
309
+ - Version `0.126.0` adds `realtime:event:publish-any` and `realtime:subscription-grant:issue-any` and an optional
310
+ `tenantId` on the realtime publish and grant requests, so the clinic announces every company's calendar changes from
311
+ its operator-workspace key.
309
312
  - Widening a type is minor; narrowing it is major.
310
313
  - Under `api/`, the contract follows the service: add the field to the service's DTO and to the
311
314
  interface in the same release, and let `implements` prove they agree.
@@ -22,10 +22,15 @@ export declare const REALTIME_GRANT_ISSUER = "iveri-realtime";
22
22
  /**
23
23
  * Requested by an owning API only after it has authorized a person to read the resource.
24
24
  *
25
- * `tenantId` is absent: it comes from the API's service token. The grant is bound to
26
- * `subjectId`, so copying one to another authenticated socket does not authorize that socket.
25
+ * The tenant normally comes from the API's service token. The grant is bound to `subjectId`, so
26
+ * copying one to another authenticated socket does not authorize that socket.
27
27
  */
28
28
  export interface IssueRealtimeSubscriptionGrantBody {
29
+ /**
30
+ * The company the grant admits a person into, when it is not the token's own. Accepted only from a token holding
31
+ * `realtime:subscription-grant:issue-any` issued in Iveri's operator workspace; anything else naming one is a 403.
32
+ */
33
+ tenantId?: UUID;
29
34
  subjectId: UUID;
30
35
  resourceType: RealtimeResourceType;
31
36
  resourceId: UUID;
@@ -52,11 +57,15 @@ export interface RealtimeSubscriptionGrantClaims {
52
57
  /**
53
58
  * A product service's best-effort change notification.
54
59
  *
55
- * The tenant comes from the authenticated service principal and is intentionally absent here.
56
- * `idempotencyKey` makes an HTTP retry harmless; no domain data or location coordinates travel
57
- * over this channel.
60
+ * The tenant normally comes from the authenticated service principal. `idempotencyKey` makes an
61
+ * HTTP retry harmless; no domain data or location coordinates travel over this channel.
58
62
  */
59
63
  export interface PublishRealtimeEventBody {
64
+ /**
65
+ * The company whose rooms hear the change, when it is not the token's own. Accepted only from a token holding
66
+ * `realtime:event:publish-any` issued in Iveri's operator workspace; anything else naming one is a 403.
67
+ */
68
+ tenantId?: UUID;
60
69
  idempotencyKey: UUID;
61
70
  resourceType: RealtimeResourceType;
62
71
  resourceId: UUID;
@@ -400,6 +400,20 @@ export declare enum UserPermission {
400
400
  * without the other.
401
401
  */
402
402
  REALTIME_EVENT_PUBLISH = "realtime:event:publish",
403
+ /**
404
+ * Issue a subscription grant for a company the request names in `tenantId`, rather than the token's own. A platform
405
+ * permission: held only by a service credential in Iveri's operator workspace, so a product sold to many companies
406
+ * (the clinic) admits each company's own people to that company's rooms from one key. Held beside
407
+ * {@link UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE}, which still opens the route; the grant is bound to the
408
+ * company it names, so it admits nobody to another company's rooms.
409
+ */
410
+ REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY = "realtime:subscription-grant:issue-any",
411
+ /**
412
+ * Publish an identifier-only resource change into a company the request names in `tenantId`, rather than the
413
+ * token's own. A platform permission, held beside {@link UserPermission.REALTIME_EVENT_PUBLISH} only by a service
414
+ * credential in Iveri's operator workspace, so one key announces every company's changes in that company's rooms.
415
+ */
416
+ REALTIME_EVENT_PUBLISH_ANY = "realtime:event:publish-any",
403
417
  /** Read worker profiles and operational availability inside the caller's tenant. */
404
418
  MOBILITY_WORKER_READ = "mobility:worker:read",
405
419
  /** Enrol workers, amend their capabilities, and suspend or reactivate them. */
@@ -463,6 +463,20 @@ export var UserPermission;
463
463
  * without the other.
464
464
  */
465
465
  UserPermission["REALTIME_EVENT_PUBLISH"] = "realtime:event:publish";
466
+ /**
467
+ * Issue a subscription grant for a company the request names in `tenantId`, rather than the token's own. A platform
468
+ * permission: held only by a service credential in Iveri's operator workspace, so a product sold to many companies
469
+ * (the clinic) admits each company's own people to that company's rooms from one key. Held beside
470
+ * {@link UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE}, which still opens the route; the grant is bound to the
471
+ * company it names, so it admits nobody to another company's rooms.
472
+ */
473
+ UserPermission["REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY"] = "realtime:subscription-grant:issue-any";
474
+ /**
475
+ * Publish an identifier-only resource change into a company the request names in `tenantId`, rather than the
476
+ * token's own. A platform permission, held beside {@link UserPermission.REALTIME_EVENT_PUBLISH} only by a service
477
+ * credential in Iveri's operator workspace, so one key announces every company's changes in that company's rooms.
478
+ */
479
+ UserPermission["REALTIME_EVENT_PUBLISH_ANY"] = "realtime:event:publish-any";
466
480
  // ══ iveri-mobility-api ══════════════════════════════════════════════════
467
481
  /** Read worker profiles and operational availability inside the caller's tenant. */
468
482
  UserPermission["MOBILITY_WORKER_READ"] = "mobility:worker:read";
@@ -753,6 +767,8 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
753
767
  UserPermission.BILLING_USAGE_READ_ANY,
754
768
  UserPermission.NOTIFICATION_SEND_ANY,
755
769
  UserPermission.CHAT_EMBED_MANAGE_ANY,
770
+ UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY,
771
+ UserPermission.REALTIME_EVENT_PUBLISH_ANY,
756
772
  ]);
757
773
  /** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
758
774
  export function isPlatformPermission(permission) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.125.0",
3
+ "version": "0.126.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {