n8n-nodes-matrix42 0.1.2 → 0.2.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.
Files changed (53) hide show
  1. package/README.md +74 -26
  2. package/dist/credentials/Matrix42BasicApi.credentials.d.ts +2 -1
  3. package/dist/credentials/Matrix42BasicApi.credentials.js +24 -4
  4. package/dist/credentials/Matrix42BasicApi.credentials.js.map +1 -1
  5. package/dist/credentials/Matrix42TokenApi.credentials.d.ts +5 -1
  6. package/dist/credentials/Matrix42TokenApi.credentials.js +51 -7
  7. package/dist/credentials/Matrix42TokenApi.credentials.js.map +1 -1
  8. package/dist/credentials/matrix42.svg +6 -0
  9. package/dist/nodes/Matrix42/GenericFunctions.d.ts +3 -2
  10. package/dist/nodes/Matrix42/GenericFunctions.js +21 -16
  11. package/dist/nodes/Matrix42/GenericFunctions.js.map +1 -1
  12. package/dist/nodes/Matrix42/Matrix42.node.d.ts +4 -1
  13. package/dist/nodes/Matrix42/Matrix42.node.js +186 -145
  14. package/dist/nodes/Matrix42/Matrix42.node.js.map +1 -1
  15. package/dist/nodes/Matrix42/Matrix42.node.json +18 -0
  16. package/dist/nodes/Matrix42/{Matrix42AsqlFunctions.d.ts → Matrix42DataFunctions.d.ts} +1 -1
  17. package/dist/nodes/Matrix42/{Matrix42AsqlFunctions.js → Matrix42DataFunctions.js} +54 -27
  18. package/dist/nodes/Matrix42/Matrix42DataFunctions.js.map +1 -0
  19. package/dist/nodes/Matrix42/Matrix42DataOperations.d.ts +3 -0
  20. package/dist/nodes/Matrix42/Matrix42DataOperations.js +433 -0
  21. package/dist/nodes/Matrix42/Matrix42DataOperations.js.map +1 -0
  22. package/dist/nodes/Matrix42/Matrix42DataQueryFunctions.d.ts +2 -0
  23. package/dist/nodes/Matrix42/Matrix42DataQueryFunctions.js +76 -0
  24. package/dist/nodes/Matrix42/Matrix42DataQueryFunctions.js.map +1 -0
  25. package/dist/nodes/Matrix42/Matrix42DataQueryOperations.d.ts +3 -0
  26. package/dist/nodes/Matrix42/Matrix42DataQueryOperations.js +214 -0
  27. package/dist/nodes/Matrix42/Matrix42DataQueryOperations.js.map +1 -0
  28. package/dist/nodes/Matrix42/Matrix42ImportFunctions.d.ts +1 -1
  29. package/dist/nodes/Matrix42/Matrix42ImportFunctions.js +4 -4
  30. package/dist/nodes/Matrix42/Matrix42ImportFunctions.js.map +1 -1
  31. package/dist/nodes/Matrix42/Matrix42ImportOperations.d.ts +1 -1
  32. package/dist/nodes/Matrix42/Matrix42ImportOperations.js +11 -12
  33. package/dist/nodes/Matrix42/Matrix42ImportOperations.js.map +1 -1
  34. package/dist/nodes/Matrix42/Matrix42StorageFunctions.d.ts +1 -1
  35. package/dist/nodes/Matrix42/Matrix42StorageFunctions.js +13 -8
  36. package/dist/nodes/Matrix42/Matrix42StorageFunctions.js.map +1 -1
  37. package/dist/nodes/Matrix42/Matrix42StorageOperations.d.ts +1 -1
  38. package/dist/nodes/Matrix42/Matrix42StorageOperations.js +23 -20
  39. package/dist/nodes/Matrix42/Matrix42StorageOperations.js.map +1 -1
  40. package/dist/nodes/Matrix42/Matrix42TicketFunctions.d.ts +2 -1
  41. package/dist/nodes/Matrix42/Matrix42TicketFunctions.js +102 -32
  42. package/dist/nodes/Matrix42/Matrix42TicketFunctions.js.map +1 -1
  43. package/dist/nodes/Matrix42/Matrix42TicketOperations.d.ts +1 -1
  44. package/dist/nodes/Matrix42/Matrix42TicketOperations.js +349 -171
  45. package/dist/nodes/Matrix42/Matrix42TicketOperations.js.map +1 -1
  46. package/dist/nodes/Matrix42/matrix42.dark.svg +6 -0
  47. package/dist/package.json +16 -7
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +64 -55
  50. package/dist/nodes/Matrix42/Matrix42AsqlFunctions.js.map +0 -1
  51. package/dist/nodes/Matrix42/Matrix42AsqlOperations.d.ts +0 -3
  52. package/dist/nodes/Matrix42/Matrix42AsqlOperations.js +0 -374
  53. package/dist/nodes/Matrix42/Matrix42AsqlOperations.js.map +0 -1
