@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
|
@@ -119756,13 +119756,6 @@ var AL = class {
|
|
|
119756
119756
|
}
|
|
119757
119757
|
};
|
|
119758
119758
|
|
|
119759
|
-
// src/server/http-response.ts
|
|
119760
|
-
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119761
|
-
status,
|
|
119762
|
-
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119763
|
-
});
|
|
119764
|
-
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119765
|
-
|
|
119766
119759
|
// src/shared/log.util.ts
|
|
119767
119760
|
var PREFIX = "[docflow]";
|
|
119768
119761
|
var describeError = (error) => {
|
|
@@ -119775,6 +119768,23 @@ var describeError = (error) => {
|
|
|
119775
119768
|
var logDocflow = (event, details) => console.info(PREFIX, event, details ?? "");
|
|
119776
119769
|
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119777
119770
|
|
|
119771
|
+
// src/server/http-response.ts
|
|
119772
|
+
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119773
|
+
status,
|
|
119774
|
+
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119775
|
+
});
|
|
119776
|
+
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119777
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119778
|
+
try {
|
|
119779
|
+
return await handler2(...args);
|
|
119780
|
+
} catch (error) {
|
|
119781
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119782
|
+
return jsonResponse(500, {
|
|
119783
|
+
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)}`
|
|
119784
|
+
});
|
|
119785
|
+
}
|
|
119786
|
+
};
|
|
119787
|
+
|
|
119778
119788
|
// src/universal-identifiers.ts
|
|
119779
119789
|
var SAVE_LAUNCH_FIELDS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER = "d2cce9f2-6ba4-415c-aa3d-5d9aba6ae89c";
|
|
119780
119790
|
|
|
@@ -119825,7 +119835,7 @@ var save_launch_fields_logic_function_default = defineLogicFunction({
|
|
|
119825
119835
|
name: "docflow-save-launch-fields",
|
|
119826
119836
|
description: "\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0438 \u043E\u0431\u044A\u0435\u043A\u0442 \u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0438 \u0434\u0435\u043B\u0430\u0435\u0442 \u043F\u0435\u0440\u0432\u044B\u043C \u0431\u043B\u043E\u043A\u043E\u043C \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 \xAB\u0417\u0430\u043F\u0443\u0441\u043A \u0441 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438\xBB",
|
|
119827
119837
|
timeoutSeconds: 30,
|
|
119828
|
-
handler,
|
|
119838
|
+
handler: withRouteErrors("save-launch-fields", handler),
|
|
119829
119839
|
httpRouteTriggerSettings: {
|
|
119830
119840
|
path: "/docflow/processes/launch-fields",
|
|
119831
119841
|
httpMethod: "POST",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
parseLaunchObject,
|
|
12
12
|
} from 'src/shared/workflow/launch-step.util';
|
|
13
13
|
import { syncLaunchTrigger } from 'src/server/launch-step';
|
|
14
|
-
import { jsonResponse, readJsonBody } from 'src/server/http-response';
|
|
14
|
+
import { jsonResponse, readJsonBody, withRouteErrors } from 'src/server/http-response';
|
|
15
15
|
import { restClient } from 'src/server/records';
|
|
16
16
|
import { logDocflow, logDocflowError } from 'src/shared/log.util';
|
|
17
17
|
import { SAVE_LAUNCH_FIELDS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
@@ -87,7 +87,7 @@ export default defineLogicFunction({
|
|
|
87
87
|
name: 'docflow-save-launch-fields',
|
|
88
88
|
description: 'Сохраняет параметры и объект запуска и делает первым блоком процесса «Запуск с параметрами»',
|
|
89
89
|
timeoutSeconds: 30,
|
|
90
|
-
handler,
|
|
90
|
+
handler: withRouteErrors('save-launch-fields', handler),
|
|
91
91
|
httpRouteTriggerSettings: {
|
|
92
92
|
path: '/docflow/processes/launch-fields',
|
|
93
93
|
httpMethod: 'POST',
|
|
@@ -119312,12 +119312,33 @@ var AL = class {
|
|
|
119312
119312
|
}
|
|
119313
119313
|
};
|
|
119314
119314
|
|
|
119315
|
+
// src/shared/log.util.ts
|
|
119316
|
+
var PREFIX = "[docflow]";
|
|
119317
|
+
var describeError = (error) => {
|
|
119318
|
+
if (error instanceof Error) {
|
|
119319
|
+
const { status, body } = error;
|
|
119320
|
+
return { name: error.name, message: error.message, status, body };
|
|
119321
|
+
}
|
|
119322
|
+
return error;
|
|
119323
|
+
};
|
|
119324
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119325
|
+
|
|
119315
119326
|
// src/server/http-response.ts
|
|
119316
119327
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119317
119328
|
status,
|
|
119318
119329
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119319
119330
|
});
|
|
119320
119331
|
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119332
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119333
|
+
try {
|
|
119334
|
+
return await handler2(...args);
|
|
119335
|
+
} catch (error) {
|
|
119336
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119337
|
+
return jsonResponse(500, {
|
|
119338
|
+
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)}`
|
|
119339
|
+
});
|
|
119340
|
+
}
|
|
119341
|
+
};
|
|
119321
119342
|
|
|
119322
119343
|
// src/shared/api/rest-response.util.ts
|
|
119323
119344
|
var readDataValue = (response) => {
|
|
@@ -119427,7 +119448,8 @@ var applyStepSettings = ({
|
|
|
119427
119448
|
createId
|
|
119428
119449
|
}) => {
|
|
119429
119450
|
const ordinaryFields = fields.filter((field) => getFormFieldRole(field) === void 0).map((field) => {
|
|
119430
|
-
const
|
|
119451
|
+
const rest = { ...field.settings };
|
|
119452
|
+
delete rest[FORM_FIELD_REQUIRED_SETTING];
|
|
119431
119453
|
const isRequired = settings.requiredFieldIds.includes(field.id);
|
|
119432
119454
|
return {
|
|
119433
119455
|
...field,
|
|
@@ -119517,7 +119539,7 @@ var save_step_settings_logic_function_default = defineLogicFunction({
|
|
|
119517
119539
|
name: "docflow-save-step-settings",
|
|
119518
119540
|
description: "\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044F, \u0441\u0440\u043E\u043A \u0438 \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F \u0448\u0430\u0433\u0430 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430",
|
|
119519
119541
|
timeoutSeconds: 15,
|
|
119520
|
-
handler,
|
|
119542
|
+
handler: withRouteErrors("save-step-settings", handler),
|
|
119521
119543
|
httpRouteTriggerSettings: {
|
|
119522
119544
|
path: "/docflow/processes/step-settings",
|
|
119523
119545
|
httpMethod: "POST",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineLogicFunction } from 'twenty-sdk/define';
|
|
2
2
|
import { type RoutePayload } from 'twenty-sdk/logic-function';
|
|
3
3
|
|
|
4
|
-
import { jsonResponse, readJsonBody } from 'src/server/http-response';
|
|
4
|
+
import { jsonResponse, readJsonBody, withRouteErrors } from 'src/server/http-response';
|
|
5
5
|
import { restClient, type WorkflowVersionRecord } from 'src/server/records';
|
|
6
6
|
import { callCoreGraphql, UPDATE_WORKFLOW_VERSION_STEP_MUTATION } from 'src/shared/api/core-graphql.util';
|
|
7
7
|
import { readRestRecord } from 'src/shared/api/rest-response.util';
|
|
@@ -81,7 +81,7 @@ export default defineLogicFunction({
|
|
|
81
81
|
name: 'docflow-save-step-settings',
|
|
82
82
|
description: 'Сохраняет исполнителя, срок и обязательные поля шага процесса',
|
|
83
83
|
timeoutSeconds: 15,
|
|
84
|
-
handler,
|
|
84
|
+
handler: withRouteErrors('save-step-settings', handler),
|
|
85
85
|
httpRouteTriggerSettings: {
|
|
86
86
|
path: '/docflow/processes/step-settings',
|
|
87
87
|
httpMethod: 'POST',
|
|
@@ -119339,12 +119339,33 @@ var AL = class {
|
|
|
119339
119339
|
}
|
|
119340
119340
|
};
|
|
119341
119341
|
|
|
119342
|
+
// src/shared/log.util.ts
|
|
119343
|
+
var PREFIX = "[docflow]";
|
|
119344
|
+
var describeError = (error) => {
|
|
119345
|
+
if (error instanceof Error) {
|
|
119346
|
+
const { status, body } = error;
|
|
119347
|
+
return { name: error.name, message: error.message, status, body };
|
|
119348
|
+
}
|
|
119349
|
+
return error;
|
|
119350
|
+
};
|
|
119351
|
+
var logDocflowError = (event, error, details) => console.error(PREFIX, event, describeError(error), details ?? "");
|
|
119352
|
+
|
|
119342
119353
|
// src/server/http-response.ts
|
|
119343
119354
|
var jsonResponse = (status, body) => new AL(JSON.stringify(body), {
|
|
119344
119355
|
status,
|
|
119345
119356
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
119346
119357
|
});
|
|
119347
119358
|
var readJsonBody = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
119359
|
+
var withRouteErrors = (name, handler2) => async (...args) => {
|
|
119360
|
+
try {
|
|
119361
|
+
return await handler2(...args);
|
|
119362
|
+
} catch (error) {
|
|
119363
|
+
logDocflowError(`${name}: unexpected error`, error);
|
|
119364
|
+
return jsonResponse(500, {
|
|
119365
|
+
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)}`
|
|
119366
|
+
});
|
|
119367
|
+
}
|
|
119368
|
+
};
|
|
119348
119369
|
|
|
119349
119370
|
// src/shared/api/rest-response.util.ts
|
|
119350
119371
|
var readDataValue = (response) => {
|
|
@@ -119414,7 +119435,7 @@ var save_task_form_logic_function_default = defineLogicFunction({
|
|
|
119414
119435
|
name: "docflow-save-task-form",
|
|
119415
119436
|
description: "\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442 \u043F\u043E\u043B\u044F \u0437\u0430\u0434\u0430\u043D\u0438\u044F \u0438 \u0438\u0445 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F",
|
|
119416
119437
|
timeoutSeconds: 15,
|
|
119417
|
-
handler,
|
|
119438
|
+
handler: withRouteErrors("save-task-form", handler),
|
|
119418
119439
|
httpRouteTriggerSettings: {
|
|
119419
119440
|
path: "/docflow/tasks/form",
|
|
119420
119441
|
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 { getFormFieldsError, parseFormFields, 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 { getTask, updateTask } from 'src/server/records';
|
|
7
7
|
import { isProcessTask } from 'src/server/task-completion';
|
|
8
8
|
import { SAVE_TASK_FORM_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/universal-identifiers';
|
|
@@ -53,7 +53,7 @@ export default defineLogicFunction({
|
|
|
53
53
|
name: 'docflow-save-task-form',
|
|
54
54
|
description: 'Сохраняет поля задания и их значения',
|
|
55
55
|
timeoutSeconds: 15,
|
|
56
|
-
handler,
|
|
56
|
+
handler: withRouteErrors('save-task-form', handler),
|
|
57
57
|
httpRouteTriggerSettings: {
|
|
58
58
|
path: '/docflow/tasks/form',
|
|
59
59
|
httpMethod: 'POST',
|