Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-4725 Migrate collaborative content #5717

Merged
merged 36 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f37871c
Remove mongodb dependency from collaborator
aonnikov Apr 25, 2024
18f8c8e
Remove CollaborativeMarkup data type
aonnikov Apr 25, 2024
307bc76
Rename getCollaborativeDocId to makeCollaborativeDoc
aonnikov May 2, 2024
27fbc54
Remove old document migrations
aonnikov May 28, 2024
1162a7d
Revert collaborator mongo url
aonnikov May 28, 2024
4dae2e2
Simplify collaborator configuration
aonnikov May 28, 2024
ff6f00d
Remove mongo dependency from collaborator and refactor save to platform
aonnikov May 29, 2024
155ccec
Add options to create and update tx
aonnikov May 29, 2024
b7b0f73
fix typings
aonnikov May 29, 2024
c19f804
Migrate collaborative markup to storage
aonnikov May 30, 2024
f23a55a
fix issue preview description
aonnikov May 31, 2024
c3a7550
create snapshot when content is updated
aonnikov Jun 3, 2024
50a5783
fix activity for collaborative documents
aonnikov Jun 3, 2024
2f6fa35
fix formatting and svelte-check issues
aonnikov Jun 3, 2024
89b565d
replace getCollaborativDoc with makeCollaborativeDoc for quality docu…
aonnikov Jun 4, 2024
2d8e74b
support for mixins
aonnikov Jun 5, 2024
04be631
fix dependency version
aonnikov Jun 5, 2024
a6929a5
fix merge conflict
aonnikov Jun 8, 2024
13669a8
do not migrate existing collaborative documents
aonnikov Jun 10, 2024
34f6073
simplify indexer tests
aonnikov Jun 10, 2024
348b2a8
collect collaborative docs in CI
aonnikov Jun 10, 2024
528b5c7
modify collabortor port in sanity tests
aonnikov Jun 11, 2024
8a91f5f
use non-collaborative editor for issue templates
aonnikov Jun 11, 2024
e683c9f
make collaborative doc attributes required
aonnikov Jun 12, 2024
9437153
Merge branch 'develop' into migrate-collaborative-content
aonnikov Aug 20, 2024
754ae55
apply uberflow pr changes
aonnikov Aug 20, 2024
fd11713
rush fast-format
aonnikov Aug 20, 2024
11e0287
remove editor-kit
aonnikov Aug 20, 2024
f5e19ae
fix tiptap versions
aonnikov Aug 20, 2024
5705b6a
make markp trigger async
aonnikov Aug 20, 2024
3a85118
fix rush check issues
aonnikov Aug 20, 2024
b08d090
fix formtting issues
aonnikov Aug 20, 2024
69aaaeb
remove stuff
aonnikov Aug 22, 2024
dc1d9fa
remove redundant changes
aonnikov Aug 22, 2024
1494972
Merge remote-tracking branch 'origin/develop' into migrate-collaborat…
aonnikov Aug 22, 2024
db3a1ef
fix: update markup before creating doc
aonnikov Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ jobs:
docker logs $(docker ps | grep transactor | cut -f 1 -d ' ') > logs/transactor.log
docker logs $(docker ps | grep account | cut -f 1 -d ' ') > logs/account.log
docker logs $(docker ps | grep front | cut -f 1 -d ' ') > logs/front.log
docker logs $(docker ps | grep collaborator | cut -f 1 -d ' ') > logs/collaborator.log
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -438,6 +439,7 @@ jobs:
docker logs $(docker ps | grep transactor | cut -f 1 -d ' ') > logs/uweb-transactor.log
docker logs $(docker ps | grep account | cut -f 1 -d ' ') > logs/uweb-account.log
docker logs $(docker ps | grep front | cut -f 1 -d ' ') > logs/uweb-front.log
docker logs $(docker ps | grep collaborator | cut -f 1 -d ' ') > logs/uweb-collaborator.log
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
Expand Down
6 changes: 2 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"SERVER_SECRET": "secret",
"ENABLE_CONSOLE": "true",
"COLLABORATOR_URL": "ws://localhost:3078",
"COLLABORATOR_API_URL": "http://localhost:3078",
"REKONI_URL": "http://localhost:4004",
"FRONT_URL": "http://localhost:8080",
"ACCOUNTS_URL": "http://localhost:3000",
Expand Down Expand Up @@ -104,7 +103,6 @@
"UPLOAD_URL": "/files",
"SERVER_PORT": "8087",
"COLLABORATOR_URL": "ws://localhost:3078",
"COLLABORATOR_API_URL": "http://localhost:3078",
"CALENDAR_URL": "http://localhost:8095",
"GMAIL_URL": "http://localhost:8088",
"TELEGRAM_URL": "http://localhost:8086",
Expand Down Expand Up @@ -239,7 +237,7 @@
"CLIENT_ID": "${env:POD_GITHUB_CLIENTID}",
"CLIENT_SECRET": "${env:POD_GITHUB_CLIENT_SECRET}",
"PRIVATE_KEY": "${env:POD_GITHUB_PRIVATE_KEY}",
"COLLABORATOR_API_URL": "http://localhost:3078",
"COLLABORATOR_URL": "ws://localhost:3078",
"SYSTEM_EMAIL": "[email protected]",
"MINIO_ENDPOINT": "localhost",
"MINIO_ACCESS_KEY": "minioadmin",
Expand Down Expand Up @@ -280,7 +278,7 @@
"env": {
"SERVER_SECRET": "secret",
"ACCOUNTS_URL": "http://localhost:3000",
"COLLABORATOR_API_URL": "http://localhost:3078",
"COLLABORATOR_URL": "ws://localhost:3078",
"STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin",
"MONGO_URL": "mongodb://localhost:27017"
},
Expand Down
1 change: 0 additions & 1 deletion desktop/src/ui/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export async function configurePlatform (): Promise<void> {
setMetadata(presentation.metadata.UploadURL, config.UPLOAD_URL)
setMetadata(presentation.metadata.FilesURL, config.FILES_URL)
setMetadata(presentation.metadata.CollaboratorUrl, config.COLLABORATOR_URL)
setMetadata(presentation.metadata.CollaboratorApiUrl, config.COLLABORATOR_API_URL)
setMetadata(presentation.metadata.PreviewConfig, parsePreviewConfig(config.PREVIEW_CONFIG))
setMetadata(presentation.metadata.FrontUrl, config.FRONT_URL)

Expand Down
1 change: 0 additions & 1 deletion desktop/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ScreenSource } from '@hcengineering/love'
export interface Config {
ACCOUNTS_URL: string
COLLABORATOR_URL: string
COLLABORATOR_API_URL: string
FRONT_URL: string
FILES_URL: string
UPLOAD_URL: string
Expand Down
2 changes: 1 addition & 1 deletion dev/doc-import-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:watch": "compile",
"_phase:bundle": "rushx bundle",
"bundle": "mkdir -p bundle && node esbuild.js",
"run-local": "cross-env SERVER_SECRET=secret MONGO_URL=mongodb://localhost:27017 COLLABORATOR_URL=ws://localhost:3078 COLLABORATOR_API_URL=http://localhost:3078 STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin PRODUCT_ID=ezqms node --nolazy -r ts-node/register ./src/__start.ts",
"run-local": "cross-env SERVER_SECRET=secret MONGO_URL=mongodb://localhost:27017 COLLABORATOR_URL=ws://localhost:3078 STORAGE_CONFIG=minio|minio?accessKey=minioadmin&secretKey=minioadmin PRODUCT_ID=ezqms node --nolazy -r ts-node/register ./src/__start.ts",
"run": "cross-env node -r ts-node/register --max-old-space-size=8000 ./src/__start.ts",
"format": "format src",
"test": "jest --passWithNoTests --silent",
Expand Down
2 changes: 1 addition & 1 deletion dev/doc-import-tool/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HtmlConversionBackend } from './convert/convert'
export interface Config {
doc: string
token: string
collaboratorApiURL: string
collaboratorURL: string
uploadURL: string
workspaceId: WorkspaceId
owner: Ref<Employee>
Expand Down
12 changes: 6 additions & 6 deletions dev/doc-import-tool/src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import core, {
Ref,
TxOperations,
generateId,
getCollaborativeDoc,
makeCollaborativeDoc,
systemAccountEmail,
type Blob
} from '@hcengineering/core'
Expand Down Expand Up @@ -100,7 +100,7 @@ async function createDocument (
abstract: '',
effectiveDate: 0,
reviewInterval: DEFAULT_PERIODIC_REVIEW_INTERVAL,
content: getCollaborativeDoc(generateId()),
content: makeCollaborativeDoc(generateId()),
snapshots: 0,
plannedEffectiveDate: 0
}
Expand Down Expand Up @@ -168,7 +168,7 @@ async function createTemplateIfNotExist (
approvers: [],
coAuthors: [],
changeControl: ccRecordId,
content: getCollaborativeDoc(generateId()),
content: makeCollaborativeDoc(generateId()),
snapshots: 0,
plannedEffectiveDate: 0
}
Expand Down Expand Up @@ -208,8 +208,8 @@ async function createSections (
throw new Error(`Invalid document: ${JSON.stringify(doc)}`)
}

const { collaboratorApiURL, token, workspaceId } = config
const collaborator = getCollaboratorClient(txops.getHierarchy(), workspaceId, token, collaboratorApiURL)
const { collaboratorURL, token, workspaceId } = config
const collaborator = getCollaboratorClient(workspaceId, token, collaboratorURL)

console.log('Creating document content')

Expand All @@ -229,7 +229,7 @@ async function createSections (
content += `<h1>${section.title}</h1>${section.content}`
}

await collaborator.updateContent(collabId, 'content', content)
await collaborator.updateContent(collabId, { content })
} finally {
// do nothing
}
Expand Down
6 changes: 3 additions & 3 deletions dev/doc-import-tool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function docImportTool (): void {
process.exit(1)
}

