2021-08-07 05:49:51 +00:00
|
|
|
//
|
2022-04-14 05:30:30 +00:00
|
|
|
// Copyright © 2022 Hardcore Engineering Inc.
|
2021-08-07 05:49:51 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
2022-04-01 05:57:22 +00:00
|
|
|
import core, { coreId, Data, PluginConfiguration, Ref, Tx, Version } from '@anticrm/core'
|
2022-02-08 09:06:06 +00:00
|
|
|
import jsonVersion from './version.json'
|
|
|
|
|
2021-08-07 05:49:51 +00:00
|
|
|
import { Builder } from '@anticrm/model'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as activityModel } from '@anticrm/model-activity'
|
2021-12-06 10:07:08 +00:00
|
|
|
import { createModel as attachmentModel } from '@anticrm/model-attachment'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as chunterModel } from '@anticrm/model-chunter'
|
|
|
|
import { createModel as contactModel } from '@anticrm/model-contact'
|
|
|
|
import { createModel as coreModel } from '@anticrm/model-core'
|
2021-12-30 09:13:16 +00:00
|
|
|
import { createModel as gmailModel } from '@anticrm/model-gmail'
|
2022-01-14 09:20:31 +00:00
|
|
|
import { createModel as inventoryModel } from '@anticrm/model-inventory'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as leadModel } from '@anticrm/model-lead'
|
2022-01-21 09:05:55 +00:00
|
|
|
import { createModel as presentationModel } from '@anticrm/model-presentation'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as recruitModel } from '@anticrm/model-recruit'
|
|
|
|
import { createModel as serverAttachmentModel } from '@anticrm/model-server-attachment'
|
2022-04-28 10:01:20 +00:00
|
|
|
import { createModel as serverBoardModel } from '@anticrm/model-server-board'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as serverContactModel } from '@anticrm/model-server-contact'
|
2022-02-11 09:18:55 +00:00
|
|
|
import { createModel as serverNotificationModel } from '@anticrm/model-server-notification'
|
2022-02-22 09:09:13 +00:00
|
|
|
import { createModel as serverChunterModel } from '@anticrm/model-server-chunter'
|
|
|
|
import { createModel as serverInventoryModel } from '@anticrm/model-server-inventory'
|
|
|
|
import { createModel as serverLeadModel } from '@anticrm/model-server-lead'
|
|
|
|
import { createModel as serverTaskModel } from '@anticrm/model-server-task'
|
2022-06-17 05:07:56 +00:00
|
|
|
import { createModel as serverTrackerModel } from '@anticrm/model-server-tracker'
|
2022-03-22 09:10:10 +00:00
|
|
|
import { createModel as serverTagsModel } from '@anticrm/model-server-tags'
|
2022-03-16 09:02:57 +00:00
|
|
|
import { createModel as serveSettingModel } from '@anticrm/model-server-setting'
|
2022-02-22 09:09:13 +00:00
|
|
|
import { createModel as serverRecruitModel } from '@anticrm/model-server-recruit'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as serverCoreModel } from '@anticrm/model-server-core'
|
|
|
|
import { createModel as settingModel } from '@anticrm/model-setting'
|
|
|
|
import { createModel as taskModel } from '@anticrm/model-task'
|
|
|
|
import { createModel as telegramModel } from '@anticrm/model-telegram'
|
2022-01-24 09:35:58 +00:00
|
|
|
import { createModel as templatesModel } from '@anticrm/model-templates'
|
|
|
|
import { createModel as textEditorModel } from '@anticrm/model-text-editor'
|
2022-01-24 18:30:13 +00:00
|
|
|
import { createModel as viewModel } from '@anticrm/model-view'
|
|
|
|
import { createModel as workbenchModel } from '@anticrm/model-workbench'
|
2022-02-07 09:03:14 +00:00
|
|
|
import { createModel as notificationModel } from '@anticrm/model-notification'
|
2022-02-16 09:02:31 +00:00
|
|
|
import { createModel as tagsModel } from '@anticrm/model-tags'
|
2022-03-18 06:37:49 +00:00
|
|
|
import { createModel as calendarModel } from '@anticrm/model-calendar'
|
2022-03-28 08:05:22 +00:00
|
|
|
import { createModel as serverCalendarModel } from '@anticrm/model-server-calendar'
|
|
|
|
import { createModel as serverGmailModel } from '@anticrm/model-server-gmail'
|
|
|
|
import { createModel as serverTelegramModel } from '@anticrm/model-server-telegram'
|
2022-03-31 08:32:42 +00:00
|
|
|
import { createModel as trackerModel } from '@anticrm/model-tracker'
|
2022-04-02 03:49:23 +00:00
|
|
|
import { createModel as boardModel } from '@anticrm/model-board'
|
2022-04-14 05:30:30 +00:00
|
|
|
import { createModel as preferenceModel } from '@anticrm/model-preference'
|
2021-08-07 05:49:51 +00:00
|
|
|
|
2022-02-08 09:06:06 +00:00
|
|
|
export const version: Data<Version> = jsonVersion as Data<Version>
|
|
|
|
|
2022-01-24 18:30:13 +00:00
|
|
|
const builder = new Builder()
|
2021-08-07 21:35:49 +00:00
|
|
|
|
2022-04-01 05:57:22 +00:00
|
|
|
const builders: [(b: Builder) => void, string][] = [
|
|
|
|
[coreModel, coreId],
|
|
|
|
[activityModel, 'activity'],
|
|
|
|
[attachmentModel, 'attachment'],
|
2022-04-19 09:38:31 +00:00
|
|
|
[tagsModel, 'tags'],
|
2022-04-01 05:57:22 +00:00
|
|
|
[viewModel, 'view'],
|
|
|
|
[workbenchModel, 'workbench'],
|
|
|
|
[contactModel, 'contact'],
|
|
|
|
[chunterModel, 'chunter'],
|
|
|
|
[taskModel, 'task'],
|
|
|
|
[recruitModel, 'recruit'],
|
|
|
|
[settingModel, 'setting'],
|
|
|
|
[telegramModel, 'telegram'],
|
|
|
|
[leadModel, 'lead'],
|
|
|
|
[gmailModel, 'gmail'],
|
|
|
|
[inventoryModel, 'inventory'],
|
|
|
|
[presentationModel, 'presentation'],
|
|
|
|
[templatesModel, 'templates'],
|
|
|
|
[textEditorModel, 'text-editor'],
|
|
|
|
[notificationModel, 'notification'],
|
2022-04-14 05:30:30 +00:00
|
|
|
[preferenceModel, 'preference'],
|
2022-04-01 05:57:22 +00:00
|
|
|
|
|
|
|
[serverCoreModel, 'server-core'],
|
|
|
|
[serverAttachmentModel, 'server-attachment'],
|
2022-04-28 10:01:20 +00:00
|
|
|
[serverBoardModel, 'server-board'],
|
2022-04-01 05:57:22 +00:00
|
|
|
[serverContactModel, 'server-contact'],
|
|
|
|
[serverNotificationModel, 'server-notification'],
|
|
|
|
[serveSettingModel, 'server-setting'],
|
|
|
|
[serverChunterModel, 'server-chunter'],
|
|
|
|
[serverInventoryModel, 'server-inventory'],
|
|
|
|
[serverLeadModel, 'server-lead'],
|
|
|
|
[serverTagsModel, 'server-tags'],
|
|
|
|
[serverTaskModel, 'server-task'],
|
2022-06-17 05:07:56 +00:00
|
|
|
[serverTrackerModel, 'server-tracker'],
|
2022-04-01 05:57:22 +00:00
|
|
|
[serverRecruitModel, 'server-recruit'],
|
|
|
|
[serverCalendarModel, 'server-calendar'],
|
|
|
|
[serverGmailModel, 'server-gmail'],
|
|
|
|
[serverTelegramModel, 'server-telegram'],
|
|
|
|
[trackerModel, 'tracker'],
|
2022-06-15 12:00:32 +00:00
|
|
|
[boardModel, 'board'],
|
|
|
|
[calendarModel, 'calendar']
|
2022-01-24 18:30:13 +00:00
|
|
|
]
|
2021-08-07 05:49:51 +00:00
|
|
|
|
2022-04-01 05:57:22 +00:00
|
|
|
for (const [b, id] of builders) {
|
|
|
|
const txes: Tx[] = []
|
|
|
|
builder.onTx = (tx) => {
|
|
|
|
txes.push(tx)
|
|
|
|
}
|
2022-01-24 18:30:13 +00:00
|
|
|
b(builder)
|
2022-04-01 05:57:22 +00:00
|
|
|
builder.createDoc(
|
|
|
|
core.class.PluginConfiguration,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
pluginId: id,
|
|
|
|
transactions: txes.map((it) => it._id)
|
|
|
|
},
|
|
|
|
('plugin-configuration-' + id) as Ref<PluginConfiguration>
|
|
|
|
)
|
|
|
|
builder.onTx = undefined
|
2022-01-24 18:30:13 +00:00
|
|
|
}
|
2021-08-07 21:35:49 +00:00
|
|
|
|
2022-01-24 18:30:13 +00:00
|
|
|
builder.createDoc(core.class.Version, core.space.Model, version, core.version.Model)
|
2021-08-07 05:49:51 +00:00
|
|
|
export default builder
|
2021-12-07 18:45:11 +00:00
|
|
|
|
|
|
|
// Export upgrade procedures
|
2022-01-24 18:30:13 +00:00
|
|
|
export { migrateOperations } from './migration'
|