Skip to content

Commit 8a0a001

Browse files
Merge branch 'develop' of https://github.com/hcengineering/platform into UBERF-9764/gmail
Signed-off-by: Artem Savchenko <[email protected]>
2 parents 7e29b92 + f5de0ee commit 8a0a001

File tree

328 files changed

+6410
-1924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+6410
-1924
lines changed

common/config/rush/pnpm-lock.yaml

+342-152
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@
185185
"@hcengineering/guest-resources": "^0.6.0",
186186
"@hcengineering/presence": "^0.6.0",
187187
"@hcengineering/presence-resources": "^0.6.0",
188+
"@hcengineering/media": "^0.6.0",
189+
"@hcengineering/media-assets": "^0.6.0",
190+
"@hcengineering/media-resources": "^0.6.0",
188191
"@hcengineering/recorder": "^0.6.0",
189192
"@hcengineering/recorder-assets": "^0.6.0",
190193
"@hcengineering/recorder-resources": "^0.6.0",

desktop/src/ui/platform.ts

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import tracker, { trackerId } from '@hcengineering/tracker'
5757
import { trainingId } from '@hcengineering/training'
5858
import uiPlugin, { getCurrentLocation, locationStorageKeyId, navigate, setLocationStorageKey } from '@hcengineering/ui'
5959
import { uiNextId } from '@hcengineering/ui-next'
60+
import { mediaId } from '@hcengineering/media'
6061
import { uploaderId } from '@hcengineering/uploader'
6162
import recorder, { recorderId } from '@hcengineering/recorder'
6263
import { viewId } from '@hcengineering/view'
@@ -115,6 +116,7 @@ import '@hcengineering/mail-assets'
115116
import '@hcengineering/chat-assets'
116117
import '@hcengineering/inbox-assets'
117118
import '@hcengineering/achievement-assets'
119+
import '@hcengineering/media-assets'
118120

