@lynkoria/contracts 0.2.0 → 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
  {
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, DeploymentOptions, 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, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveUserResponse, 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, DeploymentOptions, 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, PublishSource, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveUserResponse, 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, DeploymentOptions, 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, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveUserResponse, 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, DeploymentOptions, 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, PublishSource, PushDeliveryView, PushDevice, PushPayloadKeys, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveUserResponse, 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>>;
@@ -155,10 +156,24 @@ export declare const CallSignalRequest: z.ZodObject<{
155
156
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
156
157
  }, z.core.$strip>;
157
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>;
158
169
  export declare const MessagingTokenRequest: z.ZodObject<{
159
170
  userId: z.ZodString;
160
171
  deviceId: z.ZodString;
161
172
  tenantId: z.ZodDefault<z.ZodString>;
173
+ scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
174
+ presence: "presence";
175
+ public_conversations: "public_conversations";
176
+ }>>>;
162
177
  }, z.core.$strip>;
163
178
  export type MessagingTokenRequest = z.input<typeof MessagingTokenRequest>;
164
179
  export declare const MessagingTokenResponse: z.ZodObject<{
@@ -174,6 +189,39 @@ export declare const ConversationType: z.ZodEnum<{
174
189
  session: "session";
175
190
  }>;
176
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>;
177
225
  export declare const CreateConversationRequest: z.ZodObject<{
178
226
  tenantId: z.ZodDefault<z.ZodString>;
179
227
  type: z.ZodEnum<{
@@ -184,13 +232,87 @@ export declare const CreateConversationRequest: z.ZodObject<{
184
232
  }>;
185
233
  productConversationId: z.ZodOptional<z.ZodString>;
186
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
+ }>>;
187
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
+ }>>>;
188
248
  }, z.core.$strip>;
189
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>;
190
262
  export declare const MembersRequest: z.ZodObject<{
191
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
+ }>;
192
314
  }, z.core.$strip>;
193
- export type MembersRequest = z.infer<typeof MembersRequest>;
315
+ export type NotificationLevelRequest = z.infer<typeof NotificationLevelRequest>;
194
316
  export declare const Conversation: z.ZodObject<{
195
317
  id: z.ZodUUID;
196
318
  tenantId: z.ZodString;
@@ -202,10 +324,40 @@ export declare const Conversation: z.ZodObject<{
202
324
  }>;
203
325
  productConversationId: z.ZodNullable<z.ZodString>;
204
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>>;
205
344
  lastSeq: z.ZodNumber;
206
345
  lastMessageAt: z.ZodNullable<z.ZodString>;
207
346
  createdAt: z.ZodString;
208
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>;
209
361
  }, z.core.$strip>;
210
362
  export type Conversation = z.infer<typeof Conversation>;
211
363
  export declare const ConversationList: z.ZodObject<{
@@ -220,10 +372,40 @@ export declare const ConversationList: z.ZodObject<{
220
372
  }>;
221
373
  productConversationId: z.ZodNullable<z.ZodString>;
222
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>>;
223
392
  lastSeq: z.ZodNumber;
224
393
  lastMessageAt: z.ZodNullable<z.ZodString>;
225
394
  createdAt: z.ZodString;
226
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>;
227
409
  }, z.core.$strip>>;
228
410
  nextCursor: z.ZodNullable<z.ZodString>;
229
411
  }, z.core.$strip>;
@@ -262,17 +444,21 @@ export declare const Attachment: z.ZodObject<{
262
444
  }>>;
263
445
  }, z.core.$strip>;
264
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>;
265
449
  export declare const SendMessageRequest: z.ZodObject<{
266
450
  clientMessageId: z.ZodString;
267
451
  text: z.ZodDefault<z.ZodString>;
268
452
  attachmentIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
269
453
  parentMessageId: z.ZodOptional<z.ZodUUID>;
454
+ mentions: z.ZodDefault<z.ZodArray<z.ZodString>>;
270
455
  }, z.core.$strip>;
271
456
  export type SendMessageRequest = z.input<typeof SendMessageRequest>;
272
457
  export declare const EditMessageRequest: z.ZodObject<{
273
458
  text: z.ZodString;
459
+ mentions: z.ZodOptional<z.ZodArray<z.ZodString>>;
274
460
  }, z.core.$strip>;
