@atom8n/n8n-core 2.4.5 → 2.5.1
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/build.tsbuildinfo +1 -1
- package/dist/conflicting-storage-paths.error.d.ts +4 -0
- package/dist/conflicting-storage-paths.error.js +13 -0
- package/dist/errors/abstract/binary-data.error.js +0 -0
- package/dist/execution-engine/node-execution-context/utils/file-system-helper-functions.js +2 -1
- package/dist/execution-engine/node-execution-context/utils/resolve-source-overwrite.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/resolve-source-overwrite.js +16 -0
- package/dist/storage.config.d.ts +11 -0
- package/dist/storage.config.js +49 -0
- package/dist/utils/convert-binary-data.d.ts +2 -0
- package/dist/utils/convert-binary-data.js +50 -0
- package/package.json +10 -10
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConflictingStoragePathsError = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class ConflictingStoragePathsError extends n8n_workflow_1.UserError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super([
|
|
8
|
+
'Both N8N_STORAGE_PATH and N8N_BINARY_DATA_STORAGE_PATH are set to different values.',
|
|
9
|
+
'N8N_BINARY_DATA_STORAGE_PATH is deprecated. Please use only N8N_STORAGE_PATH.',
|
|
10
|
+
].join(' '));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ConflictingStoragePathsError = ConflictingStoragePathsError;
|
|
File without changes
|
|
@@ -35,13 +35,14 @@ async function resolvePath(path) {
|
|
|
35
35
|
}
|
|
36
36
|
function isFilePatternBlocked(resolvedFilePath) {
|
|
37
37
|
const { blockFilePatterns } = di_1.Container.get(config_1.SecurityConfig);
|
|
38
|
+
const normalizedPath = node_path_1.posix.normalize(resolvedFilePath.replace(/\\/g, '/'));
|
|
38
39
|
return blockFilePatterns
|
|
39
40
|
.split(';')
|
|
40
41
|
.map((pattern) => pattern.trim())
|
|
41
42
|
.filter((pattern) => pattern)
|
|
42
43
|
.some((pattern) => {
|
|
43
44
|
try {
|
|
44
|
-
return new RegExp(pattern, 'mi').test(
|
|
45
|
+
return new RegExp(pattern, 'mi').test(normalizedPath);
|
|
45
46
|
}
|
|
46
47
|
catch {
|
|
47
48
|
return true;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSourceOverwrite = resolveSourceOverwrite;
|
|
4
|
+
function resolveSourceOverwrite(item, executionData) {
|
|
5
|
+
const isToolExecution = !!executionData.metadata?.preserveSourceOverwrite;
|
|
6
|
+
if (!isToolExecution) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (executionData.metadata?.preservedSourceOverwrite) {
|
|
10
|
+
return executionData.metadata.preservedSourceOverwrite;
|
|
11
|
+
}
|
|
12
|
+
if (typeof item.pairedItem === 'object' && 'sourceOverwrite' in item.pairedItem) {
|
|
13
|
+
return item.pairedItem.sourceOverwrite;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { InstanceSettings } from './instance-settings';
|
|
3
|
+
export declare const EXECUTION_DATA_STORAGE_MODES: readonly ["database", "filesystem"];
|
|
4
|
+
declare const modeSchema: z.ZodEnum<["database", "filesystem"]>;
|
|
5
|
+
export declare class StorageConfig {
|
|
6
|
+
mode: z.infer<typeof modeSchema>;
|
|
7
|
+
storagePath: string;
|
|
8
|
+
constructor({ n8nFolder }: InstanceSettings);
|
|
9
|
+
sanitize(): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.StorageConfig = exports.EXECUTION_DATA_STORAGE_MODES = void 0;
|
|
16
|
+
const config_1 = require("@n8n/config");
|
|
17
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
+
const zod_1 = require("zod");
|
|
19
|
+
const conflicting_storage_paths_error_1 = require("./conflicting-storage-paths.error");
|
|
20
|
+
const instance_settings_1 = require("./instance-settings");
|
|
21
|
+
exports.EXECUTION_DATA_STORAGE_MODES = ['database', 'filesystem'];
|
|
22
|
+
const modeSchema = zod_1.z.enum(exports.EXECUTION_DATA_STORAGE_MODES);
|
|
23
|
+
let StorageConfig = class StorageConfig {
|
|
24
|
+
constructor({ n8nFolder }) {
|
|
25
|
+
this.mode = 'database';
|
|
26
|
+
this.storagePath = node_path_1.default.join(n8nFolder, 'storage');
|
|
27
|
+
}
|
|
28
|
+
sanitize() {
|
|
29
|
+
const storagePath = process.env.N8N_STORAGE_PATH;
|
|
30
|
+
const binaryDataStoragePath = process.env.N8N_BINARY_DATA_STORAGE_PATH;
|
|
31
|
+
if (storagePath === undefined || binaryDataStoragePath === undefined)
|
|
32
|
+
return;
|
|
33
|
+
if (storagePath !== binaryDataStoragePath)
|
|
34
|
+
throw new conflicting_storage_paths_error_1.ConflictingStoragePathsError();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.StorageConfig = StorageConfig;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, config_1.Env)('N8N_EXECUTION_DATA_STORAGE_MODE', modeSchema),
|
|
40
|
+
__metadata("design:type", void 0)
|
|
41
|
+
], StorageConfig.prototype, "mode", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, config_1.Env)('N8N_STORAGE_PATH'),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], StorageConfig.prototype, "storagePath", void 0);
|
|
46
|
+
exports.StorageConfig = StorageConfig = __decorate([
|
|
47
|
+
config_1.Config,
|
|
48
|
+
__metadata("design:paramtypes", [instance_settings_1.InstanceSettings])
|
|
49
|
+
], StorageConfig);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { IRunNodeResponse, WorkflowSettingsBinaryMode } from 'n8n-workflow';
|
|
2
|
+
export declare function convertBinaryData(workflowId: string, executionId: string | undefined, responseData: IRunNodeResponse, binaryMode: WorkflowSettingsBinaryMode | undefined): Promise<IRunNodeResponse>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertBinaryData = convertBinaryData;
|
|
4
|
+
const di_1 = require("@n8n/di");
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const binary_data_config_1 = require("../binary-data/binary-data.config");
|
|
7
|
+
const binary_helper_functions_1 = require("../execution-engine/node-execution-context/utils/binary-helper-functions");
|
|
8
|
+
async function convertBinaryData(workflowId, executionId, responseData, binaryMode) {
|
|
9
|
+
const { mode } = di_1.Container.get(binary_data_config_1.BinaryDataConfig);
|
|
10
|
+
if (binaryMode !== n8n_workflow_1.BINARY_MODE_COMBINED || mode === 'default')
|
|
11
|
+
return responseData;
|
|
12
|
+
if (!responseData.data?.length)
|
|
13
|
+
return responseData;
|
|
14
|
+
for (const outputData of responseData.data) {
|
|
15
|
+
for (const item of outputData) {
|
|
16
|
+
if (!item.binary)
|
|
17
|
+
continue;
|
|
18
|
+
item.json = { ...item.json };
|
|
19
|
+
item.binary = { ...item.binary };
|
|
20
|
+
const embeddedBinaries = {};
|
|
21
|
+
const jsonBinaries = {};
|
|
22
|
+
for (const [key, value] of Object.entries(item.binary)) {
|
|
23
|
+
if (value?.id) {
|
|
24
|
+
jsonBinaries[key] = value;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!executionId) {
|
|
28
|
+
embeddedBinaries[key] = value;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const buffer = Buffer.from(value.data, n8n_workflow_1.BINARY_ENCODING);
|
|
32
|
+
const binaryData = await (0, binary_helper_functions_1.prepareBinaryData)(buffer, executionId, workflowId, undefined, value?.mimeType);
|
|
33
|
+
if (value.fileName) {
|
|
34
|
+
binaryData.fileName = value.fileName;
|
|
35
|
+
}
|
|
36
|
+
jsonBinaries[key] = binaryData;
|
|
37
|
+
}
|
|
38
|
+
const existingValue = item.json[n8n_workflow_1.BINARY_IN_JSON_PROPERTY] ?? {};
|
|
39
|
+
if (Array.isArray(existingValue) || typeof existingValue !== 'object') {
|
|
40
|
+
throw new n8n_workflow_1.UnexpectedError(`Binary data could not be converted. Item already has '${n8n_workflow_1.BINARY_IN_JSON_PROPERTY}' field, but value type is not an object`);
|
|
41
|
+
}
|
|
42
|
+
if (Object.keys(jsonBinaries).length) {
|
|
43
|
+
const existingJsonBinaries = existingValue;
|
|
44
|
+
item.json[n8n_workflow_1.BINARY_IN_JSON_PROPERTY] = { ...existingJsonBinaries, ...jsonBinaries };
|
|
45
|
+
}
|
|
46
|
+
item.binary = Object.keys(embeddedBinaries).length ? embeddedBinaries : undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return responseData;
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atom8n/n8n-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Core functionality of n8n",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"bin"
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@n8n/errors": "npm:@atom8n/errors@0.
|
|
32
|
-
"@n8n/typescript-config": "npm:@atom8n/typescript-config@1.
|
|
31
|
+
"@n8n/errors": "npm:@atom8n/errors@0.8.1",
|
|
32
|
+
"@n8n/typescript-config": "npm:@atom8n/typescript-config@1.6.1",
|
|
33
33
|
"@types/express": "^5.0.1",
|
|
34
34
|
"@types/jsonwebtoken": "9.0.10",
|
|
35
35
|
"@types/lodash": "4.17.17",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@aws-sdk/client-s3": "3.808.0",
|
|
43
43
|
"@langchain/core": "1.1.0",
|
|
44
|
-
"@n8n/backend-common": "npm:@atom8n/backend-common@1.
|
|
45
|
-
"@n8n/client-oauth2": "npm:@atom8n/client-oauth2@1.
|
|
46
|
-
"@n8n/config": "npm:@atom8n/config@2.
|
|
47
|
-
"@n8n/constants": "npm:@atom8n/constants@0.
|
|
48
|
-
"@n8n/decorators": "npm:@atom8n/decorators@1.
|
|
49
|
-
"@n8n/di": "npm:@atom8n/di@0.
|
|
44
|
+
"@n8n/backend-common": "npm:@atom8n/backend-common@1.5.1",
|
|
45
|
+
"@n8n/client-oauth2": "npm:@atom8n/client-oauth2@1.3.1",
|
|
46
|
+
"@n8n/config": "npm:@atom8n/config@2.4.1",
|
|
47
|
+
"@n8n/constants": "npm:@atom8n/constants@0.18.1",
|
|
48
|
+
"@n8n/decorators": "npm:@atom8n/decorators@1.5.1",
|
|
49
|
+
"@n8n/di": "npm:@atom8n/di@0.13.1",
|
|
50
50
|
"@sentry/node": "^9.42.1",
|
|
51
51
|
"@sentry/node-native": "^9.42.1",
|
|
52
52
|
"axios": "1.12.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"lodash": "4.17.21",
|
|
65
65
|
"luxon": "3.4.4",
|
|
66
66
|
"mime-types": "3.0.1",
|
|
67
|
-
"n8n-workflow": "npm:@atom8n/n8n-workflow@2.
|
|
67
|
+
"n8n-workflow": "npm:@atom8n/n8n-workflow@2.5.1",
|
|
68
68
|
"nanoid": "3.3.8",
|
|
69
69
|
"oauth-1.0a": "2.2.6",
|
|
70
70
|
"p-cancelable": "2.1.1",
|