@haiiro/docuflow 0.0.13 → 0.0.16
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/README.md +3 -1
- package/bin/install.mjs +78 -7
- package/manifest.json +30 -20
- package/package.json +1 -1
- package/public/app/docflow-app.js +8 -7
- package/src/front-components/docflow-documents.front-component.mjs +41 -41
- package/src/front-components/docflow-documents.front-component.tsx +49 -32
- package/src/front-components/docflow-processes.front-component.mjs +34 -34
- package/src/front-components/docflow-processes.front-component.tsx +6 -9
- package/src/front-components/docflow-tasks.front-component.mjs +40 -39
- package/src/front-components/docflow-tasks.front-component.tsx +37 -15
- package/src/front-components/launch-process.front-component.mjs +30 -30
- package/src/front-components/process-steps.front-component.mjs +25 -25
- package/src/front-components/process-steps.front-component.tsx +2 -1
- package/src/front-components/task-form.front-component.mjs +45 -44
- package/src/front-components/task-form.front-component.tsx +12 -1
- package/src/logic-functions/bitrix-app.logic-function.mjs +27 -2
- package/src/logic-functions/bitrix-app.logic-function.ts +2 -2
- package/src/logic-functions/bitrix-event.logic-function.mjs +22 -1
- package/src/logic-functions/bitrix-event.logic-function.ts +2 -2
- package/src/logic-functions/bitrix-install.logic-function.mjs +26 -1
- package/src/logic-functions/bitrix-install.logic-function.ts +2 -2
- package/src/logic-functions/complete-task.logic-function.mjs +22 -1
- package/src/logic-functions/complete-task.logic-function.ts +2 -2
- package/src/logic-functions/docflow-app-session.logic-function.mjs +22 -1
- package/src/logic-functions/docflow-app-session.logic-function.ts +2 -2
- package/src/logic-functions/docflow-app.logic-function.mjs +29 -2
- package/src/logic-functions/docflow-app.logic-function.ts +2 -1
- package/src/logic-functions/launch-process.logic-function.mjs +23 -13
- package/src/logic-functions/launch-process.logic-function.ts +2 -2
- package/src/logic-functions/publish-process.logic-function.mjs +32 -11
- package/src/logic-functions/publish-process.logic-function.ts +8 -4
- package/src/logic-functions/save-launch-fields.logic-function.mjs +18 -8
- package/src/logic-functions/save-launch-fields.logic-function.ts +2 -2
- package/src/logic-functions/save-step-settings.logic-function.mjs +24 -2
- package/src/logic-functions/save-step-settings.logic-function.ts +2 -2
- package/src/logic-functions/save-task-form.logic-function.mjs +22 -1
- package/src/logic-functions/save-task-form.logic-function.ts +2 -2
|
@@ -14,7 +14,18 @@ const TaskForm = () => {
|
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<DocflowRoot>
|
|
17
|
-
|
|
17
|
+
{/* The panel fills the tab so the task's actions sit at its bottom */}
|
|
18
|
+
<div
|
|
19
|
+
style={{
|
|
20
|
+
boxSizing: 'border-box',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flex: 1,
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
minHeight: 0,
|
|
25
|
+
overflowY: 'auto',
|
|
26
|
+
padding: theme.spacing[3],
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
18
29
|
{taskId === undefined ? <Message>Откройте задачу.</Message> : <TaskWorkPanel taskId={taskId} />}
|
|
19
30
|
</div>
|
|
20
31
|
</DocflowRoot>
|
|
@@ -119749,7 +119749,7 @@ var getCrmUrl = () => {
|
|
|
119749
119749
|
// package.json
|
|
119750
119750
|
var package_default = {
|
|
119751
119751
|
name: "@haiiro/docuflow",
|
|
119752
|
-
version: "0.0.
|
|
119752
|
+
version: "0.0.16",
|
|
119753
119753
|
description: "NorDiv \u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442: \u0437\u0430\u0434\u0430\u043D\u0438\u044F \u0441 \u043F\u043E\u043B\u044F\u043C\u0438, \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u044B \u0441 \u0437\u0430\u043F\u0443\u0441\u043A\u043E\u043C \u043F\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C, \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B \u0441\u043E \u0432\u0441\u0435\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439, \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0411\u0438\u0442\u0440\u0438\u043A\u044124",
|
|
119754
119754
|
license: "AGPL-3.0-only",
|
|
119755
119755
|
publishConfig: {
|
|
@@ -119853,11 +119853,36 @@ ${config.mode === "bitrix" ? `<script src="${BX24_SDK_URL2}"></script>` : ""}
|
|
|
119853
119853
|
}
|
|
119854
119854
|
);
|
|
119855
119855
|
|
|
119856
|
+
// src/shared/log.util.ts
|
|
119857
|
+
var PREFIX = "[docflow]";
|
|
119858
|
+
var describeError = (error) => {
|
|
119859
|
+
if (error instanceof Error) {
|
|
119860
|
+
const { status, body } = error;
|
|
119861
|
+
return { name: error.name, message: error.message, status, body };
|
|
119862
|
+
}
|
|
119863
|
+
return error;
|
|
119864
|
+
};
|
|
119865
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119866
|
+
|
|
119856
119867
|
// src/server/http-response.ts
|
|
119868
|
+
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119869
|
+
status,
|
|
119870
|
+
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119871
|
+
});
|
|
119857
119872
|
var htmlResponse = (status, html) => new AL(html, {
|
|
119858
119873
|
status,
|
|
119859
119874
|
headers: { "content-type": "text/html; charset=utf-8" }
|
|
119860
119875
|
});
|
|
119876
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119877
|
+
try {
|
|
119878
|
+
return await handler2(...args);
|
|
119879
|
+
} catch (error) {
|
|
119880
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119881
|
+
return jsonResponse(500, {
|
|
119882
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
119883
|
+
});
|
|
119884
|
+
}
|
|
119885
|
+
};
|
|
119861
119886
|
|
|
119862
119887
|
// src/universal-identifiers.ts
|
|
119863
119888
|
var BITRIX_APP_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "00fa5cea-d57b-4215-980a-c4bed9232a4f";
|
|
@@ -119939,7 +119964,7 @@ var bitrix_app_logic_function_default = defineLogicFunction({
|
|
|
119939
119964
|
name: "docflow-bitrix-app",
|
|
119940
119965
|
description: "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430 \u0432 \u043F\u043E\u0440\u0442\u0430\u043B\u0435 \u0411\u0438\u0442\u0440\u0438\u043A\u044124",
|
|
119941
119966
|
timeoutSeconds: 30,
|
|
119942
|
-
handler,
|
|
119967
|
+
handler: withRouteErrors("bitrix-app", handler),
|
|
119943
119968
|
httpRouteTriggerSettings: {
|
|
119944
119969
|
path: "/bitrix/app",
|
|
119945
119970
|
httpMethod: "POST",
|
|
@@ -13,7 +13,7 @@ import { proveAndLinkBitrixPortal } from 'src/server/bitrix-portal';
|
|
|
13
13
|
import { renderBitrixPage } from 'src/server/bitrix-page';
|
|
14
14
|
import { getCrmUrl } from 'src/server/crm-url';
|
|
15
15
|
import { renderDocflowAppPage } from 'src/server/docflow-app-page';
|
|
16
|
-
import { htmlResponse } from 'src/server/http-response';
|
|
16
|
+
import { htmlResponse, withRouteErrors } from 'src/server/http-response';
|
|
17
17
|
import { BITRIX_APP_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
18
18
|
|
|
19
19
|
// "Путь вашего обработчика" of the local Bitrix24 application: the page a
|
|
@@ -106,7 +106,7 @@ export default defineLogicFunction({
|
|
|
106
106
|
name: 'docflow-bitrix-app',
|
|
107
107
|
description: 'Страница документооборота в портале Битрикс24',
|
|
108
108
|
timeoutSeconds: 30,
|
|
109
|
-
handler,
|
|
109
|
+
handler: withRouteErrors('bitrix-app', handler),
|
|
110
110
|
httpRouteTriggerSettings: {
|
|
111
111
|
path: '/bitrix/app',
|
|
112
112
|
httpMethod: 'POST',
|
|
@@ -60049,11 +60049,32 @@ var loadBitrixPortal = () => kL.get(BITRIX_PORTAL_KV_KEY);
|
|
|
60049
60049
|
var saveBitrixPortal = (portal) => kL.set(BITRIX_PORTAL_KV_KEY, portal);
|
|
60050
60050
|
var forgetBitrixPortal = () => kL.delete(BITRIX_PORTAL_KV_KEY);
|
|
60051
60051
|
|
|
60052
|
+
// src/shared/log.util.ts
|
|
60053
|
+
var PREFIX = "[docflow]";
|
|
60054
|
+
var describeError = (error) => {
|
|
60055
|
+
if (error instanceof Error) {
|
|
60056
|
+
const { status, body } = error;
|
|
60057
|
+
return { name: error.name, message: error.message, status, body };
|
|
60058
|
+
}
|
|
60059
|
+
return error;
|
|
60060
|
+
};
|
|
60061
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
60062
|
+
|
|
60052
60063
|
// src/server/http-response.ts
|
|
60053
60064
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
60054
60065
|
status,
|
|
60055
60066
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
60056
60067
|
});
|
|
60068
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
60069
|
+
try {
|
|
60070
|
+
return await handler2(...args);
|
|
60071
|
+
} catch (error) {
|
|
60072
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
60073
|
+
return jsonResponse(500, {
|
|
60074
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
60075
|
+
});
|
|
60076
|
+
}
|
|
60077
|
+
};
|
|
60057
60078
|
|
|
60058
60079
|
// src/universal-identifiers.ts
|
|
60059
60080
|
var BITRIX_EVENT_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "f27cfbdc-8e87-4e1a-ab37-fc2a8093946c";
|
|
@@ -60083,7 +60104,7 @@ var bitrix_event_logic_function_default = defineLogicFunction({
|
|
|
60083
60104
|
name: "docflow-bitrix-event",
|
|
60084
60105
|
description: "\u0421\u043E\u0431\u044B\u0442\u0438\u044F \u043F\u043E\u0440\u0442\u0430\u043B\u0430 \u0411\u0438\u0442\u0440\u0438\u043A\u044124 (\u0443\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F)",
|
|
60085
60106
|
timeoutSeconds: 15,
|
|
60086
|
-
handler,
|
|
60107
|
+
handler: withRouteErrors("bitrix-event", handler),
|
|
60087
60108
|
httpRouteTriggerSettings: {
|
|
60088
60109
|
path: "/bitrix/event",
|
|
60089
60110
|
httpMethod: "POST",
|
|
@@ -3,7 +3,7 @@ import { type RoutePayload } from 'twenty-sdk/logic-function';
|
|
|
3
3
|
|
|
4
4
|
import { parseBitrixRequest } from 'src/shared/bitrix/bitrix.util';
|
|
5
5
|
import { forgetBitrixPortal, loadBitrixPortal, saveBitrixPortal } from 'src/server/bitrix-portal';
|
|
6
|
-
import { jsonResponse } from 'src/server/http-response';
|
|
6
|
+
import { jsonResponse, withRouteErrors } from 'src/server/http-response';
|
|
7
7
|
import { BITRIX_EVENT_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
8
8
|
|
|
9
9
|
// Events of the linked portal. An event must name the linked portal; the
|
|
@@ -45,7 +45,7 @@ export default defineLogicFunction({
|
|
|
45
45
|
name: 'docflow-bitrix-event',
|
|
46
46
|
description: 'События портала Битрикс24 (удаление приложения)',
|
|
47
47
|
timeoutSeconds: 15,
|
|
48
|
-
handler,
|
|
48
|
+
handler: withRouteErrors('bitrix-event', handler),
|
|
49
49
|
httpRouteTriggerSettings: {
|
|
50
50
|
path: '/bitrix/event',
|
|
51
51
|
httpMethod: 'POST',
|
|
@@ -119561,11 +119561,36 @@ ${isInstall ? "<script>if (window.BX24) { BX24.init(function () { BX24.installFi
|
|
|
119561
119561
|
</body>
|
|
119562
119562
|
</html>`;
|
|
119563
119563
|
|
|
119564
|
+
// src/shared/log.util.ts
|
|
119565
|
+
var PREFIX = "[docflow]";
|
|
119566
|
+
var describeError = (error) => {
|
|
119567
|
+
if (error instanceof Error) {
|
|
119568
|
+
const { status, body } = error;
|
|
119569
|
+
return { name: error.name, message: error.message, status, body };
|
|
119570
|
+
}
|
|
119571
|
+
return error;
|
|
119572
|
+
};
|
|
119573
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119574
|
+
|
|
119564
119575
|
// src/server/http-response.ts
|
|
119576
|
+
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119577
|
+
status,
|
|
119578
|
+
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119579
|
+
});
|
|
119565
119580
|
var htmlResponse = (status, html) => new AL(html, {
|
|
119566
119581
|
status,
|
|
119567
119582
|
headers: { "content-type": "text/html; charset=utf-8" }
|
|
119568
119583
|
});
|
|
119584
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119585
|
+
try {
|
|
119586
|
+
return await handler2(...args);
|
|
119587
|
+
} catch (error) {
|
|
119588
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119589
|
+
return jsonResponse(500, {
|
|
119590
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
119591
|
+
});
|
|
119592
|
+
}
|
|
119593
|
+
};
|
|
119569
119594
|
|
|
119570
119595
|
// src/universal-identifiers.ts
|
|
119571
119596
|
var BITRIX_INSTALL_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "896071e0-0964-4b28-bc39-ed50c19d592a";
|
|
@@ -119623,7 +119648,7 @@ var bitrix_install_logic_function_default = defineLogicFunction({
|
|
|
119623
119648
|
name: "docflow-bitrix-install",
|
|
119624
119649
|
description: "\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043D\u0430 \u043F\u043E\u0440\u0442\u0430\u043B\u0435 \u0411\u0438\u0442\u0440\u0438\u043A\u044124",
|
|
119625
119650
|
timeoutSeconds: 30,
|
|
119626
|
-
handler,
|
|
119651
|
+
handler: withRouteErrors("bitrix-install", handler),
|
|
119627
119652
|
httpRouteTriggerSettings: {
|
|
119628
119653
|
path: "/bitrix/install",
|
|
119629
119654
|
httpMethod: "POST",
|
|
@@ -6,7 +6,7 @@ import { BitrixError, callBitrix, isBitrixConfigured } from 'src/shared/bitrix/b
|
|
|
6
6
|
import { parseBitrixRequest } from 'src/shared/bitrix/bitrix.util';
|
|
7
7
|
import { proveAndLinkBitrixPortal } from 'src/server/bitrix-portal';
|
|
8
8
|
import { renderBitrixPage } from 'src/server/bitrix-page';
|
|
9
|
-
import { htmlResponse } from 'src/server/http-response';
|
|
9
|
+
import { htmlResponse, withRouteErrors } from 'src/server/http-response';
|
|
10
10
|
import { BITRIX_INSTALL_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
11
11
|
|
|
12
12
|
// "Путь для первоначальной установки" of the local Bitrix24 application.
|
|
@@ -69,7 +69,7 @@ export default defineLogicFunction({
|
|
|
69
69
|
name: 'docflow-bitrix-install',
|
|
70
70
|
description: 'Установка приложения на портале Битрикс24',
|
|
71
71
|
timeoutSeconds: 30,
|
|
72
|
-
handler,
|
|
72
|
+
handler: withRouteErrors('bitrix-install', handler),
|
|
73
73
|
httpRouteTriggerSettings: {
|
|
74
74
|
path: '/bitrix/install',
|
|
75
75
|
httpMethod: 'POST',
|
|
@@ -119363,12 +119363,33 @@ var AL = class {
|
|
|
119363
119363
|
}
|
|
119364
119364
|
};
|
|
119365
119365
|
|
|
119366
|
+
// src/shared/log.util.ts
|
|
119367
|
+
var PREFIX = "[docflow]";
|
|
119368
|
+
var describeError = (error) => {
|
|
119369
|
+
if (error instanceof Error) {
|
|
119370
|
+
const { status, body } = error;
|
|
119371
|
+
return { name: error.name, message: error.message, status, body };
|
|
119372
|
+
}
|
|
119373
|
+
return error;
|
|
119374
|
+
};
|
|
119375
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119376
|
+
|
|
119366
119377
|
// src/server/http-response.ts
|
|
119367
119378
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119368
119379
|
status,
|
|
119369
119380
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119370
119381
|
});
|
|
119371
119382
|
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119383
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119384
|
+
try {
|
|
119385
|
+
return await handler2(...args);
|
|
119386
|
+
} catch (error) {
|
|
119387
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119388
|
+
return jsonResponse(500, {
|
|
119389
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
119390
|
+
});
|
|
119391
|
+
}
|
|
119392
|
+
};
|
|
119372
119393
|
|
|
119373
119394
|
// src/shared/api/core-graphql.util.ts
|
|
119374
119395
|
var CoreGraphqlError = class extends Error {
|
|
@@ -119633,7 +119654,7 @@ var complete_task_logic_function_default = defineLogicFunction({
|
|
|
119633
119654
|
name: "docflow-complete-task",
|
|
119634
119655
|
description: "\u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u0437\u0430\u0434\u0430\u043D\u0438\u0435: \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442 \u043F\u043E\u043B\u044F \u0438 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u0435\u0442 \u043F\u0440\u043E\u0446\u0435\u0441\u0441",
|
|
119635
119656
|
timeoutSeconds: 30,
|
|
119636
|
-
handler,
|
|
119657
|
+
handler: withRouteErrors("complete-task", handler),
|
|
119637
119658
|
httpRouteTriggerSettings: {
|
|
119638
119659
|
path: "/docflow/tasks/complete",
|
|
119639
119660
|
httpMethod: "POST",
|
|
@@ -2,7 +2,7 @@ import { defineLogicFunction } from 'twenty-sdk/define';
|
|
|
2
2
|
import { type RoutePayload } from 'twenty-sdk/logic-function';
|
|
3
3
|
|
|
4
4
|
import { parseFormValues } from 'src/shared/form/form-fields.util';
|
|
5
|
-
import { jsonResponse, readJsonBody } from 'src/server/http-response';
|
|
5
|
+
import { jsonResponse, readJsonBody, withRouteErrors } from 'src/server/http-response';
|
|
6
6
|
import { completeTask } from 'src/server/task-completion';
|
|
7
7
|
import { COMPLETE_TASK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
8
8
|
|
|
@@ -37,7 +37,7 @@ export default defineLogicFunction({
|
|
|
37
37
|
name: 'docflow-complete-task',
|
|
38
38
|
description: 'Выполняет задание: проверяет поля и продолжает процесс',
|
|
39
39
|
timeoutSeconds: 30,
|
|
40
|
-
handler,
|
|
40
|
+
handler: withRouteErrors('complete-task', handler),
|
|
41
41
|
httpRouteTriggerSettings: {
|
|
42
42
|
path: '/docflow/tasks/complete',
|
|
43
43
|
httpMethod: 'POST',
|
|
@@ -59973,11 +59973,32 @@ var AL = class {
|
|
|
59973
59973
|
}
|
|
59974
59974
|
};
|
|
59975
59975
|
|
|
59976
|
+
// src/shared/log.util.ts
|
|
59977
|
+
var PREFIX = "[docflow]";
|
|
59978
|
+
var describeError = (error) => {
|
|
59979
|
+
if (error instanceof Error) {
|
|
59980
|
+
const { status, body } = error;
|
|
59981
|
+
return { name: error.name, message: error.message, status, body };
|
|
59982
|
+
}
|
|
59983
|
+
return error;
|
|
59984
|
+
};
|
|
59985
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
59986
|
+
|
|
59976
59987
|
// src/server/http-response.ts
|
|
59977
59988
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
59978
59989
|
status,
|
|
59979
59990
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
59980
59991
|
});
|
|
59992
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
59993
|
+
try {
|
|
59994
|
+
return await handler2(...args);
|
|
59995
|
+
} catch (error) {
|
|
59996
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
59997
|
+
return jsonResponse(500, {
|
|
59998
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
59999
|
+
});
|
|
60000
|
+
}
|
|
60001
|
+
};
|
|
59981
60002
|
|
|
59982
60003
|
// src/universal-identifiers.ts
|
|
59983
60004
|
var DOCFLOW_APP_SESSION_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "e819586a-b6a5-4df9-8bef-c524b6d0a886";
|
|
@@ -60005,7 +60026,7 @@ var docflow_app_session_logic_function_default = defineLogicFunction({
|
|
|
60005
60026
|
name: "docflow-app-session",
|
|
60006
60027
|
description: "\u0421\u0435\u0441\u0441\u0438\u044F \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430 \u043E\u0442 \u0438\u043C\u0435\u043D\u0438 \u0432\u043E\u0448\u0435\u0434\u0448\u0435\u0433\u043E \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430",
|
|
60007
60028
|
timeoutSeconds: 10,
|
|
60008
|
-
handler,
|
|
60029
|
+
handler: withRouteErrors("docflow-app-session", handler),
|
|
60009
60030
|
httpRouteTriggerSettings: {
|
|
60010
60031
|
path: "/docflow/app/session",
|
|
60011
60032
|
httpMethod: "POST",
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from 'twenty-sdk/logic-function';
|
|
6
6
|
|
|
7
7
|
import { readAccessTokenClaims } from 'src/shared/app/docflow-app.util';
|
|
8
|
-
import { jsonResponse } from 'src/server/http-response';
|
|
8
|
+
import { jsonResponse, withRouteErrors } from 'src/server/http-response';
|
|
9
9
|
import { DOCFLOW_APP_SESSION_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
10
10
|
|
|
11
11
|
// The session of the standalone page: the token the CRM gave this call on
|
|
@@ -44,7 +44,7 @@ export default defineLogicFunction({
|
|
|
44
44
|
name: 'docflow-app-session',
|
|
45
45
|
description: 'Сессия отдельной страницы документооборота от имени вошедшего сотрудника',
|
|
46
46
|
timeoutSeconds: 10,
|
|
47
|
-
handler,
|
|
47
|
+
handler: withRouteErrors('docflow-app-session', handler),
|
|
48
48
|
httpRouteTriggerSettings: {
|
|
49
49
|
path: '/docflow/app/session',
|
|
50
50
|
httpMethod: 'POST',
|
|
@@ -59961,7 +59961,7 @@ var AL = class {
|
|
|
59961
59961
|
// package.json
|
|
59962
59962
|
var package_default = {
|
|
59963
59963
|
name: "@haiiro/docuflow",
|
|
59964
|
-
version: "0.0.
|
|
59964
|
+
version: "0.0.16",
|
|
59965
59965
|
description: "NorDiv \u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442: \u0437\u0430\u0434\u0430\u043D\u0438\u044F \u0441 \u043F\u043E\u043B\u044F\u043C\u0438, \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u044B \u0441 \u0437\u0430\u043F\u0443\u0441\u043A\u043E\u043C \u043F\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C, \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B \u0441\u043E \u0432\u0441\u0435\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439, \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0411\u0438\u0442\u0440\u0438\u043A\u044124",
|
|
59966
59966
|
license: "AGPL-3.0-only",
|
|
59967
59967
|
publishConfig: {
|
|
@@ -60068,6 +60068,33 @@ ${config.mode === "bitrix" ? `<script src="${BX24_SDK_URL}"></script>` : ""}
|
|
|
60068
60068
|
}
|
|
60069
60069
|
);
|
|
60070
60070
|
|
|
60071
|
+
// src/shared/log.util.ts
|
|
60072
|
+
var PREFIX = "[docflow]";
|
|
60073
|
+
var describeError = (error) => {
|
|
60074
|
+
if (error instanceof Error) {
|
|
60075
|
+
const { status, body } = error;
|
|
60076
|
+
return { name: error.name, message: error.message, status, body };
|
|
60077
|
+
}
|
|
60078
|
+
return error;
|
|
60079
|
+
};
|
|
60080
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
60081
|
+
|
|
60082
|
+
// src/server/http-response.ts
|
|
60083
|
+
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
60084
|
+
status,
|
|
60085
|
+
headers: { "content-type": "application/json; charset=utf-8" }
|
|
60086
|
+
});
|
|
60087
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
60088
|
+
try {
|
|
60089
|
+
return await handler2(...args);
|
|
60090
|
+
} catch (error) {
|
|
60091
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
60092
|
+
return jsonResponse(500, {
|
|
60093
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
60094
|
+
});
|
|
60095
|
+
}
|
|
60096
|
+
};
|
|
60097
|
+
|
|
60071
60098
|
// src/universal-identifiers.ts
|
|
60072
60099
|
var DOCFLOW_APP_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "b0da29b0-3229-4250-8919-b4f1b4370c44";
|
|
60073
60100
|
|
|
@@ -60085,7 +60112,7 @@ var docflow_app_logic_function_default = defineLogicFunction({
|
|
|
60085
60112
|
name: "docflow-app",
|
|
60086
60113
|
description: "\u041E\u0442\u0434\u0435\u043B\u044C\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430 \u0431\u0435\u0437 \u043E\u0441\u0442\u0430\u043B\u044C\u043D\u043E\u0439 CRM",
|
|
60087
60114
|
timeoutSeconds: 10,
|
|
60088
|
-
handler,
|
|
60115
|
+
handler: withRouteErrors("docflow-app", handler),
|
|
60089
60116
|
httpRouteTriggerSettings: {
|
|
60090
60117
|
path: "/docflow/app",
|
|
60091
60118
|
httpMethod: "GET",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { readDocflowAppSection } from 'src/shared/app/docflow-app.util';
|
|
8
8
|
import { getCrmUrl } from 'src/server/crm-url';
|
|
9
9
|
import { renderDocflowAppPage } from 'src/server/docflow-app-page';
|
|
10
|
+
import { withRouteErrors } from 'src/server/http-response';
|
|
10
11
|
import { DOCFLOW_APP_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
11
12
|
|
|
12
13
|
// The standalone docflow page: tasks, processes and documents without the
|
|
@@ -28,7 +29,7 @@ export default defineLogicFunction({
|
|
|
28
29
|
name: 'docflow-app',
|
|
29
30
|
description: 'Отдельная страница документооборота без остальной CRM',
|
|
30
31
|
timeoutSeconds: 10,
|
|
31
|
-
handler,
|
|
32
|
+
handler: withRouteErrors('docflow-app', handler),
|
|
32
33
|
httpRouteTriggerSettings: {
|
|
33
34
|
path: '/docflow/app',
|
|
34
35
|
httpMethod: 'GET',
|
|
@@ -119480,12 +119480,34 @@ var AL = class {
|
|
|
119480
119480
|
}
|
|
119481
119481
|
};
|
|
119482
119482
|
|
|
119483
|
+
// src/shared/log.util.ts
|
|
119484
|
+
var PREFIX = "[docflow]";
|
|
119485
|
+
var describeError = (error) => {
|
|
119486
|
+
if (error instanceof Error) {
|
|
119487
|
+
const { status, body } = error;
|
|
119488
|
+
return { name: error.name, message: error.message, status, body };
|
|
119489
|
+
}
|
|
119490
|
+
return error;
|
|
119491
|
+
};
|
|
119492
|
+
var logDocflow = (event, details) => console.info(PREFIX, event, details ?? "");
|
|
119493
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119494
|
+
|
|
119483
119495
|
// src/server/http-response.ts
|
|
119484
119496
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119485
119497
|
status,
|
|
119486
119498
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119487
119499
|
});
|
|
119488
119500
|
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119501
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119502
|
+
try {
|
|
119503
|
+
return await handler2(...args);
|
|
119504
|
+
} catch (error) {
|
|
119505
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119506
|
+
return jsonResponse(500, {
|
|
119507
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
119508
|
+
});
|
|
119509
|
+
}
|
|
119510
|
+
};
|
|
119489
119511
|
|
|
119490
119512
|
// src/server/records.ts
|
|
119491
119513
|
var clients = {
|
|
@@ -119516,18 +119538,6 @@ var runWorkflowVersion = async ({
|
|
|
119516
119538
|
return data.runWorkflowVersion.workflowRunId;
|
|
119517
119539
|
};
|
|
119518
119540
|
|
|
119519
|
-
// src/shared/log.util.ts
|
|
119520
|
-
var PREFIX = "[docflow]";
|
|
119521
|
-
var describeError = (error) => {
|
|
119522
|
-
if (error instanceof Error) {
|
|
119523
|
-
const { status, body } = error;
|
|
119524
|
-
return { name: error.name, message: error.message, status, body };
|
|
119525
|
-
}
|
|
119526
|
-
return error;
|
|
119527
|
-
};
|
|
119528
|
-
var logDocflow = (event, details) => console.info(PREFIX, event, details ?? "");
|
|
119529
|
-
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119530
|
-
|
|
119531
119541
|
// src/universal-identifiers.ts
|
|
119532
119542
|
var LAUNCH_PROCESS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "de04e9c8-7ebe-4ac2-b4b3-4ca256eb94db";
|
|
119533
119543
|
|
|
@@ -119617,7 +119627,7 @@ var launch_process_logic_function_default = defineLogicFunction({
|
|
|
119617
119627
|
name: "docflow-launch-process",
|
|
119618
119628
|
description: "\u0417\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442 \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430 \u0441 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438",
|
|
119619
119629
|
timeoutSeconds: 30,
|
|
119620
|
-
handler,
|
|
119630
|
+
handler: withRouteErrors("launch-process", handler),
|
|
119621
119631
|
httpRouteTriggerSettings: {
|
|
119622
119632
|
path: "/docflow/processes/launch",
|
|
119623
119633
|
httpMethod: "POST",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
parseLaunchFields,
|
|
17
17
|
parseLaunchObject,
|
|
18
18
|
} from 'src/shared/workflow/launch-step.util';
|
|
19
|
-
import { readJsonBody, jsonResponse } from 'src/server/http-response';
|
|
19
|
+
import { readJsonBody, jsonResponse, withRouteErrors } from 'src/server/http-response';
|
|
20
20
|
import { getWorkflow, getWorkflowVersion, restClient } from 'src/server/records';
|
|
21
21
|
import { runWorkflowVersion } from 'src/server/workflow-engine';
|
|
22
22
|
import { logDocflow, logDocflowError } from 'src/shared/log.util';
|
|
@@ -153,7 +153,7 @@ export default defineLogicFunction({
|
|
|
153
153
|
name: 'docflow-launch-process',
|
|
154
154
|
description: 'Запускает процесс документооборота с параметрами',
|
|
155
155
|
timeoutSeconds: 30,
|
|
156
|
-
handler,
|
|
156
|
+
handler: withRouteErrors('launch-process', handler),
|
|
157
157
|
httpRouteTriggerSettings: {
|
|
158
158
|
path: '/docflow/processes/launch',
|
|
159
159
|
httpMethod: 'POST',
|
|
@@ -119372,12 +119372,34 @@ var AL = class {
|
|
|
119372
119372
|
}
|
|
119373
119373
|
};
|
|
119374
119374
|
|
|
119375
|
+
// src/shared/log.util.ts
|
|
119376
|
+
var PREFIX = "[docflow]";
|
|
119377
|
+
var describeError = (error) => {
|
|
119378
|
+
if (error instanceof Error) {
|
|
119379
|
+
const { status, body } = error;
|
|
119380
|
+
return { name: error.name, message: error.message, status, body };
|
|
119381
|
+
}
|
|
119382
|
+
return error;
|
|
119383
|
+
};
|
|
119384
|
+
var logDocflow = (event, details) => console.info(PREFIX, event, details ?? "");
|
|
119385
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119386
|
+
|
|
119375
119387
|
// src/server/http-response.ts
|
|
119376
119388
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119377
119389
|
status,
|
|
119378
119390
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119379
119391
|
});
|
|
119380
119392
|
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119393
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119394
|
+
try {
|
|
119395
|
+
return await handler2(...args);
|
|
119396
|
+
} catch (error) {
|
|
119397
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119398
|
+
return jsonResponse(500, {
|
|
119399
|
+
message: `\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430: ${error instanceof Error ? error.message : String(error)}`
|
|
119400
|
+
});
|
|
119401
|
+
}
|
|
119402
|
+
};
|
|
119381
119403
|
|
|
119382
119404
|
// src/shared/api/rest-filter.util.ts
|
|
119383
119405
|
var UNSAFE_FILTER_CHARACTERS = /[()[\]'",]/g;
|
|
@@ -119425,17 +119447,16 @@ var listWorkflowVersions = async (runAs, workflowId) => readRestList(
|
|
|
119425
119447
|
})
|
|
119426
119448
|
).records;
|
|
119427
119449
|
|
|
119428
|
-
// src/shared/
|
|
119429
|
-
var
|
|
119430
|
-
var
|
|
119431
|
-
|
|
119432
|
-
|
|
119433
|
-
return
|
|
119450
|
+
// src/shared/workflow/publish-error.util.ts
|
|
119451
|
+
var INVALID_STEP_PATTERN = /Step "([^"]+)" configuration is invalid/g;
|
|
119452
|
+
var describeUnfinishedSteps = (message) => {
|
|
119453
|
+
const stepNames = [...new Set([...message.matchAll(INVALID_STEP_PATTERN)].map(([, name]) => name))];
|
|
119454
|
+
if (stepNames.length === 0) {
|
|
119455
|
+
return void 0;
|
|
119434
119456
|
}
|
|
119435
|
-
|
|
119457
|
+
const steps = stepNames.map((name) => `\xAB${name}\xBB`).join(", ");
|
|
119458
|
+
return stepNames.length === 1 ? `\u0428\u0430\u0433 ${steps} \u043D\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D \u0434\u043E \u043A\u043E\u043D\u0446\u0430. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0432 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435 \u0438 \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u0435\u0433\u043E.` : `\u0428\u0430\u0433\u0438 ${steps} \u043D\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D\u044B \u0434\u043E \u043A\u043E\u043D\u0446\u0430. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0432 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435 \u0438 \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u0438\u0445.`;
|
|
119436
119459
|
};
|
|
119437
|
-
var logDocflow = (event, details) => console.info(PREFIX, event, details ?? "");
|
|
119438
|
-
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119439
119460
|
|
|
119440
119461
|
// src/universal-identifiers.ts
|
|
119441
119462
|
var PUBLISH_PROCESS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "c164c184-3b24-4d26-832b-219f3f02102a";
|
|
@@ -119471,7 +119492,7 @@ var handler = async (event, context) => {
|
|
|
119471
119492
|
} catch (error) {
|
|
119472
119493
|
logDocflowError("publish: engine refused", error, { workflowId, isPublish });
|
|
119473
119494
|
return jsonResponse(422, {
|
|
119474
|
-
message: error instanceof CoreGraphqlError && error.userMessage !== void 0 ? error.userMessage : isPublish ? "\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D: \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0435\u0433\u043E \u0448\u0430\u0433\u0438 \u0432 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435" : "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043D\u044F\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0441 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438"
|
|
119495
|
+
message: (isPublish && error instanceof CoreGraphqlError ? describeUnfinishedSteps(`${error.message} ${error.userMessage ?? ""}`) : void 0) ?? (error instanceof CoreGraphqlError && error.userMessage !== void 0 ? error.userMessage : isPublish ? "\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D: \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0435\u0433\u043E \u0448\u0430\u0433\u0438 \u0432 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435" : "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043D\u044F\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0441 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438")
|
|
119475
119496
|
});
|
|
119476
119497
|
}
|
|
119477
119498
|
logDocflow("publish: done", { workflowId, workflowVersionId: version.id, isPublish });
|
|
@@ -119482,7 +119503,7 @@ var publish_process_logic_function_default = defineLogicFunction({
|
|
|
119482
119503
|
name: "docflow-publish-process",
|
|
119483
119504
|
description: "\u041F\u0443\u0431\u043B\u0438\u043A\u0443\u0435\u0442 \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043E\u0431\u043E\u0440\u043E\u0442\u0430 \u0438\u043B\u0438 \u0441\u043D\u0438\u043C\u0430\u0435\u0442 \u0435\u0433\u043E \u0441 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438",
|
|
119484
119505
|
timeoutSeconds: 30,
|
|
119485
|
-
handler,
|
|
119506
|
+
handler: withRouteErrors("publish-process", handler),
|
|
119486
119507
|
httpRouteTriggerSettings: {
|
|
119487
119508
|
path: "/docflow/processes/publish",
|
|
119488
119509
|
httpMethod: "POST",
|
|
@@ -11,9 +11,10 @@ import {
|
|
|
11
11
|
DEACTIVATE_WORKFLOW_VERSION_MUTATION,
|
|
12
12
|
} from 'src/shared/api/core-graphql.util';
|
|
13
13
|
import { DOCFLOW_SECTION } from 'src/shared/docflow.constants';
|
|
14
|
-
import { jsonResponse, readJsonBody } from 'src/server/http-response';
|
|
14
|
+
import { jsonResponse, readJsonBody, withRouteErrors } from 'src/server/http-response';
|
|
15
15
|
import { getWorkflow, listWorkflowVersions } from 'src/server/records';
|
|
16
16
|
import { logDocflow, logDocflowError } from 'src/shared/log.util';
|
|
17
|
+
import { describeUnfinishedSteps } from 'src/shared/workflow/publish-error.util';
|
|
17
18
|
import { PUBLISH_PROCESS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
18
19
|
|
|
19
20
|
// "Опубликовать" and "Снять с публикации" from the processes page, as the
|
|
@@ -64,11 +65,14 @@ const handler = async (event: RoutePayload, context: LogicFunctionExecutionConte
|
|
|
64
65
|
|
|
65
66
|
return jsonResponse(422, {
|
|
66
67
|
message:
|
|
67
|
-
|
|
68
|
+
(isPublish && error instanceof CoreGraphqlError
|
|
69
|
+
? describeUnfinishedSteps(`${error.message} ${error.userMessage ?? ''}`)
|
|
70
|
+
: undefined) ??
|
|
71
|
+
(error instanceof CoreGraphqlError && error.userMessage !== undefined
|
|
68
72
|
? error.userMessage
|
|
69
73
|
: isPublish
|
|
70
74
|
? 'Процесс не опубликован: проверьте его шаги в редакторе'
|
|
71
|
-
: 'Не удалось снять процесс с публикации',
|
|
75
|
+
: 'Не удалось снять процесс с публикации'),
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -82,7 +86,7 @@ export default defineLogicFunction({
|
|
|
82
86
|
name: 'docflow-publish-process',
|
|
83
87
|
description: 'Публикует процесс документооборота или снимает его с публикации',
|
|
84
88
|
timeoutSeconds: 30,
|
|
85
|
-
handler,
|
|
89
|
+
handler: withRouteErrors('publish-process', handler),
|
|
86
90
|
httpRouteTriggerSettings: {
|
|
87
91
|
path: '/docflow/processes/publish',
|
|
88
92
|
httpMethod: 'POST',
|