@lynkoria/contracts 0.1.1 → 0.4.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/catalog.js CHANGED
@@ -29,7 +29,7 @@ const GLOSSARY = [
29
29
  },
30
30
  {
31
31
  term: "Scope",
32
- definition: "What a service key may do: calls:write, messaging:write or users:write.",
32
+ definition: "What a service key may do: calls:write, messaging:write, users:write, or messaging:import (history import, never granted by default).",
33
33
  docs: "projects-and-keys.md"
34
34
  },
35
35
  {
@@ -304,7 +304,7 @@ const METRICS = [
304
304
  kind: "live",
305
305
  delay: "—",
306
306
  status: "unavailable",
307
- prerequisite: "A monitoring backend scraping the API metrics port (PD-5), and a platform operator role to see it (PD-1)."
307
+ prerequisite: "A monitoring backend scraping the API metrics port, and a platform operator role to see it."
308
308
  },
309
309
  {
310
310
  key: "onlineUsers",
@@ -332,7 +332,7 @@ const METRICS = [
332
332
  kind: "live",
333
333
  delay: "—",
334
334
  status: "unavailable",
335
- prerequisite: "A monitoring backend (PD-5); the gauge has no project label by design."
335
+ prerequisite: "A monitoring backend; the gauge has no project label by design."
336
336
  },
337
337
  {
338
338
  key: "infrastructure",
@@ -346,7 +346,7 @@ const METRICS = [
346
346
  kind: "live",
347
347
  delay: "—",
348
348
  status: "unavailable",
349
- prerequisite: "A monitoring backend (PD-5) and a platform operator role (PD-1)."
349
+ prerequisite: "A monitoring backend and a platform operator role."
350
350
  },
351
351
  {
352
352
  key: "bandwidth",
package/dist/events.d.ts CHANGED
@@ -29,12 +29,19 @@ export type TypingEvent = {
29
29
  };
30
30
  export type ConversationUpdatedEvent = {
31
31
  conversationId: string;
32
- reason: 'members_changed' | 'removed';
32
+ /**
33
+ * `members_changed`: members or roles changed. `removed`: you left or were removed.
34
+ * `updated`: title, description, metadata, visibility or archive state changed.
35
+ * `history_imported`: older messages were imported; reload history.
36
+ */
37
+ reason: 'members_changed' | 'removed' | 'updated' | 'history_imported';
33
38
  };
34
39
  export interface ServerToClientEvents {
35
40
  'message:created': (event: ConversationEvent) => void;
36
41
  'message:updated': (event: ConversationEvent) => void;
37
42
  'message:deleted': (event: ConversationEvent) => void;
43
+ 'message:pinned': (event: ConversationEvent) => void;
44
+ 'message:unpinned': (event: ConversationEvent) => void;
38
45
  'reaction:added': (event: ConversationEvent) => void;
39
46
  'reaction:removed': (event: ConversationEvent) => void;
40
47
  'conversation:updated': (event: ConversationUpdatedEvent) => void;
@@ -82,6 +89,8 @@ export declare const SocketEvents: {
82
89
  readonly MessageCreated: 'message:created';
83
90
  readonly MessageUpdated: 'message:updated';
84
91
  readonly MessageDeleted: 'message:deleted';
92
+ readonly MessagePinned: 'message:pinned';
93
+ readonly MessageUnpinned: 'message:unpinned';
85
94
  readonly ReactionAdded: 'reaction:added';
86
95
  readonly ReactionRemoved: 'reaction:removed';
87
96
  readonly ConversationUpdated: 'conversation:updated';
package/dist/events.js CHANGED
@@ -4,6 +4,8 @@ const SocketEvents = {
4
4
  MessageCreated: "message:created",
5
5
  MessageUpdated: "message:updated",
6
6
  MessageDeleted: "message:deleted",
7
+ MessagePinned: "message:pinned",
8
+ MessageUnpinned: "message:unpinned",
7
9
  ReactionAdded: "reaction:added",
8
10
  ReactionRemoved: "reaction:removed",
9
11
  ConversationUpdated: "conversation:updated",
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ErrorBody, ErrorCode, LynkoriaError } from "./errors.js";
2
2
  import { Ack, CallSignalEvent, ClientToServerEvents, ConversationReadEvent, ConversationUpdatedEvent, PushPayloadKeys, ServerToClientEvents, SocketEvents, TypingEvent, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS, WebhookEvent, WebhookEventType } from "./events.js";
3
- import { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationType, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, GrantRoleRequest, JoinTokenRequest, JoinTokenResponse, ManualStatus, MembersRequest, Message, MessagingTokenRequest, MessagingTokenResponse, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, StartRecordingRequest, TenantId, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret } from "./schemas.js";
3
+ import { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationMember, ConversationMemberPage, ConversationType, ConversationVisibility, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DeploymentOptions, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ExternalId, GrantRoleRequest, ImportMessage, ImportMessagesRequest, ImportMessagesResponse, JoinTokenRequest, JoinTokenResponse, ManualStatus, MemberRole, MembersRequest, Mentions, Message, MessageSearchResult, MessagingTokenRequest, MessagingTokenResponse, MessagingTokenScope, Metadata, NotificationLevel, NotificationLevelRequest, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, PinnedMessages, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadPositionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveTenantMemberResponse, RemoveUserResponse, RevokeSessionsRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, ServiceUploadIntentRequest, SetMemberRoleRequest, SetPresenceStatusRequest, StartRecordingRequest, TenantId, ThreadSummary, UpdateConversationRequest, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret } from "./schemas.js";
4
4
  /** Bumped when the REST/event contract changes incompatibly. */
5
5
  export declare const API_VERSION = "v1";
6
- export { Ack, AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalEvent, CallSignalRequest, CallSignalType, CallStatus, CallType, ClientToServerEvents, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationReadEvent, ConversationType, ConversationUpdatedEvent, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ErrorBody, ErrorCode, GrantRoleRequest, JoinTokenRequest, JoinTokenResponse, LynkoriaError, ManualStatus, MembersRequest, Message, MessagingTokenRequest, MessagingTokenResponse, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServerToClientEvents, ServiceKey, ServiceScope, SocketEvents, StartRecordingRequest, TenantId, TypingEvent, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS, WebhookDelivery, WebhookEvent, WebhookEventPage, WebhookEventType, WebhookSecret };
6
+ export { Ack, AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalEvent, CallSignalRequest, CallSignalType, CallStatus, CallType, ClientToServerEvents, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationMember, ConversationMemberPage, ConversationReadEvent, ConversationType, ConversationUpdatedEvent, ConversationVisibility, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DeploymentOptions, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ErrorBody, ErrorCode, ExternalId, GrantRoleRequest, ImportMessage, ImportMessagesRequest, ImportMessagesResponse, JoinTokenRequest, JoinTokenResponse, LynkoriaError, ManualStatus, MemberRole, MembersRequest, Mentions, Message, MessageSearchResult, MessagingTokenRequest, MessagingTokenResponse, MessagingTokenScope, Metadata, NotificationLevel, NotificationLevelRequest, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, PinnedMessages, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PublishSource, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadPositionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveTenantMemberResponse, RemoveUserResponse, RevokeSessionsRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServerToClientEvents, ServiceKey, ServiceScope, ServiceUploadIntentRequest, SetMemberRoleRequest, SetPresenceStatusRequest, SocketEvents, StartRecordingRequest, TenantId, ThreadSummary, TypingEvent, UpdateConversationRequest, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS, WebhookDelivery, WebhookEvent, WebhookEventPage, WebhookEventType, WebhookSecret };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ErrorCode, LynkoriaError } from "./errors.js";
2
2
  import { PushPayloadKeys, SocketEvents, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS } from "./events.js";
3
- import { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationType, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, GrantRoleRequest, JoinTokenRequest, JoinTokenResponse, ManualStatus, MembersRequest, Message, MessagingTokenRequest, MessagingTokenResponse, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, StartRecordingRequest, TenantId, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret } from "./schemas.js";
3
+ import { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationMember, ConversationMemberPage, ConversationType, ConversationVisibility, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DeploymentOptions, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ExternalId, GrantRoleRequest, ImportMessage, ImportMessagesRequest, ImportMessagesResponse, JoinTokenRequest, JoinTokenResponse, ManualStatus, MemberRole, MembersRequest, Mentions, Message, MessageSearchResult, MessagingTokenRequest, MessagingTokenResponse, MessagingTokenScope, Metadata, NotificationLevel, NotificationLevelRequest, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, PinnedMessages, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadPositionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveTenantMemberResponse, RemoveUserResponse, RevokeSessionsRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, ServiceUploadIntentRequest, SetMemberRoleRequest, SetPresenceStatusRequest, StartRecordingRequest, TenantId, ThreadSummary, UpdateConversationRequest, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret } from "./schemas.js";
4
4
  // src/index.ts
5
5
  /** Bumped when the REST/event contract changes incompatibly. */
6
6
  const API_VERSION = "v1";
7
- export { API_VERSION, AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationType, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ErrorCode, GrantRoleRequest, JoinTokenRequest, JoinTokenResponse, LynkoriaError, ManualStatus, MembersRequest, Message, MessagingTokenRequest, MessagingTokenResponse, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, SocketEvents, StartRecordingRequest, TenantId, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS, WebhookDelivery, WebhookEventPage, WebhookSecret };
7
+ export { API_VERSION, AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationMember, ConversationMemberPage, ConversationType, ConversationVisibility, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DeploymentOptions, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ErrorCode, ExternalId, GrantRoleRequest, ImportMessage, ImportMessagesRequest, ImportMessagesResponse, JoinTokenRequest, JoinTokenResponse, LynkoriaError, ManualStatus, MemberRole, MembersRequest, Mentions, Message, MessageSearchResult, MessagingTokenRequest, MessagingTokenResponse, MessagingTokenScope, Metadata, NotificationLevel, NotificationLevelRequest, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, PinnedMessages, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PublishSource, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadPositionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveTenantMemberResponse, RemoveUserResponse, RevokeSessionsRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, ServiceUploadIntentRequest, SetMemberRoleRequest, SetPresenceStatusRequest, SocketEvents, StartRecordingRequest, TenantId, ThreadSummary, UpdateConversationRequest, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TOLERANCE_SECONDS, WebhookDelivery, WebhookEventPage, WebhookSecret };
package/dist/schemas.d.ts CHANGED
@@ -30,6 +30,7 @@ export declare const ProductMessagingPolicy: z.ZodObject<{
30
30
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
31
31
  allowThreads: z.ZodDefault<z.ZodBoolean>;
32
32
  allowReactions: z.ZodDefault<z.ZodBoolean>;
33
+ allowPins: z.ZodDefault<z.ZodBoolean>;
33
34
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
34
35
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
35
36
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -64,6 +65,7 @@ export declare const CreateCallRequest: z.ZodObject<{
64
65
  emptyTimeoutSec: z.ZodDefault<z.ZodNumber>;
65
66
  departureTimeoutSec: z.ZodDefault<z.ZodNumber>;
66
67
  e2ee: z.ZodDefault<z.ZodBoolean>;
68
+ restartIfEnded: z.ZodDefault<z.ZodBoolean>;
67
69
  }, z.core.$strip>;
68
70
  export type CreateCallRequest = z.input<typeof CreateCallRequest>;
69
71
  export declare const Call: z.ZodObject<{
@@ -86,6 +88,13 @@ export declare const Call: z.ZodObject<{
86
88
  endedAt: z.ZodNullable<z.ZodString>;
87
89
  }, z.core.$strip>;
88
90
  export type Call = z.infer<typeof Call>;
91
+ export declare const PublishSource: z.ZodEnum<{
92
+ camera: "camera";
93
+ microphone: "microphone";
94
+ screen_share: "screen_share";
95
+ screen_share_audio: "screen_share_audio";
96
+ }>;
97
+ export type PublishSource = z.infer<typeof PublishSource>;
89
98
  export declare const JoinTokenRequest: z.ZodObject<{
90
99
  userId: z.ZodString;
91
100
  deviceId: z.ZodString;
@@ -96,6 +105,13 @@ export declare const JoinTokenRequest: z.ZodObject<{
96
105
  speaker: "speaker";
97
106
  viewer: "viewer";
98
107
  }>>;
108
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
109
+ publishSources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
110
+ camera: "camera";
111
+ microphone: "microphone";
112
+ screen_share: "screen_share";
113
+ screen_share_audio: "screen_share_audio";
114
+ }>>>;
99
115
  }, z.core.$strip>;
100
116
  export type JoinTokenRequest = z.input<typeof JoinTokenRequest>;
101
117
  export declare const JoinTokenResponse: z.ZodObject<{
@@ -105,6 +121,10 @@ export declare const JoinTokenResponse: z.ZodObject<{
105
121
  expiresAt: z.ZodString;
106
122
  }, z.core.$strip>;
107
123
  export type JoinTokenResponse = z.infer<typeof JoinTokenResponse>;
124
+ export declare const RemoveUserResponse: z.ZodObject<{
125
+ removed: z.ZodNumber;
126
+ }, z.core.$strip>;
127
+ export type RemoveUserResponse = z.infer<typeof RemoveUserResponse>;
108
128
  export declare const UpdatePermissionsRequest: z.ZodObject<{
109
129
  role: z.ZodEnum<{
110
130
  host: "host";
@@ -136,15 +156,30 @@ export declare const CallSignalRequest: z.ZodObject<{
136
156
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
137
157
  }, z.core.$strip>;
138
158
  export type CallSignalRequest = z.input<typeof CallSignalRequest>;
159
+ /**
160
+ * Optional capabilities of a messaging token beyond the user's own conversations. Omit `scopes` to
161
+ * grant every capability the environment enables; pass a subset to restrict a token, e.g. `[]` for a
162
+ * guest who may only use the conversations they were added to.
163
+ */
164
+ export declare const MessagingTokenScope: z.ZodEnum<{
165
+ presence: "presence";
166
+ public_conversations: "public_conversations";
167
+ }>;
168
+ export type MessagingTokenScope = z.infer<typeof MessagingTokenScope>;
139
169
  export declare const MessagingTokenRequest: z.ZodObject<{
140
170
  userId: z.ZodString;
141
171
  deviceId: z.ZodString;
142
172
  tenantId: z.ZodDefault<z.ZodString>;
173
+ scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
174
+ presence: "presence";
175
+ public_conversations: "public_conversations";
176
+ }>>>;
143
177
  }, z.core.$strip>;
144
178
  export type MessagingTokenRequest = z.input<typeof MessagingTokenRequest>;
145
179
  export declare const MessagingTokenResponse: z.ZodObject<{
146
180
  token: z.ZodString;
147
181
  expiresAt: z.ZodString;
182
+ apiUrl: z.ZodString;
148
183
  }, z.core.$strip>;
149
184
  export type MessagingTokenResponse = z.infer<typeof MessagingTokenResponse>;
150
185
  export declare const ConversationType: z.ZodEnum<{
@@ -154,6 +189,39 @@ export declare const ConversationType: z.ZodEnum<{
154
189
  session: "session";
155
190
  }>;
156
191
  export type ConversationType = z.infer<typeof ConversationType>;
192
+ /**
193
+ * `private`: only members read it. `public`: any user of the same tenant whose token has the
194
+ * `public_conversations` scope can read and search it; posting still requires membership.
195
+ */
196
+ export declare const ConversationVisibility: z.ZodEnum<{
197
+ private: "private";
198
+ public: "public";
199
+ }>;
200
+ export type ConversationVisibility = z.infer<typeof ConversationVisibility>;
201
+ /**
202
+ * `owner` and `admin` are labels your backend assigns and reads back; Lynkoria enforces only
203
+ * `viewer` (read, mark read, no posting, reacting or pinning).
204
+ */
205
+ export declare const MemberRole: z.ZodEnum<{
206
+ admin: "admin";
207
+ member: "member";
208
+ owner: "owner";
209
+ viewer: "viewer";
210
+ }>;
211
+ export type MemberRole = z.infer<typeof MemberRole>;
212
+ /** A member's own choice of which messages count for notifications and badges. */
213
+ export declare const NotificationLevel: z.ZodEnum<{
214
+ all: "all";
215
+ mentions: "mentions";
216
+ none: "none";
217
+ }>;
218
+ export type NotificationLevel = z.infer<typeof NotificationLevel>;
219
+ /**
220
+ * Small product-defined key/value data (at most 32 keys, scalar values). Never put secrets or
221
+ * personal data here: every member can read it.
222
+ */
223
+ export declare const Metadata: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
224
+ export type Metadata = z.infer<typeof Metadata>;
157
225
  export declare const CreateConversationRequest: z.ZodObject<{
158
226
  tenantId: z.ZodDefault<z.ZodString>;
159
227
  type: z.ZodEnum<{
@@ -164,13 +232,87 @@ export declare const CreateConversationRequest: z.ZodObject<{
164
232
  }>;
165
233
  productConversationId: z.ZodOptional<z.ZodString>;
166
234
  title: z.ZodOptional<z.ZodString>;
235
+ description: z.ZodOptional<z.ZodString>;
236
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
237
+ visibility: z.ZodDefault<z.ZodEnum<{
238
+ private: "private";
239
+ public: "public";
240
+ }>>;
167
241
  memberIds: z.ZodArray<z.ZodString>;
242
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
243
+ admin: "admin";
244
+ member: "member";
245
+ owner: "owner";
246
+ viewer: "viewer";
247
+ }>>>;
168
248
  }, z.core.$strip>;
169
249
  export type CreateConversationRequest = z.input<typeof CreateConversationRequest>;
250
+ /** Service-key update of a conversation; every field is optional and omitted fields are unchanged. */
251
+ export declare const UpdateConversationRequest: z.ZodObject<{
252
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
254
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
255
+ visibility: z.ZodOptional<z.ZodEnum<{
256
+ private: "private";
257
+ public: "public";
258
+ }>>;
259
+ archived: z.ZodOptional<z.ZodBoolean>;
260
+ }, z.core.$strip>;
261
+ export type UpdateConversationRequest = z.input<typeof UpdateConversationRequest>;
170
262
  export declare const MembersRequest: z.ZodObject<{
171
263
  userIds: z.ZodArray<z.ZodString>;
264
+ role: z.ZodOptional<z.ZodEnum<{
265
+ admin: "admin";
266
+ member: "member";
267
+ owner: "owner";
268
+ viewer: "viewer";
269
+ }>>;
270
+ }, z.core.$strip>;
271
+ export type MembersRequest = z.input<typeof MembersRequest>;
272
+ export declare const SetMemberRoleRequest: z.ZodObject<{
273
+ role: z.ZodEnum<{
274
+ admin: "admin";
275
+ member: "member";
276
+ owner: "owner";
277
+ viewer: "viewer";
278
+ }>;
279
+ }, z.core.$strip>;
280
+ export type SetMemberRoleRequest = z.infer<typeof SetMemberRoleRequest>;
281
+ export declare const ConversationMember: z.ZodObject<{
282
+ userId: z.ZodString;
283
+ role: z.ZodEnum<{
284
+ admin: "admin";
285
+ member: "member";
286
+ owner: "owner";
287
+ viewer: "viewer";
288
+ }>;
289
+ joinedAt: z.ZodString;
290
+ readSeq: z.ZodNumber;
291
+ }, z.core.$strip>;
292
+ export type ConversationMember = z.infer<typeof ConversationMember>;
293
+ export declare const ConversationMemberPage: z.ZodObject<{
294
+ items: z.ZodArray<z.ZodObject<{
295
+ userId: z.ZodString;
296
+ role: z.ZodEnum<{
297
+ admin: "admin";
298
+ member: "member";
299
+ owner: "owner";
300
+ viewer: "viewer";
301
+ }>;
302
+ joinedAt: z.ZodString;
303
+ readSeq: z.ZodNumber;
304
+ }, z.core.$strip>>;
305
+ nextCursor: z.ZodNullable<z.ZodString>;
306
+ }, z.core.$strip>;
307
+ export type ConversationMemberPage = z.infer<typeof ConversationMemberPage>;
308
+ export declare const NotificationLevelRequest: z.ZodObject<{
309
+ level: z.ZodEnum<{
310
+ all: "all";
311
+ mentions: "mentions";
312
+ none: "none";
313
+ }>;
172
314
  }, z.core.$strip>;
173
- export type MembersRequest = z.infer<typeof MembersRequest>;
315
+ export type NotificationLevelRequest = z.infer<typeof NotificationLevelRequest>;
174
316
  export declare const Conversation: z.ZodObject<{
175
317
  id: z.ZodUUID;
176
318
  tenantId: z.ZodString;
@@ -182,10 +324,40 @@ export declare const Conversation: z.ZodObject<{
182
324
  }>;
183
325
  productConversationId: z.ZodNullable<z.ZodString>;
184
326
  title: z.ZodNullable<z.ZodString>;
327
+ description: z.ZodNullable<z.ZodString>;
328
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
329
+ visibility: z.ZodEnum<{
330
+ private: "private";
331
+ public: "public";
332
+ }>;
333
+ archivedAt: z.ZodNullable<z.ZodString>;
334
+ memberCount: z.ZodNumber;
335
+ memberIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
336
+ memberPreview: z.ZodArray<z.ZodString>;
337
+ lastMessage: z.ZodNullable<z.ZodObject<{
338
+ id: z.ZodUUID;
339
+ senderId: z.ZodString;
340
+ body: z.ZodNullable<z.ZodString>;
341
+ hasAttachments: z.ZodBoolean;
342
+ createdAt: z.ZodString;
343
+ }, z.core.$strip>>;
185
344
  lastSeq: z.ZodNumber;
186
345
  lastMessageAt: z.ZodNullable<z.ZodString>;
187
346
  createdAt: z.ZodString;
188
347
  readSeq: z.ZodOptional<z.ZodNumber>;
348
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
349
+ admin: "admin";
350
+ member: "member";
351
+ owner: "owner";
352
+ viewer: "viewer";
353
+ }>>>;
354
+ notificationLevel: z.ZodOptional<z.ZodEnum<{
355
+ all: "all";
356
+ mentions: "mentions";
357
+ none: "none";
358
+ }>>;
359
+ unreadCount: z.ZodOptional<z.ZodNumber>;
360
+ mentionCount: z.ZodOptional<z.ZodNumber>;
189
361
  }, z.core.$strip>;
190
362
  export type Conversation = z.infer<typeof Conversation>;
191
363
  export declare const ConversationList: z.ZodObject<{
@@ -200,10 +372,40 @@ export declare const ConversationList: z.ZodObject<{
200
372
  }>;
201
373
  productConversationId: z.ZodNullable<z.ZodString>;
202
374
  title: z.ZodNullable<z.ZodString>;
375
+ description: z.ZodNullable<z.ZodString>;
376
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
377
+ visibility: z.ZodEnum<{
378
+ private: "private";
379
+ public: "public";
380
+ }>;
381
+ archivedAt: z.ZodNullable<z.ZodString>;
382
+ memberCount: z.ZodNumber;
383
+ memberIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
+ memberPreview: z.ZodArray<z.ZodString>;
385
+ lastMessage: z.ZodNullable<z.ZodObject<{
386
+ id: z.ZodUUID;
387
+ senderId: z.ZodString;
388
+ body: z.ZodNullable<z.ZodString>;
389
+ hasAttachments: z.ZodBoolean;
390
+ createdAt: z.ZodString;
391
+ }, z.core.$strip>>;
203
392
  lastSeq: z.ZodNumber;
204
393
  lastMessageAt: z.ZodNullable<z.ZodString>;
205
394
  createdAt: z.ZodString;
206
395
  readSeq: z.ZodOptional<z.ZodNumber>;
396
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
397
+ admin: "admin";
398
+ member: "member";
399
+ owner: "owner";
400
+ viewer: "viewer";
401
+ }>>>;
402
+ notificationLevel: z.ZodOptional<z.ZodEnum<{
403
+ all: "all";
404
+ mentions: "mentions";
405
+ none: "none";
406
+ }>>;
407
+ unreadCount: z.ZodOptional<z.ZodNumber>;
408
+ mentionCount: z.ZodOptional<z.ZodNumber>;
207
409
  }, z.core.$strip>>;
208
410
  nextCursor: z.ZodNullable<z.ZodString>;
209
411
  }, z.core.$strip>;
@@ -242,17 +444,21 @@ export declare const Attachment: z.ZodObject<{
242
444
  }>>;
243
445
  }, z.core.$strip>;
244
446
  export type Attachment = z.infer<typeof Attachment>;
447
+ /** User IDs a message mentions. Each must be a current member of the conversation. */
448
+ export declare const Mentions: z.ZodArray<z.ZodString>;
245
449
  export declare const SendMessageRequest: z.ZodObject<{
246
450
  clientMessageId: z.ZodString;
247
451
  text: z.ZodDefault<z.ZodString>;
248
452
  attachmentIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
249
453
  parentMessageId: z.ZodOptional<z.ZodUUID>;
454
+ mentions: z.ZodDefault<z.ZodArray<z.ZodString>>;
250
455
  }, z.core.$strip>;
251
456
  export type SendMessageRequest = z.input<typeof SendMessageRequest>;
252
457
  export declare const EditMessageRequest: z.ZodObject<{
253
458
  text: z.ZodString;
459
+ mentions: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
460
  }, z.core.$strip>;
255
- export type EditMessageRequest = z.infer<typeof EditMessageRequest>;
461
+ export type EditMessageRequest = z.input<typeof EditMessageRequest>;
256
462
  export declare const ReadRequest: z.ZodObject<{
257
463
  seq: z.ZodNumber;
258
464
  }, z.core.$strip>;
@@ -266,6 +472,13 @@ export declare const Reaction: z.ZodObject<{
266
472
  emoji: z.ZodString;
267
473
  }, z.core.$strip>;
268
474
  export type Reaction = z.infer<typeof Reaction>;
475
+ /** Replies to a top-level message. */
476
+ export declare const ThreadSummary: z.ZodObject<{
477
+ replyCount: z.ZodNumber;
478
+ lastReplyAt: z.ZodNullable<z.ZodString>;
479
+ participantIds: z.ZodArray<z.ZodString>;
480
+ }, z.core.$strip>;
481
+ export type ThreadSummary = z.infer<typeof ThreadSummary>;
269
482
  export declare const Message: z.ZodObject<{
270
483
  id: z.ZodUUID;
271
484
  conversationId: z.ZodUUID;
@@ -300,7 +513,15 @@ export declare const Message: z.ZodObject<{
300
513
  userId: z.ZodString;
301
514
  emoji: z.ZodString;
302
515
  }, z.core.$strip>>;
516
+ mentions: z.ZodArray<z.ZodString>;
303
517
  parentMessageId: z.ZodNullable<z.ZodString>;
518
+ thread: z.ZodNullable<z.ZodObject<{
519
+ replyCount: z.ZodNumber;
520
+ lastReplyAt: z.ZodNullable<z.ZodString>;
521
+ participantIds: z.ZodArray<z.ZodString>;
522
+ }, z.core.$strip>>;
523
+ pinnedAt: z.ZodNullable<z.ZodString>;
524
+ pinnedBy: z.ZodNullable<z.ZodString>;
304
525
  createdAt: z.ZodString;
305
526
  editedAt: z.ZodNullable<z.ZodString>;
306
527
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -309,6 +530,8 @@ export type Message = z.infer<typeof Message>;
309
530
  export declare const ConversationEventType: z.ZodEnum<{
310
531
  "message.created": "message.created";
311
532
  "message.deleted": "message.deleted";
533
+ "message.pinned": "message.pinned";
534
+ "message.unpinned": "message.unpinned";
312
535
  "message.updated": "message.updated";
313
536
  "reaction.added": "reaction.added";
314
537
  "reaction.removed": "reaction.removed";
@@ -324,6 +547,8 @@ export declare const ConversationEvent: z.ZodObject<{
324
547
  type: z.ZodEnum<{
325
548
  "message.created": "message.created";
326
549
  "message.deleted": "message.deleted";
550
+ "message.pinned": "message.pinned";
551
+ "message.unpinned": "message.unpinned";
327
552
  "message.updated": "message.updated";
328
553
  "reaction.added": "reaction.added";
329
554
  "reaction.removed": "reaction.removed";
@@ -362,7 +587,15 @@ export declare const ConversationEvent: z.ZodObject<{
362
587
  userId: z.ZodString;
363
588
  emoji: z.ZodString;
364
589
  }, z.core.$strip>>;
590
+ mentions: z.ZodArray<z.ZodString>;
365
591
  parentMessageId: z.ZodNullable<z.ZodString>;
592
+ thread: z.ZodNullable<z.ZodObject<{
593
+ replyCount: z.ZodNumber;
594
+ lastReplyAt: z.ZodNullable<z.ZodString>;
595
+ participantIds: z.ZodArray<z.ZodString>;
596
+ }, z.core.$strip>>;
597
+ pinnedAt: z.ZodNullable<z.ZodString>;
598
+ pinnedBy: z.ZodNullable<z.ZodString>;
366
599
  createdAt: z.ZodString;
367
600
  editedAt: z.ZodNullable<z.ZodString>;
368
601
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -371,6 +604,7 @@ export declare const ConversationEvent: z.ZodObject<{
371
604
  userId: z.ZodString;
372
605
  emoji: z.ZodString;
373
606
  }, z.core.$strip>>;
607
+ actorId: z.ZodNullable<z.ZodString>;
374
608
  createdAt: z.ZodString;
375
609
  }, z.core.$strip>;
376
610
  export type ConversationEvent = z.infer<typeof ConversationEvent>;
@@ -381,6 +615,8 @@ export declare const ConversationEventPage: z.ZodObject<{
381
615
  type: z.ZodEnum<{
382
616
  "message.created": "message.created";
383
617
  "message.deleted": "message.deleted";
618
+ "message.pinned": "message.pinned";
619
+ "message.unpinned": "message.unpinned";
384
620
  "message.updated": "message.updated";
385
621
  "reaction.added": "reaction.added";
386
622
  "reaction.removed": "reaction.removed";
@@ -419,7 +655,15 @@ export declare const ConversationEventPage: z.ZodObject<{
419
655
  userId: z.ZodString;
420
656
  emoji: z.ZodString;
421
657
  }, z.core.$strip>>;
658
+ mentions: z.ZodArray<z.ZodString>;
422
659
  parentMessageId: z.ZodNullable<z.ZodString>;
660
+ thread: z.ZodNullable<z.ZodObject<{
661
+ replyCount: z.ZodNumber;
662
+ lastReplyAt: z.ZodNullable<z.ZodString>;
663
+ participantIds: z.ZodArray<z.ZodString>;
664
+ }, z.core.$strip>>;
665
+ pinnedAt: z.ZodNullable<z.ZodString>;
666
+ pinnedBy: z.ZodNullable<z.ZodString>;
423
667
  createdAt: z.ZodString;
424
668
  editedAt: z.ZodNullable<z.ZodString>;
425
669
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -428,6 +672,7 @@ export declare const ConversationEventPage: z.ZodObject<{
428
672
  userId: z.ZodString;
429
673
  emoji: z.ZodString;
430
674
  }, z.core.$strip>>;
675
+ actorId: z.ZodNullable<z.ZodString>;
431
676
  createdAt: z.ZodString;
432
677
  }, z.core.$strip>>;
433
678
  lastSeq: z.ZodNumber;
@@ -469,7 +714,15 @@ export declare const SendMessageResponse: z.ZodObject<{
469
714
  userId: z.ZodString;
470
715
  emoji: z.ZodString;
471
716
  }, z.core.$strip>>;
717
+ mentions: z.ZodArray<z.ZodString>;
472
718
  parentMessageId: z.ZodNullable<z.ZodString>;
719
+ thread: z.ZodNullable<z.ZodObject<{
720
+ replyCount: z.ZodNumber;
721
+ lastReplyAt: z.ZodNullable<z.ZodString>;
722
+ participantIds: z.ZodArray<z.ZodString>;
723
+ }, z.core.$strip>>;
724
+ pinnedAt: z.ZodNullable<z.ZodString>;
725
+ pinnedBy: z.ZodNullable<z.ZodString>;
473
726
  createdAt: z.ZodString;
474
727
  editedAt: z.ZodNullable<z.ZodString>;
475
728
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -478,6 +731,175 @@ export declare const SendMessageResponse: z.ZodObject<{
478
731
  status: z.ZodLiteral<"sent">;
479
732
  }, z.core.$strip>;
480
733
  export type SendMessageResponse = z.infer<typeof SendMessageResponse>;
734
+ export declare const MessageSearchResult: z.ZodObject<{
735
+ items: z.ZodArray<z.ZodObject<{
736
+ id: z.ZodUUID;
737
+ conversationId: z.ZodUUID;
738
+ seq: z.ZodNumber;
739
+ senderId: z.ZodString;
740
+ clientMessageId: z.ZodString;
741
+ kind: z.ZodEnum<{
742
+ system: "system";
743
+ text: "text";
744
+ }>;
745
+ body: z.ZodNullable<z.ZodString>;
746
+ attachments: z.ZodArray<z.ZodObject<{
747
+ id: z.ZodUUID;
748
+ fileName: z.ZodString;
749
+ mediaType: z.ZodString;
750
+ size: z.ZodNumber;
751
+ status: z.ZodEnum<{
752
+ pending: "pending";
753
+ ready: "ready";
754
+ rejected: "rejected";
755
+ }>;
756
+ scanStatus: z.ZodOptional<z.ZodEnum<{
757
+ clean: "clean";
758
+ failed: "failed";
759
+ infected: "infected";
760
+ not_scanned: "not_scanned";
761
+ pending: "pending";
762
+ rejected: "rejected";
763
+ }>>;
764
+ }, z.core.$strip>>;
765
+ reactions: z.ZodArray<z.ZodObject<{
766
+ userId: z.ZodString;
767
+ emoji: z.ZodString;
768
+ }, z.core.$strip>>;
769
+ mentions: z.ZodArray<z.ZodString>;
770
+ parentMessageId: z.ZodNullable<z.ZodString>;
771
+ thread: z.ZodNullable<z.ZodObject<{
772
+ replyCount: z.ZodNumber;
773
+ lastReplyAt: z.ZodNullable<z.ZodString>;
774
+ participantIds: z.ZodArray<z.ZodString>;
775
+ }, z.core.$strip>>;
776
+ pinnedAt: z.ZodNullable<z.ZodString>;
777
+ pinnedBy: z.ZodNullable<z.ZodString>;
778
+ createdAt: z.ZodString;
779
+ editedAt: z.ZodNullable<z.ZodString>;
780
+ deletedAt: z.ZodNullable<z.ZodString>;
781
+ }, z.core.$strip>>;
782
+ nextCursor: z.ZodNullable<z.ZodString>;
783
+ }, z.core.$strip>;
784
+ export type MessageSearchResult = z.infer<typeof MessageSearchResult>;
785
+ export declare const PinnedMessages: z.ZodObject<{
786
+ items: z.ZodArray<z.ZodObject<{
787
+ id: z.ZodUUID;
788
+ conversationId: z.ZodUUID;
789
+ seq: z.ZodNumber;
790
+ senderId: z.ZodString;
791
+ clientMessageId: z.ZodString;
792
+ kind: z.ZodEnum<{
793
+ system: "system";
794
+ text: "text";
795
+ }>;
796
+ body: z.ZodNullable<z.ZodString>;
797
+ attachments: z.ZodArray<z.ZodObject<{
798
+ id: z.ZodUUID;
799
+ fileName: z.ZodString;
800
+ mediaType: z.ZodString;
801
+ size: z.ZodNumber;
802
+ status: z.ZodEnum<{
803
+ pending: "pending";
804
+ ready: "ready";
805
+ rejected: "rejected";
806
+ }>;
807
+ scanStatus: z.ZodOptional<z.ZodEnum<{
808
+ clean: "clean";
809
+ failed: "failed";
810
+ infected: "infected";
811
+ not_scanned: "not_scanned";
812
+ pending: "pending";
813
+ rejected: "rejected";
814
+ }>>;
815
+ }, z.core.$strip>>;
816
+ reactions: z.ZodArray<z.ZodObject<{
817
+ userId: z.ZodString;
818
+ emoji: z.ZodString;
819
+ }, z.core.$strip>>;
820
+ mentions: z.ZodArray<z.ZodString>;
821
+ parentMessageId: z.ZodNullable<z.ZodString>;
822
+ thread: z.ZodNullable<z.ZodObject<{
823
+ replyCount: z.ZodNumber;
824
+ lastReplyAt: z.ZodNullable<z.ZodString>;
825
+ participantIds: z.ZodArray<z.ZodString>;
826
+ }, z.core.$strip>>;
827
+ pinnedAt: z.ZodNullable<z.ZodString>;
828
+ pinnedBy: z.ZodNullable<z.ZodString>;
829
+ createdAt: z.ZodString;
830
+ editedAt: z.ZodNullable<z.ZodString>;
831
+ deletedAt: z.ZodNullable<z.ZodString>;
832
+ }, z.core.$strip>>;
833
+ }, z.core.$strip>;
834
+ export type PinnedMessages = z.infer<typeof PinnedMessages>;
835
+ /** Stable ID from the system you migrate from; becomes the message's `clientMessageId`. */
836
+ export declare const ExternalId: z.ZodString;
837
+ export declare const ImportMessage: z.ZodObject<{
838
+ externalId: z.ZodString;
839
+ senderId: z.ZodString;
840
+ kind: z.ZodDefault<z.ZodEnum<{
841
+ system: "system";
842
+ text: "text";
843
+ }>>;
844
+ text: z.ZodDefault<z.ZodString>;
845
+ createdAt: z.ZodISODateTime;
846
+ editedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
847
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
848
+ parentExternalId: z.ZodOptional<z.ZodString>;
849
+ mentions: z.ZodDefault<z.ZodArray<z.ZodString>>;
850
+ attachmentIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
851
+ reactions: z.ZodDefault<z.ZodArray<z.ZodObject<{
852
+ userId: z.ZodString;
853
+ emoji: z.ZodString;
854
+ }, z.core.$strip>>>;
855
+ pinnedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
856
+ pinnedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
857
+ }, z.core.$strip>;
858
+ export type ImportMessage = z.input<typeof ImportMessage>;
859
+ export declare const ImportMessagesRequest: z.ZodObject<{
860
+ messages: z.ZodArray<z.ZodObject<{
861
+ externalId: z.ZodString;
862
+ senderId: z.ZodString;
863
+ kind: z.ZodDefault<z.ZodEnum<{
864
+ system: "system";
865
+ text: "text";
866
+ }>>;
867
+ text: z.ZodDefault<z.ZodString>;
868
+ createdAt: z.ZodISODateTime;
869
+ editedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
870
+ deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
871
+ parentExternalId: z.ZodOptional<z.ZodString>;
872
+ mentions: z.ZodDefault<z.ZodArray<z.ZodString>>;
873
+ attachmentIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
874
+ reactions: z.ZodDefault<z.ZodArray<z.ZodObject<{
875
+ userId: z.ZodString;
876
+ emoji: z.ZodString;
877
+ }, z.core.$strip>>>;
878
+ pinnedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
879
+ pinnedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
880
+ }, z.core.$strip>>;
881
+ }, z.core.$strip>;
882
+ export type ImportMessagesRequest = z.input<typeof ImportMessagesRequest>;
883
+ export declare const ImportMessagesResponse: z.ZodObject<{
884
+ imported: z.ZodNumber;
885
+ existing: z.ZodNumber;
886
+ items: z.ZodArray<z.ZodObject<{
887
+ externalId: z.ZodString;
888
+ messageId: z.ZodUUID;
889
+ seq: z.ZodNumber;
890
+ status: z.ZodEnum<{
891
+ existing: "existing";
892
+ imported: "imported";
893
+ }>;
894
+ }, z.core.$strip>>;
895
+ lastSeq: z.ZodNumber;
896
+ }, z.core.$strip>;
897
+ export type ImportMessagesResponse = z.infer<typeof ImportMessagesResponse>;
898
+ /** Read position for a member, e.g. when importing; it only ever moves forward. */
899
+ export declare const ReadPositionRequest: z.ZodObject<{
900
+ seq: z.ZodNumber;
901
+ }, z.core.$strip>;
902
+ export type ReadPositionRequest = z.infer<typeof ReadPositionRequest>;
481
903
  export declare const UploadIntentRequest: z.ZodObject<{
482
904
  conversationId: z.ZodUUID;
483
905
  fileName: z.ZodString;
@@ -485,6 +907,16 @@ export declare const UploadIntentRequest: z.ZodObject<{
485
907
  mediaType: z.ZodString;
486
908
  }, z.core.$strip>;
487
909
  export type UploadIntentRequest = z.infer<typeof UploadIntentRequest>;
910
+ /** Service-key upload on behalf of a member (history import or server-generated files). */
911
+ export declare const ServiceUploadIntentRequest: z.ZodObject<{
912
+ conversationId: z.ZodUUID;
913
+ fileName: z.ZodString;
914
+ size: z.ZodNumber;
915
+ mediaType: z.ZodString;
916
+ uploaderId: z.ZodString;
917
+ sha256: z.ZodOptional<z.ZodString>;
918
+ }, z.core.$strip>;
919
+ export type ServiceUploadIntentRequest = z.infer<typeof ServiceUploadIntentRequest>;
488
920
  export declare const UploadIntentResponse: z.ZodObject<{
489
921
  attachment: z.ZodObject<{
490
922
  id: z.ZodUUID;
@@ -547,6 +979,31 @@ export declare const Presence: z.ZodObject<{
547
979
  lastSeenAt: z.ZodNullable<z.ZodString>;
548
980
  }, z.core.$strip>;
549
981
  export type Presence = z.infer<typeof Presence>;
982
+ /** Service-key status change, e.g. to apply a do-not-disturb preference kept by your product. */
983
+ export declare const SetPresenceStatusRequest: z.ZodObject<{
984
+ tenantId: z.ZodDefault<z.ZodString>;
985
+ status: z.ZodEnum<{
986
+ available: "available";
987
+ away: "away";
988
+ busy: "busy";
989
+ dnd: "dnd";
990
+ invisible: "invisible";
991
+ }>;
992
+ }, z.core.$strip>;
993
+ export type SetPresenceStatusRequest = z.input<typeof SetPresenceStatusRequest>;
994
+ /**
995
+ * Ends a user's realtime sessions and invalidates messaging tokens issued before now. Narrow it to
996
+ * one tenant and/or one device; omit both for every session of the user in the environment.
997
+ */
998
+ export declare const RevokeSessionsRequest: z.ZodObject<{
999
+ tenantId: z.ZodOptional<z.ZodString>;
1000
+ deviceId: z.ZodOptional<z.ZodString>;
1001
+ }, z.core.$strip>;
1002
+ export type RevokeSessionsRequest = z.input<typeof RevokeSessionsRequest>;
1003
+ export declare const RemoveTenantMemberResponse: z.ZodObject<{
1004
+ conversations: z.ZodNumber;
1005
+ }, z.core.$strip>;
1006
+ export type RemoveTenantMemberResponse = z.infer<typeof RemoveTenantMemberResponse>;
550
1007
  export declare const ConsoleRole: z.ZodEnum<{
551
1008
  admin: "admin";
552
1009
  auditor: "auditor";
@@ -559,8 +1016,10 @@ export declare const EnvironmentName: z.ZodEnum<{
559
1016
  staging: "staging";
560
1017
  }>;
561
1018
  export type EnvironmentName = z.infer<typeof EnvironmentName>;
1019
+ /** `messaging:import` (history import) is never granted by default; add it to a dedicated key. */
562
1020
  export declare const ServiceScope: z.ZodEnum<{
563
1021
  "calls:write": "calls:write";
1022
+ "messaging:import": "messaging:import";
564
1023
  "messaging:write": "messaging:write";
565
1024
  "users:write": "users:write";
566
1025
  }>;
@@ -583,7 +1042,7 @@ export declare const CreateEnvironmentRequest: z.ZodObject<{
583
1042
  production: "production";
584
1043
  staging: "staging";
585
1044
  }>;
586
- allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodURL>>;
1045
+ allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
587
1046
  webhookUrl: z.ZodDefault<z.ZodNullable<z.ZodURL>>;
588
1047
  livekitKeyRef: z.ZodString;
589
1048
  pushCredentialRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -608,6 +1067,7 @@ export declare const CreateEnvironmentRequest: z.ZodObject<{
608
1067
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
609
1068
  allowThreads: z.ZodDefault<z.ZodBoolean>;
610
1069
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1070
+ allowPins: z.ZodDefault<z.ZodBoolean>;
611
1071
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
612
1072
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
613
1073
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -619,7 +1079,7 @@ export declare const PatchEnvironmentRequest: z.ZodObject<{
619
1079
  active: "active";
620
1080
  disabled: "disabled";
621
1081
  }>>;
622
- allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodURL>>;
1082
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
623
1083
  webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
624
1084
  livekitKeyRef: z.ZodOptional<z.ZodString>;
625
1085
  pushCredentialRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -644,6 +1104,7 @@ export declare const PatchEnvironmentRequest: z.ZodObject<{
644
1104
  allowAttachments: z.ZodOptional<z.ZodBoolean>;
645
1105
  allowThreads: z.ZodOptional<z.ZodBoolean>;
646
1106
  allowReactions: z.ZodOptional<z.ZodBoolean>;
1107
+ allowPins: z.ZodOptional<z.ZodBoolean>;
647
1108
  maxAttachmentBytes: z.ZodOptional<z.ZodNumber>;
648
1109
  allowedAttachmentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
649
1110
  retentionDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -655,6 +1116,7 @@ export declare const CreateKeyRequest: z.ZodObject<{
655
1116
  displayName: z.ZodString;
656
1117
  scopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
657
1118
  "calls:write": "calls:write";
1119
+ "messaging:import": "messaging:import";
658
1120
  "messaging:write": "messaging:write";
659
1121
  "users:write": "users:write";
660
1122
  }>>>;
@@ -714,6 +1176,7 @@ export declare const Environment: z.ZodObject<{
714
1176
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
715
1177
  allowThreads: z.ZodDefault<z.ZodBoolean>;
716
1178
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1179
+ allowPins: z.ZodDefault<z.ZodBoolean>;
717
1180
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
718
1181
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
719
1182
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -768,6 +1231,7 @@ export declare const Project: z.ZodObject<{
768
1231
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
769
1232
  allowThreads: z.ZodDefault<z.ZodBoolean>;
770
1233
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1234
+ allowPins: z.ZodDefault<z.ZodBoolean>;
771
1235
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
772
1236
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
773
1237
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -892,6 +1356,12 @@ export declare const AdminMe: z.ZodObject<{
892
1356
  }, z.core.$strip>>;
893
1357
  }, z.core.$strip>;
894
1358
  export type AdminMe = z.infer<typeof AdminMe>;
1359
+ /** Names (never values) of the credential references this deployment can assign to environments. */
1360
+ export declare const DeploymentOptions: z.ZodObject<{
1361
+ livekitKeyRefs: z.ZodArray<z.ZodString>;
1362
+ pushCredentialRefs: z.ZodArray<z.ZodString>;
1363
+ }, z.core.$strip>;
1364
+ export type DeploymentOptions = z.infer<typeof DeploymentOptions>;
895
1365
  /** One of the signed-in console user's own sessions. `id` identifies it for revocation only. */
896
1366
  export declare const ConsoleSession: z.ZodObject<{
897
1367
  id: z.ZodString;
package/dist/schemas.js CHANGED
@@ -32,6 +32,8 @@ const ProductMessagingPolicy = z.object({
32
32
  allowAttachments: z.boolean().default(false),
33
33
  allowThreads: z.boolean().default(false),
34
34
  allowReactions: z.boolean().default(true),
35
+ /** Members (not viewers) may pin and unpin messages. */
36
+ allowPins: z.boolean().default(true),
35
37
  maxAttachmentBytes: z.number().int().min(1).max(5 * 1024 ** 3).default(25 * 1024 ** 2),
36
38
  allowedAttachmentTypes: z.array(z.string().regex(/^[a-z]+\/[a-z0-9.+*-]+$/i)).max(50).default([
37
39
  "image/*",
@@ -63,7 +65,13 @@ const CreateCallRequest = z.object({
63
65
  * Clients will encrypt media end to end with a key the server never sees. Lynkoria records the
64
66
  * flag and refuses server-side recording/streaming for the call; it does not distribute keys.
65
67
  */
66
- e2ee: z.boolean().default(false)
68
+ e2ee: z.boolean().default(false),
69
+ /**
70
+ * When a call with this productCallId already ended, start a new call (new `id`, same
71
+ * productCallId) instead of returning 409. Use it for persistent rooms such as a meeting link
72
+ * that people rejoin; leave it off when a retry must never reopen a finished call.
73
+ */
74
+ restartIfEnded: z.boolean().default(false)
67
75
  });
68
76
  const Call = z.object({
69
77
  id: Uuid,
@@ -77,11 +85,27 @@ const Call = z.object({
77
85
  createdAt: z.string(),
78
86
  endedAt: z.string().nullable()
79
87
  });
88
+ const PublishSource = z.enum([
89
+ "camera",
90
+ "microphone",
91
+ "screen_share",
92
+ "screen_share_audio"
93
+ ]);
80
94
  const JoinTokenRequest = z.object({
81
95
  userId: ProductId,
82
96
  deviceId: ProductId,
83
97
  displayName: z.string().trim().min(1).max(128),
84
- role: ParticipantRole.default("participant")
98
+ role: ParticipantRole.default("participant"),
99
+ /**
100
+ * Seconds the token can be used to connect (30–300, default 300). A connected participant stays
101
+ * connected; remove them with `removeParticipant`/`removeUser` when access ends.
102
+ */
103
+ ttlSeconds: z.number().int().min(30).max(300).optional(),
104
+ /**
105
+ * Restricts what this participant may publish, e.g. `["camera","microphone"]` to forbid screen
106
+ * sharing. Omit to allow every source the role permits. Viewers never publish.
107
+ */
108
+ publishSources: z.array(PublishSource).min(1).max(4).optional()
85
109
  });
86
110
  const JoinTokenResponse = z.object({
87
111
  url: z.string(),
@@ -89,6 +113,9 @@ const JoinTokenResponse = z.object({
89
113
  identity: z.string(),
90
114
  expiresAt: z.string()
91
115
  });
116
+ const RemoveUserResponse = z.object({
117
+ /** Devices that were connected and have been removed (0 if the user was not in the call). */
118
+ removed: z.number().int() });
92
119
  const UpdatePermissionsRequest = z.object({ role: z.enum([
93
120
  "host",
94
121
  "speaker",
@@ -109,14 +136,27 @@ const CallSignalRequest = z.object({
109
136
  fromUserId: ProductId.optional(),
110
137
  data: z.record(z.string(), z.unknown()).optional()
111
138
  });
139
+ /**
140
+ * Optional capabilities of a messaging token beyond the user's own conversations. Omit `scopes` to
141
+ * grant every capability the environment enables; pass a subset to restrict a token, e.g. `[]` for a
142
+ * guest who may only use the conversations they were added to.
143
+ */
144
+ const MessagingTokenScope = z.enum(["presence", "public_conversations"]);
112
145
  const MessagingTokenRequest = z.object({
113
146
  userId: ProductId,
114
147
  deviceId: ProductId,
115
- tenantId: TenantId
148
+ tenantId: TenantId,
149
+ /**
150
+ * `presence`: publish this device's presence and watch others in the tenant. `public_conversations`:
151
+ * read and search conversations with `visibility: "public"` in the tenant without being a member.
152
+ */
153
+ scopes: z.array(MessagingTokenScope).max(2).optional()
116
154
  });
117
155
  const MessagingTokenResponse = z.object({
118
156
  token: z.string(),
119
- expiresAt: z.string()
157
+ expiresAt: z.string(),
158
+ /** The API origin clients use with this token; return it to the client unchanged. */
159
+ apiUrl: z.string()
120
160
  });
121
161
  const ConversationType = z.enum([
122
162
  "dm",
@@ -124,24 +164,110 @@ const ConversationType = z.enum([
124
164
  "channel",
125
165
  "session"
126
166
  ]);
167
+ /**
168
+ * `private`: only members read it. `public`: any user of the same tenant whose token has the
169
+ * `public_conversations` scope can read and search it; posting still requires membership.
170
+ */
171
+ const ConversationVisibility = z.enum(["private", "public"]);
172
+ /**
173
+ * `owner` and `admin` are labels your backend assigns and reads back; Lynkoria enforces only
174
+ * `viewer` (read, mark read, no posting, reacting or pinning).
175
+ */
176
+ const MemberRole = z.enum([
177
+ "owner",
178
+ "admin",
179
+ "member",
180
+ "viewer"
181
+ ]);
182
+ /** A member's own choice of which messages count for notifications and badges. */
183
+ const NotificationLevel = z.enum([
184
+ "all",
185
+ "mentions",
186
+ "none"
187
+ ]);
188
+ /**
189
+ * Small product-defined key/value data (at most 32 keys, scalar values). Never put secrets or
190
+ * personal data here: every member can read it.
191
+ */
192
+ const Metadata = z.record(z.string().regex(/^[A-Za-z0-9_.-]{1,64}$/), z.union([
193
+ z.string().max(1024),
194
+ z.number(),
195
+ z.boolean(),
196
+ z.null()
197
+ ])).refine((v) => Object.keys(v).length <= 32, "at most 32 metadata keys");
127
198
  const CreateConversationRequest = z.object({
128
199
  tenantId: TenantId,
129
200
  type: ConversationType,
130
201
  productConversationId: ProductId.optional(),
131
202
  title: z.string().trim().max(200).optional(),
132
- memberIds: z.array(ProductId).min(1).max(1e3)
203
+ description: z.string().trim().max(2e3).optional(),
204
+ metadata: Metadata.optional(),
205
+ visibility: ConversationVisibility.default("private"),
206
+ memberIds: z.array(ProductId).min(1).max(1e3),
207
+ /** Roles for some of `memberIds`; others join as `member`. */
208
+ roles: z.record(ProductId, MemberRole).optional()
209
+ });
210
+ /** Service-key update of a conversation; every field is optional and omitted fields are unchanged. */
211
+ const UpdateConversationRequest = z.object({
212
+ title: z.string().trim().max(200).nullable().optional(),
213
+ description: z.string().trim().max(2e3).nullable().optional(),
214
+ /** Replaces the whole metadata object. */
215
+ metadata: Metadata.optional(),
216
+ visibility: ConversationVisibility.optional(),
217
+ /** Archived conversations stay readable but accept no new messages, edits, reactions or pins. */
218
+ archived: z.boolean().optional()
219
+ }).refine((v) => Object.keys(v).length > 0, "At least one field is required");
220
+ const MembersRequest = z.object({
221
+ userIds: z.array(ProductId).min(1).max(1e3),
222
+ /** Role for added users; existing members keep their role unless it is given. */
223
+ role: MemberRole.optional()
224
+ });
225
+ const SetMemberRoleRequest = z.object({ role: MemberRole });
226
+ const ConversationMember = z.object({
227
+ userId: z.string(),
228
+ role: MemberRole,
229
+ joinedAt: z.string(),
230
+ readSeq: z.number().int()
231
+ });
232
+ const ConversationMemberPage = z.object({
233
+ items: z.array(ConversationMember),
234
+ nextCursor: z.string().nullable()
133
235
  });
134
- const MembersRequest = z.object({ userIds: z.array(ProductId).min(1).max(1e3) });
236
+ const NotificationLevelRequest = z.object({ level: NotificationLevel });
135
237
  const Conversation = z.object({
136
238
  id: Uuid,
137
239
  tenantId: z.string(),
138
240
  type: ConversationType,
139
241
  productConversationId: z.string().nullable(),
140
242
  title: z.string().nullable(),
243
+ description: z.string().nullable(),
244
+ metadata: z.record(z.string(), z.unknown()),
245
+ visibility: ConversationVisibility,
246
+ archivedAt: z.string().nullable(),
247
+ memberCount: z.number().int(),
248
+ /** The two members of a `dm`; omitted for other types (list members instead). */
249
+ memberIds: z.array(z.string()).optional(),
250
+ /** Up to 5 active members, earliest joined first, for avatars in conversation lists. */
251
+ memberPreview: z.array(z.string()),
252
+ /** The newest message that is not deleted, with its text cut to 200 characters. */
253
+ lastMessage: z.object({
254
+ id: Uuid,
255
+ senderId: z.string(),
256
+ body: z.string().nullable(),
257
+ hasAttachments: z.boolean(),
258
+ createdAt: z.string()
259
+ }).nullable(),
141
260
  lastSeq: z.number().int(),
142
261
  lastMessageAt: z.string().nullable(),
143
262
  createdAt: z.string(),
144
- readSeq: z.number().int().optional()
263
+ readSeq: z.number().int().optional(),
264
+ /** Null when the user reads a public conversation without being a member. */
265
+ role: MemberRole.nullable().optional(),
266
+ notificationLevel: NotificationLevel.optional(),
267
+ /** Other users' messages after `readSeq` that are not deleted, capped at 1000. */
268
+ unreadCount: z.number().int().optional(),
269
+ /** Unread messages that mention the user, capped at 1000. */
270
+ mentionCount: z.number().int().optional()
145
271
  });
146
272
  const ConversationList = z.object({
147
273
  items: z.array(Conversation),
@@ -169,19 +295,33 @@ const Attachment = z.object({
169
295
  status: AttachmentStatus,
170
296
  scanStatus: AttachmentScanStatus.optional()
171
297
  });
298
+ /** User IDs a message mentions. Each must be a current member of the conversation. */
299
+ const Mentions = z.array(ProductId).max(50);
172
300
  const SendMessageRequest = z.object({
173
301
  clientMessageId: z.string().regex(/^[A-Za-z0-9_-]{8,64}$/),
174
302
  text: z.string().max(65536).default(""),
175
303
  attachmentIds: z.array(Uuid).max(10).default([]),
176
- parentMessageId: Uuid.optional()
304
+ parentMessageId: Uuid.optional(),
305
+ mentions: Mentions.default([])
306
+ });
307
+ const EditMessageRequest = z.object({
308
+ text: z.string().min(1).max(65536),
309
+ /** Replaces the mentions when given; omitted keeps them. */
310
+ mentions: Mentions.optional()
177
311
  });
178
- const EditMessageRequest = z.object({ text: z.string().min(1).max(65536) });
179
312
  const ReadRequest = z.object({ seq: z.number().int().min(0) });
180
313
  const ReactionRequest = z.object({ emoji: z.string().min(1).max(32) });
181
314
  const Reaction = z.object({
182
315
  userId: z.string(),
183
316
  emoji: z.string()
184
317
  });
318
+ /** Replies to a top-level message. */
319
+ const ThreadSummary = z.object({
320
+ replyCount: z.number().int(),
321
+ lastReplyAt: z.string().nullable(),
322
+ /** Up to 5 most recent distinct repliers, newest first. */
323
+ participantIds: z.array(z.string())
324
+ });
185
325
  const Message = z.object({
186
326
  id: Uuid,
187
327
  conversationId: Uuid,
@@ -192,7 +332,12 @@ const Message = z.object({
192
332
  body: z.string().nullable(),
193
333
  attachments: z.array(Attachment),
194
334
  reactions: z.array(Reaction),
335
+ mentions: z.array(z.string()),
195
336
  parentMessageId: z.string().nullable(),
337
+ /** Null for replies and for messages without replies. */
338
+ thread: ThreadSummary.nullable(),
339
+ pinnedAt: z.string().nullable(),
340
+ pinnedBy: z.string().nullable(),
196
341
  createdAt: z.string(),
197
342
  editedAt: z.string().nullable(),
198
343
  deletedAt: z.string().nullable()
@@ -201,6 +346,8 @@ const ConversationEventType = z.enum([
201
346
  "message.created",
202
347
  "message.updated",
203
348
  "message.deleted",
349
+ "message.pinned",
350
+ "message.unpinned",
204
351
  "reaction.added",
205
352
  "reaction.removed"
206
353
  ]);
@@ -214,6 +361,8 @@ const ConversationEvent = z.object({
214
361
  type: ConversationEventType,
215
362
  message: Message,
216
363
  reaction: Reaction.nullable(),
364
+ /** Who caused the change (sender, editor, reactor or pinner); null for imported history. */
365
+ actorId: z.string().nullable(),
217
366
  createdAt: z.string()
218
367
  });
219
368
  const ConversationEventPage = z.object({
@@ -226,12 +375,63 @@ const SendMessageResponse = z.object({
226
375
  created: z.boolean(),
227
376
  status: z.literal("sent")
228
377
  });
378
+ const MessageSearchResult = z.object({
379
+ items: z.array(Message),
380
+ nextCursor: z.string().nullable()
381
+ });
382
+ const PinnedMessages = z.object({ items: z.array(Message) });
383
+ /** Stable ID from the system you migrate from; becomes the message's `clientMessageId`. */
384
+ const ExternalId = z.string().regex(/^[A-Za-z0-9_-]{8,64}$/);
385
+ const ImportMessage = z.object({
386
+ externalId: ExternalId,
387
+ senderId: ProductId,
388
+ kind: z.enum(["text", "system"]).default("text"),
389
+ text: z.string().max(65536).default(""),
390
+ createdAt: z.iso.datetime({ offset: true }),
391
+ editedAt: z.iso.datetime({ offset: true }).nullable().optional(),
392
+ /** Deleted messages keep their place in the history without a body. */
393
+ deletedAt: z.iso.datetime({ offset: true }).nullable().optional(),
394
+ /** `externalId` of an earlier imported top-level message in the same conversation. */
395
+ parentExternalId: ExternalId.optional(),
396
+ mentions: Mentions.default([]),
397
+ /** Ready attachments created with the import upload intent for this sender and conversation. */
398
+ attachmentIds: z.array(Uuid).max(10).default([]),
399
+ reactions: z.array(z.object({
400
+ userId: ProductId,
401
+ emoji: z.string().min(1).max(32)
402
+ })).max(500).default([]),
403
+ pinnedAt: z.iso.datetime({ offset: true }).nullable().optional(),
404
+ pinnedBy: ProductId.nullable().optional()
405
+ });
406
+ const ImportMessagesRequest = z.object({
407
+ /** Oldest first. Each batch must start at or after the conversation's newest message. */
408
+ messages: z.array(ImportMessage).min(1).max(200) });
409
+ const ImportMessagesResponse = z.object({
410
+ imported: z.number().int(),
411
+ /** Already imported earlier (same sender and externalId): skipped, so retries are safe. */
412
+ existing: z.number().int(),
413
+ items: z.array(z.object({
414
+ externalId: z.string(),
415
+ messageId: Uuid,
416
+ seq: z.number().int(),
417
+ status: z.enum(["imported", "existing"])
418
+ })),
419
+ lastSeq: z.number().int()
420
+ });
421
+ /** Read position for a member, e.g. when importing; it only ever moves forward. */
422
+ const ReadPositionRequest = z.object({ seq: z.number().int().min(0) });
229
423
  const UploadIntentRequest = z.object({
230
424
  conversationId: Uuid,
231
425
  fileName: z.string().trim().min(1).max(255),
232
426
  size: z.number().int().min(1),
233
427
  mediaType: z.string().regex(/^[a-z]+\/[a-z0-9.+-]+$/i)
234
428
  });
429
+ /** Service-key upload on behalf of a member (history import or server-generated files). */
430
+ const ServiceUploadIntentRequest = UploadIntentRequest.extend({
431
+ uploaderId: ProductId,
432
+ /** Hex SHA-256 of the file; completion rejects an upload whose bytes do not match. */
433
+ sha256: z.string().regex(/^[a-f0-9]{64}$/).optional()
434
+ });
235
435
  const UploadIntentResponse = z.object({
236
436
  attachment: Attachment,
237
437
  uploadUrl: z.string(),
@@ -262,6 +462,22 @@ const Presence = z.object({
262
462
  status: PresenceStatus,
263
463
  lastSeenAt: z.string().nullable()
264
464
  });
465
+ /** Service-key status change, e.g. to apply a do-not-disturb preference kept by your product. */
466
+ const SetPresenceStatusRequest = z.object({
467
+ tenantId: TenantId,
468
+ status: ManualStatus
469
+ });
470
+ /**
471
+ * Ends a user's realtime sessions and invalidates messaging tokens issued before now. Narrow it to
472
+ * one tenant and/or one device; omit both for every session of the user in the environment.
473
+ */
474
+ const RevokeSessionsRequest = z.object({
475
+ tenantId: ProductId.optional(),
476
+ deviceId: ProductId.optional()
477
+ });
478
+ const RemoveTenantMemberResponse = z.object({
479
+ /** Conversations the user was removed from. */
480
+ conversations: z.number().int() });
265
481
  const ConsoleRole = z.enum([
266
482
  "owner",
267
483
  "admin",
@@ -269,12 +485,27 @@ const ConsoleRole = z.enum([
269
485
  "auditor"
270
486
  ]);
271
487
  const EnvironmentName = z.enum(["staging", "production"]);
488
+ /** `messaging:import` (history import) is never granted by default; add it to a dedicated key. */
272
489
  const ServiceScope = z.enum([
273
490
  "calls:write",
274
491
  "messaging:write",
275
- "users:write"
492
+ "users:write",
493
+ "messaging:import"
276
494
  ]);
277
- const Origin = z.url({ protocol: /^https?$/ }).refine((v) => new URL(v).origin === v, "must be a bare origin");
495
+ /** Custom-scheme origin of a desktop or mobile app shell, e.g. `capacitor://localhost`. */
496
+ const APP_ORIGIN = /^(?!(?:javascript|vbscript|data|file|blob|about|ws|wss|ftp):)[a-z][a-z0-9+.-]*:\/\/[a-z0-9-]+(?:\.[a-z0-9-]+)*(?::\d{1,5})?$/;
497
+ /**
498
+ * A browser origin allowed to use client tokens: a bare web origin (`https://app.example.com`) or
499
+ * an app-shell origin (`capacitor://localhost`, `tauri://localhost`, an Electron `myapp://app`).
500
+ */
501
+ const Origin = z.string().max(200).refine((v) => {
502
+ if (/^https?:/.test(v)) try {
503
+ return new URL(v).origin === v;
504
+ } catch {
505
+ return false;
506
+ }
507
+ return APP_ORIGIN.test(v);
508
+ }, "must be a bare origin such as https://app.example.com or myapp://app");
278
509
  const CreateProjectRequest = z.object({
279
510
  slug: z.string().regex(/^[a-z][a-z0-9-]{1,30}$/),
280
511
  name: z.string().trim().min(1).max(100)
@@ -321,6 +552,7 @@ const PatchEnvironmentRequest = z.object({
321
552
  allowAttachments: ProductMessagingPolicy.shape.allowAttachments.removeDefault().optional(),
322
553
  allowThreads: ProductMessagingPolicy.shape.allowThreads.removeDefault().optional(),
323
554
  allowReactions: ProductMessagingPolicy.shape.allowReactions.removeDefault().optional(),
555
+ allowPins: ProductMessagingPolicy.shape.allowPins.removeDefault().optional(),
324
556
  maxAttachmentBytes: ProductMessagingPolicy.shape.maxAttachmentBytes.removeDefault().optional(),
325
557
  allowedAttachmentTypes: ProductMessagingPolicy.shape.allowedAttachmentTypes.removeDefault().optional(),
326
558
  retentionDays: ProductMessagingPolicy.shape.retentionDays.removeDefault().optional()
@@ -437,6 +669,11 @@ const AdminMe = z.object({
437
669
  projectId: z.string().nullable()
438
670
  }))
439
671
  });
672
+ /** Names (never values) of the credential references this deployment can assign to environments. */
673
+ const DeploymentOptions = z.object({
674
+ livekitKeyRefs: z.array(z.string()),
675
+ pushCredentialRefs: z.array(z.string())
676
+ });
440
677
  /** One of the signed-in console user's own sessions. `id` identifies it for revocation only. */
441
678
  const ConsoleSession = z.object({
442
679
  id: z.string(),
@@ -729,4 +966,4 @@ const OpsOverview = z.object({
729
966
  recordings: z.array(Recording),
730
967
  scans: ScanSummary
731
968
  });
732
- export { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationType, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, GrantRoleRequest, JoinTokenRequest, JoinTokenResponse, ManualStatus, MembersRequest, Message, MessagingTokenRequest, MessagingTokenResponse, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, StartRecordingRequest, TenantId, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret };
969
+ export { AdminCall, AdminCallDetail, AdminCallPage, AdminCallQuery, AdminMe, AdminParticipant, Attachment, AttachmentScanStatus, AttachmentStatus, AuditEvent, AuditPage, AuditQuery, Call, CallSignalRequest, CallSignalType, CallStatus, CallType, ConnectivityStatus, ConsoleRole, ConsoleSession, Conversation, ConversationEvent, ConversationEventPage, ConversationEventType, ConversationList, ConversationMember, ConversationMemberPage, ConversationType, ConversationVisibility, CreateCallRequest, CreateConversationRequest, CreateEnvironmentRequest, CreateKeyRequest, CreateProjectRequest, CreatedServiceKey, DeploymentOptions, DownloadUrlResponse, EditMessageRequest, Environment, EnvironmentLive, EnvironmentName, ExternalId, GrantRoleRequest, ImportMessage, ImportMessagesRequest, ImportMessagesResponse, JoinTokenRequest, JoinTokenResponse, ManualStatus, MemberRole, MembersRequest, Mentions, Message, MessageSearchResult, MessagingTokenRequest, MessagingTokenResponse, MessagingTokenScope, Metadata, NotificationLevel, NotificationLevelRequest, NotificationPreferences, OpsOverview, OrganizationLive, ParticipantRole, PatchEnvironmentRequest, PatchProjectRequest, PinnedMessages, Presence, PresenceStatus, ProductId, ProductMessagingPolicy, Project, ProjectFeatures, ProjectLimits, ProjectLive, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadPositionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveTenantMemberResponse, RemoveUserResponse, RevokeSessionsRequest, RoleGrant, ScanSummary, SendMessageRequest, SendMessageResponse, SendNotificationRequest, SendNotificationResponse, ServiceKey, ServiceScope, ServiceUploadIntentRequest, SetMemberRoleRequest, SetPresenceStatusRequest, StartRecordingRequest, TenantId, ThreadSummary, UpdateConversationRequest, UpdatePermissionsRequest, UploadIntentRequest, UploadIntentResponse, UsageCounts, UsageQuery, UsageRow, UsageSeries, UsageSeriesQuery, Uuid, WebhookDelivery, WebhookEventPage, WebhookSecret };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynkoria/contracts",
3
- "version": "0.1.1",
3
+ "version": "0.4.0",
4
4
  "description": "Lynkoria shared contracts: Zod schemas, event names, error codes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",