@nocobase/plugin-workflow-request 2.1.0-alpha.46 → 2.1.0-alpha.47
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/dist/externalVersion.js
CHANGED
|
@@ -14,12 +14,12 @@ module.exports = {
|
|
|
14
14
|
"@formily/react": "2.3.7",
|
|
15
15
|
"@formily/antd-v5": "1.2.3",
|
|
16
16
|
"@ant-design/icons": "5.6.1",
|
|
17
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
18
|
-
"@nocobase/plugin-workflow": "2.1.0-alpha.
|
|
17
|
+
"@nocobase/client": "2.1.0-alpha.47",
|
|
18
|
+
"@nocobase/plugin-workflow": "2.1.0-alpha.47",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
20
|
+
"@nocobase/server": "2.1.0-alpha.47",
|
|
21
21
|
"axios": "1.7.7",
|
|
22
22
|
"lodash": "4.18.1",
|
|
23
|
-
"@nocobase/plugin-file-manager": "2.1.0-alpha.
|
|
24
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
23
|
+
"@nocobase/plugin-file-manager": "2.1.0-alpha.47",
|
|
24
|
+
"@nocobase/utils": "2.1.0-alpha.47"
|
|
25
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-
|
|
1
|
+
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-08T04:03:02.706Z"}
|
|
@@ -44,6 +44,9 @@ var import_lodash = require("lodash");
|
|
|
44
44
|
var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
45
45
|
var import_plugin_file_manager = __toESM(require("@nocobase/plugin-file-manager"));
|
|
46
46
|
var import_utils = require("@nocobase/utils");
|
|
47
|
+
function toRequestError(error) {
|
|
48
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
49
|
+
}
|
|
47
50
|
function getContentTypeTransformer(mimeType, app) {
|
|
48
51
|
switch (mimeType) {
|
|
49
52
|
case "text/plain":
|
|
@@ -237,41 +240,55 @@ class RequestInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
237
240
|
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
238
241
|
});
|
|
239
242
|
await processor.exit();
|
|
243
|
+
const abortHandle = processor.createBackgroundAbortHandle();
|
|
240
244
|
const jobDone = { status: import_plugin_workflow.JOB_STATUS.PENDING };
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
const settleRequest = async () => {
|
|
246
|
+
try {
|
|
247
|
+
processor.logger.info(`request (#${node.id}) sent to "${config.url}", waiting for response...`);
|
|
248
|
+
const response = await request(config, this.workflow.app, abortHandle.signal);
|
|
249
|
+
processor.logger.info(`request (#${node.id}) response success, status: ${response.status}`);
|
|
250
|
+
jobDone.status = import_plugin_workflow.JOB_STATUS.RESOLVED;
|
|
251
|
+
jobDone.result = responseSuccess(response, config.onlyData);
|
|
252
|
+
} catch (caught) {
|
|
253
|
+
const error = toRequestError(caught);
|
|
254
|
+
if (error.isAxiosError) {
|
|
255
|
+
if (error.response) {
|
|
256
|
+
processor.logger.info(`request (#${node.id}) failed with response, status: ${error.response.status}`);
|
|
257
|
+
} else if (error.request) {
|
|
258
|
+
processor.logger.error(`request (#${node.id}) failed without response: ${error.message}`);
|
|
259
|
+
} else {
|
|
260
|
+
processor.logger.error(`request (#${node.id}) initiation failed: ${error.message}`);
|
|
261
|
+
}
|
|
253
262
|
} else {
|
|
254
|
-
processor.logger.error(`request (#${node.id})
|
|
263
|
+
processor.logger.error(`request (#${node.id}) failed unexpectedly: ${error.message}`);
|
|
264
|
+
}
|
|
265
|
+
logFailureDebug(processor.logger, error);
|
|
266
|
+
jobDone.status = abortHandle.signal.aborted ? import_plugin_workflow.JOB_STATUS.ABORTED : failureStatus(config, error);
|
|
267
|
+
jobDone.result = responseFailure(error);
|
|
268
|
+
} finally {
|
|
269
|
+
abortHandle.dispose();
|
|
270
|
+
const job = await this.workflow.app.db.getRepository("jobs").findOne({
|
|
271
|
+
filterByTk: id
|
|
272
|
+
});
|
|
273
|
+
const execution = await job.getExecution();
|
|
274
|
+
const aborted = await this.workflow.abortExecutionIfExpired(execution);
|
|
275
|
+
if (!aborted) {
|
|
276
|
+
await execution.reload();
|
|
277
|
+
await job.reload();
|
|
278
|
+
}
|
|
279
|
+
if (!aborted && execution.status === import_plugin_workflow.EXECUTION_STATUS.STARTED && job.status === import_plugin_workflow.JOB_STATUS.PENDING) {
|
|
280
|
+
job.set(jobDone);
|
|
281
|
+
job.execution = execution;
|
|
282
|
+
this.workflow.resume(job);
|
|
283
|
+
} else {
|
|
284
|
+
processor.logger.warn(`request (#${node.id}) result discarded because execution (${execution.id}) is ended`);
|
|
255
285
|
}
|
|
256
|
-
} else {
|
|
257
|
-
processor.logger.error(`request (#${node.id}) failed unexpectedly: ${error.message}`);
|
|
258
|
-
}
|
|
259
|
-
logFailureDebug(processor.logger, error);
|
|
260
|
-
jobDone.status = failureStatus(config, error);
|
|
261
|
-
jobDone.result = responseFailure(error);
|
|
262
|
-
} finally {
|
|
263
|
-
const job = await this.workflow.app.db.getRepository("jobs").findOne({
|
|
264
|
-
filterByTk: id
|
|
265
|
-
});
|
|
266
|
-
const execution = await job.getExecution();
|
|
267
|
-
if (!execution.status) {
|
|
268
|
-
job.set(jobDone);
|
|
269
|
-
job.execution = execution;
|
|
270
|
-
this.workflow.resume(job);
|
|
271
|
-
} else {
|
|
272
|
-
processor.logger.warn(`request (#${node.id}) result discarded because execution (${execution.id}) is ended`);
|
|
273
286
|
}
|
|
274
|
-
}
|
|
287
|
+
};
|
|
288
|
+
settleRequest().catch((caught) => {
|
|
289
|
+
const error = toRequestError(caught);
|
|
290
|
+
processor.logger.error(`request (#${node.id}) async settling failed: ${error.message}`, { error });
|
|
291
|
+
});
|
|
275
292
|
}
|
|
276
293
|
async resume(node, job, processor) {
|
|
277
294
|
const { ignoreFail } = node.config;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Send HTTP requests to any HTTP service for data interaction in workflow.",
|
|
7
7
|
"description.ru-RU": "Отправляет HTTP-запросы к любому HTTP-сервису для взаимодействия с данными в рабочем процессе.",
|
|
8
8
|
"description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。",
|
|
9
|
-
"version": "2.1.0-alpha.
|
|
9
|
+
"version": "2.1.0-alpha.47",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow-request",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@nocobase/server": "2.x",
|
|
28
28
|
"@nocobase/test": "2.x"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "66196b57f9043ea0ac6ebdafbc732bfb98af1396",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Workflow"
|
|
33
33
|
]
|