const collaboratorApiUrl = process.env.COLLABORATOR_API_URL
if (collaboratorApiUrl === undefined) {
const collaboratorUrl = process.env.COLLABORATOR_URL
if (collaboratorUrl === undefined) {
console.error('please provide collaborator url')
process.exit(1)
}
Expand Down Expand Up @@ -104,7 +104,7 @@ export function docImportTool (): void {
space: cmd.space,
uploadURL: uploadUrl,
storageAdapter,
collaboratorApiURL: collaboratorApiUrl,
collaboratorURL: collaboratorUrl,
token: generateToken(systemAccountEmail, workspaceId)
}

Expand Down
1 change: 0 additions & 1 deletion dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ services:
- TELEGRAM_URL=http://localhost:8086
- REKONI_URL=http://localhost:4004
- COLLABORATOR_URL=ws://localhost:3078
- COLLABORATOR_API_URL=http://localhost:3078
- STORAGE_CONFIG=${STORAGE_CONFIG}
- GITHUB_URL=http://localhost:3500
- PRINT_URL=http://localhost:4005
Expand Down
1 change: 0 additions & 1 deletion dev/local-mongo/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ services:
- TELEGRAM_URL=http://localhost:8086
- REKONI_URL=http://localhost:4004
- COLLABORATOR_URL=ws://localhost:3078
- COLLABORATOR_API_URL=http://localhost:3078
- STORAGE_CONFIG=${STORAGE_CONFIG}
- GITHUB_URL=http://localhost:3500
- PRINT_URL=http://localhost:4005
Expand Down
3 changes: 1 addition & 2 deletions dev/prod/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ FRONT_URL=http://localhost:8080
REKONI_URL=http://localhost:4004

COLLABORATOR_URL=ws://locahost:3078
COLLABORATOR_API_URL=http://locahost:3078

PRINT_URL=http://localhost:4005
SIGN_URL=http://localhost:4006

ANALYTICS_COLLECTOR_URL=http://localhost:4007
ANALYTICS_COLLECTOR_URL=http://localhost:4007
1 change: 0 additions & 1 deletion dev/prod/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"ACCOUNTS_URL":"http://localhost:3000",
"COLLABORATOR_URL": "ws://localhost:3078",
"COLLABORATOR_API_URL": "http://localhost:3078",
"UPLOAD_URL":"/files",
"REKONI_URL": "http://localhost:4004",
"PRINT_URL": "http://localhost:4005",
Expand Down
3 changes: 1 addition & 2 deletions dev/prod/public/config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"GMAIL_URL": "https://gmail.hc.engineering",
"CALENDAR_URL": "https://calendar.hc.engineering",
"REKONI_URL": "https://rekoni.hc.engineering",
"COLLABORATOR_URL": "wss://collaborator.hc.engineering",
"COLLABORATOR_API_URL": "https://collaborator.hc.engineering"
"COLLABORATOR_URL": "wss://collaborator.hc.engineering"
}
1 change: 0 additions & 1 deletion dev/prod/public/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"ACCOUNTS_URL":"/account",
"COLLABORATOR_URL": "ws://localhost:3078",
"COLLABORATOR_API_URL": "http://localhost:3078",
"UPLOAD_URL":"/files",
"TELEGRAM_URL": "http://localhost:8086",
"GMAIL_URL": "http://localhost:8088",
Expand Down
2 changes: 0 additions & 2 deletions dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export interface Config {
MODEL_VERSION: string
VERSION: string
COLLABORATOR_URL: string
COLLABORATOR_API_URL: string
REKONI_URL: string
TELEGRAM_URL: string
GMAIL_URL: string
Expand Down Expand Up @@ -288,7 +287,6 @@ export async function configurePlatform() {
setMetadata(presentation.metadata.FilesURL, config.FILES_URL)
setMetadata(presentation.metadata.UploadURL, config.UPLOAD_URL)
setMetadata(presentation.metadata.CollaboratorUrl, config.COLLABORATOR_URL)
setMetadata(presentation.metadata.CollaboratorApiUrl, config.COLLABORATOR_API_URL)

setMetadata(presentation.metadata.FrontUrl, config.FRONT_URL)
setMetadata(presentation.metadata.PreviewConfig, parsePreviewConfig(config.PREVIEW_CONFIG))
Expand Down
4 changes: 0 additions & 4 deletions dev/tool/src/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,10 +1214,6 @@ async function updateId (
const markup = (contentDoc as any)[attrName] as Markup
const newMarkup = markup.replaceAll(doc._id, newId)
await update(h, db, contentDoc, { [attrName]: newMarkup })
} else if (attr.type._class === core.class.TypeCollaborativeMarkup) {
const markup = (contentDoc as any)[attrName]
const newMarkup = markup.replaceAll(doc._id, newId)
await update(h, db, contentDoc, { [attrName]: newMarkup })
} else if (attr.type._class === core.class.TypeCollaborativeDoc) {
const collaborativeDoc = (contentDoc as any)[attr.name] as CollaborativeDoc
await updateYDoc(ctx, collaborativeDoc, storage, workspaceId, contentDoc, newId, doc)
Expand Down
9 changes: 3 additions & 6 deletions dev/tool/src/markup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import core, {
type MeasureContext,
type Ref,
type WorkspaceId,
getCollaborativeDocId
makeCollaborativeDoc
} from '@hcengineering/core'
import { getMongoClient, getWorkspaceDB } from '@hcengineering/mongo'
import { type StorageAdapter } from '@hcengineering/server-core'
Expand Down Expand Up @@ -39,10 +39,7 @@ export async function fixJsonMarkup (

const attributes = hierarchy.getAllAttributes(_class)
const filtered = Array.from(attributes.values()).filter((attribute) => {
return (
hierarchy.isDerived(attribute.type._class, core.class.TypeMarkup) ||
hierarchy.isDerived(attribute.type._class, core.class.TypeCollaborativeMarkup)
)
return hierarchy.isDerived(attribute.type._class, core.class.TypeMarkup)
})
if (filtered.length === 0) continue

Expand Down Expand Up @@ -88,7 +85,7 @@ async function processFixJsonMarkupFor (
}
if (res !== value) {
update[attribute.name] = res
remove.push(getCollaborativeDocId(doc._id, attribute.name))
remove.push(makeCollaborativeDoc(doc._id, attribute.name))
}
}
} catch {}
Expand Down
4 changes: 1 addition & 3 deletions models/activity/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ async function migrateMarkup (client: MigrationClient): Promise<void> {
DOMAIN_ACTIVITY,
{
_class: activity.class.DocUpdateMessage,
'attributeUpdates.attrClass': {
$in: [core.class.TypeMarkup, core.class.TypeCollaborativeMarkup]
}
'attributeUpdates.attrClass': core.class.TypeMarkup
},
{
projection: {
Expand Down
8 changes: 4 additions & 4 deletions models/contact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import {
IndexKind,
type Blob,
type Class,
type CollaborativeDoc,
type Domain,
type Markup,
type Ref,
type Timestamp
} from '@hcengineering/core'
Expand All @@ -54,7 +54,7 @@ import {
ReadOnly,
TypeBlob,
TypeBoolean,
TypeCollaborativeMarkup,
TypeCollaborativeDoc,
TypeDate,
TypeRecord,
TypeRef,
Expand Down Expand Up @@ -173,9 +173,9 @@ export class TMember extends TAttachedDoc implements Member {
@Model(contact.class.Organization, contact.class.Contact)
@UX(contact.string.Organization, contact.icon.Company, 'ORG', 'name', undefined, contact.string.Organizations)
export class TOrganization extends TContact implements Organization {
@Prop(TypeCollaborativeMarkup(), core.string.Description)
@Prop(TypeCollaborativeDoc(), core.string.Description)
@Index(IndexKind.FullText)
description?: Markup
description!: CollaborativeDoc

@Prop(Collection(contact.class.Member), contact.string.Members)
members!: number
Expand Down
4 changes: 2 additions & 2 deletions models/controlled-documents/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TxOperations,
generateId,
DOMAIN_TX,
getCollaborativeDoc,
makeCollaborativeDoc,
MeasureMetricsContext,
type Class,
type Doc,
Expand Down Expand Up @@ -143,7 +143,7 @@ async function createProductChangeControlTemplate (tx: TxOperations): Promise<vo
minor: 1,
state: DocumentState.Effective,
commentSequence: 0,
content: getCollaborativeDoc(generateId())
content: makeCollaborativeDoc(generateId())
},
ccCategory
)
Expand Down
4 changes: 3 additions & 1 deletion models/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"@hcengineering/core": "^0.6.32",
"@hcengineering/model": "^0.6.11",
"@hcengineering/platform": "^0.6.11",
"@hcengineering/storage": "^0.6.0"
"@hcengineering/storage": "^0.6.0",
"@hcengineering/collaboration": "^0.6.0",
"@hcengineering/text": "^0.6.5"
}
}
4 changes: 0 additions & 4 deletions models/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ export class TTypeFileSize extends TType {}
@Model(core.class.TypeMarkup, core.class.Type)
export class TTypeMarkup extends TType {}

@UX(core.string.Collaborative)
@Model(core.class.TypeCollaborativeMarkup, core.class.Type)
export class TTypeCollaborativeMarkup extends TType {}

@UX(core.string.Ref)
@Model(core.class.RefTo, core.class.Type)
export class TRefTo extends TType implements RefTo<Doc> {
Expand Down
2 changes: 0 additions & 2 deletions models/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import {
TTypeBoolean,
TTypeCollaborativeDoc,
TTypeCollaborativeDocVersion,
TTypeCollaborativeMarkup,
TTypeDate,
TTypeFileSize,
TTypeHyperlink,
Expand Down Expand Up @@ -141,7 +140,6 @@ export function createModel (builder: Builder): void {
TTypeMarkup,
TTypeCollaborativeDoc,
TTypeCollaborativeDocVersion,
TTypeCollaborativeMarkup,
TArrOf,
TRefTo,
TTypeDate,
Expand Down
Loading