119121
import analyticsCollector, { analyticsCollectorId } from '@hcengineering/analytics-collector'
120122
import { coreId } from '@hcengineering/core'
@@ -154,6 +156,7 @@ function configureI18n (): void {
154156
addStringsLoader(textEditorId, async (lang: string) => await import(`@hcengineering/text-editor-assets/lang/${lang}.json`))
155157
addStringsLoader(uiId, async (lang: string) => await import(`@hcengineering/ui/lang/${lang}.json`))
156158
addStringsLoader(uiNextId, async (lang: string) => await import(`@hcengineering/ui-next/lang/${lang}.json`))
159+
addStringsLoader(mediaId, async (lang: string) => await import(`@hcengineering/media-assets/lang/${lang}.json`))
157160
addStringsLoader(uploaderId, async (lang: string) => await import(`@hcengineering/uploader-assets/lang/${lang}.json`))
158161
addStringsLoader(recorderId, async (lang: string) => await import(`@hcengineering/recorder-assets/lang/${lang}.json`))
159162
addStringsLoader(activityId, async (lang: string) => await import(`@hcengineering/activity-assets/lang/${lang}.json`))
@@ -251,6 +254,7 @@ export async function configurePlatform (): Promise<void> {
251254
setMetadata(presentation.metadata.UploadConfig, parseUploadConfig(config.UPLOAD_CONFIG, config.UPLOAD_URL))
252255
setMetadata(presentation.metadata.FrontUrl, config.FRONT_URL)
253256
setMetadata(presentation.metadata.LinkPreviewUrl, config.LINK_PREVIEW_URL ?? '')
257+
setMetadata(presentation.metadata.MailUrl, config.MAIL_URL)
254258
setMetadata(recorder.metadata.StreamUrl, config.STREAM_URL ?? '')
255259
setMetadata(presentation.metadata.StatsUrl, config.STATS_URL)
256260

@@ -344,6 +348,7 @@ export async function configurePlatform (): Promise<void> {
344348
addLocation(trainingId, async () => await import('@hcengineering/training-resources'))
345349
addLocation(productsId, async () => await import('@hcengineering/products-resources'))
346350
addLocation(documentsId, async () => await import('@hcengineering/controlled-documents-resources'))
351+
addLocation(mediaId, async () => await import('@hcengineering/media-resources'))
347352
addLocation(uploaderId, async () => await import('@hcengineering/uploader-resources'))
348353
addLocation(recorderId, async () => await import('@hcengineering/recorder-resources'))
349354
addLocation(presenceId, async () => await import('@hcengineering/presence-resources'))

desktop/src/ui/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface Config {
4343
PUBLIC_SCHEDULE_URL?: string
4444
CALDAV_SERVER_URL?: string
4545
EXPORT_URL?: string
46+
MAIL_URL?: string
4647
}
4748

4849
export interface Branding {

dev/prod/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@
256256
"@hcengineering/training-resources": "^0.1.0",
257257
"@hcengineering/ui": "^0.6.15",
258258
"@hcengineering/ui-next": "^0.6.0",
259+
"@hcengineering/media": "^0.6.0",
260+
"@hcengineering/media-assets": "^0.6.0",
261+
"@hcengineering/media-resources": "^0.6.0",
259262
"@hcengineering/uploader": "^0.6.0",
260263
"@hcengineering/uploader-assets": "^0.6.0",
261264
"@hcengineering/uploader-resources": "^0.6.0",

dev/prod/src/platform.ts

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import { trainingId } from '@hcengineering/training'
6565
import uiPlugin from '@hcengineering/ui'
6666
import {uiNextId} from '@hcengineering/ui-next'
6767
import { uploaderId } from '@hcengineering/uploader'
68+
import { mediaId } from '@hcengineering/media'
6869
import recorder, { recorderId } from '@hcengineering/recorder'
6970
import { viewId } from '@hcengineering/view'
7071
import workbench, { workbenchId } from '@hcengineering/workbench'
@@ -119,6 +120,7 @@ import '@hcengineering/tracker-assets'
119120
import '@hcengineering/training-assets'
120121
import '@hcengineering/uploader-assets'
121122
import '@hcengineering/recorder-assets'
123+
import '@hcengineering/media-assets'
122124
import '@hcengineering/view-assets'
123125
import '@hcengineering/workbench-assets'
124126
import '@hcengineering/chat-assets'
@@ -186,6 +188,7 @@ export interface Config {
186188
PUBLIC_SCHEDULE_URL?: string
187189
CALDAV_SERVER_URL?: string
188190
EXPORT_URL?: string
191+
MAIL_URL?: string
189192
}
190193

191194
export interface Branding {
@@ -275,6 +278,7 @@ function configureI18n(): void {
275278
addStringsLoader(uiNextId, async (lang: string) => await import(`@hcengineering/ui-next/lang/${lang}.json`))
276279
addStringsLoader(uploaderId, async (lang: string) => await import(`@hcengineering/uploader-assets/lang/${lang}.json`))
277280
addStringsLoader(recorderId, async (lang: string) => await import(`@hcengineering/recorder-assets/lang/${lang}.json`))
281+
addStringsLoader(mediaId, async (lang: string) => await import(`@hcengineering/media-assets/lang/${lang}.json`))
278282
addStringsLoader(activityId, async (lang: string) => await import(`@hcengineering/activity-assets/lang/${lang}.json`))
279283
addStringsLoader(
280284
attachmentId,
@@ -428,6 +432,7 @@ export async function configurePlatform() {
428432
setMetadata(presentation.metadata.UploadConfig, parseUploadConfig(config.UPLOAD_CONFIG, config.UPLOAD_URL))
429433
setMetadata(presentation.metadata.StatsUrl, config.STATS_URL)
430434
setMetadata(presentation.metadata.LinkPreviewUrl, config.LINK_PREVIEW_URL)
435+
setMetadata(presentation.metadata.MailUrl, config.MAIL_URL)
431436
setMetadata(recorder.metadata.StreamUrl, config.STREAM_URL)
432437
setMetadata(textEditor.metadata.Collaborator, config.COLLABORATOR)
433438

@@ -545,6 +550,7 @@ export async function configurePlatform() {
545550
addLocation(textEditorId, () => import(/* webpackChunkName: "text-editor" */ '@hcengineering/text-editor-resources'))
546551
addLocation(uploaderId, () => import(/* webpackChunkName: "uploader" */ '@hcengineering/uploader-resources'))
547552
addLocation(recorderId, () => import(/* webpackChunkName: "recorder" */ '@hcengineering/recorder-resources'))
553+
addLocation(mediaId, () => import(/* webpackChunkName: "media" */ '@hcengineering/media-resources'))
548554

549555
addLocation(
550556
testManagementId,

dev/tool/src/index.ts

+13-22
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,8 @@ export function devTool (
352352
const coreWsInfo = flattenStatus(wsInfo)
353353
const accountClient = getAccountClient(getToolToken())
354354

355-
const wsProducer = getPlatformQueue('tool', cmd.region).createProducer<QueueWorkspaceMessage>(
356-
toolCtx,
357-
QueueTopic.Workspace
358-
)
355+
const queue = getPlatformQueue('tool', cmd.region)
356+
const wsProducer = queue.getProducer<QueueWorkspaceMessage>(toolCtx, QueueTopic.Workspace)
359357

360358
await createWorkspace(
361359
measureCtx,
@@ -377,9 +375,8 @@ export function devTool (
377375
})
378376

379377
await wsProducer.send(res.workspaceUuid, [workspaceEvents.created()])
380-
await wsProducer.close()
381-
382-
console.log('create-workspace done')
378+
await queue.shutdown()
379+
console.log(queue)
383380
})
384381
})
385382

@@ -435,10 +432,8 @@ export function devTool (
435432
const coreWsInfo = flattenStatus(wsInfo)
436433
const measureCtx = new MeasureMetricsContext('upgrade-workspace', {})
437434
const accountClient = getAccountClient(getToolToken(wsInfo.uuid))
438-
const wsProducer = getPlatformQueue('tool', info.region).createProducer<QueueWorkspaceMessage>(
439-
toolCtx,
440-
QueueTopic.Workspace
441-
)
435+
const queue = getPlatformQueue('tool', info.region)
436+
const wsProducer = queue.getProducer<QueueWorkspaceMessage>(toolCtx, QueueTopic.Workspace)
442437
await upgradeWorkspace(
443438
measureCtx,
444439
version,
@@ -464,7 +459,7 @@ export function devTool (
464459
console.log(metricsToString(measureCtx.metrics, 'upgrade', 60))
465460

466461
await wsProducer.send(info.uuid, [workspaceEvents.upgraded()])
467-
await wsProducer.close()
462+
await queue.shutdown()
468463
console.log('upgrade-workspace done')
469464
})
470465
})
@@ -1144,12 +1139,10 @@ export function devTool (
11441139
storageAdapter: workspaceStorage,
11451140
historyFile: cmd.historyFile
11461141
})
1147-
const wsProducer = getPlatformQueue('tool', ws.region).createProducer<QueueWorkspaceMessage>(
1148-
toolCtx,
1149-
QueueTopic.Workspace
1150-
)
1142+
const queue = getPlatformQueue('tool', ws.region)
1143+
const wsProducer = queue.getProducer<QueueWorkspaceMessage>(toolCtx, QueueTopic.Workspace)
11511144
await wsProducer.send(ws.uuid, [workspaceEvents.fullReindex()])
1152-
await wsProducer.close()
1145+
await queue.shutdown()
11531146
await workspaceStorage?.close()
11541147
})
11551148
}
@@ -2092,12 +2085,10 @@ export function devTool (
20922085
}
20932086

20942087
console.log('reindex workspace', workspace)
2095-
const wsProducer = getPlatformQueue('tool', ws.region).createProducer<QueueWorkspaceMessage>(
2096-
toolCtx,
2097-
QueueTopic.Workspace
2098-
)
2088+
const queue = getPlatformQueue('tool', ws.region)
2089+
const wsProducer = queue.getProducer<QueueWorkspaceMessage>(toolCtx, QueueTopic.Workspace)
20992090
await wsProducer.send(ws.uuid, [workspaceEvents.fullReindex()])
2100-
await wsProducer.close()
2091+
await queue.shutdown()
21012092
console.log('done', workspace)
21022093
})
21032094
})

