n8n-nodes-substack 1.7.3 → 3.0.2
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 +33 -73
- package/dist/credentials/SubstackApi.credentials.js +1 -1
- package/dist/credentials/SubstackApi.credentials.js.map +1 -1
- package/dist/nodes/Substack/Comment.fields.js +14 -0
- package/dist/nodes/Substack/Comment.fields.js.map +1 -1
- package/dist/nodes/Substack/Comment.operations.d.ts +2 -1
- package/dist/nodes/Substack/Comment.operations.js +29 -2
- package/dist/nodes/Substack/Comment.operations.js.map +1 -1
- package/dist/nodes/Substack/MarkdownParser.d.ts +11 -0
- package/dist/nodes/Substack/MarkdownParser.js +228 -0
- package/dist/nodes/Substack/MarkdownParser.js.map +1 -0
- package/dist/nodes/Substack/Note.fields.js +57 -2
- package/dist/nodes/Substack/Note.fields.js.map +1 -1
- package/dist/nodes/Substack/Note.operations.d.ts +1 -0
- package/dist/nodes/Substack/Note.operations.js +107 -9
- package/dist/nodes/Substack/Note.operations.js.map +1 -1
- package/dist/nodes/Substack/Post.fields.js +30 -0
- package/dist/nodes/Substack/Post.fields.js.map +1 -1
- package/dist/nodes/Substack/Post.operations.d.ts +1 -0
- package/dist/nodes/Substack/Post.operations.js +32 -2
- package/dist/nodes/Substack/Post.operations.js.map +1 -1
- package/dist/nodes/Substack/Profile.fields.js +14 -0
- package/dist/nodes/Substack/Profile.fields.js.map +1 -1
- package/dist/nodes/Substack/Profile.operations.d.ts +1 -0
- package/dist/nodes/Substack/Profile.operations.js +30 -1
- package/dist/nodes/Substack/Profile.operations.js.map +1 -1
- package/dist/nodes/Substack/SubstackUtils.d.ts +8 -0
- package/dist/nodes/Substack/SubstackUtils.js +31 -1
- package/dist/nodes/Substack/SubstackUtils.js.map +1 -1
- package/dist/nodes/Substack/shared/DataFormatters.js +38 -20
- package/dist/nodes/Substack/shared/DataFormatters.js.map +1 -1
- package/dist/nodes/Substack/shared/ResourceOperations.d.ts +25 -0
- package/dist/nodes/Substack/shared/ResourceOperations.js +59 -0
- package/dist/nodes/Substack/shared/ResourceOperations.js.map +1 -0
- package/dist/nodes/Substack/types.d.ts +18 -3
- package/dist/package.json +9 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -1,100 +1,60 @@
|
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> This package is superseded by [n8n-nodes-substack-new](https://github.com/jakub-k-slys/n8n-nodes-substack-new),
|
|
3
|
+
> which connects to [Substack Gateway OSS](https://github.com/jakub-k-slys/substack-gateway-oss)
|
|
4
|
+
> and supports full read and write operations. This package remains
|
|
5
|
+
> available but is no longer actively developed.
|
|
6
|
+
|
|
1
7
|
# n8n-nodes-substack
|
|
2
8
|
|
|
3
9
|
[](https://badge.fury.io/js/n8n-nodes-substack)
|
|
4
10
|
[](https://opensource.org/licenses/MIT)
|
|
5
11
|
[](https://github.com/jakub-k-slys/n8n-nodes-substack/actions/workflows/test.yaml)
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
13
|
+
Read-only n8n community node for Substack. Enables content discovery and
|
|
14
|
+
analytics workflows against Substack publications.
|
|
10
15
|
|
|
11
16
|
## Features
|
|
12
17
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- **Secure Authentication**: API key authentication with publication address
|
|
18
|
-
- **Powered by substack-api**: Uses the robust [substack-api](https://www.npmjs.com/package/substack-api) library for reliable API interactions
|
|
19
|
-
|
|
20
|
-
## Quick Start
|
|
21
|
-
|
|
22
|
-
### Get Your Profile Information
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
{
|
|
26
|
-
"nodes": [
|
|
27
|
-
{
|
|
28
|
-
"name": "Get My Profile",
|
|
29
|
-
"type": "n8n-nodes-substack.substack",
|
|
30
|
-
"parameters": {
|
|
31
|
-
"resource": "profile",
|
|
32
|
-
"operation": "getOwnProfile"
|
|
33
|
-
},
|
|
34
|
-
"credentials": {
|
|
35
|
-
"substackApi": "your-credential-id"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Retrieve Recent Posts
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"nodes": [
|
|
47
|
-
{
|
|
48
|
-
"name": "Get Recent Posts",
|
|
49
|
-
"type": "n8n-nodes-substack.substack",
|
|
50
|
-
"parameters": {
|
|
51
|
-
"resource": "post",
|
|
52
|
-
"operation": "getAll",
|
|
53
|
-
"limit": 10
|
|
54
|
-
},
|
|
55
|
-
"credentials": {
|
|
56
|
-
"substackApi": "your-credential-id"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
```
|
|
18
|
+
- Profile operations: get profile information and publication data
|
|
19
|
+
- Post operations: retrieve posts with pagination
|
|
20
|
+
- Note operations: read and create notes
|
|
21
|
+
- Comment operations: get comments for posts
|
|
62
22
|
|
|
63
23
|
## Installation
|
|
64
24
|
|
|
65
|
-
### n8n Cloud
|
|
66
|
-
|
|
67
|
-
1. Go to **Settings** > **Community Nodes**
|
|
68
|
-
2. Click **Install a community node**
|
|
69
|
-
3. Enter `n8n-nodes-substack`
|
|
70
|
-
4. Click **Install**
|
|
71
|
-
|
|
72
25
|
### Self-hosted n8n
|
|
73
26
|
|
|
74
|
-
Install the node in your n8n installation directory:
|
|
75
|
-
|
|
76
27
|
```bash
|
|
77
28
|
npm install n8n-nodes-substack
|
|
78
29
|
```
|
|
79
30
|
|
|
80
|
-
|
|
31
|
+
Restart n8n after installation.
|
|
81
32
|
|
|
82
|
-
### Credentials
|
|
33
|
+
### Credentials
|
|
83
34
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- **API Key**: Your Substack API key
|
|
35
|
+
Add credentials with:
|
|
36
|
+
- **Publication Address**: your Substack domain (e.g. `myblog.substack.com`)
|
|
37
|
+
- **API Key**: your Substack API key
|
|
88
38
|
|
|
89
39
|
## Documentation
|
|
90
40
|
|
|
91
|
-
|
|
41
|
+
- [Resource Guides](docs/resources/)
|
|
42
|
+
- [Development Guide](docs/contributing.md)
|
|
43
|
+
- [Testing Guide](docs/testing.md)
|
|
44
|
+
- [Architecture](docs/design.md)
|
|
45
|
+
|
|
46
|
+
## Author
|
|
47
|
+
|
|
48
|
+
Built by [Jakub Slys](https://iam.slys.dev) — Backend Engineer building
|
|
49
|
+
distributed systems for telecoms, running a self-hosted Kubernetes homelab,
|
|
50
|
+
and building AI automation pipelines with n8n, MCP, and Claude.
|
|
51
|
+
|
|
52
|
+
I write about building this kind of tooling — n8n workflows, self-hosted AI
|
|
53
|
+
automation, and the engineering decisions behind them — at
|
|
54
|
+
[iam.slys.dev](https://iam.slys.dev).
|
|
92
55
|
|
|
93
|
-
|
|
94
|
-
- **[Development Guide](docs/contributing.md)** - Contributing to the project
|
|
95
|
-
- **[Testing Guide](docs/testing.md)** - Testing practices and procedures
|
|
96
|
-
- **[Architecture](docs/design.md)** - Design decisions and project structure
|
|
56
|
+
→ [iam.slys.dev](https://iam.slys.dev)
|
|
97
57
|
|
|
98
58
|
## License
|
|
99
59
|
|
|
100
|
-
|
|
60
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubstackApi.credentials.js","sourceRoot":"","sources":["../../credentials/SubstackApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,qCAAqC,CAAC;QACzD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,6BAA6B;gBAC1C,WAAW,EAAE,8EAA8E;gBAC3F,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,KAAK;aACnB;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"SubstackApi.credentials.js","sourceRoot":"","sources":["../../credentials/SubstackApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,qCAAqC,CAAC;QACzD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,6BAA6B;gBAC1C,WAAW,EAAE,8EAA8E;gBAC3F,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,KAAK;aACnB;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,WAAW,EAAE,0CAA0C;gBACvD,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAIF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,MAAM,EAAE,uCAAuC;iBAC/C;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,8CAA8C;gBACvD,GAAG,EAAE,sBAAsB;gBAC3B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACR,MAAM,EAAE,uCAAuC;iBAC/C;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAjDD,kCAiDC"}
|
|
@@ -32,5 +32,19 @@ exports.commentFields = [
|
|
|
32
32
|
minValue: 1,
|
|
33
33
|
},
|
|
34
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
|
+
},
|
|
35
49
|
];
|
|
36
50
|
//# sourceMappingURL=Comment.fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Comment.fields.js","sourceRoot":"","sources":["../../../nodes/Substack/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;CACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"Comment.fields.js","sourceRoot":"","sources":["../../../nodes/Substack/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"}
|
|
@@ -2,7 +2,8 @@ import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
|
2
2
|
import { SubstackClient } from 'substack-api';
|
|
3
3
|
import { IStandardResponse } from './types';
|
|
4
4
|
export declare enum CommentOperation {
|
|
5
|
-
GetAll = "getAll"
|
|
5
|
+
GetAll = "getAll",
|
|
6
|
+
GetCommentById = "getCommentById"
|
|
6
7
|
}
|
|
7
8
|
export declare const commentOperations: INodeProperties[];
|
|
8
9
|
export declare const commentOperationHandlers: Record<CommentOperation, (executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number) => Promise<IStandardResponse>>;
|
|
@@ -7,6 +7,7 @@ const SubstackUtils_1 = require("./SubstackUtils");
|
|
|
7
7
|
var CommentOperation;
|
|
8
8
|
(function (CommentOperation) {
|
|
9
9
|
CommentOperation["GetAll"] = "getAll";
|
|
10
|
+
CommentOperation["GetCommentById"] = "getCommentById";
|
|
10
11
|
})(CommentOperation || (exports.CommentOperation = CommentOperation = {}));
|
|
11
12
|
exports.commentOperations = [
|
|
12
13
|
{
|
|
@@ -27,6 +28,12 @@ exports.commentOperations = [
|
|
|
27
28
|
description: 'Get all comments for a specific post',
|
|
28
29
|
action: 'Get all comments',
|
|
29
30
|
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get Comment by ID',
|
|
33
|
+
value: CommentOperation.GetCommentById,
|
|
34
|
+
description: 'Get a specific comment by its ID',
|
|
35
|
+
action: 'Get comment by ID',
|
|
36
|
+
},
|
|
30
37
|
],
|
|
31
38
|
},
|
|
32
39
|
];
|
|
@@ -36,8 +43,8 @@ async function getAll(executeFunctions, client, publicationAddress, itemIndex) {
|
|
|
36
43
|
const limitParam = executeFunctions.getNodeParameter('limit', itemIndex, '');
|
|
37
44
|
const limit = OperationUtils_1.OperationUtils.parseLimit(limitParam);
|
|
38
45
|
const post = await client.postForId(postId);
|
|
39
|
-
const commentsIterable = post.comments();
|
|
40
|
-
const results = await OperationUtils_1.OperationUtils.executeAsyncIterable(commentsIterable, limit, (comment) => DataFormatters_1.DataFormatters.formatComment(comment, postId), publicationAddress);
|
|
46
|
+
const commentsIterable = await post.comments();
|
|
47
|
+
const results = await OperationUtils_1.OperationUtils.executeAsyncIterable(commentsIterable, limit, (comment, publicationAddress) => DataFormatters_1.DataFormatters.formatComment(comment, postId), publicationAddress);
|
|
41
48
|
return {
|
|
42
49
|
success: true,
|
|
43
50
|
data: results,
|
|
@@ -52,7 +59,27 @@ async function getAll(executeFunctions, client, publicationAddress, itemIndex) {
|
|
|
52
59
|
});
|
|
53
60
|
}
|
|
54
61
|
}
|
|
62
|
+
async function getCommentById(executeFunctions, client, publicationAddress, itemIndex) {
|
|
63
|
+
try {
|
|
64
|
+
const commentId = OperationUtils_1.OperationUtils.parseNumericParam(executeFunctions.getNodeParameter('commentId', itemIndex), 'commentId');
|
|
65
|
+
const comment = await client.commentForId(commentId);
|
|
66
|
+
const result = DataFormatters_1.DataFormatters.formatComment(comment);
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
data: result,
|
|
70
|
+
metadata: { status: 'success' },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return SubstackUtils_1.SubstackUtils.formatErrorResponse({
|
|
75
|
+
message: error.message,
|
|
76
|
+
node: executeFunctions.getNode(),
|
|
77
|
+
itemIndex,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
55
81
|
exports.commentOperationHandlers = {
|
|
56
82
|
[CommentOperation.GetAll]: getAll,
|
|
83
|
+
[CommentOperation.GetCommentById]: getCommentById,
|
|
57
84
|
};
|
|
58
85
|
//# sourceMappingURL=Comment.operations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Comment.operations.js","sourceRoot":"","sources":["../../../nodes/Substack/Comment.operations.ts"],"names":[],"mappings":";;;AAGA,4DAAyD;AACzD,4DAAyD;AACzD,mDAAgD;AAEhD,IAAY,
|
|
1
|
+
{"version":3,"file":"Comment.operations.js","sourceRoot":"","sources":["../../../nodes/Substack/Comment.operations.ts"],"names":[],"mappings":";;;AAGA,4DAAyD;AACzD,4DAAyD;AACzD,mDAAgD;AAEhD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,qCAAiB,CAAA;IACjB,qD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C,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc;CACjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OwnProfile } from 'substack-api';
|
|
2
|
+
export declare class MarkdownParser {
|
|
3
|
+
static parseMarkdownToNoteStructured(markdown: string, noteBuilder: ReturnType<OwnProfile['newNote']>): ReturnType<ReturnType<OwnProfile['newNote']>['paragraph']>;
|
|
4
|
+
static parseMarkdownToNote(markdown: string, noteBuilder: ReturnType<OwnProfile['newNote']>): ReturnType<ReturnType<OwnProfile['newNote']>['paragraph']>;
|
|
5
|
+
private static preprocessMarkdown;
|
|
6
|
+
private static processTokensStructured;
|
|
7
|
+
private static processHeadingStructured;
|
|
8
|
+
private static processParagraphStructured;
|
|
9
|
+
private static processListStructured;
|
|
10
|
+
private static processInlineTokensStructured;
|
|
11
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarkdownParser = void 0;
|
|
4
|
+
const marked_1 = require("marked");
|
|
5
|
+
marked_1.marked.setOptions({
|
|
6
|
+
gfm: true,
|
|
7
|
+
breaks: false,
|
|
8
|
+
});
|
|
9
|
+
function decodeHtmlEntities(text) {
|
|
10
|
+
const entityMap = {
|
|
11
|
+
''': "'",
|
|
12
|
+
'"': '"',
|
|
13
|
+
'&': '&',
|
|
14
|
+
'<': '<',
|
|
15
|
+
'>': '>',
|
|
16
|
+
' ': ' ',
|
|
17
|
+
};
|
|
18
|
+
return text.replace(/&#?\w+;/g, (entity) => entityMap[entity] || entity);
|
|
19
|
+
}
|
|
20
|
+
class MarkdownParser {
|
|
21
|
+
static parseMarkdownToNoteStructured(markdown, noteBuilder) {
|
|
22
|
+
if (!markdown.trim()) {
|
|
23
|
+
throw new Error('Note body cannot be empty - at least one paragraph with content is required');
|
|
24
|
+
}
|
|
25
|
+
const processedMarkdown = this.preprocessMarkdown(markdown);
|
|
26
|
+
const tokens = marked_1.marked.lexer(processedMarkdown);
|
|
27
|
+
const meaningfulTokens = tokens.filter((token) => token.type === 'paragraph' || token.type === 'heading' || token.type === 'list');
|
|
28
|
+
if (meaningfulTokens.length === 0) {
|
|
29
|
+
throw new Error('Note must contain at least one paragraph with actual content');
|
|
30
|
+
}
|
|
31
|
+
const contentTracker = { meaningfulNodesCreated: 0 };
|
|
32
|
+
let currentBuilder = null;
|
|
33
|
+
currentBuilder = this.processTokensStructured(tokens, noteBuilder, contentTracker);
|
|
34
|
+
if (contentTracker.meaningfulNodesCreated === 0) {
|
|
35
|
+
throw new Error('Note must contain at least one paragraph with actual content');
|
|
36
|
+
}
|
|
37
|
+
if (!currentBuilder) {
|
|
38
|
+
throw new Error('Failed to create note content');
|
|
39
|
+
}
|
|
40
|
+
return currentBuilder;
|
|
41
|
+
}
|
|
42
|
+
static parseMarkdownToNote(markdown, noteBuilder) {
|
|
43
|
+
return this.parseMarkdownToNoteStructured(markdown, noteBuilder);
|
|
44
|
+
}
|
|
45
|
+
static preprocessMarkdown(markdown) {
|
|
46
|
+
return markdown.replace(/\\n/g, '\n');
|
|
47
|
+
}
|
|
48
|
+
static processTokensStructured(tokens, noteBuilder, contentTracker) {
|
|
49
|
+
let currentBuilder = null;
|
|
50
|
+
for (const token of tokens) {
|
|
51
|
+
let newBuilder = null;
|
|
52
|
+
switch (token.type) {
|
|
53
|
+
case 'heading':
|
|
54
|
+
newBuilder = this.processHeadingStructured(token, noteBuilder, currentBuilder, contentTracker);
|
|
55
|
+
break;
|
|
56
|
+
case 'paragraph':
|
|
57
|
+
newBuilder = this.processParagraphStructured(token, noteBuilder, currentBuilder, contentTracker);
|
|
58
|
+
break;
|
|
59
|
+
case 'list':
|
|
60
|
+
newBuilder = this.processListStructured(token, noteBuilder, currentBuilder, contentTracker);
|
|
61
|
+
break;
|
|
62
|
+
case 'space':
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
if (token.text) {
|
|
66
|
+
const decodedText = decodeHtmlEntities(token.text);
|
|
67
|
+
if (currentBuilder) {
|
|
68
|
+
newBuilder = currentBuilder.paragraph().text(decodedText);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
newBuilder = noteBuilder.paragraph().text(decodedText);
|
|
72
|
+
}
|
|
73
|
+
contentTracker.meaningfulNodesCreated++;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (newBuilder) {
|
|
78
|
+
currentBuilder = newBuilder;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return currentBuilder;
|
|
82
|
+
}
|
|
83
|
+
static processHeadingStructured(token, noteBuilder, currentBuilder, contentTracker) {
|
|
84
|
+
const hasContent = (token.tokens && token.tokens.some((t) => t.text && t.text.trim())) ||
|
|
85
|
+
(token.text && token.text.trim());
|
|
86
|
+
if (!hasContent) {
|
|
87
|
+
return currentBuilder;
|
|
88
|
+
}
|
|
89
|
+
let paragraphBuilder = currentBuilder ? currentBuilder.paragraph() : noteBuilder.paragraph();
|
|
90
|
+
if (token.tokens && token.tokens.length > 0) {
|
|
91
|
+
paragraphBuilder = this.processInlineTokensStructured(token.tokens, paragraphBuilder, true);
|
|
92
|
+
}
|
|
93
|
+
else if (token.text) {
|
|
94
|
+
paragraphBuilder = paragraphBuilder.bold(decodeHtmlEntities(token.text));
|
|
95
|
+
}
|
|
96
|
+
contentTracker.meaningfulNodesCreated++;
|
|
97
|
+
return paragraphBuilder;
|
|
98
|
+
}
|
|
99
|
+
static processParagraphStructured(token, noteBuilder, currentBuilder, contentTracker) {
|
|
100
|
+
const hasContent = (token.tokens && token.tokens.some((t) => t.text && t.text.trim())) ||
|
|
101
|
+
(token.text && token.text.trim());
|
|
102
|
+
if (!hasContent) {
|
|
103
|
+
return currentBuilder;
|
|
104
|
+
}
|
|
105
|
+
const text = token.text ? token.text.trim() : '';
|
|
106
|
+
const normalizedText = text.replace(/\s+/g, ' ').trim();
|
|
107
|
+
const isOnlyListMarkers = /^([-*+]|(\d+\.))+(\s*([-*+]|(\d+\.)))*$/.test(normalizedText);
|
|
108
|
+
const isEmptyListMarkers = normalizedText === '- * 1.' || /^[-*+\d.\s]+$/.test(normalizedText);
|
|
109
|
+
if (isOnlyListMarkers || isEmptyListMarkers) {
|
|
110
|
+
return currentBuilder;
|
|
111
|
+
}
|
|
112
|
+
let paragraphBuilder = currentBuilder ? currentBuilder.paragraph() : noteBuilder.paragraph();
|
|
113
|
+
if (token.tokens && token.tokens.length > 0) {
|
|
114
|
+
paragraphBuilder = this.processInlineTokensStructured(token.tokens, paragraphBuilder);
|
|
115
|
+
}
|
|
116
|
+
else if (token.text) {
|
|
117
|
+
paragraphBuilder = paragraphBuilder.text(decodeHtmlEntities(token.text));
|
|
118
|
+
}
|
|
119
|
+
contentTracker.meaningfulNodesCreated++;
|
|
120
|
+
return paragraphBuilder;
|
|
121
|
+
}
|
|
122
|
+
static processListStructured(token, noteBuilder, currentBuilder, contentTracker) {
|
|
123
|
+
if (!token.items)
|
|
124
|
+
return currentBuilder;
|
|
125
|
+
let finalBuilder = currentBuilder;
|
|
126
|
+
let listItemNumber = 1;
|
|
127
|
+
token.items.forEach((item, index) => {
|
|
128
|
+
const hasContent = (item.tokens && item.tokens.some((t) => t.text && t.text.trim())) ||
|
|
129
|
+
(item.text && item.text.trim());
|
|
130
|
+
if (!hasContent) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
let actualContent = '';
|
|
134
|
+
if (item.tokens && item.tokens.length > 0) {
|
|
135
|
+
const firstToken = item.tokens[0];
|
|
136
|
+
if (firstToken && firstToken.tokens) {
|
|
137
|
+
const meaningfulInlineTokens = firstToken.tokens.filter((t) => t.text && t.text.trim());
|
|
138
|
+
if (meaningfulInlineTokens.length > 0) {
|
|
139
|
+
actualContent = meaningfulInlineTokens.map((t) => t.text.trim()).join('');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (firstToken && firstToken.text && firstToken.text.trim()) {
|
|
143
|
+
actualContent = firstToken.text.trim();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else if (item.text && item.text.trim()) {
|
|
147
|
+
actualContent = item.text.trim();
|
|
148
|
+
}
|
|
149
|
+
if (!actualContent) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let paragraphBuilder = finalBuilder ? finalBuilder.paragraph() : noteBuilder.paragraph();
|
|
153
|
+
if (token.ordered) {
|
|
154
|
+
paragraphBuilder = paragraphBuilder.text(`${listItemNumber}. `);
|
|
155
|
+
listItemNumber++;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
paragraphBuilder = paragraphBuilder.text('• ');
|
|
159
|
+
}
|
|
160
|
+
if (item.tokens && item.tokens.length > 0) {
|
|
161
|
+
const firstToken = item.tokens[0];
|
|
162
|
+
if (firstToken && firstToken.tokens) {
|
|
163
|
+
paragraphBuilder = this.processInlineTokensStructured(firstToken.tokens, paragraphBuilder);
|
|
164
|
+
}
|
|
165
|
+
else if (firstToken && firstToken.text) {
|
|
166
|
+
paragraphBuilder = paragraphBuilder.text(decodeHtmlEntities(firstToken.text));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (item.text) {
|
|
170
|
+
paragraphBuilder = paragraphBuilder.text(decodeHtmlEntities(item.text));
|
|
171
|
+
}
|
|
172
|
+
contentTracker.meaningfulNodesCreated++;
|
|
173
|
+
finalBuilder = paragraphBuilder;
|
|
174
|
+
});
|
|
175
|
+
return finalBuilder;
|
|
176
|
+
}
|
|
177
|
+
static processInlineTokensStructured(tokens, paragraphBuilder, isHeading = false) {
|
|
178
|
+
let currentBuilder = paragraphBuilder;
|
|
179
|
+
for (const token of tokens) {
|
|
180
|
+
if (!token.text || !token.text.trim()) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
switch (token.type) {
|
|
184
|
+
case 'text':
|
|
185
|
+
const decodedText = decodeHtmlEntities(token.text);
|
|
186
|
+
if (isHeading) {
|
|
187
|
+
currentBuilder = currentBuilder.bold(decodedText);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
currentBuilder = currentBuilder.text(decodedText);
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
case 'strong':
|
|
194
|
+
currentBuilder = currentBuilder.bold(decodeHtmlEntities(token.text));
|
|
195
|
+
break;
|
|
196
|
+
case 'em':
|
|
197
|
+
currentBuilder = currentBuilder.italic(decodeHtmlEntities(token.text));
|
|
198
|
+
break;
|
|
199
|
+
case 'codespan':
|
|
200
|
+
currentBuilder = currentBuilder.code(decodeHtmlEntities(token.text));
|
|
201
|
+
break;
|
|
202
|
+
case 'link':
|
|
203
|
+
if (token.text) {
|
|
204
|
+
const decodedLinkText = decodeHtmlEntities(token.text);
|
|
205
|
+
currentBuilder = currentBuilder.text(`${decodedLinkText} (${token.href})`);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
currentBuilder = currentBuilder.text(token.href);
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
default:
|
|
212
|
+
if (token.text) {
|
|
213
|
+
const decodedFallbackText = decodeHtmlEntities(token.text);
|
|
214
|
+
if (isHeading) {
|
|
215
|
+
currentBuilder = currentBuilder.bold(decodedFallbackText);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
currentBuilder = currentBuilder.text(decodedFallbackText);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return currentBuilder;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.MarkdownParser = MarkdownParser;
|
|
228
|
+
//# sourceMappingURL=MarkdownParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownParser.js","sourceRoot":"","sources":["../../../nodes/Substack/MarkdownParser.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAIhC,eAAM,CAAC,UAAU,CAAC;IACjB,GAAG,EAAE,IAAI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wBAC3D,CAAC;oBACF,CAAC;oBACD,MAAM;YACR,CAAC;QACF,CAAC;QAED,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AAvWD,wCAuWC"}
|
|
@@ -7,7 +7,7 @@ exports.noteFields = [
|
|
|
7
7
|
name: 'body',
|
|
8
8
|
type: 'string',
|
|
9
9
|
default: '',
|
|
10
|
-
description: 'The content of the note.
|
|
10
|
+
description: 'The content of the note. Must contain at least one paragraph with actual content. Markdown formatting is supported in Advanced mode.',
|
|
11
11
|
displayOptions: {
|
|
12
12
|
show: {
|
|
13
13
|
resource: ['note'],
|
|
@@ -18,7 +18,32 @@ exports.noteFields = [
|
|
|
18
18
|
typeOptions: {
|
|
19
19
|
rows: 4,
|
|
20
20
|
},
|
|
21
|
-
placeholder: 'Write your note content here... (
|
|
21
|
+
placeholder: 'Write your note content here... (Advanced mode supports Markdown: **bold**, *italic*, # headings, [links](url), - lists)',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Content Type',
|
|
25
|
+
name: 'contentType',
|
|
26
|
+
type: 'options',
|
|
27
|
+
default: 'simple',
|
|
28
|
+
description: 'Choose how to format the content',
|
|
29
|
+
displayOptions: {
|
|
30
|
+
show: {
|
|
31
|
+
resource: ['note'],
|
|
32
|
+
operation: ['create'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Simple Text',
|
|
38
|
+
value: 'simple',
|
|
39
|
+
description: 'Plain text content with structured validation',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Advanced (Markdown)',
|
|
43
|
+
value: 'advanced',
|
|
44
|
+
description: 'Supports Markdown formatting: **bold**, *italic*, # headings, - lists, [links](URL). Builder prevents invalid notes.',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
22
47
|
},
|
|
23
48
|
{
|
|
24
49
|
displayName: 'Visibility',
|
|
@@ -132,6 +157,36 @@ exports.noteFields = [
|
|
|
132
157
|
minValue: 1,
|
|
133
158
|
},
|
|
134
159
|
},
|
|
160
|
+
{
|
|
161
|
+
displayName: 'User ID',
|
|
162
|
+
name: 'userId',
|
|
163
|
+
type: 'number',
|
|
164
|
+
default: 0,
|
|
165
|
+
description: 'The user ID to get notes for',
|
|
166
|
+
displayOptions: {
|
|
167
|
+
show: {
|
|
168
|
+
resource: ['note'],
|
|
169
|
+
operation: ['getNotesById'],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
required: true,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
displayName: 'Limit',
|
|
176
|
+
name: 'limit',
|
|
177
|
+
type: 'number',
|
|
178
|
+
default: 50,
|
|
179
|
+
description: 'Max number of results to return',
|
|
180
|
+
displayOptions: {
|
|
181
|
+
show: {
|
|
182
|
+
resource: ['note'],
|
|
183
|
+
operation: ['getNotesById'],
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
typeOptions: {
|
|
187
|
+
minValue: 1,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
135
190
|
{
|
|
136
191
|
displayName: 'Note ID',
|
|
137
192
|
name: 'noteId',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Note.fields.js","sourceRoot":"","sources":["../../../nodes/Substack/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,
|
|
1
|
+
{"version":3,"file":"Note.fields.js","sourceRoot":"","sources":["../../../nodes/Substack/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,EACV,sIAAsI;QACvI,cAAc,EAAE;YACf,IAAI,EA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