n8n-nodes-substack 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/nodes/Comment.fields.d.ts +2 -0
- package/dist/nodes/Comment.fields.js +50 -0
- package/dist/nodes/Comment.fields.js.map +1 -0
- package/dist/nodes/Comment.operations.d.ts +9 -0
- package/dist/nodes/Comment.operations.js +119 -0
- package/dist/nodes/Comment.operations.js.map +1 -0
- package/dist/nodes/Follow.fields.d.ts +2 -0
- package/dist/nodes/Follow.fields.js +50 -0
- package/dist/nodes/Follow.fields.js.map +1 -0
- package/dist/nodes/Follow.operations.d.ts +8 -0
- package/dist/nodes/Follow.operations.js +83 -0
- package/dist/nodes/Follow.operations.js.map +1 -0
- package/dist/nodes/Note.fields.d.ts +2 -0
- package/dist/nodes/Note.fields.js +110 -0
- package/dist/nodes/Note.fields.js.map +1 -0
- package/dist/nodes/Note.operations.d.ts +12 -0
- package/dist/nodes/Note.operations.js +282 -0
- package/dist/nodes/Note.operations.js.map +1 -0
- package/dist/nodes/Post.fields.d.ts +2 -0
- package/dist/nodes/Post.fields.js +96 -0
- package/dist/nodes/Post.fields.js.map +1 -0
- package/dist/nodes/Post.operations.d.ts +11 -0
- package/dist/nodes/Post.operations.js +236 -0
- package/dist/nodes/Post.operations.js.map +1 -0
- package/dist/nodes/Profile.fields.d.ts +2 -0
- package/dist/nodes/Profile.fields.js +75 -0
- package/dist/nodes/Profile.fields.js.map +1 -0
- package/dist/nodes/Profile.operations.d.ts +11 -0
- package/dist/nodes/Profile.operations.js +184 -0
- package/dist/nodes/Profile.operations.js.map +1 -0
- package/dist/nodes/Substack/PostOperations.js +0 -1
- package/dist/nodes/Substack/PostOperations.js.map +1 -1
- package/dist/nodes/Substack/Substack.node.d.ts +7 -0
- package/dist/nodes/Substack/Substack.node.js +53 -63
- package/dist/nodes/Substack/Substack.node.js.map +1 -1
- package/dist/nodes/Substack.node.json +22 -0
- package/dist/package.json +3 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noteOperationHandlers = exports.noteOperations = exports.NoteOperation = void 0;
|
|
4
|
+
const SubstackUtils_1 = require("./Substack/SubstackUtils");
|
|
5
|
+
var NoteOperation;
|
|
6
|
+
(function (NoteOperation) {
|
|
7
|
+
NoteOperation["Create"] = "create";
|
|
8
|
+
NoteOperation["Get"] = "get";
|
|
9
|
+
NoteOperation["GetNotesBySlug"] = "getNotesBySlug";
|
|
10
|
+
NoteOperation["GetNotesById"] = "getNotesById";
|
|
11
|
+
NoteOperation["GetNoteById"] = "getNoteById";
|
|
12
|
+
})(NoteOperation || (exports.NoteOperation = NoteOperation = {}));
|
|
13
|
+
exports.noteOperations = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Operation',
|
|
16
|
+
name: 'operation',
|
|
17
|
+
type: 'options',
|
|
18
|
+
default: 'create',
|
|
19
|
+
noDataExpression: true,
|
|
20
|
+
displayOptions: {
|
|
21
|
+
show: {
|
|
22
|
+
resource: ['note'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
name: 'Create Note',
|
|
28
|
+
value: NoteOperation.Create,
|
|
29
|
+
description: 'Create a new note',
|
|
30
|
+
action: 'Create note',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Get Notes',
|
|
34
|
+
value: NoteOperation.Get,
|
|
35
|
+
description: 'Get notes from own profile',
|
|
36
|
+
action: 'Get notes',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Get Notes From Profile by Slug',
|
|
40
|
+
value: NoteOperation.GetNotesBySlug,
|
|
41
|
+
description: 'Get notes from a profile by its publication slug',
|
|
42
|
+
action: 'Get notes by slug',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Get Notes From Profile by ID',
|
|
46
|
+
value: NoteOperation.GetNotesById,
|
|
47
|
+
description: 'Get notes from a profile by its user ID',
|
|
48
|
+
action: 'Get notes by ID',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Get Note by ID',
|
|
52
|
+
value: NoteOperation.GetNoteById,
|
|
53
|
+
description: 'Get a specific note by its ID',
|
|
54
|
+
action: 'Get note by ID',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
async function create(executeFunctions, client, publicationAddress, itemIndex) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
try {
|
|
62
|
+
const body = executeFunctions.getNodeParameter('body', itemIndex);
|
|
63
|
+
if (!body) {
|
|
64
|
+
throw new Error('Body is required');
|
|
65
|
+
}
|
|
66
|
+
const ownProfile = await client.ownProfile();
|
|
67
|
+
const response = await ownProfile.newNote(body).publish();
|
|
68
|
+
const formattedNote = {
|
|
69
|
+
noteId: ((_a = response.id) === null || _a === void 0 ? void 0 : _a.toString()) || 'unknown',
|
|
70
|
+
body: response.body || body,
|
|
71
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${response.id || 'unknown'}`),
|
|
72
|
+
date: response.date || new Date().toISOString(),
|
|
73
|
+
status: 'published',
|
|
74
|
+
userId: ((_b = response.user_id) === null || _b === void 0 ? void 0 : _b.toString()) || 'unknown',
|
|
75
|
+
likes: 0,
|
|
76
|
+
restacks: 0,
|
|
77
|
+
type: 'note',
|
|
78
|
+
entityKey: ((_c = response.id) === null || _c === void 0 ? void 0 : _c.toString()) || 'unknown',
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
success: true,
|
|
82
|
+
data: formattedNote,
|
|
83
|
+
metadata: {
|
|
84
|
+
date: response.date,
|
|
85
|
+
status: 'published',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
91
|
+
message: error.message,
|
|
92
|
+
node: executeFunctions.getNode(),
|
|
93
|
+
itemIndex,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function get(executeFunctions, client, publicationAddress, itemIndex) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
99
|
+
try {
|
|
100
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
101
|
+
let limit = 100;
|
|
102
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
103
|
+
limit = Number(limitParam);
|
|
104
|
+
}
|
|
105
|
+
const ownProfile = await client.ownProfile();
|
|
106
|
+
const notesIterable = await ownProfile.notes();
|
|
107
|
+
const formattedNotes = [];
|
|
108
|
+
let count = 0;
|
|
109
|
+
for await (const note of notesIterable) {
|
|
110
|
+
if (count >= limit)
|
|
111
|
+
break;
|
|
112
|
+
formattedNotes.push({
|
|
113
|
+
noteId: ((_c = (_b = (_a = note.rawData) === null || _a === void 0 ? void 0 : _a.comment) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = note.id) === null || _d === void 0 ? void 0 : _d.toString()) || 'unknown',
|
|
114
|
+
body: note.body || '',
|
|
115
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${((_f = (_e = note.rawData) === null || _e === void 0 ? void 0 : _e.comment) === null || _f === void 0 ? void 0 : _f.id) || note.id || 'unknown'}`),
|
|
116
|
+
date: ((_h = (_g = note.rawData) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.timestamp) || ((_j = note.publishedAt) === null || _j === void 0 ? void 0 : _j.toISOString()) || new Date().toISOString(),
|
|
117
|
+
status: 'published',
|
|
118
|
+
userId: ((_l = (_k = note.author) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.toString()) || 'unknown',
|
|
119
|
+
likes: note.likesCount || 0,
|
|
120
|
+
restacks: ((_o = (_m = note.rawData) === null || _m === void 0 ? void 0 : _m.comment) === null || _o === void 0 ? void 0 : _o.restacks) || 0,
|
|
121
|
+
type: 'note',
|
|
122
|
+
entityKey: ((_p = note.rawData) === null || _p === void 0 ? void 0 : _p.entity_key) || note.id,
|
|
123
|
+
});
|
|
124
|
+
count++;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
success: true,
|
|
128
|
+
data: formattedNotes,
|
|
129
|
+
metadata: {
|
|
130
|
+
status: 'success',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
136
|
+
message: error.message,
|
|
137
|
+
node: executeFunctions.getNode(),
|
|
138
|
+
itemIndex,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function getNotesBySlug(executeFunctions, client, publicationAddress, itemIndex) {
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
144
|
+
try {
|
|
145
|
+
const slug = executeFunctions.getNodeParameter('slug', itemIndex);
|
|
146
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
147
|
+
let limit = 100;
|
|
148
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
149
|
+
limit = Number(limitParam);
|
|
150
|
+
}
|
|
151
|
+
const profile = await client.profileForSlug(slug);
|
|
152
|
+
const notesIterable = await profile.notes();
|
|
153
|
+
const formattedNotes = [];
|
|
154
|
+
let count = 0;
|
|
155
|
+
for await (const note of notesIterable) {
|
|
156
|
+
if (count >= limit)
|
|
157
|
+
break;
|
|
158
|
+
try {
|
|
159
|
+
formattedNotes.push({
|
|
160
|
+
noteId: ((_c = (_b = (_a = note.rawData) === null || _a === void 0 ? void 0 : _a.comment) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = note.id) === null || _d === void 0 ? void 0 : _d.toString()) || 'unknown',
|
|
161
|
+
body: note.body || '',
|
|
162
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${((_f = (_e = note.rawData) === null || _e === void 0 ? void 0 : _e.comment) === null || _f === void 0 ? void 0 : _f.id) || note.id || 'unknown'}`),
|
|
163
|
+
date: ((_h = (_g = note.rawData) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.timestamp) || ((_j = note.publishedAt) === null || _j === void 0 ? void 0 : _j.toISOString()) || new Date().toISOString(),
|
|
164
|
+
status: 'published',
|
|
165
|
+
userId: ((_l = (_k = note.author) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.toString()) || 'unknown',
|
|
166
|
+
likes: note.likesCount || 0,
|
|
167
|
+
restacks: ((_o = (_m = note.rawData) === null || _m === void 0 ? void 0 : _m.comment) === null || _o === void 0 ? void 0 : _o.restacks) || 0,
|
|
168
|
+
type: 'note',
|
|
169
|
+
entityKey: ((_p = note.rawData) === null || _p === void 0 ? void 0 : _p.entity_key) || note.id,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
}
|
|
174
|
+
count++;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
success: true,
|
|
178
|
+
data: formattedNotes,
|
|
179
|
+
metadata: {
|
|
180
|
+
status: 'success',
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
186
|
+
message: error.message,
|
|
187
|
+
node: executeFunctions.getNode(),
|
|
188
|
+
itemIndex,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function getNotesById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
193
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
194
|
+
try {
|
|
195
|
+
const userId = executeFunctions.getNodeParameter('userId', itemIndex);
|
|
196
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
197
|
+
let limit = 100;
|
|
198
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
199
|
+
limit = Number(limitParam);
|
|
200
|
+
}
|
|
201
|
+
const profile = await client.profileForId(userId);
|
|
202
|
+
const notesIterable = await profile.notes();
|
|
203
|
+
const formattedNotes = [];
|
|
204
|
+
let count = 0;
|
|
205
|
+
for await (const note of notesIterable) {
|
|
206
|
+
if (count >= limit)
|
|
207
|
+
break;
|
|
208
|
+
try {
|
|
209
|
+
formattedNotes.push({
|
|
210
|
+
noteId: ((_c = (_b = (_a = note.rawData) === null || _a === void 0 ? void 0 : _a.comment) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = note.id) === null || _d === void 0 ? void 0 : _d.toString()) || 'unknown',
|
|
211
|
+
body: note.body || '',
|
|
212
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${((_f = (_e = note.rawData) === null || _e === void 0 ? void 0 : _e.comment) === null || _f === void 0 ? void 0 : _f.id) || note.id || 'unknown'}`),
|
|
213
|
+
date: ((_h = (_g = note.rawData) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.timestamp) || ((_j = note.publishedAt) === null || _j === void 0 ? void 0 : _j.toISOString()) || new Date().toISOString(),
|
|
214
|
+
status: 'published',
|
|
215
|
+
userId: ((_l = (_k = note.author) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.toString()) || 'unknown',
|
|
216
|
+
likes: note.likesCount || 0,
|
|
217
|
+
restacks: ((_o = (_m = note.rawData) === null || _m === void 0 ? void 0 : _m.comment) === null || _o === void 0 ? void 0 : _o.restacks) || 0,
|
|
218
|
+
type: 'note',
|
|
219
|
+
entityKey: ((_p = note.rawData) === null || _p === void 0 ? void 0 : _p.entity_key) || note.id,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
}
|
|
224
|
+
count++;
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
success: true,
|
|
228
|
+
data: formattedNotes,
|
|
229
|
+
metadata: {
|
|
230
|
+
status: 'success',
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
236
|
+
message: error.message,
|
|
237
|
+
node: executeFunctions.getNode(),
|
|
238
|
+
itemIndex,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async function getNoteById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
243
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
244
|
+
try {
|
|
245
|
+
const noteId = executeFunctions.getNodeParameter('noteId', itemIndex);
|
|
246
|
+
const note = await client.noteForId(noteId);
|
|
247
|
+
const formattedNote = {
|
|
248
|
+
noteId: ((_c = (_b = (_a = note.rawData) === null || _a === void 0 ? void 0 : _a.comment) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = note.id) === null || _d === void 0 ? void 0 : _d.toString()) || 'unknown',
|
|
249
|
+
body: note.body || '',
|
|
250
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${((_f = (_e = note.rawData) === null || _e === void 0 ? void 0 : _e.comment) === null || _f === void 0 ? void 0 : _f.id) || note.id || 'unknown'}`),
|
|
251
|
+
date: ((_h = (_g = note.rawData) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.timestamp) || ((_j = note.publishedAt) === null || _j === void 0 ? void 0 : _j.toISOString()) || new Date().toISOString(),
|
|
252
|
+
status: 'published',
|
|
253
|
+
userId: ((_l = (_k = note.author) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.toString()) || 'unknown',
|
|
254
|
+
likes: note.likesCount || 0,
|
|
255
|
+
restacks: ((_o = (_m = note.rawData) === null || _m === void 0 ? void 0 : _m.comment) === null || _o === void 0 ? void 0 : _o.restacks) || 0,
|
|
256
|
+
type: 'note',
|
|
257
|
+
entityKey: ((_p = note.rawData) === null || _p === void 0 ? void 0 : _p.entity_key) || note.id,
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
success: true,
|
|
261
|
+
data: formattedNote,
|
|
262
|
+
metadata: {
|
|
263
|
+
status: 'success',
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
269
|
+
message: error.message,
|
|
270
|
+
node: executeFunctions.getNode(),
|
|
271
|
+
itemIndex,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
exports.noteOperationHandlers = {
|
|
276
|
+
[NoteOperation.Create]: create,
|
|
277
|
+
[NoteOperation.Get]: get,
|
|
278
|
+
[NoteOperation.GetNotesBySlug]: getNotesBySlug,
|
|
279
|
+
[NoteOperation.GetNotesById]: getNotesById,
|
|
280
|
+
[NoteOperation.GetNoteById]: getNoteById,
|
|
281
|
+
};
|
|
282
|
+
//# sourceMappingURL=Note.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Note.operations.js","sourceRoot":"","sources":["../../nodes/Note.operations.ts"],"names":[],"mappings":";;;AAGA,4DAAyD;AAEzD,IAAY,aAMX;AAND,WAAY,aAAa;IACxB,kCAAiB,CAAA;IACjB,4BAAW,CAAA;IACX,kDAAiC,CAAA;IACjC,8CAA6B,CAAA;IAC7B,4CAA2B,CAAA;AA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AAI,CAAC,MAAM,0CAAE,EAAE,0CAAE,QAAQ,EAAE,KAAI,SAAS;YAChD,KAAK,EAAE,IAAI,CAAC,UAAU,IAAI,CAAC;YAC3B,QAAQ,EAAE,CAAA,MAAA,MAAC,IAAY,CAAC,OAAO,0CAAE,OAAO,0CAAE,QAAQ,KAAI,CAAC;YACvD,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,CAAA,MAAC,IAAY,CAAC,OAAO,0CAAE,UAAU,KAAI,IAAI,CAAC,EAAE;SACvD,CAAC;QAEF,OAAO;YACN,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE;gBACT,MAAM,EAAE,SAAS;aACjB;SACD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,6BAAa,CAAC,mBAAmB,CAAC;YACxC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE;YAChC,SAAS;SACT,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAEY,QAAA,qBAAqB,GAKC;IAClC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM;IAC9B,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG;IACxB,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc;IAC9C,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,YAAY;IAC1C,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,WAAW;CACxC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postFields = void 0;
|
|
4
|
+
exports.postFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Limit',
|
|
7
|
+
name: 'limit',
|
|
8
|
+
type: 'number',
|
|
9
|
+
default: 50,
|
|
10
|
+
description: 'Max number of results to return',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['post'],
|
|
14
|
+
operation: ['getAll'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
typeOptions: {
|
|
18
|
+
minValue: 1,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Slug',
|
|
23
|
+
name: 'slug',
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: '',
|
|
26
|
+
description: 'The publication slug (subdomain)',
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: {
|
|
29
|
+
resource: ['post'],
|
|
30
|
+
operation: ['getPostsBySlug'],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Limit',
|
|
37
|
+
name: 'limit',
|
|
38
|
+
type: 'number',
|
|
39
|
+
default: 50,
|
|
40
|
+
description: 'Max number of results to return',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: ['post'],
|
|
44
|
+
operation: ['getPostsBySlug'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
typeOptions: {
|
|
48
|
+
minValue: 1,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'User ID',
|
|
53
|
+
name: 'userId',
|
|
54
|
+
type: 'number',
|
|
55
|
+
default: 0,
|
|
56
|
+
description: 'The user ID to get posts for',
|
|
57
|
+
displayOptions: {
|
|
58
|
+
show: {
|
|
59
|
+
resource: ['post'],
|
|
60
|
+
operation: ['getPostsById'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Limit',
|
|
67
|
+
name: 'limit',
|
|
68
|
+
type: 'number',
|
|
69
|
+
default: 50,
|
|
70
|
+
description: 'Max number of results to return',
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['post'],
|
|
74
|
+
operation: ['getPostsById'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
typeOptions: {
|
|
78
|
+
minValue: 1,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Post ID',
|
|
83
|
+
name: 'postId',
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: '',
|
|
86
|
+
description: 'The ID of the post to retrieve',
|
|
87
|
+
displayOptions: {
|
|
88
|
+
show: {
|
|
89
|
+
resource: ['post'],
|
|
90
|
+
operation: ['getPostById'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
//# sourceMappingURL=Post.fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Post.fields.js","sourceRoot":"","sources":["../../nodes/Post.fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAsB;IAI5C;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,iCAAiC;QAC9C,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE;YACZ,QAAQ,EAAE,CAAC;SACX;KACD;IAID;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,kCAAkC;QAC/C,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,SAAS,EAAE,CAAC,gBAAgB,CAAC;aAC7B;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EA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
|
|
3
|
+
import { IStandardResponse } from './Substack/types';
|
|
4
|
+
export declare enum PostOperation {
|
|
5
|
+
GetAll = "getAll",
|
|
6
|
+
GetPostsBySlug = "getPostsBySlug",
|
|
7
|
+
GetPostsById = "getPostsById",
|
|
8
|
+
GetPostById = "getPostById"
|
|
9
|
+
}
|
|
10
|
+
export declare const postOperations: INodeProperties[];
|
|
11
|
+
export declare const postOperationHandlers: Record<PostOperation, (executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number) => Promise<IStandardResponse>>;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postOperationHandlers = exports.postOperations = exports.PostOperation = void 0;
|
|
4
|
+
const SubstackUtils_1 = require("./Substack/SubstackUtils");
|
|
5
|
+
var PostOperation;
|
|
6
|
+
(function (PostOperation) {
|
|
7
|
+
PostOperation["GetAll"] = "getAll";
|
|
8
|
+
PostOperation["GetPostsBySlug"] = "getPostsBySlug";
|
|
9
|
+
PostOperation["GetPostsById"] = "getPostsById";
|
|
10
|
+
PostOperation["GetPostById"] = "getPostById";
|
|
11
|
+
})(PostOperation || (exports.PostOperation = PostOperation = {}));
|
|
12
|
+
exports.postOperations = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Operation',
|
|
15
|
+
name: 'operation',
|
|
16
|
+
type: 'options',
|
|
17
|
+
default: 'getAll',
|
|
18
|
+
noDataExpression: true,
|
|
19
|
+
displayOptions: {
|
|
20
|
+
show: {
|
|
21
|
+
resource: ['post'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
name: 'Get All Posts',
|
|
27
|
+
value: PostOperation.GetAll,
|
|
28
|
+
description: 'Get all posts from own profile',
|
|
29
|
+
action: 'Get all posts',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get Posts From Profile by Slug',
|
|
33
|
+
value: PostOperation.GetPostsBySlug,
|
|
34
|
+
description: 'Get posts from a profile by its publication slug',
|
|
35
|
+
action: 'Get posts by slug',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Get Posts From Profile by ID',
|
|
39
|
+
value: PostOperation.GetPostsById,
|
|
40
|
+
description: 'Get posts from a profile by its user ID',
|
|
41
|
+
action: 'Get posts by ID',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Get Post by ID',
|
|
45
|
+
value: PostOperation.GetPostById,
|
|
46
|
+
description: 'Get a specific post by its ID',
|
|
47
|
+
action: 'Get post by ID',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
async function getAll(executeFunctions, client, publicationAddress, itemIndex) {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
54
|
+
try {
|
|
55
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
56
|
+
let limit = 100;
|
|
57
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
58
|
+
limit = Number(limitParam);
|
|
59
|
+
}
|
|
60
|
+
const ownProfile = await client.ownProfile();
|
|
61
|
+
const postsIterable = await ownProfile.posts();
|
|
62
|
+
const formattedPosts = [];
|
|
63
|
+
let count = 0;
|
|
64
|
+
for await (const post of postsIterable) {
|
|
65
|
+
if (count >= limit)
|
|
66
|
+
break;
|
|
67
|
+
try {
|
|
68
|
+
formattedPosts.push({
|
|
69
|
+
id: post.id,
|
|
70
|
+
title: post.title || '',
|
|
71
|
+
subtitle: ((_a = post.rawData) === null || _a === void 0 ? void 0 : _a.subtitle) || '',
|
|
72
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${post.id}`),
|
|
73
|
+
postDate: ((_b = post.rawData) === null || _b === void 0 ? void 0 : _b.post_date) || (post.publishedAt && !isNaN(post.publishedAt.getTime()) ? post.publishedAt.toISOString() : new Date().toISOString()),
|
|
74
|
+
type: ((_c = post.rawData) === null || _c === void 0 ? void 0 : _c.type) || 'newsletter',
|
|
75
|
+
published: (_e = (_d = post.rawData) === null || _d === void 0 ? void 0 : _d.published) !== null && _e !== void 0 ? _e : true,
|
|
76
|
+
paywalled: (_g = (_f = post.rawData) === null || _f === void 0 ? void 0 : _f.paywalled) !== null && _g !== void 0 ? _g : false,
|
|
77
|
+
description: ((_h = post.rawData) === null || _h === void 0 ? void 0 : _h.description) || post.body || '',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
}
|
|
82
|
+
count++;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
success: true,
|
|
86
|
+
data: formattedPosts,
|
|
87
|
+
metadata: {
|
|
88
|
+
status: 'success',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
94
|
+
message: error.message,
|
|
95
|
+
node: executeFunctions.getNode(),
|
|
96
|
+
itemIndex,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function getPostsBySlug(executeFunctions, client, publicationAddress, itemIndex) {
|
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
102
|
+
try {
|
|
103
|
+
const slug = executeFunctions.getNodeParameter('slug', itemIndex);
|
|
104
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
105
|
+
let limit = 100;
|
|
106
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
107
|
+
limit = Number(limitParam);
|
|
108
|
+
}
|
|
109
|
+
const profile = await client.profileForSlug(slug);
|
|
110
|
+
const postsIterable = await profile.posts();
|
|
111
|
+
const formattedPosts = [];
|
|
112
|
+
let count = 0;
|
|
113
|
+
for await (const post of postsIterable) {
|
|
114
|
+
if (count >= limit)
|
|
115
|
+
break;
|
|
116
|
+
try {
|
|
117
|
+
formattedPosts.push({
|
|
118
|
+
id: post.id,
|
|
119
|
+
title: post.title || '',
|
|
120
|
+
subtitle: ((_a = post.rawData) === null || _a === void 0 ? void 0 : _a.subtitle) || '',
|
|
121
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${post.id}`),
|
|
122
|
+
postDate: ((_b = post.rawData) === null || _b === void 0 ? void 0 : _b.post_date) || (post.publishedAt && !isNaN(post.publishedAt.getTime()) ? post.publishedAt.toISOString() : new Date().toISOString()),
|
|
123
|
+
type: ((_c = post.rawData) === null || _c === void 0 ? void 0 : _c.type) || 'newsletter',
|
|
124
|
+
published: (_e = (_d = post.rawData) === null || _d === void 0 ? void 0 : _d.published) !== null && _e !== void 0 ? _e : true,
|
|
125
|
+
paywalled: (_g = (_f = post.rawData) === null || _f === void 0 ? void 0 : _f.paywalled) !== null && _g !== void 0 ? _g : false,
|
|
126
|
+
description: ((_h = post.rawData) === null || _h === void 0 ? void 0 : _h.description) || post.body || '',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
}
|
|
131
|
+
count++;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
data: formattedPosts,
|
|
136
|
+
metadata: {
|
|
137
|
+
status: 'success',
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
143
|
+
message: error.message,
|
|
144
|
+
node: executeFunctions.getNode(),
|
|
145
|
+
itemIndex,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async function getPostsById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
150
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
151
|
+
try {
|
|
152
|
+
const userId = executeFunctions.getNodeParameter('userId', itemIndex);
|
|
153
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
154
|
+
let limit = 100;
|
|
155
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
156
|
+
limit = Number(limitParam);
|
|
157
|
+
}
|
|
158
|
+
const profile = await client.profileForId(userId);
|
|
159
|
+
const postsIterable = await profile.posts();
|
|
160
|
+
const formattedPosts = [];
|
|
161
|
+
let count = 0;
|
|
162
|
+
for await (const post of postsIterable) {
|
|
163
|
+
if (count >= limit)
|
|
164
|
+
break;
|
|
165
|
+
try {
|
|
166
|
+
formattedPosts.push({
|
|
167
|
+
id: post.id,
|
|
168
|
+
title: post.title || '',
|
|
169
|
+
subtitle: ((_a = post.rawData) === null || _a === void 0 ? void 0 : _a.subtitle) || '',
|
|
170
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${post.id}`),
|
|
171
|
+
postDate: ((_b = post.rawData) === null || _b === void 0 ? void 0 : _b.post_date) || (post.publishedAt && !isNaN(post.publishedAt.getTime()) ? post.publishedAt.toISOString() : new Date().toISOString()),
|
|
172
|
+
type: ((_c = post.rawData) === null || _c === void 0 ? void 0 : _c.type) || 'newsletter',
|
|
173
|
+
published: (_e = (_d = post.rawData) === null || _d === void 0 ? void 0 : _d.published) !== null && _e !== void 0 ? _e : true,
|
|
174
|
+
paywalled: (_g = (_f = post.rawData) === null || _f === void 0 ? void 0 : _f.paywalled) !== null && _g !== void 0 ? _g : false,
|
|
175
|
+
description: ((_h = post.rawData) === null || _h === void 0 ? void 0 : _h.description) || post.body || '',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
}
|
|
180
|
+
count++;
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
success: true,
|
|
184
|
+
data: formattedPosts,
|
|
185
|
+
metadata: {
|
|
186
|
+
status: 'success',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
192
|
+
message: error.message,
|
|
193
|
+
node: executeFunctions.getNode(),
|
|
194
|
+
itemIndex,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function getPostById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
199
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
200
|
+
try {
|
|
201
|
+
const postId = executeFunctions.getNodeParameter('postId', itemIndex);
|
|
202
|
+
const post = await client.postForId(postId);
|
|
203
|
+
const formattedPost = {
|
|
204
|
+
id: post.id,
|
|
205
|
+
title: post.title || '',
|
|
206
|
+
subtitle: ((_a = post.rawData) === null || _a === void 0 ? void 0 : _a.subtitle) || '',
|
|
207
|
+
url: SubstackUtils_1.SubstackUtils.formatUrl(publicationAddress, `/p/${post.id}`),
|
|
208
|
+
postDate: ((_b = post.rawData) === null || _b === void 0 ? void 0 : _b.post_date) || (post.publishedAt && !isNaN(post.publishedAt.getTime()) ? post.publishedAt.toISOString() : new Date().toISOString()),
|
|
209
|
+
type: ((_c = post.rawData) === null || _c === void 0 ? void 0 : _c.type) || 'newsletter',
|
|
210
|
+
published: (_e = (_d = post.rawData) === null || _d === void 0 ? void 0 : _d.published) !== null && _e !== void 0 ? _e : true,
|
|
211
|
+
paywalled: (_g = (_f = post.rawData) === null || _f === void 0 ? void 0 : _f.paywalled) !== null && _g !== void 0 ? _g : false,
|
|
212
|
+
description: ((_h = post.rawData) === null || _h === void 0 ? void 0 : _h.description) || post.body || '',
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
success: true,
|
|
216
|
+
data: formattedPost,
|
|
217
|
+
metadata: {
|
|
218
|
+
status: 'success',
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
224
|
+
message: error.message,
|
|
225
|
+
node: executeFunctions.getNode(),
|
|
226
|
+
itemIndex,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.postOperationHandlers = {
|
|
231
|
+
[PostOperation.GetAll]: getAll,
|
|
232
|
+
[PostOperation.GetPostsBySlug]: getPostsBySlug,
|
|
233
|
+
[PostOperation.GetPostsById]: getPostsById,
|
|
234
|
+
[PostOperation.GetPostById]: getPostById,
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=Post.operations.js.map
|