@rjsebening/n8n-nodes-learningsuite 1.3.4 → 1.3.5

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.
@@ -54,6 +54,7 @@ const loTeamMember = __importStar(require("./methods/loadOptions/teamMember.load
54
54
  const loCustomFields = __importStar(require("./methods/loadOptions/customFields.loadOptions"));
55
55
  const INSTANT_EVENTS = new Set([
56
56
  'agentAction.executed',
57
+ 'aiAgent.limitForInaccessibleCourseContentExceeded',
57
58
  'accessRequest.created',
58
59
  'communityPost.created',
59
60
  'communityPost.commented',
@@ -114,6 +115,13 @@ function buildDesiredFilter(event) {
114
115
  }
115
116
  break;
116
117
  }
118
+ case 'aiAgent.limitForInaccessibleCourseContentExceeded': {
119
+ const col = getCol('additionalAiAgentLimit');
120
+ if (col === null || col === void 0 ? void 0 : col.agentId) {
121
+ filter.agentId = String(col.agentId);
122
+ }
123
+ break;
124
+ }
117
125
  // ---------------- Community
118
126
  case 'communityPost.commented': {
119
127
  const col = getCol('additionalCommunityPostCommented');
@@ -271,6 +271,15 @@ exports.communityProperties = [
271
271
  required: true,
272
272
  description: 'Content of the post as a JSON array of objects, for example Slate content',
273
273
  },
274
+ {
275
+ displayName: 'Element JSON',
276
+ name: 'elementJson',
277
+ type: 'json',
278
+ typeOptions: { rows: 4 },
279
+ displayOptions: { show: { resource: ['community'], operation: ['createCommunityPost'] } },
280
+ default: '{}',
281
+ description: 'Optional post element as a JSON object, for example a content link. Only applicable to feed posts.',
282
+ },
274
283
  {
275
284
  displayName: 'Order',
276
285
  name: 'order',
@@ -52,6 +52,18 @@ exports.courseProperties = [
52
52
  description: 'List published courses',
53
53
  action: 'Get published courses',
54
54
  },
55
+ {
56
+ name: 'Publish Course',
57
+ value: 'publishCourse',
58
+ description: 'Publish all pending changes of a course to a new version',
59
+ action: 'Publish course',
60
+ },
61
+ {
62
+ name: 'Update Lesson',
63
+ value: 'updateLesson',
64
+ description: 'Update a lesson name or visibility',
65
+ action: 'Update lesson',
66
+ },
55
67
  ],
56
68
  },
57
69
  {
@@ -69,6 +81,7 @@ exports.courseProperties = [
69
81
  'getAccessRequests',
70
82
  'getSubmissions',
71
83
  'createLesson',
84
+ 'publishCourse',
72
85
  ],
73
86
  },
74
87
  },
@@ -76,6 +89,20 @@ exports.courseProperties = [
76
89
  required: true,
77
90
  description: 'ID of the course. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
78
91
  },
92
+ {
93
+ displayName: 'Course Name or ID',
94
+ name: 'courseId',
95
+ type: 'options',
96
+ typeOptions: { loadOptionsMethod: 'course_getCourses' },
97
+ displayOptions: {
98
+ show: {
99
+ resource: ['course'],
100
+ operation: ['updateLesson'],
101
+ },
102
+ },
103
+ default: '',
104
+ description: 'Optional course filter for loading modules. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
105
+ },
79
106
  {
80
107
  displayName: 'Module Name or ID',
81
108
  name: 'moduleId',
@@ -94,6 +121,41 @@ exports.courseProperties = [
94
121
  required: true,
95
122
  description: 'Select a module. Optionally, select a course first to filter the list. Or enter an ID using an expression. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
96
123
  },
124
+ {
125
+ displayName: 'Module Name or ID',
126
+ name: 'moduleId',
127
+ type: 'options',
128
+ displayOptions: {
129
+ show: {
130
+ resource: ['course'],
131
+ operation: ['updateLesson'],
132
+ },
133
+ },
134
+ typeOptions: {
135
+ loadOptionsMethod: 'course_getModules',
136
+ loadOptionsDependsOn: ['courseId'],
137
+ },
138
+ default: '',
139
+ description: 'Optional module filter for loading lessons. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
140
+ },
141
+ {
142
+ displayName: 'Lesson Name or ID',
143
+ name: 'lessonId',
144
+ type: 'options',
145
+ typeOptions: {
146
+ loadOptionsMethod: 'module_getLessons',
147
+ loadOptionsDependsOn: ['moduleId'],
148
+ },
149
+ displayOptions: {
150
+ show: {
151
+ resource: ['course'],
152
+ operation: ['updateLesson'],
153
+ },
154
+ },
155
+ default: '',
156
+ required: true,
157
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
158
+ },
97
159
  {
98
160
  displayName: 'Section Name or ID',
99
161
  name: 'sectionId',
@@ -158,6 +220,13 @@ exports.courseProperties = [
158
220
  default: '',
159
221
  displayOptions: { show: { resource: ['course'], operation: ['createLesson'] } },
160
222
  },
223
+ {
224
+ displayName: '<b>Publishing this course goes live immediately.</b> It will include all pending changes since the last published version.',
225
+ name: 'notice_publishCourse',
226
+ type: 'notice',
227
+ default: '',
228
+ displayOptions: { show: { resource: ['course'], operation: ['publishCourse'] } },
229
+ },
161
230
  {
162
231
  displayName: 'Additional Options',
163
232
  name: 'additionalOptions',
@@ -203,6 +272,76 @@ exports.courseProperties = [
203
272
  },
204
273
  ],
205
274
  },
275
+ {
276
+ displayName: 'Publish Options',
277
+ name: 'publishOptions',
278
+ type: 'collection',
279
+ placeholder: 'Add Option',
280
+ default: {},
281
+ displayOptions: { show: { resource: ['course'], operation: ['publishCourse'] } },
282
+ options: [
283
+ {
284
+ displayName: 'Notify Members',
285
+ name: 'notifyMembers',
286
+ type: 'boolean',
287
+ default: false,
288
+ description: 'Whether course members should receive a notification with the update message via email and notification center',
289
+ },
290
+ {
291
+ displayName: 'Update Message',
292
+ name: 'updateMessage',
293
+ type: 'string',
294
+ typeOptions: { rows: 4 },
295
+ default: '',
296
+ description: 'Optional update message sent with the course update notification',
297
+ },
298
+ {
299
+ displayName: 'Version Name',
300
+ name: 'versionName',
301
+ type: 'string',
302
+ default: '',
303
+ description: 'Optional display name of the new version',
304
+ },
305
+ {
306
+ displayName: 'Version Notes',
307
+ name: 'versionNotes',
308
+ type: 'string',
309
+ typeOptions: { rows: 4 },
310
+ default: '',
311
+ description: 'Optional internal notes for the new version',
312
+ },
313
+ ],
314
+ },
315
+ {
316
+ displayName: 'Lesson Update Fields',
317
+ name: 'lessonUpdateFields',
318
+ type: 'collection',
319
+ placeholder: 'Add Field',
320
+ default: {},
321
+ displayOptions: { show: { resource: ['course'], operation: ['updateLesson'] } },
322
+ options: [
323
+ {
324
+ displayName: 'Name',
325
+ name: 'name',
326
+ type: 'string',
327
+ default: '',
328
+ description: 'The new lesson name',
329
+ },
330
+ {
331
+ displayName: 'Visibility',
332
+ name: 'visibility',
333
+ type: 'options',
334
+ options: [
335
+ { name: 'Do Not Change', value: '' },
336
+ { name: 'Coming Soon', value: 'COMING_SOON' },
337
+ { name: 'Draft', value: 'DRAFT' },
338
+ { name: 'Visible', value: 'VISIBLE' },
339
+ ],
340
+ default: '',
341
+ description: 'The visibility status of the lesson',
342
+ },
343
+ ],
344
+ },
206
345
  {
207
346
  displayName: 'Limit',
208
347
  name: 'limit',
@@ -15,6 +15,11 @@ exports.instantProperties = [
15
15
  value: 'agentAction.executed',
16
16
  description: 'Triggers when an AI agent action has been executed',
17
17
  },
18
+ {
19
+ name: 'AI Agent Limit for Inaccessible Course Content Exceeded',
20
+ value: 'aiAgent.limitForInaccessibleCourseContentExceeded',
21
+ description: 'Triggers when an AI agent exceeds the limit for inaccessible course content',
22
+ },
18
23
  {
19
24
  name: 'Community Post Commented',
20
25
  value: 'communityPost.commented',
@@ -94,6 +99,24 @@ exports.instantProperties = [
94
99
  },
95
100
  ],
96
101
  },
102
+ {
103
+ displayName: 'AI Agent Limit Options',
104
+ name: 'additionalAiAgentLimit',
105
+ type: 'collection',
106
+ default: {},
107
+ placeholder: 'Add option',
108
+ displayOptions: { show: { event: ['aiAgent.limitForInaccessibleCourseContentExceeded'] } },
109
+ options: [
110
+ {
111
+ displayName: 'Agent Name or ID',
112
+ name: 'agentId',
113
+ type: 'options',
114
+ default: '',
115
+ description: 'Optional: Only trigger for a specific AI agent. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
116
+ typeOptions: { loadOptionsMethod: 'ai_getAiAgents' },
117
+ },
118
+ ],
119
+ },
97
120
  // Agent Action Executed
98
121
  {
99
122
  displayName: 'Agent Action Executed Options',
@@ -22,6 +22,12 @@ exports.userProperties = [
22
22
  default: 'sendPushNotification',
23
23
  displayOptions: { show: { resource: ['user'] } },
24
24
  options: [
25
+ {
26
+ name: 'Send Login Email',
27
+ value: 'sendLoginEmail',
28
+ action: 'Send login email',
29
+ description: 'Send a login information email with a login link to a user',
30
+ },
25
31
  {
26
32
  name: 'Send Push Notification',
27
33
  value: 'sendPushNotification',
@@ -30,6 +36,21 @@ exports.userProperties = [
30
36
  },
31
37
  ],
32
38
  },
39
+ {
40
+ displayName: 'User Name or ID',
41
+ name: 'userId',
42
+ type: 'options',
43
+ typeOptions: { loadOptionsMethod: 'member_getMembers' },
44
+ displayOptions: {
45
+ show: {
46
+ resource: ['user'],
47
+ operation: ['sendLoginEmail'],
48
+ },
49
+ },
50
+ default: '',
51
+ required: true,
52
+ description: 'User ID of the user who should receive a login link email. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
53
+ },
33
54
  // User IDs
34
55
  {
35
56
  displayName: 'User Name or IDs',
@@ -81,6 +81,10 @@ exports.webhookProperties = [
81
81
  description: 'Type of event to subscribe to',
82
82
  options: [
83
83
  { name: 'Agent Action Executed', value: 'agentAction.executed' },
84
+ {
85
+ name: 'AI Agent Limit for Inaccessible Course Content Exceeded',
86
+ value: 'aiAgent.limitForInaccessibleCourseContentExceeded',
87
+ },
84
88
  { name: 'Community Post Commented', value: 'communityPost.commented' },
85
89
  { name: 'Community Post Created', value: 'communityPost.created' },
86
90
  { name: 'Community Post Moderated', value: 'communityPost.moderated' },
@@ -111,6 +115,10 @@ exports.webhookProperties = [
111
115
  description: 'Type of sample data to retrieve',
112
116
  options: [
113
117
  { name: 'Agent Action Executed Events', value: 'agent-action-executed-events' },
118
+ {
119
+ name: 'AI Agent Limit for Inaccessible Course Content Exceeded Events',
120
+ value: 'ai-agent-limit-for-inaccessible-course-content-exceeded-events',
121
+ },
114
122
  { name: 'Community Post Commented', value: 'community-post-commented-events' },
115
123
  { name: 'Community Post Created Events', value: 'community-post-created-events' },
116
124
  { name: 'Community Post Moderated Events', value: 'community-post-moderated-events' },
@@ -162,6 +170,31 @@ exports.webhookProperties = [
162
170
  },
163
171
  ],
164
172
  },
173
+ // AI Agent Limit for Inaccessible Course Content Exceeded
174
+ {
175
+ displayName: 'AI Agent Limit Options',
176
+ name: 'additionalAiAgentLimit',
177
+ type: 'collection',
178
+ default: {},
179
+ placeholder: 'Add option',
180
+ displayOptions: {
181
+ show: {
182
+ resource: ['webhook'],
183
+ operation: ['createSubscription', 'updateSubscription'],
184
+ eventType: ['aiAgent.limitForInaccessibleCourseContentExceeded'],
185
+ },
186
+ },
187
+ options: [
188
+ {
189
+ displayName: 'Agent Name or ID',
190
+ name: 'agentId',
191
+ type: 'options',
192
+ default: '',
193
+ description: 'Optional: Only trigger for a specific AI agent. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
194
+ typeOptions: { loadOptionsMethod: 'ai_getAiAgents' },
195
+ },
196
+ ],
197
+ },
165
198
  // Login Options
166
199
  {
167
200
  displayName: 'Login Options',
@@ -3,6 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.webhookSampleDataProperties = void 0;
5
5
  exports.webhookSampleDataProperties = [
6
+ {
7
+ displayName: 'AI Agent Limit Options',
8
+ name: 'additionalAiAgentLimitSample',
9
+ type: 'collection',
10
+ default: {},
11
+ placeholder: 'Add option',
12
+ displayOptions: {
13
+ show: { sampleDataType: ['ai-agent-limit-for-inaccessible-course-content-exceeded-events'] },
14
+ },
15
+ options: [
16
+ {
17
+ displayName: 'Agent Name or ID',
18
+ name: 'agentId',
19
+ type: 'options',
20
+ default: '',
21
+ description: 'Optional agent ID to filter AI agent inaccessible course content limit events. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
22
+ typeOptions: { loadOptionsMethod: 'ai_getAiAgents' },
23
+ },
24
+ ],
25
+ },
6
26
  {
7
27
  displayName: 'Agent Action Executed Options',
8
28
  name: 'additionalAgentActionExecutedSample',
@@ -99,6 +99,19 @@ const createCommunityPost = async (ctx, i) => {
99
99
  if (answerToPostId) {
100
100
  body.answerToPostId = answerToPostId;
101
101
  }
102
+ const elementJson = String(ctx.getNodeParameter('elementJson', i, '{}') || '').trim();
103
+ if (elementJson && elementJson !== '{}') {
104
+ try {
105
+ const element = JSON.parse(elementJson);
106
+ if (!element || Array.isArray(element) || typeof element !== 'object') {
107
+ throw new Error('Element JSON must be an object.');
108
+ }
109
+ body.element = element;
110
+ }
111
+ catch (err) {
112
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Invalid JSON in element: ${String(err)}`);
113
+ }
114
+ }
102
115
  return shared_1.lsRequest.call(ctx, 'POST', '/community/posts', { body });
103
116
  };
104
117
  const commentOnPost = async (ctx, i) => {
@@ -7,4 +7,6 @@ export declare const courseHandlers: {
7
7
  getAccessRequests: ExecuteHandler;
8
8
  getSubmissions: ExecuteHandler;
9
9
  createLesson: ExecuteHandler;
10
+ publishCourse: ExecuteHandler;
11
+ updateLesson: ExecuteHandler;
10
12
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.courseHandlers = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
4
5
  const shared_1 = require("../shared");
5
6
  const getPublished = async (ctx) => shared_1.lsRequest.call(ctx, 'GET', '/courses/published');
6
7
  const getModules = async (ctx, i) => {
@@ -76,6 +77,34 @@ const createLesson = async (ctx, i) => {
76
77
  });
77
78
  return shared_1.lsRequest.call(ctx, 'POST', `/courses/${courseId}/create-lesson/${sectionId}`, { body });
78
79
  };
80
+ const publishCourse = async (ctx, i) => {
81
+ const courseId = ctx.getNodeParameter('courseId', i);
82
+ const publishOptions = ctx.getNodeParameter('publishOptions', i, {});
83
+ const body = {
84
+ versionName: publishOptions.versionName,
85
+ versionNotes: publishOptions.versionNotes,
86
+ notifyMembers: publishOptions.notifyMembers,
87
+ updateMessage: publishOptions.updateMessage,
88
+ };
89
+ Object.keys(body).forEach((k) => {
90
+ if (body[k] === '' || body[k] === undefined || body[k] === null)
91
+ delete body[k];
92
+ });
93
+ return shared_1.lsRequest.call(ctx, 'POST', `/courses/${courseId}/publish`, { body });
94
+ };
95
+ const updateLesson = async (ctx, i) => {
96
+ const lessonId = ctx.getNodeParameter('lessonId', i);
97
+ const fields = ctx.getNodeParameter('lessonUpdateFields', i, {});
98
+ const body = {};
99
+ if (fields.name)
100
+ body.name = String(fields.name);
101
+ if (fields.visibility)
102
+ body.visibility = String(fields.visibility);
103
+ if (!body.name && !body.visibility) {
104
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Please provide at least one lesson field to update.');
105
+ }
106
+ return shared_1.lsRequest.call(ctx, 'PUT', `/lessons/${encodeURIComponent(lessonId)}`, { body });
107
+ };
79
108
  exports.courseHandlers = {
80
109
  getPublished,
81
110
  getModules,
@@ -84,4 +113,6 @@ exports.courseHandlers = {
84
113
  getAccessRequests,
85
114
  getSubmissions,
86
115
  createLesson,
116
+ publishCourse,
117
+ updateLesson,
87
118
  };
@@ -1,4 +1,5 @@
1
1
  import type { ExecuteHandler } from '../exec.types';
2
2
  export declare const userHandlers: {
3
+ sendLoginEmail: ExecuteHandler;
3
4
  sendPushNotification: ExecuteHandler;
4
5
  };
@@ -27,6 +27,11 @@ const sendPushNotification = async (ctx, i) => {
27
27
  body: bodyPayload,
28
28
  });
29
29
  };
30
+ const sendLoginEmail = async (ctx, i) => {
31
+ const userId = ctx.getNodeParameter('userId', i);
32
+ return await shared_1.lsRequest.call(ctx, 'POST', `/user/${encodeURIComponent(userId)}/send-login-email`);
33
+ };
30
34
  exports.userHandlers = {
31
- sendPushNotification, // 👈 KEY muss exakt dem operation value entsprechen
35
+ sendLoginEmail,
36
+ sendPushNotification,
32
37
  };
@@ -45,6 +45,13 @@ function buildDesiredFilter(ctx, i, eventType) {
45
45
  }
46
46
  break;
47
47
  }
48
+ case 'aiAgent.limitForInaccessibleCourseContentExceeded': {
49
+ const col = getCol(ctx, i, 'additionalAiAgentLimit');
50
+ if (col === null || col === void 0 ? void 0 : col.agentId) {
51
+ filter.agentId = String(col.agentId);
52
+ }
53
+ break;
54
+ }
48
55
  // ---------------- Community
49
56
  case 'communityPost.commented': {
50
57
  const col = getCol(ctx, i, 'additionalCommunityPostCommented');
@@ -239,6 +246,11 @@ const getSampleData = async (ctx, i) => {
239
246
  qs = col;
240
247
  break;
241
248
  }
249
+ case 'ai-agent-limit-for-inaccessible-course-content-exceeded-events': {
250
+ const col = ctx.getNodeParameter('additionalAiAgentLimitSample', i, {});
251
+ qs = col;
252
+ break;
253
+ }
242
254
  case 'progress-changed-events': {
243
255
  const col = ctx.getNodeParameter('additionalProgressChangedSample', i, {});
244
256
  qs = col;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsebening/n8n-nodes-learningsuite",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "n8n node for LearningSuite API",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",