n8n-nodes-base 0.228.2 → 0.229.0
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/nodes/Code/Code.node.js +6 -1
- package/dist/nodes/Code/Code.node.js.map +1 -1
- package/dist/nodes/Code/test/Code.workflow.json +61 -30
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js +2 -1
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/GoogleSheetsV2.node.d.ts +2 -1
- package/dist/nodes/Google/Sheet/v2/GoogleSheetsV2.node.js +1 -0
- package/dist/nodes/Google/Sheet/v2/GoogleSheetsV2.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/append.operation.js +47 -2
- package/dist/nodes/Google/Sheet/v2/actions/sheet/append.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/appendOrUpdate.operation.js +89 -23
- package/dist/nodes/Google/Sheet/v2/actions/sheet/appendOrUpdate.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js +89 -23
- package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheets.utils.js +15 -5
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheets.utils.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/index.d.ts +1 -0
- package/dist/nodes/Google/Sheet/v2/methods/index.js +2 -1
- package/dist/nodes/Google/Sheet/v2/methods/index.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.d.ts +3 -0
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js +33 -0
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/Postgres/Postgres.node.js +2 -1
- package/dist/nodes/Postgres/Postgres.node.js.map +1 -1
- package/dist/nodes/Postgres/v2/PostgresV2.node.d.ts +2 -1
- package/dist/nodes/Postgres/v2/PostgresV2.node.js +1 -1
- package/dist/nodes/Postgres/v2/PostgresV2.node.js.map +1 -1
- package/dist/nodes/Postgres/v2/actions/database/insert.operation.js +50 -4
- package/dist/nodes/Postgres/v2/actions/database/insert.operation.js.map +1 -1
- package/dist/nodes/Postgres/v2/actions/database/update.operation.js +110 -14
- package/dist/nodes/Postgres/v2/actions/database/update.operation.js.map +1 -1
- package/dist/nodes/Postgres/v2/actions/database/upsert.operation.js +72 -14
- package/dist/nodes/Postgres/v2/actions/database/upsert.operation.js.map +1 -1
- package/dist/nodes/Postgres/v2/actions/versionDescription.js +1 -1
- package/dist/nodes/Postgres/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Postgres/v2/helpers/interfaces.d.ts +6 -0
- package/dist/nodes/Postgres/v2/helpers/utils.d.ts +6 -2
- package/dist/nodes/Postgres/v2/helpers/utils.js +36 -2
- package/dist/nodes/Postgres/v2/helpers/utils.js.map +1 -1
- package/dist/nodes/Postgres/v2/methods/index.d.ts +1 -0
- package/dist/nodes/Postgres/v2/methods/index.js +2 -1
- package/dist/nodes/Postgres/v2/methods/index.js.map +1 -1
- package/dist/nodes/Postgres/v2/methods/resourceMapping.d.ts +2 -0
- package/dist/nodes/Postgres/v2/methods/resourceMapping.js +83 -0
- package/dist/nodes/Postgres/v2/methods/resourceMapping.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/types/nodes.json +9 -7
- package/package.json +3 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMappingColumns = void 0;
|
|
4
|
+
const utils_1 = require("../helpers/utils");
|
|
5
|
+
const transport_1 = require("../transport");
|
|
6
|
+
const fieldTypeMapping = {
|
|
7
|
+
string: ['text', 'varchar', 'character varying', 'character', 'char'],
|
|
8
|
+
number: [
|
|
9
|
+
'integer',
|
|
10
|
+
'smallint',
|
|
11
|
+
'bigint',
|
|
12
|
+
'decimal',
|
|
13
|
+
'numeric',
|
|
14
|
+
'real',
|
|
15
|
+
'double precision',
|
|
16
|
+
'smallserial',
|
|
17
|
+
'serial',
|
|
18
|
+
'bigserial',
|
|
19
|
+
],
|
|
20
|
+
boolean: ['boolean'],
|
|
21
|
+
dateTime: [
|
|
22
|
+
'timestamp',
|
|
23
|
+
'date',
|
|
24
|
+
'timestampz',
|
|
25
|
+
'timestamp without time zone',
|
|
26
|
+
'timestamp with time zone',
|
|
27
|
+
],
|
|
28
|
+
time: ['time', 'time without time zone', 'time with time zone'],
|
|
29
|
+
object: ['json', 'jsonb'],
|
|
30
|
+
options: ['enum', 'USER-DEFINED'],
|
|
31
|
+
array: ['ARRAY'],
|
|
32
|
+
};
|
|
33
|
+
function mapPostgresType(postgresType) {
|
|
34
|
+
let mappedType = 'string';
|
|
35
|
+
for (const t of Object.keys(fieldTypeMapping)) {
|
|
36
|
+
const postgresTypes = fieldTypeMapping[t];
|
|
37
|
+
if (postgresTypes === null || postgresTypes === void 0 ? void 0 : postgresTypes.includes(postgresType)) {
|
|
38
|
+
mappedType = t;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return mappedType;
|
|
42
|
+
}
|
|
43
|
+
async function getMappingColumns() {
|
|
44
|
+
const credentials = await this.getCredentials('postgres');
|
|
45
|
+
const { db } = await (0, transport_1.configurePostgres)(credentials);
|
|
46
|
+
const schema = this.getNodeParameter('schema', 0, {
|
|
47
|
+
extractValue: true,
|
|
48
|
+
});
|
|
49
|
+
const table = this.getNodeParameter('table', 0, {
|
|
50
|
+
extractValue: true,
|
|
51
|
+
});
|
|
52
|
+
const operation = this.getNodeParameter('operation', 0, {
|
|
53
|
+
extractValue: true,
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
const columns = await (0, utils_1.getTableSchema)(db, schema, table);
|
|
57
|
+
const unique = operation === 'upsert' ? await (0, utils_1.uniqueColumns)(db, table) : [];
|
|
58
|
+
const enumInfo = await (0, utils_1.getEnums)(db);
|
|
59
|
+
const fields = await Promise.all(columns.map(async (col) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const canBeUsedToMatch = operation === 'upsert' ? unique.some((u) => u.attname === col.column_name) : true;
|
|
62
|
+
const type = mapPostgresType(col.data_type);
|
|
63
|
+
const options = type === 'options' ? (0, utils_1.getEnumValues)(enumInfo, col.udt_name) : undefined;
|
|
64
|
+
const isAutoIncrement = (_a = col.column_default) === null || _a === void 0 ? void 0 : _a.startsWith('nextval');
|
|
65
|
+
return {
|
|
66
|
+
id: col.column_name,
|
|
67
|
+
displayName: col.column_name,
|
|
68
|
+
required: col.is_nullable !== 'YES' && !isAutoIncrement,
|
|
69
|
+
defaultMatch: col.column_name === 'id',
|
|
70
|
+
display: true,
|
|
71
|
+
type,
|
|
72
|
+
canBeUsedToMatch,
|
|
73
|
+
options,
|
|
74
|
+
};
|
|
75
|
+
}));
|
|
76
|
+
return { fields };
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.getMappingColumns = getMappingColumns;
|
|
83
|
+
//# sourceMappingURL=resourceMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceMapping.js","sourceRoot":"","sources":["../../../../../nodes/Postgres/v2/methods/resourceMapping.ts"],"names":[],"mappings":";;;AACA,4CAA0F;AAC1F,4CAAiD;AAEjD,MAAM,gBAAgB,GAAyC;IAC9D,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,CAAC;IACrE,MAAM,EAAE;QACP,SAAS;QACT,UAAU;QACV,QAAQ;QACR,SAAS;QACT,SAAS;QACT,MAAM;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