@sinoia/hubdoc-tools 1.2.1 → 1.3.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 +219 -412
- package/dist/api/api/users-api.d.ts +246 -0
- package/dist/api/api/users-api.d.ts.map +1 -0
- package/dist/api/api/users-api.js +465 -0
- package/dist/api/api/users-api.js.map +1 -0
- package/dist/api/api.d.ts +1 -0
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +1 -0
- package/dist/api/api.js.map +1 -1
- package/dist/api/models/contact-mutation.d.ts +4 -4
- package/dist/api/models/contact-mutation.d.ts.map +1 -1
- package/dist/api/models/contact.d.ts +8 -8
- package/dist/api/models/contact.d.ts.map +1 -1
- package/dist/api/models/group-mutation.d.ts +1 -1
- package/dist/api/models/group-mutation.d.ts.map +1 -1
- package/dist/api/models/group.d.ts +3 -3
- package/dist/api/models/group.d.ts.map +1 -1
- package/dist/api/models/index.d.ts +1 -0
- package/dist/api/models/index.d.ts.map +1 -1
- package/dist/api/models/index.js +1 -0
- package/dist/api/models/index.js.map +1 -1
- package/dist/api/models/permission-actor.d.ts +1 -1
- package/dist/api/models/permission-actor.d.ts.map +1 -1
- package/dist/api/models/permission-mutation.d.ts +5 -5
- package/dist/api/models/permission-mutation.d.ts.map +1 -1
- package/dist/api/models/permission.d.ts +7 -7
- package/dist/api/models/permission.d.ts.map +1 -1
- package/dist/api/models/user-mutation.d.ts +45 -0
- package/dist/api/models/user-mutation.d.ts.map +1 -0
- package/dist/api/models/user-mutation.js +23 -0
- package/dist/api/models/user-mutation.js.map +1 -0
- package/dist/api/models/user.d.ts +43 -0
- package/dist/api/models/user.d.ts.map +1 -1
- package/dist/api/models/user.js +7 -0
- package/dist/api/models/user.js.map +1 -1
- package/dist/api-client.d.ts +19 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +43 -0
- package/dist/api-client.js.map +1 -0
- package/dist/commands/import.d.ts +23 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +138 -0
- package/dist/commands/import.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/services/hubdoc-api.d.ts +3 -1
- package/dist/services/hubdoc-api.d.ts.map +1 -1
- package/dist/services/hubdoc-api.js +31 -51
- package/dist/services/hubdoc-api.js.map +1 -1
- package/dist/services/permission-manager.d.ts +42 -0
- package/dist/services/permission-manager.d.ts.map +1 -0
- package/dist/services/permission-manager.js +187 -0
- package/dist/services/permission-manager.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/csv.d.ts +44 -0
- package/dist/utils/csv.d.ts.map +1 -1
- package/dist/utils/csv.js +268 -36
- package/dist/utils/csv.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,541 +5,348 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@sinoia/hubdoc-tools)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Outil CLI puissant pour l'import/export en masse de documents avec HubDoc. Importez depuis le système de fichiers local ou des sources cloud, exportez avec structures personnalisées et metadata XML.
|
|
9
|
+
|
|
10
|
+
---
|
|
9
11
|
|
|
10
12
|
## 📦 Installation
|
|
11
13
|
|
|
12
14
|
```bash
|
|
13
|
-
#
|
|
15
|
+
# Installation globale (recommandé)
|
|
14
16
|
npm install -g @sinoia/hubdoc-tools
|
|
15
17
|
|
|
16
|
-
#
|
|
18
|
+
# Vérifier l'installation
|
|
17
19
|
hubdoc-tool --version
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
- **🔐 Automatic OAuth2**: Zero-config authentication with automatic token refresh
|
|
22
|
-
- **📦 NPM Package**: Install globally with `npm install -g @sinoia/hubdoc-tools`
|
|
23
|
-
- **🔌 API Integration**: Full integration with official HubDoc Swagger/OpenAPI API
|
|
24
|
-
- **🧩 Plugin System**: Extensible architecture for external sources (OneDrive, Google Drive, S3, Dropbox)
|
|
25
|
-
- **✅ Enhanced Validation**: Pre-import validation and detailed error reporting
|
|
26
|
-
- **🎯 Interactive Mode**: Guided workflows with previews and confirmations
|
|
27
|
-
|
|
28
|
-
### Features
|
|
29
|
-
|
|
30
|
-
**📥 Import Capabilities**
|
|
31
|
-
- **Direct Import Mode**: Import all files from a directory, preserving folder structure
|
|
32
|
-
- **Mapping Import Mode**: Use CSV mapping file for precise control over document placement
|
|
33
|
-
- **Project Support**: Assign documents to specific projects with classification plans
|
|
34
|
-
- **Permissions Management**: Set user and group permissions (read/write) on imported documents
|
|
35
|
-
|
|
36
|
-
**📤 Export Capabilities**
|
|
37
|
-
- **Scan Mode**: Generate export mapping from existing HubDoc documents
|
|
38
|
-
- **Export Mode**: Download documents with customizable folder structure recreation
|
|
39
|
-
- **XML Metadata Export**: Generate `*_metadata.xml` files with HubDoc metadata for each exported document
|
|
40
|
-
- **Project/Domain Filtering**: Export specific subsets of documents
|
|
41
|
-
- **Path Customization**: Specify custom target directories for exported files
|
|
42
|
-
|
|
43
|
-
**⚙️ General Features**
|
|
44
|
-
- **🔐 Automatic OAuth2**: Zero-config authentication with automatic token refresh and expiration handling
|
|
45
|
-
- **🎯 Interactive & CLI Modes**: Both interactive wizard and command-line interface
|
|
46
|
-
- **📁 Folder Management**: Automatic folder creation in HubDoc
|
|
47
|
-
- **📊 Progress Tracking**: Real-time import/export progress with detailed feedback
|
|
48
|
-
- **🔄 Token Management**: Automatic token refresh before expiration (60s buffer)
|
|
49
|
-
|
|
50
|
-
## 🚀 Quick Start
|
|
51
|
-
|
|
52
|
-
### 1. Installation
|
|
53
|
-
```bash
|
|
54
|
-
npm install -g @sinoia/hubdoc-tools
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 2. Configuration
|
|
22
|
+
---
|
|
58
23
|
|
|
59
|
-
|
|
24
|
+
## ⚡ Quick Start
|
|
60
25
|
|
|
61
|
-
|
|
26
|
+
### 1. Configuration (30 secondes)
|
|
62
27
|
|
|
63
28
|
```bash
|
|
64
|
-
#
|
|
29
|
+
# Définir les credentials OAuth2
|
|
65
30
|
export HUBDOC_API_URL=https://rec.hubdoc.sinoia.cloud
|
|
66
31
|
export HUBDOC_OAUTH_CLIENT_ID=your-client-id
|
|
67
32
|
export HUBDOC_OAUTH_CLIENT_SECRET=your-client-secret
|
|
68
33
|
export HUBDOC_OAUTH_SCOPES="read write"
|
|
69
|
-
|
|
70
|
-
# Run any command - authentication is automatic!
|
|
71
|
-
hubdoc-tool import --source ./documents
|
|
72
34
|
```
|
|
73
35
|
|
|
74
|
-
**
|
|
75
|
-
1. ✅ CLI checks for valid token
|
|
76
|
-
2. 🔄 Refreshes token if expired (using refresh_token)
|
|
77
|
-
3. 🌐 Opens browser for OAuth authentication if needed
|
|
78
|
-
4. 💾 Saves token to `.hubdoc-config.json`
|
|
79
|
-
5. ▶️ Proceeds with your command
|
|
80
|
-
|
|
81
|
-
**No manual token management required!**
|
|
82
|
-
|
|
83
|
-
#### Alternative: Configuration File
|
|
84
|
-
|
|
85
|
-
Create a `.hubdoc-config.json` file (environment variables override this):
|
|
36
|
+
**L'authentification est ensuite 100% automatique !** ✨
|
|
86
37
|
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
"apiUrl": "https://rec.hubdoc.sinoia.cloud",
|
|
90
|
-
"clientId": "your-client-id",
|
|
91
|
-
"clientSecret": "your-client-secret",
|
|
92
|
-
"scopes": ["read", "write"]
|
|
93
|
-
}
|
|
94
|
-
```
|
|
38
|
+
### 2. Import Basique
|
|
95
39
|
|
|
96
|
-
Or use `.env` file:
|
|
97
40
|
```bash
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
HUBDOC_OAUTH_CLIENT_SECRET=your-client-secret
|
|
101
|
-
HUBDOC_OAUTH_SCOPES="read write"
|
|
102
|
-
```
|
|
41
|
+
# Import direct (préserve la structure)
|
|
42
|
+
hubdoc-tool import --direct ./invoices
|
|
103
43
|
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Generate mapping from local directory
|
|
44
|
+
# Ou avec mapping CSV
|
|
107
45
|
hubdoc-tool generate-mapping ./documents
|
|
108
|
-
|
|
109
|
-
# Import documents (authentication is automatic!)
|
|
110
|
-
hubdoc-tool import --source /path/to/documents
|
|
111
46
|
hubdoc-tool import --mapping mapping.csv
|
|
112
|
-
|
|
47
|
+
```
|
|
113
48
|
|
|
114
|
-
|
|
115
|
-
hubdoc-tool export --scan # Generate export mapping
|
|
116
|
-
hubdoc-tool export --mapping export-mapping.csv
|
|
117
|
-
hubdoc-tool export --generate-xml-metadata # With XML metadata
|
|
49
|
+
### 3. Export
|
|
118
50
|
|
|
119
|
-
|
|
120
|
-
|
|
51
|
+
```bash
|
|
52
|
+
# Générer mapping depuis HubDoc
|
|
53
|
+
hubdoc-tool export --scan
|
|
121
54
|
|
|
122
|
-
#
|
|
123
|
-
hubdoc-tool --
|
|
124
|
-
hubdoc-tool --engine googledrive
|
|
125
|
-
hubdoc-tool --engine s3
|
|
55
|
+
# Exporter avec metadata XML
|
|
56
|
+
hubdoc-tool export --mapping export-mapping.csv --generate-xml-metadata
|
|
126
57
|
```
|
|
127
58
|
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
# Microsoft OneDrive/SharePoint
|
|
131
|
-
hubdoc-tool --engine onedrive
|
|
59
|
+
---
|
|
132
60
|
|
|
133
|
-
|
|
134
|
-
hubdoc-tool --engine googledrive
|
|
61
|
+
## 🎯 Fonctionnalités Clés
|
|
135
62
|
|
|
136
|
-
|
|
137
|
-
|
|
63
|
+
### Import
|
|
64
|
+
- ✅ **Import direct** : Structure de dossiers préservée automatiquement
|
|
65
|
+
- ✅ **Import avec mapping** : Contrôle précis via CSV
|
|
66
|
+
- ✅ **Permissions** : Gestion read/write par utilisateur/groupe
|
|
67
|
+
- ✅ **Metadata** : Format simplifié `key: value, parent.child: value`
|
|
68
|
+
- ✅ **Sources multiples** : Local, OneDrive, Google Drive, AWS S3
|
|
138
69
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
70
|
+
### Export
|
|
71
|
+
- ✅ **Scan automatique** : Génération du mapping depuis HubDoc
|
|
72
|
+
- ✅ **Structure personnalisée** : Recréation de l'arborescence
|
|
73
|
+
- ✅ **Metadata XML** : Fichiers `*_metadata.xml` générés automatiquement
|
|
74
|
+
- ✅ **Filtrage** : Par projet, domaine, workspace
|
|
142
75
|
|
|
143
|
-
###
|
|
76
|
+
### Général
|
|
77
|
+
- ✅ **OAuth2 automatique** : Zéro config manuelle, refresh automatique
|
|
78
|
+
- ✅ **Mode interactif** : Assistant guidé étape par étape
|
|
79
|
+
- ✅ **Validation** : Pré-validation des fichiers avant import
|
|
80
|
+
- ✅ **Concurrent** : Import/export parallèle configurable
|
|
81
|
+
- ✅ **Plugins** : Architecture extensible pour sources externes
|
|
144
82
|
|
|
145
|
-
|
|
83
|
+
---
|
|
146
84
|
|
|
147
|
-
|
|
148
|
-
- CSV mapping format and examples
|
|
149
|
-
- Permission system (read/write permissions)
|
|
150
|
-
- Command reference
|
|
151
|
-
- API integration details
|
|
152
|
-
- Error handling
|
|
85
|
+
## 📚 Documentation
|
|
153
86
|
|
|
154
|
-
|
|
87
|
+
| Sujet | Description |
|
|
88
|
+
|-------|-------------|
|
|
89
|
+
| **[Configuration](./docs/configuration.md)** | OAuth2, variables d'environnement, fichiers config |
|
|
90
|
+
| **[Permissions](./docs/permissions.md)** | Format naturel : `users:r:email users:w:email | groups:Name` |
|
|
91
|
+
| **[Metadata](./docs/metadata.md)** | Format simplifié : `key: value, parent.child: value` |
|
|
92
|
+
| **[Exemples](./docs/examples.md)** | Cas d'usage, scripts, automatisation |
|
|
155
93
|
|
|
156
|
-
|
|
94
|
+
---
|
|
157
95
|
|
|
158
|
-
|
|
159
|
-
- **Target Folder**: Destination folder in HubDoc (created if doesn't exist)
|
|
160
|
-
- **Projet**: Project name (optional)
|
|
161
|
-
- **Domain**: Business domain for transverse classification
|
|
162
|
-
- **Metadata (JSON)**: Additional metadata as JSON object
|
|
163
|
-
- **Read Permissions**: Users/groups with read access (`users:user1,user2|groups:group1,group2`)
|
|
164
|
-
- **Write Permissions**: Users/groups with write access (`users:user1,user2|groups:group1,group2`)
|
|
96
|
+
## 🚀 Commandes Principales
|
|
165
97
|
|
|
166
|
-
###
|
|
98
|
+
### Import
|
|
167
99
|
|
|
168
100
|
```bash
|
|
169
|
-
#
|
|
170
|
-
|
|
101
|
+
# Import direct (structure préservée)
|
|
102
|
+
hubdoc-tool import --direct ./documents
|
|
171
103
|
|
|
172
|
-
#
|
|
173
|
-
|
|
104
|
+
# Import avec mapping CSV
|
|
105
|
+
hubdoc-tool import --mapping mapping.csv
|
|
174
106
|
|
|
175
|
-
#
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
# - Metadata
|
|
107
|
+
# Import depuis source externe
|
|
108
|
+
hubdoc-tool --engine onedrive import --source "/Shared Documents"
|
|
109
|
+
hubdoc-tool --engine googledrive import --source "My Drive/Invoices"
|
|
110
|
+
hubdoc-tool --engine s3 import --source "s3://bucket/docs"
|
|
180
111
|
|
|
181
|
-
#
|
|
182
|
-
|
|
112
|
+
# Options
|
|
113
|
+
--concurrent 5 # 5 jobs parallèles
|
|
114
|
+
--skip-existing # Skip documents déjà importés
|
|
115
|
+
--dry-run # Test sans importer
|
|
116
|
+
--validate-all # Validation stricte avant import
|
|
117
|
+
```
|
|
183
118
|
|
|
184
|
-
|
|
185
|
-
npm run dev -- export --scan # Generate export mapping
|
|
186
|
-
npm run dev -- export # Download documents
|
|
187
|
-
npm run dev -- export --generate-xml-metadata # Export with XML metadata files
|
|
119
|
+
### Export
|
|
188
120
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
121
|
+
```bash
|
|
122
|
+
# Générer mapping depuis HubDoc
|
|
123
|
+
hubdoc-tool export --scan
|
|
124
|
+
|
|
125
|
+
# Exporter selon mapping
|
|
126
|
+
hubdoc-tool export --mapping export-mapping.csv
|
|
192
127
|
|
|
193
|
-
|
|
128
|
+
# Export avec XML metadata
|
|
129
|
+
hubdoc-tool export --generate-xml-metadata
|
|
194
130
|
|
|
195
|
-
|
|
131
|
+
# Options
|
|
132
|
+
--target ./output # Dossier de destination
|
|
133
|
+
--concurrent 5 # 5 downloads parallèles
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Mapping
|
|
196
137
|
|
|
197
138
|
```bash
|
|
198
|
-
#
|
|
199
|
-
|
|
139
|
+
# Générer mapping depuis dossier local
|
|
140
|
+
hubdoc-tool generate-mapping ./documents
|
|
200
141
|
|
|
201
|
-
#
|
|
202
|
-
|
|
203
|
-
# Then select "Yes" for XML metadata generation
|
|
142
|
+
# Générer avec sortie spécifique
|
|
143
|
+
hubdoc-tool generate-mapping ./docs --output custom-mapping.csv
|
|
204
144
|
```
|
|
205
145
|
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
export/
|
|
209
|
-
├── Project Name/
|
|
210
|
-
│ ├── document.pdf # Original document
|
|
211
|
-
│ ├── document_metadata.xml # Document metadata
|
|
212
|
-
│ └── Subfolder/
|
|
213
|
-
│ ├── another-doc.docx
|
|
214
|
-
│ └── another-doc_metadata.xml
|
|
215
|
-
└── export_summary.xml # Overall export summary
|
|
216
|
-
```
|
|
146
|
+
### Mode Interactif
|
|
217
147
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
- All custom metadata fields
|
|
223
|
-
- Export timestamp
|
|
224
|
-
- Original download URL
|
|
225
|
-
- User-defined metadata
|
|
226
|
-
|
|
227
|
-
**Example XML:**
|
|
228
|
-
```xml
|
|
229
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
230
|
-
<document fileName="Contract">
|
|
231
|
-
<documentId>doc_123</documentId>
|
|
232
|
-
<documentName>Contract.pdf</documentName>
|
|
233
|
-
<project>
|
|
234
|
-
<name>Client Project</name>
|
|
235
|
-
</project>
|
|
236
|
-
<folderPath>Legal/Contracts</folderPath>
|
|
237
|
-
<author>John Doe</author>
|
|
238
|
-
<createdDate>2024-01-15T10:30:00Z</createdDate>
|
|
239
|
-
<exportedAt>2024-09-11T13:42:10.829Z</exportedAt>
|
|
240
|
-
<originalDownloadUrl>https://hubdoc.example.com/download/doc_123</originalDownloadUrl>
|
|
241
|
-
</document>
|
|
148
|
+
```bash
|
|
149
|
+
# Lancer l'assistant guidé
|
|
150
|
+
hubdoc-tool --interactive
|
|
151
|
+
hubdoc-tool -i
|
|
242
152
|
```
|
|
243
153
|
|
|
244
|
-
|
|
154
|
+
---
|
|
245
155
|
|
|
246
|
-
|
|
156
|
+
## 📋 Format CSV Mapping
|
|
247
157
|
|
|
248
|
-
###
|
|
158
|
+
### Structure Basique
|
|
159
|
+
|
|
160
|
+
```csv
|
|
161
|
+
File Path;Target Folder;Workspace;Metadata (key: value, parent.child: value);Permissions (users:r:email users:w:email | groups:Name);Auto Classify;Status;Error;Document ID;Bulk Upload ID
|
|
162
|
+
```
|
|
249
163
|
|
|
250
|
-
|
|
251
|
-
- Starts a local HTTP server on `localhost:8082`
|
|
252
|
-
- Opens your browser to the OAuth authorization page
|
|
253
|
-
- Receives the authorization code via callback
|
|
254
|
-
- Exchanges the code for an access token
|
|
255
|
-
- Saves the token and refresh token to `.hubdoc-config.json`
|
|
164
|
+
### Exemple Simple
|
|
256
165
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
166
|
+
```csv
|
|
167
|
+
File Path;Target Folder;Workspace;Metadata (key: value, parent.child: value);Permissions (users:r:email users:w:email | groups:Name);Auto Classify;Status;Error;Document ID;Bulk Upload ID
|
|
168
|
+
/invoices/inv-001.pdf;Factures/2024;Comptabilité;invoice_number: INV-001, amount: 1500;;true;pending;;;
|
|
169
|
+
/contracts/c-a.pdf;Contrats;Juridique;type: service, duration: 24;users:r:legal@ex.com users:w:ceo@ex.com;false;pending;;;
|
|
170
|
+
```
|
|
262
171
|
|
|
263
|
-
|
|
172
|
+
**Voir [Exemples](./docs/examples.md) pour plus de cas d'usage**
|
|
264
173
|
|
|
265
|
-
|
|
174
|
+
---
|
|
266
175
|
|
|
267
|
-
|
|
268
|
-
1. **Environment variables** (override everything)
|
|
269
|
-
2. **`.env` file** (loaded automatically)
|
|
270
|
-
3. **`.hubdoc-config.json`** (saved tokens)
|
|
176
|
+
## 🔐 Permissions (Format Naturel)
|
|
271
177
|
|
|
272
|
-
|
|
273
|
-
# Required for automatic OAuth
|
|
274
|
-
export HUBDOC_API_URL=https://rec.hubdoc.sinoia.cloud
|
|
275
|
-
export HUBDOC_OAUTH_CLIENT_ID=your-client-id
|
|
276
|
-
export HUBDOC_OAUTH_CLIENT_SECRET=your-client-secret
|
|
277
|
-
export HUBDOC_OAUTH_SCOPES="read write admin"
|
|
178
|
+
### Format
|
|
278
179
|
|
|
279
|
-
# Optional: provide a valid token directly (skips OAuth flow)
|
|
280
|
-
export HUBDOC_TOKEN=your-existing-token
|
|
281
180
|
```
|
|
181
|
+
users:email1,email2 | users:w:admin@ex.com | groups:Group Name | groups:w:Admin Group
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Règles
|
|
282
185
|
|
|
283
|
-
|
|
186
|
+
- **Sans suffixe** = READ par défaut : `users:john@ex.com | groups:Finance`
|
|
187
|
+
- **:r** = READ explicite : `users:r:viewer@ex.com`
|
|
188
|
+
- **:w** = WRITE : `users:w:editor@ex.com | groups:w:Admins`
|
|
189
|
+
- **Espaces supportés** dans les noms de groupes : `groups:Senior Management`
|
|
284
190
|
|
|
285
|
-
|
|
286
|
-
- The CLI checks expiration **60 seconds before** actual expiration
|
|
287
|
-
- Automatic refresh using the refresh_token (no browser required)
|
|
288
|
-
- If refresh fails, a new OAuth flow is initiated automatically
|
|
191
|
+
### Exemples
|
|
289
192
|
|
|
290
|
-
|
|
193
|
+
```csv
|
|
194
|
+
# Lecture seule
|
|
195
|
+
users:john@ex.com,jane@ex.com | groups:All Staff
|
|
291
196
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
- The local OAuth callback server only binds to `127.0.0.1` (localhost)
|
|
295
|
-
- Authorization codes are single-use and expire quickly
|
|
197
|
+
# Mixte READ + WRITE
|
|
198
|
+
users:viewer@ex.com | users:w:admin@ex.com | groups:Finance | groups:w:Direction
|
|
296
199
|
|
|
297
|
-
|
|
200
|
+
# Groupes avec espaces et accents
|
|
201
|
+
groups:Comptabilité France | groups:w:Présidence Direction
|
|
202
|
+
```
|
|
298
203
|
|
|
299
|
-
|
|
300
|
-
- `https://rec.hubdoc.sinoia.cloud`
|
|
301
|
-
- `https://demo.hubdoc.sinoia.cloud`
|
|
204
|
+
**Voir [Documentation Permissions](./docs/permissions.md) pour détails complets**
|
|
302
205
|
|
|
303
|
-
|
|
304
|
-
- Environment variables (recommended for credentials)
|
|
305
|
-
- `.env` file (for local development)
|
|
306
|
-
- `.hubdoc-config.json` file (for saved tokens)
|
|
206
|
+
---
|
|
307
207
|
|
|
308
|
-
##
|
|
208
|
+
## 📝 Metadata (Format Simplifié)
|
|
309
209
|
|
|
310
|
-
|
|
210
|
+
### Format
|
|
311
211
|
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
npm run dev -- --interactive # Mode interactif
|
|
315
|
-
npm run dev -- --engine onedrive # OneDrive direct
|
|
316
|
-
npm run dev -- --engine core --limit 10 # Core avec limite
|
|
317
|
-
npm run dev # Filesystem par défaut
|
|
212
|
+
```
|
|
213
|
+
key: value, parent.child: value
|
|
318
214
|
```
|
|
319
215
|
|
|
320
|
-
###
|
|
216
|
+
### Exemples
|
|
321
217
|
|
|
322
|
-
|
|
323
|
-
|
|
218
|
+
```csv
|
|
219
|
+
# Simple
|
|
220
|
+
invoice_number: INV-001, amount: 1500, paid: true
|
|
324
221
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
- 🔍 **Détection intelligente** : Association automatique document ↔ métadonnées
|
|
328
|
-
- 📊 **Mapping HubDoc** : Conversion vers champs standard (title, author, project, etc.)
|
|
329
|
-
- ⚡ **Formats supportés** : Excel XML, XML simple
|
|
222
|
+
# Objets imbriqués (notation point)
|
|
223
|
+
supplier.name: Acme Corp, supplier.vat: FR123, amount: 2500
|
|
330
224
|
|
|
331
|
-
|
|
332
|
-
|
|
225
|
+
# Types auto-détectés
|
|
226
|
+
year: 2024, amount: 1500.50, active: true, optional: null
|
|
333
227
|
```
|
|
334
228
|
|
|
335
|
-
**
|
|
336
|
-
```
|
|
337
|
-
documents/
|
|
338
|
-
├── rapport.pdf # Document principal
|
|
339
|
-
├── rapport_metadata.xml # Métadonnées XML associées
|
|
340
|
-
└── autre-doc.docx # Autre document
|
|
341
|
-
```
|
|
229
|
+
**Voir [Documentation Metadata](./docs/metadata.md) pour détails complets**
|
|
342
230
|
|
|
343
|
-
|
|
231
|
+
---
|
|
344
232
|
|
|
345
|
-
|
|
233
|
+
## 🔌 Plugins / Sources Externes
|
|
346
234
|
|
|
347
|
-
|
|
348
|
-
1. Aller sur [Microsoft Graph Explorer](https://developer.microsoft.com/en-us/graph/graph-explorer)
|
|
349
|
-
2. Se connecter avec votre compte Microsoft/Office 365
|
|
350
|
-
3. Demander les permissions `Files.Read.All`
|
|
351
|
-
4. Copier le token généré
|
|
235
|
+
### OneDrive/SharePoint
|
|
352
236
|
|
|
353
237
|
```bash
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
238
|
+
export ONEDRIVE_CLIENT_ID=your-client-id
|
|
239
|
+
export ONEDRIVE_CLIENT_SECRET=your-client-secret
|
|
240
|
+
export ONEDRIVE_TENANT_ID=your-tenant-id
|
|
357
241
|
|
|
358
|
-
|
|
242
|
+
hubdoc-tool --engine onedrive import --source "/Shared Documents/Invoices"
|
|
243
|
+
```
|
|
359
244
|
|
|
360
|
-
|
|
361
|
-
1. Aller sur votre instance Core (ex: `https://rec.plugandwork.fr`)
|
|
362
|
-
2. Naviguer vers : `/users/token`
|
|
363
|
-
3. Copier le token Bearer affiché
|
|
245
|
+
### Google Drive
|
|
364
246
|
|
|
365
247
|
```bash
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
248
|
+
export GOOGLE_DRIVE_CLIENT_ID=your-client-id
|
|
249
|
+
export GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret
|
|
250
|
+
export GOOGLE_DRIVE_CREDENTIALS_PATH=./credentials.json
|
|
369
251
|
|
|
370
|
-
|
|
252
|
+
hubdoc-tool --engine googledrive import --source "My Drive/Documents"
|
|
253
|
+
```
|
|
371
254
|
|
|
372
|
-
|
|
373
|
-
1. Créer une application dans [Google Cloud Console](https://console.cloud.google.com/)
|
|
374
|
-
2. Activer l'API Google Drive
|
|
375
|
-
3. Créer des identifiants OAuth 2.0
|
|
376
|
-
4. Configurer les permissions `https://www.googleapis.com/auth/drive.readonly`
|
|
377
|
-
5. Obtenir `clientId`, `clientSecret`, et effectuer le flow OAuth2
|
|
255
|
+
### AWS S3
|
|
378
256
|
|
|
379
257
|
```bash
|
|
380
|
-
|
|
381
|
-
|
|
258
|
+
export AWS_ACCESS_KEY_ID=your-key
|
|
259
|
+
export AWS_SECRET_ACCESS_KEY=your-secret
|
|
260
|
+
export AWS_REGION=us-east-1
|
|
261
|
+
|
|
262
|
+
hubdoc-tool --engine s3 import --source "s3://my-bucket/documents/"
|
|
382
263
|
```
|
|
383
264
|
|
|
384
|
-
|
|
265
|
+
**Voir [Exemples](./docs/examples.md) pour configuration détaillée**
|
|
385
266
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 🛠️ Développement
|
|
270
|
+
|
|
271
|
+
### Installation pour Développement
|
|
391
272
|
|
|
392
273
|
```bash
|
|
393
|
-
|
|
394
|
-
|
|
274
|
+
git clone https://github.com/your-org/hubdoc-tools.git
|
|
275
|
+
cd hubdoc-tools
|
|
276
|
+
npm install
|
|
277
|
+
npm run build
|
|
395
278
|
```
|
|
396
279
|
|
|
397
|
-
|
|
280
|
+
### Tests
|
|
398
281
|
|
|
399
|
-
|
|
282
|
+
```bash
|
|
283
|
+
# Tous les tests
|
|
284
|
+
npm test
|
|
400
285
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
| ☁️ **OneDrive** | Cloud | Intégré |
|
|
405
|
-
| 🗂️ **Google Drive** | Cloud | Intégré |
|
|
406
|
-
| 📦 **Dropbox** | Cloud | Intégré |
|
|
407
|
-
| 📋 **Core DMS** | GED | Intégré |
|
|
408
|
-
| 📦 **Box** | Cloud | [📖 docs/connectors/box.md](./docs/connectors/box.md) |
|
|
409
|
-
| ☁️ **AWS S3** | Cloud | [📖 docs/connectors/aws-s3.md](./docs/connectors/aws-s3.md) |
|
|
410
|
-
| 🔵 **Azure Blob** | Cloud | [📖 docs/connectors/azure-blob.md](./docs/connectors/azure-blob.md) |
|
|
411
|
-
| 📚 **Alfresco** | ECM | [📖 docs/connectors/alfresco.md](./docs/connectors/alfresco.md) |
|
|
412
|
-
| 📄 **SharePoint** | Office 365 | [📖 docs/connectors/sharepoint.md](./docs/connectors/sharepoint.md) |
|
|
413
|
-
| 🏛️ **Nuxeo** | ECM | [📖 docs/connectors/nuxeo.md](./docs/connectors/nuxeo.md) |
|
|
414
|
-
| 🏢 **OpenText** | ECM | [📖 docs/connectors/opentext.md](./docs/connectors/opentext.md) |
|
|
286
|
+
# Tests spécifiques
|
|
287
|
+
npm test -- permissions
|
|
288
|
+
npm test -- metadata
|
|
415
289
|
|
|
416
|
-
|
|
290
|
+
# Coverage
|
|
291
|
+
npm run test:coverage
|
|
292
|
+
```
|
|
417
293
|
|
|
418
|
-
|
|
419
|
-
# Sélection interactive
|
|
420
|
-
npm run dev -- --interactive
|
|
294
|
+
### Build
|
|
421
295
|
|
|
422
|
-
|
|
423
|
-
|
|
296
|
+
```bash
|
|
297
|
+
# Build TypeScript
|
|
298
|
+
npm run build
|
|
424
299
|
|
|
425
|
-
#
|
|
426
|
-
npm run dev
|
|
427
|
-
npm run dev -- --engine s3 --limit 100
|
|
300
|
+
# Watch mode
|
|
301
|
+
npm run dev
|
|
428
302
|
```
|
|
429
303
|
|
|
430
|
-
|
|
431
|
-
- ✅ Instructions de configuration
|
|
432
|
-
- 🔑 Obtention des tokens/credentials
|
|
433
|
-
- ⚙️ Paramètres supportés
|
|
434
|
-
- 🛠️ Troubleshooting
|
|
435
|
-
- 📋 Bonnes pratiques
|
|
304
|
+
---
|
|
436
305
|
|
|
437
|
-
|
|
306
|
+
## 📖 Documentation Complète
|
|
438
307
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
```
|
|
308
|
+
- **[Configuration Détaillée](./docs/configuration.md)** : OAuth2, env vars, troubleshooting
|
|
309
|
+
- **[Système de Permissions](./docs/permissions.md)** : Format, exemples, cas d'usage
|
|
310
|
+
- **[Gestion des Metadata](./docs/metadata.md)** : Format simplifié, objets imbriqués
|
|
311
|
+
- **[Exemples Pratiques](./docs/examples.md)** : Scripts, automatisation, cron jobs
|
|
444
312
|
|
|
445
|
-
|
|
446
|
-
```bash
|
|
447
|
-
# Créer onedrive-config.json
|
|
448
|
-
{
|
|
449
|
-
"accessToken": "votre_token_graph_explorer",
|
|
450
|
-
"limit": 10
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
# Créer core-config.json
|
|
454
|
-
{
|
|
455
|
-
"baseUrl": "https://votre-instance.core.fr",
|
|
456
|
-
"bearerToken": "votre_token_depuis_/users/token",
|
|
457
|
-
"limit": 10
|
|
458
|
-
}
|
|
459
|
-
```
|
|
313
|
+
---
|
|
460
314
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
#### **Core Token (le plus simple)**
|
|
464
|
-
1. 🌐 Ouvrez votre instance Core : `https://rec.plugandwork.fr` (ou votre URL)
|
|
465
|
-
2. 🔐 Connectez-vous avec vos identifiants
|
|
466
|
-
3. 📍 Naviguez vers : `https://rec.plugandwork.fr/users/token`
|
|
467
|
-
4. 📋 Copiez le token Bearer affiché sur la page
|
|
468
|
-
|
|
469
|
-
#### **OneDrive Token (Graph Explorer)**
|
|
470
|
-
1. 🌐 Ouvrez [Graph Explorer](https://developer.microsoft.com/en-us/graph/graph-explorer)
|
|
471
|
-
2. 🔐 Cliquez "Sign in to Graph Explorer"
|
|
472
|
-
3. 🔑 Connectez-vous avec votre compte Microsoft/Office 365
|
|
473
|
-
4. ⚙️ Cliquez sur l'onglet "Permissions"
|
|
474
|
-
5. ✅ Recherchez et demandez `Files.Read.All`
|
|
475
|
-
6. 🔄 Acceptez les permissions demandées
|
|
476
|
-
7. 📋 Copiez le token depuis l'en-tête `Authorization: Bearer ...`
|
|
477
|
-
|
|
478
|
-
#### **Dropbox Token (App Console)**
|
|
479
|
-
1. 🌐 Ouvrez [Dropbox App Console](https://www.dropbox.com/developers/apps)
|
|
480
|
-
2. ➕ Créez une nouvelle app
|
|
481
|
-
3. 🔧 Choisissez "Scoped access" et "Full Dropbox"
|
|
482
|
-
4. ⚙️ Allez dans les settings de votre app
|
|
483
|
-
5. 🔑 Générez un "Access Token"
|
|
484
|
-
6. 📋 Copiez le token généré
|
|
485
|
-
|
|
486
|
-
#### **Google Drive Token (plus complexe)**
|
|
487
|
-
1. 🌐 Ouvrez [Google Cloud Console](https://console.cloud.google.com/)
|
|
488
|
-
2. 📁 Créez un nouveau projet ou sélectionnez-en un
|
|
489
|
-
3. 🔧 Activez l'API Google Drive
|
|
490
|
-
4. 🔑 Créez des identifiants OAuth 2.0
|
|
491
|
-
5. ⚙️ Configurez les permissions et redirections
|
|
492
|
-
6. 🔄 Effectuez le flow OAuth2 pour obtenir un access token
|
|
493
|
-
|
|
494
|
-
💡 **Conseil** : Pour les tests, commencez par **Core** (le plus simple) ou **OneDrive** (Graph Explorer).
|
|
495
|
-
|
|
496
|
-
### Utilisation avancée
|
|
315
|
+
## 🤝 Support & Contributions
|
|
497
316
|
|
|
498
|
-
|
|
499
|
-
# Lister les plugins disponibles
|
|
500
|
-
npm run dev -- plugins
|
|
317
|
+
### Signaler un Bug
|
|
501
318
|
|
|
502
|
-
|
|
503
|
-
npm run dev -- connect onedrive --interactive
|
|
319
|
+
[Ouvrir une issue](https://github.com/your-org/hubdoc-tools/issues)
|
|
504
320
|
|
|
505
|
-
|
|
506
|
-
npm run dev -- plugin-scan connection-id --limit 5
|
|
321
|
+
### Proposer une Fonctionnalité
|
|
507
322
|
|
|
508
|
-
|
|
509
|
-
npm run dev -- plugin-import mapping.csv
|
|
510
|
-
```
|
|
323
|
+
[Créer une Feature Request](https://github.com/your-org/hubdoc-tools/issues/new?template=feature_request.md)
|
|
511
324
|
|
|
512
|
-
|
|
325
|
+
### Contribuer
|
|
513
326
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
│ ├── box/ # Box cloud storage plugin
|
|
528
|
-
│ ├── aws-s3/ # AWS S3 plugin
|
|
529
|
-
│ ├── azure-blob/ # Azure Blob Storage plugin
|
|
530
|
-
│ ├── alfresco/ # Alfresco ECM plugin
|
|
531
|
-
│ ├── sharepoint/ # SharePoint Online plugin
|
|
532
|
-
│ ├── nuxeo/ # Nuxeo ECM plugin
|
|
533
|
-
│ └── opentext/ # OpenText Content Server plugin
|
|
534
|
-
├── package.json
|
|
535
|
-
├── tsconfig.json
|
|
536
|
-
└── README-hubdoc-tool.md # Detailed documentation
|
|
537
|
-
```
|
|
327
|
+
1. Fork le repo
|
|
328
|
+
2. Créer une branche : `git checkout -b feature/amazing-feature`
|
|
329
|
+
3. Commit : `git commit -m 'Add amazing feature'`
|
|
330
|
+
4. Push : `git push origin feature/amazing-feature`
|
|
331
|
+
5. Ouvrir une Pull Request
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## 📄 Licence
|
|
336
|
+
|
|
337
|
+
MIT © [Sinoia]
|
|
338
|
+
|
|
339
|
+
---
|
|
538
340
|
|
|
539
|
-
##
|
|
341
|
+
## 🎯 Roadmap
|
|
540
342
|
|
|
541
|
-
|
|
343
|
+
- [ ] Support Azure Blob Storage
|
|
344
|
+
- [ ] Support Dropbox
|
|
345
|
+
- [ ] Interface Web (dashboard)
|
|
346
|
+
- [ ] Webhooks pour import temps-réel
|
|
347
|
+
- [ ] API REST pour intégrations
|
|
348
|
+
- [ ] Support multi-tenant
|
|
542
349
|
|
|
543
|
-
|
|
350
|
+
---
|
|
544
351
|
|
|
545
|
-
|
|
352
|
+
**Made with ❤️ by Sinoia**
|