@haiiro/docuflow 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.twenty/output/manifest.json → manifest.json} +9 -9
- package/package.json +15 -3
- package/{.twenty/output/src → src}/front-components/docflow-documents.front-component.mjs +24 -24
- package/src/front-components/docflow-documents.front-component.tsx +21 -6
- package/{.twenty/output/src → src}/front-components/docflow-processes.front-component.mjs +18 -18
- package/{.twenty/output/src → src}/front-components/docflow-tasks.front-component.mjs +18 -18
- package/{.twenty/output/src → src}/front-components/process-steps.front-component.mjs +19 -19
- package/src/front-components/process-steps.front-component.tsx +6 -1
- package/{.twenty/output/src → src}/front-components/task-form.front-component.mjs +24 -24
- package/{.twenty/output/src → src}/logic-functions/launch-process.logic-function.mjs +14 -0
- package/src/logic-functions/launch-process.logic-function.ts +5 -0
- package/{.twenty/output/src → src}/logic-functions/save-launch-fields.logic-function.mjs +14 -0
- package/src/logic-functions/save-launch-fields.logic-function.ts +5 -0
- package/.gitignore +0 -43
- package/.nvmrc +0 -1
- package/.oxlintrc.json +0 -37
- package/.twenty/output/README.md +0 -128
- package/.twenty/output/package.json +0 -49
- package/.twenty/output/public/cover.svg +0 -15
- package/.twenty/output/public/logo.svg +0 -9
- package/.twenty/output/src/front-components/docflow-documents.front-component.tsx +0 -516
- package/.twenty/output/src/front-components/docflow-processes.front-component.tsx +0 -266
- package/.twenty/output/src/front-components/docflow-tasks.front-component.tsx +0 -303
- package/.twenty/output/src/front-components/process-steps.front-component.tsx +0 -286
- package/.twenty/output/src/front-components/task-form.front-component.tsx +0 -29
- package/.twenty/output/src/logic-functions/bitrix-app.logic-function.ts +0 -143
- package/.twenty/output/src/logic-functions/bitrix-event.logic-function.ts +0 -54
- package/.twenty/output/src/logic-functions/bitrix-install.logic-function.ts +0 -81
- package/.twenty/output/src/logic-functions/capture-file.logic-function.ts +0 -32
- package/.twenty/output/src/logic-functions/complete-task.logic-function.ts +0 -46
- package/.twenty/output/src/logic-functions/hand-out-form-step.logic-function.ts +0 -30
- package/.twenty/output/src/logic-functions/health-check.ts +0 -31
- package/.twenty/output/src/logic-functions/launch-parameters-step.logic-function.ts +0 -33
- package/.twenty/output/src/logic-functions/launch-process.logic-function.ts +0 -96
- package/.twenty/output/src/logic-functions/notify-bitrix-assignee.logic-function.ts +0 -85
- package/.twenty/output/src/logic-functions/on-attachment-created.logic-function.ts +0 -67
- package/.twenty/output/src/logic-functions/on-task-updated.logic-function.ts +0 -71
- package/.twenty/output/src/logic-functions/on-workflow-run-updated.logic-function.ts +0 -70
- package/.twenty/output/src/logic-functions/save-launch-fields.logic-function.ts +0 -73
- package/.twenty/output/src/logic-functions/save-step-settings.logic-function.ts +0 -90
- package/.twenty/output/src/logic-functions/save-task-form.logic-function.ts +0 -62
- package/.twenty/output/yarn.lock +0 -3292
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +0 -1
- package/dist/tsconfig.spec.tsbuildinfo +0 -1
- package/src/__tests__/api-and-bitrix.test.ts +0 -89
- package/src/__tests__/form-fields.test.ts +0 -73
- package/src/__tests__/launch-parameters.test.ts +0 -75
- package/src/__tests__/step-settings.test.ts +0 -39
- package/src/__tests__/workflow-run.test.ts +0 -113
- package/src/application-config.ts +0 -58
- package/src/fields/company-documents.field.ts +0 -29
- package/src/fields/document-author.field.ts +0 -32
- package/src/fields/document-counterparty.field.ts +0 -32
- package/src/fields/document-folder-child-folders.field.ts +0 -23
- package/src/fields/document-folder-documents.field.ts +0 -24
- package/src/fields/document-folder-parent-folder.field.ts +0 -31
- package/src/fields/document-folder.field.ts +0 -32
- package/src/fields/document-responsible.field.ts +0 -32
- package/src/fields/member-authored-documents.field.ts +0 -29
- package/src/fields/member-responsible-documents.field.ts +0 -29
- package/src/fields/task-form-schema.field.ts +0 -21
- package/src/fields/task-form-values.field.ts +0 -21
- package/src/fields/task-instruction.field.ts +0 -21
- package/src/fields/task-section.field.ts +0 -36
- package/src/fields/task-workflow-run-id.field.ts +0 -21
- package/src/fields/task-workflow-step-id.field.ts +0 -21
- package/src/fields/task-workflow-thread-id.field.ts +0 -21
- package/src/fields/workflow-launch-fields.field.ts +0 -21
- package/src/fields/workflow-section.field.ts +0 -36
- package/src/front/api.ts +0 -56
- package/src/front/format.ts +0 -60
- package/src/front/hooks/use-async.ts +0 -54
- package/src/front/hooks/use-workspace-members.ts +0 -22
- package/src/front/types.ts +0 -48
- package/src/front/ui/components.tsx +0 -436
- package/src/front/ui/form-field-inputs.tsx +0 -187
- package/src/front/ui/form-fields-builder.tsx +0 -183
- package/src/front/ui/task-work-panel.tsx +0 -218
- package/src/navigation-menu-items/docflow.navigation-menu-item.ts +0 -15
- package/src/objects/document-folder.object.ts +0 -80
- package/src/objects/document.object.ts +0 -312
- package/src/page-layouts/docflow.page-layout.ts +0 -86
- package/src/page-layouts/task-docflow.page-layout-tab.ts +0 -36
- package/src/page-layouts/workflow-steps.page-layout-tab.ts +0 -37
- package/src/roles/default-role.ts +0 -21
- package/src/roles/docflow-member.role.ts +0 -23
- package/src/server/bitrix-page.ts +0 -52
- package/src/server/bitrix-portal.ts +0 -67
- package/src/server/document-capture.ts +0 -102
- package/src/server/http-response.ts +0 -18
- package/src/server/launch-step.ts +0 -166
- package/src/server/process-tasks.ts +0 -116
- package/src/server/records.ts +0 -132
- package/src/server/task-completion.ts +0 -100
- package/src/server/workflow-engine.ts +0 -105
- package/src/shared/api/core-graphql.util.ts +0 -98
- package/src/shared/api/object-summaries.ts +0 -79
- package/src/shared/api/rest-filter.util.ts +0 -37
- package/src/shared/api/rest-response.util.ts +0 -43
- package/src/shared/bitrix/bitrix-client.ts +0 -114
- package/src/shared/bitrix/bitrix.type.ts +0 -25
- package/src/shared/bitrix/bitrix.util.ts +0 -139
- package/src/shared/docflow.constants.ts +0 -31
- package/src/shared/documents/attachment-target.util.ts +0 -64
- package/src/shared/engine.ts +0 -11
- package/src/shared/form/form-field-builder.util.ts +0 -122
- package/src/shared/form/form-field.type.ts +0 -23
- package/src/shared/form/form-fields.util.ts +0 -138
- package/src/shared/form/step-settings.util.ts +0 -104
- package/src/shared/workflow/launch-step.util.ts +0 -56
- package/src/shared/workflow/run-target-record.util.ts +0 -70
- package/src/shared/workflow/workflow-run.type.ts +0 -35
- package/src/shared/workflow/workflow-run.util.ts +0 -174
- package/src/universal-identifiers.ts +0 -199
- package/src/views/all-document-folders.view.ts +0 -50
- package/src/views/all-documents.view.ts +0 -91
- package/src/views/documents-by-status.view.ts +0 -76
- package/tsconfig.json +0 -37
- package/tsconfig.spec.json +0 -9
- package/vitest.unit.config.ts +0 -14
- /package/{.twenty/output/front-component-shared-dependencies.mjs → front-component-shared-dependencies.mjs} +0 -0
- /package/{.twenty/output/src → src}/logic-functions/bitrix-app.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/bitrix-event.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/bitrix-install.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/capture-file.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/complete-task.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/hand-out-form-step.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/health-check.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/launch-parameters-step.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/notify-bitrix-assignee.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/on-attachment-created.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/on-task-updated.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/on-workflow-run-updated.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/save-step-settings.logic-function.mjs +0 -0
- /package/{.twenty/output/src → src}/logic-functions/save-task-form.logic-function.mjs +0 -0
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import { defineObject, FieldType } from 'twenty-sdk/define';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
DOCUMENT_DATE_UNIVERSAL_IDENTIFIER,
|
|
5
|
-
DOCUMENT_DESCRIPTION_UNIVERSAL_IDENTIFIER,
|
|
6
|
-
DOCUMENT_EDITOR_KIND_UNIVERSAL_IDENTIFIER,
|
|
7
|
-
DOCUMENT_EDITOR_SNAPSHOT_UNIVERSAL_IDENTIFIER,
|
|
8
|
-
DOCUMENT_FILE_UNIVERSAL_IDENTIFIER,
|
|
9
|
-
DOCUMENT_NAME_UNIVERSAL_IDENTIFIER,
|
|
10
|
-
DOCUMENT_NUMBER_UNIVERSAL_IDENTIFIER,
|
|
11
|
-
DOCUMENT_OBJECT_UNIVERSAL_IDENTIFIER,
|
|
12
|
-
DOCUMENT_ORIGIN_UNIVERSAL_IDENTIFIER,
|
|
13
|
-
DOCUMENT_SOURCE_FILE_ID_UNIVERSAL_IDENTIFIER,
|
|
14
|
-
DOCUMENT_SOURCE_OBJECT_NAME_UNIVERSAL_IDENTIFIER,
|
|
15
|
-
DOCUMENT_SOURCE_RECORD_ID_UNIVERSAL_IDENTIFIER,
|
|
16
|
-
DOCUMENT_SOURCE_RECORD_NAME_UNIVERSAL_IDENTIFIER,
|
|
17
|
-
DOCUMENT_STATUS_UNIVERSAL_IDENTIFIER,
|
|
18
|
-
DOCUMENT_TYPE_UNIVERSAL_IDENTIFIER,
|
|
19
|
-
DOCUMENT_VALID_UNTIL_UNIVERSAL_IDENTIFIER,
|
|
20
|
-
DOCUMENT_WORKFLOW_RUN_ID_UNIVERSAL_IDENTIFIER,
|
|
21
|
-
} from 'src/universal-identifiers';
|
|
22
|
-
|
|
23
|
-
export default defineObject({
|
|
24
|
-
universalIdentifier: DOCUMENT_OBJECT_UNIVERSAL_IDENTIFIER,
|
|
25
|
-
nameSingular: 'smbDocument',
|
|
26
|
-
namePlural: 'smbDocuments',
|
|
27
|
-
labelSingular: 'Документ',
|
|
28
|
-
labelPlural: 'Документы',
|
|
29
|
-
description:
|
|
30
|
-
'Документ компании: файл, реквизиты, статус и откуда он пришёл в документы',
|
|
31
|
-
icon: 'IconFiles',
|
|
32
|
-
labelIdentifierFieldMetadataUniversalIdentifier:
|
|
33
|
-
DOCUMENT_NAME_UNIVERSAL_IDENTIFIER,
|
|
34
|
-
fields: [
|
|
35
|
-
{
|
|
36
|
-
universalIdentifier: DOCUMENT_NAME_UNIVERSAL_IDENTIFIER,
|
|
37
|
-
type: FieldType.TEXT,
|
|
38
|
-
label: 'Название',
|
|
39
|
-
icon: 'IconAbc',
|
|
40
|
-
name: 'name',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
universalIdentifier: DOCUMENT_FILE_UNIVERSAL_IDENTIFIER,
|
|
44
|
-
type: FieldType.FILES,
|
|
45
|
-
label: 'Файл',
|
|
46
|
-
icon: 'IconPaperclip',
|
|
47
|
-
name: 'file',
|
|
48
|
-
universalSettings: { maxNumberOfValues: 1 },
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
universalIdentifier: DOCUMENT_STATUS_UNIVERSAL_IDENTIFIER,
|
|
52
|
-
type: FieldType.SELECT,
|
|
53
|
-
label: 'Статус',
|
|
54
|
-
icon: 'IconProgressCheck',
|
|
55
|
-
name: 'status',
|
|
56
|
-
defaultValue: "'DRAFT'",
|
|
57
|
-
options: [
|
|
58
|
-
{
|
|
59
|
-
id: 'a0e18a38-4cd3-417d-afb8-30ae5568adaf',
|
|
60
|
-
value: 'DRAFT',
|
|
61
|
-
label: 'Черновик',
|
|
62
|
-
position: 0,
|
|
63
|
-
color: 'gray',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: '173d34b6-a325-4fe8-bf89-f3635efaf941',
|
|
67
|
-
value: 'IN_REVIEW',
|
|
68
|
-
label: 'На согласовании',
|
|
69
|
-
position: 1,
|
|
70
|
-
color: 'orange',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: 'fe0a1f41-895c-4137-85c6-0315f9a375c6',
|
|
74
|
-
value: 'APPROVED',
|
|
75
|
-
label: 'Согласован',
|
|
76
|
-
position: 2,
|
|
77
|
-
color: 'green',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: 'beb9ae41-787e-4dd8-82f6-2442f4a46209',
|
|
81
|
-
value: 'ARCHIVED',
|
|
82
|
-
label: 'В архиве',
|
|
83
|
-
position: 3,
|
|
84
|
-
color: 'blue',
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
universalIdentifier: DOCUMENT_TYPE_UNIVERSAL_IDENTIFIER,
|
|
90
|
-
type: FieldType.SELECT,
|
|
91
|
-
label: 'Тип',
|
|
92
|
-
icon: 'IconTag',
|
|
93
|
-
name: 'documentType',
|
|
94
|
-
defaultValue: "'OTHER'",
|
|
95
|
-
options: [
|
|
96
|
-
{
|
|
97
|
-
id: '1c605c59-37d3-4acc-80ec-34fb2cc6251c',
|
|
98
|
-
value: 'CONTRACT',
|
|
99
|
-
label: 'Договор',
|
|
100
|
-
position: 0,
|
|
101
|
-
color: 'blue',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: '9549a49f-8ef9-437c-a3d8-52776b68016f',
|
|
105
|
-
value: 'INVOICE',
|
|
106
|
-
label: 'Счёт',
|
|
107
|
-
position: 1,
|
|
108
|
-
color: 'green',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: '67244616-4a2d-4db0-a48a-f891eccb7d2b',
|
|
112
|
-
value: 'ACT',
|
|
113
|
-
label: 'Акт',
|
|
114
|
-
position: 2,
|
|
115
|
-
color: 'turquoise',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
id: '70fcc8e3-e779-4c63-b70d-1f035aed706e',
|
|
119
|
-
value: 'WAYBILL',
|
|
120
|
-
label: 'Накладная',
|
|
121
|
-
position: 3,
|
|
122
|
-
color: 'sky',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
id: '85390ca1-6d61-4691-a347-4a4286bada77',
|
|
126
|
-
value: 'ORDER',
|
|
127
|
-
label: 'Приказ',
|
|
128
|
-
position: 4,
|
|
129
|
-
color: 'purple',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
id: '499e28d6-52e5-47a0-9cb2-348b96192922',
|
|
133
|
-
value: 'LETTER',
|
|
134
|
-
label: 'Письмо',
|
|
135
|
-
position: 5,
|
|
136
|
-
color: 'orange',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: '709b00c4-624e-4fac-9598-cdca9e92e9cd',
|
|
140
|
-
value: 'REPORT',
|
|
141
|
-
label: 'Отчёт',
|
|
142
|
-
position: 6,
|
|
143
|
-
color: 'pink',
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: '19aec623-2fea-42b5-ae02-9554bcda75fb',
|
|
147
|
-
value: 'OTHER',
|
|
148
|
-
label: 'Прочее',
|
|
149
|
-
position: 7,
|
|
150
|
-
color: 'gray',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
universalIdentifier: DOCUMENT_NUMBER_UNIVERSAL_IDENTIFIER,
|
|
156
|
-
type: FieldType.TEXT,
|
|
157
|
-
label: 'Номер',
|
|
158
|
-
icon: 'IconHash',
|
|
159
|
-
name: 'number',
|
|
160
|
-
isNullable: true,
|
|
161
|
-
defaultValue: null,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
universalIdentifier: DOCUMENT_DATE_UNIVERSAL_IDENTIFIER,
|
|
165
|
-
type: FieldType.DATE,
|
|
166
|
-
label: 'Дата документа',
|
|
167
|
-
icon: 'IconCalendar',
|
|
168
|
-
name: 'documentDate',
|
|
169
|
-
isNullable: true,
|
|
170
|
-
defaultValue: null,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
universalIdentifier: DOCUMENT_VALID_UNTIL_UNIVERSAL_IDENTIFIER,
|
|
174
|
-
type: FieldType.DATE,
|
|
175
|
-
label: 'Действует до',
|
|
176
|
-
icon: 'IconCalendarDue',
|
|
177
|
-
name: 'validUntil',
|
|
178
|
-
isNullable: true,
|
|
179
|
-
defaultValue: null,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
universalIdentifier: DOCUMENT_DESCRIPTION_UNIVERSAL_IDENTIFIER,
|
|
183
|
-
type: FieldType.TEXT,
|
|
184
|
-
label: 'Описание',
|
|
185
|
-
icon: 'IconAlignLeft',
|
|
186
|
-
name: 'description',
|
|
187
|
-
isNullable: true,
|
|
188
|
-
defaultValue: null,
|
|
189
|
-
},
|
|
190
|
-
// Откуда документ пришёл (ADR-025 п.5): загружен в разделе или собран
|
|
191
|
-
// сервером из вложения записи либо задания процесса. Заполняет сервер.
|
|
192
|
-
{
|
|
193
|
-
universalIdentifier: DOCUMENT_ORIGIN_UNIVERSAL_IDENTIFIER,
|
|
194
|
-
type: FieldType.SELECT,
|
|
195
|
-
label: 'Источник',
|
|
196
|
-
icon: 'IconArrowFork',
|
|
197
|
-
name: 'origin',
|
|
198
|
-
defaultValue: "'UPLOAD'",
|
|
199
|
-
options: [
|
|
200
|
-
{
|
|
201
|
-
id: '589b6ce6-ed76-4572-8683-2ab62f89d0ad',
|
|
202
|
-
value: 'UPLOAD',
|
|
203
|
-
label: 'Загружен в документы',
|
|
204
|
-
position: 0,
|
|
205
|
-
color: 'gray',
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
id: '0c98e8c3-b61e-4bae-96fe-cb0083b74527',
|
|
209
|
-
value: 'RECORD',
|
|
210
|
-
label: 'Файл записи',
|
|
211
|
-
position: 1,
|
|
212
|
-
color: 'blue',
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
id: 'a33345ed-9a16-425e-bbee-0c43adaa3651',
|
|
216
|
-
value: 'PROCESS',
|
|
217
|
-
label: 'Процесс',
|
|
218
|
-
position: 2,
|
|
219
|
-
color: 'purple',
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
universalIdentifier: DOCUMENT_SOURCE_OBJECT_NAME_UNIVERSAL_IDENTIFIER,
|
|
225
|
-
type: FieldType.TEXT,
|
|
226
|
-
label: 'Объект источника',
|
|
227
|
-
icon: 'IconBox',
|
|
228
|
-
name: 'sourceObjectName',
|
|
229
|
-
isNullable: true,
|
|
230
|
-
defaultValue: null,
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
universalIdentifier: DOCUMENT_SOURCE_RECORD_ID_UNIVERSAL_IDENTIFIER,
|
|
234
|
-
type: FieldType.TEXT,
|
|
235
|
-
label: 'Id записи источника',
|
|
236
|
-
icon: 'IconId',
|
|
237
|
-
name: 'sourceRecordId',
|
|
238
|
-
isNullable: true,
|
|
239
|
-
defaultValue: null,
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
universalIdentifier: DOCUMENT_SOURCE_RECORD_NAME_UNIVERSAL_IDENTIFIER,
|
|
243
|
-
type: FieldType.TEXT,
|
|
244
|
-
label: 'Где загружен',
|
|
245
|
-
icon: 'IconMapPin',
|
|
246
|
-
name: 'sourceRecordName',
|
|
247
|
-
isNullable: true,
|
|
248
|
-
defaultValue: null,
|
|
249
|
-
},
|
|
250
|
-
// Файл источника, из которого документ собран; по нему сбор не повторяется.
|
|
251
|
-
{
|
|
252
|
-
universalIdentifier: DOCUMENT_SOURCE_FILE_ID_UNIVERSAL_IDENTIFIER,
|
|
253
|
-
type: FieldType.TEXT,
|
|
254
|
-
label: 'Файл источника',
|
|
255
|
-
icon: 'IconFileSearch',
|
|
256
|
-
name: 'sourceFileId',
|
|
257
|
-
isNullable: true,
|
|
258
|
-
defaultValue: null,
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
universalIdentifier: DOCUMENT_WORKFLOW_RUN_ID_UNIVERSAL_IDENTIFIER,
|
|
262
|
-
type: FieldType.TEXT,
|
|
263
|
-
label: 'Запуск процесса',
|
|
264
|
-
icon: 'IconTopologyStar3',
|
|
265
|
-
name: 'workflowRunId',
|
|
266
|
-
isNullable: true,
|
|
267
|
-
defaultValue: null,
|
|
268
|
-
},
|
|
269
|
-
// Какой редактор открывает документ (ADR-016 п.8). Пока все значения
|
|
270
|
-
// показывает один просмотрщик файла, Univer добавится записью в реестр фронта.
|
|
271
|
-
{
|
|
272
|
-
universalIdentifier: DOCUMENT_EDITOR_KIND_UNIVERSAL_IDENTIFIER,
|
|
273
|
-
type: FieldType.SELECT,
|
|
274
|
-
label: 'Редактор',
|
|
275
|
-
icon: 'IconEdit',
|
|
276
|
-
name: 'editorKind',
|
|
277
|
-
defaultValue: "'NONE'",
|
|
278
|
-
options: [
|
|
279
|
-
{
|
|
280
|
-
id: '04188e00-de3f-4d7f-bfc9-a38703898f80',
|
|
281
|
-
value: 'NONE',
|
|
282
|
-
label: 'Файл',
|
|
283
|
-
position: 0,
|
|
284
|
-
color: 'gray',
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
id: '7120c842-3d38-4560-b434-7cdf48b5b799',
|
|
288
|
-
value: 'UNIVER_SHEET',
|
|
289
|
-
label: 'Таблица',
|
|
290
|
-
position: 1,
|
|
291
|
-
color: 'green',
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
id: 'ac29b1e1-b344-4b15-8701-27d537744ea4',
|
|
295
|
-
value: 'UNIVER_DOC',
|
|
296
|
-
label: 'Текст',
|
|
297
|
-
position: 2,
|
|
298
|
-
color: 'blue',
|
|
299
|
-
},
|
|
300
|
-
],
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
universalIdentifier: DOCUMENT_EDITOR_SNAPSHOT_UNIVERSAL_IDENTIFIER,
|
|
304
|
-
type: FieldType.RAW_JSON,
|
|
305
|
-
label: 'Снимок редактора',
|
|
306
|
-
icon: 'IconBraces',
|
|
307
|
-
name: 'editorSnapshot',
|
|
308
|
-
isNullable: true,
|
|
309
|
-
defaultValue: null,
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definePageLayout,
|
|
3
|
-
PageLayoutTabLayoutMode,
|
|
4
|
-
PageLayoutWidgetVerticalListHeightBehavior,
|
|
5
|
-
} from 'twenty-sdk/define';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
DOCFLOW_DOCUMENTS_TAB_UNIVERSAL_IDENTIFIER,
|
|
9
|
-
DOCFLOW_DOCUMENTS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
10
|
-
DOCFLOW_PAGE_LAYOUT_UNIVERSAL_IDENTIFIER,
|
|
11
|
-
DOCFLOW_PROCESSES_TAB_UNIVERSAL_IDENTIFIER,
|
|
12
|
-
DOCFLOW_PROCESSES_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
13
|
-
DOCFLOW_TASKS_TAB_UNIVERSAL_IDENTIFIER,
|
|
14
|
-
DOCFLOW_TASKS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
15
|
-
DOCUMENTS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
16
|
-
PROCESSES_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
17
|
-
TASKS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
18
|
-
} from 'src/universal-identifiers';
|
|
19
|
-
|
|
20
|
-
const buildTab = ({
|
|
21
|
-
universalIdentifier,
|
|
22
|
-
widgetUniversalIdentifier,
|
|
23
|
-
frontComponentUniversalIdentifier,
|
|
24
|
-
title,
|
|
25
|
-
icon,
|
|
26
|
-
position,
|
|
27
|
-
}: {
|
|
28
|
-
universalIdentifier: string;
|
|
29
|
-
widgetUniversalIdentifier: string;
|
|
30
|
-
frontComponentUniversalIdentifier: string;
|
|
31
|
-
title: string;
|
|
32
|
-
icon: string;
|
|
33
|
-
position: number;
|
|
34
|
-
}) => ({
|
|
35
|
-
universalIdentifier,
|
|
36
|
-
title,
|
|
37
|
-
position,
|
|
38
|
-
icon,
|
|
39
|
-
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
40
|
-
widgets: [
|
|
41
|
-
{
|
|
42
|
-
universalIdentifier: widgetUniversalIdentifier,
|
|
43
|
-
title: ' ',
|
|
44
|
-
type: 'FRONT_COMPONENT' as const,
|
|
45
|
-
heightBehavior: PageLayoutWidgetVerticalListHeightBehavior.TAB_VIEWPORT,
|
|
46
|
-
configuration: {
|
|
47
|
-
configurationType: 'FRONT_COMPONENT' as const,
|
|
48
|
-
frontComponentUniversalIdentifier,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// The docflow page of the sidebar: the same three sections as the fork's
|
|
55
|
-
// /docflow page, built from the app's front components.
|
|
56
|
-
export default definePageLayout({
|
|
57
|
-
universalIdentifier: DOCFLOW_PAGE_LAYOUT_UNIVERSAL_IDENTIFIER,
|
|
58
|
-
name: 'Документооборот',
|
|
59
|
-
type: 'STANDALONE_PAGE',
|
|
60
|
-
tabs: [
|
|
61
|
-
buildTab({
|
|
62
|
-
universalIdentifier: DOCFLOW_TASKS_TAB_UNIVERSAL_IDENTIFIER,
|
|
63
|
-
widgetUniversalIdentifier: DOCFLOW_TASKS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
64
|
-
frontComponentUniversalIdentifier: TASKS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
65
|
-
title: 'Задания',
|
|
66
|
-
icon: 'IconChecklist',
|
|
67
|
-
position: 0,
|
|
68
|
-
}),
|
|
69
|
-
buildTab({
|
|
70
|
-
universalIdentifier: DOCFLOW_PROCESSES_TAB_UNIVERSAL_IDENTIFIER,
|
|
71
|
-
widgetUniversalIdentifier: DOCFLOW_PROCESSES_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
72
|
-
frontComponentUniversalIdentifier: PROCESSES_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
73
|
-
title: 'Процессы',
|
|
74
|
-
icon: 'IconTopologyStar3',
|
|
75
|
-
position: 1,
|
|
76
|
-
}),
|
|
77
|
-
buildTab({
|
|
78
|
-
universalIdentifier: DOCFLOW_DOCUMENTS_TAB_UNIVERSAL_IDENTIFIER,
|
|
79
|
-
widgetUniversalIdentifier: DOCFLOW_DOCUMENTS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
80
|
-
frontComponentUniversalIdentifier: DOCUMENTS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
81
|
-
title: 'Документы',
|
|
82
|
-
icon: 'IconFileText',
|
|
83
|
-
position: 2,
|
|
84
|
-
}),
|
|
85
|
-
],
|
|
86
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definePageLayoutTab,
|
|
3
|
-
PageLayoutTabLayoutMode,
|
|
4
|
-
PageLayoutWidgetVerticalListHeightBehavior,
|
|
5
|
-
STANDARD_PAGE_LAYOUT_UNIVERSAL_IDENTIFIERS,
|
|
6
|
-
} from 'twenty-sdk/define';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
TASK_FORM_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
10
|
-
TASK_RECORD_DOCFLOW_TAB_UNIVERSAL_IDENTIFIER,
|
|
11
|
-
TASK_RECORD_DOCFLOW_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
12
|
-
} from 'src/universal-identifiers';
|
|
13
|
-
|
|
14
|
-
// "Задание" tab on the standard task page: instruction, the task's own fields
|
|
15
|
-
// and completing it, the same panel as on the docflow page.
|
|
16
|
-
export default definePageLayoutTab({
|
|
17
|
-
universalIdentifier: TASK_RECORD_DOCFLOW_TAB_UNIVERSAL_IDENTIFIER,
|
|
18
|
-
pageLayoutUniversalIdentifier:
|
|
19
|
-
STANDARD_PAGE_LAYOUT_UNIVERSAL_IDENTIFIERS.taskRecordPage.universalIdentifier,
|
|
20
|
-
title: 'Задание',
|
|
21
|
-
position: 50,
|
|
22
|
-
icon: 'IconChecklist',
|
|
23
|
-
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
24
|
-
widgets: [
|
|
25
|
-
{
|
|
26
|
-
universalIdentifier: TASK_RECORD_DOCFLOW_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
27
|
-
title: ' ',
|
|
28
|
-
type: 'FRONT_COMPONENT',
|
|
29
|
-
heightBehavior: PageLayoutWidgetVerticalListHeightBehavior.TAB_VIEWPORT,
|
|
30
|
-
configuration: {
|
|
31
|
-
configurationType: 'FRONT_COMPONENT',
|
|
32
|
-
frontComponentUniversalIdentifier: TASK_FORM_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definePageLayoutTab,
|
|
3
|
-
PageLayoutTabLayoutMode,
|
|
4
|
-
PageLayoutWidgetVerticalListHeightBehavior,
|
|
5
|
-
STANDARD_PAGE_LAYOUT_UNIVERSAL_IDENTIFIERS,
|
|
6
|
-
} from 'twenty-sdk/define';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
PROCESS_STEPS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
10
|
-
WORKFLOW_RECORD_STEPS_TAB_UNIVERSAL_IDENTIFIER,
|
|
11
|
-
WORKFLOW_RECORD_STEPS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
12
|
-
} from 'src/universal-identifiers';
|
|
13
|
-
|
|
14
|
-
// "Запуск и задания" tab on the standard workflow page: the parameters asked
|
|
15
|
-
// before the launch, and who fills each "Human input" step, by when, which
|
|
16
|
-
// fields are required.
|
|
17
|
-
export default definePageLayoutTab({
|
|
18
|
-
universalIdentifier: WORKFLOW_RECORD_STEPS_TAB_UNIVERSAL_IDENTIFIER,
|
|
19
|
-
pageLayoutUniversalIdentifier:
|
|
20
|
-
STANDARD_PAGE_LAYOUT_UNIVERSAL_IDENTIFIERS.workflowRecordPage.universalIdentifier,
|
|
21
|
-
title: 'Запуск и задания',
|
|
22
|
-
position: 50,
|
|
23
|
-
icon: 'IconPlayerPlay',
|
|
24
|
-
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
25
|
-
widgets: [
|
|
26
|
-
{
|
|
27
|
-
universalIdentifier: WORKFLOW_RECORD_STEPS_WIDGET_UNIVERSAL_IDENTIFIER,
|
|
28
|
-
title: ' ',
|
|
29
|
-
type: 'FRONT_COMPONENT',
|
|
30
|
-
heightBehavior: PageLayoutWidgetVerticalListHeightBehavior.FIT_CONTENT,
|
|
31
|
-
configuration: {
|
|
32
|
-
configurationType: 'FRONT_COMPONENT',
|
|
33
|
-
frontComponentUniversalIdentifier: PROCESS_STEPS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineApplicationRole,
|
|
3
|
-
SystemPermissionFlag,
|
|
4
|
-
} from 'twenty-sdk/define';
|
|
5
|
-
|
|
6
|
-
// What the app's functions may do when nobody is behind a run (record
|
|
7
|
-
// events, the Bitrix24 portal): hand out process tasks, collect documents.
|
|
8
|
-
// A run a person triggered is further narrowed to that person's rights.
|
|
9
|
-
export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
|
|
10
|
-
'26b1dde8-4ed9-4f39-8516-e0dcb734ea5a';
|
|
11
|
-
|
|
12
|
-
export default defineApplicationRole({
|
|
13
|
-
universalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
|
|
14
|
-
label: 'Документооборот: функции приложения',
|
|
15
|
-
description: 'Права серверных функций приложения «Документооборот»',
|
|
16
|
-
canReadAllObjectRecords: true,
|
|
17
|
-
canUpdateAllObjectRecords: true,
|
|
18
|
-
canSoftDeleteAllObjectRecords: false,
|
|
19
|
-
canDestroyAllObjectRecords: false,
|
|
20
|
-
permissionFlagUniversalIdentifiers: [SystemPermissionFlag.WORKFLOWS],
|
|
21
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineRole, SystemPermissionFlag } from 'twenty-sdk/define';
|
|
2
|
-
|
|
3
|
-
import { DOCFLOW_MEMBER_ROLE_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
4
|
-
|
|
5
|
-
// Twenty lets only a person with the "Workflows" permission answer a step of
|
|
6
|
-
// a running process. Whoever fills process tasks or launches processes with
|
|
7
|
-
// parameters on a plain Twenty needs this role (or the permission in their
|
|
8
|
-
// own role). It also lets them edit processes: give it to those who own them.
|
|
9
|
-
export default defineRole({
|
|
10
|
-
universalIdentifier: DOCFLOW_MEMBER_ROLE_UNIVERSAL_IDENTIFIER,
|
|
11
|
-
label: 'Документооборот: участник процессов',
|
|
12
|
-
description:
|
|
13
|
-
'Записи CRM и право «Рабочие процессы», без которого Twenty не даёт отвечать на шаги процессов',
|
|
14
|
-
canBeAssignedToUsers: true,
|
|
15
|
-
canBeAssignedToAgents: false,
|
|
16
|
-
canBeAssignedToApiKeys: false,
|
|
17
|
-
canReadAllObjectRecords: true,
|
|
18
|
-
canUpdateAllObjectRecords: true,
|
|
19
|
-
canSoftDeleteAllObjectRecords: true,
|
|
20
|
-
canDestroyAllObjectRecords: false,
|
|
21
|
-
canUpdateAllSettings: false,
|
|
22
|
-
permissionFlagUniversalIdentifiers: [SystemPermissionFlag.WORKFLOWS],
|
|
23
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { escapeHtml } from 'src/shared/bitrix/bitrix.util';
|
|
2
|
-
|
|
3
|
-
const BX24_SDK_URL = 'https://api.bitrix24.com/api/v1/';
|
|
4
|
-
|
|
5
|
-
export type BitrixPageTask = { title: string; url?: string; dueAt?: string };
|
|
6
|
-
|
|
7
|
-
// The page shown inside the portal frame. It opens the CRM in a new browser
|
|
8
|
-
// tab: a CRM session in a third-party frame depends on cookie rules the app
|
|
9
|
-
// cannot change on a plain Twenty.
|
|
10
|
-
export const renderBitrixPage = ({
|
|
11
|
-
title,
|
|
12
|
-
message,
|
|
13
|
-
crmUrl,
|
|
14
|
-
tasks,
|
|
15
|
-
isInstall,
|
|
16
|
-
}: {
|
|
17
|
-
title: string;
|
|
18
|
-
message: string;
|
|
19
|
-
crmUrl?: string;
|
|
20
|
-
tasks: BitrixPageTask[];
|
|
21
|
-
isInstall: boolean;
|
|
22
|
-
}): string => `<!doctype html>
|
|
23
|
-
<html lang="ru">
|
|
24
|
-
<head>
|
|
25
|
-
<meta charset="utf-8">
|
|
26
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
27
|
-
<title>${escapeHtml(title)}</title>
|
|
28
|
-
<script src="${BX24_SDK_URL}"></script>
|
|
29
|
-
<style>
|
|
30
|
-
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; padding: 24px; color: #333; background: #fff; }
|
|
31
|
-
h1 { font-size: 20px; margin: 0 0 8px; }
|
|
32
|
-
p { color: #666; margin: 0 0 16px; }
|
|
33
|
-
a.button { display: inline-block; padding: 8px 16px; border-radius: 8px; background: #1961ed; color: #fff; text-decoration: none; }
|
|
34
|
-
ul { list-style: none; padding: 0; margin: 16px 0 0; }
|
|
35
|
-
li { padding: 8px 0; border-top: 1px solid #eee; display: flex; justify-content: space-between; gap: 16px; }
|
|
36
|
-
li a { color: #1961ed; text-decoration: none; }
|
|
37
|
-
.due { color: #999; white-space: nowrap; }
|
|
38
|
-
</style>
|
|
39
|
-
</head>
|
|
40
|
-
<body>
|
|
41
|
-
<h1>${escapeHtml(title)}</h1>
|
|
42
|
-
<p>${escapeHtml(message)}</p>
|
|
43
|
-
${crmUrl !== undefined ? `<a class="button" href="${escapeHtml(crmUrl)}" target="_blank" rel="noopener">Открыть документооборот</a>` : ''}
|
|
44
|
-
${tasks.length > 0 ? `<ul>${tasks
|
|
45
|
-
.map(
|
|
46
|
-
(task) =>
|
|
47
|
-
`<li>${task.url !== undefined ? `<a href="${escapeHtml(task.url)}" target="_blank" rel="noopener">${escapeHtml(task.title)}</a>` : escapeHtml(task.title)}<span class="due">${escapeHtml(task.dueAt ?? '')}</span></li>`,
|
|
48
|
-
)
|
|
49
|
-
.join('')}</ul>` : ''}
|
|
50
|
-
${isInstall ? '<script>if (window.BX24) { BX24.init(function () { BX24.installFinish(); }); }</script>' : ''}
|
|
51
|
-
</body>
|
|
52
|
-
</html>`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { kv } from 'twenty-sdk/logic-function';
|
|
2
|
-
|
|
3
|
-
import { type BitrixPortal, type BitrixRequest } from 'src/shared/bitrix/bitrix.type';
|
|
4
|
-
import { BITRIX_PORTAL_KV_KEY } from 'src/shared/bitrix/bitrix.util';
|
|
5
|
-
import {
|
|
6
|
-
BitrixError,
|
|
7
|
-
exchangeBitrixRefreshToken,
|
|
8
|
-
withFreshBitrixToken,
|
|
9
|
-
} from 'src/shared/bitrix/bitrix-client';
|
|
10
|
-
|
|
11
|
-
// One Bitrix24 portal per workspace: a company works in one portal.
|
|
12
|
-
export const loadBitrixPortal = (): Promise<BitrixPortal | null> =>
|
|
13
|
-
kv.get<BitrixPortal>(BITRIX_PORTAL_KV_KEY);
|
|
14
|
-
|
|
15
|
-
export const saveBitrixPortal = (portal: BitrixPortal): Promise<void> =>
|
|
16
|
-
kv.set(BITRIX_PORTAL_KV_KEY, portal);
|
|
17
|
-
|
|
18
|
-
export const forgetBitrixPortal = (): Promise<boolean> =>
|
|
19
|
-
kv.delete(BITRIX_PORTAL_KV_KEY);
|
|
20
|
-
|
|
21
|
-
// A request from the portal proves itself by its refresh token. The first
|
|
22
|
-
// proven portal is linked; another portal is refused, so a stranger cannot
|
|
23
|
-
// take over the workspace's link.
|
|
24
|
-
export const proveAndLinkBitrixPortal = async (
|
|
25
|
-
request: BitrixRequest,
|
|
26
|
-
): Promise<BitrixPortal & { bitrixUserId?: string }> => {
|
|
27
|
-
if (request.refreshId === undefined) {
|
|
28
|
-
throw new BitrixError('The request carries no refresh token');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const grant = await exchangeBitrixRefreshToken(request.refreshId);
|
|
32
|
-
const linkedPortal = await loadBitrixPortal();
|
|
33
|
-
|
|
34
|
-
if (linkedPortal !== null && linkedPortal.memberId !== grant.memberId) {
|
|
35
|
-
throw new BitrixError('Another Bitrix24 portal is linked to this workspace');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const portal: BitrixPortal = {
|
|
39
|
-
memberId: grant.memberId,
|
|
40
|
-
portalDomain: grant.portalDomain,
|
|
41
|
-
restEndpoint: grant.restEndpoint,
|
|
42
|
-
accessToken: grant.accessToken,
|
|
43
|
-
refreshToken: grant.refreshToken,
|
|
44
|
-
expiresAt: grant.expiresAt,
|
|
45
|
-
applicationToken: linkedPortal?.applicationToken,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
await saveBitrixPortal(portal);
|
|
49
|
-
|
|
50
|
-
return { ...portal, bitrixUserId: grant.bitrixUserId };
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const getLinkedBitrixPortal = async (): Promise<BitrixPortal | null> => {
|
|
54
|
-
const linkedPortal = await loadBitrixPortal();
|
|
55
|
-
|
|
56
|
-
if (linkedPortal === null) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const { portal, isRefreshed } = await withFreshBitrixToken(linkedPortal);
|
|
61
|
-
|
|
62
|
-
if (isRefreshed) {
|
|
63
|
-
await saveBitrixPortal(portal);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return portal;
|
|
67
|
-
};
|