@juki-team/commons 0.1.42 → 0.1.43

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.
@@ -582,6 +582,10 @@ exports.WebSocketMessageEvent = void 0;
582
582
  WebSocketMessageEvent["CLIENT_TRACK_DEVICE"] = "CLIENT_TRACK_DEVICE";
583
583
  WebSocketMessageEvent["CHAT_COMPLETIONS"] = "CHAT_COMPLETIONS";
584
584
  })(exports.WebSocketMessageEvent || (exports.WebSocketMessageEvent = {}));
585
+ /**
586
+ * Subscriptions of the client. With the TOPIC channels they are not sent to the server anymore:
587
+ * they only say which channel the client attaches (`getChannelOfWebSocketSubscribeEvent`) and the dispatch key.
588
+ */
585
589
  exports.WebSocketSubscriptionEvent = void 0;
586
590
  (function (WebSocketSubscriptionEvent) {
587
591
  WebSocketSubscriptionEvent["SUBSCRIBE_CODE_RUN_STATUS"] = "SUBSCRIBE_CODE_RUN_STATUS";
@@ -2241,10 +2245,15 @@ const EMPTY_USER_PERMISSIONS = {
2241
2245
  };
2242
2246
 
2243
2247
  // LEGACY channels (fan-out per client through the subscriptions registry in Redis)
2248
+ /** @deprecated the subscriptions registry was replaced by the TOPIC channels granted in the Ably token */
2244
2249
  const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
2250
+ /** @deprecated not used, the events arrive by the TOPIC channels */
2245
2251
  const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
2252
+ /** @deprecated the events arrive by the TOPIC channels */
2246
2253
  const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
2254
+ /** messages from the clients to the backend (chat completions, client track screenshots) */
2247
2255
  const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
2256
+ /** @deprecated global presence channel (limited to 200 members by Ably), replaced by CHANNEL_COMPANY_PRESENCE */
2248
2257
  const CHANNEL_PRESENCE_CLIENT = 'pre:client';
2249
2258
  // TOPIC channels
2250
2259
  // The backend publishes each event once on the channel of its topic and Ably does the fan-out.
@@ -2263,6 +2272,14 @@ const CHANNEL_PROBLEM = (problemKey) => `problem:${segment(problemKey)}`;
2263
2272
  const CHANNEL_CONTEST = (contestKey, role) => `contest:${segment(contestKey)}:${role}`;
2264
2273
  /** system administrators only: data sent by a tracked client (screenshots, location, device) */
2265
2274
  const CHANNEL_CLIENT_TRACK = (trackedClientId) => `client-track:${segment(trackedClientId)}`;
2275
+ /**
2276
+ * presence of the clients (tabs) of the logged users of a company (by its key), data: `UserPresenceData`.
2277
+ * The clients only enter (capability `presence`), only the administrators of the company receive it
2278
+ * (capability `presence-subscribe`). Ably limits the presence members per channel (200 by default,
2279
+ * more with server-side batching enabled on the `presence` namespace).
2280
+ * The identity of a member is its `clientId` (`sessionId|uiId`, verified by Ably), never its data.
2281
+ */
2282
+ const CHANNEL_COMPANY_PRESENCE = (companyKey) => `presence:company:${segment(companyKey)}`;
2266
2283
  // capability resources (wildcards) of the public channels
2267
2284
  const CHANNEL_SUBMISSION_ALL = 'submission:*';
2268
2285
  const CHANNEL_PROBLEM_ALL = 'problem:*';
@@ -3478,6 +3495,7 @@ exports.AssignmentState = AssignmentState;
3478
3495
  exports.AssignmentType = AssignmentType;
3479
3496
  exports.CHANNEL_CLIENT_TRACK = CHANNEL_CLIENT_TRACK;
3480
3497
  exports.CHANNEL_CLIENT_TRACK_ALL = CHANNEL_CLIENT_TRACK_ALL;
3498
+ exports.CHANNEL_COMPANY_PRESENCE = CHANNEL_COMPANY_PRESENCE;
3481
3499
  exports.CHANNEL_CONTEST = CHANNEL_CONTEST;
3482
3500
  exports.CHANNEL_PRESENCE_CLIENT = CHANNEL_PRESENCE_CLIENT;
3483
3501
  exports.CHANNEL_PROBLEM = CHANNEL_PROBLEM;
package/dist/esm/index.js CHANGED
@@ -580,6 +580,10 @@ var WebSocketMessageEvent;
580
580
  WebSocketMessageEvent["CLIENT_TRACK_DEVICE"] = "CLIENT_TRACK_DEVICE";
581
581
  WebSocketMessageEvent["CHAT_COMPLETIONS"] = "CHAT_COMPLETIONS";
582
582
  })(WebSocketMessageEvent || (WebSocketMessageEvent = {}));
