n8n-nodes-getcourse 0.1.0
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.md +38 -0
- package/README.md +359 -0
- package/dist/credentials/GetCourseApi.credentials.d.ts +10 -0
- package/dist/credentials/GetCourseApi.credentials.js +58 -0
- package/dist/credentials/GetCourseApi.credentials.js.map +1 -0
- package/dist/credentials/GetCourseTechApi.credentials.d.ts +11 -0
- package/dist/credentials/GetCourseTechApi.credentials.js +63 -0
- package/dist/credentials/GetCourseTechApi.credentials.js.map +1 -0
- package/dist/credentials/accountAddress.d.ts +11 -0
- package/dist/credentials/accountAddress.js +116 -0
- package/dist/credentials/accountAddress.js.map +1 -0
- package/dist/icons/getcourse.dark.svg +15 -0
- package/dist/icons/getcourse.svg +11 -0
- package/dist/nodes/GetCourse/GetCourse.node.d.ts +9 -0
- package/dist/nodes/GetCourse/GetCourse.node.js +48 -0
- package/dist/nodes/GetCourse/GetCourse.node.js.map +1 -0
- package/dist/nodes/GetCourse/GetCourse.node.json +40 -0
- package/dist/nodes/GetCourse/v1/actions/call/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/call/index.js +98 -0
- package/dist/nodes/GetCourse/v1/actions/call/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/deal/description.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/deal/description.js +261 -0
- package/dist/nodes/GetCourse/v1/actions/deal/description.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/deal/execute.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/deal/execute.js +181 -0
- package/dist/nodes/GetCourse/v1/actions/deal/execute.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/deal/index.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/deal/index.js +8 -0
- package/dist/nodes/GetCourse/v1/actions/deal/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/dialog/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/dialog/index.js +262 -0
- package/dist/nodes/GetCourse/v1/actions/dialog/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/helpdesk/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/helpdesk/index.js +305 -0
- package/dist/nodes/GetCourse/v1/actions/helpdesk/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/index.d.ts +5 -0
- package/dist/nodes/GetCourse/v1/actions/index.js +119 -0
- package/dist/nodes/GetCourse/v1/actions/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/lesson/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/lesson/index.js +180 -0
- package/dist/nodes/GetCourse/v1/actions/lesson/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/offer/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/offer/index.js +98 -0
- package/dist/nodes/GetCourse/v1/actions/offer/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/school/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/school/index.js +139 -0
- package/dist/nodes/GetCourse/v1/actions/school/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/user/description.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/user/description.js +499 -0
- package/dist/nodes/GetCourse/v1/actions/user/description.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/user/execute.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/user/execute.js +270 -0
- package/dist/nodes/GetCourse/v1/actions/user/execute.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/user/index.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/actions/user/index.js +8 -0
- package/dist/nodes/GetCourse/v1/actions/user/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/webhook/index.d.ts +4 -0
- package/dist/nodes/GetCourse/v1/actions/webhook/index.js +179 -0
- package/dist/nodes/GetCourse/v1/actions/webhook/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/actions/webinar/index.d.ts +3 -0
- package/dist/nodes/GetCourse/v1/actions/webinar/index.js +376 -0
- package/dist/nodes/GetCourse/v1/actions/webinar/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/descriptions/common.d.ts +7 -0
- package/dist/nodes/GetCourse/v1/descriptions/common.js +142 -0
- package/dist/nodes/GetCourse/v1/descriptions/common.js.map +1 -0
- package/dist/nodes/GetCourse/v1/helpers/errors.d.ts +11 -0
- package/dist/nodes/GetCourse/v1/helpers/errors.js +90 -0
- package/dist/nodes/GetCourse/v1/helpers/errors.js.map +1 -0
- package/dist/nodes/GetCourse/v1/helpers/request.d.ts +7 -0
- package/dist/nodes/GetCourse/v1/helpers/request.js +79 -0
- package/dist/nodes/GetCourse/v1/helpers/request.js.map +1 -0
- package/dist/nodes/GetCourse/v1/methods/index.d.ts +2 -0
- package/dist/nodes/GetCourse/v1/methods/index.js +39 -0
- package/dist/nodes/GetCourse/v1/methods/index.js.map +1 -0
- package/dist/nodes/GetCourse/v1/methods/loadOptions.d.ts +7 -0
- package/dist/nodes/GetCourse/v1/methods/loadOptions.js +76 -0
- package/dist/nodes/GetCourse/v1/methods/loadOptions.js.map +1 -0
- package/dist/nodes/GetCourse/v1/transport/index.d.ts +18 -0
- package/dist/nodes/GetCourse/v1/transport/index.js +165 -0
- package/dist/nodes/GetCourse/v1/transport/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.d.ts +9 -0
- package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.js +48 -0
- package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.json +35 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.js +287 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.js +150 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.js +8 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/description.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/description.js +487 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/description.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.js +252 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/index.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/index.js +8 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/export/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/field/index.d.ts +3 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/field/index.js +61 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/field/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/group/index.d.ts +3 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/group/index.js +42 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/group/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/index.d.ts +5 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/index.js +84 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/description.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/description.js +87 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/description.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.d.ts +5 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.js +129 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/index.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/index.js +8 -0
- package/dist/nodes/GetCourseLegacy/v1/actions/user/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/common.d.ts +14 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/common.js +198 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/common.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.d.ts +7 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.js +116 -0
- package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/errors.d.ts +18 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/errors.js +141 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/errors.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.d.ts +8 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.js +100 -0
- package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/index.d.ts +2 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/index.js +39 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/index.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.d.ts +5 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.js +92 -0
- package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.js.map +1 -0
- package/dist/nodes/GetCourseLegacy/v1/transport/index.d.ts +13 -0
- package/dist/nodes/GetCourseLegacy/v1/transport/index.js +204 -0
- package/dist/nodes/GetCourseLegacy/v1/transport/index.js.map +1 -0
- package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.d.ts +12 -0
- package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.js +339 -0
- package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.js.map +1 -0
- package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.json +32 -0
- package/dist/nodes/GetCourseTrigger/payload.d.ts +14 -0
- package/dist/nodes/GetCourseTrigger/payload.js +66 -0
- package/dist/nodes/GetCourseTrigger/payload.js.map +1 -0
- package/dist/utils/cache.d.ts +2 -0
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/dates.d.ts +3 -0
- package/dist/utils/dates.js +70 -0
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/events.d.ts +14 -0
- package/dist/utils/events.js +92 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/httpError.d.ts +4 -0
- package/dist/utils/httpError.js +46 -0
- package/dist/utils/httpError.js.map +1 -0
- package/dist/utils/query.d.ts +4 -0
- package/dist/utils/query.js +42 -0
- package/dist/utils/query.js.map +1 -0
- package/dist/utils/rateLimiter.d.ts +3 -0
- package/dist/utils/rateLimiter.js +44 -0
- package/dist/utils/rateLimiter.js.map +1 -0
- package/dist/utils/router.d.ts +8 -0
- package/dist/utils/router.js +40 -0
- package/dist/utils/router.js.map +1 -0
- package/index.js +0 -0
- package/package.json +68 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const request_1 = require("../../helpers/request");
|
|
7
|
+
const query_1 = require("../../../../../utils/query");
|
|
8
|
+
const router_1 = require("../../../../../utils/router");
|
|
9
|
+
const transport_1 = require("../../transport");
|
|
10
|
+
const showFor = (operations) => ({
|
|
11
|
+
show: { resource: ['webinar'], operation: operations },
|
|
12
|
+
});
|
|
13
|
+
const SINGLE = ['addComment', 'moderateComment', 'moderateUser'];
|
|
14
|
+
exports.description = [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Operation',
|
|
17
|
+
name: 'operation',
|
|
18
|
+
type: 'options',
|
|
19
|
+
noDataExpression: true,
|
|
20
|
+
default: 'getMany',
|
|
21
|
+
displayOptions: { show: { resource: ['webinar'] } },
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
name: 'Add Comment',
|
|
25
|
+
value: 'addComment',
|
|
26
|
+
action: 'Add a comment to a webinar chat',
|
|
27
|
+
description: 'Опубликовать сообщение в чате вебинара от имени модератора. GetCourse answers with an empty envelope, so the new comment gets no ID that any other call could use.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Get Many',
|
|
31
|
+
value: 'getMany',
|
|
32
|
+
action: 'Get many webinars',
|
|
33
|
+
description: 'Все вебинары аккаунта. The endpoint takes no parameters at all — no filter, no limit, no offset — so an account with many webinars returns all of them every time.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'Get Many by IDs',
|
|
37
|
+
value: 'getByIds',
|
|
38
|
+
action: 'Get many webinars by ID',
|
|
39
|
+
description: 'Вебинары по списку ID. A read that GetCourse implemented as a POST for the sake of the array — it creates and changes nothing.',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Moderate Comment',
|
|
43
|
+
value: 'moderateComment',
|
|
44
|
+
action: 'Moderate a webinar chat comment',
|
|
45
|
+
description: 'Удалить сообщение или пропустить его через премодерацию. Necessarily irreversible from the workflow side: nothing in the API restores a deleted comment.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Moderate User',
|
|
49
|
+
value: 'moderateUser',
|
|
50
|
+
action: 'Moderate a webinar chat user',
|
|
51
|
+
description: 'Забанить участника в чате вебинара или снять бан. Изоляция держится, пока её не снимут отдельным вызовом.',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Модерация применяется сразу и со стороны воркфлоу необратима: удалённое сообщение не вернуть ничем, а «Отклонить все» снимает с премодерации не только выбранный комментарий, но и все остальные сообщения того же участника, которые её ждут. Бан тоже сам не проходит — его снимает только операция Moderate User с действием «Снять изоляцию».',
|
|
57
|
+
name: 'webinarModerationNotice',
|
|
58
|
+
type: 'notice',
|
|
59
|
+
default: '',
|
|
60
|
+
displayOptions: showFor(['moderateComment', 'moderateUser']),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Webinar Name or ID',
|
|
64
|
+
name: 'webinarId',
|
|
65
|
+
type: 'options',
|
|
66
|
+
typeOptions: { loadOptionsMethod: 'getWebinars' },
|
|
67
|
+
default: '',
|
|
68
|
+
required: true,
|
|
69
|
+
displayOptions: showFor(SINGLE),
|
|
70
|
+
description: 'Вебинар, в чате которого работаем. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
displayName: 'Webinar Names or IDs',
|
|
74
|
+
name: 'webinarIds',
|
|
75
|
+
type: 'multiOptions',
|
|
76
|
+
typeOptions: { loadOptionsMethod: 'getWebinars' },
|
|
77
|
+
default: [],
|
|
78
|
+
required: true,
|
|
79
|
+
displayOptions: showFor(['getByIds']),
|
|
80
|
+
description: 'Вебинары, которые нужно получить, — длину списка спецификация не ограничивает. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Moderator Name or ID',
|
|
84
|
+
name: 'moderatorId',
|
|
85
|
+
type: 'options',
|
|
86
|
+
typeOptions: { loadOptionsMethod: 'getManagers' },
|
|
87
|
+
default: '',
|
|
88
|
+
required: true,
|
|
89
|
+
displayOptions: showFor(['addComment']),
|
|
90
|
+
description: 'Автор комментария — сотрудник, от чьего имени сообщение появится в чате. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Text',
|
|
94
|
+
name: 'text',
|
|
95
|
+
type: 'string',
|
|
96
|
+
typeOptions: { rows: 3 },
|
|
97
|
+
default: '',
|
|
98
|
+
required: true,
|
|
99
|
+
displayOptions: showFor(['addComment']),
|
|
100
|
+
description: 'Текст сообщения, каким его увидят участники вебинара',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
displayName: 'Additional Fields',
|
|
104
|
+
name: 'additionalFields',
|
|
105
|
+
type: 'collection',
|
|
106
|
+
placeholder: 'Add Field',
|
|
107
|
+
default: {},
|
|
108
|
+
displayOptions: showFor(['addComment']),
|
|
109
|
+
options: [
|
|
110
|
+
{
|
|
111
|
+
displayName: 'Is Private Reply',
|
|
112
|
+
name: 'isPrivateReply',
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
default: false,
|
|
115
|
+
description: 'Whether to answer the person privately (ответить лично), so the message reaches them and nobody else in the chat',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Reply to User ID',
|
|
119
|
+
name: 'replyToUserId',
|
|
120
|
+
type: 'string',
|
|
121
|
+
default: '',
|
|
122
|
+
description: 'ID участника, на чьё сообщение отвечаем',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Reply to User Type',
|
|
126
|
+
name: 'replyToUserType',
|
|
127
|
+
type: 'number',
|
|
128
|
+
default: 1,
|
|
129
|
+
description: 'Тип участника, на чьё сообщение отвечаем. Спецификация не объявляет для этого поля ни одного значения и копирует пример из соседнего — известно лишь, что в модерации участников тот же параметр описан как «1 или 2».',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
displayName: 'Webinar Launch Number',
|
|
133
|
+
name: 'webinarLaunchNumber',
|
|
134
|
+
type: 'number',
|
|
135
|
+
default: 0,
|
|
136
|
+
description: 'ID запуска автовебинара — нужен автовебинарам с частыми параллельными запусками или с запуском по расписанию. Оставленный нулём, он не отправляется, и GetCourse сам возьмёт ближайший или уже идущий запуск.',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: 'Comment ID',
|
|
142
|
+
name: 'commentId',
|
|
143
|
+
type: 'string',
|
|
144
|
+
default: '',
|
|
145
|
+
required: true,
|
|
146
|
+
displayOptions: showFor(['moderateComment']),
|
|
147
|
+
description: 'ID сообщения в чате вебинара. Метода, который вернул бы комментарии, в API нет — ID приходит с вебхуком «Комментарии вебинаров», который принимает триггер этого пакета.',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Moderation Action',
|
|
151
|
+
name: 'commentAction',
|
|
152
|
+
type: 'options',
|
|
153
|
+
default: 'premoderation_accept',
|
|
154
|
+
required: true,
|
|
155
|
+
displayOptions: showFor(['moderateComment']),
|
|
156
|
+
options: [
|
|
157
|
+
{
|
|
158
|
+
name: 'Accept in Premoderation (Принять)',
|
|
159
|
+
value: 'premoderation_accept',
|
|
160
|
+
description: 'Опубликовать сообщение, ожидающее премодерации',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'Delete (Удалить)',
|
|
164
|
+
value: 'delete',
|
|
165
|
+
description: 'Убрать сообщение из чата навсегда — восстановить его нечем',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'Reject All From the Author (Отклонить все)',
|
|
169
|
+
value: 'premoderation_reject_all',
|
|
170
|
+
description: 'Отклонить это сообщение и заодно все остальные сообщения того же участника, ожидающие премодерации',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'Reject in Premoderation (Отклонить)',
|
|
174
|
+
value: 'premoderation_reject',
|
|
175
|
+
description: 'Отклонить только это сообщение — в чат оно не попадёт',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
description: 'Что сделать с сообщением',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
displayName: 'Additional Fields',
|
|
182
|
+
name: 'additionalFields',
|
|
183
|
+
type: 'collection',
|
|
184
|
+
placeholder: 'Add Field',
|
|
185
|
+
default: {},
|
|
186
|
+
displayOptions: showFor(['moderateComment']),
|
|
187
|
+
options: [
|
|
188
|
+
{
|
|
189
|
+
displayName: 'Moderator Name or ID',
|
|
190
|
+
name: 'moderatorId',
|
|
191
|
+
type: 'options',
|
|
192
|
+
typeOptions: { loadOptionsMethod: 'getManagers' },
|
|
193
|
+
default: '',
|
|
194
|
+
description: 'От чьего имени выполняется модерация — здесь метод его принимает, но не требует, в отличие от публикации комментария. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
displayName: 'User ID',
|
|
200
|
+
name: 'userId',
|
|
201
|
+
type: 'string',
|
|
202
|
+
default: '',
|
|
203
|
+
required: true,
|
|
204
|
+
displayOptions: showFor(['moderateUser']),
|
|
205
|
+
description: 'ID участника, которого модерируем',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
displayName: 'User Type',
|
|
209
|
+
name: 'userType',
|
|
210
|
+
type: 'number',
|
|
211
|
+
typeOptions: { minValue: 1 },
|
|
212
|
+
default: 1,
|
|
213
|
+
required: true,
|
|
214
|
+
displayOptions: showFor(['moderateUser']),
|
|
215
|
+
description: 'Тип участника, который метод требует обязательно. Смысл значений не описан нигде: поле объявлено целым числом, а единственный пример в спецификации — строка «1 или 2», так что узел шлёт число и выбор оставляет за вами.',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
displayName: 'Moderation Action',
|
|
219
|
+
name: 'userAction',
|
|
220
|
+
type: 'options',
|
|
221
|
+
default: 'isolation',
|
|
222
|
+
required: true,
|
|
223
|
+
displayOptions: showFor(['moderateUser']),
|
|
224
|
+
options: [
|
|
225
|
+
{
|
|
226
|
+
name: 'Ban in Chat (Изоляция)',
|
|
227
|
+
value: 'isolation',
|
|
228
|
+
description: 'Забанить участника — писать в чат вебинара он больше не сможет',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'Unban in Chat (Снять изоляцию)',
|
|
232
|
+
value: 'isolation_remove',
|
|
233
|
+
description: 'Вернуть забаненному участнику право писать в чат',
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
description: 'Что сделать с участником',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
displayName: 'Additional Fields',
|
|
240
|
+
name: 'additionalFields',
|
|
241
|
+
type: 'collection',
|
|
242
|
+
placeholder: 'Add Field',
|
|
243
|
+
default: {},
|
|
244
|
+
displayOptions: showFor(['moderateUser']),
|
|
245
|
+
options: [
|
|
246
|
+
{
|
|
247
|
+
displayName: 'Moderator Name or ID',
|
|
248
|
+
name: 'moderatorId',
|
|
249
|
+
type: 'options',
|
|
250
|
+
typeOptions: { loadOptionsMethod: 'getManagers' },
|
|
251
|
+
default: '',
|
|
252
|
+
description: 'От чьего имени выполняется бан — метод его принимает, но не требует. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
displayName: 'Webinar Launch Number',
|
|
256
|
+
name: 'webinarLaunchNumber',
|
|
257
|
+
type: 'number',
|
|
258
|
+
default: 0,
|
|
259
|
+
description: 'ID запуска автовебинара — нужен автовебинарам с частыми параллельными запусками или с запуском по расписанию. Модерация сообщений этого параметра не принимает, хотя публикация комментария и бан участника принимают оба.',
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
];
|
|
264
|
+
function requireNumber(name, itemIndex, label) {
|
|
265
|
+
var _a;
|
|
266
|
+
const raw = String((_a = this.getNodeParameter(name, itemIndex, '')) !== null && _a !== void 0 ? _a : '').trim();
|
|
267
|
+
const value = Number(raw);
|
|
268
|
+
if (raw === '' || !Number.isFinite(value)) {
|
|
269
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${label} must be a numeric ID`, {
|
|
270
|
+
description: 'Pick the value from the list, or give the number GetCourse uses for it.',
|
|
271
|
+
itemIndex,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
function optionalNumber(value) {
|
|
277
|
+
const parsed = Number(String(value !== null && value !== void 0 ? value : '').trim());
|
|
278
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
279
|
+
}
|
|
280
|
+
function webinarItems(data) {
|
|
281
|
+
const rows = Array.isArray(data) ? data : (0, request_1.toItems)(data, {});
|
|
282
|
+
return rows.map((row) => ({ json: row }));
|
|
283
|
+
}
|
|
284
|
+
async function getWebinars() {
|
|
285
|
+
return webinarItems(await transport_1.techApiRequest.call(this, 'GET', '/webinar/get-all-webinars'));
|
|
286
|
+
}
|
|
287
|
+
async function getWebinarsByIds(itemIndex) {
|
|
288
|
+
const selected = this.getNodeParameter('webinarIds', itemIndex, []);
|
|
289
|
+
const ids = (Array.isArray(selected) ? selected.map(String) : (0, query_1.splitList)(selected))
|
|
290
|
+
.map((value) => Number(String(value).trim()))
|
|
291
|
+
.filter((value) => Number.isFinite(value));
|
|
292
|
+
if (ids.length === 0) {
|
|
293
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No webinars named', {
|
|
294
|
+
description: 'Pick at least one webinar, or give a comma-separated list of numeric IDs.',
|
|
295
|
+
itemIndex,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return webinarItems(await transport_1.techApiRequest.call(this, 'POST', '/webinar/get-webinars-by-ids', { ids }));
|
|
299
|
+
}
|
|
300
|
+
async function addComment(itemIndex) {
|
|
301
|
+
var _a;
|
|
302
|
+
const webinarId = requireNumber.call(this, 'webinarId', itemIndex, 'Webinar');
|
|
303
|
+
const moderatorId = requireNumber.call(this, 'moderatorId', itemIndex, 'Moderator');
|
|
304
|
+
const text = String((_a = this.getNodeParameter('text', itemIndex, '')) !== null && _a !== void 0 ? _a : '').trim();
|
|
305
|
+
if (text === '') {
|
|
306
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The comment has no text', {
|
|
307
|
+
description: 'GetCourse takes an empty message without complaint and shows nothing for it.',
|
|
308
|
+
itemIndex,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
const fields = this.getNodeParameter('additionalFields', itemIndex, {});
|
|
312
|
+
const body = { webinarId, moderatorId, text };
|
|
313
|
+
if (fields.isPrivateReply === true)
|
|
314
|
+
body.isPrivateReply = true;
|
|
315
|
+
const replyToUserId = optionalNumber(fields.replyToUserId);
|
|
316
|
+
if (replyToUserId !== undefined)
|
|
317
|
+
body.replyToUserId = replyToUserId;
|
|
318
|
+
const replyToUserType = optionalNumber(fields.replyToUserType);
|
|
319
|
+
if (replyToUserType !== undefined)
|
|
320
|
+
body.replyToUserType = replyToUserType;
|
|
321
|
+
const launch = optionalNumber(fields.webinarLaunchNumber);
|
|
322
|
+
if (launch !== undefined)
|
|
323
|
+
body.webinarLaunchNumber = launch;
|
|
324
|
+
const data = await transport_1.techApiRequest.call(this, 'POST', '/webinar/add-comment', body);
|
|
325
|
+
return (0, request_1.toItems)(data, { success: true, webinar_id: webinarId, moderator_id: moderatorId }).map((row) => ({ json: row }));
|
|
326
|
+
}
|
|
327
|
+
async function moderateComment(itemIndex) {
|
|
328
|
+
const webinarId = requireNumber.call(this, 'webinarId', itemIndex, 'Webinar');
|
|
329
|
+
const commentId = requireNumber.call(this, 'commentId', itemIndex, 'Comment');
|
|
330
|
+
const action = this.getNodeParameter('commentAction', itemIndex, 'delete');
|
|
331
|
+
const fields = this.getNodeParameter('additionalFields', itemIndex, {});
|
|
332
|
+
const body = { webinarId, commentId, action };
|
|
333
|
+
const moderatorId = optionalNumber(fields.moderatorId);
|
|
334
|
+
if (moderatorId !== undefined)
|
|
335
|
+
body.moderatorId = moderatorId;
|
|
336
|
+
const data = await transport_1.techApiRequest.call(this, 'POST', '/webinar/moderation-comment', body);
|
|
337
|
+
return (0, request_1.toItems)(data, {
|
|
338
|
+
success: true,
|
|
339
|
+
webinar_id: webinarId,
|
|
340
|
+
comment_id: commentId,
|
|
341
|
+
action,
|
|
342
|
+
}).map((row) => ({ json: row }));
|
|
343
|
+
}
|
|
344
|
+
async function moderateUser(itemIndex) {
|
|
345
|
+
const webinarId = requireNumber.call(this, 'webinarId', itemIndex, 'Webinar');
|
|
346
|
+
const userId = requireNumber.call(this, 'userId', itemIndex, 'User');
|
|
347
|
+
const userType = requireNumber.call(this, 'userType', itemIndex, 'User type');
|
|
348
|
+
const action = this.getNodeParameter('userAction', itemIndex, 'isolation');
|
|
349
|
+
const fields = this.getNodeParameter('additionalFields', itemIndex, {});
|
|
350
|
+
const body = { webinarId, userId, userType, action };
|
|
351
|
+
const moderatorId = optionalNumber(fields.moderatorId);
|
|
352
|
+
if (moderatorId !== undefined)
|
|
353
|
+
body.moderatorId = moderatorId;
|
|
354
|
+
const launch = optionalNumber(fields.webinarLaunchNumber);
|
|
355
|
+
if (launch !== undefined)
|
|
356
|
+
body.webinarLaunchNumber = launch;
|
|
357
|
+
const data = await transport_1.techApiRequest.call(this, 'POST', '/webinar/moderation-user', body);
|
|
358
|
+
return (0, request_1.toItems)(data, { success: true, webinar_id: webinarId, user_id: userId, action }).map((row) => ({ json: row }));
|
|
359
|
+
}
|
|
360
|
+
async function execute(operation, itemIndex) {
|
|
361
|
+
switch (operation) {
|
|
362
|
+
case 'getMany':
|
|
363
|
+
return await getWebinars.call(this);
|
|
364
|
+
case 'getByIds':
|
|
365
|
+
return await getWebinarsByIds.call(this, itemIndex);
|
|
366
|
+
case 'addComment':
|
|
367
|
+
return await addComment.call(this, itemIndex);
|
|
368
|
+
case 'moderateComment':
|
|
369
|
+
return await moderateComment.call(this, itemIndex);
|
|
370
|
+
case 'moderateUser':
|
|
371
|
+
return await moderateUser.call(this, itemIndex);
|
|
372
|
+
default:
|
|
373
|
+
throw router_1.unknownOperation.call(this, 'webinar', operation, itemIndex);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../nodes/GetCourse/v1/actions/webinar/index.ts"],"names":[],"mappings":";;;AAkdA,0BAmBC;AA/dD,+CAAkD;AAElD,mDAAgD;AAChD,sDAAuD;AACvD,wDAA+D;AAC/D,+CAAiD;AAEjD,MAAM,OAAO,GAAG,CAAC,UAAoB,EAAqC,EAAE,CAAC,CAAC;IAC7E,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE;CACtD,CAAC,CAAC;AAGH,MAAM,MAAM,GAAG,CAAC,YAAY,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAcpD,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,SAAS;QAClB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QACnD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,YAAY;gBACnB,MAAM,EAAE,iCAAiC;gBACzC,WAAW,EACV,oKAAoK;aACrK;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,mBAAmB;gBAC3B,WAAW,EACV,oKAAoK;aACrK;YACD;gBACC,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,yBAAyB;gBACjC,WAAW,EACV,gIAAgI;aACjI;YACD;gBACC,IAAI,EAAE,k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AAI,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,UAAU;YACd,OAAO,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACrD,KAAK,YAAY;YAChB,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/C,KAAK,iBAAiB;YACrB,OAAO,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACpD,KAAK,cAAc;YAClB,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACjD;YACC,MAAM,yBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const DYNAMIC_OPTIONS_DESCRIPTION = "Choose from the list, or specify an ID using an <a href=\"https://docs.n8n.io/code/expressions/\">expression</a>";
|
|
3
|
+
export declare const DYNAMIC_MULTI_OPTIONS_DESCRIPTION = "Choose from the list, or specify IDs using an <a href=\"https://docs.n8n.io/code/expressions/\">expression</a>";
|
|
4
|
+
export declare function userIdentifierProperties(resource: string, operations: string[]): INodeProperties[];
|
|
5
|
+
export declare function dealIdProperty(resource: string, operations: string[], description?: string): INodeProperties;
|
|
6
|
+
export declare function returnAllProperties(displayOptions: INodeProperties['displayOptions']): INodeProperties[];
|
|
7
|
+
export declare function customFieldsProperty(resource: string, operations: string[]): INodeProperties;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DYNAMIC_MULTI_OPTIONS_DESCRIPTION = exports.DYNAMIC_OPTIONS_DESCRIPTION = void 0;
|
|
4
|
+
exports.userIdentifierProperties = userIdentifierProperties;
|
|
5
|
+
exports.dealIdProperty = dealIdProperty;
|
|
6
|
+
exports.returnAllProperties = returnAllProperties;
|
|
7
|
+
exports.customFieldsProperty = customFieldsProperty;
|
|
8
|
+
exports.DYNAMIC_OPTIONS_DESCRIPTION = 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>';
|
|
9
|
+
exports.DYNAMIC_MULTI_OPTIONS_DESCRIPTION = 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>';
|
|
10
|
+
const show = (resource, operations, extra = {}) => ({
|
|
11
|
+
show: { resource: [resource], operation: operations, ...extra },
|
|
12
|
+
});
|
|
13
|
+
function userIdentifierProperties(resource, operations) {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Identify User By',
|
|
17
|
+
name: 'identifyBy',
|
|
18
|
+
type: 'options',
|
|
19
|
+
default: 'userId',
|
|
20
|
+
displayOptions: show(resource, operations),
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
name: 'User ID',
|
|
24
|
+
value: 'userId',
|
|
25
|
+
description: 'ID пользователя — unambiguous, and the only form every endpoint accepts',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Email',
|
|
29
|
+
value: 'email',
|
|
30
|
+
description: 'Email пользователя, when the ID is unknown',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Phone',
|
|
34
|
+
value: 'phone',
|
|
35
|
+
description: 'Телефон пользователя. Documented for the write endpoints and for Get; the other reads may ignore it and answer as if no user was named.',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
description: 'Чем адресуем пользователя. Exactly one of the three is sent.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'User ID',
|
|
42
|
+
name: 'userId',
|
|
43
|
+
type: 'string',
|
|
44
|
+
default: '',
|
|
45
|
+
required: true,
|
|
46
|
+
displayOptions: show(resource, operations, { identifyBy: ['userId'] }),
|
|
47
|
+
description: 'ID пользователя в GetCourse',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Email',
|
|
51
|
+
name: 'email',
|
|
52
|
+
type: 'string',
|
|
53
|
+
placeholder: 'name@example.com',
|
|
54
|
+
default: '',
|
|
55
|
+
required: true,
|
|
56
|
+
displayOptions: show(resource, operations, { identifyBy: ['email'] }),
|
|
57
|
+
description: 'Электронная почта пользователя',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Phone',
|
|
61
|
+
name: 'phone',
|
|
62
|
+
type: 'string',
|
|
63
|
+
placeholder: '+79161234567',
|
|
64
|
+
default: '',
|
|
65
|
+
required: true,
|
|
66
|
+
displayOptions: show(resource, operations, { identifyBy: ['phone'] }),
|
|
67
|
+
description: 'Телефон пользователя, in international form',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
function dealIdProperty(resource, operations, description = 'ID заказа в GetCourse') {
|
|
72
|
+
return {
|
|
73
|
+
displayName: 'Order ID',
|
|
74
|
+
name: 'dealId',
|
|
75
|
+
type: 'string',
|
|
76
|
+
default: '',
|
|
77
|
+
required: true,
|
|
78
|
+
displayOptions: show(resource, operations),
|
|
79
|
+
description,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function returnAllProperties(displayOptions) {
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
displayName: 'Return All',
|
|
86
|
+
name: 'returnAll',
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
default: false,
|
|
89
|
+
displayOptions,
|
|
90
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Limit',
|
|
94
|
+
name: 'limit',
|
|
95
|
+
type: 'number',
|
|
96
|
+
typeOptions: { minValue: 1 },
|
|
97
|
+
default: 50,
|
|
98
|
+
displayOptions: {
|
|
99
|
+
...displayOptions,
|
|
100
|
+
show: { ...displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.show, returnAll: [false] },
|
|
101
|
+
},
|
|
102
|
+
description: 'Max number of results to return',
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
function customFieldsProperty(resource, operations) {
|
|
107
|
+
return {
|
|
108
|
+
displayName: 'Custom Fields',
|
|
109
|
+
name: 'customFieldsUi',
|
|
110
|
+
type: 'fixedCollection',
|
|
111
|
+
typeOptions: { multipleValues: true },
|
|
112
|
+
placeholder: 'Add Custom Field',
|
|
113
|
+
default: {},
|
|
114
|
+
displayOptions: show(resource, operations),
|
|
115
|
+
description: "Дополнительные поля, keyed by numeric field ID. The Tech API has no method that lists field IDs — the GetCourse Legacy node's Custom Field resource does, and so does Профиль → Настройки аккаунта → Дополнительные поля in the browser.",
|
|
116
|
+
options: [
|
|
117
|
+
{
|
|
118
|
+
name: 'field',
|
|
119
|
+
displayName: 'Field',
|
|
120
|
+
values: [
|
|
121
|
+
{
|
|
122
|
+
displayName: 'Field ID',
|
|
123
|
+
name: 'id',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: '',
|
|
126
|
+
required: true,
|
|
127
|
+
placeholder: '3',
|
|
128
|
+
description: 'ID дополнительного поля, a number',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Value',
|
|
132
|
+
name: 'value',
|
|
133
|
+
type: 'string',
|
|
134
|
+
default: '',
|
|
135
|
+
description: 'Значение поля',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1/descriptions/common.ts"],"names":[],"mappings":";;;AAmCA,4DA6DC;AAGD,wCAcC;AAQD,kDAyBC;AAWD,oDAoCC;AA9LY,QAAA,2BAA2B,GACvC,gHAAgH,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AAE,iCAAiC;SAC9C;KACD,CAAC;AACH,CAAC;AAWD,SAAgB,oBAAoB,CAAC,QAAgB,EAAE,UAAoB;IAC1E,OAAO;QACN,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;QACrC,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;QAC1C,WAAW,EACV,0OAA0O;QAC3O,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,OAAO;gBACpB,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,UAAU;wBACvB,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,GAAG;wBAChB,WAAW,EAAE,mCAAmC;qBAChD;oBACD;wBACC,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,eAAe;qBAC5B;iBACD;aACD;SACD;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { INode } from 'n8n-workflow';
|
|
2
|
+
import { NodeApiError } from 'n8n-workflow';
|
|
3
|
+
export interface TechApiEnvelope {
|
|
4
|
+
status?: boolean;
|
|
5
|
+
message?: string | null;
|
|
6
|
+
code?: number;
|
|
7
|
+
errors?: unknown;
|
|
8
|
+
data?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare function toTechApiError(node: INode, error: unknown, status?: number): NodeApiError;
|
|
11
|
+
export declare function envelopeError(node: INode, envelope: TechApiEnvelope): NodeApiError;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toTechApiError = toTechApiError;
|
|
4
|
+
exports.envelopeError = envelopeError;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const httpError_1 = require("../../../../utils/httpError");
|
|
7
|
+
function describeErrors(errors) {
|
|
8
|
+
if (errors === null || errors === undefined)
|
|
9
|
+
return '';
|
|
10
|
+
if (Array.isArray(errors)) {
|
|
11
|
+
return errors
|
|
12
|
+
.map((entry) => (typeof entry === 'string' ? entry : JSON.stringify(entry)))
|
|
13
|
+
.filter((entry) => entry !== '')
|
|
14
|
+
.join('\n');
|
|
15
|
+
}
|
|
16
|
+
if (typeof errors === 'object') {
|
|
17
|
+
return Object.entries(errors)
|
|
18
|
+
.map(([field, detail]) => `${field}: ${Array.isArray(detail) ? detail.join(', ') : String(detail)}`)
|
|
19
|
+
.join('\n');
|
|
20
|
+
}
|
|
21
|
+
return String(errors);
|
|
22
|
+
}
|
|
23
|
+
function toTechApiError(node, error, status) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (error instanceof n8n_workflow_1.NodeApiError && status === undefined)
|
|
26
|
+
return error;
|
|
27
|
+
const httpCode = status !== null && status !== void 0 ? status : (0, httpError_1.extractStatusCode)(error);
|
|
28
|
+
const body = ((_a = (0, httpError_1.extractResponseBody)(error)) !== null && _a !== void 0 ? _a : {});
|
|
29
|
+
const reported = typeof body.message === 'string' && body.message !== '' ? body.message : '';
|
|
30
|
+
const details = describeErrors(body.errors);
|
|
31
|
+
let message = reported === '' ? 'GetCourse request failed' : reported;
|
|
32
|
+
let description = details;
|
|
33
|
+
switch (httpCode) {
|
|
34
|
+
case 400:
|
|
35
|
+
message = 'GetCourse rejected the request';
|
|
36
|
+
description =
|
|
37
|
+
details === ''
|
|
38
|
+
? reported || 'The request did not pass validation.'
|
|
39
|
+
: `${reported}\n${details}`;
|
|
40
|
+
break;
|
|
41
|
+
case 401:
|
|
42
|
+
case 403:
|
|
43
|
+
message = 'GetCourse refused the credentials';
|
|
44
|
+
description =
|
|
45
|
+
'The Tech API token is the developer key and the school key joined by an underscore. A 403 means one of the two halves is wrong, they belong to different schools, or the school has not enabled API access for this developer key.\n' +
|
|
46
|
+
details;
|
|
47
|
+
break;
|
|
48
|
+
case 404:
|
|
49
|
+
message = 'GetCourse found nothing at that address';
|
|
50
|
+
description =
|
|
51
|
+
description === ''
|
|
52
|
+
? 'The object ID may be wrong, or the method may not exist on this account version.'
|
|
53
|
+
: description;
|
|
54
|
+
break;
|
|
55
|
+
case 429:
|
|
56
|
+
message = 'GetCourse rate limit exceeded';
|
|
57
|
+
description =
|
|
58
|
+
'The account went over its request budget and the retries did not clear it. Lower "Requests per Second" on the credential, or reduce how many workflows call this account at once.';
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
if (httpCode !== undefined && httpCode >= 500) {
|
|
62
|
+
message = 'GetCourse returned a server error';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return new n8n_workflow_1.NodeApiError(node, asPlainError(error), {
|
|
66
|
+
message,
|
|
67
|
+
description: description.trim() === '' ? undefined : description.trim(),
|
|
68
|
+
httpCode: httpCode === undefined ? undefined : String(httpCode),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function asPlainError(error) {
|
|
72
|
+
var _a;
|
|
73
|
+
if (!(error instanceof n8n_workflow_1.NodeApiError))
|
|
74
|
+
return error;
|
|
75
|
+
return {
|
|
76
|
+
message: error.message,
|
|
77
|
+
description: (_a = error.description) !== null && _a !== void 0 ? _a : null,
|
|
78
|
+
httpCode: error.httpCode,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function envelopeError(node, envelope) {
|
|
82
|
+
const details = describeErrors(envelope.errors);
|
|
83
|
+
const reported = typeof envelope.message === 'string' ? envelope.message : '';
|
|
84
|
+
return new n8n_workflow_1.NodeApiError(node, envelope, {
|
|
85
|
+
message: reported === '' ? 'GetCourse reported a failure' : reported,
|
|
86
|
+
description: details === '' ? undefined : details,
|
|
87
|
+
httpCode: envelope.code === undefined ? undefined : String(envelope.code),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=errors.js.map
|