models/activity/src/migration.ts

-159
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ import {
4343
import { htmlToMarkup } from '@hcengineering/text'
4444
import {
4545
getAccountUuidByOldAccount,
46-
getAccountUuidBySocialKey,
47-
getSocialIdBySocialKey,
4846
getSocialIdFromOldAccount,
4947
getSocialKeyByOldAccount
5048
} from '@hcengineering/model-core'
@@ -365,151 +363,6 @@ async function migrateAccountsInDocUpdates (client: MigrationClient): Promise<vo
365363
ctx.info('finished processing activity doc updates ', {})
366364
}
367365

368-
/**
369-
* Migrates social ids to new accounts where needed.
370-
* Should only be applied to staging where old accounts have already been migrated to social ids.
371-
* REMOVE IT BEFORE MERGING TO PRODUCTION
372-
* @param client
373-
* @returns
374-
*/
375-
async function migrateSocialIdsInDocUpdates (client: MigrationClient): Promise<void> {
376-
const ctx = new MeasureMetricsContext('activity migrateSocialIdsInDocUpdates', {})
377-
const accountUuidBySocialKey = new Map<string, AccountUuid | null>()
378-
ctx.info('processing activity doc updates ', {})
379-
380-
async function getUpdatedVal (oldVal: string): Promise<any> {
381-
return (await getAccountUuidBySocialKey(client, oldVal, accountUuidBySocialKey)) ?? oldVal
382-
}
383-
384-
async function migrateField<P extends keyof DocAttributeUpdates> (
385-
au: DocAttributeUpdates,
386-
update: MigrateUpdate<DocUpdateMessage>['attributeUpdates'],
387-
field: P
388-
): Promise<void> {
389-
const oldValue = au?.[field]
390-
if (oldValue == null) return
391-
392-
let changed = false
393-
let newValue: any
394-
if (Array.isArray(oldValue)) {
395-
newValue = []
396-
for (const a of oldValue as any[]) {
397-
const newA = a != null ? await getUpdatedVal(a) : a
398-
if (newA !== a) {
399-
changed = true
400-
}
401-
newValue.push(newA)
402-
}
403-
} else {
404-
newValue = await getUpdatedVal(oldValue)
405-
if (newValue !== oldValue) {
406-
changed = true
407-
}
408-
}
409-
410-
if (changed) {
411-
if (update == null) throw new Error('update is null')
412-
413-
update[field] = newValue
414-
}
415-
}
416-
417-
const iterator = await client.traverse(DOMAIN_ACTIVITY, {
418-
_class: activity.class.DocUpdateMessage,
419-
action: 'update',
420-
'attributeUpdates.attrClass': 'core:class:TypePersonId',
421-
'attributeUpdates.attrKey': { $in: ['members', 'owners', 'user'] }
422-
})
423-
424-
try {
425-
let processed = 0
426-
while (true) {
427-
const docs = await iterator.next(200)
428-
if (docs === null || docs.length === 0) {
429-
break
430-
}
431-
432-
const operations: {
433-
filter: MigrationDocumentQuery<DocUpdateMessage>
434-
update: MigrateUpdate<DocUpdateMessage>
435-
}[] = []
436-
437-
for (const doc of docs) {
438-
const dum = doc as DocUpdateMessage
439-
if (dum.attributeUpdates == null) continue
440-
const update: any = { attributeUpdates: { ...dum.attributeUpdates } }
441-
442-
await migrateField(dum.attributeUpdates, update.attributeUpdates, 'added')
443-
await migrateField(dum.attributeUpdates, update.attributeUpdates, 'prevValue')
444-
await migrateField(dum.attributeUpdates, update.attributeUpdates, 'removed')
445-
await migrateField(dum.attributeUpdates, update.attributeUpdates, 'set')
446-
447-
update.attributeUpdates.attrClass = core.class.TypeAccountUuid
448-
449-
operations.push({
450-
filter: { _id: dum._id },
451-
update
452-
})
453-
}
454-
455-
if (operations.length > 0) {
456-
await client.bulk(DOMAIN_ACTIVITY, operations)
457-
}
458-
459-
processed += docs.length
460-
ctx.info('...processed', { count: processed })
461-
}
462-
} finally {
463-
await iterator.close()
464-
}
465-
466-
ctx.info('finished processing activity doc updates ', {})
467-
}
468-
469-
async function migrateSocialKeysToSocialIds (client: MigrationClient): Promise<void> {
470-
const ctx = new MeasureMetricsContext('activity migrateSocialKeysToSocialIds', {})
471-
472-
ctx.info('processing activity reactions ', {})
473-
const socialIdBySocialKey = new Map<string, PersonId | null>()
474-
const iterator = await client.traverse(DOMAIN_REACTION, { _class: activity.class.Reaction })
475-
476-
try {
477-
let processed = 0
478-
while (true) {
479-
const docs = await iterator.next(200)
480-
if (docs === null || docs.length === 0) {
481-
break
482-
}
483-
484-
const operations: { filter: MigrationDocumentQuery<Doc>, update: MigrateUpdate<Doc> }[] = []
485-
486-
for (const doc of docs) {
487-
const reaction = doc as Reaction
488-
const newCreateBy =
489-
(await getSocialIdBySocialKey(client, reaction.createBy, socialIdBySocialKey)) ?? reaction.createBy
490-
491-
if (newCreateBy === reaction.createBy) continue
492-
493-
operations.push({
494-
filter: { _id: doc._id },
495-
update: {
496-
createBy: newCreateBy
497-
}
498-
})
499-
processed++
500-
}
501-
502-
if (operations.length > 0) {
503-
await client.bulk(DOMAIN_REACTION, operations)
504-
ctx.info('...processed', { count: processed })
505-
}
506-
}
507-
} finally {
508-
await iterator.close()
509-
}
510-
ctx.info('finished processing activity reactions ', {})
511-
}
512-
513366
export const activityOperation: MigrateOperation = {
514367
async migrate (client: MigrationClient, mode): Promise<void> {
515368
await tryMigrate(mode, client, activityId, [
@@ -592,18 +445,6 @@ export const activityOperation: MigrateOperation = {
592445
state: 'accounts-in-doc-updates-v2',
593446
mode: 'upgrade',
594447
func: migrateAccountsInDocUpdates
595-
},
596-
// ONLY FOR STAGING. REMOVE IT BEFORE MERGING TO PRODUCTION
597-
{
598-
state: 'social-ids-in-doc-updates',
599-
mode: 'upgrade',
600-
func: migrateSocialIdsInDocUpdates
601-
},
602-
// ONLY FOR STAGING. REMOVE IT BEFORE MERGING TO PRODUCTION
603-
{
604-
state: 'social-keys-to-social-ids-v2',
605-
mode: 'upgrade',
606-
func: migrateSocialKeysToSocialIds
607448
}
608449
])
609450
},

models/all/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"@hcengineering/model-analytics-collector": "^0.6.0",
113113
"@hcengineering/model-server-ai-bot": "^0.6.0",
114114
"@hcengineering/model-ai-bot": "^0.6.0",
115+
"@hcengineering/model-media": "^0.6.0",
115116
"@hcengineering/model-recorder": "^0.6.0",
116117
"@hcengineering/model-test-management": "^0.6.0",
117118
"@hcengineering/model-survey": "^0.6.0",

0 commit comments

Comments
 (0)