n8n-nodes-docx-track-changes 0.1.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/LICENSE +21 -0
- package/README.ja.md +252 -0
- package/README.md +252 -0
- package/dist/nodes/DocxRevisions/DocxRevisions.node.d.ts +5 -0
- package/dist/nodes/DocxRevisions/DocxRevisions.node.js +151 -0
- package/dist/nodes/DocxRevisions/DocxRevisions.node.js.map +1 -0
- package/dist/nodes/DocxRevisions/DocxRevisions.node.json +13 -0
- package/dist/nodes/DocxRevisions/docxRevisions.svg +9 -0
- package/dist/nodes/DocxRevisions/operations/extractComments.d.ts +2 -0
- package/dist/nodes/DocxRevisions/operations/extractComments.js +39 -0
- package/dist/nodes/DocxRevisions/operations/extractComments.js.map +1 -0
- package/dist/nodes/DocxRevisions/operations/extractRevisions.d.ts +2 -0
- package/dist/nodes/DocxRevisions/operations/extractRevisions.js +43 -0
- package/dist/nodes/DocxRevisions/operations/extractRevisions.js.map +1 -0
- package/dist/nodes/DocxRevisions/utils/commentParser.d.ts +28 -0
- package/dist/nodes/DocxRevisions/utils/commentParser.js +208 -0
- package/dist/nodes/DocxRevisions/utils/commentParser.js.map +1 -0
- package/dist/nodes/DocxRevisions/utils/docxParser.d.ts +10 -0
- package/dist/nodes/DocxRevisions/utils/docxParser.js +50 -0
- package/dist/nodes/DocxRevisions/utils/docxParser.js.map +1 -0
- package/dist/nodes/DocxRevisions/utils/revisionParser.d.ts +23 -0
- package/dist/nodes/DocxRevisions/utils/revisionParser.js +217 -0
- package/dist/nodes/DocxRevisions/utils/revisionParser.js.map +1 -0
- package/dist/package.json +52 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ryoooo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# n8n-nodes-docx-track-changes
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Microsoft Word (.docx) ドキュメントから**変更履歴(リビジョン)**と**コメント**を抽出するn8nコミュニティノードです。
|
|
8
|
+
|
|
9
|
+
ドキュメントレビューワークフロー、契約管理、承認プロセスの自動化に最適です。
|
|
10
|
+
|
|
11
|
+
[n8n](https://n8n.io/) は [fair-code ライセンス](https://docs.n8n.io/reference/license/) のワークフロー自動化プラットフォームです。
|
|
12
|
+
|
|
13
|
+
## 機能
|
|
14
|
+
|
|
15
|
+
- **変更履歴の抽出** - 追加・削除の変更を作成者とタイムスタンプ付きで取得
|
|
16
|
+
- **コメントの抽出** - 返信、解決状態、対象テキスト付きでコメントを取得
|
|
17
|
+
- **コンテキスト対応** - 各変更の前後テキストを含める
|
|
18
|
+
- **サマリー統計** - タイプ別、作成者別、状態別のカウントを取得
|
|
19
|
+
- **AIエージェント対応** - AIワークフローでツールとして使用可能(`usableAsTool: true`)
|
|
20
|
+
|
|
21
|
+
## 互換性
|
|
22
|
+
|
|
23
|
+
| 要件 | バージョン |
|
|
24
|
+
|------|-----------|
|
|
25
|
+
| n8n | 1.0.0+ (2.2.0でテスト済み) |
|
|
26
|
+
| Node.js | 18.17.0+ |
|
|
27
|
+
|
|
28
|
+
> **注意:** このノードは外部依存関係(`jszip`、`fast-xml-parser`)を使用しており、**セルフホスト版n8n**向けに設計されています。n8n Cloudでは[認証済みコミュニティノード](https://docs.n8n.io/integrations/community-nodes/installation/verified-install/)のみサポートされます。
|
|
29
|
+
|
|
30
|
+
## インストール
|
|
31
|
+
|
|
32
|
+
### オプション1: GUIインストール(推奨)
|
|
33
|
+
|
|
34
|
+
セルフホスト版n8nへの最も簡単なインストール方法:
|
|
35
|
+
|
|
36
|
+
1. **Settings** > **Community Nodes** に移動
|
|
37
|
+
2. **Install** を選択
|
|
38
|
+
3. `n8n-nodes-docx-track-changes` を入力
|
|
39
|
+
4. 「I understand the risks of installing unverified code from a public source」にチェック
|
|
40
|
+
5. **Install** を選択
|
|
41
|
+
|
|
42
|
+
> **Owner** と **Admin** ユーザーのみがコミュニティノードをインストールできます。
|
|
43
|
+
|
|
44
|
+
### オプション2: 手動インストール(npm)
|
|
45
|
+
|
|
46
|
+
キューモードで動作しているn8nインスタンスやプライベートパッケージのインストール時:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# n8nコンテナにアクセス
|
|
50
|
+
docker exec -it n8n sh
|
|
51
|
+
|
|
52
|
+
# nodesディレクトリを作成してインストール
|
|
53
|
+
mkdir -p ~/.n8n/nodes
|
|
54
|
+
cd ~/.n8n/nodes
|
|
55
|
+
npm install n8n-nodes-docx-track-changes
|
|
56
|
+
|
|
57
|
+
# n8nを再起動してノードを読み込み
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### オプション3: Docker(Dockerfile)
|
|
61
|
+
|
|
62
|
+
Docker環境での永続的なインストールには、カスタムDockerfileを作成:
|
|
63
|
+
|
|
64
|
+
```dockerfile
|
|
65
|
+
FROM n8nio/n8n:latest
|
|
66
|
+
|
|
67
|
+
USER root
|
|
68
|
+
RUN cd /usr/local/lib/node_modules/n8n && \
|
|
69
|
+
npm install n8n-nodes-docx-track-changes
|
|
70
|
+
USER node
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`docker-compose.yml` を更新:
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
services:
|
|
77
|
+
n8n:
|
|
78
|
+
build:
|
|
79
|
+
context: .
|
|
80
|
+
dockerfile: Dockerfile
|
|
81
|
+
# ... 残りの設定
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
リビルドして再起動:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
docker compose down
|
|
88
|
+
docker compose up -d --build
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### AIエージェントツールとしての使用を有効化
|
|
92
|
+
|
|
93
|
+
このノードをAIエージェントツールとして使用するには、環境変数を設定:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## オペレーション
|
|
100
|
+
|
|
101
|
+
### 変更履歴の抽出(Extract Revisions)
|
|
102
|
+
|
|
103
|
+
DOCXファイルから変更履歴(追加・削除)を抽出します。
|
|
104
|
+
|
|
105
|
+
| パラメータ | 型 | デフォルト | 説明 |
|
|
106
|
+
|-----------|-----|-----------|------|
|
|
107
|
+
| Input Binary Field | string | `data` | DOCXファイルを含むバイナリプロパティ |
|
|
108
|
+
| Include Context | boolean | `false` | 各変更の前後テキストを含める |
|
|
109
|
+
| Context Length | number | `50` | 前後に含める文字数 |
|
|
110
|
+
| Include Summary | boolean | `true` | 変更統計を含める |
|
|
111
|
+
|
|
112
|
+
**出力例:**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"revisions": [
|
|
117
|
+
{
|
|
118
|
+
"type": "insert",
|
|
119
|
+
"text": "新しい条項",
|
|
120
|
+
"author": "田中 太郎",
|
|
121
|
+
"date": "2025-01-15T10:30:00Z",
|
|
122
|
+
"paragraphIndex": 5,
|
|
123
|
+
"context": {
|
|
124
|
+
"before": "契約書の",
|
|
125
|
+
"after": "について"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "delete",
|
|
130
|
+
"text": "旧条項",
|
|
131
|
+
"author": "田中 太郎",
|
|
132
|
+
"date": "2025-01-15T10:31:00Z",
|
|
133
|
+
"paragraphIndex": 5,
|
|
134
|
+
"context": null
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"summary": {
|
|
138
|
+
"totalRevisions": 15,
|
|
139
|
+
"insertions": 12,
|
|
140
|
+
"deletions": 3,
|
|
141
|
+
"authors": ["田中 太郎", "鈴木 花子"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### コメントの抽出(Extract Comments)
|
|
147
|
+
|
|
148
|
+
DOCXファイルからコメントと返信を抽出します。
|
|
149
|
+
|
|
150
|
+
| パラメータ | 型 | デフォルト | 説明 |
|
|
151
|
+
|-----------|-----|-----------|------|
|
|
152
|
+
| Input Binary Field | string | `data` | DOCXファイルを含むバイナリプロパティ |
|
|
153
|
+
| Include Resolved | boolean | `true` | 解決済みコメントを含める |
|
|
154
|
+
| Include Summary | boolean | `true` | コメント統計を含める |
|
|
155
|
+
|
|
156
|
+
**出力例:**
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"comments": [
|
|
161
|
+
{
|
|
162
|
+
"id": "1",
|
|
163
|
+
"author": "田中 太郎",
|
|
164
|
+
"date": "2025-01-15T10:30:00Z",
|
|
165
|
+
"text": "この部分を確認してください",
|
|
166
|
+
"targetText": "契約期間は1年間とする",
|
|
167
|
+
"resolved": false,
|
|
168
|
+
"replies": [
|
|
169
|
+
{
|
|
170
|
+
"id": "2",
|
|
171
|
+
"author": "鈴木 花子",
|
|
172
|
+
"date": "2025-01-15T11:00:00Z",
|
|
173
|
+
"text": "確認しました。問題ありません。"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"summary": {
|
|
179
|
+
"totalComments": 5,
|
|
180
|
+
"totalReplies": 3,
|
|
181
|
+
"resolved": 2,
|
|
182
|
+
"unresolved": 3,
|
|
183
|
+
"authors": ["田中 太郎", "鈴木 花子"]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 使用例
|
|
189
|
+
|
|
190
|
+
### 基本ワークフロー
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
[Read Binary File] → [DOCX Revisions] → [IF] → [Slack/Email]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
1. **Read Binary File** - DOCXファイルを読み込み
|
|
197
|
+
2. **DOCX Revisions** - 変更履歴またはコメントを抽出
|
|
198
|
+
3. **IF** - 未解決項目があるか確認
|
|
199
|
+
4. **Slack/Email** - レビュアーに通知
|
|
200
|
+
|
|
201
|
+
### 契約レビュー自動化
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
[Webhook] → [DOCX Revisions (Extract Revisions)] → [Code] → [Google Sheets]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
監査目的でスプレッドシートに全ての契約変更を記録。
|
|
208
|
+
|
|
209
|
+
### コメント集約
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
[Google Drive Trigger] → [DOCX Revisions (Extract Comments)] → [Filter] → [Notion]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
共有ドキュメントから未解決コメントを自動収集。
|
|
216
|
+
|
|
217
|
+
## 開発
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# 依存関係のインストール
|
|
221
|
+
pnpm install
|
|
222
|
+
|
|
223
|
+
# 開発サーバーの起動
|
|
224
|
+
pnpm dev
|
|
225
|
+
|
|
226
|
+
# テストの実行
|
|
227
|
+
pnpm test
|
|
228
|
+
|
|
229
|
+
# 本番用ビルド
|
|
230
|
+
pnpm build
|
|
231
|
+
|
|
232
|
+
# コードのLint
|
|
233
|
+
pnpm lint
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## リソース
|
|
237
|
+
|
|
238
|
+
- [n8n コミュニティノード ドキュメント](https://docs.n8n.io/integrations/community-nodes/)
|
|
239
|
+
- [n8n ノードの作成](https://docs.n8n.io/integrations/creating-nodes/)
|
|
240
|
+
- [OpenXML 変更履歴仕様](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.insertedrun)
|
|
241
|
+
|
|
242
|
+
## ライセンス
|
|
243
|
+
|
|
244
|
+
[MIT](LICENSE)
|
|
245
|
+
|
|
246
|
+
## 作者
|
|
247
|
+
|
|
248
|
+
**ryoooo**
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
n8nコミュニティのために作成
|
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# n8n-nodes-docx-track-changes
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
This is an n8n community node that extracts **revisions (track changes)** and **comments** from Microsoft Word (.docx) documents.
|
|
8
|
+
|
|
9
|
+
Perfect for automating document review workflows, contract management, and approval processes.
|
|
10
|
+
|
|
11
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Extract Revisions** - Get all tracked changes (insertions and deletions) with author and timestamp
|
|
16
|
+
- **Extract Comments** - Get all comments with replies, resolution status, and target text
|
|
17
|
+
- **Context Support** - Include surrounding text for each revision
|
|
18
|
+
- **Summary Statistics** - Get counts by type, author, and status
|
|
19
|
+
- **AI Agent Compatible** - Use as a tool in AI workflows (`usableAsTool: true`)
|
|
20
|
+
|
|
21
|
+
## Compatibility
|
|
22
|
+
|
|
23
|
+
| Requirement | Version |
|
|
24
|
+
|-------------|---------|
|
|
25
|
+
| n8n | 1.0.0+ (tested on 2.2.0) |
|
|
26
|
+
| Node.js | 18.17.0+ |
|
|
27
|
+
|
|
28
|
+
> **Note:** This node uses external dependencies (`jszip`, `fast-xml-parser`) and is designed for **self-hosted n8n**. For n8n Cloud, only [verified community nodes](https://docs.n8n.io/integrations/community-nodes/installation/verified-install/) are supported.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
### Option 1: GUI Install (Recommended)
|
|
33
|
+
|
|
34
|
+
The easiest way to install on self-hosted n8n:
|
|
35
|
+
|
|
36
|
+
1. Go to **Settings** > **Community Nodes**
|
|
37
|
+
2. Select **Install**
|
|
38
|
+
3. Enter `n8n-nodes-docx-track-changes`
|
|
39
|
+
4. Check "I understand the risks of installing unverified code from a public source"
|
|
40
|
+
5. Select **Install**
|
|
41
|
+
|
|
42
|
+
> Only **Owner** and **Admin** users can install community nodes.
|
|
43
|
+
|
|
44
|
+
### Option 2: Manual Install (npm)
|
|
45
|
+
|
|
46
|
+
For n8n instances running in queue mode or when installing private packages:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Access your n8n container
|
|
50
|
+
docker exec -it n8n sh
|
|
51
|
+
|
|
52
|
+
# Create nodes directory and install
|
|
53
|
+
mkdir -p ~/.n8n/nodes
|
|
54
|
+
cd ~/.n8n/nodes
|
|
55
|
+
npm install n8n-nodes-docx-track-changes
|
|
56
|
+
|
|
57
|
+
# Restart n8n to load the node
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Option 3: Docker (Dockerfile)
|
|
61
|
+
|
|
62
|
+
For persistent installation in Docker deployments, create a custom Dockerfile:
|
|
63
|
+
|
|
64
|
+
```dockerfile
|
|
65
|
+
FROM n8nio/n8n:latest
|
|
66
|
+
|
|
67
|
+
USER root
|
|
68
|
+
RUN cd /usr/local/lib/node_modules/n8n && \
|
|
69
|
+
npm install n8n-nodes-docx-track-changes
|
|
70
|
+
USER node
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then update your `docker-compose.yml`:
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
services:
|
|
77
|
+
n8n:
|
|
78
|
+
build:
|
|
79
|
+
context: .
|
|
80
|
+
dockerfile: Dockerfile
|
|
81
|
+
# ... rest of your configuration
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Rebuild and restart:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
docker compose down
|
|
88
|
+
docker compose up -d --build
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Enabling AI Agent Tool Usage
|
|
92
|
+
|
|
93
|
+
To use this node as an AI Agent tool, set the environment variable:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Operations
|
|
100
|
+
|
|
101
|
+
### Extract Revisions
|
|
102
|
+
|
|
103
|
+
Extracts tracked changes (insertions and deletions) from a DOCX file.
|
|
104
|
+
|
|
105
|
+
| Parameter | Type | Default | Description |
|
|
106
|
+
|-----------|------|---------|-------------|
|
|
107
|
+
| Input Binary Field | string | `data` | Binary property containing the DOCX file |
|
|
108
|
+
| Include Context | boolean | `false` | Include surrounding text for each revision |
|
|
109
|
+
| Context Length | number | `50` | Characters to include before/after |
|
|
110
|
+
| Include Summary | boolean | `true` | Include revision statistics |
|
|
111
|
+
|
|
112
|
+
**Output Example:**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"revisions": [
|
|
117
|
+
{
|
|
118
|
+
"type": "insert",
|
|
119
|
+
"text": "新しい条項",
|
|
120
|
+
"author": "田中 太郎",
|
|
121
|
+
"date": "2025-01-15T10:30:00Z",
|
|
122
|
+
"paragraphIndex": 5,
|
|
123
|
+
"context": {
|
|
124
|
+
"before": "契約書の",
|
|
125
|
+
"after": "について"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "delete",
|
|
130
|
+
"text": "旧条項",
|
|
131
|
+
"author": "田中 太郎",
|
|
132
|
+
"date": "2025-01-15T10:31:00Z",
|
|
133
|
+
"paragraphIndex": 5,
|
|
134
|
+
"context": null
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"summary": {
|
|
138
|
+
"totalRevisions": 15,
|
|
139
|
+
"insertions": 12,
|
|
140
|
+
"deletions": 3,
|
|
141
|
+
"authors": ["田中 太郎", "鈴木 花子"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Extract Comments
|
|
147
|
+
|
|
148
|
+
Extracts comments and replies from a DOCX file.
|
|
149
|
+
|
|
150
|
+
| Parameter | Type | Default | Description |
|
|
151
|
+
|-----------|------|---------|-------------|
|
|
152
|
+
| Input Binary Field | string | `data` | Binary property containing the DOCX file |
|
|
153
|
+
| Include Resolved | boolean | `true` | Include resolved comments |
|
|
154
|
+
| Include Summary | boolean | `true` | Include comment statistics |
|
|
155
|
+
|
|
156
|
+
**Output Example:**
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"comments": [
|
|
161
|
+
{
|
|
162
|
+
"id": "1",
|
|
163
|
+
"author": "田中 太郎",
|
|
164
|
+
"date": "2025-01-15T10:30:00Z",
|
|
165
|
+
"text": "この部分を確認してください",
|
|
166
|
+
"targetText": "契約期間は1年間とする",
|
|
167
|
+
"resolved": false,
|
|
168
|
+
"replies": [
|
|
169
|
+
{
|
|
170
|
+
"id": "2",
|
|
171
|
+
"author": "鈴木 花子",
|
|
172
|
+
"date": "2025-01-15T11:00:00Z",
|
|
173
|
+
"text": "確認しました。問題ありません。"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"summary": {
|
|
179
|
+
"totalComments": 5,
|
|
180
|
+
"totalReplies": 3,
|
|
181
|
+
"resolved": 2,
|
|
182
|
+
"unresolved": 3,
|
|
183
|
+
"authors": ["田中 太郎", "鈴木 花子"]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Usage Examples
|
|
189
|
+
|
|
190
|
+
### Basic Workflow
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
[Read Binary File] → [DOCX Revisions] → [IF] → [Slack/Email]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
1. **Read Binary File** - Load the DOCX file
|
|
197
|
+
2. **DOCX Revisions** - Extract revisions or comments
|
|
198
|
+
3. **IF** - Check if there are unresolved items
|
|
199
|
+
4. **Slack/Email** - Notify reviewers
|
|
200
|
+
|
|
201
|
+
### Contract Review Automation
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
[Webhook] → [DOCX Revisions (Extract Revisions)] → [Code] → [Google Sheets]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Track all contract changes in a spreadsheet for audit purposes.
|
|
208
|
+
|
|
209
|
+
### Comment Aggregation
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
[Google Drive Trigger] → [DOCX Revisions (Extract Comments)] → [Filter] → [Notion]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Automatically collect unresolved comments from shared documents.
|
|
216
|
+
|
|
217
|
+
## Development
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Install dependencies
|
|
221
|
+
pnpm install
|
|
222
|
+
|
|
223
|
+
# Start development server
|
|
224
|
+
pnpm dev
|
|
225
|
+
|
|
226
|
+
# Run tests
|
|
227
|
+
pnpm test
|
|
228
|
+
|
|
229
|
+
# Build for production
|
|
230
|
+
pnpm build
|
|
231
|
+
|
|
232
|
+
# Lint code
|
|
233
|
+
pnpm lint
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Resources
|
|
237
|
+
|
|
238
|
+
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
239
|
+
- [Creating n8n Nodes](https://docs.n8n.io/integrations/creating-nodes/)
|
|
240
|
+
- [OpenXML Track Changes Specification](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.insertedrun)
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
[MIT](LICENSE)
|
|
245
|
+
|
|
246
|
+
## Author
|
|
247
|
+
|
|
248
|
+
**ryoooo**
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
Made with ❤️ for the n8n community
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class DocxRevisions implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocxRevisions = void 0;
|
|
4
|
+
const extractRevisions_1 = require("./operations/extractRevisions");
|
|
5
|
+
const extractComments_1 = require("./operations/extractComments");
|
|
6
|
+
class DocxRevisions {
|
|
7
|
+
description = {
|
|
8
|
+
displayName: 'DOCX Revisions',
|
|
9
|
+
name: 'docxRevisions',
|
|
10
|
+
icon: 'file:docxRevisions.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
14
|
+
description: 'Extract revisions (track changes) and comments from DOCX documents',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'DOCX Revisions',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
usableAsTool: true,
|
|
21
|
+
properties: [
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Operation',
|
|
24
|
+
name: 'operation',
|
|
25
|
+
type: 'options',
|
|
26
|
+
noDataExpression: true,
|
|
27
|
+
options: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Extract Revisions',
|
|
30
|
+
value: 'extractRevisions',
|
|
31
|
+
description: 'Extract tracked changes (insertions and deletions) from a DOCX file',
|
|
32
|
+
action: 'Extract revisions from DOCX',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Extract Comments',
|
|
36
|
+
value: 'extractComments',
|
|
37
|
+
description: 'Extract comments and replies from a DOCX file',
|
|
38
|
+
action: 'Extract comments from DOCX',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
default: 'extractRevisions',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Input Binary Field',
|
|
45
|
+
name: 'binaryPropertyName',
|
|
46
|
+
type: 'string',
|
|
47
|
+
default: 'data',
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Name of the binary property containing the DOCX file',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Options',
|
|
53
|
+
name: 'options',
|
|
54
|
+
type: 'collection',
|
|
55
|
+
placeholder: 'Add Option',
|
|
56
|
+
default: {},
|
|
57
|
+
displayOptions: {
|
|
58
|
+
show: {
|
|
59
|
+
operation: ['extractRevisions'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Include Context',
|
|
65
|
+
name: 'includeContext',
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
default: false,
|
|
68
|
+
description: 'Whether to include surrounding text for each revision',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Context Length',
|
|
72
|
+
name: 'contextLength',
|
|
73
|
+
type: 'number',
|
|
74
|
+
default: 50,
|
|
75
|
+
description: 'Number of characters to include before and after each revision',
|
|
76
|
+
displayOptions: {
|
|
77
|
+
show: {
|
|
78
|
+
includeContext: [true],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Include Summary',
|
|
84
|
+
name: 'includeSummary',
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
default: true,
|
|
87
|
+
description: 'Whether to include revision statistics summary',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Options',
|
|
93
|
+
name: 'options',
|
|
94
|
+
type: 'collection',
|
|
95
|
+
placeholder: 'Add Option',
|
|
96
|
+
default: {},
|
|
97
|
+
displayOptions: {
|
|
98
|
+
show: {
|
|
99
|
+
operation: ['extractComments'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
options: [
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Include Resolved',
|
|
105
|
+
name: 'includeResolved',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
default: true,
|
|
108
|
+
description: 'Whether to include resolved comments',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
displayName: 'Include Summary',
|
|
112
|
+
name: 'includeSummary',
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
default: true,
|
|
115
|
+
description: 'Whether to include comment statistics summary',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
async execute() {
|
|
122
|
+
const items = this.getInputData();
|
|
123
|
+
const returnData = [];
|
|
124
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
125
|
+
for (let i = 0; i < items.length; i++) {
|
|
126
|
+
try {
|
|
127
|
+
if (operation === 'extractRevisions') {
|
|
128
|
+
const result = await extractRevisions_1.extractRevisions.call(this, i);
|
|
129
|
+
returnData.push(result);
|
|
130
|
+
}
|
|
131
|
+
else if (operation === 'extractComments') {
|
|
132
|
+
const result = await extractComments_1.extractComments.call(this, i);
|
|
133
|
+
returnData.push(result);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
if (this.continueOnFail()) {
|
|
138
|
+
returnData.push({
|
|
139
|
+
json: { error: error.message },
|
|
140
|
+
pairedItem: { item: i },
|
|
141
|
+
});
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return [returnData];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.DocxRevisions = DocxRevisions;
|
|
151
|
+
//# sourceMappingURL=DocxRevisions.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocxRevisions.node.js","sourceRoot":"","sources":["../../../nodes/DocxRevisions/DocxRevisions.node.ts"],"names":[],"mappings":";;;AAMA,oEAAiE;AACjE,kEAA+D;AAE/D,MAAa,aAAa;IACzB,WAAW,GAAyB;QACnC,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,8BAA8B;QACxC,WAAW,EAAE,oEAAoE;QACjF,QAAQ,EAAE;YACT,IAAI,EAAE,gBAAgB;SACtB;QACD,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE;YACX;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;gBACf,gBAAgB,EAAE,I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