Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-29 13:27:25 +02:00
parent 7e36bb8711
commit 632dddf356
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
15 changed files with 512 additions and 386 deletions

View File

@ -86,6 +86,7 @@ specifiers:
cross-env: ^7.0.3
css-loader: ^5.2.1
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'
@ -96,6 +97,7 @@ specifiers:
file-loader: ^6.2.0
intl-messageformat: ^9.7.1
mini-css-extract-plugin: ^2.2.0
minio: ^7.0.19
mongodb: ^4.1.0
node-html-parser: ^4.1.3
postcss: ^8.3.4
@ -202,6 +204,7 @@ dependencies:
cross-env: 7.0.3
css-loader: 5.2.7_webpack@5.48.0
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
@ -212,6 +215,7 @@ dependencies:
file-loader: 6.2.0_webpack@5.48.0
intl-messageformat: 9.8.1
mini-css-extract-plugin: 2.2.0_webpack@5.48.0
minio: 7.0.19
mongodb: 4.1.1
node-html-parser: 4.1.3
postcss: 8.3.6
@ -1508,6 +1512,10 @@ packages:
resolution: {integrity: sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A==}
dev: false
/@types/node/16.7.5:
resolution: {integrity: sha512-E7SpxDXoHEpmZ9C1gSqwadhE6zPRtf3g0gJy9Y51DsImnR5TcDs3QEiV/3Q7zOM8LWaZp5Gph71NK6ElVMG1IQ==}
dev: false
/@types/normalize-package-data/2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
dev: false
@ -8163,6 +8171,37 @@ packages:
webpack: 5.48.0_webpack-cli@4.7.2
dev: false
/ts-node/10.2.1_eb14afb1492fcd444e277f1fdb668e87:
resolution: {integrity: sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==}
engines: {node: '>=12.0.0'}
hasBin: true
peerDependencies:
'@swc/core': '>=1.2.50'
'@swc/wasm': '>=1.2.50'
'@types/node': '*'
typescript: '>=2.7'
peerDependenciesMeta:
'@swc/core':
optional: true
'@swc/wasm':
optional: true
dependencies:
'@cspotcode/source-map-support': 0.6.1
'@tsconfig/node10': 1.0.8
'@tsconfig/node12': 1.0.9
'@tsconfig/node14': 1.0.1
'@tsconfig/node16': 1.0.2
'@types/node': 16.7.5
acorn: 8.4.1
acorn-walk: 8.1.1
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 4.3.5
yn: 3.1.1
dev: false
/ts-node/10.2.1_f50b86b1778cd2aa4e5405c08bb39559:
resolution: {integrity: sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==}
engines: {node: '>=12.0.0'}
@ -9797,7 +9836,7 @@ packages:
version: 0.0.0
dependencies:
'@types/heft-jest': 1.0.2
'@types/node': 16.7.1
'@types/node': 16.7.5
'@types/ws': 7.4.7
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
eslint: 7.32.0
@ -9817,7 +9856,7 @@ packages:
version: 0.0.0
dependencies:
'@types/heft-jest': 1.0.2
'@types/node': 16.7.1
'@types/node': 16.7.5
'@types/ws': 7.4.7
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
eslint: 7.32.0
@ -9837,7 +9876,7 @@ packages:
version: 0.0.0
dependencies:
'@types/heft-jest': 1.0.2
'@types/node': 16.7.1
'@types/node': 16.7.5
'@types/ws': 7.4.7
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
eslint: 7.32.0
@ -9862,7 +9901,7 @@ packages:
version: 0.0.0
dependencies:
'@types/heft-jest': 1.0.2
'@types/node': 16.7.1
'@types/node': 16.7.5
'@types/ws': 7.4.7
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
esbuild: 0.12.24
@ -9870,7 +9909,7 @@ 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
ts-node: 10.2.1_f50b86b1778cd2aa4e5405c08bb39559
ts-node: 10.2.1_eb14afb1492fcd444e277f1fdb668e87
transitivePeerDependencies:
- '@swc/core'
- '@swc/wasm'
@ -10012,7 +10051,7 @@ packages:
'@types/express-fileupload': 1.1.7
'@types/heft-jest': 1.0.2
'@types/minio': 7.0.10
'@types/node': 16.7.1
'@types/node': 16.7.5
'@types/uuid': 8.3.1
'@types/ws': 7.4.7
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
@ -10029,7 +10068,7 @@ packages:
minio: 7.0.19
mongodb: 4.1.1
server-core: 0.1.0
ts-node: 10.2.1_f50b86b1778cd2aa4e5405c08bb39559
ts-node: 10.2.1_eb14afb1492fcd444e277f1fdb668e87
uuid: 8.3.2
transitivePeerDependencies:
- '@swc/core'
@ -10128,14 +10167,14 @@ packages:
dev: false
file:projects/workspace.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-Du1dJ9lKTjiLDhFbpM6d7IL3XaPksCXlPeaKBG3xz4v2v1odoMjXqMA/fjGnw091khBJi0+QqnsjR7zt2/ROpQ==, tarball: file:projects/workspace.tgz}
resolution: {integrity: sha512-xsi1Oqd00ZntGoGAMsxj9vzdN9ff9tEgf//ZmaAH4GqaVT0VF2pzeWwDNlS8cmQR0ECP61Cbu1Jd2Ppyinz8+g==, tarball: file:projects/workspace.tgz}
id: file:projects/workspace.tgz
name: '@rush-temp/workspace'
version: 0.0.0
dependencies:
'@types/heft-jest': 1.0.2
'@types/minio': 7.0.10
'@types/node': 16.7.1
'@types/node': 16.7.5
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
esbuild: 0.12.24
eslint: 7.32.0
@ -10145,11 +10184,10 @@ packages:
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

View File

@ -1,4 +1,4 @@
ACCOUNTS_URL=https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/
UPLOAD_URL=https://anticrm-upload.herokuapp.com/
UPLOAD_URL=https://upload.hc.engineering/

File diff suppressed because it is too large Load Diff

View File

@ -18,3 +18,4 @@ import { writeFileSync } from 'fs'
const content = JSON.stringify(builder.getTxes(), undefined, 2)
writeFileSync('../../dev/storage/src/model.tx.json', content)
writeFileSync('../../server/workspace/src/model.tx.json', content)

View File

@ -18,7 +18,7 @@ import { Builder, Model, Prop, UX, TypeString, Index } from '@anticrm/model'
import type { Ref, Doc, Class, Domain } from '@anticrm/core'
import { IndexKind } from '@anticrm/core'
import core, { TSpace, TDoc } from '@anticrm/model-core'
import type { Backlink, Channel, Message, Comment } from '@anticrm/chunter'
import type { Backlink, Channel, Message, Comment, Attachment } from '@anticrm/chunter'
import type { AnyComponent } from '@anticrm/ui'
import workbench from '@anticrm/model-workbench'
@ -28,6 +28,7 @@ import chunter from './plugin'
export const DOMAIN_CHUNTER = 'chunter' as Domain
export const DOMAIN_COMMENT = 'comment' as Domain
export const DOMAIN_ATTACHMENT = 'attachment' as Domain
@Model(chunter.class.Channel, core.class.Space)
@UX(chunter.string.Channel, chunter.icon.Hashtag)
@ -52,8 +53,16 @@ export class TBacklink extends TComment implements Backlink {
backlinkClass!: Ref<Class<Doc>>
}
@Model(chunter.class.Attachment, core.class.Doc, DOMAIN_ATTACHMENT)
export class TAttachment extends TDoc implements Attachment {
attachmentTo!: Ref<Doc>
collection!: string
name!: string
file!: string
}
export function createModel (builder: Builder): void {
builder.createModel(TChannel, TMessage, TComment, TBacklink)
builder.createModel(TChannel, TMessage, TComment, TBacklink, TAttachment)
builder.mixin(chunter.class.Channel, core.class.Class, workbench.mixin.SpaceView, {
view: {
class: chunter.class.Message

View File

@ -17,6 +17,7 @@
<script lang="ts">
import { getMetadata } from '@anticrm/platform'
import login from '@anticrm/login'
import { createQuery } from '@anticrm/presentation'
import { EditBox, Button, CircleButton, Grid, Label } from '@anticrm/ui'
import FileUpload from './icons/FileUpload.svelte'
@ -24,6 +25,12 @@
import Twitter from './icons/Twitter.svelte'
import User from './icons/User.svelte'
import chunter from '@anticrm/chunter'
const query = createQuery()
$: query.query(chunter.class.Attachment, {}, result => { console.log('attachments', result) })
let dragover = false
let loading = false

20
server/front/build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# 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.
#
rushx bundle
rushx docker:build
rushx docker:push

View File

@ -7,7 +7,7 @@
"scripts": {
"build": "heft build",
"lint:fix": "eslint --fix src",
"bundle": "esbuild src/index.ts --bundle --minify --platform=node > bundle.js & cp -r ../../dev/prod/dist . & cp -r ../../dev/prod/public/* ./dist/",
"bundle": "esbuild src/index.ts --bundle --minify --platform=node > bundle.js & rm -rf ./dist && cp -r ../../dev/prod/dist . && cp -r ../../dev/prod/public/* ./dist/",
"docker:build": "docker build -t anticrm/front .",
"docker:push": "docker push anticrm/front"
},

View File

@ -17,7 +17,6 @@
import express from 'express'
import fileUpload, { UploadedFile } from 'express-fileupload'
import cors from 'cors'
import { S3 } from 'aws-sdk'
import { v4 as uuid } from 'uuid'
import { decode } from 'jwt-simple'
@ -31,21 +30,21 @@ import { Client } from 'minio'
// import { createElasticAdapter } from '@anticrm/elastic'
const BUCKET = 'anticrm-upload-9e4e89c'
// const BUCKET = 'anticrm-upload-9e4e89c'
async function awsUpload (file: UploadedFile): Promise<string> {
const id = uuid()
const s3 = new S3()
const resp = await s3.upload({
Bucket: BUCKET,
Key: id,
Body: file.data,
ContentType: file.mimetype,
ACL: 'public-read'
}).promise()
console.log(resp)
return id
}
// async function awsUpload (file: UploadedFile): Promise<string> {
// const id = uuid()
// const s3 = new S3()
// const resp = await s3.upload({
// Bucket: BUCKET,
// Key: id,
// Body: file.data,
// ContentType: file.mimetype,
// ACL: 'public-read'
// }).promise()
// console.log(resp)
// return id
// }
async function minioUpload (minio: Client, workspace: string, file: UploadedFile): Promise<string> {
const id = uuid()

20
server/workspace/build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# 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.
#
rushx bundle
rushx docker:build
rushx docker:push

View File

@ -21,14 +21,15 @@
"eslint-plugin-node":"11",
"eslint":"^7.32.0",
"ts-node":"^10.2.1",
"esbuild":"~0.12.24",
"@types/minio":"~7.0.10"
"esbuild":"^0.12.24",
"@types/minio":"^7.0.10",
"@types/node":"^16.7.5"
},
"dependencies": {
"@anticrm/core": "~0.6.11",
"mongodb": "^4.1.0",
"@anticrm/contrib": "~0.6.0",
"jwt-simple": "~0.5.6",
"minio": "~7.0.19"
"jwt-simple": "^0.5.6",
"minio": "^7.0.19"
}
}

View File

@ -63,5 +63,5 @@ const minio = new Client({
console.log('creating model...')
createWorkspace(mongoUrl, db, transactorUrl, minio).then(() => {
console.log(`done.`)
console.log('done.')
}).catch(error => { console.error(error) })

View File

@ -52,7 +52,7 @@ export async function createWorkspace (mongoUrl: string, dbName: string, clientU
contrib.close()
console.log('create minio bucket')
await minio.makeBucket(dbName, 'k8s')
if (!await minio.bucketExists(dbName)) { await minio.makeBucket(dbName, 'k8s') }
} finally {
await client.close()
}

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib"
"outDir": "./lib",
"esModuleInterop": true
}
}