@learningsuite/n8n-nodes-learningsuite 1.2.2
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.de.md +555 -0
- package/README.md +427 -0
- package/dist/credentials/LearningSuiteApi.credentials.d.ts +10 -0
- package/dist/credentials/LearningSuiteApi.credentials.js +49 -0
- package/dist/credentials/learningsuite.svg +1 -0
- package/dist/nodes/LearningSuite/LearningSuite.node.d.ts +65 -0
- package/dist/nodes/LearningSuite/LearningSuite.node.js +221 -0
- package/dist/nodes/LearningSuite/LearningSuiteTrigger.node.d.ts +66 -0
- package/dist/nodes/LearningSuite/LearningSuiteTrigger.node.js +433 -0
- package/dist/nodes/LearningSuite/descriptions/ai.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/ai.properties.js +141 -0
- package/dist/nodes/LearningSuite/descriptions/apiCall.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/apiCall.properties.js +87 -0
- package/dist/nodes/LearningSuite/descriptions/bundle.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/bundle.properties.js +32 -0
- package/dist/nodes/LearningSuite/descriptions/community.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/community.properties.js +229 -0
- package/dist/nodes/LearningSuite/descriptions/course.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/course.properties.js +248 -0
- package/dist/nodes/LearningSuite/descriptions/customFields.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/customFields.properties.js +452 -0
- package/dist/nodes/LearningSuite/descriptions/group.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/group.properties.js +165 -0
- package/dist/nodes/LearningSuite/descriptions/hub.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/hub.properties.js +167 -0
- package/dist/nodes/LearningSuite/descriptions/member.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/member.properties.js +625 -0
- package/dist/nodes/LearningSuite/descriptions/module.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/module.properties.js +84 -0
- package/dist/nodes/LearningSuite/descriptions/popup.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/popup.properties.js +73 -0
- package/dist/nodes/LearningSuite/descriptions/resource.selector.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/resource.selector.js +87 -0
- package/dist/nodes/LearningSuite/descriptions/role.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/role.properties.js +14 -0
- package/dist/nodes/LearningSuite/descriptions/teamMember.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/teamMember.properties.js +74 -0
- package/dist/nodes/LearningSuite/descriptions/trigger.instant.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/trigger.instant.properties.js +542 -0
- package/dist/nodes/LearningSuite/descriptions/user.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/user.properties.js +135 -0
- package/dist/nodes/LearningSuite/descriptions/webhook.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/webhook.properties.js +672 -0
- package/dist/nodes/LearningSuite/descriptions/webhook.sampleData.properties.d.ts +2 -0
- package/dist/nodes/LearningSuite/descriptions/webhook.sampleData.properties.js +401 -0
- package/dist/nodes/LearningSuite/exec.types.d.ts +5 -0
- package/dist/nodes/LearningSuite/exec.types.js +2 -0
- package/dist/nodes/LearningSuite/execute/ai.handlers.d.ts +4 -0
- package/dist/nodes/LearningSuite/execute/ai.handlers.js +23 -0
- package/dist/nodes/LearningSuite/execute/apiCall.handlers.d.ts +4 -0
- package/dist/nodes/LearningSuite/execute/apiCall.handlers.js +46 -0
- package/dist/nodes/LearningSuite/execute/bundle.handlers.d.ts +5 -0
- package/dist/nodes/LearningSuite/execute/bundle.handlers.js +12 -0
- package/dist/nodes/LearningSuite/execute/community.handlers.d.ts +11 -0
- package/dist/nodes/LearningSuite/execute/community.handlers.js +94 -0
- package/dist/nodes/LearningSuite/execute/course.handlers.d.ts +10 -0
- package/dist/nodes/LearningSuite/execute/course.handlers.js +87 -0
- package/dist/nodes/LearningSuite/execute/customFields.handlers.d.ts +16 -0
- package/dist/nodes/LearningSuite/execute/customFields.handlers.js +342 -0
- package/dist/nodes/LearningSuite/execute/group.handlers.d.ts +15 -0
- package/dist/nodes/LearningSuite/execute/group.handlers.js +99 -0
- package/dist/nodes/LearningSuite/execute/hub.handlers.d.ts +9 -0
- package/dist/nodes/LearningSuite/execute/hub.handlers.js +65 -0
- package/dist/nodes/LearningSuite/execute/member.handlers.d.ts +23 -0
- package/dist/nodes/LearningSuite/execute/member.handlers.js +244 -0
- package/dist/nodes/LearningSuite/execute/module.handlers.d.ts +6 -0
- package/dist/nodes/LearningSuite/execute/module.handlers.js +36 -0
- package/dist/nodes/LearningSuite/execute/popup.handlers.d.ts +7 -0
- package/dist/nodes/LearningSuite/execute/popup.handlers.js +24 -0
- package/dist/nodes/LearningSuite/execute/registry.d.ts +2 -0
- package/dist/nodes/LearningSuite/execute/registry.js +35 -0
- package/dist/nodes/LearningSuite/execute/role.handlers.d.ts +4 -0
- package/dist/nodes/LearningSuite/execute/role.handlers.js +6 -0
- package/dist/nodes/LearningSuite/execute/teamMember.handlers.d.ts +6 -0
- package/dist/nodes/LearningSuite/execute/teamMember.handlers.js +21 -0
- package/dist/nodes/LearningSuite/execute/user.handlers.d.ts +4 -0
- package/dist/nodes/LearningSuite/execute/user.handlers.js +32 -0
- package/dist/nodes/LearningSuite/execute/webhook.handlers.d.ts +9 -0
- package/dist/nodes/LearningSuite/execute/webhook.handlers.js +306 -0
- package/dist/nodes/LearningSuite/icons/learningsuite-icon-dark.svg +1 -0
- package/dist/nodes/LearningSuite/icons/learningsuite-icon-light.svg +1 -0
- package/dist/nodes/LearningSuite/index.d.ts +1 -0
- package/dist/nodes/LearningSuite/index.js +17 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/apiCall.loadOptions.d.ts +1 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/apiCall.loadOptions.js +2 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/bundle.loadOptions.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/bundle.loadOptions.js +7 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/common.d.ts +7 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/common.js +22 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/community.loadOptions.d.ts +5 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/community.loadOptions.js +80 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/course.loadOptions.d.ts +5 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/course.loadOptions.js +58 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/customFields.loadOptions.d.ts +12 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/customFields.loadOptions.js +55 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/group.loadOptions.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/group.loadOptions.js +7 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/hub.loadOptions.d.ts +3 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/hub.loadOptions.js +11 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/member.loadOptions.d.ts +9 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/member.loadOptions.js +27 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/module.loadOptions.d.ts +5 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/module.loadOptions.js +29 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/popup.loadOptions.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/popup.loadOptions.js +7 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/role.loadOptions.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/role.loadOptions.js +7 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/teamMember.loadOptions.d.ts +9 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/teamMember.loadOptions.js +35 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/webhook.loadOptions.d.ts +6 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/webhook.loadOptions.js +18 -0
- package/dist/nodes/LearningSuite/methods/resourceMappers/customFields.resourceMapper.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/resourceMappers/customFields.resourceMapper.js +35 -0
- package/dist/nodes/LearningSuite/methods/resourceMappers/hub.resourceMapper.d.ts +2 -0
- package/dist/nodes/LearningSuite/methods/resourceMappers/hub.resourceMapper.js +34 -0
- package/dist/nodes/LearningSuite/shared/customFields.helpers.d.ts +4 -0
- package/dist/nodes/LearningSuite/shared/customFields.helpers.js +56 -0
- package/dist/nodes/LearningSuite/shared/customFields.shared.d.ts +42 -0
- package/dist/nodes/LearningSuite/shared/customFields.shared.js +101 -0
- package/dist/nodes/LearningSuite/shared/customFields.upload.d.ts +13 -0
- package/dist/nodes/LearningSuite/shared/customFields.upload.js +198 -0
- package/dist/nodes/LearningSuite/shared/errors.d.ts +1 -0
- package/dist/nodes/LearningSuite/shared/errors.js +16 -0
- package/dist/nodes/LearningSuite/shared/getScopedParam.d.ts +2 -0
- package/dist/nodes/LearningSuite/shared/getScopedParam.js +39 -0
- package/dist/nodes/LearningSuite/shared/index.d.ts +4 -0
- package/dist/nodes/LearningSuite/shared/index.js +20 -0
- package/dist/nodes/LearningSuite/shared/parsing.d.ts +1 -0
- package/dist/nodes/LearningSuite/shared/parsing.js +15 -0
- package/dist/nodes/LearningSuite/shared/request.d.ts +13 -0
- package/dist/nodes/LearningSuite/shared/request.js +53 -0
- package/dist/nodes/LearningSuitePollingTrigger/LearningSuitePollingTrigger.node.d.ts +11 -0
- package/dist/nodes/LearningSuitePollingTrigger/LearningSuitePollingTrigger.node.js +278 -0
- package/dist/nodes/LearningSuitePollingTrigger/descriptions/trigger.polling.properties.d.ts +2 -0
- package/dist/nodes/LearningSuitePollingTrigger/descriptions/trigger.polling.properties.js +193 -0
- package/package.json +65 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customFields_getCards = customFields_getCards;
|
|
4
|
+
exports.customFields_getDefinitions = customFields_getDefinitions;
|
|
5
|
+
exports.customFields_getCategories = customFields_getCategories;
|
|
6
|
+
exports.customFields_getFieldType = customFields_getFieldType;
|
|
7
|
+
exports.customFields_getFieldOptions = customFields_getFieldOptions;
|
|
8
|
+
const common_1 = require("./common");
|
|
9
|
+
const customFields_helpers_1 = require("../../shared/customFields.helpers");
|
|
10
|
+
async function customFields_getCards() {
|
|
11
|
+
return common_1.fetchOptions.call(this, '/custom-fields/cards', undefined, ['name', 'title'], ['id']);
|
|
12
|
+
}
|
|
13
|
+
async function customFields_getDefinitions() {
|
|
14
|
+
const cardId = this.getCurrentNodeParameter('cardId');
|
|
15
|
+
const customFieldCardId = this.getCurrentNodeParameter('customFieldCardId');
|
|
16
|
+
const filterCardId = cardId || customFieldCardId;
|
|
17
|
+
return common_1.fetchOptions.call(this, '/custom-fields/definitions', filterCardId ? { customFieldCardId: filterCardId } : undefined, ['label', 'name', 'key'], ['key']);
|
|
18
|
+
}
|
|
19
|
+
async function customFields_getCategories() {
|
|
20
|
+
const customFieldCardId = this.getCurrentNodeParameter('customFieldCardId');
|
|
21
|
+
return common_1.fetchOptions.call(this, '/custom-fields/categories', customFieldCardId ? { customFieldCardId } : undefined, ['name', 'title'], ['id']);
|
|
22
|
+
}
|
|
23
|
+
async function customFields_getFieldType() {
|
|
24
|
+
const fieldKey = this.getCurrentNodeParameter('fieldKey');
|
|
25
|
+
if (!fieldKey) {
|
|
26
|
+
return [{ name: 'Unknown', value: '' }];
|
|
27
|
+
}
|
|
28
|
+
const definition = await (0, customFields_helpers_1.fetchFieldDefinition)(this, fieldKey);
|
|
29
|
+
if (!definition) {
|
|
30
|
+
return [{ name: 'Unknown', value: '' }];
|
|
31
|
+
}
|
|
32
|
+
const simpleType = (0, customFields_helpers_1.getLsSimpleType)(definition);
|
|
33
|
+
return [{ name: simpleType, value: simpleType }];
|
|
34
|
+
}
|
|
35
|
+
async function customFields_getFieldOptions() {
|
|
36
|
+
var _a;
|
|
37
|
+
const fieldKey = this.getCurrentNodeParameter('fieldKey');
|
|
38
|
+
if (!fieldKey) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const definition = await (0, customFields_helpers_1.fetchFieldDefinition)(this, fieldKey);
|
|
42
|
+
if (!((_a = definition === null || definition === void 0 ? void 0 : definition.typeDefinition) === null || _a === void 0 ? void 0 : _a.options)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const options = definition.typeDefinition.options;
|
|
46
|
+
return options
|
|
47
|
+
.filter((opt) => opt && opt.key)
|
|
48
|
+
.map((opt) => {
|
|
49
|
+
var _a;
|
|
50
|
+
return ({
|
|
51
|
+
name: String((_a = opt.label) !== null && _a !== void 0 ? _a : opt.key),
|
|
52
|
+
value: String(opt.key),
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.group_getGroups = group_getGroups;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
async function group_getGroups() {
|
|
6
|
+
return common_1.fetchOptions.call(this, '/groups', undefined, ['name', 'title'], ['id', 'sid']);
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function hub_getHubs(this: ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
3
|
+
export declare function hub_getTemplates(this: ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hub_getHubs = hub_getHubs;
|
|
4
|
+
exports.hub_getTemplates = hub_getTemplates;
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
async function hub_getHubs() {
|
|
7
|
+
return common_1.fetchOptions.call(this, '/hubs', undefined, ['name', 'title'], ['id', 'sid']);
|
|
8
|
+
}
|
|
9
|
+
async function hub_getTemplates() {
|
|
10
|
+
return common_1.fetchOptions.call(this, '/hub-templates', undefined, ['name', 'title'], ['id', 'sid']);
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function member_getMembers(this: ILoadOptionsFunctions): Promise<{
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[]>;
|
|
6
|
+
export declare function member_getMembersByEmail(this: ILoadOptionsFunctions): Promise<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[]>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.member_getMembers = member_getMembers;
|
|
4
|
+
exports.member_getMembersByEmail = member_getMembersByEmail;
|
|
5
|
+
const shared_1 = require("../../shared");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
async function member_getMembers() {
|
|
8
|
+
const res = await shared_1.lsRequest.call(this, 'GET', '/members');
|
|
9
|
+
const rows = (0, common_1.ensureArray)(res);
|
|
10
|
+
return rows.map((m) => {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
const label = (m === null || m === void 0 ? void 0 : m.email)
|
|
13
|
+
? `${m.email}${m.firstName || m.lastName ? ` — ${[m.firstName, m.lastName].filter(Boolean).join(' ')}` : ''}`
|
|
14
|
+
: ((_a = m === null || m === void 0 ? void 0 : m.id) !== null && _a !== void 0 ? _a : 'Unknown');
|
|
15
|
+
return { name: String(label), value: String((_d = (_c = (_b = m === null || m === void 0 ? void 0 : m.id) !== null && _b !== void 0 ? _b : m === null || m === void 0 ? void 0 : m.sid) !== null && _c !== void 0 ? _c : m === null || m === void 0 ? void 0 : m.slug) !== null && _d !== void 0 ? _d : label) };
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async function member_getMembersByEmail() {
|
|
19
|
+
const res = await shared_1.lsRequest.call(this, 'GET', '/members');
|
|
20
|
+
const rows = (0, common_1.ensureArray)(res);
|
|
21
|
+
return rows
|
|
22
|
+
.filter((m) => !!m.email)
|
|
23
|
+
.map((m) => {
|
|
24
|
+
const label = `${m.email}${m.firstName || m.lastName ? ` — ${[m.firstName, m.lastName].filter(Boolean).join(' ')}` : ''}`;
|
|
25
|
+
return { name: String(label), value: String(m.email) };
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
+
export declare function module_getAllModules(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
3
|
+
export declare function module_getModules(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
4
|
+
export declare function module_getSections(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
5
|
+
export declare function module_getLessons(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.module_getAllModules = module_getAllModules;
|
|
4
|
+
exports.module_getModules = module_getModules;
|
|
5
|
+
exports.module_getSections = module_getSections;
|
|
6
|
+
exports.module_getLessons = module_getLessons;
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
const getScopedParam_1 = require("../../shared/getScopedParam");
|
|
9
|
+
async function module_getAllModules() {
|
|
10
|
+
return common_1.fetchOptions.call(this, '/modules', undefined, ['title', 'name'], ['id', 'sid']);
|
|
11
|
+
}
|
|
12
|
+
async function module_getModules() {
|
|
13
|
+
const courseId = getScopedParam_1.getScopedParam.call(this, 'courseId');
|
|
14
|
+
if (!courseId)
|
|
15
|
+
return [];
|
|
16
|
+
return common_1.fetchOptions.call(this, `/courses/${courseId}/modules`, undefined, ['title', 'name'], ['id', 'sid']);
|
|
17
|
+
}
|
|
18
|
+
async function module_getSections() {
|
|
19
|
+
const moduleId = getScopedParam_1.getScopedParam.call(this, 'moduleId');
|
|
20
|
+
if (!moduleId)
|
|
21
|
+
return [];
|
|
22
|
+
return common_1.fetchOptions.call(this, `/modules/${moduleId}/sections`, undefined, ['title', 'name'], ['id', 'sid']);
|
|
23
|
+
}
|
|
24
|
+
async function module_getLessons() {
|
|
25
|
+
const moduleId = getScopedParam_1.getScopedParam.call(this, 'moduleId');
|
|
26
|
+
if (!moduleId)
|
|
27
|
+
return [];
|
|
28
|
+
return common_1.fetchOptions.call(this, `/modules/${moduleId}/lessons`, undefined, ['title', 'name'], ['id', 'sid']);
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popup_getPopups = popup_getPopups;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
async function popup_getPopups() {
|
|
6
|
+
return common_1.fetchOptions.call(this, '/popups', undefined, ['internalName', 'sid'], ['id']);
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.role_getRoles = role_getRoles;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
async function role_getRoles() {
|
|
6
|
+
return common_1.fetchOptions.call(this, '/user/roles', undefined, ['name'], ['id']);
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function teamMember_getTeamMembersById(this: ILoadOptionsFunctions): Promise<{
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[]>;
|
|
6
|
+
export declare function teamMember_getTeamMembersByEmail(this: ILoadOptionsFunctions): Promise<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.teamMember_getTeamMembersById = teamMember_getTeamMembersById;
|
|
4
|
+
exports.teamMember_getTeamMembersByEmail = teamMember_getTeamMembersByEmail;
|
|
5
|
+
const shared_1 = require("../../shared");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
function buildLabel(m) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const fullName = (m === null || m === void 0 ? void 0 : m.fullName) || [m === null || m === void 0 ? void 0 : m.firstName, m === null || m === void 0 ? void 0 : m.lastName].filter(Boolean).join(' ') || 'Unbekannt';
|
|
10
|
+
const role = (_a = m === null || m === void 0 ? void 0 : m.roleId) !== null && _a !== void 0 ? _a : '—';
|
|
11
|
+
const email = (_b = m === null || m === void 0 ? void 0 : m.email) !== null && _b !== void 0 ? _b : '';
|
|
12
|
+
return [fullName, role, email].filter(Boolean).join(' - ');
|
|
13
|
+
}
|
|
14
|
+
async function teamMember_getTeamMembersById() {
|
|
15
|
+
const res = await shared_1.lsRequest.call(this, 'GET', '/team-members?limit=100');
|
|
16
|
+
const rows = (0, common_1.ensureArray)(res);
|
|
17
|
+
return rows.map((m) => {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
return ({
|
|
20
|
+
name: buildLabel(m),
|
|
21
|
+
value: String((_c = (_b = (_a = m === null || m === void 0 ? void 0 : m.id) !== null && _a !== void 0 ? _a : m === null || m === void 0 ? void 0 : m.sid) !== null && _b !== void 0 ? _b : m === null || m === void 0 ? void 0 : m.slug) !== null && _c !== void 0 ? _c : 'Unknown'),
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function teamMember_getTeamMembersByEmail() {
|
|
26
|
+
const res = await shared_1.lsRequest.call(this, 'GET', '/team-members?limit=100');
|
|
27
|
+
const rows = (0, common_1.ensureArray)(res);
|
|
28
|
+
return rows.map((m) => {
|
|
29
|
+
var _a;
|
|
30
|
+
return ({
|
|
31
|
+
name: buildLabel(m),
|
|
32
|
+
value: String((_a = m === null || m === void 0 ? void 0 : m.email) !== null && _a !== void 0 ? _a : 'Unknown'),
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webhook_getSubscriptions = webhook_getSubscriptions;
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
async function webhook_getSubscriptions() {
|
|
7
|
+
const res = await shared_1.lsRequest.call(this, 'GET', '/webhooks/subscription');
|
|
8
|
+
const rows = (0, common_1.ensureArray)(res);
|
|
9
|
+
return rows.map((s) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const label = (_a = s === null || s === void 0 ? void 0 : s.type) !== null && _a !== void 0 ? _a : 'Unknown type';
|
|
12
|
+
return {
|
|
13
|
+
name: String(label),
|
|
14
|
+
description: String(s === null || s === void 0 ? void 0 : s.url),
|
|
15
|
+
value: String(s === null || s === void 0 ? void 0 : s.id),
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMultipleCustomFieldValueResourceMapperFields = getMultipleCustomFieldValueResourceMapperFields;
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
5
|
+
const customFields_shared_1 = require("../../shared/customFields.shared");
|
|
6
|
+
async function getMultipleCustomFieldValueResourceMapperFields() {
|
|
7
|
+
try {
|
|
8
|
+
const cards = await shared_1.lsRequest.call(this, 'GET', '/custom-fields/cards/expanded');
|
|
9
|
+
if (!Array.isArray(cards)) {
|
|
10
|
+
return { fields: [] };
|
|
11
|
+
}
|
|
12
|
+
const definitions = (0, customFields_shared_1.collectAllFieldDefinitions)(cards);
|
|
13
|
+
if (definitions.length === 0) {
|
|
14
|
+
return { fields: [] };
|
|
15
|
+
}
|
|
16
|
+
const fields = definitions.map((def) => {
|
|
17
|
+
const mapped = (0, customFields_shared_1.mapLsType)(def);
|
|
18
|
+
const displayName = mapped.maxInfo ? `${def.name} (${mapped.maxInfo})` : def.name;
|
|
19
|
+
return {
|
|
20
|
+
id: def.key,
|
|
21
|
+
displayName: displayName || def.key,
|
|
22
|
+
type: mapped.type,
|
|
23
|
+
options: mapped.options,
|
|
24
|
+
required: false,
|
|
25
|
+
canBeUsedToMatch: false,
|
|
26
|
+
defaultMatch: false,
|
|
27
|
+
display: true,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
return { fields };
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return { fields: [] };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTemplateVariablesResourceMapperFields = getTemplateVariablesResourceMapperFields;
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
5
|
+
const templateVariablesCache = new Map();
|
|
6
|
+
async function getTemplateVariablesResourceMapperFields() {
|
|
7
|
+
const templateId = this.getCurrentNodeParameter('templateId');
|
|
8
|
+
if (templateId === undefined || templateId === null) {
|
|
9
|
+
return { fields: [] };
|
|
10
|
+
}
|
|
11
|
+
if (templateId === '' || templateId === 'undefined' || templateId === 'null') {
|
|
12
|
+
return { fields: [] };
|
|
13
|
+
}
|
|
14
|
+
const cached = templateVariablesCache.get(templateId);
|
|
15
|
+
if (cached) {
|
|
16
|
+
return cached;
|
|
17
|
+
}
|
|
18
|
+
const raw = (await shared_1.lsRequest.call(this, 'GET', `/hub-template/${templateId}/variables`));
|
|
19
|
+
const variables = Array.isArray(raw)
|
|
20
|
+
? raw.filter((variable) => typeof variable === 'string')
|
|
21
|
+
: [];
|
|
22
|
+
const fields = variables.map((variable) => ({
|
|
23
|
+
id: variable,
|
|
24
|
+
displayName: variable,
|
|
25
|
+
defaultMatch: false,
|
|
26
|
+
canBeUsedToMatch: false,
|
|
27
|
+
required: true,
|
|
28
|
+
display: true,
|
|
29
|
+
type: 'string',
|
|
30
|
+
}));
|
|
31
|
+
const mapped = { fields };
|
|
32
|
+
templateVariablesCache.set(templateId, mapped);
|
|
33
|
+
return mapped;
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { LsFieldDefinition } from './customFields.shared';
|
|
3
|
+
export declare function fetchFieldDefinition(ctx: ILoadOptionsFunctions, fieldKey: string): Promise<LsFieldDefinition | undefined>;
|
|
4
|
+
export declare function getLsSimpleType(def: LsFieldDefinition): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// n8n-nodes-learningsuite/nodes/LearningSuite/methods/loadOptions/customFields.helpers.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.fetchFieldDefinition = fetchFieldDefinition;
|
|
5
|
+
exports.getLsSimpleType = getLsSimpleType;
|
|
6
|
+
const request_1 = require("./request");
|
|
7
|
+
const customFields_shared_1 = require("./customFields.shared");
|
|
8
|
+
async function fetchFieldDefinition(ctx, fieldKey) {
|
|
9
|
+
const cards = await request_1.lsRequest.call(ctx, 'GET', '/custom-fields/cards/expanded');
|
|
10
|
+
if (!Array.isArray(cards)) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
for (const card of cards) {
|
|
14
|
+
if (!(0, customFields_shared_1.isLsCard)(card) || !Array.isArray(card.definitions)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const found = card.definitions.find((d) => (0, customFields_shared_1.isLsFieldDefinition)(d) && d.key === fieldKey);
|
|
18
|
+
if (found) {
|
|
19
|
+
return found;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
function getLsSimpleType(def) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const td = def === null || def === void 0 ? void 0 : def.typeDefinition;
|
|
27
|
+
if (!td) {
|
|
28
|
+
return 'string';
|
|
29
|
+
}
|
|
30
|
+
const type = String((_a = td.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
31
|
+
const variant = String((_b = td.variant) !== null && _b !== void 0 ? _b : '').toLowerCase();
|
|
32
|
+
switch (type) {
|
|
33
|
+
case 'string':
|
|
34
|
+
return 'string';
|
|
35
|
+
case 'number':
|
|
36
|
+
return 'number';
|
|
37
|
+
case 'boolean':
|
|
38
|
+
return 'boolean';
|
|
39
|
+
case 'datetime':
|
|
40
|
+
case 'date':
|
|
41
|
+
case 'time':
|
|
42
|
+
return 'dateTime';
|
|
43
|
+
case 'select':
|
|
44
|
+
return variant === 'multi' ? 'multiOptions' : 'option';
|
|
45
|
+
case 'files':
|
|
46
|
+
return 'files';
|
|
47
|
+
case 'images':
|
|
48
|
+
return 'images';
|
|
49
|
+
case 'videos':
|
|
50
|
+
return 'videos';
|
|
51
|
+
case 'audios':
|
|
52
|
+
return 'audios';
|
|
53
|
+
default:
|
|
54
|
+
return 'string';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FieldType } from 'n8n-workflow';
|
|
2
|
+
export interface LsOption {
|
|
3
|
+
key: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LsTypeDefinition {
|
|
7
|
+
type?: string;
|
|
8
|
+
variant?: string;
|
|
9
|
+
options?: LsOption[];
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
maxImages?: number;
|
|
12
|
+
maxVideos?: number;
|
|
13
|
+
maxAudios?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface LsFieldDefinition {
|
|
16
|
+
key: string;
|
|
17
|
+
name: string;
|
|
18
|
+
typeDefinition?: LsTypeDefinition;
|
|
19
|
+
}
|
|
20
|
+
export interface LsCard {
|
|
21
|
+
definitions?: LsFieldDefinition[];
|
|
22
|
+
}
|
|
23
|
+
export interface MappedTypeResult {
|
|
24
|
+
type: FieldType;
|
|
25
|
+
options?: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
maxInfo?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const SIMPLE_TYPE_MAPPING: Record<string, FieldType>;
|
|
32
|
+
export declare const MEDIA_TYPES: readonly ["files", "images", "videos", "audios"];
|
|
33
|
+
export declare function isLsCard(value: unknown): value is LsCard;
|
|
34
|
+
export declare function isLsFieldDefinition(value: unknown): value is LsFieldDefinition;
|
|
35
|
+
export declare function toOptions(def: LsFieldDefinition): Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}> | undefined;
|
|
39
|
+
export declare function mapLsType(def: LsFieldDefinition): MappedTypeResult;
|
|
40
|
+
export declare function isValidFieldKey(fieldKey: string | undefined): fieldKey is string;
|
|
41
|
+
export declare function findFieldDefinition(cards: unknown[], fieldKey: string): LsFieldDefinition | undefined;
|
|
42
|
+
export declare function collectAllFieldDefinitions(cards: unknown[]): LsFieldDefinition[];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// n8n-nodes-learningsuite/nodes/LearningSuite/shared/customFields.shared.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MEDIA_TYPES = exports.SIMPLE_TYPE_MAPPING = void 0;
|
|
5
|
+
exports.isLsCard = isLsCard;
|
|
6
|
+
exports.isLsFieldDefinition = isLsFieldDefinition;
|
|
7
|
+
exports.toOptions = toOptions;
|
|
8
|
+
exports.mapLsType = mapLsType;
|
|
9
|
+
exports.isValidFieldKey = isValidFieldKey;
|
|
10
|
+
exports.findFieldDefinition = findFieldDefinition;
|
|
11
|
+
exports.collectAllFieldDefinitions = collectAllFieldDefinitions;
|
|
12
|
+
exports.SIMPLE_TYPE_MAPPING = {
|
|
13
|
+
string: 'string',
|
|
14
|
+
number: 'number',
|
|
15
|
+
boolean: 'boolean',
|
|
16
|
+
datetime: 'dateTime',
|
|
17
|
+
};
|
|
18
|
+
exports.MEDIA_TYPES = ['files', 'images', 'videos', 'audios'];
|
|
19
|
+
function isLsCard(value) {
|
|
20
|
+
return typeof value === 'object' && value !== null;
|
|
21
|
+
}
|
|
22
|
+
function isLsFieldDefinition(value) {
|
|
23
|
+
if (typeof value !== 'object' || value === null || !('key' in value)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const candidate = value;
|
|
27
|
+
return typeof candidate.key === 'string';
|
|
28
|
+
}
|
|
29
|
+
function toOptions(def) {
|
|
30
|
+
var _a;
|
|
31
|
+
const opts = (_a = def === null || def === void 0 ? void 0 : def.typeDefinition) === null || _a === void 0 ? void 0 : _a.options;
|
|
32
|
+
if (!Array.isArray(opts) || opts.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const validOptions = opts
|
|
36
|
+
.filter((o) => Boolean(o && o.key !== undefined))
|
|
37
|
+
.map((o) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return ({
|
|
40
|
+
name: String((_a = o.label) !== null && _a !== void 0 ? _a : o.key),
|
|
41
|
+
value: String(o.key),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
return validOptions.length > 0 ? validOptions : undefined;
|
|
45
|
+
}
|
|
46
|
+
function mapLsType(def) {
|
|
47
|
+
var _a, _b, _c, _d, _e;
|
|
48
|
+
const td = def === null || def === void 0 ? void 0 : def.typeDefinition;
|
|
49
|
+
if (!td) {
|
|
50
|
+
return { type: 'string' };
|
|
51
|
+
}
|
|
52
|
+
const typeRaw = String((_a = td.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
53
|
+
const variantRaw = String((_b = td.variant) !== null && _b !== void 0 ? _b : '').toLowerCase();
|
|
54
|
+
if (typeRaw === 'select') {
|
|
55
|
+
const options = toOptions(def);
|
|
56
|
+
if (variantRaw === 'multi') {
|
|
57
|
+
return { type: 'array', options };
|
|
58
|
+
}
|
|
59
|
+
return { type: 'options', options };
|
|
60
|
+
}
|
|
61
|
+
if (exports.MEDIA_TYPES.includes(typeRaw)) {
|
|
62
|
+
const max = (_e = (_d = (_c = td.maxFiles) !== null && _c !== void 0 ? _c : td.maxImages) !== null && _d !== void 0 ? _d : td.maxVideos) !== null && _e !== void 0 ? _e : td.maxAudios;
|
|
63
|
+
return {
|
|
64
|
+
type: 'string',
|
|
65
|
+
maxInfo: typeof max === 'number' ? `max. ${max}` : undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (typeRaw in exports.SIMPLE_TYPE_MAPPING) {
|
|
69
|
+
return { type: exports.SIMPLE_TYPE_MAPPING[typeRaw] };
|
|
70
|
+
}
|
|
71
|
+
return { type: 'string' };
|
|
72
|
+
}
|
|
73
|
+
function isValidFieldKey(fieldKey) {
|
|
74
|
+
return Boolean(fieldKey && fieldKey.trim() !== '');
|
|
75
|
+
}
|
|
76
|
+
function findFieldDefinition(cards, fieldKey) {
|
|
77
|
+
for (const card of cards) {
|
|
78
|
+
if (!isLsCard(card) || !Array.isArray(card.definitions)) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const found = card.definitions.find((d) => isLsFieldDefinition(d) && d.key === fieldKey);
|
|
82
|
+
if (found) {
|
|
83
|
+
return found;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
function collectAllFieldDefinitions(cards) {
|
|
89
|
+
const fields = [];
|
|
90
|
+
for (const card of cards) {
|
|
91
|
+
if (!isLsCard(card) || !Array.isArray(card.definitions)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
for (const def of card.definitions) {
|
|
95
|
+
if (isLsFieldDefinition(def) && def.typeDefinition) {
|
|
96
|
+
fields.push(def);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return fields;
|
|
101
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
interface UploadedFileValue {
|
|
3
|
+
fileId: string;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
fileSize: number;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Uploads one or more binary properties and returns the array of file value objects.
|
|
10
|
+
* The binaryPropertyNames parameter can be a comma-separated list (e.g. "data,file1,file2").
|
|
11
|
+
*/
|
|
12
|
+
export declare function uploadFilesFromBinaryProperties(ctx: IExecuteFunctions, itemIndex: number, userId: string, binaryPropertyNames: string, fieldType: string, fileNameOverride?: string): Promise<UploadedFileValue[]>;
|
|
13
|
+
export {};
|