wanas-zcrm-extractor 1.0.0 → 1.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 +186 -140
- package/bin/cli.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,140 +1,186 @@
|
|
|
1
|
-
# Zoho CRM V8 Metadata Extractor
|
|
2
|
-
|
|
3
|
-
A robust, production-quality
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
###
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1
|
+
# Zoho CRM V8 Metadata Extractor (`zcrm`)
|
|
2
|
+
|
|
3
|
+
A robust, production-quality CLI utility and local web dashboard designed to authenticate with Zoho CRM (OAuth2 V8 APIs) and extract all metadata, settings, and Deluge scripts into a structured, developer-friendly local directory structure.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🌟 Key Features
|
|
8
|
+
|
|
9
|
+
1. **Global CLI Wrapper (`zcrm`):** Command-line tools for authentication, data extraction, and starting the local web explorer dashboard.
|
|
10
|
+
2. **Standard ZDK CLI Directory Layout:** Writes module structures, layouts, fields, profiles, and roles in a format fully compatible with the standard Zoho ZDK CLI tool.
|
|
11
|
+
3. **Deluge Script Downloader:** Pulls custom function source codes, organizes them into folders by namespace, and saves them as local Deluge `.ds` files.
|
|
12
|
+
4. **Interactive Dashboard:** Launch a premium, glassmorphic dark-theme dashboard to review extracted modules, view field properties, search and filter APIs, and download structured ZIP archives of the exports.
|
|
13
|
+
5. **Robust Pipeline & Error Handling:**
|
|
14
|
+
- Interactive progress indicators showing modules and deluge functions as they download.
|
|
15
|
+
- Resilient Axios client with auto-refreshing OAuth tokens.
|
|
16
|
+
- Exponential backoff retry system to handle API rate limits (HTTP 429).
|
|
17
|
+
- Rich console results screen showing execution statistics.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🛠️ Installation
|
|
22
|
+
|
|
23
|
+
Install the CLI utility globally via npm:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g wanas-zcrm-extractor
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
*(Ensure you have [Node.js](https://nodejs.org/) v18+ installed on your system).*
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🔑 Setup & Registration
|
|
34
|
+
|
|
35
|
+
To authenticate, you must register a Zoho API Client in the Zoho Developer Console:
|
|
36
|
+
|
|
37
|
+
1. Visit the [Zoho Developer Console](https://api-console.zoho.com/).
|
|
38
|
+
2. Click **Add Client** and select **Server-based Applications**.
|
|
39
|
+
3. Configure your application details:
|
|
40
|
+
- **Client Name:** `Zoho CRM Metadata Extractor`
|
|
41
|
+
- **Homepage URL:** `http://localhost:3000`
|
|
42
|
+
- **Authorized Redirect URIs:** `http://localhost:3000/zoho/callback` (or your preferred local port redirect URI)
|
|
43
|
+
4. Click **Create** to receive your **Client ID** and **Client Secret**.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚀 CLI Commands Reference
|
|
48
|
+
|
|
49
|
+
### 1. `zcrm login`
|
|
50
|
+
Authenticates the CLI to access your Zoho CRM account.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
zcrm login [options]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Options:**
|
|
57
|
+
* `--client-id <id>` - Zoho OAuth Client ID.
|
|
58
|
+
* `--client-secret <secret>` - Zoho OAuth Client Secret.
|
|
59
|
+
* `--dc <dc>` - Zoho Data Center domain (`com`, `eu`, `in`, `jp`, `com.au`, `com.cn`).
|
|
60
|
+
* `--redirect-uri <uri>` - Zoho OAuth Redirect URI.
|
|
61
|
+
* `--refresh-token <token>` - Headless authentication option (bypasses browser authorization).
|
|
62
|
+
|
|
63
|
+
**Examples:**
|
|
64
|
+
* *Interactive Mode (Prompts for missing details):*
|
|
65
|
+
```bash
|
|
66
|
+
zcrm login
|
|
67
|
+
```
|
|
68
|
+
* *Express Login with Custom Credentials:*
|
|
69
|
+
```bash
|
|
70
|
+
zcrm login --client-id 1000.xxxxxxx --client-secret xxxxxxx --dc com --redirect-uri http://localhost:3000/zoho/callback
|
|
71
|
+
```
|
|
72
|
+
* *Headless Login (For CI/CD or Server Scripts):*
|
|
73
|
+
```bash
|
|
74
|
+
zcrm login --client-id 1000.xxxxxxx --client-secret xxxxxxx --dc com --refresh-token 1000.xxxxxxxxxxxxxxxxx
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 2. `zcrm pull`
|
|
80
|
+
Crawls all Zoho CRM endpoints to extract metadata schemas and custom functions deluge scripts.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
zcrm pull [options]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Options:**
|
|
87
|
+
* `-o, --output <dir>` - Destination folder path (defaults to `./metadata` in the current working directory).
|
|
88
|
+
|
|
89
|
+
**What happens during a pull:**
|
|
90
|
+
1. Verifies authentication and refreshes active OAuth access tokens automatically.
|
|
91
|
+
2. Fetches Zoho Org information and sets up local project mapping configs.
|
|
92
|
+
3. Crawls every module to pull field configurations and page layout schemas (with a beautiful progress indicator).
|
|
93
|
+
4. Fetches Profiles, Roles, and Webhooks settings.
|
|
94
|
+
5. Downloads all custom deluge function scripts.
|
|
95
|
+
6. Compiles a consolidated database of schemas and summaries.
|
|
96
|
+
7. Prints a rich-text CLI banner and statistics summary showing the number of modules, layouts, and fields processed.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 3. `zcrm dashboard`
|
|
101
|
+
Launches the premium local web dashboard to explore the pulled metadata in a browser.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
zcrm dashboard [options]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Options:**
|
|
108
|
+
* `-p, --port <port>` - Port to run the dashboard on (defaults to `3000`).
|
|
109
|
+
|
|
110
|
+
Once launched, navigate to **`http://localhost:3000`** in your browser. From here, you can:
|
|
111
|
+
- View live extraction logs.
|
|
112
|
+
- Browse extracted modules, inspect field tables, view picklist values, and lookup relationships.
|
|
113
|
+
- Search and filter across field names.
|
|
114
|
+
- Download a consolidated `.zip` file of all extracted files.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### 4. `zcrm logout`
|
|
119
|
+
Clears stored configuration credentials, OAuth tokens, and active sessions from the workspace.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
zcrm logout
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 📂 Generated Directory Structure
|
|
128
|
+
|
|
129
|
+
When running `zcrm pull -o ./metadata`, the following layout is compiled inside the output folder:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
metadata/
|
|
133
|
+
├── .zdk/ # Internal ZDK CLI stores
|
|
134
|
+
│ ├── .logs/ # Extractor logging files and audit history
|
|
135
|
+
│ ├── .org/
|
|
136
|
+
│ │ └── org.json # Extracted Zoho CRM Organization metadata
|
|
137
|
+
│ └── .store/ # Extracted cached index formats
|
|
138
|
+
│ ├── index.json # Master index of extracted modules
|
|
139
|
+
│ ├── modules_raw.json # Raw API modules catalog response
|
|
140
|
+
│ ├── field_map.json # Key-value map of every field's data type
|
|
141
|
+
│ ├── complete_metadata.json # Unified JSON database of all endpoints
|
|
142
|
+
│ ├── webhooks.json # Extracted webhooks metadata
|
|
143
|
+
│ └── functions.json # Extracted functions catalog
|
|
144
|
+
│
|
|
145
|
+
├── crm/ # Standard Zoho ZDK CLI metadata layout
|
|
146
|
+
│ └── meta/
|
|
147
|
+
│ ├── modules/ # Individual Module schemas
|
|
148
|
+
│ │ └── <Module_API_Name>/
|
|
149
|
+
│ │ ├── <Module_API_Name>.modules-meta.json
|
|
150
|
+
│ │ ├── fields/ # Field configurations
|
|
151
|
+
│ │ │ └── <Field_API_Name>.fields-meta.json
|
|
152
|
+
│ │ └── layouts/ # Page Layout configurations
|
|
153
|
+
│ │ └── <Layout_API_Name>.layouts-meta.json
|
|
154
|
+
│ ├── profiles/ # Profile Permissions mapping
|
|
155
|
+
│ │ └── <Profile_Name>.profiles-meta.json
|
|
156
|
+
│ └── roles/ # Role Hierarchy definitions
|
|
157
|
+
│ └── <Role_Name>.roles-meta.json
|
|
158
|
+
│
|
|
159
|
+
├── functions/ # Custom Deluge function files (.ds)
|
|
160
|
+
│ ├── standalone/ # Deluge scripts sorted by namespace
|
|
161
|
+
│ │ └── standalone.<Function_API_Name>.ds
|
|
162
|
+
│ ├── automation/
|
|
163
|
+
│ ├── button/
|
|
164
|
+
│ ├── related_list/
|
|
165
|
+
│ ├── schedule/
|
|
166
|
+
│ └── salessignals/
|
|
167
|
+
│
|
|
168
|
+
├── extra/ # Custom analysis exports
|
|
169
|
+
│ └── modules/
|
|
170
|
+
│ └── <Module_API_Name>/
|
|
171
|
+
│ ├── summary.json # Custom module summary (counts, fields, picklists, formulas)
|
|
172
|
+
│ ├── custom_views/ # Custom View configuration JSONs
|
|
173
|
+
│ │ └── <View_API_Name>.custom_views-meta.json
|
|
174
|
+
│ └── related_lists/ # Related List configurations
|
|
175
|
+
│ └── <List_API_Name>.related_lists-meta.json
|
|
176
|
+
│
|
|
177
|
+
├── zdk-project.json # ZDK CLI project settings config
|
|
178
|
+
├── meta.json # ZDK resource configuration
|
|
179
|
+
└── .zdkignore # Standard gitignore rules for ZDK caches
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 🤝 Contribution & License
|
|
185
|
+
|
|
186
|
+
This project is maintained by Wanas Apps and licensed under the **ISC License**. For queries or feedback, feel free to contact us.
|
package/bin/cli.js
CHANGED
|
@@ -57,11 +57,13 @@ function drawProgress(current, total, label, action) {
|
|
|
57
57
|
process.stdout.write(`\x1b[34m[${bar}]\x1b[0m \x1b[1;32m${percent}%\x1b[0m | \x1b[1m${label}\x1b[0m: ${truncatedAction}`);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
const pkg = require('../package.json');
|
|
61
|
+
|
|
60
62
|
// Version and metadata configuration
|
|
61
63
|
program
|
|
62
64
|
.name('zcrm')
|
|
63
65
|
.description('Zoho CRM V8 Metadata Extractor CLI Utility')
|
|
64
|
-
.version(
|
|
66
|
+
.version(pkg.version, '-v, --version', 'output the current version')
|
|
65
67
|
.addHelpText('before', getBanner());
|
|
66
68
|
|
|
67
69
|
/**
|