@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,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.memberHandlers = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
const getByEmail = async (ctx, i) => {
|
|
6
|
+
const email = ctx.getNodeParameter('email', i);
|
|
7
|
+
const includeGroups = ctx.getNodeParameter('includeGroups', i);
|
|
8
|
+
const qs = { email };
|
|
9
|
+
if (includeGroups)
|
|
10
|
+
qs.includeGroups = includeGroups;
|
|
11
|
+
return await shared_1.lsRequest.call(ctx, 'GET', '/members/by-email', { qs });
|
|
12
|
+
};
|
|
13
|
+
const getById = async (ctx, i) => {
|
|
14
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
15
|
+
const includeGroups = ctx.getNodeParameter('includeGroups', i);
|
|
16
|
+
const qs = {};
|
|
17
|
+
if (includeGroups)
|
|
18
|
+
qs.includeGroups = includeGroups;
|
|
19
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}`, { qs });
|
|
20
|
+
};
|
|
21
|
+
const getAll = async (ctx, i) => {
|
|
22
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
23
|
+
const includeGroups = ctx.getNodeParameter('includeGroups', i);
|
|
24
|
+
const limit = ctx.getNodeParameter('limit', i);
|
|
25
|
+
const offset = ctx.getNodeParameter('offset', i);
|
|
26
|
+
const qs = {};
|
|
27
|
+
if (includeGroups !== undefined)
|
|
28
|
+
qs.includeGroups = includeGroups;
|
|
29
|
+
if (limit !== undefined)
|
|
30
|
+
qs.limit = limit;
|
|
31
|
+
if (offset !== undefined)
|
|
32
|
+
qs.offset = offset;
|
|
33
|
+
const days = additionalOptions.daysNotLoggedInGte;
|
|
34
|
+
const includeNever = additionalOptions.includeNeverLoggedIn;
|
|
35
|
+
if (days !== undefined)
|
|
36
|
+
qs.days_not_logged_in_gte = days;
|
|
37
|
+
if (includeNever !== undefined)
|
|
38
|
+
qs.include_never_logged_in = includeNever;
|
|
39
|
+
return await shared_1.lsRequest.call(ctx, 'GET', '/members', { qs });
|
|
40
|
+
};
|
|
41
|
+
const create = async (ctx, i) => {
|
|
42
|
+
const memberEmail = ctx.getNodeParameter('memberEmail', i);
|
|
43
|
+
const firstName = ctx.getNodeParameter('firstName', i);
|
|
44
|
+
const lastName = ctx.getNodeParameter('lastName', i);
|
|
45
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
46
|
+
const body = {
|
|
47
|
+
email: memberEmail,
|
|
48
|
+
firstName,
|
|
49
|
+
lastName,
|
|
50
|
+
...additionalOptions,
|
|
51
|
+
};
|
|
52
|
+
for (const k of Object.keys(body)) {
|
|
53
|
+
if (body[k] === '' || body[k] == null)
|
|
54
|
+
delete body[k];
|
|
55
|
+
}
|
|
56
|
+
return shared_1.lsRequest.call(ctx, 'POST', '/members', { body });
|
|
57
|
+
};
|
|
58
|
+
const update = async (ctx, i) => {
|
|
59
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
60
|
+
const firstName = ctx.getNodeParameter('firstName', i, '');
|
|
61
|
+
const lastName = ctx.getNodeParameter('lastName', i, '');
|
|
62
|
+
const updateFields = ctx.getNodeParameter('updateFields', i, {});
|
|
63
|
+
const body = { ...updateFields };
|
|
64
|
+
if (firstName)
|
|
65
|
+
body.firstName = firstName;
|
|
66
|
+
if (lastName)
|
|
67
|
+
body.lastName = lastName;
|
|
68
|
+
for (const k of Object.keys(body)) {
|
|
69
|
+
if (body[k] === '' || body[k] == null)
|
|
70
|
+
delete body[k];
|
|
71
|
+
}
|
|
72
|
+
return shared_1.lsRequest.call(ctx, 'PUT', `/members/${memberId}`, { body });
|
|
73
|
+
};
|
|
74
|
+
const del = async (ctx, i) => {
|
|
75
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
76
|
+
return await shared_1.lsRequest.call(ctx, 'DELETE', `/members/${memberId}`);
|
|
77
|
+
};
|
|
78
|
+
const activateDeactivate = async (ctx, i) => {
|
|
79
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
80
|
+
const activateAction = ctx.getNodeParameter('activateAction', i);
|
|
81
|
+
return await shared_1.lsRequest.call(ctx, 'PUT', `/members/${memberId}`, { body: { enabled: activateAction === 'activate' } });
|
|
82
|
+
};
|
|
83
|
+
const addToCourses = async (ctx, i) => {
|
|
84
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
85
|
+
const courseIds = (0, shared_1.toIdArray)(ctx.getNodeParameter('courseIds', i));
|
|
86
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
87
|
+
return await shared_1.lsRequest.call(ctx, 'PUT', `/members/${memberId}/courses`, {
|
|
88
|
+
body: { courseIds, ...additionalOptions },
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const removeFromCourses = async (ctx, i) => {
|
|
92
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
93
|
+
const courseIds = (0, shared_1.toIdArray)(ctx.getNodeParameter('courseIds', i));
|
|
94
|
+
return await shared_1.lsRequest.call(ctx, 'DELETE', `/members/${memberId}/courses`, { body: { courseIds } });
|
|
95
|
+
};
|
|
96
|
+
const getCourses = async (ctx, i) => {
|
|
97
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
98
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/courses`);
|
|
99
|
+
};
|
|
100
|
+
const getCourseInfo = async (ctx, i) => {
|
|
101
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
102
|
+
const courseId = ctx.getNodeParameter('courseId', i);
|
|
103
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/course-info/${courseId}`);
|
|
104
|
+
};
|
|
105
|
+
const getCourseProgress = async (ctx, i) => {
|
|
106
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
107
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i);
|
|
108
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/course-progress/${courseInstanceId}`);
|
|
109
|
+
};
|
|
110
|
+
const getModuleProgress = async (ctx, i) => {
|
|
111
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
112
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i);
|
|
113
|
+
const moduleId = ctx.getNodeParameter('moduleId', i);
|
|
114
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/course-progress/${courseInstanceId}/module/${moduleId}`);
|
|
115
|
+
};
|
|
116
|
+
const getLessonProgress = async (ctx, i) => {
|
|
117
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
118
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i);
|
|
119
|
+
const lessonId = ctx.getNodeParameter('lessonId', i);
|
|
120
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/course-progress/${courseInstanceId}/lesson/${lessonId}`);
|
|
121
|
+
};
|
|
122
|
+
const setCourseProgress = async (ctx, i) => {
|
|
123
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
124
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i);
|
|
125
|
+
const setForWholeCourse = ctx.getNodeParameter('setForWholeCourse', i);
|
|
126
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
127
|
+
const body = {};
|
|
128
|
+
if (setForWholeCourse) {
|
|
129
|
+
body.setForWholeCourse = true;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
if (additionalOptions.modulesToSetCompleted) {
|
|
133
|
+
body.modulesToSetCompleted = (0, shared_1.toIdArray)(additionalOptions.modulesToSetCompleted);
|
|
134
|
+
}
|
|
135
|
+
if (additionalOptions.lessonsToSetCompleted) {
|
|
136
|
+
body.lessonsToSetCompleted = (0, shared_1.toIdArray)(additionalOptions.lessonsToSetCompleted);
|
|
137
|
+
}
|
|
138
|
+
if (additionalOptions.pagesToSetCompleted) {
|
|
139
|
+
body.pagesToSetCompleted = (0, shared_1.toIdArray)(additionalOptions.pagesToSetCompleted);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return await shared_1.lsRequest.call(ctx, 'PUT', `/members/${memberId}/course-progress/${courseInstanceId}`, { body });
|
|
143
|
+
};
|
|
144
|
+
const resetCourseProgress = async (ctx, i) => {
|
|
145
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
146
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i);
|
|
147
|
+
const setForWholeCourse = ctx.getNodeParameter('setForWholeCourse', i);
|
|
148
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
149
|
+
const body = {};
|
|
150
|
+
if (setForWholeCourse) {
|
|
151
|
+
body.setForWholeCourse = true;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
if (additionalOptions.modulesToResetProgressFor) {
|
|
155
|
+
body.modulesToResetProgressFor = (0, shared_1.toIdArray)(additionalOptions.modulesToResetProgressFor);
|
|
156
|
+
}
|
|
157
|
+
if (additionalOptions.lessonsToResetProgressFor) {
|
|
158
|
+
body.lessonsToResetProgressFor = (0, shared_1.toIdArray)(additionalOptions.lessonsToResetProgressFor);
|
|
159
|
+
}
|
|
160
|
+
if (additionalOptions.pagesToResetProgressFor) {
|
|
161
|
+
body.pagesToResetProgressFor = (0, shared_1.toIdArray)(additionalOptions.pagesToResetProgressFor);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return await shared_1.lsRequest.call(ctx, 'DELETE', `/members/${memberId}/course-progress/${courseInstanceId}`, { body });
|
|
165
|
+
};
|
|
166
|
+
const addToBundles = async (ctx, i) => {
|
|
167
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
168
|
+
const bundles = (0, shared_1.toIdArray)(ctx.getNodeParameter('bundles', i));
|
|
169
|
+
const add = ctx.getNodeParameter('additionalOptions', i, {});
|
|
170
|
+
const body = { bundles };
|
|
171
|
+
if (add.accessGivenAtOverride) {
|
|
172
|
+
body.accessGivenAtOverride = String(add.accessGivenAtOverride);
|
|
173
|
+
}
|
|
174
|
+
if (add.unlimitedAccess === true) {
|
|
175
|
+
body.unlimitedAccess = true;
|
|
176
|
+
}
|
|
177
|
+
else if (add.accessUntilOverride) {
|
|
178
|
+
body.accessUntilOverride = String(add.accessUntilOverride);
|
|
179
|
+
}
|
|
180
|
+
if (typeof add.disableAccessNotificationEmail === 'boolean') {
|
|
181
|
+
body.disableAccessNotificationEmail = add.disableAccessNotificationEmail;
|
|
182
|
+
}
|
|
183
|
+
return shared_1.lsRequest.call(ctx, 'PUT', `/members/${memberId}/bundles`, { body });
|
|
184
|
+
};
|
|
185
|
+
const removeFromBundles = async (ctx, i) => {
|
|
186
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
187
|
+
const bundleIds = (0, shared_1.toIdArray)(ctx.getNodeParameter('bundleIds', i));
|
|
188
|
+
return shared_1.lsRequest.call(ctx, 'DELETE', `/members/${memberId}/bundles`, {
|
|
189
|
+
body: { bundleIds },
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const getBundles = async (ctx, i) => {
|
|
193
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
194
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/members/${memberId}/bundles`);
|
|
195
|
+
};
|
|
196
|
+
const findOrCreate = async (ctx, i) => {
|
|
197
|
+
const email = ctx.getNodeParameter('email', i);
|
|
198
|
+
try {
|
|
199
|
+
return await shared_1.lsRequest.call(ctx, 'GET', '/members/by-email', { qs: { email } });
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
const is404 = (0, shared_1.getHttpCode)(error) === 404;
|
|
203
|
+
if (!is404) {
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
const firstName = ctx.getNodeParameter('firstName', i, '');
|
|
207
|
+
const lastName = ctx.getNodeParameter('lastName', i, '');
|
|
208
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
209
|
+
const body = {
|
|
210
|
+
email,
|
|
211
|
+
firstName,
|
|
212
|
+
lastName,
|
|
213
|
+
...additionalOptions,
|
|
214
|
+
};
|
|
215
|
+
for (const k of Object.keys(body)) {
|
|
216
|
+
if (body[k] === '' || body[k] == null) {
|
|
217
|
+
delete body[k];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return await shared_1.lsRequest.call(ctx, 'POST', '/members', { body });
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
exports.memberHandlers = {
|
|
224
|
+
getByEmail,
|
|
225
|
+
getById,
|
|
226
|
+
getAll,
|
|
227
|
+
create,
|
|
228
|
+
update,
|
|
229
|
+
delete: del,
|
|
230
|
+
activateDeactivate,
|
|
231
|
+
addToCourses,
|
|
232
|
+
removeFromCourses,
|
|
233
|
+
getCourses,
|
|
234
|
+
getCourseInfo,
|
|
235
|
+
getCourseProgress,
|
|
236
|
+
getModuleProgress,
|
|
237
|
+
getLessonProgress,
|
|
238
|
+
setCourseProgress,
|
|
239
|
+
resetCourseProgress,
|
|
240
|
+
addToBundles,
|
|
241
|
+
removeFromBundles,
|
|
242
|
+
getBundles,
|
|
243
|
+
findOrCreate,
|
|
244
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moduleHandlers = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
const getLessons = async (ctx, i) => {
|
|
6
|
+
const moduleId = ctx.getNodeParameter('moduleId', i);
|
|
7
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/modules/${moduleId}/lessons`);
|
|
8
|
+
};
|
|
9
|
+
const getSections = async (ctx, i) => {
|
|
10
|
+
const moduleId = ctx.getNodeParameter('moduleId', i);
|
|
11
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/modules/${moduleId}/sections`);
|
|
12
|
+
};
|
|
13
|
+
const createUnlockOverride = async (ctx, i) => {
|
|
14
|
+
const moduleId = ctx.getNodeParameter('moduleId', i);
|
|
15
|
+
const memberId = ctx.getNodeParameter('memberId', i, '');
|
|
16
|
+
const courseInstanceId = ctx.getNodeParameter('courseId', i, '');
|
|
17
|
+
const additionalOptions = ctx.getNodeParameter('additionalOptions', i, {});
|
|
18
|
+
const newModuleAccess = ctx.getNodeParameter('newModuleAccess', i, '');
|
|
19
|
+
const body = {
|
|
20
|
+
moduleId,
|
|
21
|
+
userId: memberId || undefined,
|
|
22
|
+
courseInstanceId: courseInstanceId || undefined,
|
|
23
|
+
new_module_access: newModuleAccess || undefined,
|
|
24
|
+
...additionalOptions,
|
|
25
|
+
};
|
|
26
|
+
Object.keys(body).forEach((k) => {
|
|
27
|
+
if (body[k] === '' || body[k] === undefined || body[k] === null)
|
|
28
|
+
delete body[k];
|
|
29
|
+
});
|
|
30
|
+
return await shared_1.lsRequest.call(ctx, 'POST', '/create-module-unlock-override', { body });
|
|
31
|
+
};
|
|
32
|
+
exports.moduleHandlers = {
|
|
33
|
+
getLessons,
|
|
34
|
+
getSections,
|
|
35
|
+
createUnlockOverride,
|
|
36
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popupHandlers = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
const getAll = async (ctx, i) => {
|
|
6
|
+
const limit = ctx.getNodeParameter('limit', i, 100);
|
|
7
|
+
const offset = ctx.getNodeParameter('offset', i, 0);
|
|
8
|
+
return await shared_1.lsRequest.call(ctx, 'GET', '/popups', { qs: { limit, offset } });
|
|
9
|
+
};
|
|
10
|
+
const get = async (ctx, i) => {
|
|
11
|
+
const popupId = ctx.getNodeParameter('popupId', i);
|
|
12
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/popups/${popupId}`);
|
|
13
|
+
};
|
|
14
|
+
const triggerForMember = async (ctx, i) => {
|
|
15
|
+
const popupId = ctx.getNodeParameter('popupId', i);
|
|
16
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
17
|
+
return await shared_1.lsRequest.call(ctx, 'POST', `/popups/${popupId}/trigger/${memberId}`);
|
|
18
|
+
};
|
|
19
|
+
const removeTriggerForMember = async (ctx, i) => {
|
|
20
|
+
const popupId = ctx.getNodeParameter('popupId', i);
|
|
21
|
+
const memberId = ctx.getNodeParameter('memberId', i);
|
|
22
|
+
return await shared_1.lsRequest.call(ctx, 'DELETE', `/popups/${popupId}/trigger/${memberId}`);
|
|
23
|
+
};
|
|
24
|
+
exports.popupHandlers = { getAll, get, triggerForMember, removeTriggerForMember };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registry = void 0;
|
|
4
|
+
const apiCall_handlers_1 = require("./apiCall.handlers");
|
|
5
|
+
const bundle_handlers_1 = require("./bundle.handlers");
|
|
6
|
+
const community_handlers_1 = require("./community.handlers");
|
|
7
|
+
const course_handlers_1 = require("./course.handlers");
|
|
8
|
+
const group_handlers_1 = require("./group.handlers");
|
|
9
|
+
const hub_handlers_1 = require("./hub.handlers");
|
|
10
|
+
const member_handlers_1 = require("./member.handlers");
|
|
11
|
+
const module_handlers_1 = require("./module.handlers");
|
|
12
|
+
const popup_handlers_1 = require("./popup.handlers");
|
|
13
|
+
const role_handlers_1 = require("./role.handlers");
|
|
14
|
+
const webhook_handlers_1 = require("./webhook.handlers");
|
|
15
|
+
const teamMember_handlers_1 = require("./teamMember.handlers");
|
|
16
|
+
const user_handlers_1 = require("./user.handlers");
|
|
17
|
+
const customFields_handlers_1 = require("./customFields.handlers");
|
|
18
|
+
const ai_handlers_1 = require("./ai.handlers");
|
|
19
|
+
exports.registry = {
|
|
20
|
+
ai: ai_handlers_1.aiHandlers,
|
|
21
|
+
apiCall: apiCall_handlers_1.apiCallHandlers,
|
|
22
|
+
bundle: bundle_handlers_1.bundleHandlers,
|
|
23
|
+
community: community_handlers_1.communityHandlers,
|
|
24
|
+
course: course_handlers_1.courseHandlers,
|
|
25
|
+
customFields: customFields_handlers_1.customFieldsHandlers,
|
|
26
|
+
group: group_handlers_1.groupHandlers,
|
|
27
|
+
hub: hub_handlers_1.hubHandlers,
|
|
28
|
+
member: member_handlers_1.memberHandlers,
|
|
29
|
+
module: module_handlers_1.moduleHandlers,
|
|
30
|
+
popup: popup_handlers_1.popupHandlers,
|
|
31
|
+
teamMember: teamMember_handlers_1.teamMemberHandlers,
|
|
32
|
+
user: user_handlers_1.userHandlers,
|
|
33
|
+
role: role_handlers_1.roleHandlers,
|
|
34
|
+
webhook: webhook_handlers_1.webhookHandlers,
|
|
35
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.roleHandlers = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
const getAll = async (ctx) => shared_1.lsRequest.call(ctx, 'GET', '/user/roles');
|
|
6
|
+
exports.roleHandlers = { getAll };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.teamMemberHandlers = void 0;
|
|
4
|
+
/*/nodes/LearningSuite/execute/teamMember.handlers.ts*/
|
|
5
|
+
const shared_1 = require("../shared");
|
|
6
|
+
const getAll = async function (ctx, i) {
|
|
7
|
+
const limit = Number(ctx.getNodeParameter('limit', i, 15));
|
|
8
|
+
const offset = Number(ctx.getNodeParameter('offset', i, 0));
|
|
9
|
+
const path = `/team-members?limit=${encodeURIComponent(limit)}&offset=${encodeURIComponent(offset)}`;
|
|
10
|
+
return await shared_1.lsRequest.call(ctx, 'GET', path);
|
|
11
|
+
};
|
|
12
|
+
const getByEmail = async function (ctx, i) {
|
|
13
|
+
const email = String(ctx.getNodeParameter('email', i)).trim();
|
|
14
|
+
const path = `/team-members/by-email?email=${encodeURIComponent(email)}`;
|
|
15
|
+
return await shared_1.lsRequest.call(ctx, 'GET', path);
|
|
16
|
+
};
|
|
17
|
+
const getById = async function (ctx, i) {
|
|
18
|
+
const userId = ctx.getNodeParameter('userId', i);
|
|
19
|
+
return await shared_1.lsRequest.call(ctx, 'GET', `/team-members/${encodeURIComponent(userId)}`);
|
|
20
|
+
};
|
|
21
|
+
exports.teamMemberHandlers = { getAll, getByEmail, getById };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userHandlers = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
/**
|
|
6
|
+
* Send push notifications to users and/or groups
|
|
7
|
+
*/
|
|
8
|
+
const sendPushNotification = async (ctx, i) => {
|
|
9
|
+
const userIds = (0, shared_1.toIdArray)(ctx.getNodeParameter('userIds', i));
|
|
10
|
+
const groupIds = (0, shared_1.toIdArray)(ctx.getNodeParameter('groupIds', i));
|
|
11
|
+
const title = ctx.getNodeParameter('title', i, '');
|
|
12
|
+
const body = ctx.getNodeParameter('body', i, '');
|
|
13
|
+
const linkUrl = ctx.getNodeParameter('linkUrl', i);
|
|
14
|
+
const publicImageUrl = ctx.getNodeParameter('publicImageUrl', i, '');
|
|
15
|
+
const bodyPayload = { linkUrl };
|
|
16
|
+
if (userIds.length > 0)
|
|
17
|
+
bodyPayload.userIds = userIds;
|
|
18
|
+
if (groupIds.length > 0)
|
|
19
|
+
bodyPayload.groupIds = groupIds;
|
|
20
|
+
if (title)
|
|
21
|
+
bodyPayload.title = title;
|
|
22
|
+
if (body)
|
|
23
|
+
bodyPayload.body = body;
|
|
24
|
+
if (publicImageUrl)
|
|
25
|
+
bodyPayload.publicImageUrl = publicImageUrl;
|
|
26
|
+
return await shared_1.lsRequest.call(ctx, 'POST', '/user/push-notifications/send', {
|
|
27
|
+
body: bodyPayload,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.userHandlers = {
|
|
31
|
+
sendPushNotification, // 👈 KEY muss exakt dem operation value entsprechen
|
|
32
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecuteHandler } from '../exec.types';
|
|
2
|
+
export declare const webhookHandlers: {
|
|
3
|
+
getSubscriptions: ExecuteHandler;
|
|
4
|
+
getSubscription: ExecuteHandler;
|
|
5
|
+
createSubscription: ExecuteHandler;
|
|
6
|
+
updateSubscription: ExecuteHandler;
|
|
7
|
+
deleteSubscription: ExecuteHandler;
|
|
8
|
+
getSampleData: ExecuteHandler;
|
|
9
|
+
};
|