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.
Files changed (171) hide show
  1. package/LICENSE.md +38 -0
  2. package/README.md +359 -0
  3. package/dist/credentials/GetCourseApi.credentials.d.ts +10 -0
  4. package/dist/credentials/GetCourseApi.credentials.js +58 -0
  5. package/dist/credentials/GetCourseApi.credentials.js.map +1 -0
  6. package/dist/credentials/GetCourseTechApi.credentials.d.ts +11 -0
  7. package/dist/credentials/GetCourseTechApi.credentials.js +63 -0
  8. package/dist/credentials/GetCourseTechApi.credentials.js.map +1 -0
  9. package/dist/credentials/accountAddress.d.ts +11 -0
  10. package/dist/credentials/accountAddress.js +116 -0
  11. package/dist/credentials/accountAddress.js.map +1 -0
  12. package/dist/icons/getcourse.dark.svg +15 -0
  13. package/dist/icons/getcourse.svg +11 -0
  14. package/dist/nodes/GetCourse/GetCourse.node.d.ts +9 -0
  15. package/dist/nodes/GetCourse/GetCourse.node.js +48 -0
  16. package/dist/nodes/GetCourse/GetCourse.node.js.map +1 -0
  17. package/dist/nodes/GetCourse/GetCourse.node.json +40 -0
  18. package/dist/nodes/GetCourse/v1/actions/call/index.d.ts +3 -0
  19. package/dist/nodes/GetCourse/v1/actions/call/index.js +98 -0
  20. package/dist/nodes/GetCourse/v1/actions/call/index.js.map +1 -0
  21. package/dist/nodes/GetCourse/v1/actions/deal/description.d.ts +2 -0
  22. package/dist/nodes/GetCourse/v1/actions/deal/description.js +261 -0
  23. package/dist/nodes/GetCourse/v1/actions/deal/description.js.map +1 -0
  24. package/dist/nodes/GetCourse/v1/actions/deal/execute.d.ts +2 -0
  25. package/dist/nodes/GetCourse/v1/actions/deal/execute.js +181 -0
  26. package/dist/nodes/GetCourse/v1/actions/deal/execute.js.map +1 -0
  27. package/dist/nodes/GetCourse/v1/actions/deal/index.d.ts +2 -0
  28. package/dist/nodes/GetCourse/v1/actions/deal/index.js +8 -0
  29. package/dist/nodes/GetCourse/v1/actions/deal/index.js.map +1 -0
  30. package/dist/nodes/GetCourse/v1/actions/dialog/index.d.ts +3 -0
  31. package/dist/nodes/GetCourse/v1/actions/dialog/index.js +262 -0
  32. package/dist/nodes/GetCourse/v1/actions/dialog/index.js.map +1 -0
  33. package/dist/nodes/GetCourse/v1/actions/helpdesk/index.d.ts +3 -0
  34. package/dist/nodes/GetCourse/v1/actions/helpdesk/index.js +305 -0
  35. package/dist/nodes/GetCourse/v1/actions/helpdesk/index.js.map +1 -0
  36. package/dist/nodes/GetCourse/v1/actions/index.d.ts +5 -0
  37. package/dist/nodes/GetCourse/v1/actions/index.js +119 -0
  38. package/dist/nodes/GetCourse/v1/actions/index.js.map +1 -0
  39. package/dist/nodes/GetCourse/v1/actions/lesson/index.d.ts +3 -0
  40. package/dist/nodes/GetCourse/v1/actions/lesson/index.js +180 -0
  41. package/dist/nodes/GetCourse/v1/actions/lesson/index.js.map +1 -0
  42. package/dist/nodes/GetCourse/v1/actions/offer/index.d.ts +3 -0
  43. package/dist/nodes/GetCourse/v1/actions/offer/index.js +98 -0
  44. package/dist/nodes/GetCourse/v1/actions/offer/index.js.map +1 -0
  45. package/dist/nodes/GetCourse/v1/actions/school/index.d.ts +3 -0
  46. package/dist/nodes/GetCourse/v1/actions/school/index.js +139 -0
  47. package/dist/nodes/GetCourse/v1/actions/school/index.js.map +1 -0
  48. package/dist/nodes/GetCourse/v1/actions/user/description.d.ts +2 -0
  49. package/dist/nodes/GetCourse/v1/actions/user/description.js +499 -0
  50. package/dist/nodes/GetCourse/v1/actions/user/description.js.map +1 -0
  51. package/dist/nodes/GetCourse/v1/actions/user/execute.d.ts +2 -0
  52. package/dist/nodes/GetCourse/v1/actions/user/execute.js +270 -0
  53. package/dist/nodes/GetCourse/v1/actions/user/execute.js.map +1 -0
  54. package/dist/nodes/GetCourse/v1/actions/user/index.d.ts +2 -0
  55. package/dist/nodes/GetCourse/v1/actions/user/index.js +8 -0
  56. package/dist/nodes/GetCourse/v1/actions/user/index.js.map +1 -0
  57. package/dist/nodes/GetCourse/v1/actions/webhook/index.d.ts +4 -0
  58. package/dist/nodes/GetCourse/v1/actions/webhook/index.js +179 -0
  59. package/dist/nodes/GetCourse/v1/actions/webhook/index.js.map +1 -0
  60. package/dist/nodes/GetCourse/v1/actions/webinar/index.d.ts +3 -0
  61. package/dist/nodes/GetCourse/v1/actions/webinar/index.js +376 -0
  62. package/dist/nodes/GetCourse/v1/actions/webinar/index.js.map +1 -0
  63. package/dist/nodes/GetCourse/v1/descriptions/common.d.ts +7 -0
  64. package/dist/nodes/GetCourse/v1/descriptions/common.js +142 -0
  65. package/dist/nodes/GetCourse/v1/descriptions/common.js.map +1 -0
  66. package/dist/nodes/GetCourse/v1/helpers/errors.d.ts +11 -0
  67. package/dist/nodes/GetCourse/v1/helpers/errors.js +90 -0
  68. package/dist/nodes/GetCourse/v1/helpers/errors.js.map +1 -0
  69. package/dist/nodes/GetCourse/v1/helpers/request.d.ts +7 -0
  70. package/dist/nodes/GetCourse/v1/helpers/request.js +79 -0
  71. package/dist/nodes/GetCourse/v1/helpers/request.js.map +1 -0
  72. package/dist/nodes/GetCourse/v1/methods/index.d.ts +2 -0
  73. package/dist/nodes/GetCourse/v1/methods/index.js +39 -0
  74. package/dist/nodes/GetCourse/v1/methods/index.js.map +1 -0
  75. package/dist/nodes/GetCourse/v1/methods/loadOptions.d.ts +7 -0
  76. package/dist/nodes/GetCourse/v1/methods/loadOptions.js +76 -0
  77. package/dist/nodes/GetCourse/v1/methods/loadOptions.js.map +1 -0
  78. package/dist/nodes/GetCourse/v1/transport/index.d.ts +18 -0
  79. package/dist/nodes/GetCourse/v1/transport/index.js +165 -0
  80. package/dist/nodes/GetCourse/v1/transport/index.js.map +1 -0
  81. package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.d.ts +9 -0
  82. package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.js +48 -0
  83. package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.js.map +1 -0
  84. package/dist/nodes/GetCourseLegacy/GetCourseLegacy.node.json +35 -0
  85. package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.d.ts +2 -0
  86. package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.js +287 -0
  87. package/dist/nodes/GetCourseLegacy/v1/actions/deal/description.js.map +1 -0
  88. package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.d.ts +2 -0
  89. package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.js +150 -0
  90. package/dist/nodes/GetCourseLegacy/v1/actions/deal/execute.js.map +1 -0
  91. package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.d.ts +2 -0
  92. package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.js +8 -0
  93. package/dist/nodes/GetCourseLegacy/v1/actions/deal/index.js.map +1 -0
  94. package/dist/nodes/GetCourseLegacy/v1/actions/export/description.d.ts +2 -0
  95. package/dist/nodes/GetCourseLegacy/v1/actions/export/description.js +487 -0
  96. package/dist/nodes/GetCourseLegacy/v1/actions/export/description.js.map +1 -0
  97. package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.d.ts +2 -0
  98. package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.js +252 -0
  99. package/dist/nodes/GetCourseLegacy/v1/actions/export/execute.js.map +1 -0
  100. package/dist/nodes/GetCourseLegacy/v1/actions/export/index.d.ts +2 -0
  101. package/dist/nodes/GetCourseLegacy/v1/actions/export/index.js +8 -0
  102. package/dist/nodes/GetCourseLegacy/v1/actions/export/index.js.map +1 -0
  103. package/dist/nodes/GetCourseLegacy/v1/actions/field/index.d.ts +3 -0
  104. package/dist/nodes/GetCourseLegacy/v1/actions/field/index.js +61 -0
  105. package/dist/nodes/GetCourseLegacy/v1/actions/field/index.js.map +1 -0
  106. package/dist/nodes/GetCourseLegacy/v1/actions/group/index.d.ts +3 -0
  107. package/dist/nodes/GetCourseLegacy/v1/actions/group/index.js +42 -0
  108. package/dist/nodes/GetCourseLegacy/v1/actions/group/index.js.map +1 -0
  109. package/dist/nodes/GetCourseLegacy/v1/actions/index.d.ts +5 -0
  110. package/dist/nodes/GetCourseLegacy/v1/actions/index.js +84 -0
  111. package/dist/nodes/GetCourseLegacy/v1/actions/index.js.map +1 -0
  112. package/dist/nodes/GetCourseLegacy/v1/actions/user/description.d.ts +2 -0
  113. package/dist/nodes/GetCourseLegacy/v1/actions/user/description.js +87 -0
  114. package/dist/nodes/GetCourseLegacy/v1/actions/user/description.js.map +1 -0
  115. package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.d.ts +5 -0
  116. package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.js +129 -0
  117. package/dist/nodes/GetCourseLegacy/v1/actions/user/execute.js.map +1 -0
  118. package/dist/nodes/GetCourseLegacy/v1/actions/user/index.d.ts +2 -0
  119. package/dist/nodes/GetCourseLegacy/v1/actions/user/index.js +8 -0
  120. package/dist/nodes/GetCourseLegacy/v1/actions/user/index.js.map +1 -0
  121. package/dist/nodes/GetCourseLegacy/v1/descriptions/common.d.ts +14 -0
  122. package/dist/nodes/GetCourseLegacy/v1/descriptions/common.js +198 -0
  123. package/dist/nodes/GetCourseLegacy/v1/descriptions/common.js.map +1 -0
  124. package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.d.ts +7 -0
  125. package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.js +116 -0
  126. package/dist/nodes/GetCourseLegacy/v1/descriptions/constants.js.map +1 -0
  127. package/dist/nodes/GetCourseLegacy/v1/helpers/errors.d.ts +18 -0
  128. package/dist/nodes/GetCourseLegacy/v1/helpers/errors.js +141 -0
  129. package/dist/nodes/GetCourseLegacy/v1/helpers/errors.js.map +1 -0
  130. package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.d.ts +8 -0
  131. package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.js +100 -0
  132. package/dist/nodes/GetCourseLegacy/v1/helpers/exportRows.js.map +1 -0
  133. package/dist/nodes/GetCourseLegacy/v1/methods/index.d.ts +2 -0
  134. package/dist/nodes/GetCourseLegacy/v1/methods/index.js +39 -0
  135. package/dist/nodes/GetCourseLegacy/v1/methods/index.js.map +1 -0
  136. package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.d.ts +5 -0
  137. package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.js +92 -0
  138. package/dist/nodes/GetCourseLegacy/v1/methods/loadOptions.js.map +1 -0
  139. package/dist/nodes/GetCourseLegacy/v1/transport/index.d.ts +13 -0
  140. package/dist/nodes/GetCourseLegacy/v1/transport/index.js +204 -0
  141. package/dist/nodes/GetCourseLegacy/v1/transport/index.js.map +1 -0
  142. package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.d.ts +12 -0
  143. package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.js +339 -0
  144. package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.js.map +1 -0
  145. package/dist/nodes/GetCourseTrigger/GetCourseTrigger.node.json +32 -0
  146. package/dist/nodes/GetCourseTrigger/payload.d.ts +14 -0
  147. package/dist/nodes/GetCourseTrigger/payload.js +66 -0
  148. package/dist/nodes/GetCourseTrigger/payload.js.map +1 -0
  149. package/dist/utils/cache.d.ts +2 -0
  150. package/dist/utils/cache.js +27 -0
  151. package/dist/utils/cache.js.map +1 -0
  152. package/dist/utils/dates.d.ts +3 -0
  153. package/dist/utils/dates.js +70 -0
  154. package/dist/utils/dates.js.map +1 -0
  155. package/dist/utils/events.d.ts +14 -0
  156. package/dist/utils/events.js +92 -0
  157. package/dist/utils/events.js.map +1 -0
  158. package/dist/utils/httpError.d.ts +4 -0
  159. package/dist/utils/httpError.js +46 -0
  160. package/dist/utils/httpError.js.map +1 -0
  161. package/dist/utils/query.d.ts +4 -0
  162. package/dist/utils/query.js +42 -0
  163. package/dist/utils/query.js.map +1 -0
  164. package/dist/utils/rateLimiter.d.ts +3 -0
  165. package/dist/utils/rateLimiter.js +44 -0
  166. package/dist/utils/rateLimiter.js.map +1 -0
  167. package/dist/utils/router.d.ts +8 -0
  168. package/dist/utils/router.js +40 -0
  169. package/dist/utils/router.js.map +1 -0
  170. package/index.js +0 -0
  171. package/package.json +68 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1/helpers/errors.ts"],"names":[],"mappings":";;AA8CA,wCAoDC;AA6BD,sCASC;AAvID,+CAA4C;AAE5C,2DAAqF;AAYrF,SAAS,cAAc,CAAC,MAAe;IACtC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAEvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM;aACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;aAC3E,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;aAC/B,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAEhC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAqB,CAAC;aAC1C,GAAG,CACH,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CACnB,GAAG,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAC1E;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC;AAUD,SAAgB,cAAc,CAAC,IAAW,EAAE,KAAc,EAAE,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CAAC,CAAC,OAAO;QACjD,QAAQ,EAAE,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;KACzE,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function userIdentifier(this: IExecuteFunctions, itemIndex: number): IDataObject;