583
+ /**
584
+ * Subscriptions of the client. With the TOPIC channels they are not sent to the server anymore:
585
+ * they only say which channel the client attaches (`getChannelOfWebSocketSubscribeEvent`) and the dispatch key.
586
+ */
583
587
  var WebSocketSubscriptionEvent;
584
588
  (function (WebSocketSubscriptionEvent) {
585
589
  WebSocketSubscriptionEvent["SUBSCRIBE_CODE_RUN_STATUS"] = "SUBSCRIBE_CODE_RUN_STATUS";
@@ -2239,10 +2243,15 @@ const EMPTY_USER_PERMISSIONS = {
2239
2243
  };
2240
2244
 
2241
2245
  // LEGACY channels (fan-out per client through the subscriptions registry in Redis)
2246
+ /** @deprecated the subscriptions registry was replaced by the TOPIC channels granted in the Ably token */
2242
2247
  const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
2248
+ /** @deprecated not used, the events arrive by the TOPIC channels */
2243
2249
  const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
2250
+ /** @deprecated the events arrive by the TOPIC channels */
2244
2251
  const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
2252
+ /** messages from the clients to the backend (chat completions, client track screenshots) */
2245
2253
  const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
2254
+ /** @deprecated global presence channel (limited to 200 members by Ably), replaced by CHANNEL_COMPANY_PRESENCE */
2246
2255
  const CHANNEL_PRESENCE_CLIENT = 'pre:client';
2247
2256
  // TOPIC channels
2248
2257
  // The backend publishes each event once on the channel of its topic and Ably does the fan-out.
@@ -2261,6 +2270,14 @@ const CHANNEL_PROBLEM = (problemKey) => `problem:${segment(problemKey)}`;
2261
2270
  const CHANNEL_CONTEST = (contestKey, role) => `contest:${segment(contestKey)}:${role}`;
2262
2271
  /** system administrators only: data sent by a tracked client (screenshots, location, device) */
2263
2272
  const CHANNEL_CLIENT_TRACK = (trackedClientId) => `client-track:${segment(trackedClientId)}`;
2273
+ /**
2274
+ * presence of the clients (tabs) of the logged users of a company (by its key), data: `UserPresenceData`.
2275
+ * The clients only enter (capability `presence`), only the administrators of the company receive it
2276
+ * (capability `presence-subscribe`). Ably limits the presence members per channel (200 by default,
2277
+ * more with server-side batching enabled on the `presence` namespace).
2278
+ * The identity of a member is its `clientId` (`sessionId|uiId`, verified by Ably), never its data.
2279
+ */
2280
+ const CHANNEL_COMPANY_PRESENCE = (companyKey) => `presence:company:${segment(companyKey)}`;
2264
2281
  // capability resources (wildcards) of the public channels
2265
2282
  const CHANNEL_SUBMISSION_ALL = 'submission:*';
2266
2283
  const CHANNEL_PROBLEM_ALL = 'problem:*';
@@ -3470,4 +3487,4 @@ const isQuizTextSheet = (value) => {
3470
3487
  && ['text', 'number', 'textarea'].includes(value?.inputType);
3471
3488
  };
3472
3489
 
3473
- export { ACCEPTED_PROGRAMMING_LANGUAGES, ASPECT_RATIO, AspectRatio, AssignmentClass, AssignmentState, AssignmentType, CHANNEL_CLIENT_TRACK, CHANNEL_CLIENT_TRACK_ALL, CHANNEL_CONTEST, CHANNEL_PRESENCE_CLIENT, CHANNEL_PROBLEM, CHANNEL_PROBLEM_ALL, CHANNEL_PUBLISH_MESSAGES, CHANNEL_PUBLISH_SUBSCRIPTIONS, CHANNEL_SESSION, CHANNEL_SUBMISSION, CHANNEL_SUBMISSION_ALL, CHANNEL_SUBSCRIBE_CLIENT, CHANNEL_SUBSCRIBE_NOTIFICATIONS, CHANNEL_USER, CODE_LANGUAGE, COMPANY_PLAN, CONTEST_ROLE, CONTEST_STATUS, COOKIE_JUKI_SESSION_ID, COURSE_ROLE, CodeLanguage, CollectionKey, CompanyLogoType, CompanyPlan, ContestChannelRole, ContestEventAction, ContestProblemBlockedByType, ContestProblemPrerequisiteType, ContestStatus, ContestTimeStatus, CourseRole, CourseStatus, CourseType, DAY_NAMES, DEFAULT_JUKI_PROFILE_IMAGE, DataViewMode, EMPTY_DOCUMENT_MEMBERS, EMPTY_ENTITY_MEMBERS, EMPTY_USER_PERMISSIONS, ENTITY_ACCESS, ENTITY_STATE, ERROR, EmailSubscription, EmailValidationState, EntityAccess, EntityCollection, EntityMembersRank, EntityState, EntityStatus, ErrorCode, FILE_ROLE, FILE_TYPE, FileMemberRole, FileType, FilesJukiPub, GroupType, HEADER_JUKI_FORWARDED_HOST, HEADER_JUKI_INTERNAL_API_KEY, HEADER_JUKI_METADATA, HEADER_JUKI_SECRET_TOKEN, HEADER_JUKI_VISITOR_SESSION_ID, HOURS, HTTPMethod, JUDGE, JUKI_APP_COMPANY_KEY, JUKI_APP_EMAIL_TEMPLATE, JkError, Judge, LANGUAGE, LOWERCASE_LETTERS, Language, LogLevel, LogOperation, MAX_DATE, MEMBER_ROLE, MILLISECONDS, MINUTES, MIN_DATE, MONTH_NAMES, MemberRole, MemberType, MenuViewMode, NEW_PAGE_SHEET, NUMBERS, NotificationType, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PAGE, PAGE_SIZE, PAGE_SIZES, PALLETE, PROBLEM_INPUT, PROBLEM_MODE, PROBLEM_MODES, PROBLEM_OUTPUT, PROBLEM_ROLE, PROBLEM_TYPE, PROBLEM_TYPES, PROBLEM_VERDICT, PROBLEM_VERDICTS, ProblemInput, ProblemOutput, ProblemScoringMode, ProblemType, ProblemVerdict, ProfileSetting, QuizScoringMode, RUNNER_ACCEPTED_PROBLEM_MODES, RUNNER_ACCEPTED_PROBLEM_TYPES, RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES, RUNNER_TYPE, Role, RunnerType, SECONDS, SEC_120, SEC_30, SEC_60, SEC_90, SEPARATOR_TOKEN, SUBMISSION_RUN_STATUS, SUPPORT_EMAIL, SYSTEM_ROLE, ScopeData, Status, SubmissionRunStatus, SystemRole, TEAM_ROLE, THEME, TeamRole, TeamStatus, Theme, TypeTestCase, UPPERCASE_LETTERS, USER_ROLE, USER_STATUS, UserRole, UserStatus, UserTeamStatus, WebSocketMessageEvent, WebSocketResponseEvent, WebSocketSubscriptionEvent, WorkingIn, WorksheetType, YEARS, _KEY, _SUB_SUB_TAB, _SUB_TAB, _TAB, _TYPE, areArraysDifferent, chunkString, cleanRequest, clearAsyncInterval, consoleError, consoleInfo, consoleWarn, contentResponse, contentsResponse, errorsResponse, getAssignmentCommentKey, getAssignmentUserCommentKey, getChannelOfWebSocketSubscribeEvent, getClientId, getContestChannelParams, getContestCommentKey, getContestKeyOfWebSocketSubscribeEvent, getDataLog, getDataOfTestCase, getDays, getDefaultMeta, getDocumentAccess, getHours, getMilliseconds, getMinutes, getMonths, getParamsOfClientId, getParamsOfUserKey, getPlainText, getProblemCommentKey, getProblemJudgeKey, getRandomString, getSeconds, getSummaryWorksheetsInPages, getTotalExercisesOfSummaryWorksheetsInPages, getUserKey, getVerdictFromTestCase, getWebSocketResponseEventKey, getWebSocketResponseEventKeyOfResponse, getWorksheetsInPages, getYears, humanFileSize, indexToLetters, isBasicWorksheet, isChatCompletionsWebSocketEventDTO, isClientTrackDeviceWebSocketEventDTO, isClientTrackLocationWebSocketEventDTO, isClientTrackScreenshotWebSocketEventDTO, isClientTrackWebSocketResponseEventDTO, isCodeEditorSheet, isCodeRunStatusMessageWebSocketResponseEventDTO, isContestAssignment, isContestChangesWebSocketResponseEventDTO, isCourseAssignment, isEndlessContest, isFutureContest, isGlobalContest, isJkmdSheet, isObjectJson, isPastContest, isPingWebSocketEventDTO, isPongWebSocketResponseEventDTO, isProblemCrawledWebSocketResponseEventDTO, isQuizOptionsSheet, isQuizProblemSheet, isQuizTextSheet, isSenDataChatCompletionsWebSocketResponseEventDTO, isSendDataClientTrackWebSocketResponseEventDTO, isSendDataEc2InstancesListWebSocketResponseEventDTO, isSendDataEcsTaskDefinitionListWebSocketResponseEventDTO, isSendDataEcsTasksListWebSocketResponseEventDTO, isSendDataRunCommandWebSocketResponseEventDTO, isSendDataSsmSessionsListWebSocketResponseEventDTO, isSendDataWebSocketResponseEventDTO, isStringJson, isSubmissionRunStatusMessageWebSocketResponseEventDTO, isSubmissionsCrawlWebSocketResponseEventDTO, isSubscribeClientTrackDataWebSocketEventDTO, isSubscribeClientTrackWebSocketEventDTO, isSubscribeCodeRunStatusWebSocketEventDTO, isSubscribeContestChangesWebSocketEventDTO, isSubscribeGetDataWebSocketEventDTO, isSubscribeProblemCrawledWebSocketEventDTO, isSubscribeSubmissionRunStatusWebSocketEventDTO, isSubscribeSubmissionsCrawlWebSocketEventDTO, isSubscribeUserNotificationWebSocketEventDTO, isTeamMember, isUnsubscribeClientTrackDataWebSocketEventDTO, isUnsubscribeClientTrackWebSocketEventDTO, isUnsubscribeCodeRunStatusWebSocketEventDTO, isUnsubscribeContestChangesWebSocketEventDTO, isUnsubscribeGetDataWebSocketEventDTO, isUnsubscribeProblemCrawledWebSocketEventDTO, isUnsubscribeSubmissionRunStatusWebSocketEventDTO, isUnsubscribeSubmissionsCrawlWebSocketEventDTO, isUnsubscribeUserNotificationWebSocketEventDTO, isUserMember, isUserMessageWebSocketResponseEventDTO, isUserNotificationContestClarificationWebSocketResponseEventDTO, isUserNotificationSubmissionWebSocketResponseEventDTO, isUserNotificationWebSocketResponseEventDTO, isWebSocketChannelsMessageDTO, isWebSocketResponseEventDTO, isWebsocketSubscription, isWorksheetAssignment, join, lettersToIndex, memorySizeOf, mergeVerdicts, mex, normalizeToLocalStartOfDay, normalizeToLocalStartOfHour, normalizeToLocalStartOfMinutes, normalizeToLocalStartOfSeconds, objectUpdate, objectsUpdate, range, removeExtension, safeJsonParse, setAsyncInterval, split, splitTime, stringToArrayBuffer, toEntityMembersDTO, toJkError };
3490
+ export { ACCEPTED_PROGRAMMING_LANGUAGES, ASPECT_RATIO, AspectRatio, AssignmentClass, AssignmentState, AssignmentType, CHANNEL_CLIENT_TRACK, CHANNEL_CLIENT_TRACK_ALL, CHANNEL_COMPANY_PRESENCE, CHANNEL_CONTEST, CHANNEL_PRESENCE_CLIENT, CHANNEL_PROBLEM, CHANNEL_PROBLEM_ALL, CHANNEL_PUBLISH_MESSAGES, CHANNEL_PUBLISH_SUBSCRIPTIONS, CHANNEL_SESSION, CHANNEL_SUBMISSION, CHANNEL_SUBMISSION_ALL, CHANNEL_SUBSCRIBE_CLIENT, CHANNEL_SUBSCRIBE_NOTIFICATIONS, CHANNEL_USER, CODE_LANGUAGE, COMPANY_PLAN, CONTEST_ROLE, CONTEST_STATUS, COOKIE_JUKI_SESSION_ID, COURSE_ROLE, CodeLanguage, CollectionKey, CompanyLogoType, CompanyPlan, ContestChannelRole, ContestEventAction, ContestProblemBlockedByType, ContestProblemPrerequisiteType, ContestStatus, ContestTimeStatus, CourseRole, CourseStatus, CourseType, DAY_NAMES, DEFAULT_JUKI_PROFILE_IMAGE, DataViewMode, EMPTY_DOCUMENT_MEMBERS, EMPTY_ENTITY_MEMBERS, EMPTY_USER_PERMISSIONS, ENTITY_ACCESS, ENTITY_STATE, ERROR, EmailSubscription, EmailValidationState, EntityAccess, EntityCollection, EntityMembersRank, EntityState, EntityStatus, ErrorCode, FILE_ROLE, FILE_TYPE, FileMemberRole, FileType, FilesJukiPub, GroupType, HEADER_JUKI_FORWARDED_HOST, HEADER_JUKI_INTERNAL_API_KEY, HEADER_JUKI_METADATA, HEADER_JUKI_SECRET_TOKEN, HEADER_JUKI_VISITOR_SESSION_ID, HOURS, HTTPMethod, JUDGE, JUKI_APP_COMPANY_KEY, JUKI_APP_EMAIL_TEMPLATE, JkError, Judge, LANGUAGE, LOWERCASE_LETTERS, Language, LogLevel, LogOperation, MAX_DATE, MEMBER_ROLE, MILLISECONDS, MINUTES, MIN_DATE, MONTH_NAMES, MemberRole, MemberType, MenuViewMode, NEW_PAGE_SHEET, NUMBERS, NotificationType, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PAGE, PAGE_SIZE, PAGE_SIZES, PALLETE, PROBLEM_INPUT, PROBLEM_MODE, PROBLEM_MODES, PROBLEM_OUTPUT, PROBLEM_ROLE, PROBLEM_TYPE, PROBLEM_TYPES, PROBLEM_VERDICT, PROBLEM_VERDICTS, ProblemInput, ProblemOutput, ProblemScoringMode, ProblemType, ProblemVerdict, ProfileSetting, QuizScoringMode, RUNNER_ACCEPTED_PROBLEM_MODES, RUNNER_ACCEPTED_PROBLEM_TYPES, RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES, RUNNER_TYPE, Role, RunnerType, SECONDS, SEC_120, SEC_30, SEC_60, SEC_90, SEPARATOR_TOKEN, SUBMISSION_RUN_STATUS, SUPPORT_EMAIL, SYSTEM_ROLE, ScopeData, Status, SubmissionRunStatus, SystemRole, TEAM_ROLE, THEME, TeamRole, TeamStatus, Theme, TypeTestCase, UPPERCASE_LETTERS, USER_ROLE, USER_STATUS, UserRole, UserStatus, UserTeamStatus, WebSocketMessageEvent, WebSocketResponseEvent, WebSocketSubscriptionEvent, WorkingIn, WorksheetType, YEARS, _KEY, _SUB_SUB_TAB, _SUB_TAB, _TAB, _TYPE, areArraysDifferent, chunkString, cleanRequest, clearAsyncInterval, consoleError, consoleInfo, consoleWarn, contentResponse, contentsResponse, errorsResponse, getAssignmentCommentKey, getAssignmentUserCommentKey, getChannelOfWebSocketSubscribeEvent, getClientId, getContestChannelParams, getContestCommentKey, getContestKeyOfWebSocketSubscribeEvent, getDataLog, getDataOfTestCase, getDays, getDefaultMeta, getDocumentAccess, getHours, getMilliseconds, getMinutes, getMonths, getParamsOfClientId, getParamsOfUserKey, getPlainText, getProblemCommentKey, getProblemJudgeKey, getRandomString, getSeconds, getSummaryWorksheetsInPages, getTotalExercisesOfSummaryWorksheetsInPages, getUserKey, getVerdictFromTestCase, getWebSocketResponseEventKey, getWebSocketResponseEventKeyOfResponse, getWorksheetsInPages, getYears, humanFileSize, indexToLetters, isBasicWorksheet, isChatCompletionsWebSocketEventDTO, isClientTrackDeviceWebSocketEventDTO, isClientTrackLocationWebSocketEventDTO, isClientTrackScreenshotWebSocketEventDTO, isClientTrackWebSocketResponseEventDTO, isCodeEditorSheet, isCodeRunStatusMessageWebSocketResponseEventDTO, isContestAssignment, isContestChangesWebSocketResponseEventDTO, isCourseAssignment, isEndlessContest, isFutureContest, isGlobalContest, isJkmdSheet, isObjectJson, isPastContest, isPingWebSocketEventDTO, isPongWebSocketResponseEventDTO, isProblemCrawledWebSocketResponseEventDTO, isQuizOptionsSheet, isQuizProblemSheet, isQuizTextSheet, isSenDataChatCompletionsWebSocketResponseEventDTO, isSendDataClientTrackWebSocketResponseEventDTO, isSendDataEc2InstancesListWebSocketResponseEventDTO, isSendDataEcsTaskDefinitionListWebSocketResponseEventDTO, isSendDataEcsTasksListWebSocketResponseEventDTO, isSendDataRunCommandWebSocketResponseEventDTO, isSendDataSsmSessionsListWebSocketResponseEventDTO, isSendDataWebSocketResponseEventDTO, isStringJson, isSubmissionRunStatusMessageWebSocketResponseEventDTO, isSubmissionsCrawlWebSocketResponseEventDTO, isSubscribeClientTrackDataWebSocketEventDTO, isSubscribeClientTrackWebSocketEventDTO, isSubscribeCodeRunStatusWebSocketEventDTO, isSubscribeContestChangesWebSocketEventDTO, isSubscribeGetDataWebSocketEventDTO, isSubscribeProblemCrawledWebSocketEventDTO, isSubscribeSubmissionRunStatusWebSocketEventDTO, isSubscribeSubmissionsCrawlWebSocketEventDTO, isSubscribeUserNotificationWebSocketEventDTO, isTeamMember, isUnsubscribeClientTrackDataWebSocketEventDTO, isUnsubscribeClientTrackWebSocketEventDTO, isUnsubscribeCodeRunStatusWebSocketEventDTO, isUnsubscribeContestChangesWebSocketEventDTO, isUnsubscribeGetDataWebSocketEventDTO, isUnsubscribeProblemCrawledWebSocketEventDTO, isUnsubscribeSubmissionRunStatusWebSocketEventDTO, isUnsubscribeSubmissionsCrawlWebSocketEventDTO, isUnsubscribeUserNotificationWebSocketEventDTO, isUserMember, isUserMessageWebSocketResponseEventDTO, isUserNotificationContestClarificationWebSocketResponseEventDTO, isUserNotificationSubmissionWebSocketResponseEventDTO, isUserNotificationWebSocketResponseEventDTO, isWebSocketChannelsMessageDTO, isWebSocketResponseEventDTO, isWebsocketSubscription, isWorksheetAssignment, join, lettersToIndex, memorySizeOf, mergeVerdicts, mex, normalizeToLocalStartOfDay, normalizeToLocalStartOfHour, normalizeToLocalStartOfMinutes, normalizeToLocalStartOfSeconds, objectUpdate, objectsUpdate, range, removeExtension, safeJsonParse, setAsyncInterval, split, splitTime, stringToArrayBuffer, toEntityMembersDTO, toJkError };
@@ -1,8 +1,13 @@
1
1
  import { ClientId, ContestChannelRole } from '../types';
2
+ /** @deprecated the subscriptions registry was replaced by the TOPIC channels granted in the Ably token */
2
3
  export declare const CHANNEL_PUBLISH_SUBSCRIPTIONS = "pub:subscriptions";
4
+ /** @deprecated not used, the events arrive by the TOPIC channels */
3
5
  export declare const CHANNEL_SUBSCRIBE_NOTIFICATIONS = "sub:notifications";
6
+ /** @deprecated the events arrive by the TOPIC channels */
4
7
  export declare const CHANNEL_SUBSCRIBE_CLIENT: (clientId: ClientId) => string;
8
+ /** messages from the clients to the backend (chat completions, client track screenshots) */
5
9
  export declare const CHANNEL_PUBLISH_MESSAGES = "pub:messages";
10
+ /** @deprecated global presence channel (limited to 200 members by Ably), replaced by CHANNEL_COMPANY_PRESENCE */
6
11
  export declare const CHANNEL_PRESENCE_CLIENT = "pre:client";
7
12
  /** private: events of one session (code runs, requested data, client track commands) */
8
13
  export declare const CHANNEL_SESSION: (sessionId: string) => string;
@@ -16,6 +21,14 @@ export declare const CHANNEL_PROBLEM: (problemKey: string) => string;
16
21
  export declare const CHANNEL_CONTEST: (contestKey: string, role: ContestChannelRole) => string;
17
22
  /** system administrators only: data sent by a tracked client (screenshots, location, device) */
18
23
  export declare const CHANNEL_CLIENT_TRACK: (trackedClientId: ClientId) => string;
24
+ /**
25
+ * presence of the clients (tabs) of the logged users of a company (by its key), data: `UserPresenceData`.
26
+ * The clients only enter (capability `presence`), only the administrators of the company receive it
27
+ * (capability `presence-subscribe`). Ably limits the presence members per channel (200 by default,
28
+ * more with server-side batching enabled on the `presence` namespace).
29
+ * The identity of a member is its `clientId` (`sessionId|uiId`, verified by Ably), never its data.
30
+ */
31
+ export declare const CHANNEL_COMPANY_PRESENCE: (companyKey: string) => string;
19
32
  export declare const CHANNEL_SUBMISSION_ALL = "submission:*";
20
33
  export declare const CHANNEL_PROBLEM_ALL = "problem:*";
21
34
  export declare const CHANNEL_CLIENT_TRACK_ALL = "client-track:*";
@@ -8,6 +8,7 @@ interface WebsocketMessage {
8
8
  export interface PingWebSocketEventDTO extends WebsocketMessage {
9
9
  event: WebSocketMessageEvent.PING;
10
10
  }
11
+ /** @deprecated the location is the `href` of the company presence (`UserPresenceData`) */
11
12
  export interface ClientTrackLocationWebSocketEventDTO extends WebsocketMessage {
12
13
  event: WebSocketMessageEvent.CLIENT_TRACK_LOCATION;
13
14
  href: string;
@@ -269,4 +270,12 @@ export interface WebSocketChannelsMessageDTO {
269
270
  channels: string[];
270
271
  event: WebSocketResponseEventDTO;
271
272
  }
273
+ /**
274
+ * Data of a client (tab) in its company presence channel (`CHANNEL_COMPANY_PRESENCE`).
275
+ * Sent by the client: informative only, the identity is the presence member `clientId`.
276
+ */
277
+ export interface UserPresenceData {
278
+ href: string;
279
+ uiId: string;
280
+ }
272
281
  export {};
@@ -6,6 +6,10 @@ export declare enum WebSocketMessageEvent {
6
6
  CLIENT_TRACK_DEVICE = "CLIENT_TRACK_DEVICE",
7
7
  CHAT_COMPLETIONS = "CHAT_COMPLETIONS"
8
8
  }
9
+ /**
10
+ * Subscriptions of the client. With the TOPIC channels they are not sent to the server anymore:
11
+ * they only say which channel the client attaches (`getChannelOfWebSocketSubscribeEvent`) and the dispatch key.
12
+ */
9
13
  export declare enum WebSocketSubscriptionEvent {
10
14
  SUBSCRIBE_CODE_RUN_STATUS = "SUBSCRIBE_CODE_RUN_STATUS",
11
15
  UNSUBSCRIBE_CODE_RUN_STATUS = "UNSUBSCRIBE_CODE_RUN_STATUS",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juki-team/commons",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "author": "juki-team",
5
5
  "license": "MIT",
6
6
  "type": "module",