package/README.md CHANGED
@@ -21,40 +21,49 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
21
21
 
22
22
  This node supports multiple operations across different resources:
23
23
 
24
- ### Data Fragments (asql)
24
+ ### Data Fragment
25
25
 
26
- - **Get Fragments** (`getFragments`): Retrieve data fragments from a specified Data Definition.
26
+ - **Get Many** (`getAll`): Retrieve data fragments matching a search expression, with Return All / Limit paging.
27
27
 
28
- - **Add Fragment** (`addFragment`): Create a new data fragment in the specified Data Definition.
28
+ - **Create** (`create`): Create a new data fragment in the specified Data Definition.
29
29
 
30
- - **Update Fragment** (`updateFragment`): Update an existing data fragment by its ID.
30
+ - **Update** (`update`): Update an existing data fragment.
31
31
 
32
- - **Delete Fragment** (`deleteFragment`): Remove a data fragment by its ID.
32
+ - **Delete** (`delete`): Delete a data fragment by its ID.
33
33
 
34
34
 
35
- ### Data Objects (asql)
35
+ ### Data Object
36
36
 
37
- - **Add Object** (`addObject`): Create a new Data Object under a given fragment.
37
+ - **Create** (`create`): Create a new object for a Configuration Item.
38
38
 
39
- - **Get Object** (`getObject`): Retrieve a Data Object by its ID.
39
+ - **Get** (`get`): Retrieve a single object by its ID.
40
40
 
41
- - **Update Object** (`updateObject`): Update an existing Data Object by its ID.
41
+ - **Update** (`update`): Update an existing object.
42
42
 
43
- - **Delete Object** (`deleteObject`): Delete a Data Object by its ID.
43
+ - **Delete** (`delete`): Delete an object by its ID.
44
44
 
45
45
 
46
- ### Tickets
46
+ ### Data Query
47
47
 
48
- - **Create Ticket** (`createTicket`): Open a new ticket in the Service Desk.
48
+ - **Get Data** (`getData`): Read the list items of a data query, with Return All / paging (zero-based pages). Uses the `POST` variant so a structured **User Filters** group (`QueryFilterGroup`) can be passed in the body for ad-hoc filtering.
49
49
 
50
- - **Close Ticket** (`closeTicket`): Close an existing ticket by ID.
50
+ ### Ticket
51
51
 
52
- - **Transform Ticket** (`transformTicket`): Apply a transformation to a ticket.
52
+ - **Create** (`create`): Open a new ticket in the Service Desk (with a selectable initial **State**).
53
53
 
54
+ - **Close** (`close`): Close an Incident or Service Request.
55
+
56
+ - **Transform** (`transform`): Transform a ticket into another type.
57
+
58
+ - **Add Journal Entry** (`addJournalEntry`): Add a journal entry to a ticket.
59
+
60
+ ### Storage
61
+
62
+ - **Upload** (`upload`): Upload a file and attach it to a Configuration Item.
54
63
 
55
64
  ### Import
56
65
 
57
- - **Execute Import Definition** (`executeImportDefinition`): Run a predefined import definition to ingest data.
66
+ - **Execute** (`execute`): Run a predefined import definition to ingest data.
58
67
 
59
68
  ## Credentials
60
69
 
@@ -62,35 +71,39 @@ This node supports multiple operations across different resources:
62
71
 
63
72
  This node supports two authentication methods. Configure these under **Workflow → Credentials**.
64
73
 
65
- ### Matrix42 Token Auth
74
+ ### Matrix42 Webservice Token Auth
66
75
 
67
- 1. **API Token** — Your long‑lived Matrix42 API Token.
76
+ 1. **Server URL** — Your Matrix42 server URL (e.g. `https://matrix42.example.com`).
68
77
 