3
+ export declare function userIdentifierQuery(this: IExecuteFunctions, itemIndex: number): IDataObject;
4
+ export declare function dealId(this: IExecuteFunctions, itemIndex: number): number;
5
+ export declare function customFieldsPayload(this: IExecuteFunctions, itemIndex: number): IDataObject;
6
+ export declare function toItems(data: unknown, fallback?: IDataObject): IDataObject[];
7
+ export declare function applyLimit(rows: IDataObject[], returnAll: boolean, limit: number): IDataObject[];
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userIdentifier = userIdentifier;
4
+ exports.userIdentifierQuery = userIdentifierQuery;
5
+ exports.dealId = dealId;
6
+ exports.customFieldsPayload = customFieldsPayload;
7
+ exports.toItems = toItems;
8
+ exports.applyLimit = applyLimit;
9
+ const n8n_workflow_1 = require("n8n-workflow");
10
+ function userIdentifier(itemIndex) {
11
+ var _a;
12
+ const by = String(this.getNodeParameter('identifyBy', itemIndex, 'userId'));
13
+ const value = String((_a = this.getNodeParameter(by, itemIndex, '')) !== null && _a !== void 0 ? _a : '').trim();
14
+ if (value === '') {
15
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No user named', {
16
+ description: 'Fill in the ID, e-mail or phone number the operation should look the user up by.',
17
+ itemIndex,
18
+ });
19
+ }
20
+ if (by !== 'userId')
21
+ return { [by]: value };
22
+ return { userId: assertNumeric.call(this, value, 'user ID', itemIndex) };
23
+ }
24
+ function assertNumeric(value, label, itemIndex) {
25
+ const parsed = Number(value);
26
+ if (!Number.isFinite(parsed)) {
27
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `"${value}" is not a ${label}`, {
28
+ description: `GetCourse expects a number here. Anything else is serialised as null, which the API ` +
29
+ 'reads as the field having been left out.',
30
+ itemIndex,
31
+ });
32
+ }
33
+ return parsed;
34
+ }
35
+ function userIdentifierQuery(itemIndex) {
36
+ return userIdentifier.call(this, itemIndex);
37
+ }
38
+ function dealId(itemIndex) {
39
+ var _a;
40
+ const raw = String((_a = this.getNodeParameter('dealId', itemIndex, '')) !== null && _a !== void 0 ? _a : '').trim();
41
+ if (raw === '') {
42
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No order named', {
43
+ description: 'Give the numeric GetCourse order ID.',
44
+ itemIndex,
45
+ });
46
+ }
47
+ return assertNumeric.call(this, raw, 'order ID', itemIndex);
48
+ }
49
+ function customFieldsPayload(itemIndex) {
50
+ var _a, _b, _c;
51
+ const collection = this.getNodeParameter('customFieldsUi', itemIndex, {});
52
+ const rows = ((_a = collection.field) !== null && _a !== void 0 ? _a : []);
53
+ const payload = {};
54
+ for (const row of rows) {
55
+ const id = String((_b = row.id) !== null && _b !== void 0 ? _b : '').trim();
56
+ if (id === '')
57
+ continue;
58
+ payload[id] = (_c = row.value) !== null && _c !== void 0 ? _c : '';
59
+ }
60
+ return payload;
61
+ }
62
+ function toItems(data, fallback = { success: true }) {
63
+ if (data === null || data === undefined)
64
+ return [fallback];
65
+ if (Array.isArray(data)) {
66
+ if (data.length === 0)
67
+ return [fallback];
68
+ return data.map((entry) => entry !== null && typeof entry === 'object' && !Array.isArray(entry)
69
+ ? entry
70
+ : { value: entry });
71
+ }
72
+ if (typeof data === 'object')
73
+ return [data];
74
+ return [{ value: data }];
75
+ }
76
+ function applyLimit(rows, returnAll, limit) {
77
+ return returnAll ? rows : rows.slice(0, Math.max(1, limit));
78
+ }
79
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1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;IAC/E,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE3D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACzB,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACnE,CAAC,CAAE,KAAqB;YACxB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CACnB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAmB,CAAC,CAAC;IAE3D,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1B,CAAC;AAGD,SAAgB,UAAU,CAAC,IAAmB,EAAE,SAAkB,EAAE,KAAa;IAChF,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,2 @@
1
+ import * as loadOptions from './loadOptions';
2
+ export { loadOptions };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadOptions = void 0;
37
+ const loadOptions = __importStar(require("./loadOptions"));
38
+ exports.loadOptions = loadOptions;
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1/methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAEpC,kCAAW"}
@@ -0,0 +1,7 @@
1
+ import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
2
+ export declare function getGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
3
+ export declare function getDepartments(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
4
+ export declare function getManagers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
5
+ export declare function getCancelReasons(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
6
+ export declare function getWebinars(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ export declare function getOffers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGroups = getGroups;
4
+ exports.getDepartments = getDepartments;
5
+ exports.getManagers = getManagers;
6
+ exports.getCancelReasons = getCancelReasons;
7
+ exports.getWebinars = getWebinars;
8
+ exports.getOffers = getOffers;
9
+ const transport_1 = require("../transport");
10
+ async function dictionary(endpoint) {
11
+ const data = (await transport_1.techApiCachedRequest.call(this, endpoint));
12
+ return Array.isArray(data) ? data : [];
13
+ }
14
+ function toOptions(rows, label, describe) {
15
+ return rows
16
+ .map((row) => {
17
+ var _a;
18
+ return ({
19
+ name: label(row) || String((_a = row.id) !== null && _a !== void 0 ? _a : ''),
20
+ value: row.id,
21
+ description: describe === null || describe === void 0 ? void 0 : describe(row),
22
+ });
23
+ })
24
+ .filter((option) => option.value !== undefined && option.name !== '')
25
+ .sort((left, right) => String(left.name).localeCompare(String(right.name)));
26
+ }
27
+ async function getGroups() {
28
+ return toOptions(await dictionary.call(this, '/common/get-groups'), (row) => { var _a; return String((_a = row.name) !== null && _a !== void 0 ? _a : ''); });
29
+ }
30
+ async function getDepartments() {
31
+ return toOptions(await dictionary.call(this, '/common/get-departments'), (row) => { var _a, _b; return String((_b = (_a = row.title) !== null && _a !== void 0 ? _a : row.name) !== null && _b !== void 0 ? _b : ''); });
32
+ }
33
+ async function getManagers() {
34
+ return toOptions(await dictionary.call(this, '/common/get-personal-managers'), (row) => {
35
+ var _a, _b, _c;
36
+ const name = `${String((_a = row.first_name) !== null && _a !== void 0 ? _a : '')} ${String((_b = row.last_name) !== null && _b !== void 0 ? _b : '')}`.trim();
37
+ return name === '' ? String((_c = row.email) !== null && _c !== void 0 ? _c : '') : name;
38
+ }, (row) => { var _a; return String((_a = row.email) !== null && _a !== void 0 ? _a : ''); });
39
+ }
40
+ async function getCancelReasons() {
41
+ return toOptions(await dictionary.call(this, '/deal/get-cancel-reasons'), (row) => { var _a; return String((_a = row.name) !== null && _a !== void 0 ? _a : ''); });
42
+ }
43
+ async function getWebinars() {
44
+ return toOptions(await dictionary.call(this, '/webinar/get-all-webinars'), (row) => {
45
+ var _a, _b, _c;
46
+ const params = ((_a = row.params) !== null && _a !== void 0 ? _a : {});
47
+ return String((_c = (_b = row.name) !== null && _b !== void 0 ? _b : params.title) !== null && _c !== void 0 ? _c : '');
48
+ }, (row) => { var _a; return String((_a = row.status) !== null && _a !== void 0 ? _a : ''); });
49
+ }
50
+ async function getOffers() {
51
+ const pageSize = 100;
52
+ const maxPages = 20;
53
+ const rows = [];
54
+ for (let page = 0; page < maxPages; page++) {
55
+ const batch = (await transport_1.techApiCachedRequest.call(this, '/offer/get-offers', {
56
+ limit: pageSize,
57
+ offset: page * pageSize,
58
+ }));
59
+ if (!Array.isArray(batch) || batch.length === 0)
60
+ break;
61
+ rows.push(...batch);
62
+ if (batch.length < pageSize)
63
+ break;
64
+ }
65
+ return toOptions(rows, (row) => {
66
+ var _a, _b, _c;
67
+ const code = String((_a = row.code) !== null && _a !== void 0 ? _a : '');
68
+ return code === '' ? String((_b = row.title) !== null && _b !== void 0 ? _b : '') : `${String((_c = row.title) !== null && _c !== void 0 ? _c : '')} [${code}]`;
69
+ }, (row) => {
70
+ var _a;
71
+ const price = row.price === undefined ? '' : String(row.price);
72
+ const currency = String((_a = row.currency) !== null && _a !== void 0 ? _a : '');
73
+ return [price, currency].filter((part) => part !== '').join(' ');
74
+ });
75
+ }
76
+ //# sourceMappingURL=loadOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1/methods/loadOptions.ts"],"names":[],"mappings":";;AAkCA,8BAIC;AAGD,wCAIC;AAMD,kCASC;AAED,4CAMC;AAED,kCASC;AASD,8BA6BC;AAnHD,4CAAoD;AAYpD,KAAK,UAAU,UAAU,CAA8B,QAAgB;IACtE,MAAM,IAAI,GAAG,CAAC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AAM,KAAK,GAAG,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAA,GAAG,CAAC,QAAQ,mCAAI,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC,CACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions, IPollFunctions, IWebhookFunctions } from 'n8n-workflow';
2
+ import type { TechApiEnvelope } from '../helpers/errors';
3
+ export type GetCourseContext = IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions | IPollFunctions;
4
+ export declare const CREDENTIAL_NAME = "getCourseTechApi";
5
+ export interface TechRequestOptions {
6
+ fullResponse?: boolean;
7
+ maxAttempts?: number;
8
+ headers?: IDataObject;
9
+ }
10
+ export declare function techApiRequest(this: GetCourseContext, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, options?: TechRequestOptions): Promise<any>;
11
+ export declare function readEnvelope(this: GetCourseContext, body: unknown, url: string, status: number): TechApiEnvelope;
12
+ export declare function techApiCachedRequest(this: GetCourseContext, endpoint: string, qs?: IDataObject): Promise<any>;
13
+ export declare function techApiRequestAllItems(this: GetCourseContext, endpoint: string, qs?: IDataObject, options?: {
14
+ limit?: number;
15
+ pageSize?: number;
16
+ maxPages?: number;
17
+ }): Promise<IDataObject[]>;
18
+ export declare function compactQuery(input?: IDataObject): IDataObject;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CREDENTIAL_NAME = void 0;
4
+ exports.techApiRequest = techApiRequest;
5
+ exports.readEnvelope = readEnvelope;
6
+ exports.techApiCachedRequest = techApiCachedRequest;
7
+ exports.techApiRequestAllItems = techApiRequestAllItems;
8
+ exports.compactQuery = compactQuery;
9
+ const n8n_workflow_1 = require("n8n-workflow");
10
+ const accountAddress_1 = require("../../../../credentials/accountAddress");
11
+ const cache_1 = require("../../../../utils/cache");
12
+ const httpError_1 = require("../../../../utils/httpError");
13
+ const rateLimiter_1 = require("../../../../utils/rateLimiter");
14
+ const errors_1 = require("../helpers/errors");
15
+ exports.CREDENTIAL_NAME = 'getCourseTechApi';
16
+ const API_PREFIX = '/pl/api/v1';
17
+ const RETRYABLE_READ_STATUSES = new Set([500, 502, 503, 504]);
18
+ async function resolveAccount() {
19
+ var _a, _b, _c;
20
+ const credentials = await this.getCredentials(exports.CREDENTIAL_NAME);
21
+ const baseUrl = (0, accountAddress_1.accountBaseUrl)(credentials);
22
+ if (baseUrl === '') {
23
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The GetCourse credential has no usable account address', {
24
+ description: 'Open the credential and fill in the account address — either the subdomain, for example myschool.getcourse.ru, or the school domain.',
25
+ });
26
+ }
27
+ return {
28
+ baseUrl,
29
+ requestsPerSecond: Number(credentials.requestsPerSecond) || 5,
30
+ credentialId: (_c = (_b = (_a = this.getNode().credentials) === null || _a === void 0 ? void 0 : _a[exports.CREDENTIAL_NAME]) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : 'unbound',
31
+ };
32
+ }
33
+ function backoffDelay(attempt, error) {
34
+ const advertised = (0, httpError_1.extractRetryAfterMs)(error);
35
+ if (advertised !== undefined)
36
+ return Math.min(advertised, 60000);
37
+ return Math.min(2 ** (attempt - 1) * 1000, 16000) + (0, n8n_workflow_1.randomInt)(250);
38
+ }
39
+ async function techApiRequest(method, endpoint, body, qs, options = {}) {
40
+ var _a;
41
+ const account = await resolveAccount.call(this);
42
+ const url = `${account.baseUrl}${API_PREFIX}${endpoint}`;
43
+ const requestOptions = {
44
+ method,
45
+ baseURL: `${account.baseUrl}${API_PREFIX}`,
46
+ url: endpoint,
47
+ json: true,
48
+ returnFullResponse: true,
49
+ disableFollowRedirect: true,
50
+ ignoreHttpStatusErrors: true,
51
+ };
52
+ if (options.headers !== undefined)
53
+ requestOptions.headers = options.headers;
54
+ if (body !== undefined)
55
+ requestOptions.body = body;
56
+ const query = compactQuery(qs);
57
+ if (Object.keys(query).length > 0)
58
+ requestOptions.qs = query;
59
+ const maxAttempts = (_a = options.maxAttempts) !== null && _a !== void 0 ? _a : 4;
60
+ for (let attempt = 1;; attempt++) {
61
+ await (0, rateLimiter_1.acquireSlot)(`${account.baseUrl}|tech`, account.requestsPerSecond, 1000);
62
+ let response;
63
+ try {
64
+ response = (await this.helpers.httpRequestWithAuthentication.call(this, exports.CREDENTIAL_NAME, requestOptions));
65
+ }
66
+ catch (error) {
67
+ if (attempt < maxAttempts) {
68
+ await (0, n8n_workflow_1.sleep)(backoffDelay(attempt, error));
69
+ continue;
70
+ }
71
+ throw (0, errors_1.toTechApiError)(this.getNode(), error, (0, httpError_1.extractStatusCode)(error));
72
+ }
73
+ const status = Number(response.statusCode);
74
+ assertNoRedirect.call(this, response, url);
75
+ const envelope = readEnvelope.call(this, response.body, url, status);
76
+ if (status === 429 || (method === 'GET' && RETRYABLE_READ_STATUSES.has(status))) {
77
+ if (attempt < maxAttempts) {
78
+ await (0, n8n_workflow_1.sleep)(backoffDelay(attempt, { response }));
79
+ continue;
80
+ }
81
+ }
82
+ if (envelope.status === false || status >= 400) {
83
+ throw (0, errors_1.toTechApiError)(this.getNode(), (0, errors_1.envelopeError)(this.getNode(), envelope), status);
84
+ }
85
+ return options.fullResponse === true ? envelope : envelope.data;
86
+ }
87
+ }
88
+ function assertNoRedirect(response, url) {
89
+ var _a, _b, _c;
90
+ const status = Number(response.statusCode);
91
+ if (!Number.isFinite(status) || status < 300 || status >= 400)
92
+ return;
93
+ const headers = ((_a = response.headers) !== null && _a !== void 0 ? _a : {});
94
+ const location = String((_c = (_b = headers.location) !== null && _b !== void 0 ? _b : headers.Location) !== null && _c !== void 0 ? _c : '').trim();
95
+ const host = location === '' ? '' : location.replace(/^https?:\/\//i, '').split('/')[0];
96
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The GetCourse account redirects API calls elsewhere', {
97
+ description: `${url} answered ${status}${host === '' ? '' : ` and pointed at ${host}`}. An account that ` +
98
+ 'force-redirects its GetCourse address to its own domain serves the API only on that domain. ' +
99
+ `Set the credential to Custom Domain${host === '' ? '' : ` and enter ${host}`}. The redirect ` +
100
+ 'was not followed: it would have sent the developer key to the other host.',
101
+ });
102
+ }
103
+ function readEnvelope(body, url, status) {
104
+ const isObject = body !== null && typeof body === 'object' && !Array.isArray(body);
105
+ if (isObject && 'status' in body)
106
+ return body;
107
+ if (isObject && 'success' in body) {
108
+ const flag = body.success;
109
+ const ok = flag === true || flag === 1 || String(flag).trim().toUpperCase() === 'OK';
110
+ return { status: ok, message: ok ? '' : String(flag), code: status, errors: [], data: [] };
111
+ }
112
+ const text = String(body !== null && body !== void 0 ? body : '').trim();
113
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GetCourse answered with something other than API data', {
114
+ description: `${url} answered ${status} with ${text === '' ? 'an empty body' : 'a body carrying neither a status nor a success field'}. ` +
115
+ 'Tech API responses carry one or the other, so this is not the API answering — the usual cause is an ' +
116
+ 'account that serves it on its own domain, or a proxy in front of n8n.',
117
+ });
118
+ }
119
+ async function techApiCachedRequest(endpoint, qs = {}) {
120
+ var _a, _b, _c;
121
+ const credentialId = (_c = (_b = (_a = this.getNode().credentials) === null || _a === void 0 ? void 0 : _a[exports.CREDENTIAL_NAME]) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : 'unbound';
122
+ const key = `tech|${credentialId}|${endpoint}|${JSON.stringify(qs)}`;
123
+ return await (0, cache_1.cached)(key, async () => await techApiRequest.call(this, 'GET', endpoint, undefined, qs));
124
+ }
125
+ async function techApiRequestAllItems(endpoint, qs = {}, options = {}) {
126
+ var _a, _b;
127
+ const pageSize = Math.max(1, (_a = options.pageSize) !== null && _a !== void 0 ? _a : 100);
128
+ const maxPages = (_b = options.maxPages) !== null && _b !== void 0 ? _b : 500;
129
+ const rows = [];
130
+ for (let page = 0;; page++) {
131
+ if (page >= maxPages) {
132
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `More than ${rows.length} rows to read`, {
133
+ description: `${endpoint} is still returning rows after ${maxPages} pages. Narrow the request, or ` +
134
+ 'turn Return All off and take a defined number — this node will not hand back a ' +
135
+ 'silently shortened list.',
136
+ });
137
+ }
138
+ const wanted = options.limit === undefined ? pageSize : Math.min(pageSize, options.limit - rows.length);
139
+ if (wanted <= 0)
140
+ break;
141
+ const batch = (await techApiRequest.call(this, 'GET', endpoint, undefined, {
142
+ ...qs,
143
+ limit: wanted,
144
+ offset: page * pageSize,
145
+ }));
146
+ if (!Array.isArray(batch) || batch.length === 0)
147
+ break;
148
+ rows.push(...batch);
149
+ if (batch.length < wanted)
150
+ break;
151
+ }
152
+ return options.limit === undefined ? rows : rows.slice(0, options.limit);
153
+ }
154
+ function compactQuery(input) {
155
+ const output = {};
156
+ for (const [key, value] of Object.entries(input !== null && input !== void 0 ? input : {})) {
157
+ if (value === undefined || value === null || value === '')
158
+ continue;
159
+ if (Array.isArray(value) && value.length === 0)
160
+ continue;
161
+ output[key] = value;
162
+ }
163
+ return output;
164
+ }
165
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/GetCourse/v1/transport/index.ts"],"names":[],"mappings":";;;AA+FA,wCAiFC;AAiDD,oCA+BC;AAQD,oDAaC;AASD,wDAyCC;AAGD,oCAUC;AA1UD,+CAAoE;AAEpE,2EAAwE;AACxE,mDAAiD;AACjD,2DAAqF;AACrF,+DAA4D;AAE5D,8CAAkE;AAUrD,QAAA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AAC;YAAE,MAAM;QACvD,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAEpB,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM;YAAE,MAAM;IAClC,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC;AAGD,SAAgB,YAAY,CAAC,KAAmB;IAC/C,MAAM,MAAM,GAAgB,EAAE,CAAC;IAE/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,EAAE,CAAC;QACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;YAAE,SAAS;QACpE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACzD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import { loadOptions } from './v1/methods';
3
+ export declare class GetCourseLegacy implements INodeType {
4
+ description: INodeTypeDescription;
5
+ methods: {
6
+ loadOptions: typeof loadOptions;
7
+ };
8
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
9
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetCourseLegacy = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const router_1 = require("../../utils/router");
6
+ const actions_1 = require("./v1/actions");
7
+ const methods_1 = require("./v1/methods");
8
+ class GetCourseLegacy {
9
+ constructor() {
10
+ this.description = {
11
+ displayName: 'GetCourse Legacy',
12
+ name: 'getCourseLegacy',
13
+ icon: {
14
+ light: 'file:../../icons/getcourse.svg',
15
+ dark: 'file:../../icons/getcourse.dark.svg',
16
+ },
17
+ group: ['transform'],
18
+ version: 1,
19
+ subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
20
+ description: 'Import users and orders into GetCourse, and export users, orders, payments and group members out of it, through the account Import/Export API',
21
+ defaults: { name: 'GetCourse Legacy' },
22
+ usableAsTool: true,
23
+ builderHint: {
24
+ searchHint: 'GetCourse has two separate APIs and this node is the older one — the account Import/Export API, keyed by the secret key under Профиль → Настройки аккаунта → АПИ. It is the only way to CREATE a user or an order, and the only way to read them in bulk; the GetCourse node covers the newer Tech API, which can read and update single objects but create nothing. Bulk reads are asynchronous: Export and Wait does the whole job in one node, while Start, Check Status and Get Result split it across a chain with an n8n Wait node in between. The account gets 100 export requests per two hours in total and every status check counts, so this is a nightly-report tool, not a polling trigger — for reacting to events, point a GetCourse process with the «Вызвать URL» operation at a GetCourse Trigger node.',
25
+ relatedNodes: [
26
+ {
27
+ nodeType: 'n8n-nodes-getcourse.getCourse',
28
+ relationHint: 'The newer Tech API: reads and updates one user, order, offer, dialog or webinar at a time',
29
+ },
30
+ {
31
+ nodeType: 'n8n-nodes-getcourse.getCourseTrigger',
32
+ relationHint: 'Starts the workflow when GetCourse reports an event',
33
+ },
34
+ ],
35
+ },
36
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
37
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
38
+ credentials: [{ name: 'getCourseApi', required: true }],
39
+ properties: [actions_1.resourceProperty, ...actions_1.resourceProperties],
40
+ };
41
+ this.methods = { loadOptions: methods_1.loadOptions };
42
+ }
43
+ async execute() {
44
+ return await router_1.routeItems.call(this, actions_1.resources);
45
+ }
46
+ }
47
+ exports.GetCourseLegacy = GetCourseLegacy;
48
+ //# sourceMappingURL=GetCourseLegacy.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetCourseLegacy.node.js","sourceRoot":"","sources":["../../../nodes/GetCourseLegacy/GetCourseLegacy.node.ts"],"names":[],"mappings":";;;AAMA,+CAAmD;AAEnD,+CAAgD;AAChD,0CAA+E;AAC/E,0CAA2C;AAE3C,MAAa,eAAe;IAA5B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE;gBACL,KAAK,EAAE,gCAAgC;gBACvC,IAAI,EAAE,qCAAqC;aAC3C;YACD,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,gEAAgE;YAC1E,WAAW,EACV,+IAA+I;YAChJ,QAAQ,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;YACtC,YAAY,EAAE,IAAI;YAKlB,WAAW,EAAE;gBACZ,UAAU,EACT,2xBAA2xB;gBAC5xB,YAAY,EAAE;oBACb;wBACC,QAAQ,EAAE,+BAA+B;wBACzC,YAAY,EACX,2FAA2F;qBAC5F;oBACD;wBACC,QAAQ,EAAE,sCAAsC;wBAChD,YAAY,EAAE,qDAAqD;qBACnE;iBACD;aACD;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACvD,UAAU,EAAE,CAAC,0BAAgB,EAAE,GAAG,4BAAkB,CAAC;SACrD,CAAC;QAEF,YAAO,GAAG,EAAE,WAAW,EAAX,qBAAW,EAAE,CAAC;IAK3B,CAAC;IAHA,KAAK,CAAC,OAAO;QACZ,OAAO,MAAM,mBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAS,CAAC,CAAC;IAC/C,CAAC;CACD;AA7CD,0CA6CC"}
@@ -0,0 +1,35 @@
1
+ {
2
+ "node": "n8n-nodes-getcourse.getCourseLegacy",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Sales", "Marketing & Content", "Data & Storage"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://github.com/zenland-dev/n8n-nodes-getcourse?tab=readme-ov-file#credentials"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://github.com/zenland-dev/n8n-nodes-getcourse?tab=readme-ov-file"
15
+ }
16
+ ]
17
+ },
18
+ "alias": [
19
+ "GetCourse",
20
+ "Геткурс",
21
+ "LMS",
22
+ "Export",
23
+ "Выгрузка",
24
+ "Import",
25
+ "Импорт",
26
+ "Order",
27
+ "Заказ",
28
+ "Deal",
29
+ "Payment",
30
+ "Платёж",
31
+ "Group",
32
+ "Группа",
33
+ "Course"
34
+ ]
35
+ }
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];