n8n-nodes-substack 0.6.0 → 0.7.1
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/Substack/Comment.fields.d.ts +2 -0
- package/dist/nodes/Substack/Comment.fields.js +50 -0
- package/dist/nodes/Substack/Comment.fields.js.map +1 -0
- package/dist/nodes/Substack/Comment.operations.d.ts +9 -0
- package/dist/nodes/Substack/Comment.operations.js +119 -0
- package/dist/nodes/Substack/Comment.operations.js.map +1 -0
- package/dist/nodes/Substack/Note.fields.d.ts +2 -0
- package/dist/nodes/Substack/Note.fields.js +96 -0
- package/dist/nodes/Substack/Note.fields.js.map +1 -0
- package/dist/nodes/Substack/Note.operations.d.ts +11 -0
- package/dist/nodes/Substack/Note.operations.js +244 -0
- package/dist/nodes/Substack/Note.operations.js.map +1 -0
- package/dist/nodes/Substack/Post.fields.d.ts +2 -0
- package/dist/nodes/Substack/Post.fields.js +96 -0
- package/dist/nodes/Substack/Post.fields.js.map +1 -0
- package/dist/nodes/Substack/Post.operations.d.ts +11 -0
- package/dist/nodes/Substack/Post.operations.js +248 -0
- package/dist/nodes/Substack/Post.operations.js.map +1 -0
- package/dist/nodes/Substack/Profile.fields.d.ts +2 -0
- package/dist/nodes/Substack/Profile.fields.js +75 -0
- package/dist/nodes/Substack/Profile.fields.js.map +1 -0
- package/dist/nodes/Substack/Profile.operations.d.ts +11 -0
- package/dist/nodes/Substack/Profile.operations.js +184 -0
- package/dist/nodes/Substack/Profile.operations.js.map +1 -0
- package/dist/nodes/Substack/Substack.node.d.ts +6 -0
- package/dist/nodes/Substack/Substack.node.js +46 -66
- package/dist/nodes/Substack/Substack.node.js.map +1 -1
- package/dist/nodes/Substack/Substack.node.json +22 -0
- package/dist/package.json +3 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/dist/nodes/Substack/CommentOperations.d.ts +0 -6
- package/dist/nodes/Substack/CommentOperations.js +0 -53
- package/dist/nodes/Substack/CommentOperations.js.map +0 -1
- package/dist/nodes/Substack/FollowOperations.d.ts +0 -6
- package/dist/nodes/Substack/FollowOperations.js +0 -57
- package/dist/nodes/Substack/FollowOperations.js.map +0 -1
- package/dist/nodes/Substack/NoteOperations.d.ts +0 -7
- package/dist/nodes/Substack/NoteOperations.js +0 -90
- package/dist/nodes/Substack/NoteOperations.js.map +0 -1
- package/dist/nodes/Substack/PostOperations.d.ts +0 -6
- package/dist/nodes/Substack/PostOperations.js +0 -57
- package/dist/nodes/Substack/PostOperations.js.map +0 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare enum SubstackResource {
|
|
3
|
+
Profile = "profile",
|
|
4
|
+
Post = "post",
|
|
5
|
+
Note = "note",
|
|
6
|
+
Comment = "comment"
|
|
7
|
+
}
|
|
2
8
|
export declare class Substack implements INodeType {
|
|
3
9
|
description: INodeTypeDescription;
|
|
4
10
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Substack = void 0;
|
|
3
|
+
exports.Substack = exports.SubstackResource = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
5
|
+
const Profile_fields_1 = require("./Profile.fields");
|
|
6
|
+
const Profile_operations_1 = require("./Profile.operations");
|
|
7
|
+
const Post_fields_1 = require("./Post.fields");
|
|
8
|
+
const Post_operations_1 = require("./Post.operations");
|
|
9
|
+
const Note_fields_1 = require("./Note.fields");
|
|
10
|
+
const Note_operations_1 = require("./Note.operations");
|
|
11
|
+
const Comment_fields_1 = require("./Comment.fields");
|
|
12
|
+
const Comment_operations_1 = require("./Comment.operations");
|
|
10
13
|
const SubstackUtils_1 = require("./SubstackUtils");
|
|
14
|
+
var SubstackResource;
|
|
15
|
+
(function (SubstackResource) {
|
|
16
|
+
SubstackResource["Profile"] = "profile";
|
|
17
|
+
SubstackResource["Post"] = "post";
|
|
18
|
+
SubstackResource["Note"] = "note";
|
|
19
|
+
SubstackResource["Comment"] = "comment";
|
|
20
|
+
})(SubstackResource || (exports.SubstackResource = SubstackResource = {}));
|
|
21
|
+
const resourceOperationHandlers = {
|
|
22
|
+
[SubstackResource.Profile]: Profile_operations_1.profileOperationHandlers,
|
|
23
|
+
[SubstackResource.Post]: Post_operations_1.postOperationHandlers,
|
|
24
|
+
[SubstackResource.Note]: Note_operations_1.noteOperationHandlers,
|
|
25
|
+
[SubstackResource.Comment]: Comment_operations_1.commentOperationHandlers,
|
|
26
|
+
};
|
|
11
27
|
class Substack {
|
|
12
28
|
constructor() {
|
|
13
29
|
this.description = {
|
|
@@ -36,39 +52,40 @@ class Substack {
|
|
|
36
52
|
displayName: 'Resource',
|
|
37
53
|
name: 'resource',
|
|
38
54
|
type: 'options',
|
|
55
|
+
default: 'profile',
|
|
39
56
|
noDataExpression: true,
|
|
40
57
|
options: [
|
|
41
58
|
{
|
|
42
59
|
name: 'Comment',
|
|
43
|
-
value:
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'Follow',
|
|
47
|
-
value: 'follow',
|
|
60
|
+
value: SubstackResource.Comment,
|
|
48
61
|
},
|
|
49
62
|
{
|
|
50
63
|
name: 'Note',
|
|
51
|
-
value:
|
|
64
|
+
value: SubstackResource.Note,
|
|
52
65
|
},
|
|
53
66
|
{
|
|
54
67
|
name: 'Post',
|
|
55
|
-
value:
|
|
68
|
+
value: SubstackResource.Post,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Profile',
|
|
72
|
+
value: SubstackResource.Profile,
|
|
56
73
|
},
|
|
57
74
|
],
|
|
58
|
-
default: 'note',
|
|
59
75
|
},
|
|
60
|
-
...
|
|
61
|
-
...
|
|
62
|
-
...
|
|
63
|
-
...
|
|
64
|
-
...
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
...
|
|
76
|
+
...Profile_operations_1.profileOperations,
|
|
77
|
+
...Profile_fields_1.profileFields,
|
|
78
|
+
...Post_operations_1.postOperations,
|
|
79
|
+
...Post_fields_1.postFields,
|
|
80
|
+
...Note_operations_1.noteOperations,
|
|
81
|
+
...Note_fields_1.noteFields,
|
|
82
|
+
...Comment_operations_1.commentOperations,
|
|
83
|
+
...Comment_fields_1.commentFields,
|
|
68
84
|
],
|
|
69
85
|
};
|
|
70
86
|
}
|
|
71
87
|
async execute() {
|
|
88
|
+
var _a;
|
|
72
89
|
const items = this.getInputData();
|
|
73
90
|
const returnData = [];
|
|
74
91
|
const { client, publicationAddress } = await SubstackUtils_1.SubstackUtils.initializeClient(this);
|
|
@@ -76,55 +93,18 @@ class Substack {
|
|
|
76
93
|
try {
|
|
77
94
|
const resource = this.getNodeParameter('resource', i);
|
|
78
95
|
const operation = this.getNodeParameter('operation', i);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
response = await PostOperations_1.PostOperations.getAll(this, client, publicationAddress, i);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
|
|
86
|
-
itemIndex: i,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else if (resource === 'note') {
|
|
91
|
-
if (operation === 'create') {
|
|
92
|
-
response = await NoteOperations_1.NoteOperations.create(this, client, publicationAddress, i);
|
|
93
|
-
}
|
|
94
|
-
else if (operation === 'get') {
|
|
95
|
-
response = await NoteOperations_1.NoteOperations.get(this, client, publicationAddress, i);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
|
|
99
|
-
itemIndex: i,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (resource === 'comment') {
|
|
104
|
-
if (operation === 'getAll') {
|
|
105
|
-
response = await CommentOperations_1.CommentOperations.getAll(this, client, publicationAddress, i);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
|
|
109
|
-
itemIndex: i,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else if (resource === 'follow') {
|
|
114
|
-
if (operation === 'getFollowing') {
|
|
115
|
-
response = await FollowOperations_1.FollowOperations.getFollowing(this, client, publicationAddress, i);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
|
|
96
|
+
const fallback = () => {
|
|
97
|
+
if (!resourceOperationHandlers[resource]) {
|
|
98
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`, {
|
|
119
99
|
itemIndex: i,
|
|
120
100
|
});
|
|
121
101
|
}
|
|
122
|
-
|
|
123
|
-
else {
|
|
124
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`, {
|
|
102
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation} for resource: ${resource}`, {
|
|
125
103
|
itemIndex: i,
|
|
126
104
|
});
|
|
127
|
-
}
|
|
105
|
+
};
|
|
106
|
+
const operationHandler = ((_a = resourceOperationHandlers[resource]) === null || _a === void 0 ? void 0 : _a[operation]) || fallback;
|
|
107
|
+
const response = await operationHandler(this, client, publicationAddress, i);
|
|
128
108
|
if (!response.success) {
|
|
129
109
|
if (this.continueOnFail()) {
|
|
130
110
|
returnData.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Substack.node.js","sourceRoot":"","sources":["../../../nodes/Substack/Substack.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,+
|
|
1
|
+
{"version":3,"file":"Substack.node.js","sourceRoot":"","sources":["../../../nodes/Substack/Substack.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,qDAAiD;AACjD,6DAAmF;AACnF,+CAA2C;AAC3C,uDAA0E;AAC1E,+CAA2C;AAC3C,uDAA0E;AAC1E,qDAAiD;AACjD,6DAAmF;AAEnF,mDAAgD;AAEhD,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,uCAAmB,CAAA;IACnB,iCAAa,CAAA;IACb,iCAAa,CAAA;IACb,uCAAmB,CAAA;AACpB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AASD,MAAM,yBAAyB,GAAwB;IACtD,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,6CAAwB;IACpD,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,uCAAqB;IAC9C,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,uCAAqB;IAC9C,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,6CAAwB;CACpD,CAAC;AAEF,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,cAAc,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC,CAAC,CAAC;YACZ,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;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CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBAEP,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,QAAQ,CAAC,IAAI;wBACnB,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAxID,4BAwIC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"displayName": "Substack",
|
|
3
|
+
"name": "substack",
|
|
4
|
+
"icon": "file:substack.svg",
|
|
5
|
+
"group": ["output"],
|
|
6
|
+
"defaultVersion": 1,
|
|
7
|
+
"version": [1],
|
|
8
|
+
"subtitle": "={{$parameter[\"operation\"] + \": \" + $parameter[\"resource\"]}}",
|
|
9
|
+
"description": "Interact with Substack API - Read-only operations for profiles, posts, notes, and comments",
|
|
10
|
+
"defaults": {
|
|
11
|
+
"name": "Substack"
|
|
12
|
+
},
|
|
13
|
+
"inputs": ["main"],
|
|
14
|
+
"outputs": ["main"],
|
|
15
|
+
"usableAsTool": true,
|
|
16
|
+
"credentials": [
|
|
17
|
+
{
|
|
18
|
+
"name": "substackApi",
|
|
19
|
+
"required": true
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-substack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "n8n community node for Substack API integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
@@ -28,9 +28,8 @@
|
|
|
28
28
|
"prepublishOnly": "npm run build && npx eslint -c eslint.prepublish.config.js nodes credentials package.json",
|
|
29
29
|
"test": "jest",
|
|
30
30
|
"test:watch": "jest --watch",
|
|
31
|
-
"test:
|
|
32
|
-
"test:
|
|
33
|
-
"test:all": "npm run test && npm run test:e2e"
|
|
31
|
+
"test:unit": "jest",
|
|
32
|
+
"test:unit:watch": "jest --watch"
|
|
34
33
|
},
|
|
35
34
|
"files": [
|
|
36
35
|
"dist"
|
|
@@ -51,8 +50,6 @@
|
|
|
51
50
|
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
|
52
51
|
"gulp": "^5.0.0",
|
|
53
52
|
"jest": "^30.0.3",
|
|
54
|
-
"msw": "^2.10.2",
|
|
55
|
-
"nock": "^14.0.5",
|
|
56
53
|
"prettier": "^3.5.3",
|
|
57
54
|
"ts-jest": "^29.2.5",
|
|
58
55
|
"typescript": "^5.8.2"
|