n8n-nodes-base 1.98.1 → 1.99.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/GoogleSheetsOAuth2Api.credentials.js +1 -0
- package/dist/credentials/GoogleSheetsOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/JiraSoftwareCloudApi.credentials.js +1 -1
- package/dist/credentials/JiraSoftwareCloudApi.credentials.js.map +1 -1
- package/dist/credentials/JiraSoftwareServerApi.credentials.js +1 -1
- package/dist/credentials/JiraSoftwareServerApi.credentials.js.map +1 -1
- package/dist/credentials/JiraSoftwareServerPatApi.credentials.js +1 -1
- package/dist/credentials/JiraSoftwareServerPatApi.credentials.js.map +1 -1
- package/dist/nodes/Code/ExecutionError.js +11 -4
- package/dist/nodes/Code/ExecutionError.js.map +1 -1
- package/dist/nodes/ExecutionData/ExecutionData.node.js +35 -10
- package/dist/nodes/ExecutionData/ExecutionData.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js.map +1 -1
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js +1 -2
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js.map +1 -1
- package/dist/nodes/Microsoft/Sql/GenericFunctions.js.map +1 -1
- package/dist/nodes/Onfleet/Onfleet.node.js.map +1 -1
- package/dist/nodes/Postgres/v1/genericFunctions.js.map +1 -1
- package/dist/types/credentials.json +4 -4
- package/dist/types/nodes.json +4 -4
- package/package.json +7 -7
|
@@ -31,6 +31,7 @@ class GoogleSheetsOAuth2Api {
|
|
|
31
31
|
this.name = "googleSheetsOAuth2Api";
|
|
32
32
|
this.extends = ["googleOAuth2Api"];
|
|
33
33
|
this.displayName = "Google Sheets OAuth2 API";
|
|
34
|
+
this.icon = "node:n8n-nodes-base.googleSheets";
|
|
34
35
|
this.documentationUrl = "google/oauth-single-service";
|
|
35
36
|
this.properties = [
|
|
36
37
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../credentials/GoogleSheetsOAuth2Api.credentials.ts"],"sourcesContent":["import type { ICredentialType, INodeProperties } from 'n8n-workflow';\n\nconst scopes = [\n\t'https://www.googleapis.com/auth/drive.file',\n\t'https://www.googleapis.com/auth/spreadsheets',\n\t'https://www.googleapis.com/auth/drive.metadata',\n];\n\nexport class GoogleSheetsOAuth2Api implements ICredentialType {\n\tname = 'googleSheetsOAuth2Api';\n\n\textends = ['googleOAuth2Api'];\n\n\tdisplayName = 'Google Sheets OAuth2 API';\n\n\tdocumentationUrl = 'google/oauth-single-service';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Scope',\n\t\t\tname: 'scope',\n\t\t\ttype: 'hidden',\n\t\t\tdefault: scopes.join(' '),\n\t\t},\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'Make sure you enabled the following APIs & Services in the Google Cloud Console: Google Drive API, Google Sheets API. <a href=\"https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/#scopes\" target=\"_blank\">More info</a>.',\n\t\t\tname: 'notice',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t\tdisplayOptions: {\n\t\t\t\thideOnCloud: true,\n\t\t\t},\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,SAAS;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACD;AAEO,MAAM,sBAAiD;AAAA,EAAvD;AACN,gBAAO;AAEP,mBAAU,CAAC,iBAAiB;AAE5B,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS,OAAO,KAAK,GAAG;AAAA,MACzB;AAAA,MACA;AAAA,QACC,aACC;AAAA,QACD,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,gBAAgB;AAAA,UACf,aAAa;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../credentials/GoogleSheetsOAuth2Api.credentials.ts"],"sourcesContent":["import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';\n\nconst scopes = [\n\t'https://www.googleapis.com/auth/drive.file',\n\t'https://www.googleapis.com/auth/spreadsheets',\n\t'https://www.googleapis.com/auth/drive.metadata',\n];\n\nexport class GoogleSheetsOAuth2Api implements ICredentialType {\n\tname = 'googleSheetsOAuth2Api';\n\n\textends = ['googleOAuth2Api'];\n\n\tdisplayName = 'Google Sheets OAuth2 API';\n\n\ticon: Icon = 'node:n8n-nodes-base.googleSheets';\n\n\tdocumentationUrl = 'google/oauth-single-service';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Scope',\n\t\t\tname: 'scope',\n\t\t\ttype: 'hidden',\n\t\t\tdefault: scopes.join(' '),\n\t\t},\n\t\t{\n\t\t\tdisplayName:\n\t\t\t\t'Make sure you enabled the following APIs & Services in the Google Cloud Console: Google Drive API, Google Sheets API. <a href=\"https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/#scopes\" target=\"_blank\">More info</a>.',\n\t\t\tname: 'notice',\n\t\t\ttype: 'notice',\n\t\t\tdefault: '',\n\t\t\tdisplayOptions: {\n\t\t\t\thideOnCloud: true,\n\t\t\t},\n\t\t},\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,SAAS;AAAA,EACd;AAAA,EACA;AAAA,EACA;AACD;AAEO,MAAM,sBAAiD;AAAA,EAAvD;AACN,gBAAO;AAEP,mBAAU,CAAC,iBAAiB;AAE5B,uBAAc;AAEd,gBAAa;AAEb,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS,OAAO,KAAK,GAAG;AAAA,MACzB;AAAA,MACA;AAAA,QACC,aACC;AAAA,QACD,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,gBAAgB;AAAA,UACf,aAAa;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../credentials/JiraSoftwareCloudApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareCloudApi implements ICredentialType {\n\tname = 'jiraSoftwareCloudApi';\n\n\tdisplayName = 'Jira SW Cloud API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Email',\n\t\t\tname: 'email',\n\t\t\ttype: 'string',\n\t\t\tplaceholder: 'name@email.com',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'API Token',\n\t\t\tname: 'apiToken',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.atlassian.net',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\tauth: {\n\t\t\t\tusername: '={{$credentials.email}}',\n\t\t\t\tpassword: '={{$credentials.apiToken}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/
|
|
1
|
+
{"version":3,"sources":["../../credentials/JiraSoftwareCloudApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareCloudApi implements ICredentialType {\n\tname = 'jiraSoftwareCloudApi';\n\n\tdisplayName = 'Jira SW Cloud API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Email',\n\t\t\tname: 'email',\n\t\t\ttype: 'string',\n\t\t\tplaceholder: 'name@email.com',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'API Token',\n\t\t\tname: 'apiToken',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.atlassian.net',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\tauth: {\n\t\t\t\tusername: '={{$credentials.email}}',\n\t\t\t\tpassword: '={{$credentials.apiToken}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/myself',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,qBAAgD;AAAA,EAAtD;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,MAAM;AAAA,UACL,UAAU;AAAA,UACV,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,MACN;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../credentials/JiraSoftwareServerApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareServerApi implements ICredentialType {\n\tname = 'jiraSoftwareServerApi';\n\n\tdisplayName = 'Jira SW Server API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Email',\n\t\t\tname: 'email',\n\t\t\ttype: 'string',\n\t\t\tplaceholder: 'name@email.com',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Password',\n\t\t\tname: 'password',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.com',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\tauth: {\n\t\t\t\tusername: '={{$credentials.email}}',\n\t\t\t\tpassword: '={{$credentials.password}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/
|
|
1
|
+
{"version":3,"sources":["../../credentials/JiraSoftwareServerApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareServerApi implements ICredentialType {\n\tname = 'jiraSoftwareServerApi';\n\n\tdisplayName = 'Jira SW Server API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Email',\n\t\t\tname: 'email',\n\t\t\ttype: 'string',\n\t\t\tplaceholder: 'name@email.com',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Password',\n\t\t\tname: 'password',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.com',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\tauth: {\n\t\t\t\tusername: '={{$credentials.email}}',\n\t\t\t\tpassword: '={{$credentials.password}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/myself',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,sBAAiD;AAAA,EAAvD;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,aAAa;AAAA,UACZ,UAAU;AAAA,QACX;AAAA,QACA,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,MAAM;AAAA,UACL,UAAU;AAAA,UACV,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,MACN;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../credentials/JiraSoftwareServerPatApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareServerPatApi implements ICredentialType {\n\tname = 'jiraSoftwareServerPatApi';\n\n\tdisplayName = 'Jira SW Server (PAT) API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Personal Access Token',\n\t\t\tname: 'personalAccessToken',\n\t\t\ttypeOptions: { password: true },\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.com',\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.personalAccessToken}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/
|
|
1
|
+
{"version":3,"sources":["../../credentials/JiraSoftwareServerPatApi.credentials.ts"],"sourcesContent":["import type {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class JiraSoftwareServerPatApi implements ICredentialType {\n\tname = 'jiraSoftwareServerPatApi';\n\n\tdisplayName = 'Jira SW Server (PAT) API';\n\n\tdocumentationUrl = 'jira';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Personal Access Token',\n\t\t\tname: 'personalAccessToken',\n\t\t\ttypeOptions: { password: true },\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Domain',\n\t\t\tname: 'domain',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://example.com',\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.personalAccessToken}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials?.domain}}',\n\t\t\turl: '/rest/api/2/myself',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,yBAAoD;AAAA,EAA1D;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,MAAM;AAAA,QACN,SAAS;AAAA,MACV;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AAEA,wBAAqC;AAAA,MACpC,MAAM;AAAA,MACN,YAAY;AAAA,QACX,SAAS;AAAA,UACR,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,gBAA+B;AAAA,MAC9B,SAAS;AAAA,QACR,SAAS;AAAA,QACT,KAAK;AAAA,MACN;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -41,13 +41,14 @@ class ExecutionError extends import_n8n_workflow.ApplicationError {
|
|
|
41
41
|
* Populate error `message` and `description` from error `stack`.
|
|
42
42
|
*/
|
|
43
43
|
populateFromStack() {
|
|
44
|
-
const stackRows = this.stack.split("\n");
|
|
44
|
+
const stackRows = this.stack && typeof this.stack === "string" ? this.stack.split("\n") : [];
|
|
45
45
|
if (stackRows.length === 0) {
|
|
46
46
|
this.message = "Unknown error";
|
|
47
|
+
return;
|
|
47
48
|
}
|
|
48
49
|
const messageRow = stackRows.find((line) => line.includes("Error:"));
|
|
49
50
|
const lineNumberRow = stackRows.find((line) => line.includes("Code:"));
|
|
50
|
-
const lineNumberDisplay = this.toLineNumberDisplay(lineNumberRow);
|
|
51
|
+
const lineNumberDisplay = this.toLineNumberDisplay(lineNumberRow) || "";
|
|
51
52
|
if (!messageRow) {
|
|
52
53
|
this.message = `Unknown error ${lineNumberDisplay}`;
|
|
53
54
|
return;
|
|
@@ -58,7 +59,7 @@ class ExecutionError extends import_n8n_workflow.ApplicationError {
|
|
|
58
59
|
this.message = `Unknown error ${lineNumberDisplay}`;
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
this.message = `${errorDetails} ${lineNumberDisplay}
|
|
62
|
+
this.message = `${errorDetails} ${lineNumberDisplay}`.trim();
|
|
62
63
|
}
|
|
63
64
|
toLineNumberDisplay(lineNumberRow) {
|
|
64
65
|
const errorLineNumberMatch = lineNumberRow?.match(/Code:(?<lineNumber>\d+)/);
|
|
@@ -70,7 +71,13 @@ class ExecutionError extends import_n8n_workflow.ApplicationError {
|
|
|
70
71
|
}
|
|
71
72
|
toErrorDetailsAndType(messageRow) {
|
|
72
73
|
if (!messageRow) return [null, null];
|
|
73
|
-
|
|
74
|
+
messageRow = messageRow.replace(/^Error: /, "");
|
|
75
|
+
const colonIndex = messageRow.indexOf(": ");
|
|
76
|
+
if (colonIndex === -1) {
|
|
77
|
+
return [messageRow.trim(), null];
|
|
78
|
+
}
|
|
79
|
+
const errorType = messageRow.substring(0, colonIndex).trim();
|
|
80
|
+
const errorDetails = messageRow.substring(colonIndex + 2).trim();
|
|
74
81
|
return [errorDetails, errorType === "Error" ? null : errorType];
|
|
75
82
|
}
|
|
76
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Code/ExecutionError.ts"],"sourcesContent":["import { ApplicationError } from 'n8n-workflow';\n\nexport class ExecutionError extends ApplicationError {\n\tdescription: string | null = null;\n\n\titemIndex: number | undefined = undefined;\n\n\tcontext: { itemIndex: number } | undefined = undefined;\n\n\tstack = '';\n\n\tlineNumber: number | undefined = undefined;\n\n\tconstructor(error: Error & { stack?: string }, itemIndex?: number) {\n\t\tsuper(error.message);\n\t\tthis.itemIndex = itemIndex;\n\n\t\tif (this.itemIndex !== undefined) {\n\t\t\tthis.context = { itemIndex: this.itemIndex };\n\t\t}\n\n\t\tthis.stack = error.stack ?? '';\n\n\t\tthis.populateFromStack();\n\t}\n\n\t/**\n\t * Populate error `message` and `description` from error `stack`.\n\t */\n\tprivate populateFromStack() {\n\t\tconst stackRows = this.stack.split('\\n');\n\n\t\tif (stackRows.length === 0) {\n\t\t\tthis.message = 'Unknown error';\n\t\t}\n\n\t\tconst messageRow = stackRows.find((line) => line.includes('Error:'));\n\t\tconst lineNumberRow = stackRows.find((line) => line.includes('Code:'));\n\t\tconst lineNumberDisplay = this.toLineNumberDisplay(lineNumberRow);\n\n\t\tif (!messageRow) {\n\t\t\tthis.message = `Unknown error ${lineNumberDisplay}`;\n\t\t\treturn;\n\t\t}\n\n\t\tconst [errorDetails, errorType] = this.toErrorDetailsAndType(messageRow);\n\n\t\tif (errorType) this.description = errorType;\n\n\t\tif (!errorDetails) {\n\t\t\tthis.message = `Unknown error ${lineNumberDisplay}`;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.message = `${errorDetails} ${lineNumberDisplay}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Code/ExecutionError.ts"],"sourcesContent":["import { ApplicationError } from 'n8n-workflow';\n\nexport class ExecutionError extends ApplicationError {\n\tdescription: string | null = null;\n\n\titemIndex: number | undefined = undefined;\n\n\tcontext: { itemIndex: number } | undefined = undefined;\n\n\tstack = '';\n\n\tlineNumber: number | undefined = undefined;\n\n\tconstructor(error: Error & { stack?: string }, itemIndex?: number) {\n\t\tsuper(error.message);\n\t\tthis.itemIndex = itemIndex;\n\n\t\tif (this.itemIndex !== undefined) {\n\t\t\tthis.context = { itemIndex: this.itemIndex };\n\t\t}\n\n\t\tthis.stack = error.stack ?? '';\n\n\t\tthis.populateFromStack();\n\t}\n\n\t/**\n\t * Populate error `message` and `description` from error `stack`.\n\t */\n\tprivate populateFromStack() {\n\t\tconst stackRows = this.stack && typeof this.stack === 'string' ? this.stack.split('\\n') : [];\n\n\t\tif (stackRows.length === 0) {\n\t\t\tthis.message = 'Unknown error';\n\t\t\treturn;\n\t\t}\n\n\t\tconst messageRow = stackRows.find((line) => line.includes('Error:'));\n\t\tconst lineNumberRow = stackRows.find((line) => line.includes('Code:'));\n\t\tconst lineNumberDisplay = this.toLineNumberDisplay(lineNumberRow) || '';\n\n\t\tif (!messageRow) {\n\t\t\tthis.message = `Unknown error ${lineNumberDisplay}`;\n\t\t\treturn;\n\t\t}\n\n\t\tconst [errorDetails, errorType] = this.toErrorDetailsAndType(messageRow);\n\n\t\tif (errorType) this.description = errorType;\n\n\t\tif (!errorDetails) {\n\t\t\tthis.message = `Unknown error ${lineNumberDisplay}`;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.message = `${errorDetails} ${lineNumberDisplay}`.trim();\n\t}\n\n\tprivate toLineNumberDisplay(lineNumberRow?: string) {\n\t\tconst errorLineNumberMatch = lineNumberRow?.match(/Code:(?<lineNumber>\\d+)/);\n\n\t\tif (!errorLineNumberMatch?.groups?.lineNumber) return null;\n\n\t\tconst lineNumber = errorLineNumberMatch.groups.lineNumber;\n\n\t\tthis.lineNumber = Number(lineNumber);\n\n\t\tif (!lineNumber) return '';\n\n\t\treturn this.itemIndex === undefined\n\t\t\t? `[line ${lineNumber}]`\n\t\t\t: `[line ${lineNumber}, for item ${this.itemIndex}]`;\n\t}\n\n\tprivate toErrorDetailsAndType(messageRow?: string) {\n\t\tif (!messageRow) return [null, null];\n\n\t\t// Remove \"Error: \" prefix added by stacktrace formatting\n\t\tmessageRow = messageRow.replace(/^Error: /, '');\n\n\t\tconst colonIndex = messageRow.indexOf(': ');\n\t\tif (colonIndex === -1) {\n\t\t\treturn [messageRow.trim(), null];\n\t\t}\n\n\t\tconst errorType = messageRow.substring(0, colonIndex).trim();\n\t\tconst errorDetails = messageRow.substring(colonIndex + 2).trim();\n\n\t\treturn [errorDetails, errorType === 'Error' ? null : errorType];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAiC;AAE1B,MAAM,uBAAuB,qCAAiB;AAAA,EAWpD,YAAY,OAAmC,WAAoB;AAClE,UAAM,MAAM,OAAO;AAXpB,uBAA6B;AAE7B,qBAAgC;AAEhC,mBAA6C;AAE7C,iBAAQ;AAER,sBAAiC;AAIhC,SAAK,YAAY;AAEjB,QAAI,KAAK,cAAc,QAAW;AACjC,WAAK,UAAU,EAAE,WAAW,KAAK,UAAU;AAAA,IAC5C;AAEA,SAAK,QAAQ,MAAM,SAAS;AAE5B,SA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,IAAI;AAAA,IAChC;AAEA,UAAM,YAAY,WAAW,UAAU,GAAG,UAAU,EAAE,KAAK;AAC3D,UAAM,eAAe,WAAW,UAAU,aAAa,CAAC,EAAE,KAAK;AAE/D,WAAO,CAAC,cAAc,cAAc,UAAU,OAAO,SAAS;AAAA,EAC/D;AACD;","names":[]}
|
|
@@ -30,7 +30,7 @@ class ExecutionData {
|
|
|
30
30
|
icon: "fa:tasks",
|
|
31
31
|
group: ["input"],
|
|
32
32
|
iconColor: "light-green",
|
|
33
|
-
version: 1,
|
|
33
|
+
version: [1, 1.1],
|
|
34
34
|
description: "Add execution data for search",
|
|
35
35
|
defaults: {
|
|
36
36
|
name: "Execution Data",
|
|
@@ -84,7 +84,8 @@ class ExecutionData {
|
|
|
84
84
|
name: "key",
|
|
85
85
|
type: "string",
|
|
86
86
|
default: "",
|
|
87
|
-
placeholder: "e.g. myKey"
|
|
87
|
+
placeholder: "e.g. myKey",
|
|
88
|
+
requiresDataPath: "single"
|
|
88
89
|
},
|
|
89
90
|
{
|
|
90
91
|
displayName: "Value",
|
|
@@ -117,20 +118,44 @@ class ExecutionData {
|
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
async execute() {
|
|
120
|
-
const
|
|
121
|
+
const dataProxy = this.getWorkflowDataProxy(0);
|
|
122
|
+
const nodeVersion = this.getNode().typeVersion;
|
|
121
123
|
const items = this.getInputData();
|
|
122
124
|
const operations = this.getNodeParameter("operation", 0);
|
|
125
|
+
const returnData = [];
|
|
123
126
|
if (operations === "save") {
|
|
124
127
|
for (let i = 0; i < items.length; i++) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
try {
|
|
129
|
+
const dataToSave = this.getNodeParameter("dataToSave", i, {}).values || [];
|
|
130
|
+
const values = dataToSave.reduce(
|
|
131
|
+
(acc, { key, value }) => {
|
|
132
|
+
const valueToSet = value ? value : nodeVersion >= 1.1 ? "" : value;
|
|
133
|
+
acc[key] = valueToSet;
|
|
134
|
+
return acc;
|
|
135
|
+
},
|
|
136
|
+
{}
|
|
137
|
+
);
|
|
138
|
+
dataProxy.$execution.customData.setAll(values);
|
|
139
|
+
returnData.push(items[i]);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (this.continueOnFail()) {
|
|
142
|
+
returnData.push({
|
|
143
|
+
json: {
|
|
144
|
+
error: error.message
|
|
145
|
+
},
|
|
146
|
+
pairedItem: {
|
|
147
|
+
item: i
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), error);
|
|
153
|
+
}
|
|
131
154
|
}
|
|
155
|
+
} else {
|
|
156
|
+
return [items];
|
|
132
157
|
}
|
|
133
|
-
return [
|
|
158
|
+
return [returnData];
|
|
134
159
|
}
|
|
135
160
|
}
|
|
136
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/ExecutionData/ExecutionData.node.ts"],"sourcesContent":["import type {\n\
|
|
1
|
+
{"version":3,"sources":["../../../nodes/ExecutionData/ExecutionData.node.ts"],"sourcesContent":["import type {\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\ntype DataToSave = {\n\tvalues: Array<{ key: string; value: string }>;\n};\n\nexport class ExecutionData implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Execution Data',\n\t\tname: 'executionData',\n\t\ticon: 'fa:tasks',\n\t\tgroup: ['input'],\n\t\ticonColor: 'light-green',\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Add execution data for search',\n\t\tdefaults: {\n\t\t\tname: 'Execution Data',\n\t\t\tcolor: '#29A568',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t\"Save important data using this node. It will be displayed on each execution for easy reference and you can filter by it.<br />Filtering is available on Pro and Enterprise plans. <a href='https://n8n.io/pricing/' target='_blank'>More Info</a>\",\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Operation',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'save',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Save Highlight Data (for Search/review)',\n\t\t\t\t\t\tvalue: 'save',\n\t\t\t\t\t\taction: 'Save Highlight Data (for search/review)',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Data to Save',\n\t\t\t\tname: 'dataToSave',\n\t\t\t\tplaceholder: 'Add Saved Field',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValueButtonText: 'Add Saved Field',\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['save'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Values',\n\t\t\t\t\t\tname: 'values',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Key',\n\t\t\t\t\t\t\t\tname: 'key',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'e.g. myKey',\n\t\t\t\t\t\t\t\trequiresDataPath: 'single',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\t\tname: 'value',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'e.g. myValue',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\thints: [\n\t\t\t{\n\t\t\t\ttype: 'warning',\n\t\t\t\tmessage: 'Some keys are longer than 50 characters. They will be truncated.',\n\t\t\t\tdisplayCondition: '={{ $parameter.dataToSave.values.some((x) => x.key.length > 50) }}',\n\t\t\t\twhenToDisplay: 'beforeExecution',\n\t\t\t\tlocation: 'outputPane',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'warning',\n\t\t\t\tmessage: 'Some values are longer than 512 characters. They will be truncated.',\n\t\t\t\tdisplayCondition: '={{ $parameter.dataToSave.values.some((x) => x.value.length > 512) }}',\n\t\t\t\twhenToDisplay: 'beforeExecution',\n\t\t\t\tlocation: 'outputPane',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst dataProxy = this.getWorkflowDataProxy(0);\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tconst items = this.getInputData();\n\t\tconst operations = this.getNodeParameter('operation', 0);\n\n\t\tconst returnData: INodeExecutionData[] = [];\n\n\t\tif (operations === 'save') {\n\t\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst dataToSave =\n\t\t\t\t\t\t(this.getNodeParameter('dataToSave', i, {}) as DataToSave).values || [];\n\n\t\t\t\t\tconst values = dataToSave.reduce(\n\t\t\t\t\t\t(acc, { key, value }) => {\n\t\t\t\t\t\t\tconst valueToSet = value ? value : nodeVersion >= 1.1 ? '' : value;\n\t\t\t\t\t\t\tacc[key] = valueToSet;\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as { [key: string]: string },\n\t\t\t\t\t);\n\n\t\t\t\t\tdataProxy.$execution.customData.setAll(values);\n\n\t\t\t\t\treturnData.push(items[i]);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: {\n\t\t\t\t\t\t\t\terror: error.message,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpairedItem: {\n\t\t\t\t\t\t\t\titem: i,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), error);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn [items];\n\t\t}\n\n\t\treturn [returnData];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAAwD;AAMjD,MAAM,cAAmC;AAAA,EAAzC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,WAAW;AAAA,MACX,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,YAAY;AAAA,QACX;AAAA,UACC,aACC;AAAA,UACD,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QACV;AAAA,QACA;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,kBAAkB;AAAA,UAClB,SAAS;AAAA,YACR;AAAA,c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I,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,YAAI;AACH,gBAAM,aACJ,KAAK,iBAAiB,cAAc,GAAG,CAAC,CAAC,EAAiB,UAAU,CAAC;AAEvE,gBAAM,SAAS,WAAW;AAAA,YACzB,CAAC,KAAK,EAAE,KAAK,MAAM,MAAM;AACxB,oBAAM,aAAa,QAAQ,QAAQ,eAAe,MAAM,KAAK;AAC7D,kBAAI,GAAG,IAAI;AACX,qBAAO;AAAA,YACR;AAAA,YACA,CAAC;AAAA,UACF;AAEA,oBAAU,WAAW,WAAW,OAAO,MAAM;AAE7C,qBAAW,KAAK,MAAM,CAAC,CAAC;AAAA,QACzB,SAAS,OAAO;AACf,cAAI,KAAK,eAAe,GAAG;AAC1B,uBAAW,KAAK;AAAA,cACf,MAAM;AAAA,gBACL,OAAO,MAAM;AAAA,cACd;AAAA,cACA,YAAY;AAAA,gBACX,MAAM;AAAA,cACP;AAAA,YACD,CAAC;AACD;AAAA,UACD;AACA,gBAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,KAAK;AAAA,QACnD;AAAA,MACD;AAAA,IACD,OAAO;AACN,aAAO,CAAC,KAAK;AAAA,IACd;AAEA,WAAO,CAAC,UAAU;AAAA,EACnB;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../nodes/Google/Sheet/v2/methods/resourceMapping.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tILoadOptionsFunctions,\n\tResourceMapperField,\n\tResourceMapperFields,\n} from 'n8n-workflow';\n\nimport { GoogleSheet } from '../helpers/GoogleSheet';\nimport { ROW_NUMBER, type ResourceLocator } from '../helpers/GoogleSheets.types';\nimport { getSpreadsheetId } from '../helpers/GoogleSheets.utils';\n\nexport async function getMappingColumns(\n\tthis: ILoadOptionsFunctions,\n): Promise<ResourceMapperFields> {\n\tconst documentId = this.getNodeParameter('documentId', 0) as IDataObject | null;\n\n\tif (!documentId) return { fields: [] };\n\n\tconst { mode, value } = documentId;\n\n\tconst spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);\n\n\tconst sheet = new GoogleSheet(spreadsheetId, this);\n\tconst sheetWithinDocument = this.getNodeParameter('sheetName', undefined, {\n\t\textractValue: true,\n\t}) as string;\n\tconst { mode: sheetMode } = this.getNodeParameter('sheetName', 0) as { mode: ResourceLocator };\n\n\tconst { title: sheetName } = await sheet.spreadsheetGetSheet(\n\t\tthis.getNode(),\n\t\tsheetMode,\n\t\tsheetWithinDocument,\n\t);\n\n\tconst locationDefine = this.getNodeParameter(\n\t\t'options.locationDefine.values',\n\t\t0,\n\t\t{},\n\t) as IDataObject;\n\n\tlet columnNamesRow = 1;\n\n\tif (locationDefine.headerRow) {\n\t\tcolumnNamesRow = locationDefine.headerRow as number;\n\t}\n\n\tconst sheetData = await sheet.getData(\n\t\t`${sheetName}!${columnNamesRow}:${columnNamesRow}`,\n\t\t'FORMATTED_VALUE',\n\t);\n\n\tconst columns = sheet.testFilter(sheetData || [], 0, 0).filter((col) => col !== '');\n\n\tconst fields: ResourceMapperField[] = columns.map((col) => ({\n\t\tid: col,\n\t\tdisplayName: col,\n\t\trequired: false,\n\t\tdefaultMatch: col === 'id',\n\t\tdisplay: true,\n\t\ttype: 'string',\n\t\tcanBeUsedToMatch: true,\n\t}));\n\n\tconst operation = this.getNodeParameter('operation', 0) as string;\n\n\tif (operation === 'update') {\n\t\tfields.push({\n\t\t\tid: ROW_NUMBER,\n\t\t\tdisplayName: ROW_NUMBER,\n\t\t\trequired: false,\n\t\t\tdefaultMatch: false,\n\t\t\tdisplay: true,\n\t\t\ttype: '
|
|
1
|
+
{"version":3,"sources":["../../../../../../nodes/Google/Sheet/v2/methods/resourceMapping.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tILoadOptionsFunctions,\n\tResourceMapperField,\n\tResourceMapperFields,\n} from 'n8n-workflow';\n\nimport { GoogleSheet } from '../helpers/GoogleSheet';\nimport { ROW_NUMBER, type ResourceLocator } from '../helpers/GoogleSheets.types';\nimport { getSpreadsheetId } from '../helpers/GoogleSheets.utils';\n\nexport async function getMappingColumns(\n\tthis: ILoadOptionsFunctions,\n): Promise<ResourceMapperFields> {\n\tconst documentId = this.getNodeParameter('documentId', 0) as IDataObject | null;\n\n\tif (!documentId) return { fields: [] };\n\n\tconst { mode, value } = documentId;\n\n\tconst spreadsheetId = getSpreadsheetId(this.getNode(), mode as ResourceLocator, value as string);\n\n\tconst sheet = new GoogleSheet(spreadsheetId, this);\n\tconst sheetWithinDocument = this.getNodeParameter('sheetName', undefined, {\n\t\textractValue: true,\n\t}) as string;\n\tconst { mode: sheetMode } = this.getNodeParameter('sheetName', 0) as { mode: ResourceLocator };\n\n\tconst { title: sheetName } = await sheet.spreadsheetGetSheet(\n\t\tthis.getNode(),\n\t\tsheetMode,\n\t\tsheetWithinDocument,\n\t);\n\n\tconst locationDefine = this.getNodeParameter(\n\t\t'options.locationDefine.values',\n\t\t0,\n\t\t{},\n\t) as IDataObject;\n\n\tlet columnNamesRow = 1;\n\n\tif (locationDefine.headerRow) {\n\t\tcolumnNamesRow = locationDefine.headerRow as number;\n\t}\n\n\tconst sheetData = await sheet.getData(\n\t\t`${sheetName}!${columnNamesRow}:${columnNamesRow}`,\n\t\t'FORMATTED_VALUE',\n\t);\n\n\tconst columns = sheet.testFilter(sheetData || [], 0, 0).filter((col) => col !== '');\n\n\tconst fields: ResourceMapperField[] = columns.map((col) => ({\n\t\tid: col,\n\t\tdisplayName: col,\n\t\trequired: false,\n\t\tdefaultMatch: col === 'id',\n\t\tdisplay: true,\n\t\ttype: 'string',\n\t\tcanBeUsedToMatch: true,\n\t}));\n\n\tconst operation = this.getNodeParameter('operation', 0) as string;\n\n\tif (operation === 'update') {\n\t\tfields.push({\n\t\t\tid: ROW_NUMBER,\n\t\t\tdisplayName: ROW_NUMBER,\n\t\t\trequired: false,\n\t\t\tdefaultMatch: false,\n\t\t\tdisplay: true,\n\t\t\ttype: 'number',\n\t\t\tcanB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ACN,kBAAkB;AAAA,EACnB,EAAE;AAEF,QAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,MAAI,cAAc,UAAU;AAC3B,WAAO,KAAK;AAAA,MACX,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,UAAU;AAAA,MACV,cAAc;AAAA,MACd,SAAS;AAAA,MACT,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,UAAU;AAAA,MACV,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAEA,SAAO,EAAE,OAAO;AACjB;","names":["import_GoogleSheets"]}
|
|
@@ -50,8 +50,7 @@ class MicrosoftSharePoint {
|
|
|
50
50
|
}
|
|
51
51
|
],
|
|
52
52
|
requestDefaults: {
|
|
53
|
-
baseURL: "=https://{{ $credentials.subdomain }}.sharepoint.com/_api/v2.0/"
|
|
54
|
-
ignoreHttpStatusErrors: true
|
|
53
|
+
baseURL: "=https://{{ $credentials.subdomain }}.sharepoint.com/_api/v2.0/"
|
|
55
54
|
},
|
|
56
55
|
properties: [
|
|
57
56
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.ts"],"sourcesContent":["import type { INodeType, INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { file, item, list } from './descriptions';\nimport { listSearch, resourceMapping } from './methods';\n\nexport class MicrosoftSharePoint implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Microsoft SharePoint',\n\t\tname: 'microsoftSharePoint',\n\t\ticon: {\n\t\t\tlight: 'file:microsoftSharePoint.svg',\n\t\t\tdark: 'file:microsoftSharePoint.svg',\n\t\t},\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\t\tdescription: 'Interact with Microsoft SharePoint API',\n\t\tdefaults: {\n\t\t\tname: 'Microsoft SharePoint',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'microsoftSharePointOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tbaseURL: '=https://{{ $credentials.subdomain }}.sharepoint.com/_api/v2.0/',\n\t\t
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.ts"],"sourcesContent":["import type { INodeType, INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { file, item, list } from './descriptions';\nimport { listSearch, resourceMapping } from './methods';\n\nexport class MicrosoftSharePoint implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Microsoft SharePoint',\n\t\tname: 'microsoftSharePoint',\n\t\ticon: {\n\t\t\tlight: 'file:microsoftSharePoint.svg',\n\t\t\tdark: 'file:microsoftSharePoint.svg',\n\t\t},\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\t\tdescription: 'Interact with Microsoft SharePoint API',\n\t\tdefaults: {\n\t\t\tname: 'Microsoft SharePoint',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'microsoftSharePointOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tbaseURL: '=https://{{ $credentials.subdomain }}.sharepoint.com/_api/v2.0/',\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: 'File',\n\t\t\t\t\t\tvalue: 'file',\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\t{\n\t\t\t\t\t\tname: 'List',\n\t\t\t\t\t\tvalue: 'list',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'file',\n\t\t\t},\n\n\t\t\t...file.description,\n\t\t\t...item.description,\n\t\t\t...list.description,\n\t\t],\n\t};\n\n\tmethods = {\n\t\tlistSearch,\n\t\tresourceMapping,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAoC;AAEpC,0BAAiC;AACjC,qBAA4C;AAErC,MAAM,oBAAyC;AAAA,EAA/C;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,cAAc;AAAA,MACd,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,SAAS;AAAA,MACV;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,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,QAEA,GAAG,yBAAK;AAAA,QACR,GAAG,yBAAK;AAAA,QACR,GAAG,yBAAK;AAAA,MACT;AAAA,IACD;AAEA,mBAAU;AAAA,MACT;AAAA,MACA;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/Microsoft/Sql/GenericFunctions.ts"],"sourcesContent":["import type { IResult } from 'mssql';\nimport mssql from 'mssql';\nimport type { IDataObject, INodeExecutionData } from 'n8n-workflow';\nimport { deepCopy } from 'n8n-workflow';\n\nimport { chunk, flatten } from '@utils/utilities';\n\nimport type { ITables, OperationInputData } from './interfaces';\n\n/**\n * Returns a copy of the item which only contains the json data and\n * of that only the defined properties\n *\n * @param {INodeExecutionData} item The item to copy\n * @param {string[]} properties The properties it should include\n */\nexport function copyInputItem(item: INodeExecutionData, properties: string[]): IDataObject {\n\t// Prepare the data to insert and copy it to be returned\n\tconst newItem: IDataObject = {};\n\tfor (const property of properties) {\n\t\tif (item.json[property] === undefined) {\n\t\t\tnewItem[property] = null;\n\t\t} else {\n\t\t\tnewItem[property] = deepCopy(item.json[property]);\n\t\t}\n\t}\n\treturn newItem;\n}\n\n/**\n * Creates an ITables with the columns for the operations\n *\n * @param {INodeExecutionData[]} items The items to extract the tables/columns for\n * @param {function} getNodeParam getter for the Node's Parameters\n */\nexport function createTableStruct(\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\tgetNodeParam: Function,\n\titems: INodeExecutionData[],\n\tadditionalProperties: string[] = [],\n\tkeyName?: string,\n): ITables {\n\treturn items.reduce((tables, item, index) => {\n\t\tconst table = getNodeParam('table', index) as string;\n\t\tconst columnString = getNodeParam('columns', index) as string;\n\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\t\tconst itemCopy = copyInputItem(item, columns.concat(additionalProperties));\n\t\tconst keyParam = keyName ? (getNodeParam(keyName, index) as string) : undefined;\n\t\tif (tables[table] === undefined) {\n\t\t\ttables[table] = {};\n\t\t}\n\t\tif (tables[table][columnString] === undefined) {\n\t\t\ttables[table][columnString] = [];\n\t\t}\n\t\tif (keyName) {\n\t\t\titemCopy[keyName] = keyParam;\n\t\t}\n\t\ttables[table][columnString].push(itemCopy);\n\t\treturn tables;\n\t}, {} as ITables);\n}\n\n/**\n * Executes a queue of queries on given ITables.\n *\n * @param {ITables} tables The ITables to be processed.\n * @param {function} buildQueryQueue function that builds the queue of promises\n */\nexport async function executeQueryQueue(\n\ttables: ITables,\n\tbuildQueryQueue: (data: OperationInputData) => Array<Promise<object>>,\n): Promise<any[]> {\n\treturn await Promise.all(\n\t\tObject.keys(tables).map(async (table) => {\n\t\t\tconst columnsResults = Object.keys(tables[table]).map(async (columnString) => {\n\t\t\t\treturn await Promise.all(\n\t\t\t\t\tbuildQueryQueue({\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\tcolumnString,\n\t\t\t\t\t\titems: tables[table][columnString],\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\t\t\treturn await Promise.all(columnsResults);\n\t\t}),\n\t);\n}\n\nexport function formatColumns(columns: string) {\n\treturn columns\n\t\t.split(',')\n\t\t.map((column) => `[${column.trim()}]`)\n\t\t.join(', ');\n}\n\nexport function configurePool(credentials: IDataObject) {\n\tconst config = {\n\t\tserver: credentials.server as string,\n\t\tport: credentials.port as number,\n\t\tdatabase: credentials.database as string,\n\t\tuser: credentials.user as string,\n\t\tpassword: credentials.password as string,\n\t\tdomain: credentials.domain ? (credentials.domain as string) : undefined,\n\t\tconnectionTimeout: credentials.connectTimeout as number,\n\t\trequestTimeout: credentials.requestTimeout as number,\n\t\toptions: {\n\t\t\tencrypt: credentials.tls as boolean,\n\t\t\tenableArithAbort: false,\n\t\t\ttdsVersion: credentials.tdsVersion as string,\n\t\t\ttrustServerCertificate: credentials.allowUnauthorizedCerts as boolean,\n\t\t},\n\t};\n\n\treturn new mssql.ConnectionPool(config);\n}\n\nconst escapeTableName = (table: string) => {\n\ttable = table.trim();\n\tif (table.startsWith('[') && table.endsWith(']')) {\n\t\treturn table;\n\t} else {\n\t\treturn `[${table}]`;\n\t}\n};\n\nconst MSSQL_PARAMETER_LIMIT = 2100;\n\nexport function mssqlChunk(rows: IDataObject[]): IDataObject[][] {\n\tconst chunked: IDataObject[][] = [[]];\n\tlet currentParamCount = 0;\n\n\tfor (const row of rows) {\n\t\tconst rowValues = Object.values(row);\n\t\tconst valueCount = rowValues.length;\n\n\t\tif (currentParamCount + valueCount >= MSSQL_PARAMETER_LIMIT) {\n\t\t\tchunked.push([]);\n\t\t\tcurrentParamCount = 0;\n\t\t}\n\n\t\tchunked[chunked.length - 1].push(row);\n\n\t\tcurrentParamCount += valueCount;\n\t}\n\n\treturn chunked;\n}\n\nexport async function insertOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\treturn await executeQueryQueue(\n\t\ttables,\n\t\t({ table, columnString, items }: OperationInputData): Array<Promise<object>> => {\n\t\t\treturn mssqlChunk(items).map(async (insertValues) => {\n\t\t\t\tconst request = pool.request();\n\n\t\t\t\tconst valuesPlaceholder = [];\n\n\t\t\t\tfor (const [rIndex, entry] of insertValues.entries()) {\n\t\t\t\t\tconst row = Object.values(entry);\n\t\t\t\t\tvaluesPlaceholder.push(`(${row.map((_, vIndex) => `@r${rIndex}v${vIndex}`).join(', ')})`);\n\t\t\t\t\tfor (const [vIndex, value] of row.entries()) {\n\t\t\t\t\t\trequest.input(`r${rIndex}v${vIndex}`, value);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst query = `INSERT INTO ${escapeTableName(table)} (${formatColumns(\n\t\t\t\t\tcolumnString,\n\t\t\t\t)}) VALUES ${valuesPlaceholder.join(', ')};`;\n\n\t\t\t\treturn await request.query(query);\n\t\t\t});\n\t\t},\n\t);\n}\n\nexport async function updateOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\treturn await executeQueryQueue(\n\t\ttables,\n\t\t({ table, columnString, items }: OperationInputData): Array<Promise<object>> => {\n\t\t\treturn items.map(async (item) => {\n\t\t\t\tconst request = pool.request();\n\t\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\n\t\t\t\tconst setValues: string[] = [];\n\t\t\t\tconst condition = `${item.updateKey} = @condition`;\n\t\t\t\trequest.input('condition', item[item.updateKey as string]);\n\n\t\t\t\tfor (const [index, col] of columns.entries()) {\n\t\t\t\t\tsetValues.push(`[${col}] = @v${index}`);\n\t\t\t\t\trequest.input(`v${index}`, item[col]);\n\t\t\t\t}\n\n\t\t\t\tconst query = `UPDATE ${escapeTableName(table)} SET ${setValues.join(\n\t\t\t\t\t', ',\n\t\t\t\t)} WHERE ${condition};`;\n\n\t\t\t\treturn await request.query(query);\n\t\t\t});\n\t\t},\n\t);\n}\n\nexport async function deleteOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\tconst queriesResults = await Promise.all(\n\t\tObject.keys(tables).map(async (table) => {\n\t\t\tconst deleteKeyResults = Object.keys(tables[table]).map(async (deleteKey) => {\n\t\t\t\tconst deleteItemsList = chunk(\n\t\t\t\t\ttables[table][deleteKey].map((item) =>\n\t\t\t\t\t\tcopyInputItem(item as INodeExecutionData, [deleteKey]),\n\t\t\t\t\t),\n\t\t\t\t\t1000,\n\t\t\t\t);\n\t\t\t\tconst queryQueue = deleteItemsList.map(async (deleteValues) => {\n\t\t\t\t\tconst request = pool.request();\n\t\t\t\t\tconst valuesPlaceholder: string[] = [];\n\n\t\t\t\t\tfor (const [index, entry] of deleteValues.entries()) {\n\t\t\t\t\t\tvaluesPlaceholder.push(`@v${index}`);\n\t\t\t\t\t\trequest.input(`v${index}`, entry[deleteKey]);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst query = `DELETE FROM ${escapeTableName(\n\t\t\t\t\t\ttable,\n\t\t\t\t\t)} WHERE [${deleteKey}] IN (${valuesPlaceholder.join(', ')});`;\n\n\t\t\t\t\treturn await request.query(query);\n\t\t\t\t});\n\t\t\t\treturn await Promise.all(queryQueue);\n\t\t\t});\n\t\t\treturn await Promise.all(deleteKeyResults);\n\t\t}),\n\t);\n\n\treturn flatten(queriesResults).reduce(\n\t\t(acc: number, resp: mssql.IResult<object>): number =>\n\t\t\t(acc += resp.rowsAffected.reduce((sum, val) => (sum += val))),\n\t\t0,\n\t);\n}\n\nexport async function executeSqlQueryAndPrepareResults(\n\tpool: mssql.ConnectionPool,\n\trawQuery: string,\n\titemIndex: number,\n): Promise<INodeExecutionData[]> {\n\tconst rawResult: IResult<any> = await pool.request().query(rawQuery);\n\tconst { recordsets, rowsAffected } = rawResult;\n\tif (Array.isArray(recordsets) && recordsets.length > 0) {\n\t\tconst result: IDataObject[] = recordsets.length > 1 ? flatten(recordsets) : recordsets[0];\n\n\t\treturn result.map((entry) => ({\n\t\t\tjson: entry,\n\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t}));\n\t} else if (rowsAffected && rowsAffected.length > 0) {\n\t\t// Handle non-SELECT queries (e.g., INSERT, UPDATE, DELETE)\n\t\treturn rowsAffected.map((affectedRows, idx) => ({\n\t\t\tjson: {\n\t\t\t\tmessage: `Query ${idx + 1} executed successfully`,\n\t\t\t\trowsAffected: affectedRows,\n\t\t\t},\n\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t}));\n\t} else {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: { message: 'Query executed successfully, but no rows were affected' },\n\t\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,0BAAyB;AAEzB,uBAA+B;AAWxB,SAAS,cAAc,MAA0B,YAAmC;AAE1F,QAAM,UAAuB,CAAC;AAC9B,a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a,SACZ,OAAO,KAAK,aAAa,OAAO,CAAC,KAAK,QAAS,OAAO,GAAI;AAAA,IAC5D;AAAA,EACD;AACD;AAEA,eAAsB,iCACrB,MACA,UACA,WACgC;AAChC,QAAM,YAA0B,MAAM,KAAK,QAAQ,EAAE,MAAM,QAAQ;AACnE,QAAM,EAAE,YAAY,aAAa,IAAI;AACrC,MAAI,MAAM,QAAQ,UAAU,KAAK,WAAW,SAAS,GAAG;AACvD,UAAM,SAAwB,WAAW,SAAS,QAAI,0BAAQ,UAAU,IAAI,WAAW,CAAC;AAExF,WAAO,OAAO,IAAI,CAAC,WAAW;AAAA,MAC7B,MAAM;AAAA,MACN,YAAY,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,IACjC,EAAE;AAAA,EACH,WAAW,gBAAgB,aAAa,SAAS,GAAG;AAEnD,WAAO,aAAa,IAAI,CAAC,cAAc,SAAS;AAAA,MAC/C,MAAM;AAAA,QACL,SAAS,SAAS,MAAM,CAAC;AAAA,QACzB,cAAc;AAAA,MACf;AAAA,MACA,YAAY,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,IACjC,EAAE;AAAA,EACH,OAAO;AACN,WAAO;AAAA,MACN;AAAA,QACC,MAAM,EAAE,SAAS,yDAAyD;AAAA,QAC1E,YAAY,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,MACjC;AAAA,IACD;AAAA,EACD;AACD;","names":["mssql"]}
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Microsoft/Sql/GenericFunctions.ts"],"sourcesContent":["import type { IResult } from 'mssql';\nimport mssql from 'mssql';\nimport type { IDataObject, INodeExecutionData } from 'n8n-workflow';\nimport { deepCopy } from 'n8n-workflow';\n\nimport { chunk, flatten } from '@utils/utilities';\n\nimport type { ITables, OperationInputData } from './interfaces';\n\n/**\n * Returns a copy of the item which only contains the json data and\n * of that only the defined properties\n *\n * @param {INodeExecutionData} item The item to copy\n * @param {string[]} properties The properties it should include\n */\nexport function copyInputItem(item: INodeExecutionData, properties: string[]): IDataObject {\n\t// Prepare the data to insert and copy it to be returned\n\tconst newItem: IDataObject = {};\n\tfor (const property of properties) {\n\t\tif (item.json[property] === undefined) {\n\t\t\tnewItem[property] = null;\n\t\t} else {\n\t\t\tnewItem[property] = deepCopy(item.json[property]);\n\t\t}\n\t}\n\treturn newItem;\n}\n\n/**\n * Creates an ITables with the columns for the operations\n *\n * @param {INodeExecutionData[]} items The items to extract the tables/columns for\n * @param {function} getNodeParam getter for the Node's Parameters\n */\nexport function createTableStruct(\n\t// eslint-disable-next-line @typescript-eslint/no-restricted-types\n\tgetNodeParam: Function,\n\titems: INodeExecutionData[],\n\tadditionalProperties: string[] = [],\n\tkeyName?: string,\n): ITables {\n\treturn items.reduce((tables, item, index) => {\n\t\tconst table = getNodeParam('table', index) as string;\n\t\tconst columnString = getNodeParam('columns', index) as string;\n\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\t\tconst itemCopy = copyInputItem(item, columns.concat(additionalProperties));\n\t\tconst keyParam = keyName ? (getNodeParam(keyName, index) as string) : undefined;\n\t\tif (tables[table] === undefined) {\n\t\t\ttables[table] = {};\n\t\t}\n\t\tif (tables[table][columnString] === undefined) {\n\t\t\ttables[table][columnString] = [];\n\t\t}\n\t\tif (keyName) {\n\t\t\titemCopy[keyName] = keyParam;\n\t\t}\n\t\ttables[table][columnString].push(itemCopy);\n\t\treturn tables;\n\t}, {} as ITables);\n}\n\n/**\n * Executes a queue of queries on given ITables.\n *\n * @param {ITables} tables The ITables to be processed.\n * @param {function} buildQueryQueue function that builds the queue of promises\n */\nexport async function executeQueryQueue(\n\ttables: ITables,\n\tbuildQueryQueue: (data: OperationInputData) => Array<Promise<object>>,\n): Promise<any[]> {\n\treturn await Promise.all(\n\t\tObject.keys(tables).map(async (table) => {\n\t\t\tconst columnsResults = Object.keys(tables[table]).map(async (columnString) => {\n\t\t\t\treturn await Promise.all(\n\t\t\t\t\tbuildQueryQueue({\n\t\t\t\t\t\ttable,\n\t\t\t\t\t\tcolumnString,\n\t\t\t\t\t\titems: tables[table][columnString],\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\t\t\treturn await Promise.all(columnsResults);\n\t\t}),\n\t);\n}\n\nexport function formatColumns(columns: string) {\n\treturn columns\n\t\t.split(',')\n\t\t.map((column) => `[${column.trim()}]`)\n\t\t.join(', ');\n}\n\nexport function configurePool(credentials: IDataObject) {\n\tconst config = {\n\t\tserver: credentials.server as string,\n\t\tport: credentials.port as number,\n\t\tdatabase: credentials.database as string,\n\t\tuser: credentials.user as string,\n\t\tpassword: credentials.password as string,\n\t\tdomain: credentials.domain ? (credentials.domain as string) : undefined,\n\t\tconnectionTimeout: credentials.connectTimeout as number,\n\t\trequestTimeout: credentials.requestTimeout as number,\n\t\toptions: {\n\t\t\tencrypt: credentials.tls as boolean,\n\t\t\tenableArithAbort: false,\n\t\t\ttdsVersion: credentials.tdsVersion as string,\n\t\t\ttrustServerCertificate: credentials.allowUnauthorizedCerts as boolean,\n\t\t},\n\t};\n\n\treturn new mssql.ConnectionPool(config);\n}\n\nconst escapeTableName = (table: string) => {\n\ttable = table.trim();\n\tif (table.startsWith('[') && table.endsWith(']')) {\n\t\treturn table;\n\t} else {\n\t\treturn `[${table}]`;\n\t}\n};\n\nconst MSSQL_PARAMETER_LIMIT = 2100;\n\nexport function mssqlChunk(rows: IDataObject[]): IDataObject[][] {\n\tconst chunked: IDataObject[][] = [[]];\n\tlet currentParamCount = 0;\n\n\tfor (const row of rows) {\n\t\tconst rowValues = Object.values(row);\n\t\tconst valueCount = rowValues.length;\n\n\t\tif (currentParamCount + valueCount >= MSSQL_PARAMETER_LIMIT) {\n\t\t\tchunked.push([]);\n\t\t\tcurrentParamCount = 0;\n\t\t}\n\n\t\tchunked[chunked.length - 1].push(row);\n\n\t\tcurrentParamCount += valueCount;\n\t}\n\n\treturn chunked;\n}\n\nexport async function insertOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\treturn await executeQueryQueue(\n\t\ttables,\n\t\t({ table, columnString, items }: OperationInputData): Array<Promise<object>> => {\n\t\t\treturn mssqlChunk(items).map(async (insertValues) => {\n\t\t\t\tconst request = pool.request();\n\n\t\t\t\tconst valuesPlaceholder = [];\n\n\t\t\t\tfor (const [rIndex, entry] of insertValues.entries()) {\n\t\t\t\t\tconst row = Object.values(entry);\n\t\t\t\t\tvaluesPlaceholder.push(`(${row.map((_, vIndex) => `@r${rIndex}v${vIndex}`).join(', ')})`);\n\t\t\t\t\tfor (const [vIndex, value] of row.entries()) {\n\t\t\t\t\t\trequest.input(`r${rIndex}v${vIndex}`, value);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst query = `INSERT INTO ${escapeTableName(table)} (${formatColumns(\n\t\t\t\t\tcolumnString,\n\t\t\t\t)}) VALUES ${valuesPlaceholder.join(', ')};`;\n\n\t\t\t\treturn await request.query(query);\n\t\t\t});\n\t\t},\n\t);\n}\n\nexport async function updateOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\treturn await executeQueryQueue(\n\t\ttables,\n\t\t({ table, columnString, items }: OperationInputData): Array<Promise<object>> => {\n\t\t\treturn items.map(async (item) => {\n\t\t\t\tconst request = pool.request();\n\t\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\n\t\t\t\tconst setValues: string[] = [];\n\t\t\t\tconst condition = `${item.updateKey} = @condition`;\n\t\t\t\trequest.input('condition', item[item.updateKey as string]);\n\n\t\t\t\tfor (const [index, col] of columns.entries()) {\n\t\t\t\t\tsetValues.push(`[${col}] = @v${index}`);\n\t\t\t\t\trequest.input(`v${index}`, item[col]);\n\t\t\t\t}\n\n\t\t\t\tconst query = `UPDATE ${escapeTableName(table)} SET ${setValues.join(\n\t\t\t\t\t', ',\n\t\t\t\t)} WHERE ${condition};`;\n\n\t\t\t\treturn await request.query(query);\n\t\t\t});\n\t\t},\n\t);\n}\n\nexport async function deleteOperation(tables: ITables, pool: mssql.ConnectionPool) {\n\tconst queriesResults = await Promise.all(\n\t\tObject.keys(tables).map(async (table) => {\n\t\t\tconst deleteKeyResults = Object.keys(tables[table]).map(async (deleteKey) => {\n\t\t\t\tconst deleteItemsList = chunk(\n\t\t\t\t\ttables[table][deleteKey].map((item) =>\n\t\t\t\t\t\tcopyInputItem(item as INodeExecutionData, [deleteKey]),\n\t\t\t\t\t),\n\t\t\t\t\t1000,\n\t\t\t\t);\n\t\t\t\tconst queryQueue = deleteItemsList.map(async (deleteValues) => {\n\t\t\t\t\tconst request = pool.request();\n\t\t\t\t\tconst valuesPlaceholder: string[] = [];\n\n\t\t\t\t\tfor (const [index, entry] of deleteValues.entries()) {\n\t\t\t\t\t\tvaluesPlaceholder.push(`@v${index}`);\n\t\t\t\t\t\trequest.input(`v${index}`, entry[deleteKey]);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst query = `DELETE FROM ${escapeTableName(\n\t\t\t\t\t\ttable,\n\t\t\t\t\t)} WHERE [${deleteKey}] IN (${valuesPlaceholder.join(', ')});`;\n\n\t\t\t\t\treturn await request.query(query);\n\t\t\t\t});\n\t\t\t\treturn await Promise.all(queryQueue);\n\t\t\t});\n\t\t\treturn await Promise.all(deleteKeyResults);\n\t\t}),\n\t);\n\n\treturn flatten(queriesResults).reduce(\n\t\t(acc: number, resp: mssql.IResult<object>): number =>\n\t\t\t(acc += resp.rowsAffected.reduce((sum, val) => (sum += val))),\n\t\t0,\n\t);\n}\n\nexport async function executeSqlQueryAndPrepareResults(\n\tpool: mssql.ConnectionPool,\n\trawQuery: string,\n\titemIndex: number,\n): Promise<INodeExecutionData[]> {\n\tconst rawResult: IResult<any> = await pool.request().query(rawQuery);\n\tconst { recordsets, rowsAffected } = rawResult;\n\tif (Array.isArray(recordsets) && recordsets.length > 0) {\n\t\tconst result: IDataObject[] = recordsets.length > 1 ? flatten(recordsets) : recordsets[0];\n\n\t\treturn result.map((entry) => ({\n\t\t\tjson: entry,\n\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t}));\n\t} else if (rowsAffected && rowsAffected.length > 0) {\n\t\t// Handle non-SELECT queries (e.g., INSERT, UPDATE, DELETE)\n\t\treturn rowsAffected.map((affectedRows, idx) => ({\n\t\t\tjson: {\n\t\t\t\tmessage: `Query ${idx + 1} executed successfully`,\n\t\t\t\trowsAffected: affectedRows,\n\t\t\t},\n\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t}));\n\t} else {\n\t\treturn [\n\t\t\t{\n\t\t\t\tjson: { message: 'Query executed successfully, but no rows were affected' },\n\t\t\t\tpairedItem: [{ item: itemIndex }],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,0BAAyB;AAEzB,uBAA+B;AAWxB,SAAS,cAAc,MAA0B,YAAmC;AAE1F,QAAM,UAAuB,CAAC;AAC9B,aAAW,YAAY,YAAY;AAClC,QAAI,KAAK,KAAK,QAAQ,MAAM,QAAW;AACtC,cAAQ,QAAQ,IAAI;AAAA,IACrB,OAAO;AACN,cAAQ,QAAQ,QAAI,8BAAS,KAAK,KAAK,QAAQ,CAAC;AAAA,IACjD;AAAA,EACD;AACA,SAAO;AACR;AAQO,SAAS,kBAEf,cACA,OACA,uBAAiC,CAAC,GAClC,SACU;AACV,SAAO,MAAM,OAAO,CAAC,QAAQ,MAAM,UAAU;AAC5C,UAAM,QAAQ,aAAa,SAAS,KAAK;AACzC,UAAM,eAAe,aAAa,WAAW,KAAK;AAClD,UAAM,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC;AACrE,UAAM,WAAW,cAAc,MAAM,QAAQ,OAAO,oBAAoB,CAAC;AACzE,UAAM,WAAW,UAAW,aAAa,SAAS,KAAK,IAAe;AACtE,QAAI,OAAO,KAAK,MAAM,QAAW;AAChC,aAAO,KAAK,IAAI,CAAC;AAAA,IAClB;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A,MACA,YAAY,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,IACjC,EAAE;AAAA,EACH,OAAO;AACN,WAAO;AAAA,MACN;AAAA,QACC,MAAM,EAAE,SAAS,yDAAyD;AAAA,QAC1E,YAAY,CAAC,EAAE,MAAM,UAAU,CAAC;AAAA,MACjC;AAAA,IACD;AAAA,EACD;AACD;","names":["mssql"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Onfleet/Onfleet.node.ts"],"sourcesContent":["import {\n\ttype IExecuteFunctions,\n\ttype ICredentialsDecrypted,\n\ttype ICredentialTestFunctions,\n\ttype IDataObject,\n\ttype INodeCredentialTestResult,\n\ttype INodeExecutionData,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype IRequestOptions,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { adminFields, adminOperations } from './descriptions/AdministratorDescription';\nimport { containerFields, containerOperations } from './descriptions/ContainerDescription';\nimport { destinationFields, destinationOperations } from './descriptions/DestinationDescription';\nimport { hubFields, hubOperations } from './descriptions/HubDescription';\nimport { organizationFields, organizationOperations } from './descriptions/OrganizationDescription';\nimport { recipientFields, recipientOperations } from './descriptions/RecipientDescription';\nimport { taskFields, taskOperations } from './descriptions/TaskDescription';\nimport { teamFields, teamOperations } from './descriptions/TeamDescription';\nimport { workerFields, workerOperations } from './descriptions/WorkerDescription';\nimport { resourceLoaders } from './GenericFunctions';\nimport { Onfleet as OnfleetMethods } from './Onfleet';\nexport class Onfleet implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Onfleet',\n\t\tname: 'onfleet',\n\t\ticon: 'file:Onfleet.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tsubtitle: '={{$parameter[\"operation\"] + \": \" + $parameter[\"resource\"]}}',\n\t\tdescription: 'Consume Onfleet API',\n\t\tdefaults: {\n\t\t\tname: 'Onfleet',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'onfleetApi',\n\t\t\t\trequired: true,\n\t\t\t\ttestedBy: 'onfleetApiTest',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t// List of option resources\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: 'Admin',\n\t\t\t\t\t\tvalue: 'admin',\n\t\t\t\t\t},\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: 'Destination',\n\t\t\t\t\t\tvalue: 'destination',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Hub',\n\t\t\t\t\t\tvalue: 'hub',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Organization',\n\t\t\t\t\t\tvalue: 'organization',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Recipient',\n\t\t\t\t\t\tvalue: 'recipient',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Task',\n\t\t\t\t\t\tvalue: 'task',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Team',\n\t\t\t\t\t\tvalue: 'team',\n\t\t\t\t\t},\n\t\t\t\t\t// {\n\t\t\t\t\t// \tname: 'Webhook',\n\t\t\t\t\t// \tvalue: 'webhook',\n\t\t\t\t\t// },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Worker',\n\t\t\t\t\t\tvalue: 'worker',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'task',\n\t\t\t\tdescription: 'The resource to perform operations on',\n\t\t\t},\n\t\t\t// Operations & fields\n\t\t\t...adminOperations,\n\t\t\t...adminFields,\n\t\t\t...containerOperations,\n\t\t\t...containerFields,\n\t\t\t...destinationOperations,\n\t\t\t...destinationFields,\n\t\t\t...hubOperations,\n\t\t\t...hubFields,\n\t\t\t...organizationOperations,\n\t\t\t...organizationFields,\n\t\t\t...recipientOperations,\n\t\t\t...recipientFields,\n\t\t\t...taskOperations,\n\t\t\t...taskFields,\n\t\t\t...teamOperations,\n\t\t\t...teamFields,\n\t\t\t// ...webhookOperations,\n\t\t\t// ...webhookFields,\n\t\t\t...workerOperations,\n\t\t\t...workerFields,\n\t\t],\n\t};\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync onfleetApiTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tconst credentials = credential.data as IDataObject;\n\n\t\t\t\tconst options: IRequestOptions = {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\t'User-Agent': 'n8n-onfleet',\n\t\t\t\t\t},\n\t\t\t\t\tauth: {\n\t\t\t\t\t\tuser: credentials.apiKey as string,\n\t\t\t\t\t\tpass: '',\n\t\t\t\t\t},\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\turi: 'https://onfleet.com/api/v2/auth/test',\n\t\t\t\t\tjson: true,\n\t\t\t\t};\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.helpers.request(options);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Authentication successful',\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: `Auth settings are not valid: ${error}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tloadOptions: resourceLoaders,\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst resource = this.getNodeParameter('resource', 0);\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\t\tconst items = this.getInputData();\n\n\t\t// eslint-disable-next-line @typescript-eslint/
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Onfleet/Onfleet.node.ts"],"sourcesContent":["import {\n\ttype IExecuteFunctions,\n\ttype ICredentialsDecrypted,\n\ttype ICredentialTestFunctions,\n\ttype IDataObject,\n\ttype INodeCredentialTestResult,\n\ttype INodeExecutionData,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype IRequestOptions,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { adminFields, adminOperations } from './descriptions/AdministratorDescription';\nimport { containerFields, containerOperations } from './descriptions/ContainerDescription';\nimport { destinationFields, destinationOperations } from './descriptions/DestinationDescription';\nimport { hubFields, hubOperations } from './descriptions/HubDescription';\nimport { organizationFields, organizationOperations } from './descriptions/OrganizationDescription';\nimport { recipientFields, recipientOperations } from './descriptions/RecipientDescription';\nimport { taskFields, taskOperations } from './descriptions/TaskDescription';\nimport { teamFields, teamOperations } from './descriptions/TeamDescription';\nimport { workerFields, workerOperations } from './descriptions/WorkerDescription';\nimport { resourceLoaders } from './GenericFunctions';\nimport { Onfleet as OnfleetMethods } from './Onfleet';\nexport class Onfleet implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Onfleet',\n\t\tname: 'onfleet',\n\t\ticon: 'file:Onfleet.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tsubtitle: '={{$parameter[\"operation\"] + \": \" + $parameter[\"resource\"]}}',\n\t\tdescription: 'Consume Onfleet API',\n\t\tdefaults: {\n\t\t\tname: 'Onfleet',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'onfleetApi',\n\t\t\t\trequired: true,\n\t\t\t\ttestedBy: 'onfleetApiTest',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t// List of option resources\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: 'Admin',\n\t\t\t\t\t\tvalue: 'admin',\n\t\t\t\t\t},\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: 'Destination',\n\t\t\t\t\t\tvalue: 'destination',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Hub',\n\t\t\t\t\t\tvalue: 'hub',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Organization',\n\t\t\t\t\t\tvalue: 'organization',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Recipient',\n\t\t\t\t\t\tvalue: 'recipient',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Task',\n\t\t\t\t\t\tvalue: 'task',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Team',\n\t\t\t\t\t\tvalue: 'team',\n\t\t\t\t\t},\n\t\t\t\t\t// {\n\t\t\t\t\t// \tname: 'Webhook',\n\t\t\t\t\t// \tvalue: 'webhook',\n\t\t\t\t\t// },\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Worker',\n\t\t\t\t\t\tvalue: 'worker',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'task',\n\t\t\t\tdescription: 'The resource to perform operations on',\n\t\t\t},\n\t\t\t// Operations & fields\n\t\t\t...adminOperations,\n\t\t\t...adminFields,\n\t\t\t...containerOperations,\n\t\t\t...containerFields,\n\t\t\t...destinationOperations,\n\t\t\t...destinationFields,\n\t\t\t...hubOperations,\n\t\t\t...hubFields,\n\t\t\t...organizationOperations,\n\t\t\t...organizationFields,\n\t\t\t...recipientOperations,\n\t\t\t...recipientFields,\n\t\t\t...taskOperations,\n\t\t\t...taskFields,\n\t\t\t...teamOperations,\n\t\t\t...teamFields,\n\t\t\t// ...webhookOperations,\n\t\t\t// ...webhookFields,\n\t\t\t...workerOperations,\n\t\t\t...workerFields,\n\t\t],\n\t};\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync onfleetApiTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tconst credentials = credential.data as IDataObject;\n\n\t\t\t\tconst options: IRequestOptions = {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\t'User-Agent': 'n8n-onfleet',\n\t\t\t\t\t},\n\t\t\t\t\tauth: {\n\t\t\t\t\t\tuser: credentials.apiKey as string,\n\t\t\t\t\t\tpass: '',\n\t\t\t\t\t},\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\turi: 'https://onfleet.com/api/v2/auth/test',\n\t\t\t\t\tjson: true,\n\t\t\t\t};\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.helpers.request(options);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Authentication successful',\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: `Auth settings are not valid: ${error}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tloadOptions: resourceLoaders,\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst resource = this.getNodeParameter('resource', 0);\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\t\tconst items = this.getInputData();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-restricted-types\n\t\tconst operations: { [key: string]: Function } = {\n\t\t\ttask: OnfleetMethods.executeTaskOperations,\n\t\t\tdestination: OnfleetMethods.executeDestinationOperations,\n\t\t\torganization: OnfleetMethods.executeOrganizationOperations,\n\t\t\tadmin: OnfleetMethods.executeAdministratorOperations,\n\t\t\trecipient: OnfleetMethods.executeRecipientOperations,\n\t\t\thub: OnfleetMethods.executeHubOperations,\n\t\t\tworker: OnfleetMethods.executeWorkerOperations,\n\t\t\twebhook: OnfleetMethods.executeWebhookOperations,\n\t\t\tcontainer: OnfleetMethods.executeContainerOperations,\n\t\t\tteam: OnfleetMethods.executeTeamOperations,\n\t\t};\n\n\t\tconst responseData = await operations[resource].call(this, `${resource}s`, operation, items);\n\n\t\t// Map data to n8n data\n\t\treturn [this.helpers.returnJsonArray(responseData as IDataObject)];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAWO;AAEP,sCAA6C;AAC7C,kCAAqD;AACrD,oCAAyD;AACzD,4BAAyC;AACzC,qCAA2D;AAC3D,kCAAqD;AACrD,6BAA2C;AAC3C,6BAA2C;AAC3C,+BAA+C;AAC/C,8BAAgC;AAChC,qBAA0C;AACnC,MAAM,QAA6B;AAAA,EAAnC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,SAAS;AAAA,MACT,UAAU;AAAA,MACV,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,cAAc;AAAA,MACd,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,aAAa;AAAA,QACZ;AA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