n8n-nodes-substack 0.5.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/NoteOperations.js +5 -5
- package/dist/nodes/Substack/NoteOperations.js.map +1 -1
- 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 +4 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ Or clone locally and open in VS Code with the Dev Containers extension.
|
|
|
113
113
|
|
|
114
114
|
**What's included:**
|
|
115
115
|
- โก Node.js LTS with all dependencies pre-installed
|
|
116
|
-
- ๐งช Complete testing environment (Jest, unit
|
|
116
|
+
- ๐งช Complete testing environment (Jest, unit tests)
|
|
117
117
|
- ๐ง Code quality tools (ESLint, Prettier, TypeScript)
|
|
118
118
|
- ๐ Pre-configured VS Code tasks and extensions
|
|
119
119
|
- ๐ Optional n8n CLI for integration testing
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commentFields = void 0;
|
|
4
|
+
exports.commentFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Post ID',
|
|
7
|
+
name: 'postId',
|
|
8
|
+
type: 'number',
|
|
9
|
+
default: 0,
|
|
10
|
+
description: 'The ID of the post to get comments for',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['comment'],
|
|
14
|
+
operation: ['getAll'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
name: 'limit',
|
|
22
|
+
type: 'number',
|
|
23
|
+
default: 50,
|
|
24
|
+
description: 'Max number of results to return',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
resource: ['comment'],
|
|
28
|
+
operation: ['getAll'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
typeOptions: {
|
|
32
|
+
minValue: 1,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Comment ID',
|
|
37
|
+
name: 'commentId',
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: '',
|
|
40
|
+
description: 'The ID of the comment to retrieve',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: ['comment'],
|
|
44
|
+
operation: ['getCommentById'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
//# sourceMappingURL=Comment.fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Comment.fields.js","sourceRoot":"","sources":["../../nodes/Comment.fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAsB;IAI/C;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,wCAAwC;QACrD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IACD;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,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE;YACZ,QAAQ,EAAE,CAAC;SACX;KACD;IAID;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,mCAAmC;QAChD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,gBAAgB,CAAC;aAC7B;SACD;QACD,QAAQ,EAAE,IAAI;KACd;CACD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { SubstackClient } from 'substack-api';
|
|
3
|
+
import { IStandardResponse } from './Substack/types';
|
|
4
|
+
export declare enum CommentOperation {
|
|
5
|
+
GetAll = "getAll",
|
|
6
|
+
GetCommentById = "getCommentById"
|
|
7
|
+
}
|
|
8
|
+
export declare const commentOperations: INodeProperties[];
|
|
9
|
+
export declare const commentOperationHandlers: Record<CommentOperation, (executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number) => Promise<IStandardResponse>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commentOperationHandlers = exports.commentOperations = exports.CommentOperation = void 0;
|
|
4
|
+
const SubstackUtils_1 = require("./Substack/SubstackUtils");
|
|
5
|
+
var CommentOperation;
|
|
6
|
+
(function (CommentOperation) {
|
|
7
|
+
CommentOperation["GetAll"] = "getAll";
|
|
8
|
+
CommentOperation["GetCommentById"] = "getCommentById";
|
|
9
|
+
})(CommentOperation || (exports.CommentOperation = CommentOperation = {}));
|
|
10
|
+
exports.commentOperations = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Operation',
|
|
13
|
+
name: 'operation',
|
|
14
|
+
type: 'options',
|
|
15
|
+
default: 'getAll',
|
|
16
|
+
noDataExpression: true,
|
|
17
|
+
displayOptions: {
|
|
18
|
+
show: {
|
|
19
|
+
resource: ['comment'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
name: 'Get All Comments',
|
|
25
|
+
value: CommentOperation.GetAll,
|
|
26
|
+
description: 'Get all comments for a specific post',
|
|
27
|
+
action: 'Get all comments',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Get Comment by ID',
|
|
31
|
+
value: CommentOperation.GetCommentById,
|
|
32
|
+
description: 'Get a specific comment by its ID',
|
|
33
|
+
action: 'Get comment by ID',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
async function getAll(executeFunctions, client, publicationAddress, itemIndex) {
|
|
39
|
+
var _a;
|
|
40
|
+
try {
|
|
41
|
+
const postId = executeFunctions.getNodeParameter('postId', itemIndex);
|
|
42
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
43
|
+
let limit = 100;
|
|
44
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
45
|
+
limit = Number(limitParam);
|
|
46
|
+
}
|
|
47
|
+
const post = await client.postForId(postId.toString());
|
|
48
|
+
const commentsIterable = await post.comments();
|
|
49
|
+
const formattedComments = [];
|
|
50
|
+
let count = 0;
|
|
51
|
+
for await (const comment of commentsIterable) {
|
|
52
|
+
if (count >= limit)
|
|
53
|
+
break;
|
|
54
|
+
formattedComments.push({
|
|
55
|
+
id: comment.id,
|
|
56
|
+
body: comment.body,
|
|
57
|
+
createdAt: ((_a = comment.rawData) === null || _a === void 0 ? void 0 : _a.created_at) || comment.createdAt.toISOString(),
|
|
58
|
+
parentPostId: postId,
|
|
59
|
+
author: {
|
|
60
|
+
id: comment.author.id,
|
|
61
|
+
name: comment.author.name,
|
|
62
|
+
isAdmin: comment.author.isAdmin || false,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
count++;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
data: formattedComments,
|
|
70
|
+
metadata: {
|
|
71
|
+
status: 'success',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
77
|
+
message: error.message,
|
|
78
|
+
node: executeFunctions.getNode(),
|
|
79
|
+
itemIndex,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function getCommentById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
try {
|
|
86
|
+
const commentId = executeFunctions.getNodeParameter('commentId', itemIndex);
|
|
87
|
+
const comment = await client.commentForId(commentId);
|
|
88
|
+
const formattedComment = {
|
|
89
|
+
id: comment.id,
|
|
90
|
+
body: comment.body,
|
|
91
|
+
createdAt: ((_a = comment.rawData) === null || _a === void 0 ? void 0 : _a.created_at) || comment.createdAt.toISOString(),
|
|
92
|
+
parentPostId: ((_b = comment.rawData) === null || _b === void 0 ? void 0 : _b.parent_post_id) || 0,
|
|
93
|
+
author: {
|
|
94
|
+
id: comment.author.id,
|
|
95
|
+
name: comment.author.name,
|
|
96
|
+
isAdmin: comment.author.isAdmin || false,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
data: formattedComment,
|
|
102
|
+
metadata: {
|
|
103
|
+
status: 'success',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
109
|
+
message: error.message,
|
|
110
|
+
node: executeFunctions.getNode(),
|
|
111
|
+
itemIndex,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.commentOperationHandlers = {
|
|
116
|
+
[CommentOperation.GetAll]: getAll,
|
|
117
|
+
[CommentOperation.GetCommentById]: getCommentById,
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=Comment.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Comment.operations.js","sourceRoot":"","sources":["../../nodes/Comment.operations.ts"],"names":[],"mappings":";;;AAGA,4DA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,SAAS,CAAW,CAAC;QAGtF,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAErD,MAAM,gBAAgB,GAAqB;YAC1C,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS,EAAE,CAAA,MAAC,OAAe,CAAC,OAAO,0CAAE,UAAU,KAAI,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE;YAClF,YAAY,EAAE,CAAA,MAAC,OAAe,CAAC,OAAO,0CAAE,cAAc,KAAI,CAAC;YAC3D,MAAM,EAAE;gBACP,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;gBACrB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;gBACzB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK;aACxC;SACD,CAAC;QAEF,OAAO;YACN,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,gBAAgB;YACtB,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,wBAAwB,GAKF;IAClC,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM;IACjC,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc;CACjD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.followFields = void 0;
|
|
4
|
+
const getFollowingOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Return Type',
|
|
7
|
+
name: 'returnType',
|
|
8
|
+
type: 'options',
|
|
9
|
+
options: [
|
|
10
|
+
{
|
|
11
|
+
name: 'Full Profiles',
|
|
12
|
+
value: 'profiles',
|
|
13
|
+
description: 'Return complete profile information',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'User IDs Only',
|
|
17
|
+
value: 'ids',
|
|
18
|
+
description: 'Return only user IDs',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
default: 'profiles',
|
|
22
|
+
description: 'Choose what information to return about the users you follow',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
resource: ['follow'],
|
|
26
|
+
operation: ['getFollowing'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Limit',
|
|
32
|
+
name: 'limit',
|
|
33
|
+
type: 'number',
|
|
34
|
+
default: 50,
|
|
35
|
+
description: 'Max number of results to return',
|
|
36
|
+
displayOptions: {
|
|
37
|
+
show: {
|
|
38
|
+
resource: ['follow'],
|
|
39
|
+
operation: ['getFollowing'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
typeOptions: {
|
|
43
|
+
minValue: 1,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
exports.followFields = [
|
|
48
|
+
...getFollowingOperation,
|
|
49
|
+
];
|
|
50
|
+
//# sourceMappingURL=Follow.fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Follow.fields.js","sourceRoot":"","sources":["../../nodes/Follow.fields.ts"],"names":[],"mappings":";;;AAGA,MAAM,qBAAqB,GAAsB;IAChD;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,qCAAqC;aAClD;YACD;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,sBAAsB;aACnC;SACD;QACD,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,8DAA8D;QAC3E,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACpB,SAAS,EAAE,CAAC,cAAc,CAAC;aAC3B;SACD;KACD;IACD;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,QAAQ,CAAC;gBACpB,SAAS,EAAE,CAAC,cAAc,CAAC;aAC3B;SACD;QACD,WAAW,EAAE;YACZ,QAAQ,EAAE,CAAC;SACX;KACD;CACD,CAAC;AAEW,QAAA,YAAY,GAAsB;IAI9C,GAAG,qBAAqB;CACxB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { SubstackClient } from 'substack-api';
|
|
3
|
+
import { IStandardResponse } from './Substack/types';
|
|
4
|
+
export declare enum FollowOperation {
|
|
5
|
+
GetFollowing = "getFollowing"
|
|
6
|
+
}
|
|
7
|
+
export declare const followOperations: INodeProperties[];
|
|
8
|
+
export declare const followOperationHandlers: Record<FollowOperation, (executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number) => Promise<IStandardResponse>>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.followOperationHandlers = exports.followOperations = exports.FollowOperation = void 0;
|
|
4
|
+
const SubstackUtils_1 = require("./Substack/SubstackUtils");
|
|
5
|
+
var FollowOperation;
|
|
6
|
+
(function (FollowOperation) {
|
|
7
|
+
FollowOperation["GetFollowing"] = "getFollowing";
|
|
8
|
+
})(FollowOperation || (exports.FollowOperation = FollowOperation = {}));
|
|
9
|
+
exports.followOperations = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Operation',
|
|
12
|
+
name: 'operation',
|
|
13
|
+
type: 'options',
|
|
14
|
+
default: 'getFollowing',
|
|
15
|
+
noDataExpression: true,
|
|
16
|
+
displayOptions: {
|
|
17
|
+
show: {
|
|
18
|
+
resource: ['follow'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Following',
|
|
24
|
+
value: FollowOperation.GetFollowing,
|
|
25
|
+
description: 'Get users that you follow',
|
|
26
|
+
action: 'Get following',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
async function getFollowing(executeFunctions, client, publicationAddress, itemIndex) {
|
|
32
|
+
try {
|
|
33
|
+
const returnType = executeFunctions.getNodeParameter('returnType', itemIndex, 'profiles');
|
|
34
|
+
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
35
|
+
let limit = 100;
|
|
36
|
+
if (limitParam !== '' && limitParam !== null && limitParam !== undefined) {
|
|
37
|
+
limit = Number(limitParam);
|
|
38
|
+
}
|
|
39
|
+
let followingData = [];
|
|
40
|
+
const ownProfile = await client.ownProfile();
|
|
41
|
+
const followeesIterable = await ownProfile.followees();
|
|
42
|
+
let count = 0;
|
|
43
|
+
for await (const followee of followeesIterable) {
|
|
44
|
+
if (count >= limit)
|
|
45
|
+
break;
|
|
46
|
+
if (returnType === 'ids') {
|
|
47
|
+
followingData.push({
|
|
48
|
+
id: followee.id,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
followingData.push({
|
|
53
|
+
id: followee.id,
|
|
54
|
+
name: followee.name,
|
|
55
|
+
handle: followee.slug,
|
|
56
|
+
bio: followee.bio,
|
|
57
|
+
subscriberCount: 0,
|
|
58
|
+
subscriberCountString: '',
|
|
59
|
+
primaryPublication: undefined,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
count++;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
data: followingData,
|
|
67
|
+
metadata: {
|
|
68
|
+
status: 'success',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
74
|
+
message: error.message,
|
|
75
|
+
node: executeFunctions.getNode(),
|
|
76
|
+
itemIndex,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.followOperationHandlers = {
|
|
81
|
+
[FollowOperation.GetFollowing]: getFollowing,
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=Follow.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Follow.operations.js","sourceRoot":"","sources":["../../nodes/Follow.operations.ts"],"names":[],"mappings":";;;AAGA,4DAAyD;AAEzD,IAAY,eAEX;AAFD,WAAY,eAAe;IAC1B,gDAA6B,CAAA;AAC9B,CAAC,EAFW,eAAe,+BAAf,eAAe,QAE1B;AAEY,QAAA,gBAAgB,GAAsB;IAClD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,cAAc;QACvB,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACpB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,eAAe,CAAC,YAAY;gBACnC,WAAW,EAAE,2BAA2B;gBACxC,MAAM,EAAE,eAAe;aACvB;SACD;KACD;CACD,CAAC;AAEF,KAAK,UAAU,YAAY,CAC1B,gB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ACT,CAAC;QAED,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,uBAAuB,GAKD;IAClC,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,YAAY;CAC5C,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noteFields = void 0;
|
|
4
|
+
exports.noteFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Body',
|
|
7
|
+
name: 'body',
|
|
8
|
+
type: 'string',
|
|
9
|
+
default: '',
|
|
10
|
+
description: 'The content of the note',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['note'],
|
|
14
|
+
operation: ['create'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
name: 'limit',
|
|
22
|
+
type: 'number',
|
|
23
|
+
default: 50,
|
|
24
|
+
description: 'Max number of results to return',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
resource: ['note'],
|
|
28
|
+
operation: ['get'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
typeOptions: {
|
|
32
|
+
minValue: 1,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Slug',
|
|
37
|
+
name: 'slug',
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: '',
|
|
40
|
+
description: 'The publication slug (subdomain)',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: ['note'],
|
|
44
|
+
operation: ['getNotesBySlug'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Limit',
|
|
51
|
+
name: 'limit',
|
|
52
|
+
type: 'number',
|
|
53
|
+
default: 50,
|
|
54
|
+
description: 'Max number of results to return',
|
|
55
|
+
displayOptions: {
|
|
56
|
+
show: {
|
|
57
|
+
resource: ['note'],
|
|
58
|
+
operation: ['getNotesBySlug'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
typeOptions: {
|
|
62
|
+
minValue: 1,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'User ID',
|
|
67
|
+
name: 'userId',
|
|
68
|
+
type: 'number',
|
|
69
|
+
default: 0,
|
|
70
|
+
description: 'The user ID to get notes for',
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['note'],
|
|
74
|
+
operation: ['getNotesById'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Limit',
|
|
81
|
+
name: 'limit',
|
|
82
|
+
type: 'number',
|
|
83
|
+
default: 50,
|
|
84
|
+
description: 'Max number of results to return',
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
resource: ['note'],
|
|
88
|
+
operation: ['getNotesById'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
typeOptions: {
|
|
92
|
+
minValue: 1,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: 'Note ID',
|
|
97
|
+
name: 'noteId',
|
|
98
|
+
type: 'string',
|
|
99
|
+
default: '',
|
|
100
|
+
description: 'The ID of the note to retrieve',
|
|
101
|
+
displayOptions: {
|
|
102
|
+
show: {
|
|
103
|
+
resource: ['note'],
|
|
104
|
+
operation: ['getNoteById'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
required: true,
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
//# sourceMappingURL=Note.fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Note.fields.js","sourceRoot":"","sources":["../../nodes/Note.fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAsB;IAI5C;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,yBAAyB;QACtC,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IAID;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,KAAK,CAAC;aAClB;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,WA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|
2
|
+
import { SubstackClient } from 'substack-api';
|
|
3
|
+
import { IStandardResponse } from './Substack/types';
|
|
4
|
+
export declare enum NoteOperation {
|
|
5
|
+
Create = "create",
|
|
6
|
+
Get = "get",
|
|
7
|
+
GetNotesBySlug = "getNotesBySlug",
|
|
8
|
+
GetNotesById = "getNotesById",
|
|
9
|
+
GetNoteById = "getNoteById"
|
|
10
|
+
}
|
|
11
|
+
export declare const noteOperations: INodeProperties[];
|
|
12
|
+
export declare const noteOperationHandlers: Record<NoteOperation, (executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number) => Promise<IStandardResponse>>;
|