@rjsebening/n8n-nodes-learningsuite 1.3.0 → 1.3.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/dist/nodes/LearningSuite/LearningSuiteTrigger.node.d.ts +2 -0
- package/dist/nodes/LearningSuite/LearningSuiteTrigger.node.js +13 -0
- package/dist/nodes/LearningSuite/descriptions/trigger.instant.properties.js +27 -0
- package/dist/nodes/LearningSuite/descriptions/webhook.properties.js +33 -0
- package/dist/nodes/LearningSuite/execute/webhook.handlers.js +11 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/common.d.ts +1 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/common.js +5 -0
- package/dist/nodes/LearningSuite/methods/loadOptions/customFields.loadOptions.js +4 -8
- package/dist/nodes/LearningSuite/shared/customFields.helpers.js +1 -4
- package/dist/nodes/LearningSuite/shared/request.d.ts +3 -0
- package/dist/nodes/LearningSuite/shared/request.js +18 -0
- package/package.json +1 -1
|
@@ -57,6 +57,8 @@ export declare class LearningSuiteTrigger implements INodeType {
|
|
|
57
57
|
community_getBadges(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
58
58
|
community_getLatestPosts(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
59
59
|
bundle_getBundles(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
60
|
+
ai_getAgentActions(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
61
|
+
ai_getAiAgents(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
60
62
|
};
|
|
61
63
|
};
|
|
62
64
|
webhookMethods: {
|
|
@@ -39,6 +39,7 @@ const request_1 = require("./shared/request");
|
|
|
39
39
|
const trigger_instant_properties_1 = require("./descriptions/trigger.instant.properties");
|
|
40
40
|
const parsing_1 = require("./shared/parsing");
|
|
41
41
|
// methods - loadOptions
|
|
42
|
+
const loAi = __importStar(require("./methods/loadOptions/ai.loadOptions"));
|
|
42
43
|
const loBundle = __importStar(require("./methods/loadOptions/bundle.loadOptions"));
|
|
43
44
|
const loCommunity = __importStar(require("./methods/loadOptions/community.loadOptions"));
|
|
44
45
|
const loCourse = __importStar(require("./methods/loadOptions/course.loadOptions"));
|
|
@@ -102,6 +103,17 @@ function buildDesiredFilter(event) {
|
|
|
102
103
|
}
|
|
103
104
|
};
|
|
104
105
|
switch (event) {
|
|
106
|
+
// ---------------- Agent Action
|
|
107
|
+
case 'agentAction.executed': {
|
|
108
|
+
const col = getCol('additionalAgentActionExecuted');
|
|
109
|
+
if (col === null || col === void 0 ? void 0 : col.toolKey) {
|
|
110
|
+
filter.toolKey = String(col.toolKey);
|
|
111
|
+
}
|
|
112
|
+
if (col === null || col === void 0 ? void 0 : col.agentId) {
|
|
113
|
+
filter.agentId = String(col.agentId);
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
105
117
|
// ---------------- Community
|
|
106
118
|
case 'communityPost.commented': {
|
|
107
119
|
const col = getCol('additionalCommunityPostCommented');
|
|
@@ -291,6 +303,7 @@ class LearningSuiteTrigger {
|
|
|
291
303
|
};
|
|
292
304
|
this.methods = {
|
|
293
305
|
loadOptions: {
|
|
306
|
+
...loAi,
|
|
294
307
|
...loBundle,
|
|
295
308
|
...loCommunity,
|
|
296
309
|
...loCourse,
|
|
@@ -94,6 +94,33 @@ exports.instantProperties = [
|
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
},
|
|
97
|
+
// Agent Action Executed
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Agent Action Executed Options',
|
|
100
|
+
name: 'additionalAgentActionExecuted',
|
|
101
|
+
type: 'collection',
|
|
102
|
+
default: {},
|
|
103
|
+
placeholder: 'Add option',
|
|
104
|
+
displayOptions: { show: { event: ['agentAction.executed'] } },
|
|
105
|
+
options: [
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Tool Key Name or ID',
|
|
108
|
+
name: 'toolKey',
|
|
109
|
+
type: 'options',
|
|
110
|
+
default: '',
|
|
111
|
+
description: 'Optional: Only trigger for a specific agent action. Leave empty to trigger for all actions. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
112
|
+
typeOptions: { loadOptionsMethod: 'ai_getAgentActions' },
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Agent Name or ID',
|
|
116
|
+
name: 'agentId',
|
|
117
|
+
type: 'options',
|
|
118
|
+
default: '',
|
|
119
|
+
description: 'Optional: Only trigger for actions executed by a specific AI agent. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
120
|
+
typeOptions: { loadOptionsMethod: 'ai_getAiAgents' },
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
97
124
|
// New Login
|
|
98
125
|
{
|
|
99
126
|
displayName: 'Login Options',
|
|
@@ -129,6 +129,39 @@ exports.webhookProperties = [
|
|
|
129
129
|
],
|
|
130
130
|
},
|
|
131
131
|
// ====== Optionen pro Event (identisch zu instantProperties) ======
|
|
132
|
+
// Agent Action Executed
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Agent Action Executed Options',
|
|
135
|
+
name: 'additionalAgentActionExecuted',
|
|
136
|
+
type: 'collection',
|
|
137
|
+
default: {},
|
|
138
|
+
placeholder: 'Add option',
|
|
139
|
+
displayOptions: {
|
|
140
|
+
show: {
|
|
141
|
+
resource: ['webhook'],
|
|
142
|
+
operation: ['createSubscription', 'updateSubscription'],
|
|
143
|
+
eventType: ['agentAction.executed'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
options: [
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Tool Key Name or ID',
|
|
149
|
+
name: 'toolKey',
|
|
150
|
+
type: 'options',
|
|
151
|
+
default: '',
|
|
152
|
+
description: 'Optional: Only trigger for a specific agent action. Leave empty to trigger for all actions. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
153
|
+
typeOptions: { loadOptionsMethod: 'ai_getAgentActions' },
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
displayName: 'Agent Name or ID',
|
|
157
|
+
name: 'agentId',
|
|
158
|
+
type: 'options',
|
|
159
|
+
default: '',
|
|
160
|
+
description: 'Optional: Only trigger for actions executed by a specific AI agent. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
161
|
+
typeOptions: { loadOptionsMethod: 'ai_getAiAgents' },
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
132
165
|
// Login Options
|
|
133
166
|
{
|
|
134
167
|
displayName: 'Login Options',
|
|
@@ -34,6 +34,17 @@ function buildDesiredFilter(ctx, i, eventType) {
|
|
|
34
34
|
var _a;
|
|
35
35
|
const filter = {};
|
|
36
36
|
switch (eventType) {
|
|
37
|
+
// ---------------- Agent Action
|
|
38
|
+
case 'agentAction.executed': {
|
|
39
|
+
const col = getCol(ctx, i, 'additionalAgentActionExecuted');
|
|
40
|
+
if (col === null || col === void 0 ? void 0 : col.toolKey) {
|
|
41
|
+
filter.toolKey = String(col.toolKey);
|
|
42
|
+
}
|
|
43
|
+
if (col === null || col === void 0 ? void 0 : col.agentId) {
|
|
44
|
+
filter.agentId = String(col.agentId);
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
37
48
|
// ---------------- Community
|
|
38
49
|
case 'communityPost.commented': {
|
|
39
50
|
const col = getCol(ctx, i, 'additionalCommunityPostCommented');
|
|
@@ -4,4 +4,5 @@ type LoadOptionRow = IDataObject;
|
|
|
4
4
|
export declare function toOptions(rows: LoadOptionRow[], labelKeys?: string[], valueKeys?: string[]): INodePropertyOptions[];
|
|
5
5
|
export declare function ensureArray<T>(res: T | T[]): T[];
|
|
6
6
|
export declare function fetchOptions(this: ILoadOptionsFunctions, endpoint: string, qs?: IDataObject, labelKeys?: string[], valueKeys?: string[]): Promise<INodePropertyOptions[]>;
|
|
7
|
+
export declare function fetchOptionsAll(this: ILoadOptionsFunctions, endpoint: string, qs?: IDataObject, labelKeys?: string[], valueKeys?: string[]): Promise<INodePropertyOptions[]>;
|
|
7
8
|
export {};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toOptions = toOptions;
|
|
4
4
|
exports.ensureArray = ensureArray;
|
|
5
5
|
exports.fetchOptions = fetchOptions;
|
|
6
|
+
exports.fetchOptionsAll = fetchOptionsAll;
|
|
6
7
|
const shared_1 = require("../../shared");
|
|
7
8
|
function toOptions(rows, labelKeys = ['name', 'title', 'email'], valueKeys = ['id', 'sid', 'slug']) {
|
|
8
9
|
return rows.map((r) => {
|
|
@@ -20,3 +21,7 @@ async function fetchOptions(endpoint, qs, labelKeys, valueKeys) {
|
|
|
20
21
|
const rows = ensureArray(res);
|
|
21
22
|
return toOptions(rows, labelKeys, valueKeys);
|
|
22
23
|
}
|
|
24
|
+
async function fetchOptionsAll(endpoint, qs, labelKeys, valueKeys) {
|
|
25
|
+
const rows = await shared_1.lsRequestAll.call(this, endpoint, { qs });
|
|
26
|
+
return toOptions(rows, labelKeys, valueKeys);
|
|
27
|
+
}
|
|
@@ -31,16 +31,15 @@ function getMediaFieldDetails(fieldType, typeDefinition, cardName) {
|
|
|
31
31
|
return [typeLabel, getMediaFieldMaxInfo(fieldType, typeDefinition), cardName].filter(Boolean).join(', ');
|
|
32
32
|
}
|
|
33
33
|
async function customFields_getCards() {
|
|
34
|
-
return common_1.
|
|
34
|
+
return common_1.fetchOptionsAll.call(this, '/custom-fields/cards', undefined, ['name', 'title'], ['id']);
|
|
35
35
|
}
|
|
36
36
|
async function customFields_getDefinitions() {
|
|
37
37
|
const cardId = this.getCurrentNodeParameter('cardId');
|
|
38
38
|
const customFieldCardId = this.getCurrentNodeParameter('customFieldCardId');
|
|
39
39
|
const filterCardId = cardId || customFieldCardId;
|
|
40
|
-
const
|
|
40
|
+
const definitions = await shared_1.lsRequestAll.call(this, '/custom-fields/definitions', {
|
|
41
41
|
qs: filterCardId ? { customFieldCardId: filterCardId } : undefined,
|
|
42
42
|
});
|
|
43
|
-
const definitions = Array.isArray(res) ? res : [res];
|
|
44
43
|
return definitions
|
|
45
44
|
.filter((definition) => typeof definition === 'object' && definition !== null)
|
|
46
45
|
.map((definition) => {
|
|
@@ -62,10 +61,7 @@ async function customFields_getDefinitions() {
|
|
|
62
61
|
}
|
|
63
62
|
async function customFields_getMediaDefinitions() {
|
|
64
63
|
var _a, _b, _c, _d, _e;
|
|
65
|
-
const cards = await shared_1.
|
|
66
|
-
if (!Array.isArray(cards)) {
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
64
|
+
const cards = await shared_1.lsRequestAll.call(this, '/custom-fields/cards/expanded');
|
|
69
65
|
const options = [];
|
|
70
66
|
for (const card of cards) {
|
|
71
67
|
if (typeof card !== 'object' || card === null)
|
|
@@ -95,7 +91,7 @@ async function customFields_getMediaDefinitions() {
|
|
|
95
91
|
}
|
|
96
92
|
async function customFields_getCategories() {
|
|
97
93
|
const customFieldCardId = this.getCurrentNodeParameter('customFieldCardId');
|
|
98
|
-
return common_1.
|
|
94
|
+
return common_1.fetchOptionsAll.call(this, '/custom-fields/categories', customFieldCardId ? { customFieldCardId } : undefined, ['name', 'title'], ['id']);
|
|
99
95
|
}
|
|
100
96
|
async function customFields_getFieldType() {
|
|
101
97
|
const fieldKey = this.getCurrentNodeParameter('fieldKey');
|
|
@@ -6,10 +6,7 @@ exports.getLsSimpleType = getLsSimpleType;
|
|
|
6
6
|
const request_1 = require("./request");
|
|
7
7
|
const customFields_shared_1 = require("./customFields.shared");
|
|
8
8
|
async function fetchFieldDefinition(ctx, fieldKey) {
|
|
9
|
-
const cards = await request_1.
|
|
10
|
-
if (!Array.isArray(cards)) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
9
|
+
const cards = await request_1.lsRequestAll.call(ctx, '/custom-fields/cards/expanded');
|
|
13
10
|
for (const card of cards) {
|
|
14
11
|
if (!(0, customFields_shared_1.isLsCard)(card) || !Array.isArray(card.definitions)) {
|
|
15
12
|
continue;
|
|
@@ -11,3 +11,6 @@ export declare function apiRequest(this: ApiThis, { method, path, qs, body, }: {
|
|
|
11
11
|
qs?: IDataObject;
|
|
12
12
|
body?: IDataObject;
|
|
13
13
|
}): Promise<IDataObject | IDataObject[]>;
|
|
14
|
+
export declare function lsRequestAll(this: ApiThis, endpoint: string, { qs }?: {
|
|
15
|
+
qs?: IDataObject;
|
|
16
|
+
}): Promise<IDataObject[]>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeEndpoint = normalizeEndpoint;
|
|
4
4
|
exports.lsRequest = lsRequest;
|
|
5
5
|
exports.apiRequest = apiRequest;
|
|
6
|
+
exports.lsRequestAll = lsRequestAll;
|
|
6
7
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
8
|
function hasRequestWithAuthentication(value) {
|
|
8
9
|
var _a;
|
|
@@ -51,3 +52,20 @@ async function lsRequest(method, endpoint, { qs, body } = {}) {
|
|
|
51
52
|
async function apiRequest({ method, path, qs, body, }) {
|
|
52
53
|
return requestCore.call(this, { method, endpoint: path, qs, body });
|
|
53
54
|
}
|
|
55
|
+
async function lsRequestAll(endpoint, { qs } = {}) {
|
|
56
|
+
const pageSize = 100;
|
|
57
|
+
const maxPages = 500;
|
|
58
|
+
const all = [];
|
|
59
|
+
let offset = 0;
|
|
60
|
+
for (let page = 0; page < maxPages; page++) {
|
|
61
|
+
const res = await lsRequest.call(this, 'GET', endpoint, {
|
|
62
|
+
qs: { ...(qs !== null && qs !== void 0 ? qs : {}), limit: pageSize, offset },
|
|
63
|
+
});
|
|
64
|
+
const rows = Array.isArray(res) ? res : res ? [res] : [];
|
|
65
|
+
all.push(...rows);
|
|
66
|
+
if (rows.length < pageSize)
|
|
67
|
+
break;
|
|
68
|
+
offset += pageSize;
|
|
69
|
+
}
|
|
70
|
+
return all;
|
|
71
|
+
}
|