275
- export type EditMessageRequest = z.infer<typeof EditMessageRequest>;
461
+ export type EditMessageRequest = z.input<typeof EditMessageRequest>;
276
462
  export declare const ReadRequest: z.ZodObject<{
277
463
  seq: z.ZodNumber;
278
464
  }, z.core.$strip>;
@@ -286,6 +472,13 @@ export declare const Reaction: z.ZodObject<{
286
472
  emoji: z.ZodString;
287
473
  }, z.core.$strip>;
288
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>;
289
482
  export declare const Message: z.ZodObject<{
290
483
  id: z.ZodUUID;
291
484
  conversationId: z.ZodUUID;
@@ -320,7 +513,15 @@ export declare const Message: z.ZodObject<{
320
513
  userId: z.ZodString;
321
514
  emoji: z.ZodString;
322
515
  }, z.core.$strip>>;
516
+ mentions: z.ZodArray<z.ZodString>;
323
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>;
324
525
  createdAt: z.ZodString;
325
526
  editedAt: z.ZodNullable<z.ZodString>;
326
527
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -329,6 +530,8 @@ export type Message = z.infer<typeof Message>;
329
530
  export declare const ConversationEventType: z.ZodEnum<{
330
531
  "message.created": "message.created";
331
532
  "message.deleted": "message.deleted";
533
+ "message.pinned": "message.pinned";
534
+ "message.unpinned": "message.unpinned";
332
535
  "message.updated": "message.updated";
333
536
  "reaction.added": "reaction.added";
334
537
  "reaction.removed": "reaction.removed";
@@ -344,6 +547,8 @@ export declare const ConversationEvent: z.ZodObject<{
344
547
  type: z.ZodEnum<{
345
548
  "message.created": "message.created";
346
549
  "message.deleted": "message.deleted";
550
+ "message.pinned": "message.pinned";
551
+ "message.unpinned": "message.unpinned";
347
552
  "message.updated": "message.updated";
348
553
  "reaction.added": "reaction.added";
349
554
  "reaction.removed": "reaction.removed";
@@ -382,7 +587,15 @@ export declare const ConversationEvent: z.ZodObject<{
382
587
  userId: z.ZodString;
383
588
  emoji: z.ZodString;
384
589
  }, z.core.$strip>>;
590
+ mentions: z.ZodArray<z.ZodString>;
385
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>;
386
599
  createdAt: z.ZodString;
387
600
  editedAt: z.ZodNullable<z.ZodString>;
388
601
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -391,6 +604,7 @@ export declare const ConversationEvent: z.ZodObject<{
391
604
  userId: z.ZodString;
392
605
  emoji: z.ZodString;
393
606
  }, z.core.$strip>>;
607
+ actorId: z.ZodNullable<z.ZodString>;
394
608
  createdAt: z.ZodString;
395
609
  }, z.core.$strip>;
396
610
  export type ConversationEvent = z.infer<typeof ConversationEvent>;
@@ -401,6 +615,8 @@ export declare const ConversationEventPage: z.ZodObject<{
401
615
  type: z.ZodEnum<{
402
616
  "message.created": "message.created";
403
617
  "message.deleted": "message.deleted";
618
+ "message.pinned": "message.pinned";
619
+ "message.unpinned": "message.unpinned";
404
620
  "message.updated": "message.updated";
405
621
  "reaction.added": "reaction.added";
406
622
  "reaction.removed": "reaction.removed";
@@ -439,7 +655,15 @@ export declare const ConversationEventPage: z.ZodObject<{
439
655
  userId: z.ZodString;
440
656
  emoji: z.ZodString;
441
657
  }, z.core.$strip>>;
658
+ mentions: z.ZodArray<z.ZodString>;
442
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>;
443
667
  createdAt: z.ZodString;
444
668
  editedAt: z.ZodNullable<z.ZodString>;
445
669
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -448,6 +672,7 @@ export declare const ConversationEventPage: z.ZodObject<{
448
672
  userId: z.ZodString;
449
673
  emoji: z.ZodString;
450
674
  }, z.core.$strip>>;
675
+ actorId: z.ZodNullable<z.ZodString>;
451
676
  createdAt: z.ZodString;
452
677
  }, z.core.$strip>>;
453
678
  lastSeq: z.ZodNumber;
@@ -489,7 +714,15 @@ export declare const SendMessageResponse: z.ZodObject<{
489
714
  userId: z.ZodString;
490
715
  emoji: z.ZodString;
491
716
  }, z.core.$strip>>;
717
+ mentions: z.ZodArray<z.ZodString>;
492
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>;
493
726
  createdAt: z.ZodString;
494
727
  editedAt: z.ZodNullable<z.ZodString>;
495
728
  deletedAt: z.ZodNullable<z.ZodString>;
@@ -498,6 +731,175 @@ export declare const SendMessageResponse: z.ZodObject<{
498
731
  status: z.ZodLiteral<"sent">;
499
732
  }, z.core.$strip>;
500
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>;
501
903
  export declare const UploadIntentRequest: z.ZodObject<{
502
904
  conversationId: z.ZodUUID;
503
905
  fileName: z.ZodString;
@@ -505,6 +907,16 @@ export declare const UploadIntentRequest: z.ZodObject<{
505
907
  mediaType: z.ZodString;
506
908
  }, z.core.$strip>;
507
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>;
508
920
  export declare const UploadIntentResponse: z.ZodObject<{
509
921
  attachment: z.ZodObject<{
510
922
  id: z.ZodUUID;
@@ -567,6 +979,31 @@ export declare const Presence: z.ZodObject<{
567
979
  lastSeenAt: z.ZodNullable<z.ZodString>;
568
980
  }, z.core.$strip>;
569
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>;
570
1007
  export declare const ConsoleRole: z.ZodEnum<{
571
1008
  admin: "admin";
572
1009
  auditor: "auditor";
@@ -579,8 +1016,10 @@ export declare const EnvironmentName: z.ZodEnum<{
579
1016
  staging: "staging";
580
1017
  }>;
581
1018
  export type EnvironmentName = z.infer<typeof EnvironmentName>;
1019
+ /** `messaging:import` (history import) is never granted by default; add it to a dedicated key. */
582
1020
  export declare const ServiceScope: z.ZodEnum<{
583
1021
  "calls:write": "calls:write";
1022
+ "messaging:import": "messaging:import";
584
1023
  "messaging:write": "messaging:write";
585
1024
  "users:write": "users:write";
586
1025
  }>;
@@ -603,7 +1042,7 @@ export declare const CreateEnvironmentRequest: z.ZodObject<{
603
1042
  production: "production";
604
1043
  staging: "staging";
605
1044
  }>;
606
- allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodURL>>;
1045
+ allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
607
1046
  webhookUrl: z.ZodDefault<z.ZodNullable<z.ZodURL>>;
608
1047
  livekitKeyRef: z.ZodString;
609
1048
  pushCredentialRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -628,6 +1067,7 @@ export declare const CreateEnvironmentRequest: z.ZodObject<{
628
1067
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
629
1068
  allowThreads: z.ZodDefault<z.ZodBoolean>;
630
1069
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1070
+ allowPins: z.ZodDefault<z.ZodBoolean>;
631
1071
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
632
1072
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
633
1073
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -639,7 +1079,7 @@ export declare const PatchEnvironmentRequest: z.ZodObject<{
639
1079
  active: "active";
640
1080
  disabled: "disabled";
641
1081
  }>>;
642
- allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodURL>>;
1082
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
643
1083
  webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
644
1084
  livekitKeyRef: z.ZodOptional<z.ZodString>;
645
1085
  pushCredentialRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -664,6 +1104,7 @@ export declare const PatchEnvironmentRequest: z.ZodObject<{
664
1104
  allowAttachments: z.ZodOptional<z.ZodBoolean>;
665
1105
  allowThreads: z.ZodOptional<z.ZodBoolean>;
666
1106
  allowReactions: z.ZodOptional<z.ZodBoolean>;
1107
+ allowPins: z.ZodOptional<z.ZodBoolean>;
667
1108
  maxAttachmentBytes: z.ZodOptional<z.ZodNumber>;
668
1109
  allowedAttachmentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
669
1110
  retentionDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -675,6 +1116,7 @@ export declare const CreateKeyRequest: z.ZodObject<{
675
1116
  displayName: z.ZodString;
676
1117
  scopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
677
1118
  "calls:write": "calls:write";
1119
+ "messaging:import": "messaging:import";
678
1120
  "messaging:write": "messaging:write";
679
1121
  "users:write": "users:write";
680
1122
  }>>>;
@@ -734,6 +1176,7 @@ export declare const Environment: z.ZodObject<{
734
1176
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
735
1177
  allowThreads: z.ZodDefault<z.ZodBoolean>;
736
1178
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1179
+ allowPins: z.ZodDefault<z.ZodBoolean>;
737
1180
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
738
1181
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
739
1182
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
@@ -788,6 +1231,7 @@ export declare const Project: z.ZodObject<{
788
1231
  allowAttachments: z.ZodDefault<z.ZodBoolean>;
789
1232
  allowThreads: z.ZodDefault<z.ZodBoolean>;
790
1233
  allowReactions: z.ZodDefault<z.ZodBoolean>;
1234
+ allowPins: z.ZodDefault<z.ZodBoolean>;
791
1235
  maxAttachmentBytes: z.ZodDefault<z.ZodNumber>;
792
1236
  allowedAttachmentTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
793
1237
  retentionDays: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
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/*",
@@ -134,10 +136,21 @@ const CallSignalRequest = z.object({
134
136
  fromUserId: ProductId.optional(),
135
137
  data: z.record(z.string(), z.unknown()).optional()
136
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"]);
137
145
  const MessagingTokenRequest = z.object({
138
146
  userId: ProductId,
139
147
  deviceId: ProductId,
140
- 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()
141
154
  });
142
155
  const MessagingTokenResponse = z.object({
143
156
  token: z.string(),
@@ -151,24 +164,110 @@ const ConversationType = z.enum([
151
164
  "channel",
152
165
  "session"
153
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");
154
198
  const CreateConversationRequest = z.object({
155
199
  tenantId: TenantId,
156
200
  type: ConversationType,
157
201
  productConversationId: ProductId.optional(),
158
202
  title: z.string().trim().max(200).optional(),
159
- 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()
160
235
  });
161
- const MembersRequest = z.object({ userIds: z.array(ProductId).min(1).max(1e3) });
236
+ const NotificationLevelRequest = z.object({ level: NotificationLevel });
162
237
  const Conversation = z.object({
163
238
  id: Uuid,
164
239
  tenantId: z.string(),
165
240
  type: ConversationType,
166
241
  productConversationId: z.string().nullable(),
167
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(),
168
260
  lastSeq: z.number().int(),
169
261
  lastMessageAt: z.string().nullable(),
170
262
  createdAt: z.string(),
171
- 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()
172
271
  });
173
272
  const ConversationList = z.object({
174
273
  items: z.array(Conversation),
@@ -196,19 +295,33 @@ const Attachment = z.object({
196
295
  status: AttachmentStatus,
197
296
  scanStatus: AttachmentScanStatus.optional()
198
297
  });
298
+ /** User IDs a message mentions. Each must be a current member of the conversation. */
299
+ const Mentions = z.array(ProductId).max(50);
199
300
  const SendMessageRequest = z.object({
200
301
  clientMessageId: z.string().regex(/^[A-Za-z0-9_-]{8,64}$/),
201
302
  text: z.string().max(65536).default(""),
202
303
  attachmentIds: z.array(Uuid).max(10).default([]),
203
- 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()
204
311
  });
205
- const EditMessageRequest = z.object({ text: z.string().min(1).max(65536) });
206
312
  const ReadRequest = z.object({ seq: z.number().int().min(0) });
207
313
  const ReactionRequest = z.object({ emoji: z.string().min(1).max(32) });
208
314
  const Reaction = z.object({
209
315
  userId: z.string(),
210
316
  emoji: z.string()
211
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
+ });
212
325
  const Message = z.object({
213
326
  id: Uuid,
214
327
  conversationId: Uuid,
@@ -219,7 +332,12 @@ const Message = z.object({
219
332
  body: z.string().nullable(),
220
333
  attachments: z.array(Attachment),
221
334
  reactions: z.array(Reaction),
335
+ mentions: z.array(z.string()),
222
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(),
223
341
  createdAt: z.string(),
224
342
  editedAt: z.string().nullable(),
225
343
  deletedAt: z.string().nullable()
@@ -228,6 +346,8 @@ const ConversationEventType = z.enum([
228
346
  "message.created",
229
347
  "message.updated",
230
348
  "message.deleted",
349
+ "message.pinned",
350
+ "message.unpinned",
231
351
  "reaction.added",
232
352
  "reaction.removed"
233
353
  ]);
@@ -241,6 +361,8 @@ const ConversationEvent = z.object({
241
361
  type: ConversationEventType,
242
362
  message: Message,
243
363
  reaction: Reaction.nullable(),
364
+ /** Who caused the change (sender, editor, reactor or pinner); null for imported history. */
365
+ actorId: z.string().nullable(),
244
366
  createdAt: z.string()
245
367
  });
246
368
  const ConversationEventPage = z.object({
@@ -253,12 +375,63 @@ const SendMessageResponse = z.object({
253
375
  created: z.boolean(),
254
376
  status: z.literal("sent")
255
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) });
256
423
  const UploadIntentRequest = z.object({
257
424
  conversationId: Uuid,
258
425
  fileName: z.string().trim().min(1).max(255),
259
426
  size: z.number().int().min(1),
260
427
  mediaType: z.string().regex(/^[a-z]+\/[a-z0-9.+-]+$/i)
261
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
+ });
262
435
  const UploadIntentResponse = z.object({
263
436
  attachment: Attachment,
264
437
  uploadUrl: z.string(),
@@ -289,6 +462,22 @@ const Presence = z.object({
289
462
  status: PresenceStatus,
290
463
  lastSeenAt: z.string().nullable()
291
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() });
292
481
  const ConsoleRole = z.enum([
293
482
  "owner",
294
483
  "admin",
@@ -296,12 +485,27 @@ const ConsoleRole = z.enum([
296
485
  "auditor"
297
486
  ]);
298
487
  const EnvironmentName = z.enum(["staging", "production"]);
488
+ /** `messaging:import` (history import) is never granted by default; add it to a dedicated key. */
299
489
  const ServiceScope = z.enum([
300
490
  "calls:write",
301
491
  "messaging:write",
302
- "users:write"
492
+ "users:write",
493
+ "messaging:import"
303
494
  ]);
304
- 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");
305
509
  const CreateProjectRequest = z.object({
306
510
  slug: z.string().regex(/^[a-z][a-z0-9-]{1,30}$/),
307
511
  name: z.string().trim().min(1).max(100)
@@ -348,6 +552,7 @@ const PatchEnvironmentRequest = z.object({
348
552
  allowAttachments: ProductMessagingPolicy.shape.allowAttachments.removeDefault().optional(),
349
553
  allowThreads: ProductMessagingPolicy.shape.allowThreads.removeDefault().optional(),
350
554
  allowReactions: ProductMessagingPolicy.shape.allowReactions.removeDefault().optional(),
555
+ allowPins: ProductMessagingPolicy.shape.allowPins.removeDefault().optional(),
351
556
  maxAttachmentBytes: ProductMessagingPolicy.shape.maxAttachmentBytes.removeDefault().optional(),
352
557
  allowedAttachmentTypes: ProductMessagingPolicy.shape.allowedAttachmentTypes.removeDefault().optional(),
353
558
  retentionDays: ProductMessagingPolicy.shape.retentionDays.removeDefault().optional()
@@ -761,4 +966,4 @@ const OpsOverview = z.object({
761
966
  recordings: z.array(Recording),
762
967
  scans: ScanSummary
763
968
  });
764
- 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, DeploymentOptions, 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, PublishSource, PushDeliveryView, PushDevice, PushPlatform, PushProvider, Reaction, ReactionRequest, ReadRequest, Recording, RecordingDownload, RecordingFile, RecordingKind, RecordingList, RecordingOutput, RecordingStatus, RegisterDeviceRequest, RemoveUserResponse, 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.2.0",
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",