mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 02:51:54 +03:00
Attachment orphans cleanup (#842)
Signed-off-by: Ilya Sumbatyants <ilya.sumb@gmail.com>
This commit is contained in:
parent
c5f0ea5166
commit
626ece4045
@ -57,6 +57,8 @@ specifiers:
|
||||
'@rush-temp/model-lead': file:./projects/model-lead.tgz
|
||||
'@rush-temp/model-recruit': file:./projects/model-recruit.tgz
|
||||
'@rush-temp/model-rig': file:./projects/model-rig.tgz
|
||||
'@rush-temp/model-server-attachment': file:./projects/model-server-attachment.tgz
|
||||
'@rush-temp/model-server-contact': file:./projects/model-server-contact.tgz
|
||||
'@rush-temp/model-server-core': file:./projects/model-server-core.tgz
|
||||
'@rush-temp/model-setting': file:./projects/model-setting.tgz
|
||||
'@rush-temp/model-task': file:./projects/model-task.tgz
|
||||
@ -75,6 +77,10 @@ specifiers:
|
||||
'@rush-temp/recruit-assets': file:./projects/recruit-assets.tgz
|
||||
'@rush-temp/recruit-resources': file:./projects/recruit-resources.tgz
|
||||
'@rush-temp/server': file:./projects/server.tgz
|
||||
'@rush-temp/server-attachment': file:./projects/server-attachment.tgz
|
||||
'@rush-temp/server-attachment-resources': file:./projects/server-attachment-resources.tgz
|
||||
'@rush-temp/server-contact': file:./projects/server-contact.tgz
|
||||
'@rush-temp/server-contact-resources': file:./projects/server-contact-resources.tgz
|
||||
'@rush-temp/server-core': file:./projects/server-core.tgz
|
||||
'@rush-temp/server-ws': file:./projects/server-ws.tgz
|
||||
'@rush-temp/setting': file:./projects/setting.tgz
|
||||
@ -98,14 +104,14 @@ specifiers:
|
||||
'@rush-temp/workbench-resources': file:./projects/workbench-resources.tgz
|
||||
'@rushstack/heft': ^0.41.1
|
||||
'@rushstack/heft-jest-plugin': ^0.1.15
|
||||
'@tiptap/core': ^2.0.0-beta.163
|
||||
'@tiptap/extension-highlight': ^2.0.0-beta.32
|
||||
'@tiptap/extension-link': ^2.0.0-beta.35
|
||||
'@tiptap/extension-mention': ^2.0.0-beta.92
|
||||
'@tiptap/extension-placeholder': ^2.0.0-beta.46
|
||||
'@tiptap/extension-typography': ^2.0.0-beta.19
|
||||
'@tiptap/starter-kit': ~2.0.0-beta.171
|
||||
'@tiptap/suggestion': ^2.0.0-beta.87
|
||||
'@tiptap/core': ~2.0.0-beta.93
|
||||
'@tiptap/extension-highlight': ~2.0.0-beta.15
|
||||
'@tiptap/extension-link': ~2.0.0-beta.33
|
||||
'@tiptap/extension-mention': ~2.0.0-beta.63
|
||||
'@tiptap/extension-placeholder': ~2.0.0-beta.26
|
||||
'@tiptap/extension-typography': ~2.0.0-beta.13
|
||||
'@tiptap/starter-kit': ~2.0.0-beta.89
|
||||
'@tiptap/suggestion': ~2.0.0-beta.85
|
||||
'@types/cors': ^2.8.12
|
||||
'@types/deep-equal': ^1.0.1
|
||||
'@types/express': ^4.17.13
|
||||
@ -117,9 +123,8 @@ specifiers:
|
||||
'@types/koa-router': ^7.4.4
|
||||
'@types/koa__cors': ^3.0.3
|
||||
'@types/mime-types': ~2.1.1
|
||||
'@types/minio': ^7.0.10
|
||||
'@types/pdfkit': ~0.12.3
|
||||
'@types/prosemirror-state': ~1.2.8
|
||||
'@types/prosemirror-model': ~1.16.0
|
||||
'@types/toposort': ^2.0.3
|
||||
'@types/uuid': ^8.3.1
|
||||
'@types/xml2js': ~0.4.9
|
||||
@ -154,15 +159,13 @@ specifiers:
|
||||
lexorank: ~1.0.4
|
||||
mime-types: ~2.1.34
|
||||
mini-css-extract-plugin: ^2.2.0
|
||||
minio: ^7.0.19
|
||||
pdfkit: ~0.13.0
|
||||
postcss: ^8.3.4
|
||||
postcss-load-config: ^3.1.0
|
||||
postcss-loader: ^6.1.0
|
||||
prettier: ^2.4.1
|
||||
prettier-plugin-svelte: ^2.2.0
|
||||
prosemirror-model: ^1.16.1
|
||||
prosemirror-state: ^1.3.4
|
||||
prosemirror-model: ~1.16.1
|
||||
sass: ^1.37.5
|
||||
sass-loader: ^12.1.0
|
||||
simplytyped: ^3.3.0
|
||||
@ -238,6 +241,8 @@ dependencies:
|
||||
'@rush-temp/model-lead': file:projects/model-lead.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-recruit': file:projects/model-recruit.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-rig': file:projects/model-rig.tgz_37f79b97d0d86442e45d380c86f520c5
|
||||
'@rush-temp/model-server-attachment': file:projects/model-server-attachment.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-server-contact': file:projects/model-server-contact.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-server-core': file:projects/model-server-core.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-setting': file:projects/model-setting.tgz_typescript@4.5.4
|
||||
'@rush-temp/model-task': file:projects/model-task.tgz_typescript@4.5.4
|
||||
@ -256,6 +261,10 @@ dependencies:
|
||||
'@rush-temp/recruit-assets': file:projects/recruit-assets.tgz
|
||||
'@rush-temp/recruit-resources': file:projects/recruit-resources.tgz_096c09b0b673a57c275d9767a12070b1
|
||||
'@rush-temp/server': file:projects/server.tgz
|
||||
'@rush-temp/server-attachment': file:projects/server-attachment.tgz
|
||||
'@rush-temp/server-attachment-resources': file:projects/server-attachment-resources.tgz
|
||||
'@rush-temp/server-contact': file:projects/server-contact.tgz
|
||||
'@rush-temp/server-contact-resources': file:projects/server-contact-resources.tgz
|
||||
'@rush-temp/server-core': file:projects/server-core.tgz
|
||||
'@rush-temp/server-ws': file:projects/server-ws.tgz
|
||||
'@rush-temp/setting': file:projects/setting.tgz
|
||||
@ -298,9 +307,8 @@ dependencies:
|
||||
'@types/koa-router': 7.4.4
|
||||
'@types/koa__cors': 3.1.0
|
||||
'@types/mime-types': 2.1.1
|
||||
'@types/minio': 7.0.11
|
||||
'@types/pdfkit': 0.12.3
|
||||
'@types/prosemirror-state': 1.2.8
|
||||
'@types/prosemirror-model': 1.16.0
|
||||
'@types/toposort': 2.0.3
|
||||
'@types/uuid': 8.3.3
|
||||
'@types/xml2js': 0.4.9
|
||||
@ -335,7 +343,6 @@ dependencies:
|
||||
lexorank: 1.0.4
|
||||
mime-types: 2.1.34
|
||||
mini-css-extract-plugin: 2.4.5_webpack@5.65.0
|
||||
minio: 7.0.25
|
||||
pdfkit: 0.13.0
|
||||
postcss: 8.4.5
|
||||
postcss-load-config: 3.1.0
|
||||
@ -343,7 +350,6 @@ dependencies:
|
||||
prettier: 2.5.1
|
||||
prettier-plugin-svelte: 2.5.1_prettier@2.5.1
|
||||
prosemirror-model: 1.16.1
|
||||
prosemirror-state: 1.3.4
|
||||
sass: 1.45.0
|
||||
sass-loader: 12.4.0_sass@1.45.0+webpack@5.65.0
|
||||
simplytyped: 3.3.0_typescript@4.5.4
|
||||
@ -1752,7 +1758,7 @@ packages:
|
||||
/@types/minio/7.0.11:
|
||||
resolution: {integrity: sha512-ltn30nGhtxytil4jFU1Tt6lvD+JnUyCYHfNBKsRjZ76ueSkrQdIByghcnhFvr15at3cnvj+tVn+euCqTX/5ejQ==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.0
|
||||
'@types/node': 17.0.10
|
||||
dev: false
|
||||
|
||||
/@types/node/12.20.24:
|
||||
@ -1771,6 +1777,10 @@ packages:
|
||||
resolution: {integrity: sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==}
|
||||
dev: false
|
||||
|
||||
/@types/node/17.0.10:
|
||||
resolution: {integrity: sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==}
|
||||
dev: false
|
||||
|
||||
/@types/normalize-package-data/2.4.1:
|
||||
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
|
||||
dev: false
|
||||
@ -1914,20 +1924,20 @@ packages:
|
||||
/@types/whatwg-url/8.2.1:
|
||||
resolution: {integrity: sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.0
|
||||
'@types/node': 17.0.10
|
||||
'@types/webidl-conversions': 6.1.1
|
||||
dev: false
|
||||
|
||||
/@types/ws/7.4.7:
|
||||
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.0
|
||||
'@types/node': 17.0.10
|
||||
dev: false
|
||||
|
||||
/@types/ws/8.2.2:
|
||||
resolution: {integrity: sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.0
|
||||
'@types/node': 17.0.10
|
||||
dev: false
|
||||
|
||||
/@types/xml2js/0.4.9:
|
||||
@ -7164,8 +7174,8 @@ packages:
|
||||
resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==}
|
||||
dev: false
|
||||
|
||||
/minio/7.0.25:
|
||||
resolution: {integrity: sha512-5Ber8g7jd0XpVGgtj/7AcpHSoye7/bb6zGx5ts/xDgGpK3cuqH2f9lvh9pawegipoAca39JIaUYYmswFVVyznQ==}
|
||||
/minio/7.0.26:
|
||||
resolution: {integrity: sha512-knutnEZZMIUB/Xln6psVDrqObFKXDcF9m4IfFIX+zgDHYg3AlcF88DY1wdgg7bUkf+uU8iHkzP2q5CXAhia73w==}
|
||||
engines: {node: '>= 4'}
|
||||
dependencies:
|
||||
async: 3.2.2
|
||||
@ -8053,12 +8063,6 @@ packages:
|
||||
w3c-keyname: 2.2.4
|
||||
dev: false
|
||||
|
||||
/prosemirror-model/1.15.0:
|
||||
resolution: {integrity: sha512-hQJv7SnIhlAy9ga3lhPPgaufhvCbQB9tHwscJ9E1H1pPHmN8w5V/lURueoYv9Kc3/bpNWoyHa8r3g//m7N0ChQ==}
|
||||
dependencies:
|
||||
orderedmap: 1.1.1
|
||||
dev: false
|
||||
|
||||
/prosemirror-model/1.16.1:
|
||||
resolution: {integrity: sha512-r1/w0HDU40TtkXp0DyKBnFPYwd8FSlUSJmGCGFv4DeynfeSlyQF2FD0RQbVEMOe6P3PpUSXM6LZBV7W/YNZ4mA==}
|
||||
dependencies:
|
||||
@ -8075,14 +8079,14 @@ packages:
|
||||
/prosemirror-state/1.3.4:
|
||||
resolution: {integrity: sha512-Xkkrpd1y/TQ6HKzN3agsQIGRcLckUMA9u3j207L04mt8ToRgpGeyhbVv0HI7omDORIBHjR29b7AwlATFFf2GLA==}
|
||||
dependencies:
|
||||
prosemirror-model: 1.15.0
|
||||
prosemirror-model: 1.16.1
|
||||
prosemirror-transform: 1.3.3
|
||||
dev: false
|
||||
|
||||
/prosemirror-transform/1.3.3:
|
||||
resolution: {integrity: sha512-9NLVXy1Sfa2G6qPqhWMkEvwQQMTw7OyTqOZbJaGQWsCeH3hH5Cw+c5eNaLM1Uu75EyKLsEZhJ93XpHJBa6RX8A==}
|
||||
dependencies:
|
||||
prosemirror-model: 1.15.0
|
||||
prosemirror-model: 1.16.1
|
||||
dev: false
|
||||
|
||||
/prosemirror-view/1.23.6:
|
||||
@ -10679,7 +10683,7 @@ packages:
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
jwt-simple: 0.5.6
|
||||
minio: 7.0.25
|
||||
minio: 7.0.26
|
||||
mongodb: 4.2.2
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
@ -10835,7 +10839,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/chunter-resources.tgz_096c09b0b673a57c275d9767a12070b1:
|
||||
resolution: {integrity: sha512-f6XU3bEnmm8jO7FEfi+LjEhLu4p/f8Y4HzoRHA+p39bZCegxBevjz89RWVFhQ+lC9tWWyg2zK0Tt6E88llN2lw==, tarball: file:projects/chunter-resources.tgz}
|
||||
resolution: {integrity: sha512-kSOFnCkf8slbORpUj5Tyhx8eYysTFC/4Pl7K1zY9btONN4v4t/0sCJhwNAh6oYeKLD8srXB6AvgA6A4l69p5Hw==, tarball: file:projects/chunter-resources.tgz}
|
||||
id: file:projects/chunter-resources.tgz
|
||||
name: '@rush-temp/chunter-resources'
|
||||
version: 0.0.0
|
||||
@ -11231,7 +11235,7 @@ packages:
|
||||
express: 4.17.2
|
||||
express-fileupload: 1.2.1
|
||||
jwt-simple: 0.5.6
|
||||
minio: 7.0.25
|
||||
minio: 7.0.26
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
uuid: 8.3.2
|
||||
@ -11263,7 +11267,7 @@ packages:
|
||||
faker: 5.5.3
|
||||
jpeg-js: 0.4.3
|
||||
jwt-simple: 0.5.6
|
||||
minio: 7.0.25
|
||||
minio: 7.0.26
|
||||
pdfkit: 0.13.0
|
||||
prettier: 2.5.1
|
||||
ts-node: 10.4.0_5d12c2add188ff0e728b4ade3dacd39b
|
||||
@ -11630,7 +11634,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/model-all.tgz_typescript@4.5.4:
|
||||
resolution: {integrity: sha512-PxQBpDt3uxqeXs8TrLKh5b2KIdH8SRZkM7KkL5gA0qGIeeH13EjN22X/jMc8TZVMKwaBL1aJld8aE5YkIKPK6g==, tarball: file:projects/model-all.tgz}
|
||||
resolution: {integrity: sha512-Z4F3zvl3i5iZUuhvKo1+SlVy9Urq09lVL4XsyY1zAwk14Af42uf5CVbbubPiSuLt4SevW1StJ5c08y4vztbfQA==, tarball: file:projects/model-all.tgz}
|
||||
id: file:projects/model-all.tgz
|
||||
name: '@rush-temp/model-all'
|
||||
version: 0.0.0
|
||||
@ -11862,6 +11866,48 @@ packages:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/model-server-attachment.tgz_typescript@4.5.4:
|
||||
resolution: {integrity: sha512-xAncTxoGAOvlBak/67IUq2BT1ZZZh9/x0HWzw/sx9VVxA52JZsf5SqSf+iPQx5wwcBESidh/HyERAH+EqoOjXw==, tarball: file:projects/model-server-attachment.tgz}
|
||||
id: file:projects/model-server-attachment.tgz
|
||||
name: '@rush-temp/model-server-attachment'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
prettier: 2.5.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/model-server-contact.tgz_typescript@4.5.4:
|
||||
resolution: {integrity: sha512-cS09KWx82ek8kc0tutF538kEZMRkOMLnY0sQSUScOPEYHb4cLR4M94PrIhsY8DiP6TJctkT0ddnvwXMApAwyGA==, tarball: file:projects/model-server-contact.tgz}
|
||||
id: file:projects/model-server-contact.tgz
|
||||
name: '@rush-temp/model-server-contact'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
prettier: 2.5.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/model-server-core.tgz_typescript@4.5.4:
|
||||
resolution: {integrity: sha512-hagtid24XnydnAi0jSVnRJ20sGD3k+GpvqFaUO3/T5PgvwafBta6ZZ90b931ttxK4XWt6qdNaKLmUFBsxJ3mvg==, tarball: file:projects/model-server-core.tgz}
|
||||
id: file:projects/model-server-core.tgz
|
||||
@ -11905,7 +11951,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/model-task.tgz_typescript@4.5.4:
|
||||
resolution: {integrity: sha512-8CPB0TE05gwOb4WKefT6zaL/jIgiwfqBM46riENkiR6TJgy1oiACqoS1p7YA+XzZJSy0eAaR3308lGohMNNGzQ==, tarball: file:projects/model-task.tgz}
|
||||
resolution: {integrity: sha512-+R3a/p9KvLJRF7CCbFwZer5TPDbBAjpTW85JDRrpV4sL2bEQIgtgtoYYwtd8dMyqCld1MToYesR9WYvwHmVGFw==, tarball: file:projects/model-task.tgz}
|
||||
id: file:projects/model-task.tgz
|
||||
name: '@rush-temp/model-task'
|
||||
version: 0.0.0
|
||||
@ -12183,7 +12229,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/prod.tgz_sass@1.45.0+typescript@4.5.4:
|
||||
resolution: {integrity: sha512-J/vqaKPl5JAPRjUi0olTyjdAmRM4ToFWCazldFFxMS6o+hgXCQIGPSZ7sB0HPdq+7pi+QL8GuRFvb0xsZJjKWw==, tarball: file:projects/prod.tgz}
|
||||
resolution: {integrity: sha512-WxsSu4KtdtPTf1EJkHs/CJFDHiU0AgfGMmyOm66DFGc0cWOiJlgoCcw9TuCNaQPCBQ/ldbNYbfpj01N4iZFYuA==, tarball: file:projects/prod.tgz}
|
||||
id: file:projects/prod.tgz
|
||||
name: '@rush-temp/prod'
|
||||
version: 0.0.0
|
||||
@ -12313,9 +12359,33 @@ packages:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-core.tgz:
|
||||
resolution: {integrity: sha512-ZWRRX5y31zZdDRPHie4p5z6R5uEKrB4FwoLn8zwF4R+7QJ1B0ycJ0BqA9akQMyo2iI5JG3mm1luwigL0Rv717g==, tarball: file:projects/server-core.tgz}
|
||||
name: '@rush-temp/server-core'
|
||||
file:projects/server-attachment-resources.tgz:
|
||||
resolution: {integrity: sha512-V/H2gWfte5sRJYj91+6StCv/+q2vAp6iHQRBcwBjcFJwMyuFqAQMhaGsWvJtAgtIENRY/22/I8KWiwg8O74XCg==, tarball: file:projects/server-attachment-resources.tgz}
|
||||
name: '@rush-temp/server-attachment-resources'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@elastic/elasticsearch': 7.16.0
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@types/minio': 7.0.11
|
||||
'@types/node': 17.0.10
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
minio: 7.0.26
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-attachment.tgz:
|
||||
resolution: {integrity: sha512-4qdqR7uqC/Ny/CMNrrw9AN/5cvlkTcVZ9ifEA7PybcLQzib+GtOXn7uUE/HeaSDVIjfUU3bK8I15M6bftaGaUA==, tarball: file:projects/server-attachment.tgz}
|
||||
name: '@rush-temp/server-attachment'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
@ -12334,6 +12404,70 @@ packages:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-contact-resources.tgz:
|
||||
resolution: {integrity: sha512-4yOcy58wmHdLoBsIlawD4KAe5I+q9NtlKXnZRvuyF0Gdb8UZcEvL2NjxHZNJkDmTGvvmmr2ihwYKJE+g4N//jg==, tarball: file:projects/server-contact-resources.tgz}
|
||||
name: '@rush-temp/server-contact-resources'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-contact.tgz:
|
||||
resolution: {integrity: sha512-W867u5lGNLWPLD35YvKz5uugJ2O0DYqLRnbUc3BSHi9Gqqs3SoKWZaIVspXQsaSbuReMnWJLPIRKfTxgr5sM/w==, tarball: file:projects/server-contact.tgz}
|
||||
name: '@rush-temp/server-contact'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@types/node': 16.11.14
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-core.tgz:
|
||||
resolution: {integrity: sha512-pBPLg+MVM4LQN9UZyECIo2d0ewVW4hG6VbDvqFFP7Qo8o5V0umkcyCFyhpnVPKL/ZaPj8aOD4OK2ohMZL6w3Vg==, tarball: file:projects/server-core.tgz}
|
||||
name: '@rush-temp/server-core'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@types/minio': 7.0.11
|
||||
'@types/node': 16.11.14
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
|
||||
eslint: 7.32.0
|
||||
eslint-config-standard-with-typescript: 21.0.1_ce2fa0c4dfa1c256100cababd749a13a
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
minio: 7.0.26
|
||||
prettier: 2.5.1
|
||||
typescript: 4.5.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/server-ws.tgz:
|
||||
resolution: {integrity: sha512-MSFFpLjIMFt0oyH4+8JUkNOkCNtdEtMDoxcyN7+kDdz44wSZjSOmheJHYkXO6JTEffcaaRhQ9vO/e7MBNMeoxQ==, tarball: file:projects/server-ws.tgz}
|
||||
name: '@rush-temp/server-ws'
|
||||
@ -12361,12 +12495,13 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/server.tgz:
|
||||
resolution: {integrity: sha512-9Uipi7DSygrXn0tNjJFnjCs8ws9vhKCQVhJFRp5lepIsnllFvSdDR82RPLMtC/i1qv0cWcrpJgbxpmEKC/g3vQ==, tarball: file:projects/server.tgz}
|
||||
resolution: {integrity: sha512-e8Oeh7z0NrGebPnTPZDsh4H6UUwDv2F4ywRw2o6GW7r3iXd1iK4nbxqs1bG7DvHy7kpY+jWk6tMpFSYJ+RXOrg==, tarball: file:projects/server.tgz}
|
||||
name: '@rush-temp/server'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@rushstack/heft': 0.41.8
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@types/minio': 7.0.11
|
||||
'@types/node': 16.11.14
|
||||
'@types/ws': 7.4.7
|
||||
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
|
||||
@ -12378,6 +12513,7 @@ packages:
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||
minio: 7.0.26
|
||||
prettier: 2.5.1
|
||||
ts-node: 10.4.0_5d12c2add188ff0e728b4ade3dacd39b
|
||||
typescript: 4.5.4
|
||||
@ -12394,7 +12530,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/setting-resources.tgz_096c09b0b673a57c275d9767a12070b1:
|
||||
resolution: {integrity: sha512-r/wZZM67R0JwXnUUHxlo5gS1wshjqgf6qJx/fBKfe5d59ZqIXvLD41NhkNBwA7iQsRd+QNmCS4u1fNtCjl20dQ==, tarball: file:projects/setting-resources.tgz}
|
||||
resolution: {integrity: sha512-KNZjL1XCVMDaeEnRfQBi4JAMjdg5aUyf6jrCrLGMZfG8Keq4JjHKqCNGVQ+xaYFZcQrEifs7M5OD9D6oimC4ag==, tarball: file:projects/setting-resources.tgz}
|
||||
id: file:projects/setting-resources.tgz
|
||||
name: '@rush-temp/setting-resources'
|
||||
version: 0.0.0
|
||||
@ -12587,7 +12723,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/text-editor.tgz_096c09b0b673a57c275d9767a12070b1:
|
||||
resolution: {integrity: sha512-vX6gE0smseJFY0FJ/cVNfMxcVDf7mHwXgzubjhhgjNDbSkhaAQUenK153uzBgYN+mRJZNhp1X8traE7nkz/MYg==, tarball: file:projects/text-editor.tgz}
|
||||
resolution: {integrity: sha512-Fg9TwM9Q/v+2QLbOwTuBAhjI0/4Lm34ksUW2R0PjuY0WTUGk/ZbKALm2HJAr+fQgjd8B1FXjcFXlidoOIWQ9jA==, tarball: file:projects/text-editor.tgz}
|
||||
id: file:projects/text-editor.tgz
|
||||
name: '@rush-temp/text-editor'
|
||||
version: 0.0.0
|
||||
@ -12669,7 +12805,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/tool.tgz:
|
||||
resolution: {integrity: sha512-UTtMmhy2JCwkDOHG2WLvbiU1QU4Jo9wXRIwpZZtgEkHvyGE3hDzrLNkItaxYI4QzeJIIg1/OZzaFRz24+1o1rg==, tarball: file:projects/tool.tgz}
|
||||
resolution: {integrity: sha512-Zwy6rf7v5DtpINp3IaWvHYoEVdkaQMi2n837scjAUyUjp21wMQshZudzu/K00Nfi4vI/Z40Ue8hG6LrcrUHQzA==, tarball: file:projects/tool.tgz}
|
||||
name: '@rush-temp/tool'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
@ -12694,7 +12830,7 @@ packages:
|
||||
fast-equals: 2.0.4
|
||||
jwt-simple: 0.5.6
|
||||
mime-types: 2.1.34
|
||||
minio: 7.0.25
|
||||
minio: 7.0.26
|
||||
mongodb: 4.2.2
|
||||
prettier: 2.5.1
|
||||
ts-node: 10.4.0_5d12c2add188ff0e728b4ade3dacd39b
|
||||
@ -12751,7 +12887,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/view-resources.tgz_096c09b0b673a57c275d9767a12070b1:
|
||||
resolution: {integrity: sha512-oT79PCOUvwaL6QgjuwTNVJJqyE82WDmBx37jF5/c6SpSrYNF14+hN41rrPReKQyhhxkyrBts73IePyHxIn653Q==, tarball: file:projects/view-resources.tgz}
|
||||
resolution: {integrity: sha512-6d+XQfG6pEVmJN/wmtsjCSSC0XGG/ZQC0jWePTo+6OfT2W3ot4f2G4unN8Loj8rHdcgOG4Df+/zW1eg+J3goTQ==, tarball: file:projects/view-resources.tgz}
|
||||
id: file:projects/view-resources.tgz
|
||||
name: '@rush-temp/view-resources'
|
||||
version: 0.0.0
|
||||
|
@ -16,6 +16,7 @@ services:
|
||||
command: server /data --address ":9000" --console-address ":9001"
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
volumes:
|
||||
- files:/data
|
||||
elastic:
|
||||
@ -69,18 +70,22 @@ services:
|
||||
- ELASTIC_URL=http://elastic:9200
|
||||
- MINIO_ENDPOINT=minio
|
||||
- MINIO_ACCESS_KEY=minioadmin
|
||||
- MINIO_SECRET_KEY=minioadmin
|
||||
- MINIO_SECRET_KEY=minioadmin
|
||||
transactor:
|
||||
image: anticrm/transactor
|
||||
links:
|
||||
- mongodb
|
||||
- elastic
|
||||
- minio
|
||||
ports:
|
||||
- 3333:3333
|
||||
environment:
|
||||
- ELASTIC_URL=http://elastic:9200
|
||||
- MONGO_URL=mongodb://mongodb:27017
|
||||
- METRICS_CONSOLE=true
|
||||
- MINIO_ENDPOINT=minio
|
||||
- MINIO_ACCESS_KEY=minioadmin
|
||||
- MINIO_SECRET_KEY=minioadmin
|
||||
# - APM_SERVER_URL=http://apm-server:8200
|
||||
# apm-server:
|
||||
# image: docker.elastic.co/apm/apm-server:7.14.2
|
||||
|
@ -89,6 +89,10 @@
|
||||
"@anticrm/image-cropper-resources": "~0.6.0",
|
||||
"@anticrm/inventory": "~0.6.0",
|
||||
"@anticrm/inventory-assets": "~0.6.0",
|
||||
"@anticrm/inventory-resources": "~0.6.0"
|
||||
"@anticrm/inventory-resources": "~0.6.0",
|
||||
"@anticrm/server-attachment": "~0.6.1",
|
||||
"@anticrm/server-attachment-resources": "~0.6.0",
|
||||
"@anticrm/server-contact": "~0.6.1",
|
||||
"@anticrm/server-contact-resources": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ import { addLocation } from '@anticrm/platform'
|
||||
|
||||
import login from '@anticrm/login'
|
||||
import { clientId } from '@anticrm/client'
|
||||
import { serverAttachmentId } from '@anticrm/server-attachment'
|
||||
import { serverContactId } from '@anticrm/server-contact'
|
||||
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
|
||||
@ -29,6 +31,9 @@ export function configurePlatformDev() {
|
||||
console.log('Use DEV server')
|
||||
addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/dev-client-resources'))
|
||||
|
||||
addLocation(serverAttachmentId, () => import(/* webpackChunkName: "server-attachment" */ '@anticrm/server-attachment-resources'))
|
||||
addLocation(serverContactId, () => import(/* webpackChunkName: "server-contact" */ '@anticrm/server-contact-resources'))
|
||||
|
||||
// Set devmodel to hook client to be able to present all activity
|
||||
enableDevModel()
|
||||
}
|
||||
|
@ -61,12 +61,16 @@
|
||||
"@anticrm/model-attachment": "~0.6.0",
|
||||
"@anticrm/mongo": "~0.6.0",
|
||||
"@anticrm/dev-storage": "~0.6.0",
|
||||
"@anticrm/server-attachment": "~0.6.0",
|
||||
"@anticrm/server-attachment-resources": "~0.6.0",
|
||||
"xml2js": "~0.4.23",
|
||||
"@anticrm/model-recruit": "~0.6.0",
|
||||
"@anticrm/recruit": "~0.6.2",
|
||||
"@anticrm/task": "~0.6.0",
|
||||
"@anticrm/chunter": "~0.6.1",
|
||||
"mime-types": "~2.1.34",
|
||||
"@anticrm/attachment": "~0.6.1"
|
||||
"@anticrm/attachment": "~0.6.1",
|
||||
"@anticrm/server-contact": "~0.6.1",
|
||||
"@anticrm/server-contact-resources": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,13 @@ import {
|
||||
IndexedDoc,
|
||||
TxAdapter
|
||||
} from '@anticrm/server-core'
|
||||
import { serverAttachmentId } from '@anticrm/server-attachment'
|
||||
import { serverContactId } from '@anticrm/server-contact'
|
||||
import { Client as ElasticClient } from '@elastic/elasticsearch'
|
||||
import { Client } from 'minio'
|
||||
import { Db, MongoClient } from 'mongodb'
|
||||
import { listMinioObjects } from './minio'
|
||||
import { addLocation } from '@anticrm/platform'
|
||||
|
||||
export async function rebuildElastic (
|
||||
mongoUrl: string,
|
||||
@ -99,6 +102,8 @@ export class ElasticTool {
|
||||
storage!: ServerStorage
|
||||
db!: Db
|
||||
constructor (readonly mongoUrl: string, readonly dbName: string, readonly minio: Client, readonly elasticUrl: string) {
|
||||
addLocation(serverAttachmentId, () => import('@anticrm/server-attachment-resources'))
|
||||
addLocation(serverContactId, () => import('@anticrm/server-contact-resources'))
|
||||
this.mongoClient = new MongoClient(mongoUrl)
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@
|
||||
"@anticrm/model-telegram": "~0.6.0",
|
||||
"@anticrm/model-demo": "~0.6.0",
|
||||
"@anticrm/model-server-core": "~0.6.0",
|
||||
"@anticrm/model-server-attachment": "~0.6.0",
|
||||
"@anticrm/model-server-contact": "~0.6.0",
|
||||
"@anticrm/model-activity": "~0.6.0",
|
||||
"@anticrm/model-attachment": "~0.6.0",
|
||||
"@anticrm/model-gmail": "~0.6.0",
|
||||
|
@ -30,6 +30,8 @@ import { createModel as gmailModel } from '@anticrm/model-gmail'
|
||||
import { createModel as inventoryModel } from '@anticrm/model-inventory'
|
||||
|
||||
import { createModel as serverCoreModel } from '@anticrm/model-server-core'
|
||||
import { createModel as serverAttachmentModel } from '@anticrm/model-server-attachment'
|
||||
import { createModel as serverContactModel } from '@anticrm/model-server-contact'
|
||||
import { createModel as activityModel } from '@anticrm/model-activity'
|
||||
|
||||
import { createDemo } from '@anticrm/model-demo'
|
||||
@ -52,6 +54,8 @@ gmailModel(builder)
|
||||
inventoryModel(builder)
|
||||
|
||||
serverCoreModel(builder)
|
||||
serverAttachmentModel(builder)
|
||||
serverContactModel(builder)
|
||||
|
||||
createDemo(builder)
|
||||
|
||||
|
7
models/server-attachment/.eslintrc.js
Normal file
7
models/server-attachment/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
models/server-attachment/.npmignore
Normal file
4
models/server-attachment/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
models/server-attachment/config/rig.json
Normal file
18
models/server-attachment/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/model-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
models/server-attachment/package.json
Normal file
34
models/server-attachment/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/model-server-attachment",
|
||||
"version": "0.6.0",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/model-rig": "~0.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/model": "~0.6.0",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-attachment": "~0.6.0",
|
||||
"@anticrm/server-core": "~0.6.0"
|
||||
}
|
||||
}
|
27
models/server-attachment/src/index.ts
Normal file
27
models/server-attachment/src/index.ts
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// 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 { Builder } from '@anticrm/model'
|
||||
|
||||
import serverCore from '@anticrm/server-core'
|
||||
import core from '@anticrm/core'
|
||||
import serverAttachment from '@anticrm/server-attachment'
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
||||
trigger: serverAttachment.trigger.OnAttachmentDelete
|
||||
})
|
||||
}
|
8
models/server-attachment/tsconfig.json
Normal file
8
models/server-attachment/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
}
|
||||
}
|
7
models/server-contact/.eslintrc.js
Normal file
7
models/server-contact/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
models/server-contact/.npmignore
Normal file
4
models/server-contact/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
models/server-contact/config/rig.json
Normal file
18
models/server-contact/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/model-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
models/server-contact/package.json
Normal file
34
models/server-contact/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/model-server-contact",
|
||||
"version": "0.6.0",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/model-rig": "~0.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/model": "~0.6.0",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-contact": "~0.6.0",
|
||||
"@anticrm/server-core": "~0.6.0"
|
||||
}
|
||||
}
|
27
models/server-contact/src/index.ts
Normal file
27
models/server-contact/src/index.ts
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// 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 { Builder } from '@anticrm/model'
|
||||
|
||||
import serverCore from '@anticrm/server-core'
|
||||
import core from '@anticrm/core'
|
||||
import serverContact from '@anticrm/server-contact'
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
||||
trigger: serverContact.trigger.OnContactDelete
|
||||
})
|
||||
}
|
8
models/server-contact/tsconfig.json
Normal file
8
models/server-contact/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@
|
||||
async function createAttachment (file: File) {
|
||||
loading++
|
||||
try {
|
||||
const uuid = await uploadFile(file, space, objectId)
|
||||
const uuid = await uploadFile(file, { space, attachedTo: objectId })
|
||||
console.log('uploaded file uuid', uuid)
|
||||
client.addCollection(attachment.class.Attachment, space, objectId, _class, 'attachments', {
|
||||
name: file.name,
|
||||
|
@ -18,19 +18,25 @@ import type { Doc, Ref, Space } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { getMetadata } from '@anticrm/platform'
|
||||
|
||||
export async function uploadFile (file: File, space?: Ref<Space>, attachedTo?: Ref<Doc>): Promise<string> {
|
||||
console.log(file)
|
||||
export async function uploadFile (file: File, opts?: { space: Ref<Space>, attachedTo: Ref<Doc> }): Promise<string> {
|
||||
const uploadUrl = getMetadata(login.metadata.UploadUrl)
|
||||
|
||||
if (uploadUrl === undefined) {
|
||||
throw Error('UploadURL is not defined')
|
||||
}
|
||||
|
||||
const data = new FormData()
|
||||
data.append('file', file)
|
||||
|
||||
const params = [['space', space], ['attachedTo', attachedTo]]
|
||||
.filter((x): x is [string, Ref<any>] => x[1] !== undefined)
|
||||
.map(([name, value]) => `${name}=${value}`)
|
||||
.join('&')
|
||||
const params = opts !== undefined
|
||||
? [['space', opts.space], ['attachedTo', opts.attachedTo]]
|
||||
.filter((x): x is [string, Ref<any>] => x[1] !== undefined)
|
||||
.map(([name, value]) => `${name}=${value}`)
|
||||
.join('&')
|
||||
: ''
|
||||
const suffix = params === '' ? params : `?${params}`
|
||||
|
||||
const url = `${uploadUrl as string}?name=${encodeURIComponent(file.name)}&${params}`
|
||||
const url = `${uploadUrl}${suffix}`
|
||||
const resp = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -38,12 +44,12 @@ export async function uploadFile (file: File, space?: Ref<Space>, attachedTo?: R
|
||||
},
|
||||
body: data
|
||||
})
|
||||
|
||||
if (resp.status !== 200) {
|
||||
throw new Error("Can't upload file.")
|
||||
throw Error(`Failed to upload file: ${resp.statusText}`)
|
||||
}
|
||||
const uuid = await resp.text()
|
||||
console.log(uuid)
|
||||
return uuid
|
||||
|
||||
return await resp.text()
|
||||
}
|
||||
|
||||
export async function deleteFile (id: string): Promise<void> {
|
||||
|
@ -53,7 +53,7 @@ export default plugin(attachmentId, {
|
||||
Photo: '' as Ref<Class<Photo>>
|
||||
},
|
||||
helper: {
|
||||
UploadFile: '' as Resource<(file: File, space?: Ref<Space>, attachedTo?: Ref<Doc>) => Promise<string>>,
|
||||
UploadFile: '' as Resource<(file: File, opts?: { space: Ref<Space>, attachedTo: Ref<Doc> }) => Promise<string>>,
|
||||
DeleteFile: '' as Resource<(id: string) => Promise<void>>
|
||||
}
|
||||
})
|
||||
|
@ -92,7 +92,10 @@
|
||||
try {
|
||||
const uploadFile = await getResource(attachment.helper.UploadFile)
|
||||
|
||||
resume.uuid = await uploadFile(file, contact.space.Contacts, candidateId)
|
||||
resume.uuid = await uploadFile(file, {
|
||||
space: contact.space.Contacts,
|
||||
attachedTo: candidateId
|
||||
})
|
||||
resume.name = file.name
|
||||
resume.size = file.size
|
||||
resume.type = file.type
|
||||
|
32
rush.json
32
rush.json
@ -710,7 +710,37 @@
|
||||
"packageName": "@anticrm/dev-account",
|
||||
"projectFolder": "dev/account",
|
||||
"shouldPublish": true
|
||||
},
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/server-attachment",
|
||||
"projectFolder": "server/attachment",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/model-server-attachment",
|
||||
"projectFolder": "models/server-attachment",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/server-attachment-resources",
|
||||
"projectFolder": "server/attachment-resources",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/server-contact",
|
||||
"projectFolder": "server/contact",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/model-server-contact",
|
||||
"projectFolder": "models/server-contact",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/server-contact-resources",
|
||||
"projectFolder": "server/contact-resources",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/mongo",
|
||||
"projectFolder": "server/mongo",
|
||||
|
7
server/attachment-resources/.eslintrc.js
Normal file
7
server/attachment-resources/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
server/attachment-resources/.npmignore
Normal file
4
server/attachment-resources/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
server/attachment-resources/config/rig.json
Normal file
18
server/attachment-resources/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/platform-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
server/attachment-resources/package.json
Normal file
34
server/attachment-resources/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/server-attachment-resources",
|
||||
"version": "0.6.0",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig": "~0.6.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-core": "~0.6.0",
|
||||
"@anticrm/attachment": "~0.6.0"
|
||||
}
|
||||
}
|
86
server/attachment-resources/src/index.ts
Normal file
86
server/attachment-resources/src/index.ts
Normal file
@ -0,0 +1,86 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021, 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Doc, Ref, Tx, TxCollectionCUD, TxCreateDoc, TxRemoveDoc } from '@anticrm/core'
|
||||
import type { TriggerControl } from '@anticrm/server-core'
|
||||
import type { Attachment } from '@anticrm/attachment'
|
||||
import attachment from '@anticrm/attachment'
|
||||
import core, { TxProcessor } from '@anticrm/core'
|
||||
|
||||
const extractTx = (tx: Tx): Tx => {
|
||||
if (tx._class === core.class.TxCollectionCUD) {
|
||||
return (tx as TxCollectionCUD<Doc, Attachment>).tx
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
const findCreateTx = async (id: Ref<Attachment>, findAll: TriggerControl['findAll']): Promise<TxCreateDoc<Attachment> | undefined> => {
|
||||
const createTx = (await findAll<TxCreateDoc<Attachment>>(core.class.TxCreateDoc, { objectId: id }))[0]
|
||||
|
||||
if (createTx !== undefined) {
|
||||
return createTx
|
||||
}
|
||||
|
||||
const colTx = (await findAll<TxCollectionCUD<Doc, Attachment>>(core.class.TxCollectionCUD, {
|
||||
'tx._class': core.class.TxCreateDoc,
|
||||
'tx.objectClass': attachment.class.Attachment,
|
||||
'tx.objectId': id
|
||||
}))[0]
|
||||
|
||||
return colTx.tx as TxCreateDoc<Attachment>
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function OnAttachmentDelete (tx: Tx, { findAll, hierarchy, fulltextFx, storageFx }: TriggerControl): Promise<Tx[]> {
|
||||
const actualTx = extractTx(tx)
|
||||
if (actualTx._class !== core.class.TxRemoveDoc) {
|
||||
return []
|
||||
}
|
||||
|
||||
const rmTx = actualTx as TxRemoveDoc<Attachment>
|
||||
|
||||
if (!hierarchy.isDerived(rmTx.objectClass, attachment.class.Attachment)) {
|
||||
return []
|
||||
}
|
||||
|
||||
const createTx = await findCreateTx(rmTx.objectId, findAll)
|
||||
|
||||
if (createTx === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
const attach = TxProcessor.createDoc2Doc(createTx)
|
||||
|
||||
fulltextFx(async (adapter) => {
|
||||
await adapter.remove(attach.file as Ref<Doc>)
|
||||
})
|
||||
|
||||
storageFx(async (adapter, bucket) => {
|
||||
await adapter.removeObject(bucket, attach.file)
|
||||
})
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
export default async () => ({
|
||||
trigger: {
|
||||
OnAttachmentDelete
|
||||
}
|
||||
})
|
8
server/attachment-resources/tsconfig.json
Normal file
8
server/attachment-resources/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
}
|
||||
}
|
7
server/attachment/.eslintrc.js
Normal file
7
server/attachment/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
server/attachment/.npmignore
Normal file
4
server/attachment/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
server/attachment/config/rig.json
Normal file
18
server/attachment/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/platform-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
server/attachment/package.json
Normal file
34
server/attachment/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/server-attachment",
|
||||
"version": "0.6.1",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig": "~0.6.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@types/node": "^16.4.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-core": "~0.6.0"
|
||||
}
|
||||
}
|
33
server/attachment/src/index.ts
Normal file
33
server/attachment/src/index.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021, 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Resource, Plugin } from '@anticrm/platform'
|
||||
import { plugin } from '@anticrm/platform'
|
||||
import type { TriggerFunc } from '@anticrm/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const serverAttachmentId = 'server-attachment' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export default plugin(serverAttachmentId, {
|
||||
trigger: {
|
||||
OnAttachmentDelete: '' as Resource<TriggerFunc>
|
||||
}
|
||||
})
|
9
server/attachment/tsconfig.json
Normal file
9
server/attachment/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
7
server/contact-resources/.eslintrc.js
Normal file
7
server/contact-resources/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
server/contact-resources/.npmignore
Normal file
4
server/contact-resources/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
server/contact-resources/config/rig.json
Normal file
18
server/contact-resources/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/platform-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
server/contact-resources/package.json
Normal file
34
server/contact-resources/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/server-contact-resources",
|
||||
"version": "0.6.0",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig": "~0.6.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-core": "~0.6.0",
|
||||
"@anticrm/contact": "~0.6.0"
|
||||
}
|
||||
}
|
63
server/contact-resources/src/index.ts
Normal file
63
server/contact-resources/src/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021, 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Tx, TxCreateDoc, TxRemoveDoc, TxUpdateDoc } from '@anticrm/core'
|
||||
import core from '@anticrm/core'
|
||||
import type { TriggerControl } from '@anticrm/server-core'
|
||||
import type { Contact } from '@anticrm/contact'
|
||||
import contact from '@anticrm/contact'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function OnContactDelete (tx: Tx, { findAll, hierarchy, storageFx }: TriggerControl): Promise<Tx[]> {
|
||||
if (tx._class !== core.class.TxRemoveDoc) {
|
||||
return []
|
||||
}
|
||||
|
||||
const rmTx = tx as TxRemoveDoc<Contact>
|
||||
|
||||
if (!hierarchy.isDerived(rmTx.objectClass, contact.class.Contact)) {
|
||||
return []
|
||||
}
|
||||
|
||||
const createTx = (await findAll<TxCreateDoc<Contact>>(core.class.TxCreateDoc, { objectId: rmTx.objectId }))[0]
|
||||
if (createTx === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
const updateTxes = await findAll<TxUpdateDoc<Contact>>(core.class.TxUpdateDoc, { objectId: rmTx.objectId })
|
||||
const avatar: string | undefined = [createTx.attributes.avatar, ...updateTxes.map((x) => x.operations.avatar)]
|
||||
.filter((x): x is string => x !== undefined)
|
||||
.slice(-1)[0]
|
||||
|
||||
if (avatar === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
storageFx(async (adapter, bucket) => {
|
||||
await adapter.removeObject(bucket, avatar)
|
||||
})
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
export default async () => ({
|
||||
trigger: {
|
||||
OnContactDelete
|
||||
}
|
||||
})
|
8
server/contact-resources/tsconfig.json
Normal file
8
server/contact-resources/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
}
|
||||
}
|
7
server/contact/.eslintrc.js
Normal file
7
server/contact/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
server/contact/.npmignore
Normal file
4
server/contact/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
server/contact/config/rig.json
Normal file
18
server/contact/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/platform-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
34
server/contact/package.json
Normal file
34
server/contact/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@anticrm/server-contact",
|
||||
"version": "0.6.1",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:watch": "tsc",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"lint": "eslint src",
|
||||
"format": "prettier --write src && eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig": "~0.6.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@types/node": "^16.4.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@typescript-eslint/parser": "^5.4.0",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-core": "~0.6.0"
|
||||
}
|
||||
}
|
33
server/contact/src/index.ts
Normal file
33
server/contact/src/index.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021, 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Resource, Plugin } from '@anticrm/platform'
|
||||
import { plugin } from '@anticrm/platform'
|
||||
import type { TriggerFunc } from '@anticrm/server-core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const serverContactId = 'server-contact' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export default plugin(serverContactId, {
|
||||
trigger: {
|
||||
OnContactDelete: '' as Resource<TriggerFunc>
|
||||
}
|
||||
})
|
9
server/contact/tsconfig.json
Normal file
9
server/contact/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
"@anticrm/platform-rig": "~0.6.0",
|
||||
"@types/heft-jest": "^1.0.2",
|
||||
"@types/node": "^16.4.10",
|
||||
"@types/minio": "~7.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
@ -28,6 +29,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5"
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"minio": "~7.0.26"
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Client as MinioClient } from 'minio'
|
||||
import core, {
|
||||
AttachedDoc,
|
||||
Class,
|
||||
@ -84,6 +85,7 @@ export interface DbConfiguration {
|
||||
factory: FullTextAdapterFactory
|
||||
url: string
|
||||
}
|
||||
storageFactory?: () => MinioClient
|
||||
}
|
||||
|
||||
class TServerStorage implements ServerStorage {
|
||||
@ -96,7 +98,9 @@ class TServerStorage implements ServerStorage {
|
||||
private readonly hierarchy: Hierarchy,
|
||||
private readonly triggers: Triggers,
|
||||
private readonly fulltextAdapter: FullTextAdapter,
|
||||
private readonly storageAdapter: MinioClient | undefined,
|
||||
private readonly modelDb: ModelDb,
|
||||
private readonly workspace: string,
|
||||
options?: ServerStorageOptions
|
||||
) {
|
||||
this.fulltext = new FullTextIndex(hierarchy, fulltextAdapter, this, options?.skipUpdateAttached ?? false)
|
||||
@ -204,6 +208,13 @@ class TServerStorage implements ServerStorage {
|
||||
await this.modelDb.tx(tx)
|
||||
}
|
||||
|
||||
const fAll = (mctx: MeasureContext) => <T extends Doc>(
|
||||
clazz: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
options?: FindOptions<T>
|
||||
): Promise<FindResult<T>> => this.findAll(mctx, clazz, query, options)
|
||||
|
||||
const triggerFx = new Effects()
|
||||
let derived: Tx[] = []
|
||||
let result: TxResult = {}
|
||||
// store object
|
||||
@ -212,7 +223,20 @@ class TServerStorage implements ServerStorage {
|
||||
derived = [
|
||||
...(await ctx.with('process-collection', { _class }, () => this.processCollection(ctx, tx))),
|
||||
...(await ctx.with('process-triggers', {}, (ctx) =>
|
||||
this.triggers.apply(tx.modifiedBy, tx, this.findAll.bind(this, ctx), this.hierarchy)
|
||||
this.triggers.apply(tx.modifiedBy, tx, {
|
||||
fx: triggerFx.fx,
|
||||
fulltextFx: (f) => triggerFx.fx(() => f(this.fulltextAdapter)),
|
||||
storageFx: (f) => {
|
||||
const adapter = this.storageAdapter
|
||||
if (adapter === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
triggerFx.fx(() => f(adapter, this.workspace))
|
||||
},
|
||||
findAll: fAll(ctx),
|
||||
hierarchy: this.hierarchy
|
||||
})
|
||||
))
|
||||
]
|
||||
|
||||
@ -226,11 +250,29 @@ class TServerStorage implements ServerStorage {
|
||||
for (const tx of derived) {
|
||||
await ctx.with('derived-fulltext', { _class: txClass(tx) }, (ctx) => this.fulltext.tx(ctx, tx))
|
||||
}
|
||||
|
||||
for (const fx of triggerFx.effects) {
|
||||
await fx()
|
||||
}
|
||||
|
||||
return [result, derived]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type Effect = () => Promise<void>
|
||||
class Effects {
|
||||
private readonly _effects: Effect[] = []
|
||||
|
||||
public fx = (f: Effect): void => {
|
||||
this._effects.push(f)
|
||||
}
|
||||
|
||||
get effects (): Effect[] {
|
||||
return [...this._effects]
|
||||
}
|
||||
}
|
||||
|
||||
function txObjectClass (tx: Tx): string {
|
||||
return tx._class === core.class.TxCollectionCUD
|
||||
? (tx as TxCollectionCUD<Doc, AttachedDoc>).tx.objectClass
|
||||
@ -283,6 +325,7 @@ export async function createServerStorage (conf: DbConfiguration, options?: Serv
|
||||
}
|
||||
|
||||
const fulltextAdapter = await conf.fulltextAdapter.factory(conf.fulltextAdapter.url, conf.workspace)
|
||||
const storageAdapter = conf.storageFactory?.()
|
||||
|
||||
return new TServerStorage(conf.domains, conf.defaultAdapter, adapters, hierarchy, triggers, fulltextAdapter, modelDb, options)
|
||||
return new TServerStorage(conf.domains, conf.defaultAdapter, adapters, hierarchy, triggers, fulltextAdapter, storageAdapter, modelDb, conf.workspace, options)
|
||||
}
|
||||
|
@ -14,11 +14,11 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Tx, Doc, TxCreateDoc, Ref, Account, Hierarchy, TxCollectionCUD, AttachedDoc } from '@anticrm/core'
|
||||
import type { Tx, Doc, TxCreateDoc, Ref, Account, TxCollectionCUD, AttachedDoc } from '@anticrm/core'
|
||||
import core, { TxFactory } from '@anticrm/core'
|
||||
|
||||
import { getResource } from '@anticrm/platform'
|
||||
import type { Trigger, TriggerFunc, FindAll } from './types'
|
||||
import type { Trigger, TriggerFunc, TriggerControl } from './types'
|
||||
|
||||
import serverCore from './plugin'
|
||||
|
||||
@ -42,8 +42,8 @@ export class Triggers {
|
||||
}
|
||||
}
|
||||
|
||||
async apply (account: Ref<Account>, tx: Tx, findAll: FindAll<Doc>, hierarchy: Hierarchy): Promise<Tx[]> {
|
||||
const derived = this.triggers.map(trigger => trigger(tx, new TxFactory(account), findAll, hierarchy))
|
||||
async apply (account: Ref<Account>, tx: Tx, ctrl: Omit<TriggerControl, 'txFactory'>): Promise<Tx[]> {
|
||||
const derived = this.triggers.map(trigger => trigger(tx, { ...ctrl, txFactory: new TxFactory(account) }))
|
||||
const result = await Promise.all(derived)
|
||||
return result.flatMap(x => x)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021 Hardcore Engineering Inc.
|
||||
// Copyright © 2021, 2022 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
|
||||
@ -14,19 +14,30 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Tx, Ref, Doc, Class, Space, Timestamp, Account, FindResult, DocumentQuery, FindOptions, TxResult, MeasureContext } from '@anticrm/core'
|
||||
import type { Client as MinioClient } from 'minio'
|
||||
import type { Tx, Ref, Doc, Class, Storage, Space, Timestamp, Account, FindResult, DocumentQuery, FindOptions, TxResult, MeasureContext } from '@anticrm/core'
|
||||
import { TxFactory, Hierarchy } from '@anticrm/core'
|
||||
import type { Resource } from '@anticrm/platform'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type FindAll<T extends Doc> = (clazz: Ref<Class<T>>, query: DocumentQuery<T>, options?: FindOptions<T>) => Promise<FindResult<T>>
|
||||
export interface TriggerControl {
|
||||
txFactory: TxFactory
|
||||
findAll: Storage['findAll']
|
||||
hierarchy: Hierarchy
|
||||
|
||||
fulltextFx: (f: (adapter: FullTextAdapter) => Promise<void>) => void
|
||||
// Since we don't have other storages let's consider adapter is MinioClient
|
||||
// Later can be replaced with generic one with bucket encapsulated inside.
|
||||
storageFx: (f: (adapter: MinioClient, bucket: string) => Promise<void>) => void
|
||||
fx: (f: () => Promise<void>) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type TriggerFunc = (tx: Tx, txFactory: TxFactory, findAll: FindAll<Doc>, hierarchy: Hierarchy) => Promise<Tx[]>
|
||||
export type TriggerFunc = (tx: Tx, ctrl: TriggerControl) => Promise<Tx[]>
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -22,7 +22,7 @@ import cors from 'cors'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
import { decode } from 'jwt-simple'
|
||||
|
||||
import { Space, Ref, Doc, Account, generateId } from '@anticrm/core'
|
||||
import { Space, Ref, Doc, Account } from '@anticrm/core'
|
||||
// import { TxFactory } from '@anticrm/core'
|
||||
import type { Token, IndexedDoc } from '@anticrm/server-core'
|
||||
import { createElasticAdapter } from '@anticrm/elastic'
|
||||
@ -159,9 +159,9 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
const uuid = await minioUpload(config.minio, payload.workspace, file)
|
||||
console.log('uploaded uuid', uuid)
|
||||
|
||||
const name = req.query.name as string | undefined
|
||||
const space = req.query.space as Ref<Space> | undefined
|
||||
const attachedTo = req.query.attachedTo as Ref<Doc> | undefined
|
||||
|
||||
// const name = req.query.name as string
|
||||
|
||||
// await createAttachment(
|
||||
@ -175,11 +175,11 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
// fileId
|
||||
// )
|
||||
|
||||
if (name !== undefined && space !== undefined && attachedTo !== undefined) {
|
||||
if (space !== undefined && attachedTo !== undefined) {
|
||||
const elastic = await createElasticAdapter(config.elasticUrl, payload.workspace)
|
||||
|
||||
const indexedDoc: IndexedDoc = {
|
||||
id: generateId() + '/attachments/' + name as Ref<Doc>,
|
||||
id: uuid as Ref<Doc>,
|
||||
_class: attachment.class.Attachment,
|
||||
space,
|
||||
modifiedOn: Date.now(),
|
||||
@ -273,7 +273,7 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
const elastic = await createElasticAdapter(config.elasticUrl, payload.workspace)
|
||||
|
||||
const indexedDoc: IndexedDoc = {
|
||||
id: generateId() + '/attachments/' + 'Profile.pdf' as Ref<Doc>,
|
||||
id: id as Ref<Doc>,
|
||||
_class: attachment.class.Attachment,
|
||||
space,
|
||||
modifiedOn: Date.now(),
|
||||
|
@ -30,6 +30,21 @@ spec:
|
||||
secretKeyRef:
|
||||
name: elastic
|
||||
key: url
|
||||
- name: MINIO_ENDPOINT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio
|
||||
key: endpoint
|
||||
- name: MINIO_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio
|
||||
key: accessKey
|
||||
- name: MINIO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio
|
||||
key: secretKey
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
@ -5,7 +5,7 @@
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"start": "ts-node src/__start.ts",
|
||||
"start": "MONGO_URL=mongodb://localhost:27017 ELASTIC_URL=http://localhost:9200 MINIO_ENDPOINT=localhost MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin ts-node src/__start.ts",
|
||||
"build": "heft build",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"bundle": "esbuild src/__start.ts --bundle --platform=node > bundle.js",
|
||||
@ -31,15 +31,21 @@
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"prettier": "^2.4.1",
|
||||
"@rushstack/heft": "^0.41.1",
|
||||
"typescript": "^4.3.5"
|
||||
"typescript": "^4.3.5",
|
||||
"@types/minio": "~7.0.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/server-core": "~0.6.1",
|
||||
"@anticrm/server-ws": "~0.6.11",
|
||||
"@anticrm/server-attachment": "~0.6.0",
|
||||
"@anticrm/server-attachment-resources": "~0.6.0",
|
||||
"@anticrm/mongo": "~0.6.1",
|
||||
"@anticrm/elastic": "~0.6.0",
|
||||
"elastic-apm-node": "~3.26.0"
|
||||
"elastic-apm-node": "~3.26.0",
|
||||
"minio": "~7.0.26",
|
||||
"@anticrm/server-contact": "~0.6.1",
|
||||
"@anticrm/server-contact-resources": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,32 @@ if (elasticUrl === undefined) {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const minioEndpoint = process.env.MINIO_ENDPOINT
|
||||
if (minioEndpoint === undefined) {
|
||||
console.error('MINIO_ENDPOINT is required')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const minioAccessKey = process.env.MINIO_ACCESS_KEY
|
||||
if (minioAccessKey === undefined) {
|
||||
console.error('MINIO_ACCESS_KEY is required')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const minioSecretKey = process.env.MINIO_SECRET_KEY
|
||||
if (minioSecretKey === undefined) {
|
||||
console.error('MINIO_SECRET_KEY is required')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const minioConf = {
|
||||
endPoint: minioEndpoint,
|
||||
accessKey: minioAccessKey,
|
||||
secretKey: minioSecretKey
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
const shutdown = start(url, elasticUrl, 3333)
|
||||
const shutdown = start(url, elasticUrl, minioConf, 3333)
|
||||
|
||||
const close = (): void => {
|
||||
console.trace('Exiting from server')
|
||||
|
@ -15,3 +15,4 @@
|
||||
//
|
||||
|
||||
export { start } from './server'
|
||||
export type { MinioConfig } from './server'
|
||||
|
@ -14,12 +14,18 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Client as MinioClient } from 'minio'
|
||||
import { Class, Doc, DocumentQuery, DOMAIN_MODEL, DOMAIN_TX, FindOptions, FindResult, Hierarchy, ModelDb, Ref, Tx, TxResult } from '@anticrm/core'
|
||||
import { createElasticAdapter } from '@anticrm/elastic'
|
||||
import { createMongoAdapter, createMongoTxAdapter } from '@anticrm/mongo'
|
||||
import type { DbAdapter, DbConfiguration } from '@anticrm/server-core'
|
||||
import { createServerStorage } from '@anticrm/server-core'
|
||||
import { start as startJsonRpc } from '@anticrm/server-ws'
|
||||
|
||||
import { addLocation } from '@anticrm/platform'
|
||||
import { serverAttachmentId } from '@anticrm/server-attachment'
|
||||
import { serverContactId } from '@anticrm/server-contact'
|
||||
|
||||
import { metricsContext } from './metrics'
|
||||
|
||||
class NullDbAdapter implements DbAdapter {
|
||||
@ -36,7 +42,19 @@ async function createNullAdapter (hierarchy: Hierarchy, url: string, db: string,
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function start (dbUrl: string, fullTextUrl: string, port: number, host?: string): () => void {
|
||||
export interface MinioConfig {
|
||||
endPoint: string
|
||||
accessKey: string
|
||||
secretKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function start (dbUrl: string, fullTextUrl: string, minioConf: MinioConfig, port: number, host?: string): () => void {
|
||||
addLocation(serverAttachmentId, () => import('@anticrm/server-attachment-resources'))
|
||||
addLocation(serverContactId, () => import('@anticrm/server-contact-resources'))
|
||||
|
||||
return startJsonRpc(metricsContext, (workspace: string) => {
|
||||
const conf: DbConfiguration = {
|
||||
domains: {
|
||||
@ -62,6 +80,11 @@ export function start (dbUrl: string, fullTextUrl: string, port: number, host?:
|
||||
factory: createElasticAdapter,
|
||||
url: fullTextUrl
|
||||
},
|
||||
storageFactory: () => new MinioClient({
|
||||
...minioConf,
|
||||
port: 9000,
|
||||
useSSL: false
|
||||
}),
|
||||
workspace
|
||||
}
|
||||
return createServerStorage(conf)
|
||||
|
Loading…
Reference in New Issue
Block a user