n8n-nodes-base 1.86.1 → 1.87.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/credentials/HttpBearerAuth.credentials.js +63 -0
- package/dist/credentials/HttpBearerAuth.credentials.js.map +1 -0
- package/dist/credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.js +109 -0
- package/dist/credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.js.map +1 -0
- package/dist/known/credentials.json +11 -0
- package/dist/known/nodes.json +4 -0
- package/dist/nodes/EmailReadImap/v2/utils.js +4 -1
- package/dist/nodes/EmailReadImap/v2/utils.js.map +1 -1
- package/dist/nodes/Form/Form.node.js +2 -2
- package/dist/nodes/Form/Form.node.js.map +1 -1
- package/dist/nodes/Form/v2/FormTriggerV2.node.js +2 -2
- package/dist/nodes/Form/v2/FormTriggerV2.node.js.map +1 -1
- package/dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.js +87 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.json +18 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.svg +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/common.js +163 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/common.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/Container.resource.js +141 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/Container.resource.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/create.operation.js +166 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/create.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/delete.operation.js +40 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/delete.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/get.operation.js +47 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/getAll.operation.js +47 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/container/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/index.js +42 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/index.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/Item.resource.js +210 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/Item.resource.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/create.operation.js +72 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/create.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/delete.operation.js +64 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/delete.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/get.operation.js +77 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/getAll.operation.js +48 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/query.operation.js +102 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/query.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/update.operation.js +83 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/descriptions/item/update.operation.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/constants.js +52 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/constants.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/errorHandler.js +108 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/errorHandler.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/interfaces.js +17 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/utils.js +200 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/helpers/utils.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/methods/index.js +39 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/methods/index.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/methods/listSearch.js +75 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/methods/listSearch.js.map +1 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/transport/index.js +43 -0
- package/dist/nodes/Microsoft/AzureCosmosDb/transport/index.js.map +1 -0
- package/dist/nodes/Wait/Wait.node.js +2 -2
- package/dist/nodes/Wait/Wait.node.js.map +1 -1
- package/dist/nodes/Webhook/error.d.ts +8 -0
- package/dist/nodes/Webhook/utils.d.ts +32 -0
- package/dist/nodes/Webhook/utils.js +13 -0
- package/dist/nodes/Webhook/utils.js.map +1 -1
- package/dist/test/nodes/FakeCredentialsMap.js +6 -0
- package/dist/test/nodes/FakeCredentialsMap.js.map +1 -1
- package/dist/types/credentials.json +2 -0
- package/dist/types/nodes.json +6 -5
- package/package.json +9 -6
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var HttpBearerAuth_credentials_exports = {};
|
|
20
|
+
__export(HttpBearerAuth_credentials_exports, {
|
|
21
|
+
HttpBearerAuth: () => HttpBearerAuth
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(HttpBearerAuth_credentials_exports);
|
|
24
|
+
class HttpBearerAuth {
|
|
25
|
+
constructor() {
|
|
26
|
+
// eslint-disable-next-line n8n-nodes-base/cred-class-field-name-unsuffixed
|
|
27
|
+
this.name = "httpBearerAuth";
|
|
28
|
+
this.displayName = "Bearer Auth";
|
|
29
|
+
this.documentationUrl = "httpRequest";
|
|
30
|
+
this.genericAuth = true;
|
|
31
|
+
this.icon = "node:n8n-nodes-base.httpRequest";
|
|
32
|
+
this.properties = [
|
|
33
|
+
{
|
|
34
|
+
displayName: "Bearer Token",
|
|
35
|
+
name: "token",
|
|
36
|
+
type: "string",
|
|
37
|
+
typeOptions: {
|
|
38
|
+
password: true
|
|
39
|
+
},
|
|
40
|
+
default: ""
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'This credential uses the "Authorization" header. To use a custom header, use a "Custom Auth" credential instead',
|
|
44
|
+
name: "useCustomAuth",
|
|
45
|
+
type: "notice",
|
|
46
|
+
default: ""
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
this.authenticate = {
|
|
50
|
+
type: "generic",
|
|
51
|
+
properties: {
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: "Bearer ={{$credentials.token}}"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
HttpBearerAuth
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=HttpBearerAuth.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../credentials/HttpBearerAuth.credentials.ts"],"sourcesContent":["import type { IAuthenticateGeneric, ICredentialType, INodeProperties, Icon } from 'n8n-workflow';\n\n// eslint-disable-next-line n8n-nodes-base/cred-class-name-unsuffixed\nexport class HttpBearerAuth implements ICredentialType {\n\t// eslint-disable-next-line n8n-nodes-base/cred-class-field-name-unsuffixed\n\tname = 'httpBearerAuth';\n\n\tdisplayName = 'Bearer Auth';\n\n\tdocumentationUrl = 'httpRequest';\n\n\tgenericAuth = true;\n\n\ticon: Icon = 'node:n8n-nodes-base.httpRequest';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Bearer Token',\n\t\t\tname: 'token',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'This credential uses the \"Authorization\" header. To use a custom header, use a \"Custom Auth\" credential instead',\n\t\t\tname: 'useCustomAuth',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\theaders: {\n\t\t\t\tAuthorization: 'Bearer ={{$credentials.token}}',\n\t\t\t},\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,eAA0C;AAAA,EAAhD;AAEN;AAAA,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,uBAAc;AAEd,gBAAa;AAEb,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,QACA,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aACC;AAAA,QACD,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MicrosoftAzureCosmosDbSharedKeyApi_credentials_exports = {};
|
|
20
|
+
__export(MicrosoftAzureCosmosDbSharedKeyApi_credentials_exports, {
|
|
21
|
+
MicrosoftAzureCosmosDbSharedKeyApi: () => MicrosoftAzureCosmosDbSharedKeyApi
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(MicrosoftAzureCosmosDbSharedKeyApi_credentials_exports);
|
|
24
|
+
var import_crypto = require("crypto");
|
|
25
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_constants = require("../nodes/Microsoft/AzureCosmosDb/helpers/constants");
|
|
27
|
+
class MicrosoftAzureCosmosDbSharedKeyApi {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.name = "microsoftAzureCosmosDbSharedKeyApi";
|
|
30
|
+
this.displayName = "Microsoft Azure Cosmos DB API";
|
|
31
|
+
this.documentationUrl = "microsoftAzureCosmosdb";
|
|
32
|
+
this.properties = [
|
|
33
|
+
{
|
|
34
|
+
displayName: "Account",
|
|
35
|
+
name: "account",
|
|
36
|
+
default: "",
|
|
37
|
+
description: "Account name",
|
|
38
|
+
required: true,
|
|
39
|
+
type: "string"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: "Key",
|
|
43
|
+
name: "key",
|
|
44
|
+
default: "",
|
|
45
|
+
description: "Account key",
|
|
46
|
+
required: true,
|
|
47
|
+
type: "string",
|
|
48
|
+
typeOptions: {
|
|
49
|
+
password: true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: "Database",
|
|
54
|
+
name: "database",
|
|
55
|
+
default: "",
|
|
56
|
+
description: "Database name",
|
|
57
|
+
required: true,
|
|
58
|
+
type: "string"
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
this.test = {
|
|
62
|
+
request: {
|
|
63
|
+
baseURL: "=https://{{ $credentials.account }}.documents.azure.com/dbs/{{ $credentials.database }}",
|
|
64
|
+
url: "/colls"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async authenticate(credentials, requestOptions) {
|
|
69
|
+
const date = (/* @__PURE__ */ new Date()).toUTCString();
|
|
70
|
+
requestOptions.headers ??= {};
|
|
71
|
+
requestOptions.headers = {
|
|
72
|
+
...requestOptions.headers,
|
|
73
|
+
"x-ms-date": date,
|
|
74
|
+
"x-ms-version": import_constants.CURRENT_VERSION,
|
|
75
|
+
"Cache-Control": "no-cache"
|
|
76
|
+
};
|
|
77
|
+
const url = new URL(
|
|
78
|
+
requestOptions.uri ?? requestOptions.baseURL + requestOptions.url
|
|
79
|
+
);
|
|
80
|
+
const pathSegments = url.pathname.split("/").filter(Boolean);
|
|
81
|
+
const foundResource = import_constants.RESOURCE_TYPES.map((type2) => ({
|
|
82
|
+
type: type2,
|
|
83
|
+
index: pathSegments.lastIndexOf(type2)
|
|
84
|
+
})).filter(({ index: index2 }) => index2 !== -1).sort((a, b) => b.index - a.index).shift();
|
|
85
|
+
if (!foundResource) {
|
|
86
|
+
throw new import_n8n_workflow.OperationalError("Unable to determine the resource type from the URL");
|
|
87
|
+
}
|
|
88
|
+
const { type, index } = foundResource;
|
|
89
|
+
const resourceId = pathSegments[index + 1] !== void 0 ? `${pathSegments.slice(0, index).join("/")}/${type}/${pathSegments[index + 1]}` : pathSegments.slice(0, index).join("/");
|
|
90
|
+
const key = Buffer.from(credentials.key, "base64");
|
|
91
|
+
const payload = `${(requestOptions.method ?? "GET").toLowerCase()}
|
|
92
|
+
${type.toLowerCase()}
|
|
93
|
+
${resourceId}
|
|
94
|
+
${date.toLowerCase()}
|
|
95
|
+
|
|
96
|
+
`;
|
|
97
|
+
const hmacSha256 = (0, import_crypto.createHmac)("sha256", key);
|
|
98
|
+
const signature = hmacSha256.update(payload, "utf8").digest("base64");
|
|
99
|
+
requestOptions.headers[import_constants.HeaderConstants.AUTHORIZATION] = encodeURIComponent(
|
|
100
|
+
`type=master&ver=1.0&sig=${signature}`
|
|
101
|
+
);
|
|
102
|
+
return requestOptions;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
MicrosoftAzureCosmosDbSharedKeyApi
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=MicrosoftAzureCosmosDbSharedKeyApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.ts"],"sourcesContent":["import { createHmac } from 'crypto';\nimport type {\n\tICredentialDataDecryptedObject,\n\tICredentialType,\n\tICredentialTestRequest,\n\tIHttpRequestOptions,\n\tINodeProperties,\n\tIRequestOptions,\n} from 'n8n-workflow';\nimport { OperationalError } from 'n8n-workflow';\n\nimport {\n\tCURRENT_VERSION,\n\tHeaderConstants,\n\tRESOURCE_TYPES,\n} from '../nodes/Microsoft/AzureCosmosDb/helpers/constants';\n\nexport class MicrosoftAzureCosmosDbSharedKeyApi implements ICredentialType {\n\tname = 'microsoftAzureCosmosDbSharedKeyApi';\n\n\tdisplayName = 'Microsoft Azure Cosmos DB API';\n\n\tdocumentationUrl = 'microsoftAzureCosmosdb';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Account',\n\t\t\tname: 'account',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Account name',\n\t\t\trequired: true,\n\t\t\ttype: 'string',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Key',\n\t\t\tname: 'key',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Account key',\n\t\t\trequired: true,\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Database',\n\t\t\tname: 'database',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Database name',\n\t\t\trequired: true,\n\t\t\ttype: 'string',\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\tcredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\tconst date = new Date().toUTCString();\n\n\t\trequestOptions.headers ??= {};\n\t\trequestOptions.headers = {\n\t\t\t...requestOptions.headers,\n\t\t\t'x-ms-date': date,\n\t\t\t'x-ms-version': CURRENT_VERSION,\n\t\t\t'Cache-Control': 'no-cache',\n\t\t};\n\n\t\t// HttpRequest node uses IRequestOptions.uri\n\t\tconst url = new URL(\n\t\t\t(requestOptions as IRequestOptions).uri ?? requestOptions.baseURL + requestOptions.url,\n\t\t);\n\n\t\tconst pathSegments = url.pathname.split('/').filter(Boolean);\n\n\t\tconst foundResource = RESOURCE_TYPES.map((type) => ({\n\t\t\ttype,\n\t\t\tindex: pathSegments.lastIndexOf(type),\n\t\t}))\n\t\t\t.filter(({ index }) => index !== -1)\n\t\t\t.sort((a, b) => b.index - a.index)\n\t\t\t.shift();\n\n\t\tif (!foundResource) {\n\t\t\tthrow new OperationalError('Unable to determine the resource type from the URL');\n\t\t}\n\n\t\tconst { type, index } = foundResource;\n\t\tconst resourceId =\n\t\t\tpathSegments[index + 1] !== undefined\n\t\t\t\t? `${pathSegments.slice(0, index).join('/')}/${type}/${pathSegments[index + 1]}`\n\t\t\t\t: pathSegments.slice(0, index).join('/');\n\n\t\tconst key = Buffer.from(credentials.key as string, 'base64');\n\t\tconst payload = `${(requestOptions.method ?? 'GET').toLowerCase()}\\n${type.toLowerCase()}\\n${resourceId}\\n${date.toLowerCase()}\\n\\n`;\n\t\tconst hmacSha256 = createHmac('sha256', key);\n\t\tconst signature = hmacSha256.update(payload, 'utf8').digest('base64');\n\n\t\trequestOptions.headers[HeaderConstants.AUTHORIZATION] = encodeURIComponent(\n\t\t\t`type=master&ver=1.0&sig=${signature}`,\n\t\t);\n\n\t\treturn requestOptions;\n\t}\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL:\n\t\t\t\t'=https://{{ $credentials.account }}.documents.azure.com/dbs/{{ $credentials.database }}',\n\t\t\turl: '/colls',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;A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,EAAE,KAAK,EAChC,MAAM;AAER,QAAI,CAAC,eAAe;AACnB,YAAM,IAAI,qCAAiB,oDAAoD;AAAA,IAChF;AAEA,UAAM,EAAE,MAAM,MAAM,IAAI;AACxB,UAAM,aACL,aAAa,QAAQ,CAAC,MAAM,SACzB,GAAG,aAAa,MAAM,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC,IAAI,IAAI,IAAI,aAAa,QAAQ,CAAC,CAAC,KAC5E,aAAa,MAAM,GAAG,KAAK,EAAE,KAAK,GAAG;AAEzC,UAAM,MAAM,OAAO,KAAK,YAAY,KAAe,QAAQ;AAC3D,UAAM,UAAU,IAAI,eAAe,UAAU,OAAO,YAAY,CAAC;AAAA,EAAK,KAAK,YAAY,CAAC;AAAA,EAAK,UAAU;AAAA,EAAK,KAAK,YAAY,CAAC;AAAA;AAAA;AAC9H,UAAM,iBAAa,0BAAW,UAAU,GAAG;AAC3C,UAAM,YAAY,WAAW,OAAO,SAAS,MAAM,EAAE,OAAO,QAAQ;AAEpE,mBAAe,QAAQ,iCAAgB,aAAa,IAAI;AAAA,MACvD,2BAA2B,SAAS;AAAA,IACrC;AAEA,WAAO;AAAA,EACR;AASD;","names":["type","index"]}
|
|
@@ -1176,6 +1176,10 @@
|
|
|
1176
1176
|
"webhook"
|
|
1177
1177
|
]
|
|
1178
1178
|
},
|
|
1179
|
+
"httpBearerAuth": {
|
|
1180
|
+
"className": "HttpBearerAuth",
|
|
1181
|
+
"sourcePath": "dist/credentials/HttpBearerAuth.credentials.js"
|
|
1182
|
+
},
|
|
1179
1183
|
"httpDigestAuth": {
|
|
1180
1184
|
"className": "HttpDigestAuth",
|
|
1181
1185
|
"sourcePath": "dist/credentials/HttpDigestAuth.credentials.js",
|
|
@@ -1613,6 +1617,13 @@
|
|
|
1613
1617
|
"messageBird"
|
|
1614
1618
|
]
|
|
1615
1619
|
},
|
|
1620
|
+
"microsoftAzureCosmosDbSharedKeyApi": {
|
|
1621
|
+
"className": "MicrosoftAzureCosmosDbSharedKeyApi",
|
|
1622
|
+
"sourcePath": "dist/credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.js",
|
|
1623
|
+
"supportedNodes": [
|
|
1624
|
+
"azureCosmosDb"
|
|
1625
|
+
]
|
|
1626
|
+
},
|
|
1616
1627
|
"microsoftAzureMonitorOAuth2Api": {
|
|
1617
1628
|
"className": "MicrosoftAzureMonitorOAuth2Api",
|
|
1618
1629
|
"sourcePath": "dist/credentials/MicrosoftAzureMonitorOAuth2Api.credentials.js",
|
package/dist/known/nodes.json
CHANGED
|
@@ -931,6 +931,10 @@
|
|
|
931
931
|
"className": "Metabase",
|
|
932
932
|
"sourcePath": "dist/nodes/Metabase/Metabase.node.js"
|
|
933
933
|
},
|
|
934
|
+
"azureCosmosDb": {
|
|
935
|
+
"className": "AzureCosmosDb",
|
|
936
|
+
"sourcePath": "dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.js"
|
|
937
|
+
},
|
|
934
938
|
"microsoftDynamicsCrm": {
|
|
935
939
|
"className": "MicrosoftDynamicsCrm",
|
|
936
940
|
"sourcePath": "dist/nodes/Microsoft/Dynamics/MicrosoftDynamicsCrm.node.js"
|
|
@@ -115,7 +115,10 @@ async function getNewEmails(imapConnection, searchCriteria, staticData, postProc
|
|
|
115
115
|
json: {
|
|
116
116
|
textHtml: await getText(parts, message, "html"),
|
|
117
117
|
textPlain: await getText(parts, message, "plain"),
|
|
118
|
-
metadata: {}
|
|
118
|
+
metadata: {},
|
|
119
|
+
attributes: {
|
|
120
|
+
uid: message.attributes.uid
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
};
|
|
121
124
|
const messageHeader = message.parts.filter((part) => part.which === "HEADER");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/EmailReadImap/v2/utils.ts"],"sourcesContent":["import { getParts, type ImapSimple, type Message, type MessagePart } from '@n8n/imap';\nimport { find } from 'lodash';\nimport { simpleParser, type Source as ParserSource } from 'mailparser';\nimport {\n\ttype IBinaryData,\n\ttype INodeExecutionData,\n\ttype IDataObject,\n\ttype ITriggerFunctions,\n\tNodeOperationError,\n\ttype IBinaryKeyData,\n} from 'n8n-workflow';\n\nasync function parseRawEmail(\n\tthis: ITriggerFunctions,\n\tmessageEncoded: ParserSource,\n\tdataPropertyNameDownload: string,\n): Promise<INodeExecutionData> {\n\tconst responseData = await simpleParser(messageEncoded);\n\tconst headers: IDataObject = {};\n\tconst additionalData: IDataObject = {};\n\n\tfor (const header of responseData.headerLines) {\n\t\theaders[header.key] = header.line;\n\t}\n\n\tadditionalData.headers = headers;\n\tadditionalData.headerLines = undefined;\n\n\tconst binaryData: IBinaryKeyData = {};\n\tif (responseData.attachments) {\n\t\tfor (let i = 0; i < responseData.attachments.length; i++) {\n\t\t\tconst attachment = responseData.attachments[i];\n\t\t\tbinaryData[`${dataPropertyNameDownload}${i}`] = await this.helpers.prepareBinaryData(\n\t\t\t\tattachment.content,\n\t\t\t\tattachment.filename,\n\t\t\t\tattachment.contentType,\n\t\t\t);\n\t\t}\n\n\t\tadditionalData.attachments = undefined;\n\t}\n\n\treturn {\n\t\tjson: { ...responseData, ...additionalData },\n\t\tbinary: Object.keys(binaryData).length ? binaryData : undefined,\n\t} as INodeExecutionData;\n}\n\nexport async function getNewEmails(\n\tthis: ITriggerFunctions,\n\timapConnection: ImapSimple,\n\tsearchCriteria: Array<string | string[]>,\n\tstaticData: IDataObject,\n\tpostProcessAction: string,\n\tgetText: (parts: MessagePart[], message: Message, subtype: string) => Promise<string>,\n\tgetAttachment: (\n\t\timapConnection: ImapSimple,\n\t\tparts: MessagePart[],\n\t\tmessage: Message,\n\t) => Promise<IBinaryData[]>,\n): Promise<INodeExecutionData[]> {\n\tconst format = this.getNodeParameter('format', 0) as string;\n\n\tlet fetchOptions = {};\n\n\tif (format === 'simple' || format === 'raw') {\n\t\tfetchOptions = {\n\t\t\tbodies: ['TEXT', 'HEADER'],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t} else if (format === 'resolved') {\n\t\tfetchOptions = {\n\t\t\tbodies: [''],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t}\n\n\tconst results = await imapConnection.search(searchCriteria, fetchOptions);\n\n\tconst newEmails: INodeExecutionData[] = [];\n\tlet newEmail: INodeExecutionData;\n\tlet attachments: IBinaryData[];\n\tlet propertyName: string;\n\n\t// All properties get by default moved to metadata except the ones\n\t// which are defined here which get set on the top level.\n\tconst topLevelProperties = ['cc', 'date', 'from', 'subject', 'to'];\n\n\tif (format === 'resolved') {\n\t\tconst dataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t) as string;\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: '' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\tconst parsedEmail = await parseRawEmail.call(\n\t\t\t\tthis,\n\t\t\t\tpart.body as Buffer,\n\t\t\t\tdataPropertyAttachmentsPrefixName,\n\t\t\t);\n\n\t\t\tnewEmails.push(parsedEmail);\n\t\t}\n\t} else if (format === 'simple') {\n\t\tconst downloadAttachments = this.getNodeParameter('downloadAttachments') as boolean;\n\n\t\tlet dataPropertyAttachmentsPrefixName = '';\n\t\tif (downloadAttachments) {\n\t\t\tdataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t\t) as string;\n\t\t}\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst parts = getParts(message.attributes.struct as IDataObject[]);\n\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\ttextHtml: await getText(parts, message, 'html'),\n\t\t\t\t\ttextPlain: await getText(parts, message, 'plain'),\n\t\t\t\t\tmetadata: {} as IDataObject,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst messageHeader = message.parts.filter((part) => part.which === 'HEADER');\n\n\t\t\tconst messageBody = messageHeader[0].body as Record<string, string[]>;\n\t\t\tfor (propertyName of Object.keys(messageBody)) {\n\t\t\t\tif (messageBody[propertyName].length) {\n\t\t\t\t\tif (topLevelProperties.includes(propertyName)) {\n\t\t\t\t\t\tnewEmail.json[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(newEmail.json.metadata as IDataObject)[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (downloadAttachments) {\n\t\t\t\t// Get attachments and add them if any get found\n\t\t\t\tattachments = await getAttachment(imapConnection, parts, message);\n\t\t\t\tif (attachments.length) {\n\t\t\t\t\tnewEmail.binary = {};\n\t\t\t\t\tfor (let i = 0; i < attachments.length; i++) {\n\t\t\t\t\t\tnewEmail.binary[`${dataPropertyAttachmentsPrefixName}${i}`] = attachments[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t} else if (format === 'raw') {\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: 'TEXT' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\t// Return base64 string\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\traw: part.body as string,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t}\n\n\t// only mark messages as seen once processing has finished\n\tif (postProcessAction === 'read') {\n\t\tconst uidList = results.map((e) => e.attributes.uid);\n\t\tif (uidList.length > 0) {\n\t\t\tawait imapConnection.addFlags(uidList, '\\\\SEEN');\n\t\t}\n\t}\n\treturn newEmails;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0E;AAC1E,oBAAqB;AACrB,wBAA0D;AAC1D,0BAOO;AAEP,eAAe,cAEd,gBACA,0BAC8B;AAC9B,QAAM,eAAe,UAAM,gCAAa,cAAc;AACtD,QAAM,UAAuB,CAAC;AAC9B,QAAM,iBAA8B,CAAC;AAErC,aAAW,UAAU,aAAa,aAAa;AAC9C,YAAQ,OAAO,GAAG,IAAI,OAAO;AAAA,EAC9B;AAEA,iBAAe,UAAU;AACzB,iBAAe,cAAc;AAE7B,QAAM,aAA6B,CAAC;AACpC,MAAI,aAAa,aAAa;AAC7B,aAAS,IAAI,GAAG,IAAI,aAAa,YAAY,QAAQ,KAAK;AACzD,YAAM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AA,QACD;AAAA,MACD;AAEA,UAAI,qBAAqB;AAExB,sBAAc,MAAM,cAAc,gBAAgB,OAAO,OAAO;AAChE,YAAI,YAAY,QAAQ;AACvB,mBAAS,SAAS,CAAC;AACnB,mBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AAC5C,qBAAS,OAAO,GAAG,iCAAiC,GAAG,CAAC,EAAE,IAAI,YAAY,CAAC;AAAA,UAC5E;AAAA,QACD;AAAA,MACD;AAEA,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAAA,EACD,WAAW,WAAW,OAAO;AAC5B,eAAW,WAAW,SAAS;AAC9B,UACC,WAAW,mBAAmB,UAC9B,QAAQ,WAAW,OAAQ,WAAW,gBACrC;AACD;AAAA,MACD;AACA,UACC,WAAW,mBAAmB,UAC7B,WAAW,iBAA4B,QAAQ,WAAW,KAC1D;AACD,mBAAW,iBAAiB,QAAQ,WAAW;AAAA,MAChD;AACA,YAAM,WAAO,oBAAK,QAAQ,OAAO,EAAE,OAAO,OAAO,CAAC;AAElD,UAAI,SAAS,QAAW;AACvB,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,iCAAiC;AAAA,MAC/E;AAEA,iBAAW;AAAA,QACV,MAAM;AAAA,UACL,KAAK,KAAK;AAAA,QACX;AAAA,MACD;AAEA,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAAA,EACD;AAGA,MAAI,sBAAsB,QAAQ;AACjC,UAAM,UAAU,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG;AACnD,QAAI,QAAQ,SAAS,GAAG;AACvB,YAAM,eAAe,SAAS,SAAS,QAAQ;AAAA,IAChD;AAAA,EACD;AACA,SAAO;AACR;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/EmailReadImap/v2/utils.ts"],"sourcesContent":["import { getParts, type ImapSimple, type Message, type MessagePart } from '@n8n/imap';\nimport { find } from 'lodash';\nimport { simpleParser, type Source as ParserSource } from 'mailparser';\nimport {\n\ttype IBinaryData,\n\ttype INodeExecutionData,\n\ttype IDataObject,\n\ttype ITriggerFunctions,\n\tNodeOperationError,\n\ttype IBinaryKeyData,\n} from 'n8n-workflow';\n\nasync function parseRawEmail(\n\tthis: ITriggerFunctions,\n\tmessageEncoded: ParserSource,\n\tdataPropertyNameDownload: string,\n): Promise<INodeExecutionData> {\n\tconst responseData = await simpleParser(messageEncoded);\n\tconst headers: IDataObject = {};\n\tconst additionalData: IDataObject = {};\n\n\tfor (const header of responseData.headerLines) {\n\t\theaders[header.key] = header.line;\n\t}\n\n\tadditionalData.headers = headers;\n\tadditionalData.headerLines = undefined;\n\n\tconst binaryData: IBinaryKeyData = {};\n\tif (responseData.attachments) {\n\t\tfor (let i = 0; i < responseData.attachments.length; i++) {\n\t\t\tconst attachment = responseData.attachments[i];\n\t\t\tbinaryData[`${dataPropertyNameDownload}${i}`] = await this.helpers.prepareBinaryData(\n\t\t\t\tattachment.content,\n\t\t\t\tattachment.filename,\n\t\t\t\tattachment.contentType,\n\t\t\t);\n\t\t}\n\n\t\tadditionalData.attachments = undefined;\n\t}\n\n\treturn {\n\t\tjson: { ...responseData, ...additionalData },\n\t\tbinary: Object.keys(binaryData).length ? binaryData : undefined,\n\t} as INodeExecutionData;\n}\n\nexport async function getNewEmails(\n\tthis: ITriggerFunctions,\n\timapConnection: ImapSimple,\n\tsearchCriteria: Array<string | string[]>,\n\tstaticData: IDataObject,\n\tpostProcessAction: string,\n\tgetText: (parts: MessagePart[], message: Message, subtype: string) => Promise<string>,\n\tgetAttachment: (\n\t\timapConnection: ImapSimple,\n\t\tparts: MessagePart[],\n\t\tmessage: Message,\n\t) => Promise<IBinaryData[]>,\n): Promise<INodeExecutionData[]> {\n\tconst format = this.getNodeParameter('format', 0) as string;\n\n\tlet fetchOptions = {};\n\n\tif (format === 'simple' || format === 'raw') {\n\t\tfetchOptions = {\n\t\t\tbodies: ['TEXT', 'HEADER'],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t} else if (format === 'resolved') {\n\t\tfetchOptions = {\n\t\t\tbodies: [''],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t}\n\n\tconst results = await imapConnection.search(searchCriteria, fetchOptions);\n\n\tconst newEmails: INodeExecutionData[] = [];\n\tlet newEmail: INodeExecutionData;\n\tlet attachments: IBinaryData[];\n\tlet propertyName: string;\n\n\t// All properties get by default moved to metadata except the ones\n\t// which are defined here which get set on the top level.\n\tconst topLevelProperties = ['cc', 'date', 'from', 'subject', 'to'];\n\n\tif (format === 'resolved') {\n\t\tconst dataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t) as string;\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: '' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\tconst parsedEmail = await parseRawEmail.call(\n\t\t\t\tthis,\n\t\t\t\tpart.body as Buffer,\n\t\t\t\tdataPropertyAttachmentsPrefixName,\n\t\t\t);\n\n\t\t\tnewEmails.push(parsedEmail);\n\t\t}\n\t} else if (format === 'simple') {\n\t\tconst downloadAttachments = this.getNodeParameter('downloadAttachments') as boolean;\n\n\t\tlet dataPropertyAttachmentsPrefixName = '';\n\t\tif (downloadAttachments) {\n\t\t\tdataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t\t) as string;\n\t\t}\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst parts = getParts(message.attributes.struct as IDataObject[]);\n\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\ttextHtml: await getText(parts, message, 'html'),\n\t\t\t\t\ttextPlain: await getText(parts, message, 'plain'),\n\t\t\t\t\tmetadata: {} as IDataObject,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tuid: message.attributes.uid,\n\t\t\t\t\t} as IDataObject,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst messageHeader = message.parts.filter((part) => part.which === 'HEADER');\n\n\t\t\tconst messageBody = messageHeader[0].body as Record<string, string[]>;\n\t\t\tfor (propertyName of Object.keys(messageBody)) {\n\t\t\t\tif (messageBody[propertyName].length) {\n\t\t\t\t\tif (topLevelProperties.includes(propertyName)) {\n\t\t\t\t\t\tnewEmail.json[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(newEmail.json.metadata as IDataObject)[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (downloadAttachments) {\n\t\t\t\t// Get attachments and add them if any get found\n\t\t\t\tattachments = await getAttachment(imapConnection, parts, message);\n\t\t\t\tif (attachments.length) {\n\t\t\t\t\tnewEmail.binary = {};\n\t\t\t\t\tfor (let i = 0; i < attachments.length; i++) {\n\t\t\t\t\t\tnewEmail.binary[`${dataPropertyAttachmentsPrefixName}${i}`] = attachments[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t} else if (format === 'raw') {\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: 'TEXT' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\t// Return base64 string\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\traw: part.body as string,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t}\n\n\t// only mark messages as seen once processing has finished\n\tif (postProcessAction === 'read') {\n\t\tconst uidList = results.map((e) => e.attributes.uid);\n\t\tif (uidList.length > 0) {\n\t\t\tawait imapConnection.addFlags(uidList, '\\\\SEEN');\n\t\t}\n\t}\n\treturn newEmails;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0E;AAC1E,oBAAqB;AACrB,wBAA0D;AAC1D,0BAOO;AAEP,eAAe,cAEd,gBACA,0BAC8B;AAC9B,QAAM,eAAe,UAAM,gCAAa,cAAc;AACtD,QAAM,UAAuB,CAAC;AAC9B,QAAM,iBAA8B,CAAC;AAErC,aAAW,UAAU,aAAa,aAAa;AAC9C,YAAQ,OAAO,GAAG,IAAI,OAAO;AAAA,EAC9B;AAEA,iBAAe,UAAU;AACzB,iBAAe,cAAc;AAE7B,QAAM,aAA6B,CAAC;AACpC,MAAI,aAAa,aAAa;AAC7B,aA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
281
|
path: "",
|
|
282
282
|
restartWebhook: true,
|
|
283
283
|
isFullPath: true,
|
|
284
|
-
|
|
284
|
+
nodeType: "form"
|
|
285
285
|
},
|
|
286
286
|
{
|
|
287
287
|
name: "default",
|
|
@@ -290,7 +290,7 @@ class Form extends import_n8n_workflow.Node {
|
|
|
290
290
|
path: "",
|
|
291
291
|
restartWebhook: true,
|
|
292
292
|
isFullPath: true,
|
|
293
|
-
|
|
293
|
+
nodeType: "form"
|
|
294
294
|
}
|
|
295
295
|
],
|
|
296
296
|
properties: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Form/Form.node.ts"],"sourcesContent":["import type {\n\tFormFieldsParameter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeTypeDescription,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tNodeTypeAndVersion,\n} from 'n8n-workflow';\nimport {\n\tNode,\n\tupdateDisplayOptions,\n\tNodeOperationError,\n\tFORM_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\ttryToParseJsonToFormFields,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { cssVariables } from './cssVariables';\nimport { renderFormCompletion } from './formCompletionUtils';\nimport { renderFormNode } from './formNodeUtils';\nimport { configureWaitTillDate } from '../../utils/sendAndWait/configureWaitTillDate.util';\nimport { limitWaitTimeProperties } from '../../utils/sendAndWait/descriptions';\nimport { formDescription, formFields, formTitle } from '../Form/common.descriptions';\nimport { prepareFormReturnItem, resolveRawData } from '../Form/utils';\n\nconst waitTimeProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Limit Wait Time',\n\t\tname: 'limitWaitTime',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to limit the time this node should wait for a user response before execution resumes',\n\t},\n\t...updateDisplayOptions(\n\t\t{\n\t\t\tshow: {\n\t\t\t\tlimitWaitTime: [true],\n\t\t\t},\n\t\t},\n\t\tlimitWaitTimeProperties,\n\t),\n];\n\nexport const formFieldsProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Define Form',\n\t\tname: 'defineForm',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Using Fields Below',\n\t\t\t\tvalue: 'fields',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Using JSON',\n\t\t\t\tvalue: 'json',\n\t\t\t},\n\t\t],\n\t\tdefault: 'fields',\n\t},\n\t{\n\t\tdisplayName: 'Form Fields',\n\t\tname: 'jsonOutput',\n\t\ttype: 'json',\n\t\ttypeOptions: {\n\t\t\trows: 5,\n\t\t},\n\t\tdefault:\n\t\t\t'[\\n {\\n \"fieldLabel\":\"Name\",\\n \"placeholder\":\"enter you name\",\\n \"requiredField\":true\\n },\\n {\\n \"fieldLabel\":\"Age\",\\n \"fieldType\":\"number\",\\n \"placeholder\":\"enter your age\"\\n },\\n {\\n \"fieldLabel\":\"Email\",\\n \"fieldType\":\"email\",\\n \"requiredField\":true\\n }\\n]',\n\t\tvalidateType: 'form-fields',\n\t\tignoreValidationDuringExecution: true,\n\t\thint: '<a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.form/\" target=\"_blank\">See docs</a> for field syntax',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tdefineForm: ['json'],\n\t\t\t},\n\t\t},\n\t},\n\t{ ...formFields, displayOptions: { show: { defineForm: ['fields'] } } },\n];\n\nconst pageProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['page'],\n\t\t},\n\t},\n\t[\n\t\t...formFieldsProperties,\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false },\n\t\t\t\tformDescription,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Button Label',\n\t\t\t\t\tname: 'buttonLabel',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: 'Submit',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n);\n\nconst completionProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['completion'],\n\t\t},\n\t},\n\t[\n\t\t{\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\tdisplayName: 'On n8n Form Submission',\n\t\t\tname: 'respondWith',\n\t\t\ttype: 'options',\n\t\t\tdefault: 'text',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Completion Screen',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t\tdescription: 'Show a response text to the user',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Redirect to URL',\n\t\t\t\t\tvalue: 'redirect',\n\t\t\t\t\tdescription: 'Redirect the user to a URL',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Text',\n\t\t\t\t\tvalue: 'showText',\n\t\t\t\t\tdescription: 'Display simple text or HTML',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Return Binary File',\n\t\t\t\t\tvalue: 'returnBinary',\n\t\t\t\t\tdescription: 'Return incoming binary file',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'URL',\n\t\t\tname: 'redirectUrl',\n\t\t\tvalidateType: 'url',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Title',\n\t\t\tname: 'completionTitle',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Message',\n\t\t\tname: 'completionMessage',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Text',\n\t\t\tname: 'responseText',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['showText'],\n\t\t\t\t},\n\t\t\t},\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. Thanks for filling the form',\n\t\t\tdescription: 'The text to display on the page. Use HTML to show a customized web page.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Input Data Field Name',\n\t\t\tname: 'inputDataFieldName',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: 'data',\n\t\t\tplaceholder: 'e.g. data',\n\t\t\tdescription:\n\t\t\t\t'Find the name of input field containing the binary data to return in the Input panel on the left, in the Binary tab',\n\t\t\thint: 'The name of the input field containing the binary file data to be returned',\n\t\t},\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false, displayName: 'Completion Page Title' },\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n);\n\nexport class Form extends Node {\n\tnodeInputData: INodeExecutionData[] = [];\n\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'n8n Form',\n\t\tname: 'form',\n\t\ticon: 'file:form.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\t\tdefaults: {\n\t\t\tname: 'Form',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tisForm: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: 'responseNode',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tisForm: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'An n8n Form Trigger node must be set up before this node',\n\t\t\t\tname: 'triggerNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Page Type',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'page',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Next Form Page',\n\t\t\t\t\t\tvalue: 'page',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Form Ending',\n\t\t\t\t\t\tvalue: 'completion',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t...pageProperties,\n\t\t\t...completionProperties,\n\t\t],\n\t};\n\n\tasync webhook(context: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = context.getResponseObject();\n\n\t\tconst operation = context.getNodeParameter('operation', '') as string;\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst trigger = parentNodes.find(\n\t\t\t(node) => node.type === 'n8n-nodes-base.formTrigger',\n\t\t) as NodeTypeAndVersion;\n\n\t\tconst mode = context.evaluateExpression(`{{ $('${trigger?.name}').first().json.formMode }}`) as\n\t\t\t| 'test'\n\t\t\t| 'production';\n\n\t\tconst defineForm = context.getNodeParameter('defineForm', false) as string;\n\n\t\tlet fields: FormFieldsParameter = [];\n\t\tif (defineForm === 'json') {\n\t\t\ttry {\n\t\t\t\tconst jsonOutput = context.getNodeParameter('jsonOutput', '', {\n\t\t\t\t\trawExpressions: true,\n\t\t\t\t}) as string;\n\n\t\t\t\tfields = tryToParseJsonToFormFields(resolveRawData(context, jsonOutput));\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), error.message, {\n\t\t\t\t\tdescription: error.message,\n\t\t\t\t\ttype: mode === 'test' ? 'manual-form-test' : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tfields = context.getNodeParameter('formFields.values', []) as FormFieldsParameter;\n\t\t}\n\n\t\tconst method = context.getRequestObject().method;\n\n\t\tif (operation === 'completion' && method === 'GET') {\n\t\t\treturn await renderFormCompletion(context, res, trigger);\n\t\t}\n\n\t\tif (operation === 'completion' && method === 'POST') {\n\t\t\treturn {\n\t\t\t\tworkflowData: [context.evaluateExpression('{{ $input.all() }}') as INodeExecutionData[]],\n\t\t\t};\n\t\t}\n\n\t\tif (method === 'GET') {\n\t\t\treturn await renderFormNode(context, res, trigger, fields, mode);\n\t\t}\n\n\t\tlet useWorkflowTimezone = context.evaluateExpression(\n\t\t\t`{{ $('${trigger?.name}').params.options?.useWorkflowTimezone }}`,\n\t\t) as boolean;\n\n\t\tif (useWorkflowTimezone === undefined && trigger?.typeVersion > 2) {\n\t\t\tuseWorkflowTimezone = true;\n\t\t}\n\n\t\tconst returnItem = await prepareFormReturnItem(context, fields, mode, useWorkflowTimezone);\n\n\t\treturn {\n\t\t\twebhookResponse: { status: 200 },\n\t\t\tworkflowData: [[returnItem]],\n\t\t};\n\t}\n\n\tasync execute(context: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst operation = context.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'completion') {\n\t\t\tthis.nodeInputData = context.getInputData();\n\t\t}\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst hasFormTrigger = parentNodes.some((node) => node.type === FORM_TRIGGER_NODE_TYPE);\n\n\t\tif (!hasFormTrigger) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Form Trigger node must be set before this node',\n\t\t\t);\n\t\t}\n\n\t\tconst childNodes = context.getChildNodes(context.getNode().name);\n\t\tconst hasNextPage = childNodes.some((node) => node.type === FORM_NODE_TYPE);\n\n\t\tif (operation === 'completion' && hasNextPage) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Completion has to be the last Form node in the workflow',\n\t\t\t);\n\t\t}\n\n\t\tconst waitTill = configureWaitTillDate(context, 'root');\n\t\tawait context.putExecutionToWait(waitTill);\n\n\t\tcontext.sendResponse({\n\t\t\theaders: {\n\t\t\t\tlocation: context.evaluateExpression('{{ $execution.resumeFormUrl }}', 0),\n\t\t\t},\n\t\t\tstatusCode: 307,\n\t\t});\n\n\t\treturn [context.getInputData()];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,0BAQO;AAEP,0BAA6B;AAC7B,iCAAqC;AACrC,2BAA+B;AAC/B,mCAAsC;AACtC,0BAAwC;AACxC,oBAAuD;AACvD,mBAAsD;AAEtD,MAAM,qBAAwC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,EACF;AAAA,EACA,OAAG;AAAA,IACF;AAAA,MACC,MAAM;AAAA,QACL,eAAe,CAAC,IAAI;AAAA,MACrB;AAAA,IACD;AAAA,IACA;AAAA,EACD;AACD;AAEO,MAAM,uBAA0C;AAAA,EACtD;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;A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QAAQ,QAAQ;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,UAAM,eAAW,oDAAsB,SAAS,MAAM;AACtD,UAAM,QAAQ,mBAAmB,QAAQ;AAEzC,YAAQ,aAAa;AAAA,MACpB,SAAS;AAAA,QACR,UAAU,QAAQ,mBAAmB,kCAAkC,CAAC;AAAA,MACzE;AAAA,MACA,YAAY;AAAA,IACb,CAAC;AAED,WAAO,CAAC,QAAQ,aAAa,CAAC;AAAA,EAC/B;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Form/Form.node.ts"],"sourcesContent":["import type {\n\tFormFieldsParameter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeTypeDescription,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tNodeTypeAndVersion,\n} from 'n8n-workflow';\nimport {\n\tNode,\n\tupdateDisplayOptions,\n\tNodeOperationError,\n\tFORM_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\ttryToParseJsonToFormFields,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { cssVariables } from './cssVariables';\nimport { renderFormCompletion } from './formCompletionUtils';\nimport { renderFormNode } from './formNodeUtils';\nimport { configureWaitTillDate } from '../../utils/sendAndWait/configureWaitTillDate.util';\nimport { limitWaitTimeProperties } from '../../utils/sendAndWait/descriptions';\nimport { formDescription, formFields, formTitle } from '../Form/common.descriptions';\nimport { prepareFormReturnItem, resolveRawData } from '../Form/utils';\n\nconst waitTimeProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Limit Wait Time',\n\t\tname: 'limitWaitTime',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to limit the time this node should wait for a user response before execution resumes',\n\t},\n\t...updateDisplayOptions(\n\t\t{\n\t\t\tshow: {\n\t\t\t\tlimitWaitTime: [true],\n\t\t\t},\n\t\t},\n\t\tlimitWaitTimeProperties,\n\t),\n];\n\nexport const formFieldsProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Define Form',\n\t\tname: 'defineForm',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Using Fields Below',\n\t\t\t\tvalue: 'fields',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Using JSON',\n\t\t\t\tvalue: 'json',\n\t\t\t},\n\t\t],\n\t\tdefault: 'fields',\n\t},\n\t{\n\t\tdisplayName: 'Form Fields',\n\t\tname: 'jsonOutput',\n\t\ttype: 'json',\n\t\ttypeOptions: {\n\t\t\trows: 5,\n\t\t},\n\t\tdefault:\n\t\t\t'[\\n {\\n \"fieldLabel\":\"Name\",\\n \"placeholder\":\"enter you name\",\\n \"requiredField\":true\\n },\\n {\\n \"fieldLabel\":\"Age\",\\n \"fieldType\":\"number\",\\n \"placeholder\":\"enter your age\"\\n },\\n {\\n \"fieldLabel\":\"Email\",\\n \"fieldType\":\"email\",\\n \"requiredField\":true\\n }\\n]',\n\t\tvalidateType: 'form-fields',\n\t\tignoreValidationDuringExecution: true,\n\t\thint: '<a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.form/\" target=\"_blank\">See docs</a> for field syntax',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tdefineForm: ['json'],\n\t\t\t},\n\t\t},\n\t},\n\t{ ...formFields, displayOptions: { show: { defineForm: ['fields'] } } },\n];\n\nconst pageProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['page'],\n\t\t},\n\t},\n\t[\n\t\t...formFieldsProperties,\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false },\n\t\t\t\tformDescription,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Button Label',\n\t\t\t\t\tname: 'buttonLabel',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: 'Submit',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n);\n\nconst completionProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['completion'],\n\t\t},\n\t},\n\t[\n\t\t{\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\tdisplayName: 'On n8n Form Submission',\n\t\t\tname: 'respondWith',\n\t\t\ttype: 'options',\n\t\t\tdefault: 'text',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Completion Screen',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t\tdescription: 'Show a response text to the user',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Redirect to URL',\n\t\t\t\t\tvalue: 'redirect',\n\t\t\t\t\tdescription: 'Redirect the user to a URL',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Text',\n\t\t\t\t\tvalue: 'showText',\n\t\t\t\t\tdescription: 'Display simple text or HTML',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Return Binary File',\n\t\t\t\t\tvalue: 'returnBinary',\n\t\t\t\t\tdescription: 'Return incoming binary file',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'URL',\n\t\t\tname: 'redirectUrl',\n\t\t\tvalidateType: 'url',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Title',\n\t\t\tname: 'completionTitle',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Message',\n\t\t\tname: 'completionMessage',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Text',\n\t\t\tname: 'responseText',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['showText'],\n\t\t\t\t},\n\t\t\t},\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. Thanks for filling the form',\n\t\t\tdescription: 'The text to display on the page. Use HTML to show a customized web page.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Input Data Field Name',\n\t\t\tname: 'inputDataFieldName',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: 'data',\n\t\t\tplaceholder: 'e.g. data',\n\t\t\tdescription:\n\t\t\t\t'Find the name of input field containing the binary data to return in the Input panel on the left, in the Binary tab',\n\t\t\thint: 'The name of the input field containing the binary file data to be returned',\n\t\t},\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false, displayName: 'Completion Page Title' },\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n);\n\nexport class Form extends Node {\n\tnodeInputData: INodeExecutionData[] = [];\n\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'n8n Form',\n\t\tname: 'form',\n\t\ticon: 'file:form.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\t\tdefaults: {\n\t\t\tname: 'Form',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: 'responseNode',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'An n8n Form Trigger node must be set up before this node',\n\t\t\t\tname: 'triggerNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Page Type',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'page',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Next Form Page',\n\t\t\t\t\t\tvalue: 'page',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Form Ending',\n\t\t\t\t\t\tvalue: 'completion',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t...pageProperties,\n\t\t\t...completionProperties,\n\t\t],\n\t};\n\n\tasync webhook(context: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = context.getResponseObject();\n\n\t\tconst operation = context.getNodeParameter('operation', '') as string;\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst trigger = parentNodes.find(\n\t\t\t(node) => node.type === 'n8n-nodes-base.formTrigger',\n\t\t) as NodeTypeAndVersion;\n\n\t\tconst mode = context.evaluateExpression(`{{ $('${trigger?.name}').first().json.formMode }}`) as\n\t\t\t| 'test'\n\t\t\t| 'production';\n\n\t\tconst defineForm = context.getNodeParameter('defineForm', false) as string;\n\n\t\tlet fields: FormFieldsParameter = [];\n\t\tif (defineForm === 'json') {\n\t\t\ttry {\n\t\t\t\tconst jsonOutput = context.getNodeParameter('jsonOutput', '', {\n\t\t\t\t\trawExpressions: true,\n\t\t\t\t}) as string;\n\n\t\t\t\tfields = tryToParseJsonToFormFields(resolveRawData(context, jsonOutput));\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), error.message, {\n\t\t\t\t\tdescription: error.message,\n\t\t\t\t\ttype: mode === 'test' ? 'manual-form-test' : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tfields = context.getNodeParameter('formFields.values', []) as FormFieldsParameter;\n\t\t}\n\n\t\tconst method = context.getRequestObject().method;\n\n\t\tif (operation === 'completion' && method === 'GET') {\n\t\t\treturn await renderFormCompletion(context, res, trigger);\n\t\t}\n\n\t\tif (operation === 'completion' && method === 'POST') {\n\t\t\treturn {\n\t\t\t\tworkflowData: [context.evaluateExpression('{{ $input.all() }}') as INodeExecutionData[]],\n\t\t\t};\n\t\t}\n\n\t\tif (method === 'GET') {\n\t\t\treturn await renderFormNode(context, res, trigger, fields, mode);\n\t\t}\n\n\t\tlet useWorkflowTimezone = context.evaluateExpression(\n\t\t\t`{{ $('${trigger?.name}').params.options?.useWorkflowTimezone }}`,\n\t\t) as boolean;\n\n\t\tif (useWorkflowTimezone === undefined && trigger?.typeVersion > 2) {\n\t\t\tuseWorkflowTimezone = true;\n\t\t}\n\n\t\tconst returnItem = await prepareFormReturnItem(context, fields, mode, useWorkflowTimezone);\n\n\t\treturn {\n\t\t\twebhookResponse: { status: 200 },\n\t\t\tworkflowData: [[returnItem]],\n\t\t};\n\t}\n\n\tasync execute(context: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst operation = context.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'completion') {\n\t\t\tthis.nodeInputData = context.getInputData();\n\t\t}\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst hasFormTrigger = parentNodes.some((node) => node.type === FORM_TRIGGER_NODE_TYPE);\n\n\t\tif (!hasFormTrigger) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Form Trigger node must be set before this node',\n\t\t\t);\n\t\t}\n\n\t\tconst childNodes = context.getChildNodes(context.getNode().name);\n\t\tconst hasNextPage = childNodes.some((node) => node.type === FORM_NODE_TYPE);\n\n\t\tif (operation === 'completion' && hasNextPage) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Completion has to be the last Form node in the workflow',\n\t\t\t);\n\t\t}\n\n\t\tconst waitTill = configureWaitTillDate(context, 'root');\n\t\tawait context.putExecutionToWait(waitTill);\n\n\t\tcontext.sendResponse({\n\t\t\theaders: {\n\t\t\t\tlocation: context.evaluateExpression('{{ $execution.resumeFormUrl }}', 0),\n\t\t\t},\n\t\t\tstatusCode: 307,\n\t\t});\n\n\t\treturn [context.getInputData()];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,0BAQO;AAEP,0BAA6B;AAC7B,iCAAqC;AACrC,2BAA+B;AAC/B,mCAAsC;AACtC,0BAAwC;AACxC,oBAAuD;AACvD,mBAAsD;AAEtD,MAAM,qBAAwC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,EACF;AAAA,EACA,OAAG;AAAA,IACF;AAAA,MACC,MAAM;AAAA,QACL,eAAe,CAAC,IAAI;AAAA,MACrB;AAAA,IACD;AAAA,IACA;AAAA,EACD;AACD;AAEO,MAAM,uBAA0C;AAAA,EACtD;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,IACA,SACC;AAAA,IACD,cAAc;AAAA,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AA,IACD;AAEA,UAAM,eAAW,oDAAsB,SAAS,MAAM;AACtD,UAAM,QAAQ,mBAAmB,QAAQ;AAEzC,YAAQ,aAAa;AAAA,MACpB,SAAS;AAAA,QACR,UAAU,QAAQ,mBAAmB,kCAAkC,CAAC;AAAA,MACzE;AAAA,MACA,YAAY;AAAA,IACb,CAAC;AAED,WAAO,CAAC,QAAQ,aAAa,CAAC;AAAA,EAC/B;AACD;","names":[]}
|
|
@@ -53,7 +53,7 @@ const descriptionV2 = {
|
|
|
53
53
|
isFullPath: true,
|
|
54
54
|
path: '={{ $parameter["path"] || $parameter["options"]?.path || $webhookId }}',
|
|
55
55
|
ndvHideUrl: true,
|
|
56
|
-
|
|
56
|
+
nodeType: "form"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: "default",
|
|
@@ -63,7 +63,7 @@ const descriptionV2 = {
|
|
|
63
63
|
isFullPath: true,
|
|
64
64
|
path: '={{ $parameter["path"] || $parameter["options"]?.path || $webhookId }}',
|
|
65
65
|
ndvHideMethod: true,
|
|
66
|
-
|
|
66
|
+
nodeType: "form"
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
69
|
eventTriggerDescription: "Waiting for you to submit the form",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/Form/v2/FormTriggerV2.node.ts"],"sourcesContent":["import {\n\tADD_FORM_NOTICE,\n\ttype INodePropertyOptions,\n\tNodeConnectionTypes,\n\ttype INodeProperties,\n\ttype INodeType,\n\ttype INodeTypeBaseDescription,\n\ttype INodeTypeDescription,\n\ttype IWebhookFunctions,\n} from 'n8n-workflow';\n\nimport {\n\tappendAttributionToForm,\n\tformDescription,\n\tformFields,\n\tformRespondMode,\n\tformTitle,\n\tformTriggerPanel,\n\trespondWithOptions,\n\twebhookPath,\n} from '../common.descriptions';\nimport { cssVariables } from '../cssVariables';\nimport { FORM_TRIGGER_AUTHENTICATION_PROPERTY } from '../interfaces';\nimport { formWebhook } from '../utils';\n\nconst useWorkflowTimezone: INodeProperties = {\n\tdisplayName: 'Use Workflow Timezone',\n\tname: 'useWorkflowTimezone',\n\ttype: 'boolean',\n\tdefault: false,\n\tdescription: \"Whether to use the workflow timezone set in node's settings rather than UTC\",\n};\n\nconst descriptionV2: INodeTypeDescription = {\n\tdisplayName: 'n8n Form Trigger',\n\tname: 'formTrigger',\n\ticon: 'file:form.svg',\n\tgroup: ['trigger'],\n\tversion: [2, 2.1, 2.2],\n\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\tdefaults: {\n\t\tname: 'On form submission',\n\t},\n\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\twebhooks: [\n\t\t{\n\t\t\tname: 'setup',\n\t\t\thttpMethod: 'GET',\n\t\t\tresponseMode: 'onReceived',\n\t\t\tisFullPath: true,\n\t\t\tpath: '={{ $parameter[\"path\"] || $parameter[\"options\"]?.path || $webhookId }}',\n\t\t\tndvHideUrl: true,\n\t\t\
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Form/v2/FormTriggerV2.node.ts"],"sourcesContent":["import {\n\tADD_FORM_NOTICE,\n\ttype INodePropertyOptions,\n\tNodeConnectionTypes,\n\ttype INodeProperties,\n\ttype INodeType,\n\ttype INodeTypeBaseDescription,\n\ttype INodeTypeDescription,\n\ttype IWebhookFunctions,\n} from 'n8n-workflow';\n\nimport {\n\tappendAttributionToForm,\n\tformDescription,\n\tformFields,\n\tformRespondMode,\n\tformTitle,\n\tformTriggerPanel,\n\trespondWithOptions,\n\twebhookPath,\n} from '../common.descriptions';\nimport { cssVariables } from '../cssVariables';\nimport { FORM_TRIGGER_AUTHENTICATION_PROPERTY } from '../interfaces';\nimport { formWebhook } from '../utils';\n\nconst useWorkflowTimezone: INodeProperties = {\n\tdisplayName: 'Use Workflow Timezone',\n\tname: 'useWorkflowTimezone',\n\ttype: 'boolean',\n\tdefault: false,\n\tdescription: \"Whether to use the workflow timezone set in node's settings rather than UTC\",\n};\n\nconst descriptionV2: INodeTypeDescription = {\n\tdisplayName: 'n8n Form Trigger',\n\tname: 'formTrigger',\n\ticon: 'file:form.svg',\n\tgroup: ['trigger'],\n\tversion: [2, 2.1, 2.2],\n\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\tdefaults: {\n\t\tname: 'On form submission',\n\t},\n\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\twebhooks: [\n\t\t{\n\t\t\tname: 'setup',\n\t\t\thttpMethod: 'GET',\n\t\t\tresponseMode: 'onReceived',\n\t\t\tisFullPath: true,\n\t\t\tpath: '={{ $parameter[\"path\"] || $parameter[\"options\"]?.path || $webhookId }}',\n\t\t\tndvHideUrl: true,\n\t\t\tnodeType: 'form',\n\t\t},\n\t\t{\n\t\t\tname: 'default',\n\t\t\thttpMethod: 'POST',\n\t\t\tresponseMode: '={{$parameter[\"responseMode\"]}}',\n\t\t\tresponseData: '={{$parameter[\"responseMode\"] === \"lastNode\" ? \"noData\" : undefined}}',\n\t\t\tisFullPath: true,\n\t\t\tpath: '={{ $parameter[\"path\"] || $parameter[\"options\"]?.path || $webhookId }}',\n\t\t\tndvHideMethod: true,\n\t\t\tnodeType: 'form',\n\t\t},\n\t],\n\teventTriggerDescription: 'Waiting for you to submit the form',\n\tactivationMessage: 'You can now make calls to your production Form URL.',\n\ttriggerPanel: formTriggerPanel,\n\tcredentials: [\n\t\t{\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed\n\t\t\tname: 'httpBasicAuth',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\t[FORM_TRIGGER_AUTHENTICATION_PROPERTY]: ['basicAuth'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Authentication',\n\t\t\tname: FORM_TRIGGER_AUTHENTICATION_PROPERTY,\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Basic Auth',\n\t\t\t\t\tvalue: 'basicAuth',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'None',\n\t\t\t\t\tvalue: 'none',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'none',\n\t\t},\n\t\t{ ...webhookPath, displayOptions: { show: { '@version': [{ _cnd: { lte: 2.1 } }] } } },\n\t\tformTitle,\n\t\tformDescription,\n\t\tformFields,\n\t\t{ ...formRespondMode, displayOptions: { show: { '@version': [{ _cnd: { lte: 2.1 } }] } } },\n\t\t{\n\t\t\t...formRespondMode,\n\t\t\toptions: (formRespondMode.options as INodePropertyOptions[])?.filter(\n\t\t\t\t(option) => option.value !== 'responseNode',\n\t\t\t),\n\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 2.2 } }] } },\n\t\t},\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t\"In the 'Respond to Webhook' node, select 'Respond With JSON' and set the <strong>formSubmittedText</strong> key to display a custom response in the form, or the <strong>redirectURL</strong> key to redirect users to a URL\",\n\t\t\tname: 'formNotice',\n\t\t\ttype: 'notice',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: { responseMode: ['responseNode'] },\n\t\t\t},\n\t\t\tdefault: '',\n\t\t},\n\t\t// notice would be shown if no Form node was connected to trigger\n\t\t{\n\t\t\tdisplayName: 'Build multi-step forms by adding a form page later in your workflow',\n\t\t\tname: ADD_FORM_NOTICE,\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\tappendAttributionToForm,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Button Label',\n\t\t\t\t\tdescription: 'The label of the submit button in the form',\n\t\t\t\t\tname: 'buttonLabel',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: 'Submit',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...webhookPath,\n\t\t\t\t\trequired: false,\n\t\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 2.2 } }] } },\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...respondWithOptions,\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t'/responseMode': ['responseNode'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Ignore Bots',\n\t\t\t\t\tname: 'ignoreBots',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tdescription: 'Whether to ignore requests from bots like link previewers and web crawlers',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...useWorkflowTimezone,\n\t\t\t\t\tdefault: false,\n\t\t\t\t\tdescription: \"Whether to use the workflow timezone in 'submittedAt' field or UTC\",\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'@version': [2],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t...useWorkflowTimezone,\n\t\t\t\t\tdefault: true,\n\t\t\t\t\tdescription: \"Whether to use the workflow timezone in 'submittedAt' field or UTC\",\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { gt: 2 } }],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t'@version': [{ _cnd: { gt: 2 } }],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport class FormTriggerV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...descriptionV2,\n\t\t};\n\t}\n\n\tasync webhook(this: IWebhookFunctions) {\n\t\treturn await formWebhook(this);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BASO;AAEP,oBASO;AACP,0BAA6B;AAC7B,wBAAqD;AACrD,mBAA4B;AAE5B,MAAM,sBAAuC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AACd;AAEA,MAAM,gBAAsC;AAAA,EAC3C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO,CAAC,SAAS;AAAA,EACjB,SAAS,CAAC,GAAG,KAAK,GAAG;AAAA,EACrB,aAAa;AAAA,EACb,UAAU;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EAEA,QAAQ,CAAC;AAAA,EACT,SAAS,CAAC,wCAAoB,IAAI;AAAA,EAClC,UAAU;AAAA,IACT;AAAA,MACC,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACX;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,eAAe;AAAA,M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,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;AAAA,YACjC;AAAA,UACD;AAAA,UACA,SAAS,iCAAa,KAAK;AAAA,UAC3B,aAAa;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,cAAmC;AAAA,EAG/C,YAAY,iBAA2C;AACtD,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EAEA,MAAM,UAAiC;AACtC,WAAO,UAAM,0BAAY,IAAI;AAAA,EAC9B;AACD;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var AzureCosmosDb_node_exports = {};
|
|
20
|
+
__export(AzureCosmosDb_node_exports, {
|
|
21
|
+
AzureCosmosDb: () => AzureCosmosDb
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(AzureCosmosDb_node_exports);
|
|
24
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
25
|
+
var import_descriptions = require("./descriptions");
|
|
26
|
+
var import_methods = require("./methods");
|
|
27
|
+
class AzureCosmosDb {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.description = {
|
|
30
|
+
displayName: "Azure Cosmos DB",
|
|
31
|
+
name: "azureCosmosDb",
|
|
32
|
+
icon: {
|
|
33
|
+
light: "file:AzureCosmosDb.svg",
|
|
34
|
+
dark: "file:AzureCosmosDb.svg"
|
|
35
|
+
},
|
|
36
|
+
group: ["transform"],
|
|
37
|
+
version: 1,
|
|
38
|
+
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
39
|
+
description: "Interact with Azure Cosmos DB API",
|
|
40
|
+
defaults: {
|
|
41
|
+
name: "Azure Cosmos DB"
|
|
42
|
+
},
|
|
43
|
+
inputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
44
|
+
outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
45
|
+
credentials: [
|
|
46
|
+
{
|
|
47
|
+
name: "microsoftAzureCosmosDbSharedKeyApi",
|
|
48
|
+
required: true
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
requestDefaults: {
|
|
52
|
+
baseURL: "=https://{{ $credentials.account }}.documents.azure.com/dbs/{{ $credentials.database }}",
|
|
53
|
+
json: true,
|
|
54
|
+
ignoreHttpStatusErrors: true
|
|
55
|
+
},
|
|
56
|
+
properties: [
|
|
57
|
+
{
|
|
58
|
+
displayName: "Resource",
|
|
59
|
+
name: "resource",
|
|
60
|
+
type: "options",
|
|
61
|
+
noDataExpression: true,
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
name: "Container",
|
|
65
|
+
value: "container"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Item",
|
|
69
|
+
value: "item"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
default: "container"
|
|
73
|
+
},
|
|
74
|
+
...import_descriptions.container.description,
|
|
75
|
+
...import_descriptions.item.description
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
this.methods = {
|
|
79
|
+
listSearch: import_methods.listSearch
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
AzureCosmosDb
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=AzureCosmosDb.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.ts"],"sourcesContent":["import type { INodeType, INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { container, item } from './descriptions';\nimport { listSearch } from './methods';\n\nexport class AzureCosmosDb implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Azure Cosmos DB',\n\t\tname: 'azureCosmosDb',\n\t\ticon: {\n\t\t\tlight: 'file:AzureCosmosDb.svg',\n\t\t\tdark: 'file:AzureCosmosDb.svg',\n\t\t},\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\t\tdescription: 'Interact with Azure Cosmos DB API',\n\t\tdefaults: {\n\t\t\tname: 'Azure Cosmos DB',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'microsoftAzureCosmosDbSharedKeyApi',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tbaseURL:\n\t\t\t\t'=https://{{ $credentials.account }}.documents.azure.com/dbs/{{ $credentials.database }}',\n\t\t\tjson: true,\n\t\t\tignoreHttpStatusErrors: true,\n\t\t},\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Resource',\n\t\t\t\tname: 'resource',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Container',\n\t\t\t\t\t\tvalue: 'container',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Item',\n\t\t\t\t\t\tvalue: 'item',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'container',\n\t\t\t},\n\n\t\t\t...container.description,\n\t\t\t...item.description,\n\t\t],\n\t};\n\n\tmethods = {\n\t\tlistSearch,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAoC;AAEpC,0BAAgC;AAChC,qBAA2B;AAEpB,MAAM,cAAmC;AAAA,EAAzC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACP;AAAA,MACA,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,iBAAiB;AAAA,QAChB,SACC;AAAA,QACD,MAAM;AAAA,QACN,wBAAwB;AAAA,MACzB;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,SAAS;AAAA,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,QAEA,GAAG,8BAAU;AAAA,QACb,GAAG,yBAAK;AAAA,MACT;AAAA,IACD;AAEA,mBAAU;AAAA,MACT;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.azureCosmosDb",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Data & Storage"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://docs.n8n.io/integrations/builtin/credentials/microsoft/"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.azureCosmosDb/"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M105.825 58.635c5.491 22.449-8.458 45.049-31.156 50.48-22.695 5.429-45.547-8.365-51.036-30.815-5.492-22.449 8.458-45.049 31.153-50.48l.078-.018c22.588-5.46 45.374 8.223 50.896 30.565l.065.268Z" fill="#59B3D8"/><path fill-rule="evenodd" clip-rule="evenodd" d="M58.747 85.194c-.013-6.137-5.055-11.1-11.259-11.085h-1.701c1.442-5.932-2.248-11.895-8.246-13.322a11.182 11.182 0 0 0-2.703-.306H23.162c-2.525 12.851 1.246 26.127 10.174 35.796h14.149c6.205.015 11.247-4.948 11.262-11.083ZM72.69 39.233c0 .649.085 1.296.255 1.925h-4.861c-6.445 0-11.667 5.168-11.667 11.543 0 6.372 5.222 11.54 11.667 11.54h38.645c-1.258-13.787-9.486-26.01-21.862-32.477h-4.605c-4.177-.002-7.562 3.339-7.572 7.469Zm34.043 33.587H83.679c-5.259-.013-9.531 4.187-9.552 9.385a9.241 9.241 0 0 0 1.148 4.471c-5.003 1.546-7.792 6.814-6.228 11.765 1.242 3.934 4.938 6.607 9.106 6.589h6.427c12.314-6.454 20.607-18.51 22.153-32.21Z" fill="#B6DEEC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M17.382 40.624a1.286 1.286 0 0 1-1.3-1.275v-.003c-.021-8.064-6.637-14.587-14.79-14.579A1.286 1.286 0 0 1 0 23.489c0-.703.579-1.275 1.292-1.275 8.143.007 14.756-6.503 14.79-14.554a1.29 1.29 0 0 1 1.356-1.227c.672.028 1.21.56 1.241 1.227.021 8.061 6.639 14.584 14.792 14.577.713 0 1.292.572 1.292 1.277 0 .706-.579 1.279-1.292 1.279-8.148-.011-14.766 6.507-14.792 14.566-.01.7-.589 1.265-1.297 1.265Z" fill="#B7D332"/><path fill-rule="evenodd" clip-rule="evenodd" d="M108.6 122.793a.764.764 0 0 1-.768-.759c-.018-4.821-3.98-8.719-8.854-8.709a.762.762 0 0 1-.77-.756c0-.419.342-.759.765-.759h.005c4.872.002 8.826-3.893 8.844-8.711a.77.77 0 0 1 .778-.767.77.77 0 0 1 .775.767c.018 4.818 3.972 8.713 8.843 8.711a.761.761 0 0 1 .77.756.759.759 0 0 1-.765.759h-.005c-4.871-.002-8.828 3.893-8.843 8.714a.764.764 0 0 1-.773.754h-.002Z" fill="#0072C5"/><path fill-rule="evenodd" clip-rule="evenodd" d="M126.317 30.84c-4.035-6.539-14.175-8.049-29.306-4.384a121.688 121.688 0 0 0-13.893 4.384 42.829 42.829 0 0 1 8.187 5.173c2.574-.836 5.101-1.59 7.512-2.173a53.33 53.33 0 0 1 12.335-1.727c4.957 0 7.691 1.211 8.606 2.686 1.496 2.423.119 8.816-8.681 18.871-1.566 1.789-3.326 3.601-5.179 5.423a175.936 175.936 0 0 1-31.843 24.149 176.032 176.032 0 0 1-36.329 17.105c-15.317 4.936-25.773 4.836-28.119 1.048-2.342-3.788 2.344-13.048 13.776-24.29a41.005 41.005 0 0 1-.938-9.735c-18.2 16.271-24.09 30.365-19.387 37.981 2.463 3.985 7.844 6.229 15.705 6.229a80.772 80.772 0 0 0 27.183-5.932 194.648 194.648 0 0 0 32.11-15.926 193.405 193.405 0 0 0 28.884-21.148 118.565 118.565 0 0 0 9.947-9.941c10.207-11.655 13.466-21.268 9.43-27.793Z" fill="#000"/></svg>
|