n8n-nodes-qwease 0.3.9
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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/credentials/QweaseApi.credentials.d.ts +10 -0
- package/dist/credentials/QweaseApi.credentials.js +37 -0
- package/dist/credentials/qwease.png +0 -0
- package/dist/credentials/qwease.svg +4 -0
- package/dist/nodes/Qwease/FormFieldsHelper.d.ts +21 -0
- package/dist/nodes/Qwease/FormFieldsHelper.js +187 -0
- package/dist/nodes/Qwease/GenericFunctions.d.ts +4 -0
- package/dist/nodes/Qwease/GenericFunctions.js +30 -0
- package/dist/nodes/Qwease/KnowledgeTaskDescription.d.ts +5 -0
- package/dist/nodes/Qwease/KnowledgeTaskDescription.js +306 -0
- package/dist/nodes/Qwease/OtherResourcesDescription.d.ts +12 -0
- package/dist/nodes/Qwease/OtherResourcesDescription.js +444 -0
- package/dist/nodes/Qwease/Qwease.node.d.ts +32 -0
- package/dist/nodes/Qwease/Qwease.node.js +187 -0
- package/dist/nodes/Qwease/QweaseDescription.d.ts +3 -0
- package/dist/nodes/Qwease/QweaseDescription.js +390 -0
- package/dist/nodes/Qwease/QweaseMethods.d.ts +22 -0
- package/dist/nodes/Qwease/QweaseMethods.js +335 -0
- package/dist/nodes/Qwease/QweaseTrigger.node.d.ts +12 -0
- package/dist/nodes/Qwease/QweaseTrigger.node.js +152 -0
- package/dist/nodes/Qwease/TicketBody.d.ts +3 -0
- package/dist/nodes/Qwease/TicketBody.js +104 -0
- package/dist/nodes/Qwease/executeHelpers.d.ts +14 -0
- package/dist/nodes/Qwease/executeHelpers.js +66 -0
- package/dist/nodes/Qwease/executeKnowledgeTask.d.ts +3 -0
- package/dist/nodes/Qwease/executeKnowledgeTask.js +127 -0
- package/dist/nodes/Qwease/executeOtherResources.d.ts +7 -0
- package/dist/nodes/Qwease/executeOtherResources.js +256 -0
- package/dist/nodes/Qwease/qwease.png +0 -0
- package/dist/nodes/Qwease/qwease.svg +4 -0
- package/dist/nodes/Qwease/shared.d.ts +13 -0
- package/dist/nodes/Qwease/shared.js +155 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Qwease
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# n8n-nodes-qwease
|
|
2
|
+
|
|
3
|
+
Community node for [n8n](https://n8n.io) — connect workflows to [Qwease](https://qwease.fr) ITSM (tickets, helpdesk, MSP).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
**Settings → Community nodes → Install** → enter:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
n8n-nodes-qwease
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or link locally during development:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
npm link
|
|
18
|
+
cd ~/.n8n/custom
|
|
19
|
+
npm link n8n-nodes-qwease
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Credentials
|
|
23
|
+
|
|
24
|
+
Create a **Qwease API** credential:
|
|
25
|
+
|
|
26
|
+
- **API Token**: your Qwease bearer token (Administration). Paste the token only, without `Bearer`.
|
|
27
|
+
|
|
28
|
+
Test calls `GET https://rest.qwease.fr/api/me/`.
|
|
29
|
+
|
|
30
|
+
## Nodes (v0.3)
|
|
31
|
+
|
|
32
|
+
### Qwease (action)
|
|
33
|
+
|
|
34
|
+
| Resource | Operations |
|
|
35
|
+
|----------|------------|
|
|
36
|
+
| **Ticket** | Create · Get · Get Many · Update · Add Comment |
|
|
37
|
+
| **User** | Create · Get · Get Many · Update |
|
|
38
|
+
| **Organization** | Create · Get · Get Many · Update (`/client/`) |
|
|
39
|
+
| **Device** | Create · Get · Get Many · Update |
|
|
40
|
+
| **Team** | Create · Get · Get Many · Update |
|
|
41
|
+
| **Knowledge** | Create · Get · Get Many · Update · Update Content · Search |
|
|
42
|
+
| **Task** | Create · Get · Get Many · Update |
|
|
43
|
+
| **Search** | Advanced Search · Quick Search |
|
|
44
|
+
| **Me** | Get |
|
|
45
|
+
|
|
46
|
+
Related objects use **From list / By ID**. Create flows show essential fields; optionals under **Additional Fields**.
|
|
47
|
+
|
|
48
|
+
### Qwease Trigger (webhook)
|
|
49
|
+
|
|
50
|
+
Starts on Qwease outbound webhooks:
|
|
51
|
+
|
|
52
|
+
1. Activate the workflow and copy the Production webhook URL.
|
|
53
|
+
2. Qwease Admin → Integrations → Webhooks → create URL + save the **secret** (shown once).
|
|
54
|
+
3. Run **Test** on the webhook in Qwease.
|
|
55
|
+
4. Automation → trigger event → action **Send webhook**.
|
|
56
|
+
5. Paste the secret into the trigger node; optionally filter `event_type` values.
|
|
57
|
+
|
|
58
|
+
Signature: HMAC-SHA256 header `X-Qwease-Signature-256` (raw hex). See [KB webhooks](https://app.notion.com/p/3cd7035fdb12819ea9b4e6487c384cc6).
|
|
59
|
+
|
|
60
|
+
API reference: https://rest.qwease.fr/swagger/
|
|
61
|
+
|
|
62
|
+
### Smoke local
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm run build
|
|
66
|
+
npm link
|
|
67
|
+
n8n start
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Always rebuild then restart n8n after code changes.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class QweaseApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: "file:qwease.svg";
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QweaseApi = void 0;
|
|
4
|
+
class QweaseApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'qweaseApi';
|
|
7
|
+
this.displayName = 'Qwease API';
|
|
8
|
+
this.icon = 'file:qwease.svg';
|
|
9
|
+
this.documentationUrl = 'https://rest.qwease.fr/swagger/';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Token',
|
|
13
|
+
name: 'apiToken',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'Bearer token from Qwease Administration (paste the token only, without the "Bearer" prefix)',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
this.authenticate = {
|
|
22
|
+
type: 'generic',
|
|
23
|
+
properties: {
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: '=Bearer {{$credentials.apiToken}}',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
this.test = {
|
|
30
|
+
request: {
|
|
31
|
+
baseURL: 'https://rest.qwease.fr/api',
|
|
32
|
+
url: '/me/',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.QweaseApi = QweaseApi;
|
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="60" height="60">
|
|
2
|
+
<circle cx="30" cy="30" r="30" fill="#0B3D91"/>
|
|
3
|
+
<text x="30" y="38" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="32" font-weight="700" fill="#FFFFFF">Q</text>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IDataObject, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
import { type QweaseContext } from './GenericFunctions';
|
|
3
|
+
export type QweaseFormField = {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
technical_name: string;
|
|
7
|
+
fields_type: string;
|
|
8
|
+
optionslist?: IDataObject[];
|
|
9
|
+
};
|
|
10
|
+
export declare function extractLocatorValue(value: unknown): string;
|
|
11
|
+
export declare function parseOptionalId(value: unknown): number | undefined;
|
|
12
|
+
export declare function extractStatutModelId(formDetails: IDataObject): number | undefined;
|
|
13
|
+
export declare function extractFormIdFromTicket(ticket: IDataObject): number | undefined;
|
|
14
|
+
export declare function resolveFormIdForLists(context: ILoadOptionsFunctions): Promise<number | undefined>;
|
|
15
|
+
export declare function fetchFormFields(context: QweaseContext, formId: number): Promise<QweaseFormField[]>;
|
|
16
|
+
/** Entity-scoped custom fields: type=user | client | device */
|
|
17
|
+
export declare function fetchEntityFields(context: QweaseContext, fieldType: 'user' | 'client' | 'device'): Promise<QweaseFormField[]>;
|
|
18
|
+
export declare function fetchFieldListOptions(context: QweaseContext, fieldId: number): Promise<IDataObject[]>;
|
|
19
|
+
export declare function resolveScopedCustomField(context: ILoadOptionsFunctions, technicalName: string): Promise<QweaseFormField | undefined>;
|
|
20
|
+
export declare function resolveCustomFieldOptions(context: ILoadOptionsFunctions, technicalName: string): Promise<IDataObject[]>;
|
|
21
|
+
export declare function fetchFormStatusItems(context: QweaseContext, formId: number): Promise<IDataObject[]>;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractLocatorValue = extractLocatorValue;
|
|
4
|
+
exports.parseOptionalId = parseOptionalId;
|
|
5
|
+
exports.extractStatutModelId = extractStatutModelId;
|
|
6
|
+
exports.extractFormIdFromTicket = extractFormIdFromTicket;
|
|
7
|
+
exports.resolveFormIdForLists = resolveFormIdForLists;
|
|
8
|
+
exports.fetchFormFields = fetchFormFields;
|
|
9
|
+
exports.fetchEntityFields = fetchEntityFields;
|
|
10
|
+
exports.fetchFieldListOptions = fetchFieldListOptions;
|
|
11
|
+
exports.resolveScopedCustomField = resolveScopedCustomField;
|
|
12
|
+
exports.resolveCustomFieldOptions = resolveCustomFieldOptions;
|
|
13
|
+
exports.fetchFormStatusItems = fetchFormStatusItems;
|
|
14
|
+
const GenericFunctions_1 = require("./GenericFunctions");
|
|
15
|
+
function extractLocatorValue(value) {
|
|
16
|
+
if (value === undefined || value === null || value === '') {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === 'object' && value !== null && 'value' in value) {
|
|
20
|
+
return extractLocatorValue(value.value);
|
|
21
|
+
}
|
|
22
|
+
return String(value);
|
|
23
|
+
}
|
|
24
|
+
function parseOptionalId(value) {
|
|
25
|
+
const raw = extractLocatorValue(value);
|
|
26
|
+
if (!raw) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const n = parseInt(raw, 10);
|
|
30
|
+
return Number.isNaN(n) ? undefined : n;
|
|
31
|
+
}
|
|
32
|
+
function extractStatutModelId(formDetails) {
|
|
33
|
+
const statutModel = formDetails.statut_model;
|
|
34
|
+
if (typeof statutModel === 'number') {
|
|
35
|
+
return statutModel;
|
|
36
|
+
}
|
|
37
|
+
if (statutModel && typeof statutModel === 'object') {
|
|
38
|
+
return parseOptionalId(statutModel.id);
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
function extractFormIdFromTicket(ticket) {
|
|
43
|
+
const form = ticket.form;
|
|
44
|
+
if (typeof form === 'number') {
|
|
45
|
+
return form;
|
|
46
|
+
}
|
|
47
|
+
if (form && typeof form === 'object') {
|
|
48
|
+
return parseOptionalId(form.id);
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
async function resolveFormIdForLists(context) {
|
|
53
|
+
const operation = context.getCurrentNodeParameter('operation');
|
|
54
|
+
if (operation === 'create') {
|
|
55
|
+
return parseOptionalId(context.getCurrentNodeParameter('form'));
|
|
56
|
+
}
|
|
57
|
+
if (operation === 'update') {
|
|
58
|
+
const ticketId = extractLocatorValue(context.getCurrentNodeParameter('ticketId'));
|
|
59
|
+
if (!ticketId) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const ticket = (await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', `/ticket/${ticketId}/`));
|
|
63
|
+
return extractFormIdFromTicket(ticket);
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
async function fetchFormFields(context, formId) {
|
|
68
|
+
var _a;
|
|
69
|
+
const response = await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', '/forms-category/', {}, { form: formId, depth: 2 });
|
|
70
|
+
const categories = (0, GenericFunctions_1.qweaseListFromResponse)(response);
|
|
71
|
+
const fields = [];
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
for (const category of categories) {
|
|
74
|
+
const categoryFields = category.fields;
|
|
75
|
+
if (!Array.isArray(categoryFields)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
for (const field of categoryFields) {
|
|
79
|
+
if (!field || typeof field !== 'object') {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const entry = field;
|
|
83
|
+
const technicalName = String(entry.technical_name || '');
|
|
84
|
+
if (!technicalName || seen.has(technicalName)) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
seen.add(technicalName);
|
|
88
|
+
fields.push({
|
|
89
|
+
id: (_a = parseOptionalId(entry.id)) !== null && _a !== void 0 ? _a : 0,
|
|
90
|
+
name: String(entry.name || entry.display_name || technicalName),
|
|
91
|
+
technical_name: technicalName,
|
|
92
|
+
fields_type: String(entry.fields_type || 'string'),
|
|
93
|
+
optionslist: Array.isArray(entry.optionslist) ? entry.optionslist : undefined,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return fields;
|
|
98
|
+
}
|
|
99
|
+
/** Entity-scoped custom fields: type=user | client | device */
|
|
100
|
+
async function fetchEntityFields(context, fieldType) {
|
|
101
|
+
var _a;
|
|
102
|
+
const response = await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', '/fields/', {}, { type: fieldType, is_active: true, depth: 1 });
|
|
103
|
+
const list = (0, GenericFunctions_1.qweaseListFromResponse)(response);
|
|
104
|
+
const fields = [];
|
|
105
|
+
const seen = new Set();
|
|
106
|
+
for (const entry of list) {
|
|
107
|
+
if (!entry || typeof entry !== 'object') {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const technicalName = String(entry.technical_name || '');
|
|
111
|
+
if (!technicalName || seen.has(technicalName)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
seen.add(technicalName);
|
|
115
|
+
fields.push({
|
|
116
|
+
id: (_a = parseOptionalId(entry.id)) !== null && _a !== void 0 ? _a : 0,
|
|
117
|
+
name: String(entry.name || entry.display_name || technicalName),
|
|
118
|
+
technical_name: technicalName,
|
|
119
|
+
fields_type: String(entry.fields_type || 'string'),
|
|
120
|
+
optionslist: Array.isArray(entry.optionslist) ? entry.optionslist : undefined,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return fields;
|
|
124
|
+
}
|
|
125
|
+
async function fetchFieldListOptions(context, fieldId) {
|
|
126
|
+
const response = await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', `/fields/${fieldId}/listoptions/`);
|
|
127
|
+
return (0, GenericFunctions_1.qweaseListFromResponse)(response);
|
|
128
|
+
}
|
|
129
|
+
function optionsFromField(field) {
|
|
130
|
+
if (Array.isArray(field.optionslist) && field.optionslist.length > 0) {
|
|
131
|
+
return field.optionslist;
|
|
132
|
+
}
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
async function resolveScopedCustomField(context, technicalName) {
|
|
136
|
+
if (!technicalName) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
const resource = context.getCurrentNodeParameter('resource');
|
|
140
|
+
let fields = [];
|
|
141
|
+
if (resource === 'ticket') {
|
|
142
|
+
const formId = await resolveFormIdForLists(context);
|
|
143
|
+
if (!formId) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
fields = await fetchFormFields(context, formId);
|
|
147
|
+
}
|
|
148
|
+
else if (resource === 'user') {
|
|
149
|
+
fields = await fetchEntityFields(context, 'user');
|
|
150
|
+
}
|
|
151
|
+
else if (resource === 'organization') {
|
|
152
|
+
fields = await fetchEntityFields(context, 'client');
|
|
153
|
+
}
|
|
154
|
+
else if (resource === 'device') {
|
|
155
|
+
fields = await fetchEntityFields(context, 'device');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
return fields.find((field) => field.technical_name === technicalName);
|
|
161
|
+
}
|
|
162
|
+
async function resolveCustomFieldOptions(context, technicalName) {
|
|
163
|
+
const field = await resolveScopedCustomField(context, technicalName);
|
|
164
|
+
if (!field) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
const embedded = optionsFromField(field);
|
|
168
|
+
if (embedded.length > 0) {
|
|
169
|
+
return embedded;
|
|
170
|
+
}
|
|
171
|
+
if (!field.id) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
return fetchFieldListOptions(context, field.id);
|
|
175
|
+
}
|
|
176
|
+
async function fetchFormStatusItems(context, formId) {
|
|
177
|
+
const formDetails = (await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', `/forms/${formId}/details/`));
|
|
178
|
+
const statutModelId = extractStatutModelId(formDetails);
|
|
179
|
+
if (!statutModelId) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
const response = await GenericFunctions_1.qweaseApiRequest.call(context, 'GET', '/statusitem/', {}, {
|
|
183
|
+
related_status: statutModelId,
|
|
184
|
+
position__in: '1,2,3,4',
|
|
185
|
+
});
|
|
186
|
+
return (0, GenericFunctions_1.qweaseListFromResponse)(response);
|
|
187
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExecuteFunctions, IHttpRequestMethods, IDataObject, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export type QweaseContext = IExecuteFunctions | ILoadOptionsFunctions;
|
|
3
|
+
export declare function qweaseListFromResponse(response: IDataObject | IDataObject[]): IDataObject[];
|
|
4
|
+
export declare function qweaseApiRequest(this: QweaseContext, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.qweaseListFromResponse = qweaseListFromResponse;
|
|
4
|
+
exports.qweaseApiRequest = qweaseApiRequest;
|
|
5
|
+
const BASE_URL = 'https://rest.qwease.fr/api';
|
|
6
|
+
function qweaseListFromResponse(response) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (Array.isArray(response)) {
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
11
|
+
const results = (_a = response.results) !== null && _a !== void 0 ? _a : response.data;
|
|
12
|
+
if (Array.isArray(results)) {
|
|
13
|
+
return results;
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
async function qweaseApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
18
|
+
const options = {
|
|
19
|
+
method,
|
|
20
|
+
url: `${BASE_URL}${endpoint}`,
|
|
21
|
+
json: true,
|
|
22
|
+
};
|
|
23
|
+
if (Object.keys(body).length) {
|
|
24
|
+
options.body = body;
|
|
25
|
+
}
|
|
26
|
+
if (Object.keys(qs).length) {
|
|
27
|
+
options.qs = qs;
|
|
28
|
+
}
|
|
29
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'qweaseApi', options);
|
|
30
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const knowledgeOperations: INodeProperties[];
|
|
3
|
+
export declare const knowledgeFields: INodeProperties[];
|
|
4
|
+
export declare const taskOperations: INodeProperties[];
|
|
5
|
+
export declare const taskFields: INodeProperties[];
|