@leaflow/sdk 0.180.0 → 0.181.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/dist/eventbus/v1/generated/functions.d.ts +21 -23
- package/dist/eventbus/v1/generated/functions.js +1 -2
- package/dist/eventbus/v1/generated/models.d.ts +53 -40
- package/dist/eventbus/v1/generated/schemas.zod.d.ts +25 -25
- package/dist/eventbus/v1/generated/schemas.zod.js +21 -23
- package/dist/eventbus/v1/generated/validators/createEventRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createEventRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/createNamespaceRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createNamespaceRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/cursorPagination.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/cursorPagination.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/error.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/error.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/errorStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/errorStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventDetail.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventDetail.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventList.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventList.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventMessage.zod.d.ts +29 -25
- package/dist/eventbus/v1/generated/validators/eventMessage.zod.js +27 -26
- package/dist/eventbus/v1/generated/validators/eventResource.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventResource.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventVersion.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventVersion.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/fieldViolation.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/fieldViolation.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/listEventsParams.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/listEventsParams.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/listNamespacesParams.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/listNamespacesParams.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceList.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceList.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceResource.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceResource.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/offsetPagination.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/offsetPagination.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/publication.zod.d.ts +23 -23
- package/dist/eventbus/v1/generated/validators/publication.zod.js +22 -27
- package/dist/eventbus/v1/generated/validators/publicationRecipient.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/publicationRecipient.zod.js +89 -0
- package/dist/eventbus/v1/generated/validators/publishRequest.zod.d.ts +25 -24
- package/dist/eventbus/v1/generated/validators/publishRequest.zod.js +23 -23
- package/dist/eventbus/v1/generated/validators/publishResponse.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/publishResponse.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/publishedMessage.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/publishedMessage.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.d.ts +20 -22
- package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.js +20 -24
- package/dist/eventbus/v1/generated/validators/realtimeTicketRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/realtimeTicketRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/recipient.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/recipient.zod.js +89 -0
- package/dist/eventbus/v1/generated/validators/sender.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/sender.zod.js +92 -0
- package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/updateNamespaceRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/updateNamespaceRequest.zod.js +20 -21
- package/package.json +1 -1
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -606,8 +605,7 @@ export declare const getCreateAccountRealtimeTicketUrl: () => string;
|
|
|
606
605
|
/**
|
|
607
606
|
* Issues a short-lived ticket for a caller who has not selected a project, or belongs to none. Only
|
|
608
607
|
* platform events are accepted, and the ticket covers only messages sent to the caller outside
|
|
609
|
-
* any project or to no recipient. The ticket cannot publish.
|
|
610
|
-
* ticket lives no longer than the token it was created with.
|
|
608
|
+
* any project or to no recipient. The ticket cannot publish. The ticket lives no longer than the token it was created with.
|
|
611
609
|
* @summary Create an account realtime ticket
|
|
612
610
|
*/
|
|
613
611
|
export declare const createAccountRealtimeTicket: (realtimeTicketRequest: RealtimeTicketRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createAccountRealtimeTicketResponse>;
|
|
@@ -369,8 +369,7 @@ export const getCreateAccountRealtimeTicketUrl = () => {
|
|
|
369
369
|
/**
|
|
370
370
|
* Issues a short-lived ticket for a caller who has not selected a project, or belongs to none. Only
|
|
371
371
|
* platform events are accepted, and the ticket covers only messages sent to the caller outside
|
|
372
|
-
* any project or to no recipient. The ticket cannot publish.
|
|
373
|
-
* ticket lives no longer than the token it was created with.
|
|
372
|
+
* any project or to no recipient. The ticket cannot publish. The ticket lives no longer than the token it was created with.
|
|
374
373
|
* @summary Create an account realtime ticket
|
|
375
374
|
*/
|
|
376
375
|
export const createAccountRealtimeTicket = async (realtimeTicketRequest, options, fetchFn) => {
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -377,6 +376,13 @@ export interface UpdateEventRequest {
|
|
|
377
376
|
tags?: string[];
|
|
378
377
|
status?: EventStatus;
|
|
379
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* A member of the current project; when set, only that member receives the message
|
|
381
|
+
*/
|
|
382
|
+
export interface PublicationRecipient {
|
|
383
|
+
/** @maxLength 128 */
|
|
384
|
+
id: string;
|
|
385
|
+
}
|
|
380
386
|
/**
|
|
381
387
|
* The message payload
|
|
382
388
|
*/
|
|
@@ -400,21 +406,16 @@ export interface Publication {
|
|
|
400
406
|
* @maxLength 256
|
|
401
407
|
*/
|
|
402
408
|
key?: string;
|
|
403
|
-
|
|
404
|
-
* A member of the current project; when set, only that member receives the message
|
|
405
|
-
* @maxLength 128
|
|
406
|
-
*/
|
|
407
|
-
subject?: string;
|
|
409
|
+
recipient?: PublicationRecipient;
|
|
408
410
|
/** The message payload */
|
|
409
411
|
data: PublicationData;
|
|
410
412
|
}
|
|
411
413
|
export interface PublishRequest {
|
|
412
414
|
/**
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
* @maxLength 192
|
|
415
|
+
* Any label for the publishing client, such as one per browser tab; it need not be unique
|
|
416
|
+
* @maxLength 128
|
|
416
417
|
*/
|
|
417
|
-
client_id
|
|
418
|
+
client_id?: string;
|
|
418
419
|
/**
|
|
419
420
|
* @minItems 1
|
|
420
421
|
* @maxItems 64
|
|
@@ -452,14 +453,30 @@ export interface RealtimeTicket {
|
|
|
452
453
|
ticket: string;
|
|
453
454
|
/** When the ticket expires, in UTC RFC 3339; renew the connection before then */
|
|
454
455
|
expires_at: string;
|
|
455
|
-
/** The prefix every client ID on this ticket must start with */
|
|
456
|
-
client_id_prefix: string;
|
|
457
456
|
/** The topic filters the ticket covers; subscribe to these or to filters within them */
|
|
458
457
|
topics: string[];
|
|
459
458
|
}
|
|
460
459
|
export type EventMessageData = {
|
|
461
460
|
[key: string]: unknown;
|
|
462
461
|
};
|
|
462
|
+
/**
|
|
463
|
+
* Who published a message, as established when it was accepted
|
|
464
|
+
*/
|
|
465
|
+
export interface Sender {
|
|
466
|
+
/** The publisher's identity */
|
|
467
|
+
id: string;
|
|
468
|
+
/** The publisher's display name when the message was accepted; absent when none is known */
|
|
469
|
+
name?: string;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Who a message is sent to; absent for a message sent to no recipient. With only `project_id` the
|
|
473
|
+
* message goes to the members of the project; with only `id` it goes to that person outside any
|
|
474
|
+
* project; with both it goes to that person as a member of the project.
|
|
475
|
+
*/
|
|
476
|
+
export interface Recipient {
|
|
477
|
+
project_id?: string;
|
|
478
|
+
id?: string;
|
|
479
|
+
}
|
|
463
480
|
/**
|
|
464
481
|
* A message as delivered over a realtime connection
|
|
465
482
|
*/
|
|
@@ -469,16 +486,12 @@ export interface EventMessage {
|
|
|
469
486
|
/** @minimum 1 */
|
|
470
487
|
version: number;
|
|
471
488
|
key?: string;
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
/** The publishing client, exactly as it
|
|
475
|
-
client_id
|
|
489
|
+
sender: Sender;
|
|
490
|
+
recipient?: Recipient;
|
|
491
|
+
/** The label the publishing client gave, exactly as given; absent when it gave none */
|
|
492
|
+
client_id?: string;
|
|
476
493
|
/** The realtime connection the message was published on; absent for messages published over HTTP or by platform services */
|
|
477
494
|
connection_id?: string;
|
|
478
|
-
/** The project the message was sent to */
|
|
479
|
-
project_id?: string;
|
|
480
|
-
/** The person the message was sent to */
|
|
481
|
-
subject?: string;
|
|
482
495
|
created_at: string;
|
|
483
496
|
data: EventMessageData;
|
|
484
497
|
}
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -237,12 +236,14 @@ export declare const GetEventVersionParams: zod.ZodObject<{
|
|
|
237
236
|
* @summary Publish event messages
|
|
238
237
|
*/
|
|
239
238
|
export declare const PublishEventsBody: zod.ZodObject<{
|
|
240
|
-
client_id: zod.ZodString
|
|
239
|
+
client_id: zod.ZodOptional<zod.ZodString>;
|
|
241
240
|
messages: zod.ZodArray<zod.ZodObject<{
|
|
242
241
|
event: zod.ZodString;
|
|
243
242
|
version: zod.ZodDefault<zod.ZodInt>;
|
|
244
243
|
key: zod.ZodOptional<zod.ZodString>;
|
|
245
|
-
|
|
244
|
+
recipient: zod.ZodOptional<zod.ZodObject<{
|
|
245
|
+
id: zod.ZodString;
|
|
246
|
+
}, zod.z.core.$strict>>;
|
|
246
247
|
data: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
247
248
|
}, zod.z.core.$strict>>;
|
|
248
249
|
}, zod.z.core.$strict>;
|
|
@@ -262,8 +263,7 @@ export declare const CreateRealtimeTicketBody: zod.ZodObject<{
|
|
|
262
263
|
/**
|
|
263
264
|
* Issues a short-lived ticket for a caller who has not selected a project, or belongs to none. Only
|
|
264
265
|
* platform events are accepted, and the ticket covers only messages sent to the caller outside
|
|
265
|
-
* any project or to no recipient. The ticket cannot publish.
|
|
266
|
-
* ticket lives no longer than the token it was created with.
|
|
266
|
+
* any project or to no recipient. The ticket cannot publish. The ticket lives no longer than the token it was created with.
|
|
267
267
|
* @summary Create an account realtime ticket
|
|
268
268
|
*/
|
|
269
269
|
export declare const CreateAccountRealtimeTicketBody: zod.ZodObject<{
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -299,8 +298,7 @@ export const CreateRealtimeTicketBody = RealtimeTicketRequest;
|
|
|
299
298
|
/**
|
|
300
299
|
* Issues a short-lived ticket for a caller who has not selected a project, or belongs to none. Only
|
|
301
300
|
* platform events are accepted, and the ticket covers only messages sent to the caller outside
|
|
302
|
-
* any project or to no recipient. The ticket cannot publish.
|
|
303
|
-
* ticket lives no longer than the token it was created with.
|
|
301
|
+
* any project or to no recipient. The ticket cannot publish. The ticket lives no longer than the token it was created with.
|
|
304
302
|
* @summary Create an account realtime ticket
|
|
305
303
|
*/
|
|
306
304
|
export const CreateAccountRealtimeTicketBody = RealtimeTicketRequest;
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|