Skip to content

Commit

Permalink
UBERF-8999 Presence service (#7539)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Onnikov <[email protected]>
  • Loading branch information
aonnikov authored Dec 24, 2024
1 parent 30edf4e commit 949e7c2
Show file tree
Hide file tree
Showing 57 changed files with 1,080 additions and 44 deletions.
110 changes: 105 additions & 5 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@
"@hcengineering/guest": "^0.6.4",
"@hcengineering/guest-assets": "^0.6.0",
"@hcengineering/guest-resources": "^0.6.0",
"@hcengineering/presence": "^0.6.0",
"@hcengineering/presence-resources": "^0.6.0",
"@hcengineering/uploader": "^0.6.0",
"@hcengineering/uploader-assets": "^0.6.0",
"@hcengineering/uploader-resources": "^0.6.0",
Expand Down
5 changes: 4 additions & 1 deletion desktop/src/ui/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { leadId } from '@hcengineering/lead'
import login, { loginId } from '@hcengineering/login'
import notification, { notificationId } from '@hcengineering/notification'
import onboard, { onboardId } from '@hcengineering/onboard'
import presence, { presenceId } from '@hcengineering/presence'
import { recruitId } from '@hcengineering/recruit'
import rekoni from '@hcengineering/rekoni'
import { requestId } from '@hcengineering/request'
Expand Down Expand Up @@ -245,6 +246,7 @@ export async function configurePlatform (): Promise<void> {
setMetadata(uiPlugin.metadata.DefaultApplication, login.component.LoginApp)
setMetadata(analyticsCollector.metadata.EndpointURL, config.ANALYTICS_COLLECTOR_URL)
setMetadata(aiBot.metadata.EndpointURL, config.AI_URL)
setMetadata(presence.metadata.PresenceUrl, config.PRESENCE_URL ?? '')

const languages = myBranding.languages !== undefined && myBranding.languages !== '' ? myBranding.languages.split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt', 'zh', 'fr', 'cs', 'it']

Expand Down Expand Up @@ -303,6 +305,7 @@ export async function configurePlatform (): Promise<void> {
addLocation(productsId, async () => await import('@hcengineering/products-resources'))
addLocation(documentsId, async () => await import('@hcengineering/controlled-documents-resources'))
addLocation(uploaderId, async () => await import('@hcengineering/uploader-resources'))
addLocation(presenceId, async () => await import('@hcengineering/presence-resources'))
addLocation(githubId, async () => await import(/* webpackChunkName: "github" */ '@hcengineering/github-resources'))
addLocation(
desktopPreferencesId,
Expand All @@ -313,7 +316,7 @@ export async function configurePlatform (): Promise<void> {
addLocation(printId, () => import(/* webpackChunkName: "print" */ '@hcengineering/print-resources'))
addLocation(textEditorId, () => import(/* webpackChunkName: "text-editor" */ '@hcengineering/text-editor-resources'))
addLocation(testManagementId, () => import(/* webpackChunkName: "test-management" */ '@hcengineering/test-management-resources'))
addLocation(surveyId, () => import(/* webpackChunkName: "uploader" */ '@hcengineering/survey-resources'))
addLocation(surveyId, () => import(/* webpackChunkName: "survey" */ '@hcengineering/survey-resources'))

setMetadata(client.metadata.FilterModel, 'ui')
setMetadata(client.metadata.ExtraPlugins, ['preference' as Plugin])
Expand Down
1 change: 1 addition & 0 deletions desktop/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface Config {
DESKTOP_UPDATES_URL?: string
DESKTOP_UPDATES_CHANNEL?: string
TELEGRAM_BOT_URL?: string
PRESENCE_URL?: string

STATS_URL?: string
}
Expand Down
2 changes: 2 additions & 0 deletions dev/prod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
"@hcengineering/print": "^0.6.0",
"@hcengineering/print-assets": "^0.6.0",
"@hcengineering/print-resources": "^0.6.0",
"@hcengineering/presence": "^0.6.0",
"@hcengineering/presence-resources": "^0.6.0",
"@hcengineering/uploader": "^0.6.0",
"@hcengineering/uploader-assets": "^0.6.0",
"@hcengineering/uploader-resources": "^0.6.0",
Expand Down
6 changes: 5 additions & 1 deletion dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { viewId } from '@hcengineering/view'
import workbench, { workbenchId } from '@hcengineering/workbench'
import { testManagementId } from '@hcengineering/test-management'
import { surveyId } from '@hcengineering/survey'
import presence, { presenceId } from '@hcengineering/presence'

import { bitrixId } from '@hcengineering/bitrix'

Expand Down Expand Up @@ -161,6 +162,7 @@ export interface Config {
PREVIEW_CONFIG?: string
UPLOAD_CONFIG?: string
STATS_URL?: string
PRESENCE_URL?: string
USE_BINARY_PROTOCOL?: boolean,
TRANSACTOR_OVERRIDE?: string
}
Expand Down Expand Up @@ -342,6 +344,7 @@ export async function configurePlatform() {
setMetadata(love.metadata.WebSocketURL, config.LIVEKIT_WS)
setMetadata(print.metadata.PrintURL, config.PRINT_URL)
setMetadata(sign.metadata.SignURL, config.SIGN_URL)
setMetadata(presence.metadata.PresenceUrl, config.PRESENCE_URL ?? '')

const languages = myBranding.languages ? (myBranding.languages as string).split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt', 'zh', 'fr', 'cs', 'it']

Expand Down Expand Up @@ -409,7 +412,8 @@ export async function configurePlatform() {
addLocation(textEditorId, () => import(/* webpackChunkName: "text-editor" */ '@hcengineering/text-editor-resources'))
addLocation(uploaderId, () => import(/* webpackChunkName: "uploader" */ '@hcengineering/uploader-resources'))
addLocation(testManagementId, () => import(/* webpackChunkName: "test-management" */ '@hcengineering/test-management-resources'))
addLocation(surveyId, () => import(/* webpackChunkName: "uploader" */ '@hcengineering/survey-resources'))
addLocation(surveyId, () => import(/* webpackChunkName: "survey" */ '@hcengineering/survey-resources'))
addLocation(presenceId, () => import(/* webpackChunkName: "presence" */ '@hcengineering/presence-resources'))

setMetadata(client.metadata.FilterModel, 'ui')
setMetadata(client.metadata.ExtraPlugins, ['preference' as Plugin])
Expand Down
3 changes: 2 additions & 1 deletion models/all/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"@hcengineering/model-ai-bot": "^0.6.0",
"@hcengineering/model-server-fulltext": "^0.6.0",
"@hcengineering/model-test-management": "^0.6.0",
"@hcengineering/model-survey": "^0.6.0"
"@hcengineering/model-survey": "^0.6.0",
"@hcengineering/model-presence": "^0.6.0"
}
}
2 changes: 2 additions & 0 deletions models/all/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import {
} from '@hcengineering/model-server-controlled-documents'
import { serverFulltextId, createModel as serverFulltextModel } from '@hcengineering/model-server-fulltext'
import { surveyId, createModel as surveyModel } from '@hcengineering/model-survey'
import { presenceId, createModel as presenceModel } from '@hcengineering/model-presence'

import { type Plugin } from '@hcengineering/platform'

Expand Down Expand Up @@ -422,6 +423,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
}
],
[surveyModel, surveyId],
[presenceModel, presenceId],

[serverCoreModel, serverCoreId],
[serverAttachmentModel, serverAttachmentId],
Expand Down
7 changes: 7 additions & 0 deletions models/presence/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/model/eslint.config.json'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
}
}
4 changes: 4 additions & 0 deletions models/presence/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!/lib/**
!CHANGELOG.md
/lib/**/__tests__/
5 changes: 5 additions & 0 deletions models/presence/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig",
"rigProfile": "model"
}
41 changes: 41 additions & 0 deletions models/presence/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@hcengineering/model-presence",
"version": "0.6.0",
"main": "lib/index.js",
"svelte": "src/index.ts",
"types": "types/index.d.ts",
"author": "Hardcore Engineering Inc.",
"template": "@hcengineering/model-package",
"license": "EPL-2.0",
"scripts": {
"build": "compile",
"build:watch": "compile",
"format": "format src",
"_phase:build": "compile transpile src",
"_phase:format": "format src",
"_phase:validate": "compile validate"
},
"devDependencies": {
"@hcengineering/platform-rig": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-n": "^15.4.0",
"eslint": "^8.54.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"prettier": "^3.1.0",
"typescript": "^5.3.3"
},
"dependencies": {
"@hcengineering/core": "^0.6.32",
"@hcengineering/model": "^0.6.11",
"@hcengineering/model-core": "^0.6.0",
"@hcengineering/model-presentation": "^0.6.0",
"@hcengineering/model-workbench": "^0.6.1",
"@hcengineering/platform": "^0.6.11",
"@hcengineering/ui": "^0.6.15",
"@hcengineering/presence": "^0.6.0",
"@hcengineering/presence-resources": "^0.6.0"
}
}
31 changes: 31 additions & 0 deletions models/presence/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright © 2024 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

import { type Builder } from '@hcengineering/model'
import core from '@hcengineering/model-core'
import presentation from '@hcengineering/model-presentation'
import workbench from '@hcengineering/model-workbench'

import presence from './plugin'

export { presenceId } from '@hcengineering/presence'
export { presence as default }

export function createModel (builder: Builder): void {
builder.createDoc(presentation.class.ComponentPointExtension, core.space.Model, {
extension: workbench.extensions.WorkbenchExtensions,
component: presence.component.WorkbenchExtension
})
}
25 changes: 25 additions & 0 deletions models/presence/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Copyright © 2024 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

import { mergeIds } from '@hcengineering/platform'
import { type AnyComponent } from '@hcengineering/ui'
import { presenceId } from '@hcengineering/presence'
import presence from '@hcengineering/presence-resources/src/plugin'

export default mergeIds(presenceId, presence, {
component: {
WorkbenchExtension: '' as AnyComponent
}
})
Loading

0 comments on commit 949e7c2

Please sign in to comment.