69
- 2. **Base URL** — Your Matrix42 server URL (e.g. `https://api.mycompany.com`).
78
+ 2. **Webservice Token** — Your Matrix42 API Token.
79
+
80
+ 3. **Ignore SSL Issues (Insecure)** — Enable when the server uses a self‑signed certificate.
70
81
 
71
82
 
72
83
  On execution, the node:
73
84
 
74
- - Exchanges the API Token for a short‑lived Bearer (JWT) token via `GenerateAccessTokenFromApiToken`.
85
+ - Exchanges the API Token for a short‑lived Bearer (JWT) access token via `GenerateAccessTokenFromApiToken` (handled automatically in the credential's pre‑authentication step; the access token is cached and refreshed on expiry).
75
86
 
76
- - Uses the Bearer token in the `Authorization` header for all subsequent calls.
87
+ - Uses the access token in the `Authorization` header for all subsequent calls.
77
88
 
78
89
 
79
- > **Self‑signed certificates**: If your Matrix42 server uses a self‑signed SSL certificate, you must add its CA certificate to n8ns trusted certificate store. For details, see the n8n docs on adding self‑signed certificates: https://docs.n8n.io/hosting/configuration/configuration-examples/custom-certificate-authority/
90
+ > **Self‑signed certificates**: enable **Ignore SSL Issues (Insecure)** on the credential, or add the server's CA certificate to n8n's trusted store (see https://docs.n8n.io/hosting/configuration/configuration-examples/custom-certificate-authority/).
80
91
 
81
92
  ### Matrix42 Basic Auth
82
93
 
83
- 1. **Username** and **Password**Your Matrix42 user credentials.
94
+ 1. **Server URL** — As above.
95
+
96
+ 2. **User** and **Password** — Your Matrix42 user credentials.
84
97
 
85
- 2. **Base URL** — As above.
98
+ 3. **Ignore SSL Issues (Insecure)** — As above.
86
99
 
87
100
  ## Compatibility
88
101
 
89
- - **n8n**: Tested with v1.100.1 and later.
102
+ - **n8n**: Node API version 1; built and tested against `n8n-workflow` 2.x. Requires n8n 1.85 or later (uses `NodeConnectionTypes`). Last tested with n8n 2.2.3.
90
103
 
91
- - **Node.js**: v22.17.0 or higher.
104
+ - **Node.js**: v22 or higher.
92
105
 
93
- - **Matrix42 ESMP API**: Tested with Matrix42 12.1.2.5325.
106
+ - **Matrix42 ESMP API**: Last tested against Matrix42 26.1.0.1390.
94
107
 
95
108
  ## Resources
96
109
 
@@ -99,6 +112,26 @@ On execution, the node:
99
112
 
100
113
  ## Version History
101
114
 
115
+ **0.2.0:**
116
+ - **Breaking (node v2):** the `ASQL` resource was split into **Data Fragment** and **Data Object**, and operations were renamed to the standard CRUD set (`Get Many`, `Create`, `Update`, `Delete`, `Get`, `Transform`, `Close`, `Add Journal Entry`, `Upload`, `Execute`). Existing workflows using the node must reselect the resource/operation.
117
+ - Token auth now performs the documented API‑token → access‑token exchange
118
+ - Added an **Ignore SSL Issues (Insecure)** toggle to both credentials.
119
+ - Added a **Data Query** resource with **Get Data** (POST-based, paged, with Return All and a structured **User Filters** body).
120
+ - Ticket **Create** gained a selectable **State** field (loaded from the instance's activity states; defaults to New/200) and an **Extra Properties** collection for setting arbitrary/custom ticket attributes as name/value pairs.
121
+ - Added an optional **Response Language** credential field, sent as the `Explicit-Language` header on every request.
122
+ - `Get Many` (fragments) gained **Return All / Limit** paging.
123
+
124
+ **0.1.3:**
125
+ - Added Operations:
126
+ - Tickets: `addJournalEntry`
127
+
128
+ **0.1.2:**
129
+ - Added Operations:
130
+ - Storage Operations: `uploadFile`
131
+
132
+ **0.1.1:**
133
+ - Bug Fixes
134
+
102
135
  **0.1.0:**
103
136
  - Initial release supporting operations across multiple resources:
104
137
  - Data Fragments: `getFragments`, `addFragment`, `updateFragment`, `deleteFragment`
@@ -109,3 +142,18 @@ On execution, the node:
109
142
  - Authentication methods:
110
143
  - Matrix42 Token API (API Token ↔︎ Bearer JWT exchange)
111
144
  - Matrix42 Basic API (HTTP Basic Authentication)
145
+
146
+
147
+ ## Legal & Disclaimer
148
+
149
+ This project is an **unofficial, community-maintained integration** for the Matrix42 ESMP **Public API**.
150
+ It uses only documented, publicly available endpoints as described in the official
151
+ [Matrix42 Web Services API documentation](https://help.matrix42.com/030_ESMP/030_INT/Business_Processes_and_API_Integrations/Matrix42_Web_Services_API).
152
+
153
+ Matrix42 **explicitly provides** a Public API and token-based authentication mechanism to support
154
+ third-party integrations. This node simply wraps those endpoints for easier use within n8n.
155
+ There is **no violation** of Matrix42’s licensing or terms of service in doing so.
156
+
157
+ > **No Affiliation:**
158
+ > This project is **not affiliated with, endorsed, or sponsored by Matrix42 GmbH**.
159
+ > *MATRIX42* and related marks are trademarks of Matrix42 GmbH, used here for identification purposes only.
@@ -1,9 +1,10 @@
1
- import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class Matrix42BasicApi implements ICredentialType {
3
3
  name: string;
4
4
  extends: string[];
5
5
  displayName: string;
6
6
  documentationUrl: string;
7
+ icon: "file:matrix42.svg";
7
8
  properties: INodeProperties[];
8
9
  authenticate: IAuthenticateGeneric;
9
10
  test: ICredentialTestRequest;
@@ -6,14 +6,16 @@ class Matrix42BasicApi {
6
6
  this.name = 'matrix42BasicApi';
7
7
  this.extends = ['httpBasicAuth'];
8
8
  this.displayName = 'Matrix42 Basic Auth API';
9
- this.documentationUrl = 'https://help.matrix42.com/030_ESMP/030_INT/Business_Processes_and_API_Integrations/Web_Services%3A_Authentication_types';
9
+ this.documentationUrl = 'https://docs.matrix42.com/1074558_web-services/3463380_web-services-authentication-types';
10
+ this.icon = 'file:matrix42.svg';
10
11
  this.properties = [
11
12
  {
12
13
  displayName: 'Server URL',
13
14
  name: 'serverUrl',
14
15
  type: 'string',
15
16
  default: '',
16
- hint: 'The URL of the Matrix42 server. (https://www.example-matrix42.com)',
17
+ placeholder: 'e.g. https://matrix42.example.com',
18
+ hint: 'The base URL of the Matrix42 server',
17
19
  required: true,
18
20
  },
19
21
  {
@@ -33,6 +35,21 @@ class Matrix42BasicApi {
33
35
  },
34
36
  default: '',
35
37
  },
38
+ {
39
+ displayName: 'Ignore SSL Issues (Insecure)',
40
+ name: 'allowUnauthorizedCerts',
41
+ type: 'boolean',
42
+ default: false,
43
+ description: 'Whether to connect even if SSL certificate validation is not possible, e.g. when the Matrix42 server uses a self-signed certificate',
44
+ },
45
+ {
46
+ displayName: 'Response Language',
47
+ name: 'explicitLanguage',
48
+ type: 'string',
49
+ default: '',
50
+ placeholder: 'e.g. de-DE',
51
+ hint: 'Optional. Sent as the "Explicit-Language" header on every request to control the language of the response. Leave empty to use the server default.',
52
+ },
36
53
  ];
37
54
  this.authenticate = {
38
55
  type: 'generic',
@@ -45,9 +62,12 @@ class Matrix42BasicApi {
45
62
  };
46
63
  this.test = {
47
64
  request: {
48
- baseURL: '={{$credentials?.serverUrl}}',
65
+ baseURL: '={{$credentials.serverUrl.replace(/\\/+$/, "")}}',
49
66
  url: '/m42Services/api/data/fragments/SPSGlobalConfigurationClassBase',
50
- skipSslCertificateValidation: false,
67
+ qs: {
68
+ pagesize: 1,
69
+ },
70
+ skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
51
71
  },
52
72
  };
53
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Matrix42BasicApi.credentials.js","sourceRoot":"","sources":["../../credentials/Matrix42BasicApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,gBAAgB;IAA7B;QACC,SAAI,GAAG,kBAAkB,CAAC;QAE1B,YAAO,GAAG,CAAC,eAAe,CAAC,CAAC;QAE5B,gBAAW,GAAG,yBAAyB,CAAC;QAExC,qBAAgB,GAAG,yHAAyH,CAAC;QAE7I,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,oEAAoE;gBAC1E,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,IAAI,EAAE;oBACL,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,4BAA4B;iBACtC;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,8BAA8B;gBACvC,GAAG,EAAE,iEAAiE;gBACtE,4BAA4B,EAAE,KAAK;aACnC;SACD,CAAC;IACH,CAAC;CAAA;AAtDD,4CAsDC"}
1
+ {"version":3,"file":"Matrix42BasicApi.credentials.js","sourceRoot":"","sources":["../../credentials/Matrix42BasicApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,gBAAgB;IA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AE;gBACR,OAAO,EAAE,kDAAkD;gBAC3D,GAAG,EAAE,iEAAiE;gBACtE,EAAE,EAAE;oBACH,QAAQ,EAAE,CAAC;iBACX;gBACD,4BAA4B,EAAE,0CAA0C;aACxE;SACD,CAAC;IACH,CAAC;CAAA;AA7ED,4CA6EC"}
@@ -1,9 +1,13 @@
1
- import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { IAuthenticateGeneric, ICredentialDataDecryptedObject, ICredentialTestRequest, ICredentialType, IHttpRequestHelper, INodeProperties } from 'n8n-workflow';
2
2
  export declare class Matrix42TokenApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
+ icon: "file:matrix42.svg";
6
7
  properties: INodeProperties[];
8
+ preAuthentication(this: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject): Promise<{
9
+ accessToken: string;
10
+ }>;
7
11
  authenticate: IAuthenticateGeneric;
8
12
  test: ICredentialTestRequest;
9
13
  }
@@ -5,14 +5,16 @@ class Matrix42TokenApi {
5
5
  constructor() {
6
6
  this.name = 'matrix42TokenApi';
7
7
  this.displayName = 'Matrix42 Webservice Token Auth API';
8
- this.documentationUrl = 'https://help.matrix42.com/030_ESMP/030_INT/Business_Processes_and_API_Integrations/Web_Services%3A_Authentication_types';
8
+ this.documentationUrl = 'https://docs.matrix42.com/1074558_web-services/3463380_web-services-authentication-types';
9
+ this.icon = 'file:matrix42.svg';
9
10
  this.properties = [
10
11
  {
11
12
  displayName: 'Server URL',
12
13
  name: 'serverUrl',
13
14
  type: 'string',
14
15
  default: '',
15
- hint: 'The URL of the Matrix42 server. (https://www.example-matrix42.com)',
16
+ placeholder: 'e.g. https://matrix42.example.com',
17
+ hint: 'The base URL of the Matrix42 server',
16
18
  required: true,
17
19
  },
18
20
  {
@@ -20,29 +22,71 @@ class Matrix42TokenApi {
20
22
  name: 'webserviceToken',
21
23
  type: 'string',
22
24
  typeOptions: {
23
- password: true
25
+ password: true,
24
26
  },
25
27
  default: '',
26
- hint: 'The Webservice token of the Matrix42 server.',
28
+ hint: 'The API Token generated in Matrix42. It is exchanged for a short-lived access token on each run',
27
29
  required: true,
28
30
  },
31
+ {
32
+ displayName: 'Ignore SSL Issues (Insecure)',
33
+ name: 'allowUnauthorizedCerts',
34
+ type: 'boolean',
35
+ default: false,
36
+ description: 'Whether to connect even if SSL certificate validation is not possible, e.g. when the Matrix42 server uses a self-signed certificate',
37
+ },
38
+ {
39
+ displayName: 'Response Language',
40
+ name: 'explicitLanguage',
41
+ type: 'string',
42
+ default: '',
43
+ placeholder: 'e.g. de-DE',
44
+ hint: 'Optional. Sent as the "Explicit-Language" header on every request to control the language of the response. Leave empty to use the server default.',
45
+ },
46
+ {
47
+ displayName: 'Access Token',
48
+ name: 'accessToken',
49
+ type: 'hidden',
50
+ typeOptions: {
51
+ expirable: true,
52
+ },
53
+ default: '',
54
+ },
29
55
  ];
30
56
  this.authenticate = {
31
57
  type: 'generic',
32
58
  properties: {
33
59
  headers: {
34
- Authorization: '=Bearer {{$credentials.webserviceToken}}',
60
+ Authorization: '=Bearer {{$credentials.accessToken}}',
35
61
  },
36
62
  },
37
63
  };
38
64
  this.test = {
39
65
  request: {
40
- baseURL: '={{$credentials?.serverUrl}}',
66
+ baseURL: '={{$credentials.serverUrl.replace(/\\/+$/, "")}}',
41
67
  url: '/m42Services/api/data/fragments/SPSGlobalConfigurationClassBase',
42
- skipSslCertificateValidation: false,
68
+ qs: {
69
+ pagesize: 1,
70
+ },
71
+ skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
43
72
  },
44
73
  };
45
74
  }
75
+ async preAuthentication(credentials) {
76
+ const serverUrl = credentials.serverUrl.replace(/\/+$/, '');
77
+ const { RawToken } = (await this.helpers.httpRequest({
78
+ method: 'POST',
79
+ url: `${serverUrl}/m42Services/api/ApiToken/GenerateAccessTokenFromApiToken`,
80
+ skipSslCertificateValidation: credentials.allowUnauthorizedCerts === true,
81
+ headers: {
82
+ 'Content-Type': 'application/json',
83
+ Authorization: `Bearer ${credentials.webserviceToken}`,
84
+ },
85
+ body: {},
86
+ json: true,
87
+ }));
88
+ return { accessToken: RawToken };
89
+ }
46
90
  }
47
91
  exports.Matrix42TokenApi = Matrix42TokenApi;
48
92
  //# sourceMappingURL=Matrix42TokenApi.credentials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Matrix42TokenApi.credentials.js","sourceRoot":"","sources":["../../credentials/Matrix42TokenApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,gBAAgB;IAA7B;QACC,SAAI,GAAG,kBAAkB,CAAC;QAE1B,gBAAW,GAAG,oCAAoC,CAAC;QAEnD,qBAAgB,GAAG,yHAAyH,CAAC;QAE7I,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,oEAAoE;gBAC1E,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,8CAA8C;gBACpD,QAAQ,EAAE,IAAI;aACd;SAUD,CAAC;QAeF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,0CAA0C;iBACzD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,8BAA8B;gBACvC,GAAG,EAAE,iEAAiE;gBACtE,4BAA4B,EAAE,KAAK;aACnC;SACD,CAAC;IACH,CAAC;CAAA;AAnED,4CAmEC"}
1
+ {"version":3,"file":"Matrix42TokenApi.credentials.js","sourceRoot":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AsC;iBACrD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,kDAAkD;gBAC3D,GAAG,EAAE,iEAAiE;gBACtE,EAAE,EAAE;oBACH,QAAQ,EAAE,CAAC;iBACX;gBACD,4BAA4B,EAAE,0CAA0C;aACxE;SACD,CAAC;IACH,CAAC;IArCA,KAAK,CAAC,iBAAiB,CAA2B,WAA2C;QAC5F,MAAM,SAAS,GAAI,WAAW,CAAC,SAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAExE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACpD,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,GAAG,SAAS,2DAA2D;YAC5E,4BAA4B,EAAE,WAAW,CAAC,sBAAsB,KAAK,IAAI;YACzE,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,WAAW,CAAC,eAAe,EAAE;aACtD;YACD,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,IAAI;SACV,CAAC,CAAyB,CAAC;QAE5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAClC,CAAC;CAqBD;AA/FD,4CA+FC"}
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="400" height="150" viewBox="0 0 400 150">
3
+ <path d="M197.5,0h-72.5l-27.5,72.5L72.5,0H0v150h55V60l32.5,90h20l35-90v90h55l-52.5-75L197.5,0Z" fill="#202326"/>
4
+ <path d="M232.5,85v-30l-20,30h20Z" fill="#f86200"/>
5
+ <path d="M210,0l-50,75,52.5,75h187.5V0h-190ZM282.5,120h-15v20h-35v-20h-25l-32.5-45,45-60h50v70h15v35h-2.5ZM385,140h-95v-30c47.5-37.5,55-45,55-52.5,0-5-5-7.5-10-7.5-10,0-17.5,2.5-25,12.5l-2.5,2.5-22.5-25v-2.5c12.5-12.5,30-20,47.5-20,30,0,50,17.5,50,42.5,0,17.5-10,30-35,50h35v30h2.5Z" fill="#f86200"/>
6
+ </svg>
@@ -1,3 +1,4 @@
1
- import { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
1
+ import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ export declare function normalizeServerUrl(serverUrl: string): string;
3
+ export declare function escapeAsqlString(value: string): string;
2
4
  export declare function matrix42ApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: `/${string}`, body: object, query?: IDataObject, uri?: string, contentType?: string): Promise<any>;
3
- export declare function uuidv4(): string;
@@ -1,33 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeServerUrl = normalizeServerUrl;
4
+ exports.escapeAsqlString = escapeAsqlString;
3
5
  exports.matrix42ApiRequest = matrix42ApiRequest;
4
- exports.uuidv4 = uuidv4;
6
+ function normalizeServerUrl(serverUrl) {
7
+ return serverUrl.replace(/\/+$/, '');
8
+ }
9
+ function escapeAsqlString(value) {
10
+ return String(value !== null && value !== void 0 ? value : '').replace(/'/g, "''");
11
+ }
5
12
  async function matrix42ApiRequest(method, endpoint, body, query, uri, contentType = 'application/json') {
6
13
  const authenticationMethod = this.getNodeParameter('authentication', 0);
7
14
  const credentialType = authenticationMethod === 'basic' ? 'matrix42BasicApi' : 'matrix42TokenApi';
8
- const { serverUrl } = await this.getCredentials(credentialType);
15
+ const { serverUrl, allowUnauthorizedCerts, explicitLanguage } = await this.getCredentials(credentialType);
9
16
  const isJson = contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase().includes('application/json');
17
+ const hasBody = method !== 'GET' && method !== 'HEAD' && body != null && Object.keys(body).length > 0;
18
+ const headers = {
19
+ 'Content-Type': contentType,
20
+ };
21
+ if (explicitLanguage) {
22
+ headers['Explicit-Language'] = explicitLanguage;
23
+ }
10
24
  const options = {
11
- headers: {
12
- 'Content-Type': contentType,
13
- },
25
+ headers,
14
26
  method,
15
- body: method === 'GET' || method === 'HEAD' || method === 'DELETE' ? null : body,
27
+ body: hasBody ? body : undefined,
16
28
  qs: query,
17
- url: uri || `${serverUrl}/m42Services/api${endpoint}`,
29
+ url: uri || `${normalizeServerUrl(serverUrl)}/m42Services/api${endpoint}`,
18
30
  json: isJson,
19
- skipSslCertificateValidation: false
31
+ skipSslCertificateValidation: allowUnauthorizedCerts === true,
20
32
  };
21
- if (options.body === null) {
33
+ if (options.body === undefined) {
22
34
  delete options.body;
23
35
  }
24
36
  return await this.helpers.httpRequestWithAuthentication.call(this, credentialType, options);
25
37
  }
26
- function uuidv4() {
27
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
28
- const r = (Math.random() * 16) | 0;
29
- const v = c === 'x' ? r : (r & 0x3) | 0x8;
30
- return v.toString(16);
31
- });
32
- }
33
38
  //# sourceMappingURL=GenericFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Matrix42/GenericFunctions.ts"],"names":[],"mappings":";;AAOA,gDAiCC;AAED,wBAMC;AAzCM,KAAK,UAAU,kBAAkB,CAEvC,MAA2B,EAC3B,QAAsB,EACtB,IAAY,EACZ,KAAmB,EACnB,GAAY,EACZ,cAAsB,kBAAkB;IAGxC,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAW,CAAC;IAClF,MAAM,cAAc,GAAG,oBAAoB,KAAK,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAClG,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM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IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAChC,EAAE,EAAE,KAAK;QACT,GAAG,EAAE,GAAG,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAC,mBAAmB,QAAQ,EAAE;QACzE,IAAI,EAAE,MAAM;QACZ,4BAA4B,EAAE,sBAAsB,KAAK,IAAI;KAC7D,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7F,CAAC"}
@@ -1,4 +1,4 @@
1
- import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
2
  export declare class Matrix42 implements INodeType {
3
3
  description: INodeTypeDescription;
4
4
  methods: {
@@ -10,10 +10,13 @@ export declare class Matrix42 implements INodeType {
10
10
  getTicketRoles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
11
11
  getTicketSlas(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
12
12
  getTicketOlas(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
13
+ getActivityStates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
13
14
  getTicketCloseReasons(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
14
15
  getTicketCloseErrorTypes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
16
+ getDataQueries(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
15
17
  getImportDefinitions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
16
18
  getStorageProviders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
19
+ getJournalEntryTypes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
17
20
  };
18
21
  };
19
22
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;