From f1f254b104a68cf0d55e383907369c1aa39920d5 Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Fri, 10 Sep 2021 09:57:49 +0200 Subject: [PATCH] tool update Signed-off-by: Andrey Platov --- common/config/rush/pnpm-lock.yaml | 19 +- dev/tool/package.json | 12 +- dev/tool/run.sh | 2 + dev/tool/src/index.ts | 79 +- dev/tool/src/model.tx.json | 1490 +++++++++++++++++++++++++++++ dev/tool/src/workspace.ts | 59 ++ dev/tool/tsconfig.json | 3 +- models/contact/src/plugin.ts | 5 +- models/demo/src/index.ts | 23 - plugins/contact/src/index.ts | 5 +- server/account/src/index.ts | 8 +- server/contrib/src/connection.ts | 8 +- 12 files changed, 1658 insertions(+), 55 deletions(-) create mode 100644 dev/tool/src/model.tx.json create mode 100644 dev/tool/src/workspace.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 76ccf39d97..0b9249441a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -91,7 +91,6 @@ specifiers: css-loader: ^5.2.1 deep-equal: ^2.0.5 dotenv-webpack: ^7.0.2 - esbuild: ^0.12.24 eslint: ^7.32.0 eslint-config-standard-with-typescript: ^20.0.0 eslint-plugin-import: '2' @@ -213,7 +212,6 @@ dependencies: css-loader: 5.2.7_webpack@5.48.0 deep-equal: 2.0.5 dotenv-webpack: 7.0.3_webpack@5.48.0 - esbuild: 0.12.24 eslint: 7.32.0 eslint-config-standard-with-typescript: 20.0.0_2e482f375e273d762fe67cbd5e194b49 eslint-plugin-import: 2.23.4_eslint@7.32.0 @@ -3463,12 +3461,6 @@ packages: resolution: {integrity: sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==} dev: false - /esbuild/0.12.24: - resolution: {integrity: sha512-C0ibY+HsXzYB6L/pLWEiWjMpghKsIc58Q5yumARwBQsHl9DXPakW+5NI/Y9w4YXiz0PEP6XTGTT/OV4Nnsmb4A==} - hasBin: true - requiresBuild: true - dev: false - /esbuild/0.12.26: resolution: {integrity: sha512-YmTkhPKjvTJ+G5e96NyhGf69bP+hzO0DscqaVJTi5GM34uaD4Ecj7omu5lJO+NrxCUBRhy2chONLK1h/2LwoXA==} hasBin: true @@ -9431,7 +9423,7 @@ packages: '@types/heft-jest': 1.0.2 '@types/node': 16.7.5 '@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea - esbuild: 0.12.24 + esbuild: 0.12.26 eslint: 7.32.0 eslint-plugin-import: 2.23.4_eslint@7.32.0 eslint-plugin-node: 11.1.0_eslint@7.32.0 @@ -10124,12 +10116,14 @@ packages: dev: false file:projects/tool.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-Z0BaX1B1yinHaiai353t9rj20BUpViVPFU9rX9LC0dA8wvHQ/5WY8jgEmhwrHYhq/+iauybdXG8tBCJLBQTeBQ==, tarball: file:projects/tool.tgz} + resolution: {integrity: sha512-mb2zTxDp5DHlfEi7/b+0vGiTzSkQsIpDf3A5ZgT/zjugH4VCX2j8M7N7n+ZA1+KFdhw69egzQ3Hru0gCATaWEg==, tarball: file:projects/tool.tgz} id: file:projects/tool.tgz name: '@rush-temp/tool' version: 0.0.0 dependencies: '@types/heft-jest': 1.0.2 + '@types/minio': 7.0.10 + '@types/node': 16.7.5 '@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea commander: 8.1.0 esbuild: 0.12.26 @@ -10137,12 +10131,13 @@ packages: eslint-plugin-import: 2.23.4_eslint@7.32.0 eslint-plugin-node: 11.1.0_eslint@7.32.0 eslint-plugin-promise: 4.3.1 + jwt-simple: 0.5.6 + minio: 7.0.19 mongodb: 4.1.1 - ts-node: 10.2.1_typescript@4.3.5 + ts-node: 10.2.1_eb14afb1492fcd444e277f1fdb668e87 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' - - '@types/node' - '@typescript-eslint/parser' - supports-color - typescript diff --git a/dev/tool/package.json b/dev/tool/package.json index 99ea1da303..5c2cd3bc02 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -21,11 +21,19 @@ "eslint-plugin-node":"11", "eslint":"^7.32.0", "ts-node":"^10.2.1", - "esbuild":"^0.12.26" + "esbuild":"^0.12.26", + "@types/minio":"^7.0.10", + "@types/node":"^16.7.5" }, "dependencies": { "mongodb":"^4.1.1", "commander":"^8.1.0", - "@anticrm/account":"~0.6.0" + "@anticrm/account":"~0.6.0", + "jwt-simple":"^0.5.6", + "@anticrm/contrib":"~0.6.0", + "@anticrm/core":"~0.6.11", + "@anticrm/contact":"~0.6.0", + "@anticrm/workspace":"~0.6.0", + "minio":"^7.0.19" } } diff --git a/dev/tool/run.sh b/dev/tool/run.sh index 08bdee1315..0f3cfd7afc 100755 --- a/dev/tool/run.sh +++ b/dev/tool/run.sh @@ -20,5 +20,7 @@ export MINIO_SECRET_KEY=$(kubectl get secret --namespace default minio -o jsonpa kubectl run anticrm-tool --rm --tty -i --restart='Never' \ --env="MONGO_URL=mongodb://root:$MONGODB_ROOT_PASSWORD@mng-mongodb:27017/" \ + --env="TRANSACTOR_URL=ws://transactor/" \ + --env="MINIO_ENDPOINT=minio" \ --env="MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \ --env="MINIO_SECRET_KEY=$MINIO_SECRET_KEY" --image anticrm/tool --command -- bash diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index d63e1593dd..9cec799090 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -17,8 +17,51 @@ import { program } from 'commander' import { MongoClient, Db } from 'mongodb' import { getAccount, createAccount, assignWorkspace, createWorkspace } from '@anticrm/account' +import { createContributingClient } from '@anticrm/contrib' +import core, { TxOperations } from '@anticrm/core' +import { encode } from 'jwt-simple' +import { Client } from 'minio' +import { initWorkspace } from './workspace' -const mongodbUri = process.env.MONGO_URL ?? 'mongodb://localhost:27017' +import contact from '@anticrm/contact' + +const mongodbUri = process.env.MONGO_URL +if (mongodbUri === undefined) { + console.error('please provide mongodb url.') + process.exit(1) +} + +const transactorUrl = process.env.TRANSACTOR_URL +if (transactorUrl === undefined) { + console.error('please provide transactor url.') + process.exit(1) +} + +const minioEndpoint = process.env.MINIO_ENDPOINT +if (minioEndpoint === undefined) { + console.error('please provide minio endpoint') + process.exit(1) +} + +const minioAccessKey = process.env.MINIO_ACCESS_KEY +if (minioAccessKey === undefined) { + console.error('please provide minio access key') + process.exit(1) +} + +const minioSecretKey = process.env.MINIO_SECRET_KEY +if (minioSecretKey === undefined) { + console.error('please provide minio secret key') + process.exit(1) +} + +const minio = new Client({ + endPoint: minioEndpoint, + port: 9000, + useSSL: false, + accessKey: minioAccessKey, + secretKey: minioSecretKey +}) async function withDatabase (uri: string, f: (db: Db) => Promise): Promise { console.log(`connecting to database '${uri}'...`) @@ -35,21 +78,40 @@ program .command('create-user ') .description('create user and corresponding account in master database') .requiredOption('-p, --password ', 'user password') - .requiredOption('-f, --fullname ', 'full user name') - .action(async (email, cmd) => { + .requiredOption('-f, --first ', 'first name') + .requiredOption('-l, --last ', 'first name') + .action(async (email: string, cmd) => { return await withDatabase(mongodbUri, async (db) => { - await createAccount(db, email, cmd.password) - // await createContact(withTenant(client, cmd.workspace), email, cmd.fullname) + console.log(`creating account ${cmd.firstname as string} ${cmd.lastname as string} (${email})...`) + await createAccount(db, email, cmd.password, cmd.firstname, cmd.lastname) }) }) program .command('assign-workspace ') .description('assign workspace') - .action(async (email, workspace, cmd) => { + .action(async (email: string, workspace: string, cmd) => { return await withDatabase(mongodbUri, async (db) => { - console.log(`assigning user ${email as string} to ${workspace as string}...`) + console.log(`retrieveing account from ${email}...`) + const account = await getAccount(db, email) + if (account === null) { + throw new Error('account not found') + } + console.log(`assigning user ${email} to ${workspace}...`) await assignWorkspace(db, email, workspace) + const token = encode({ email: 'anticrm@hc.engineering', workspace }, 'secret') + const url = new URL(`/${token}`, transactorUrl) + const contrib = await createContributingClient(url.href) + const txop = new TxOperations(contrib, core.account.System) + await txop.createDoc(contact.class.Employee, contact.space.Employee, { + firstName: account.first, + lastName: account.last, + city: 'Mountain View', + channels: [] + }) + await txop.createDoc(core.class.Account, core.space.Model, { + email + }) }) }) @@ -70,8 +132,7 @@ program .action(async (workspace, cmd) => { return await withDatabase(mongodbUri, async (db) => { await createWorkspace(db, workspace, cmd.organization) - - // await initDatabase(withTenant(client, workspace)) + await initWorkspace(mongodbUri, workspace, transactorUrl, minio) }) }) diff --git a/dev/tool/src/model.tx.json b/dev/tool/src/model.tx.json new file mode 100644 index 0000000000..9b2a1e41b7 --- /dev/null +++ b/dev/tool/src/model.tx.json @@ -0,0 +1,1490 @@ +[ + { + "_id": "6138e727b33f4e301505895d", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Obj", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0 + } + }, + { + "_id": "6138e727b33f4e301505895e", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Doc", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Obj" + } + }, + { + "_id": "6138e727b33f4e301505895f", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:State", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "state", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058960", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Type", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058961", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:TypeString", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Type" + } + }, + { + "_id": "6138e727b33f4e3015058962", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Attribute", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058963", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Account", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058964", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Space", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058965", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Tx", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "tx", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058966", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:TxCUD", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Tx" + } + }, + { + "_id": "6138e727b33f4e3015058967", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:TxUpdateDoc", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:TxCUD" + } + }, + { + "_id": "6138e727b33f4e3015058968", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:TxMixin", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:TxCUD" + } + }, + { + "_id": "6138e727b33f4e3015058969", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:TxCreateDoc", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:TxCUD" + } + }, + { + "_id": "6138e727b33f4e301505896a", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Class", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e301505896b", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "core:class:Mixin", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e301505896c", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:class:Viewlet", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e301505896d", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:class:ViewletDescriptor", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e301505896e", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:mixin:ObjectEditor", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e301505896f", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:mixin:KanbanCard", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e3015058970", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:mixin:AttributePresenter", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143360, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e3015058971", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:mixin:AttributeEditor", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e3015058972", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "core:class:TypeString", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributeEditor", + "attributes": { + "editor": "view:component:StringEditor" + } + }, + { + "_id": "6138e727b33f4e3015058973", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "core:class:TypeString", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributePresenter", + "attributes": { + "presenter": "view:component:StringPresenter" + } + }, + { + "_id": "6138e727b33f4e3015058974", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "core:class:State", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributePresenter", + "attributes": { + "presenter": "view:component:StatePresenter" + } + }, + { + "_id": "6138e727b33f4e3015058975", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:viewlet:Table", + "objectClass": "view:class:ViewletDescriptor", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Table", + "icon": "view:icon:Table", + "component": "view:component:TableView" + } + }, + { + "_id": "6138e727b33f4e3015058976", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "view:viewlet:Kanban", + "objectClass": "view:class:ViewletDescriptor", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Kanban", + "icon": "view:icon:Kanban", + "component": "view:component:KanbanView" + } + }, + { + "_id": "6138e727b33f4e3015058977", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "workbench:mixin:SpaceView", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Class" + } + }, + { + "_id": "6138e727b33f4e3015058978", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "workbench:class:Application", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058979", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:Contact", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "contact", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e301505897a", + "objectId": "6138e727b33f4e301505897b", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143186, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "channels", + "type": { + "_class": "contact:class:TypeChannels" + }, + "label": "Contact Info", + "attributeOf": "contact:class:Contact" + } + }, + { + "_id": "6138e727b33f4e301505897c", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:Person", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "contact:class:Contact", + "label": "Person" + } + }, + { + "_id": "6138e727b33f4e301505897d", + "objectId": "6138e727b33f4e301505897e", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143186, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "firstName", + "type": { + "_class": "core:class:TypeString" + }, + "label": "First name", + "attributeOf": "contact:class:Person" + } + }, + { + "_id": "6138e727b33f4e301505897f", + "objectId": "6138e727b33f4e3015058980", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143186, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "lastName", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Last name", + "attributeOf": "contact:class:Person" + } + }, + { + "_id": "6138e727b33f4e3015058981", + "objectId": "6138e727b33f4e3015058982", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143186, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "city", + "type": { + "_class": "core:class:TypeString" + }, + "label": "City", + "attributeOf": "contact:class:Person" + } + }, + { + "_id": "6138e727b33f4e3015058983", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:Employee", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "contact:class:Person" + } + }, + { + "_id": "6138e727b33f4e3015058984", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:Organization", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "contact:class:Contact" + } + }, + { + "_id": "6138e727b33f4e3015058985", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:TypeChannels", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Type" + } + }, + { + "_id": "6138e727b33f4e3015058986", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:class:ChannelProvider", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058987", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "contact:class:TypeChannels", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributePresenter", + "attributes": { + "presenter": "contact:component:ChannelsPresenter" + } + }, + { + "_id": "6138e727b33f4e3015058988", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:channelProvider:Email", + "objectClass": "contact:class:ChannelProvider", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Email", + "icon": "contact:icon:Email", + "placeholder": "john.appleseed@apple.com" + } + }, + { + "_id": "6138e727b33f4e3015058989", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e301505898a", + "objectClass": "contact:class:ChannelProvider", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Phone", + "icon": "contact:icon:Phone", + "placeholder": "+1 555 333 7777" + } + }, + { + "_id": "6138e727b33f4e301505898b", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e301505898c", + "objectClass": "contact:class:ChannelProvider", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "LinkedIn", + "icon": "contact:icon:LinkedIn", + "placeholder": "https://linkedin.com/in/jappleseed" + } + }, + { + "_id": "6138e727b33f4e301505898d", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e301505898e", + "objectClass": "contact:class:ChannelProvider", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Twitter", + "icon": "contact:icon:Twitter", + "placeholder": "@appleseed" + } + }, + { + "_id": "6138e727b33f4e301505898f", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e3015058990", + "objectClass": "contact:class:ChannelProvider", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Telegram", + "icon": "contact:icon:Telegram", + "placeholder": "@appleseed" + } + }, + { + "_id": "6138e727b33f4e3015058991", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "contact:space:Employee", + "objectClass": "core:class:Space", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "name": "Employees", + "description": "Employees", + "private": false, + "members": [] + } + }, + { + "_id": "6138e727b33f4e3015058992", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "contact:class:Person", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributePresenter", + "attributes": { + "presenter": "contact:component:PersonPresenter" + } + }, + { + "_id": "6138e727b33f4e3015058993", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:class:Attachment", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "attachment", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058994", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:class:Comment", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "comment", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058995", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:class:Backlink", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "chunter:class:Comment" + } + }, + { + "_id": "6138e727b33f4e3015058996", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:class:Message", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "chunter", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e3015058997", + "objectId": "6138e727b33f4e3015058998", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143289, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "content", + "index": 0, + "type": { + "_class": "core:class:TypeString" + }, + "label": "Content", + "attributeOf": "chunter:class:Message" + } + }, + { + "_id": "6138e727b33f4e3015058999", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:class:Channel", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Space", + "label": "chunter:string:Channel", + "icon": "chunter:icon:Hashtag" + } + }, + { + "_id": "6138e727b33f4e301505899a", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "chunter:class:Channel", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "workbench:mixin:SpaceView", + "attributes": { + "view": { + "class": "chunter:class:Message" + } + } + }, + { + "_id": "6138e727b33f4e301505899b", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "chunter:viewlet:Chat", + "objectClass": "view:class:ViewletDescriptor", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "Chat", + "icon": "view:icon:Table", + "component": "chunter:component:ChannelView" + } + }, + { + "_id": "6138e727b33f4e301505899c", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e301505899d", + "objectClass": "view:class:Viewlet", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "attachTo": "chunter:class:Message", + "descriptor": "chunter:viewlet:Chat", + "open": "X", + "config": {} + } + }, + { + "_id": "6138e727b33f4e301505899e", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e301505899f", + "objectClass": "workbench:class:Application", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "chunter:string:ApplicationLabelChunter", + "icon": "chunter:icon:Chunter", + "navigatorModel": { + "spaces": [ + { + "label": "chunter:string:Channels", + "spaceClass": "chunter:class:Channel", + "addSpaceLabel": "chunter:string:CreateChannel", + "createComponent": "chunter:component:CreateChannel" + } + ] + } + } + }, + { + "_id": "6138e727b33f4e30150589a0", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589a1", + "objectClass": "chunter:class:Channel", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "name": "general", + "description": "General Channel", + "private": false, + "members": [] + } + }, + { + "_id": "6138e727b33f4e30150589a2", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589a3", + "objectClass": "chunter:class:Channel", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "name": "random", + "description": "Random Talks", + "private": false, + "members": [] + } + }, + { + "_id": "6138e727b33f4e30150589a4", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "chunter:class:Attachment", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:AttributePresenter", + "attributes": { + "presenter": "chunter:component:AttachmentPresenter" + } + }, + { + "_id": "6138e727b33f4e30150589a5", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "task:class:Task", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e30150589a6", + "objectId": "6138e727b33f4e30150589a7", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143233, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "title", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Title", + "attributeOf": "task:class:Task" + } + }, + { + "_id": "6138e727b33f4e30150589a8", + "objectId": "6138e727b33f4e30150589a9", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143233, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "description", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Description", + "attributeOf": "task:class:Task" + } + }, + { + "_id": "6138e727b33f4e30150589aa", + "objectId": "6138e727b33f4e30150589ab", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143233, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "assignee", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Assignee", + "attributeOf": "task:class:Task" + } + }, + { + "_id": "6138e727b33f4e30150589ac", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "task:class:Project", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Space", + "label": "Project", + "icon": "task:icon:Task" + } + }, + { + "_id": "6138e727b33f4e30150589ad", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "task:class:Project", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "workbench:mixin:SpaceView", + "attributes": { + "view": { + "class": "task:class:Task", + "createItemDialog": "task:component:CreateTask" + } + } + }, + { + "_id": "6138e727b33f4e30150589ae", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589af", + "objectClass": "view:class:Viewlet", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "attachTo": "task:class:Task", + "descriptor": "view:viewlet:Table", + "open": "ZX", + "options": { + "lookup": { + "assignee": "contact:class:Employee" + } + }, + "config": [ + "title", + "$lookup.assignee" + ] + } + }, + { + "_id": "6138e727b33f4e30150589b0", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589b1", + "objectClass": "workbench:class:Application", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "task:string:ApplicationLabelTask", + "icon": "task:icon:Task", + "navigatorModel": { + "spaces": [ + { + "label": "task:string:Projects", + "spaceClass": "task:class:Project", + "addSpaceLabel": "task:string:CreateProject", + "createComponent": "task:component:CreateProject" + } + ] + } + } + }, + { + "_id": "6138e727b33f4e30150589b2", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589b3", + "objectClass": "task:class:Project", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "name": "demo", + "description": "Demo Project", + "private": false, + "members": [] + } + }, + { + "_id": "6138e727b33f4e30150589b4", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "recruit:class:Applicant", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "recruit", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e30150589b5", + "objectId": "6138e727b33f4e30150589b6", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143340, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "candidate", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Candidate", + "attributeOf": "recruit:class:Applicant" + } + }, + { + "_id": "6138e727b33f4e30150589b7", + "objectId": "6138e727b33f4e30150589b8", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143340, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "state", + "type": { + "_class": "core:class:TypeString" + }, + "label": "State", + "attributeOf": "recruit:class:Applicant" + } + }, + { + "_id": "6138e727b33f4e30150589b9", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "recruit:class:Candidate", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "contact:class:Person", + "label": "Candidate" + } + }, + { + "_id": "6138e727b33f4e30150589ba", + "objectId": "6138e727b33f4e30150589bb", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143340, + "objectSpace": "core:space:Model", + "objectClass": "core:class:Attribute", + "attributes": { + "name": "resume", + "type": { + "_class": "core:class:TypeString" + }, + "label": "Resume", + "attributeOf": "recruit:class:Candidate" + } + }, + { + "_id": "6138e727b33f4e30150589bc", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "recruit:class:Candidates", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Space", + "label": "recruit:string:CandidatePools", + "icon": "recruit:icon:RecruitApplication" + } + }, + { + "_id": "6138e727b33f4e30150589bd", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "recruit:class:Vacancy", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "kind": 0, + "extends": "core:class:Space", + "label": "recruit:string:Vacancy", + "icon": "recruit:icon:Vacancy" + } + }, + { + "_id": "6138e727b33f4e30150589be", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "recruit:class:Vacancy", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "workbench:mixin:SpaceView", + "attributes": { + "view": { + "class": "recruit:class:Applicant", + "createItemDialog": "recruit:component:CreateApplication" + } + } + }, + { + "_id": "6138e727b33f4e30150589bf", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "recruit:class:Candidates", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "workbench:mixin:SpaceView", + "attributes": { + "view": { + "class": "recruit:class:Candidate", + "createItemDialog": "recruit:component:CreateCandidate" + } + } + }, + { + "_id": "6138e727b33f4e30150589c0", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589c1", + "objectClass": "workbench:class:Application", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "label": "recruit:string:RecruitApplication", + "icon": "recruit:icon:RecruitApplication", + "navigatorModel": { + "spaces": [ + { + "label": "recruit:string:Vacancies", + "spaceClass": "recruit:class:Vacancy", + "addSpaceLabel": "recruit:string:CreateVacancy", + "createComponent": "recruit:component:CreateVacancy" + }, + { + "label": "recruit:string:CandidatePools", + "spaceClass": "recruit:class:Candidates", + "addSpaceLabel": "recruit:string:CreateCandidates", + "createComponent": "recruit:component:CreateCandidates" + } + ] + } + } + }, + { + "_id": "6138e727b33f4e30150589c2", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "recruit:space:CandidatesPublic", + "objectClass": "recruit:class:Candidates", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "name": "public", + "description": "Public Candidates", + "private": false, + "members": [] + } + }, + { + "_id": "6138e727b33f4e30150589c3", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589c4", + "objectClass": "view:class:Viewlet", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "attachTo": "recruit:class:Candidate", + "descriptor": "view:viewlet:Table", + "open": "recruit:component:EditCandidate", + "options": { + "lookup": { + "resume": "chunter:class:Attachment" + } + }, + "config": [ + "", + "#recruit:component:CreateApplicationPresenter", + "city", + "$lookup.resume", + "channels" + ] + } + }, + { + "_id": "6138e727b33f4e30150589c5", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589c6", + "objectClass": "view:class:Viewlet", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "attachTo": "recruit:class:Applicant", + "descriptor": "view:viewlet:Table", + "open": "recruit:component:EditCandidate", + "options": { + "lookup": { + "candidate": "recruit:class:Candidate", + "state": "core:class:State" + } + }, + "config": [ + "$lookup.candidate", + "$lookup.state", + "$lookup.candidate.city", + "$lookup.candidate.channels" + ] + } + }, + { + "_id": "6138e727b33f4e30150589c7", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589c8", + "objectClass": "view:class:Viewlet", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "attachTo": "recruit:class:Applicant", + "descriptor": "view:viewlet:Kanban", + "open": "recruit:component:EditCandidate", + "options": { + "lookup": { + "candidate": "recruit:class:Candidate", + "state": "core:class:State" + } + }, + "config": [ + "$lookup.candidate", + "$lookup.state", + "$lookup.candidate.city", + "$lookup.candidate.channels" + ] + } + }, + { + "_id": "6138e727b33f4e30150589c9", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "recruit:class:Applicant", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:KanbanCard", + "attributes": { + "card": "recruit:component:KanbanCard" + } + }, + { + "_id": "6138e727b33f4e30150589ca", + "_class": "core:class:TxMixin", + "space": "core:space:Tx", + "modifiedBy": "core:account:System", + "modifiedOn": 1631119143361, + "objectId": "recruit:class:Candidate", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "mixin": "view:mixin:ObjectEditor", + "attributes": { + "editor": "recruit:component:EditCandidate" + } + }, + { + "_id": "6138e727b33f4e30150589cb", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "server-core:class:Trigger", + "objectClass": "core:class:Class", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "domain": "model", + "kind": 0, + "extends": "core:class:Doc" + } + }, + { + "_id": "6138e727b33f4e30150589cc", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589cd", + "objectClass": "server-core:class:Trigger", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143361, + "modifiedBy": "core:account:System", + "attributes": { + "trigger": "server-chunter:trigger:OnMessage" + } + }, + { + "_id": "6138e727b33f4e30150589ce", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589cf", + "objectClass": "contact:class:Employee", + "objectSpace": "contact:space:Employee", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Rosamund", + "lastName": "Chen", + "city": "Mountain View", + "channels": [] + } + }, + { + "_id": "6138e727b33f4e30150589d0", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589d1", + "objectClass": "core:class:Account", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "email": "rosamund@hc.engineering" + } + }, + { + "_id": "6138e727b33f4e30150589d2", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589d3", + "objectClass": "contact:class:Employee", + "objectSpace": "contact:space:Employee", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Elon", + "lastName": "Musk", + "city": "Bel Air", + "channels": [] + } + }, + { + "_id": "6138e727b33f4e30150589d4", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589d5", + "objectClass": "core:class:Account", + "objectSpace": "core:space:Model", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "email": "elon@hc.engineering" + } + }, + { + "_id": "6138e727b33f4e30150589d6", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589d7", + "objectClass": "recruit:class:Candidate", + "objectSpace": "recruit:space:CandidatesPublic", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Andrey", + "lastName": "P.", + "city": "Monte Carlo", + "channels": [ + { + "provider": "contact:channelProvider:Email", + "value": "andrey@hc.engineering" + } + ] + } + }, + { + "_id": "6138e727b33f4e30150589d8", + "_class": "core:class:TxCreateDoc", + "space": "core:space:Tx", + "objectId": "6138e727b33f4e30150589d9", + "objectClass": "recruit:class:Candidate", + "objectSpace": "recruit:space:CandidatesPublic", + "modifiedOn": 1631119143362, + "modifiedBy": "core:account:System", + "attributes": { + "firstName": "Marina", + "lastName": "M.", + "city": "Los Angeles", + "channels": [ + { + "provider": "contact:channelProvider:Email", + "value": "marina@hc.engineering" + } + ] + } + } +] \ No newline at end of file diff --git a/dev/tool/src/workspace.ts b/dev/tool/src/workspace.ts new file mode 100644 index 0000000000..dc3e54f38a --- /dev/null +++ b/dev/tool/src/workspace.ts @@ -0,0 +1,59 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 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 { MongoClient, Document } from 'mongodb' +import core, { DOMAIN_TX, Tx } from '@anticrm/core' +import { createContributingClient } from '@anticrm/contrib' +import { encode } from 'jwt-simple' +import { Client } from 'minio' + +import * as txJson from './model.tx.json' + +const txes = (txJson as any).default as Tx[] + +/** + * @public + */ +export async function initWorkspace (mongoUrl: string, dbName: string, clientUrl: string, minio: Client): Promise { + const client = new MongoClient(mongoUrl) + try { + await client.connect() + const db = client.db(dbName) + + console.log('dropping database...') + await db.dropDatabase() + + console.log('creating model...') + const model = txes.filter(tx => tx.objectSpace === core.space.Model) + const result = await db.collection(DOMAIN_TX).insertMany(model as Document[]) + console.log(`${result.insertedCount} model transactions inserted.`) + + console.log('creating data...') + const data = txes.filter(tx => tx.objectSpace !== core.space.Model) + const token = encode({ email: 'anticrm@hc.engineering', workspace: dbName }, 'secret') + const url = new URL(`/${token}`, clientUrl) + const contrib = await createContributingClient(url.href) + for (const tx of data) { + await contrib.tx(tx) + } + contrib.close() + + console.log('create minio bucket') + if (!await minio.bucketExists(dbName)) { await minio.makeBucket(dbName, 'k8s') } + } finally { + await client.close() + } +} diff --git a/dev/tool/tsconfig.json b/dev/tool/tsconfig.json index aeb0517b13..fffbf4c341 100644 --- a/dev/tool/tsconfig.json +++ b/dev/tool/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "rootDir": "./src", - "outDir": "./lib" + "outDir": "./lib", + "esModuleInterop": true } } \ No newline at end of file diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index f5fddcacdd..137490fccd 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -14,7 +14,7 @@ // import { mergeIds } from '@anticrm/platform' -import type { Ref, Space, Class, Type } from '@anticrm/core' +import type { Ref, Class, Type } from '@anticrm/core' import contact, { contactId } from '@anticrm/contact' import type { ChannelProvider, Channel } from '@anticrm/contact' import type { AnyComponent } from '@anticrm/ui' @@ -35,8 +35,5 @@ export const ids = mergeIds(contactId, contact, { }, class: { TypeChannels: '' as Ref>> - }, - space: { - Employee: '' as Ref } }) diff --git a/models/demo/src/index.ts b/models/demo/src/index.ts index 0c52868e64..a80b7d5c3c 100644 --- a/models/demo/src/index.ts +++ b/models/demo/src/index.ts @@ -16,33 +16,10 @@ import { Builder } from '@anticrm/model' -import core from '@anticrm/core' import contact from '@anticrm/model-contact' import recruit from '@anticrm/model-recruit' export function createDemo (builder: Builder): void { - builder.createDoc(contact.class.Employee, contact.space.Employee, { - firstName: 'Rosamund', - lastName: 'Chen', - city: 'Mountain View', - channels: [] - }) - - builder.createDoc(core.class.Account, core.space.Model, { - email: 'rosamund@hc.engineering' - }) - - builder.createDoc(contact.class.Employee, contact.space.Employee, { - firstName: 'Elon', - lastName: 'Musk', - city: 'Bel Air', - channels: [] - }) - - builder.createDoc(core.class.Account, core.space.Model, { - email: 'elon@hc.engineering' - }) - builder.createDoc(recruit.class.Candidate, recruit.space.CandidatesPublic, { firstName: 'Andrey', lastName: 'P.', diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts index a5acbc611c..eb3d48a301 100644 --- a/plugins/contact/src/index.ts +++ b/plugins/contact/src/index.ts @@ -15,7 +15,7 @@ import { plugin } from '@anticrm/platform' import type { Plugin, Asset } from '@anticrm/platform' -import type { Doc, Ref, Class, UXObject } from '@anticrm/core' +import type { Doc, Ref, Class, UXObject, Space } from '@anticrm/core' /** * @public @@ -90,5 +90,8 @@ export default plugin(contactId, { WhatsApp: '' as Asset, Youtube: '' as Asset, GitHub: '' as Asset + }, + space: { + Employee: '' as Ref } }) diff --git a/server/account/src/index.ts b/server/account/src/index.ts index 6110555ad2..48405e782f 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -51,6 +51,8 @@ const accountPlugin = plugin(accountId, { export interface Account { _id: ObjectId email: string + first: string + last: string hash: Binary salt: Binary workspaces: ObjectId[] @@ -161,7 +163,7 @@ export async function login (db: Db, email: string, password: string, workspace: /** * @public */ -export async function createAccount (db: Db, email: string, password: string): Promise { +export async function createAccount (db: Db, email: string, password: string, first: string, last: string): Promise { const salt = randomBytes(32) const hash = hashWithSalt(password, salt) @@ -174,11 +176,15 @@ export async function createAccount (db: Db, email: string, password: string): P email, hash, salt, + first, + last, workspaces: [] }) return { _id: insert.insertedId, + first, + last, email, workspaces: [] } diff --git a/server/contrib/src/connection.ts b/server/contrib/src/connection.ts index 0aa86aa3e7..8215263ed8 100644 --- a/server/contrib/src/connection.ts +++ b/server/contrib/src/connection.ts @@ -14,17 +14,21 @@ // limitations under the License. // -import type { Tx, WithTx } from '@anticrm/core' +import { Tx, Storage, Class, Doc, DocumentQuery, FindOptions, Ref, FindResult } from '@anticrm/core' import { serialize } from '@anticrm/platform' import WebSocket from 'ws' /** * @public */ -export class ContributingClient implements WithTx { +export class ContributingClient implements Storage { constructor (private readonly websocket: WebSocket) { } + findAll (_class: Ref>, query: DocumentQuery, options?: FindOptions | undefined): Promise> { + throw new Error('findAll not implemeneted for contributing client') + } + async tx (tx: Tx): Promise { this.websocket.send(serialize({ method: 'tx',