@ingeno/pipedream-services 1.0.63 → 1.0.65
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/dist/aws/apn/partner-central-client.test.d.ts +2 -0
- package/dist/aws/apn/partner-central-client.test.d.ts.map +1 -0
- package/dist/aws/apn/partner-central-client.test.js +38 -0
- package/dist/aws/apn/partner-central-client.test.js.map +1 -0
- package/dist/aws/apn/zoho-crm/apn-opportunities-sync-step.test.d.ts +2 -0
- package/dist/aws/apn/zoho-crm/apn-opportunities-sync-step.test.d.ts.map +1 -0
- package/dist/aws/apn/zoho-crm/apn-opportunities-sync-step.test.js +34 -0
- package/dist/aws/apn/zoho-crm/apn-opportunities-sync-step.test.js.map +1 -0
- package/dist/aws/aws-list-stream.test.d.ts +3 -0
- package/dist/aws/aws-list-stream.test.d.ts.map +1 -0
- package/dist/aws/aws-list-stream.test.js +50 -0
- package/dist/aws/aws-list-stream.test.js.map +1 -0
- package/dist/collections/collections-to-table.test.d.ts +2 -0
- package/dist/collections/collections-to-table.test.d.ts.map +1 -0
- package/dist/collections/collections-to-table.test.js +105 -0
- package/dist/collections/collections-to-table.test.js.map +1 -0
- package/dist/collections/converter.test.d.ts +2 -0
- package/dist/collections/converter.test.d.ts.map +1 -0
- package/dist/collections/converter.test.js +304 -0
- package/dist/collections/converter.test.js.map +1 -0
- package/dist/postgres/posgres-test-config.d.ts +8 -0
- package/dist/postgres/posgres-test-config.d.ts.map +1 -0
- package/dist/postgres/posgres-test-config.js +8 -0
- package/dist/postgres/posgres-test-config.js.map +1 -0
- package/dist/postgres/postgres-test-connection.test.d.ts +2 -0
- package/dist/postgres/postgres-test-connection.test.d.ts.map +1 -0
- package/dist/postgres/postgres-test-connection.test.js +68 -0
- package/dist/postgres/postgres-test-connection.test.js.map +1 -0
- package/dist/postgres/postgres.d.ts.map +1 -1
- package/dist/postgres/postgres.js +5 -3
- package/dist/postgres/postgres.js.map +1 -1
- package/dist/postgres/postgres.test.d.ts +2 -0
- package/dist/postgres/postgres.test.d.ts.map +1 -0
- package/dist/postgres/postgres.test.js +497 -0
- package/dist/postgres/postgres.test.js.map +1 -0
- package/dist/streams/list-stream.test.d.ts +2 -0
- package/dist/streams/list-stream.test.d.ts.map +1 -0
- package/dist/streams/list-stream.test.js +169 -0
- package/dist/streams/list-stream.test.js.map +1 -0
- package/dist/zoho-crm/index.d.ts +1 -4
- package/dist/zoho-crm/index.d.ts.map +1 -1
- package/dist/zoho-crm/index.js +1 -4
- package/dist/zoho-crm/index.js.map +1 -1
- package/dist/zoho-crm/zoho-crm-client.d.ts +68 -0
- package/dist/zoho-crm/zoho-crm-client.d.ts.map +1 -1
- package/dist/zoho-crm/zoho-crm-client.js +216 -0
- package/dist/zoho-crm/zoho-crm-client.js.map +1 -1
- package/dist/zoho-crm/zoho-crm-client.test.d.ts +2 -0
- package/dist/zoho-crm/zoho-crm-client.test.d.ts.map +1 -0
- package/dist/zoho-crm/zoho-crm-client.test.js +341 -0
- package/dist/zoho-crm/zoho-crm-client.test.js.map +1 -0
- package/dist/zoho-crm/zoho-crm-fetcher.d.ts +2 -8
- package/dist/zoho-crm/zoho-crm-fetcher.d.ts.map +1 -1
- package/dist/zoho-crm/zoho-crm-fetcher.js +110 -28
- package/dist/zoho-crm/zoho-crm-fetcher.js.map +1 -1
- package/dist/zoho-crm/zoho-crm-to-database-collection-converter.d.ts +8 -0
- package/dist/zoho-crm/zoho-crm-to-database-collection-converter.d.ts.map +1 -0
- package/dist/zoho-crm/zoho-crm-to-database-collection-converter.js +117 -0
- package/dist/zoho-crm/zoho-crm-to-database-collection-converter.js.map +1 -0
- package/package.json +3 -2
- package/dist/zoho-crm/module-processor.d.ts +0 -8
- package/dist/zoho-crm/module-processor.d.ts.map +0 -1
- package/dist/zoho-crm/module-processor.js +0 -114
- package/dist/zoho-crm/module-processor.js.map +0 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
dotenv.config({ path: path.resolve(process.cwd(), '../../.env') });
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { beforeAll, describe, expect, it } from 'vitest';
|
|
5
|
+
import { zohoTestCredentials } from '@ingeno/pipedream-simulator';
|
|
6
|
+
import { ZohoCRMClient } from './zoho-crm-client.js';
|
|
7
|
+
describe('ZohoCRM Real Integration Tests', () => {
|
|
8
|
+
let client;
|
|
9
|
+
const testOpportunityId = `TEST-OPP-TO-DELETE`;
|
|
10
|
+
const testOpportunityName = `Test APN Opportunity - Safe to delete`;
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
console.log('🧪 Setting up real Zoho CRM integration test...');
|
|
13
|
+
const credentials = await zohoTestCredentials();
|
|
14
|
+
client = new ZohoCRMClient({
|
|
15
|
+
accessToken: credentials.oauth_access_token,
|
|
16
|
+
apiDomain: credentials.api_domain,
|
|
17
|
+
});
|
|
18
|
+
console.log('✅ Authenticated client created successfully');
|
|
19
|
+
}, 30000); // 30 second timeout for auth
|
|
20
|
+
it('should add an APN opportunity if it does not exist', async () => {
|
|
21
|
+
console.log('🧪 Testing real APN Opportunity creation...');
|
|
22
|
+
// Define the opportunity data to create
|
|
23
|
+
const opportunityData = {
|
|
24
|
+
Opportunity_Id: testOpportunityId,
|
|
25
|
+
Name: testOpportunityName,
|
|
26
|
+
Customer_Name: 'Test Customer Corp',
|
|
27
|
+
Opportunity_Type: 'Migration',
|
|
28
|
+
Status: 'Active',
|
|
29
|
+
Value: 75000,
|
|
30
|
+
Description: 'Test opportunity created by automated integration test',
|
|
31
|
+
Expected_Close_Date: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0], // 30 days from now
|
|
32
|
+
Stage: 'Prospecting',
|
|
33
|
+
Source: 'API Integration Test'
|
|
34
|
+
};
|
|
35
|
+
// Step 1: Search for existing opportunity with the same Opportunity_Id
|
|
36
|
+
console.log(`🔍 Searching for existing opportunity with ID: "${testOpportunityId}"`);
|
|
37
|
+
const searchResults = await client.searchAPNOpportunities(`Opportunity_Id:equals:${testOpportunityId}`, { fields: ['id', 'Opportunity_Id', 'Name', 'Customer_Name', 'Status'] });
|
|
38
|
+
let opportunityId;
|
|
39
|
+
if (searchResults.data && searchResults.data.length > 0) {
|
|
40
|
+
const opportunity = searchResults.data[0];
|
|
41
|
+
expect(opportunity).toBeDefined();
|
|
42
|
+
expect(opportunity.Opportunity_Id).toBe(testOpportunityId);
|
|
43
|
+
opportunityId = opportunity.id;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const createResult = await client.createAPNOpportunity(opportunityData);
|
|
47
|
+
expect(createResult).toBeDefined();
|
|
48
|
+
expect(createResult.code).toBe('SUCCESS');
|
|
49
|
+
opportunityId = createResult.details.id;
|
|
50
|
+
}
|
|
51
|
+
// Step 2: Verify we can retrieve the opportunity by ID
|
|
52
|
+
console.log(`🔍 Verifying opportunity can be retrieved by ID: ${opportunityId}`);
|
|
53
|
+
const retrievedOpportunity = await client.getAPNOpportunity(opportunityId);
|
|
54
|
+
expect(retrievedOpportunity).toBeDefined();
|
|
55
|
+
expect(retrievedOpportunity.id).toBe(opportunityId);
|
|
56
|
+
expect(retrievedOpportunity.Name).toBe(testOpportunityName);
|
|
57
|
+
// Step 3: Test updating the opportunity
|
|
58
|
+
console.log(`📝 Testing opportunity update...`);
|
|
59
|
+
const updateData = {
|
|
60
|
+
Description: `Updated by integration test at ${new Date().toISOString()}`,
|
|
61
|
+
Status: 'In Progress'
|
|
62
|
+
};
|
|
63
|
+
const updateResult = await client.updateAPNOpportunity(opportunityId, updateData);
|
|
64
|
+
expect(updateResult).toBeDefined();
|
|
65
|
+
expect(updateResult.details.id).toBe(opportunityId);
|
|
66
|
+
// Step 4 : Delete the test opportunity
|
|
67
|
+
console.log(`🗑️ Deleting test opportunity with ID: ${opportunityId}`);
|
|
68
|
+
const deleteResult = await client.deleteAPNOpportunity(opportunityId);
|
|
69
|
+
expect(deleteResult).toBe(true);
|
|
70
|
+
}, 120000);
|
|
71
|
+
it('should fetch deal stage history for existing deals', async () => {
|
|
72
|
+
console.log('🧪 Testing deal stage history fetching...');
|
|
73
|
+
// Step 1: Get a few deals to test with
|
|
74
|
+
console.log('📊 Fetching existing deals to test stage history...');
|
|
75
|
+
const deals = await client.getDeals({ maxRecords: 5 });
|
|
76
|
+
expect(deals).toBeDefined();
|
|
77
|
+
expect(Array.isArray(deals)).toBe(true);
|
|
78
|
+
if (deals.length === 0) {
|
|
79
|
+
console.log('⚠️ No deals found, skipping stage history test');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const testDeal = deals[0];
|
|
83
|
+
console.log(`🎯 Testing stage history for deal: ${testDeal.id} (${testDeal.Deal_Name || testDeal.Name || 'Unnamed Deal'})`);
|
|
84
|
+
// Step 2: Test basic stage history fetch
|
|
85
|
+
console.log('📈 Fetching stage history...');
|
|
86
|
+
const stageHistory = await client.getDealStageHistory(testDeal.id);
|
|
87
|
+
expect(stageHistory).toBeDefined();
|
|
88
|
+
expect(Array.isArray(stageHistory)).toBe(true);
|
|
89
|
+
console.log(`✅ Found ${stageHistory.length} stage history records`);
|
|
90
|
+
// Validate stage history structure if records exist
|
|
91
|
+
if (stageHistory.length > 0) {
|
|
92
|
+
const historyRecord = stageHistory[0];
|
|
93
|
+
console.log('📝 Sample stage history record:', JSON.stringify(historyRecord, null, 2));
|
|
94
|
+
expect(historyRecord).toBeDefined();
|
|
95
|
+
expect(typeof historyRecord).toBe('object');
|
|
96
|
+
}
|
|
97
|
+
// Step 3: Test paginated stage history fetch
|
|
98
|
+
console.log('📄 Testing paginated stage history fetch...');
|
|
99
|
+
const allStageHistory = await client.getAllDealStageHistory(testDeal.id, 10);
|
|
100
|
+
expect(allStageHistory).toBeDefined();
|
|
101
|
+
expect(Array.isArray(allStageHistory)).toBe(true);
|
|
102
|
+
expect(allStageHistory.length).toBeLessThanOrEqual(10);
|
|
103
|
+
console.log(`✅ Paginated fetch returned ${allStageHistory.length} records`);
|
|
104
|
+
// Step 4: Test streaming stage history
|
|
105
|
+
console.log('🌊 Testing stage history streaming...');
|
|
106
|
+
const stream = client.createDealStageHistoryStream(testDeal.id);
|
|
107
|
+
expect(stream).toBeDefined();
|
|
108
|
+
expect(typeof stream.subscribe).toBe('function');
|
|
109
|
+
console.log('✅ Stage history stream created successfully');
|
|
110
|
+
console.log('🎉 Deal stage history tests completed successfully');
|
|
111
|
+
}, 60000);
|
|
112
|
+
it('should fetch related list metadata for modules', async () => {
|
|
113
|
+
console.log('🧪 Testing related list metadata fetching...');
|
|
114
|
+
// Step 1: Test getting related list metadata for Deals module
|
|
115
|
+
console.log('🔗 Fetching related list metadata for Deals module...');
|
|
116
|
+
const dealsMetadata = await client.getRelatedListMetadata('Deals');
|
|
117
|
+
expect(dealsMetadata).toBeDefined();
|
|
118
|
+
expect(dealsMetadata.related_lists).toBeDefined();
|
|
119
|
+
expect(Array.isArray(dealsMetadata.related_lists)).toBe(true);
|
|
120
|
+
console.log(`✅ Found ${dealsMetadata.related_lists.length} related lists for Deals`);
|
|
121
|
+
// Step 2: Test structured related record types function
|
|
122
|
+
console.log('📋 Getting structured related record types for Deals...');
|
|
123
|
+
const relatedTypes = await client.getModuleRelatedRecordTypes('Deals');
|
|
124
|
+
expect(relatedTypes).toBeDefined();
|
|
125
|
+
expect(Array.isArray(relatedTypes)).toBe(true);
|
|
126
|
+
console.log(`✅ Found ${relatedTypes.length} related record types`);
|
|
127
|
+
// Validate structure of related types
|
|
128
|
+
if (relatedTypes.length > 0) {
|
|
129
|
+
const firstType = relatedTypes[0];
|
|
130
|
+
console.log('📝 Sample related type:', JSON.stringify(firstType, null, 2));
|
|
131
|
+
expect(firstType).toBeDefined();
|
|
132
|
+
expect(typeof firstType.api_name).toBe('string');
|
|
133
|
+
expect(typeof firstType.display_label).toBe('string');
|
|
134
|
+
expect(typeof firstType.sequence_number).toBe('number');
|
|
135
|
+
}
|
|
136
|
+
// Step 3: Test with Accounts module
|
|
137
|
+
console.log('🏢 Testing with Accounts module...');
|
|
138
|
+
const accountsRelatedTypes = await client.getModuleRelatedRecordTypes('Accounts');
|
|
139
|
+
expect(accountsRelatedTypes).toBeDefined();
|
|
140
|
+
expect(Array.isArray(accountsRelatedTypes)).toBe(true);
|
|
141
|
+
console.log(`✅ Found ${accountsRelatedTypes.length} related record types for Accounts`);
|
|
142
|
+
// Step 4: Test getting related records if we have any deals
|
|
143
|
+
if (relatedTypes.length > 0) {
|
|
144
|
+
console.log('🔍 Testing related records fetching...');
|
|
145
|
+
// Get a deal to test with
|
|
146
|
+
const deals = await client.getDeals({ maxRecords: 1 });
|
|
147
|
+
if (deals.length > 0) {
|
|
148
|
+
const testDeal = deals[0];
|
|
149
|
+
const firstRelatedType = relatedTypes[0];
|
|
150
|
+
console.log(`🎯 Testing related records for deal: ${testDeal.id}, related type: ${firstRelatedType.api_name}`);
|
|
151
|
+
try {
|
|
152
|
+
const relatedRecords = await client.getRelatedRecords('Deals', testDeal.id, firstRelatedType.api_name, { per_page: 5 });
|
|
153
|
+
expect(relatedRecords).toBeDefined();
|
|
154
|
+
expect(relatedRecords.data).toBeDefined();
|
|
155
|
+
expect(Array.isArray(relatedRecords.data)).toBe(true);
|
|
156
|
+
console.log(`✅ Found ${relatedRecords.data.length} related records of type ${firstRelatedType.api_name}`);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
console.log(`⚠️ Could not fetch related records for ${firstRelatedType.api_name}: ${error.message}`);
|
|
160
|
+
// This is expected for some related types that might not have data or permissions
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
console.log('🎉 Related list metadata tests completed successfully');
|
|
165
|
+
}, 60000);
|
|
166
|
+
it('should fetch pipeline information for Deals module', async () => {
|
|
167
|
+
console.log('🧪 Testing pipeline fetching...');
|
|
168
|
+
// Step 1: Test getting Deals layout ID
|
|
169
|
+
console.log('🏗️ Getting Deals layout ID...');
|
|
170
|
+
const layoutId = await client.getDealsLayoutId();
|
|
171
|
+
expect(layoutId).toBeDefined();
|
|
172
|
+
expect(typeof layoutId).toBe('string');
|
|
173
|
+
expect(layoutId.length).toBeGreaterThan(0);
|
|
174
|
+
console.log(`✅ Found Deals layout ID: ${layoutId}`);
|
|
175
|
+
// Step 2: Test getting pipelines using layout ID
|
|
176
|
+
console.log('🔧 Fetching pipelines using layout ID...');
|
|
177
|
+
const pipelinesRaw = await client.getPipelines(layoutId);
|
|
178
|
+
expect(pipelinesRaw).toBeDefined();
|
|
179
|
+
expect(pipelinesRaw.pipeline).toBeDefined();
|
|
180
|
+
expect(Array.isArray(pipelinesRaw.pipeline)).toBe(true);
|
|
181
|
+
console.log(`✅ Found ${pipelinesRaw.pipeline.length} pipeline(s) in raw response`);
|
|
182
|
+
// Step 3: Test structured pipeline details
|
|
183
|
+
console.log('📊 Getting structured pipeline details...');
|
|
184
|
+
const pipelineDetails = await client.getPipelineDetails(layoutId);
|
|
185
|
+
expect(pipelineDetails).toBeDefined();
|
|
186
|
+
expect(Array.isArray(pipelineDetails)).toBe(true);
|
|
187
|
+
console.log(`✅ Found ${pipelineDetails.length} structured pipeline(s)`);
|
|
188
|
+
// Validate pipeline structure if pipelines exist
|
|
189
|
+
if (pipelineDetails.length > 0) {
|
|
190
|
+
const firstPipeline = pipelineDetails[0];
|
|
191
|
+
console.log('📝 Sample pipeline:', JSON.stringify(firstPipeline, null, 2));
|
|
192
|
+
expect(firstPipeline).toBeDefined();
|
|
193
|
+
expect(typeof firstPipeline.id).toBe('string');
|
|
194
|
+
expect(typeof firstPipeline.display_value).toBe('string');
|
|
195
|
+
expect(typeof firstPipeline.default).toBe('boolean');
|
|
196
|
+
expect(Array.isArray(firstPipeline.stages)).toBe(true);
|
|
197
|
+
// Validate stage structure if stages exist
|
|
198
|
+
if (firstPipeline.stages.length > 0) {
|
|
199
|
+
const firstStage = firstPipeline.stages[0];
|
|
200
|
+
expect(firstStage).toBeDefined();
|
|
201
|
+
expect(typeof firstStage.id).toBe('string');
|
|
202
|
+
expect(typeof firstStage.display_value).toBe('string');
|
|
203
|
+
expect(typeof firstStage.sequence_number).toBe('number');
|
|
204
|
+
console.log(`✅ Pipeline "${firstPipeline.display_value}" has ${firstPipeline.stages.length} stages`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Step 4: Test convenience method for Deals pipelines
|
|
208
|
+
console.log('🎯 Testing convenience method for Deals pipelines...');
|
|
209
|
+
const dealsPipelines = await client.getDealsPipelines();
|
|
210
|
+
expect(dealsPipelines).toBeDefined();
|
|
211
|
+
expect(Array.isArray(dealsPipelines)).toBe(true);
|
|
212
|
+
expect(dealsPipelines.length).toBe(pipelineDetails.length);
|
|
213
|
+
console.log(`✅ Convenience method returned ${dealsPipelines.length} pipeline(s)`);
|
|
214
|
+
// Step 5: Test getting a specific pipeline if we have any
|
|
215
|
+
if (dealsPipelines.length > 0) {
|
|
216
|
+
const testPipelineId = dealsPipelines[0].id;
|
|
217
|
+
console.log(`🎯 Testing specific pipeline fetch for ID: ${testPipelineId}`);
|
|
218
|
+
const specificPipeline = await client.getDealsPipeline(testPipelineId);
|
|
219
|
+
expect(specificPipeline).toBeDefined();
|
|
220
|
+
expect(Array.isArray(specificPipeline)).toBe(true);
|
|
221
|
+
expect(specificPipeline.length).toBe(1);
|
|
222
|
+
expect(specificPipeline[0].id).toBe(testPipelineId);
|
|
223
|
+
console.log(`✅ Successfully fetched specific pipeline: ${specificPipeline[0].display_value}`);
|
|
224
|
+
}
|
|
225
|
+
console.log('🎉 Pipeline tests completed successfully');
|
|
226
|
+
}, 60000);
|
|
227
|
+
it('should explore available settings and configurations like pipelines', async () => {
|
|
228
|
+
console.log('🧪 Exploring other settings/configurations available in Zoho CRM...');
|
|
229
|
+
// Common settings endpoints that might exist
|
|
230
|
+
const settingsEndpoints = [
|
|
231
|
+
'/settings/modules',
|
|
232
|
+
'/settings/fields',
|
|
233
|
+
'/settings/layouts',
|
|
234
|
+
'/settings/pipeline',
|
|
235
|
+
'/settings/custom_views',
|
|
236
|
+
'/settings/roles',
|
|
237
|
+
'/settings/profiles',
|
|
238
|
+
'/settings/users',
|
|
239
|
+
'/settings/territories',
|
|
240
|
+
'/settings/currencies',
|
|
241
|
+
'/settings/custom_links',
|
|
242
|
+
'/settings/workflow',
|
|
243
|
+
'/settings/automation',
|
|
244
|
+
'/settings/blueprints',
|
|
245
|
+
'/settings/tags',
|
|
246
|
+
'/settings/related_lists',
|
|
247
|
+
'/settings/picklist_values',
|
|
248
|
+
'/settings/organization',
|
|
249
|
+
'/settings/company_details',
|
|
250
|
+
'/settings/preferences',
|
|
251
|
+
'/settings/variables',
|
|
252
|
+
'/settings/macros',
|
|
253
|
+
'/settings/email_templates',
|
|
254
|
+
'/settings/inventory_templates',
|
|
255
|
+
'/settings/attachments',
|
|
256
|
+
'/settings/notes',
|
|
257
|
+
'/settings/activities',
|
|
258
|
+
'/settings/forecasts',
|
|
259
|
+
'/settings/analytics',
|
|
260
|
+
'/settings/dashboard',
|
|
261
|
+
'/settings/reports',
|
|
262
|
+
'/settings/integrations',
|
|
263
|
+
'/settings/apis',
|
|
264
|
+
'/settings/webhooks',
|
|
265
|
+
'/settings/functions',
|
|
266
|
+
'/settings/canvas',
|
|
267
|
+
'/settings/widgets',
|
|
268
|
+
'/settings/zia'
|
|
269
|
+
];
|
|
270
|
+
const workingEndpoints = [];
|
|
271
|
+
const failedEndpoints = [];
|
|
272
|
+
for (const endpoint of settingsEndpoints) {
|
|
273
|
+
try {
|
|
274
|
+
console.log(`🔍 Testing: ${endpoint}`);
|
|
275
|
+
const response = await client.makeRequest(endpoint, {}, `explore ${endpoint}`);
|
|
276
|
+
console.log(`✅ SUCCESS: ${endpoint}`);
|
|
277
|
+
console.log(` Response keys: [${Object.keys(response).join(', ')}]`);
|
|
278
|
+
// Show sample data structure for interesting endpoints
|
|
279
|
+
if (response && typeof response === 'object') {
|
|
280
|
+
const firstKey = Object.keys(response)[0];
|
|
281
|
+
if (firstKey && Array.isArray(response[firstKey]) && response[firstKey].length > 0) {
|
|
282
|
+
const sampleItem = response[firstKey][0];
|
|
283
|
+
console.log(` Sample item keys: [${Object.keys(sampleItem).join(', ')}]`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
workingEndpoints.push(endpoint);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
console.log(`❌ FAILED: ${endpoint} - ${error.message}`);
|
|
290
|
+
failedEndpoints.push({ endpoint, error: error.message });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
console.log(`\n📊 Summary:`);
|
|
294
|
+
console.log(`✅ Working endpoints: ${workingEndpoints.length}`);
|
|
295
|
+
console.log(`❌ Failed endpoints: ${failedEndpoints.length}`);
|
|
296
|
+
console.log(`\n✅ Available Settings/Configurations:`);
|
|
297
|
+
workingEndpoints.forEach(endpoint => {
|
|
298
|
+
console.log(` - ${endpoint}`);
|
|
299
|
+
});
|
|
300
|
+
// Test some specific settings that we know work
|
|
301
|
+
console.log(`\n🔧 Testing specific working endpoints with parameters...`);
|
|
302
|
+
try {
|
|
303
|
+
// Test modules with specific module
|
|
304
|
+
console.log(`📋 Testing /settings/modules for specific module...`);
|
|
305
|
+
const moduleSettings = await client.makeRequest('/settings/modules/Deals', {}, 'get Deals module settings');
|
|
306
|
+
console.log(` Deals module settings keys: [${Object.keys(moduleSettings).join(', ')}]`);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
console.log(` ❌ Failed: ${error.message}`);
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
// Test fields with module parameter
|
|
313
|
+
console.log(`📝 Testing /settings/fields with module parameter...`);
|
|
314
|
+
const fieldsSettings = await client.makeRequest('/settings/fields?module=Deals', {}, 'get Deals fields settings');
|
|
315
|
+
console.log(` Deals fields count: ${fieldsSettings.fields?.length || 0}`);
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.log(` ❌ Failed: ${error.message}`);
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
// Test layouts with module parameter
|
|
322
|
+
console.log(`🏗️ Testing /settings/layouts with module parameter...`);
|
|
323
|
+
const layoutsSettings = await client.makeRequest('/settings/layouts?module=Deals', {}, 'get Deals layouts settings');
|
|
324
|
+
console.log(` Deals layouts count: ${layoutsSettings.layouts?.length || 0}`);
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
console.log(` ❌ Failed: ${error.message}`);
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
// Test organization settings
|
|
331
|
+
console.log(`🏢 Testing /settings/organization...`);
|
|
332
|
+
const orgSettings = await client.makeRequest('/settings/organization', {}, 'get organization settings');
|
|
333
|
+
console.log(` Organization settings keys: [${Object.keys(orgSettings).join(', ')}]`);
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
console.log(` ❌ Failed: ${error.message}`);
|
|
337
|
+
}
|
|
338
|
+
console.log('🎉 Settings exploration completed');
|
|
339
|
+
}, 120000); // Longer timeout for this comprehensive test
|
|
340
|
+
});
|
|
341
|
+
//# sourceMappingURL=zoho-crm-client.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoho-crm-client.test.js","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-client.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC,CAAA;AAElE,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,QAAQ,CAAC,gCAAgC,EAAE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GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,gCAAgC,EAAE,EAAE,EAAE,4BAA4B,CAAC,CAAA;YACpH,OAAO,CAAC,GAAG,CAAC,2BAA4B,eAAuB,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;QACzF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,gBAAiB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAA;QACzD,CAAC;QAED,IAAI,CAAC;YACH,6BAA6B;YAC7B,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;YACnD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,wBAAwB,EAAE,EAAE,EAAE,2BAA2B,CAAC,CAAA;YACvG,OAAO,CAAC,GAAG,CAAC,mCAAmC,MAAM,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,gBAAiB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAA;QACzD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;IAElD,CAAC,EAAE,MAAM,CAAC,CAAA,CAAC,6CAA6C;AAE1D,CAAC,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PostgresAuth } from '../index.js';
|
|
1
|
+
import type { PostgresAuth, ZohoCredentials } from '../index.js';
|
|
2
2
|
export interface ZohoCRMFetchOptions {
|
|
3
|
-
zohoCredentials:
|
|
3
|
+
zohoCredentials: ZohoCredentials;
|
|
4
4
|
postgresCredentials: PostgresAuth;
|
|
5
5
|
modules: string[];
|
|
6
6
|
maxResults?: number;
|
|
@@ -12,11 +12,5 @@ export interface ZohoCRMFetchResult {
|
|
|
12
12
|
records: number;
|
|
13
13
|
}>;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Reusable function to fetch data from Zoho CRM modules and save to PostgreSQL
|
|
17
|
-
*
|
|
18
|
-
* @param options Configuration options for the fetch operation
|
|
19
|
-
* @returns Summary of tables created and records processed
|
|
20
|
-
*/
|
|
21
15
|
export declare function fetchZohoCRMData(options: ZohoCRMFetchOptions): Promise<ZohoCRMFetchResult>;
|
|
22
16
|
//# sourceMappingURL=zoho-crm-fetcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoho-crm-fetcher.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-fetcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"zoho-crm-fetcher.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-fetcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,eAAe,CAAA;IAChC,mBAAmB,EAAE,YAAY,CAAA;IACjC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACnD;AAgJD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmBhG"}
|
|
@@ -1,43 +1,125 @@
|
|
|
1
|
-
import { ZohoCRMClient, ZohoAuth, collectionSummary, collectionsToTables, fillTables,
|
|
2
|
-
|
|
3
|
-
* Reusable function to fetch data from Zoho CRM modules and save to PostgreSQL
|
|
4
|
-
*
|
|
5
|
-
* @param options Configuration options for the fetch operation
|
|
6
|
-
* @returns Summary of tables created and records processed
|
|
7
|
-
*/
|
|
8
|
-
export async function fetchZohoCRMData(options) {
|
|
9
|
-
const { zohoCredentials, postgresCredentials, modules, maxResults, tablesPrefix = 'zoho_crm_' } = options;
|
|
10
|
-
// Initialize Zoho Auth and Client
|
|
1
|
+
import { ZohoCRMClient, ZohoAuth, collectionSummary, collectionsToTables, fillTables, convertZohoCRMModuleToDatabaseCollection } from '../index.js';
|
|
2
|
+
async function createAuthenticatedZohoCRMClient(zohoCredentials) {
|
|
11
3
|
const zohoAuth = new ZohoAuth(zohoCredentials);
|
|
12
4
|
const accessToken = await zohoAuth.getAccessToken();
|
|
13
|
-
|
|
5
|
+
return new ZohoCRMClient({
|
|
14
6
|
accessToken,
|
|
15
7
|
apiDomain: zohoCredentials.api_domain,
|
|
16
8
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
}
|
|
10
|
+
function addRequiredModuleDependencies(modules) {
|
|
11
|
+
const modulesWithDependencies = [...modules];
|
|
12
|
+
const shouldIncludePipelines = modules.includes('Deals');
|
|
13
|
+
if (shouldIncludePipelines && !modulesWithDependencies.includes('DealHistory')) {
|
|
14
|
+
modulesWithDependencies.push('DealHistory');
|
|
15
|
+
console.log('Added DealHistory module since Deals is included');
|
|
16
|
+
}
|
|
17
|
+
return { modulesWithDependencies, shouldIncludePipelines };
|
|
18
|
+
}
|
|
19
|
+
function buildCollectionSchema(name, columns, prepareMode = 'drop') {
|
|
20
|
+
return {
|
|
21
|
+
name,
|
|
22
|
+
prepareMode,
|
|
23
|
+
columns,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function buildPipelinesCollection(pipelinesData) {
|
|
27
|
+
const pipelinesSchema = buildCollectionSchema('pipelines', [
|
|
28
|
+
{ name: 'id', type: 'id' },
|
|
29
|
+
{ name: 'pipeline_id', path: 'id' },
|
|
30
|
+
{ name: 'display_value', type: 'text' },
|
|
31
|
+
{ name: 'default', type: 'bool' },
|
|
32
|
+
{ name: 'stages_count', transform: (pipeline) => pipeline.stages?.length || 0 },
|
|
33
|
+
{ name: 'stages_data', type: 'json', path: 'stages' },
|
|
34
|
+
]);
|
|
35
|
+
return {
|
|
36
|
+
schema: pipelinesSchema,
|
|
37
|
+
objects: pipelinesData.map((pipeline, index) => ({
|
|
38
|
+
id: index + 1,
|
|
39
|
+
...pipeline,
|
|
40
|
+
})),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function buildPipelineStagesCollection(pipelinesData) {
|
|
44
|
+
const flattenedStages = pipelinesData
|
|
45
|
+
.filter((pipeline) => pipeline.stages && Array.isArray(pipeline.stages))
|
|
46
|
+
.flatMap((pipeline) => pipeline.stages.map((stage) => ({
|
|
47
|
+
id: stage.id,
|
|
48
|
+
pipeline_id: pipeline.id,
|
|
49
|
+
pipeline_display_value: pipeline.display_value,
|
|
50
|
+
stage_id: stage.id,
|
|
51
|
+
stage_display_value: stage.display_value,
|
|
52
|
+
sequence_number: stage.sequence_number,
|
|
53
|
+
forecast_category: stage.forecast_category,
|
|
54
|
+
forecast_type: stage.forecast_type,
|
|
55
|
+
probability: stage.probability || 0,
|
|
56
|
+
})));
|
|
57
|
+
const stagesSchema = buildCollectionSchema('pipeline_stages', [
|
|
58
|
+
{ name: 'id', type: 'id' },
|
|
59
|
+
{ name: 'pipeline_id', type: 'text' },
|
|
60
|
+
{ name: 'pipeline_display_value', type: 'text' },
|
|
61
|
+
{ name: 'stage_id', type: 'text' },
|
|
62
|
+
{ name: 'stage_display_value', type: 'text' },
|
|
63
|
+
{ name: 'sequence_number', type: 'number' },
|
|
64
|
+
{ name: 'forecast_category', type: 'text' },
|
|
65
|
+
{ name: 'forecast_type', type: 'text' },
|
|
66
|
+
{ name: 'probability', type: 'number' },
|
|
67
|
+
]);
|
|
68
|
+
return {
|
|
69
|
+
schema: stagesSchema,
|
|
70
|
+
objects: flattenedStages,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async function fetchAndBuildPipelineCollections(client) {
|
|
74
|
+
console.log('Fetching Deals pipelines...');
|
|
75
|
+
try {
|
|
76
|
+
const pipelinesData = await client.getDealsPipelines();
|
|
77
|
+
const pipelinesCollection = buildPipelinesCollection(pipelinesData);
|
|
78
|
+
const pipelineStagesCollection = buildPipelineStagesCollection(pipelinesData);
|
|
79
|
+
console.log(`Processed ${pipelinesData.length} pipelines`);
|
|
80
|
+
console.log(`Processed ${pipelineStagesCollection.objects.length} pipeline stages`);
|
|
81
|
+
return [pipelinesCollection, pipelineStagesCollection];
|
|
25
82
|
}
|
|
26
|
-
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.warn('Failed to fetch pipelines:', error.message);
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function saveCollectionsAndCreateSummary(collections, postgresCredentials, tablesPrefix) {
|
|
27
89
|
collectionSummary(collections);
|
|
28
|
-
// Convert to table format
|
|
29
90
|
const tablesRows = collectionsToTables(collections);
|
|
30
|
-
// Fill PostgreSQL tables
|
|
31
91
|
await fillTables({
|
|
32
92
|
auth: postgresCredentials,
|
|
33
93
|
tablesRows,
|
|
34
94
|
tablesPrefix,
|
|
35
95
|
});
|
|
36
|
-
return {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
96
|
+
return collections.map((collection) => ({
|
|
97
|
+
table: `${tablesPrefix}${collection.schema.name}`,
|
|
98
|
+
records: collection.objects.length,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
function logFetchOperationDetails(modules, maxResults) {
|
|
102
|
+
console.log(`Fetching data from modules: ${modules.join(', ')}`);
|
|
103
|
+
console.log(`Max results per module: ${maxResults || 'all'}`);
|
|
104
|
+
}
|
|
105
|
+
async function fetchAllModuleCollections(modules, client, maxResults) {
|
|
106
|
+
return await Promise.all(modules.map(async (moduleName) => {
|
|
107
|
+
console.log(`Fetching ${moduleName}...`);
|
|
108
|
+
return await convertZohoCRMModuleToDatabaseCollection(moduleName, client, { maxRecords: maxResults || undefined });
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
export async function fetchZohoCRMData(options) {
|
|
112
|
+
const { zohoCredentials, postgresCredentials, modules, maxResults, tablesPrefix = 'zoho_crm_' } = options;
|
|
113
|
+
const client = await createAuthenticatedZohoCRMClient(zohoCredentials);
|
|
114
|
+
const { modulesWithDependencies, shouldIncludePipelines } = addRequiredModuleDependencies(modules);
|
|
115
|
+
logFetchOperationDetails(modulesWithDependencies, maxResults);
|
|
116
|
+
const moduleCollections = await fetchAllModuleCollections(modulesWithDependencies, client, maxResults);
|
|
117
|
+
const allCollections = [...moduleCollections];
|
|
118
|
+
if (shouldIncludePipelines) {
|
|
119
|
+
const pipelineCollections = await fetchAndBuildPipelineCollections(client);
|
|
120
|
+
allCollections.push(...pipelineCollections);
|
|
121
|
+
}
|
|
122
|
+
const summary = await saveCollectionsAndCreateSummary(allCollections, postgresCredentials, tablesPrefix);
|
|
123
|
+
return { summary };
|
|
42
124
|
}
|
|
43
125
|
//# sourceMappingURL=zoho-crm-fetcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoho-crm-fetcher.js","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"zoho-crm-fetcher.js","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAA;AAgB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EzG,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,eAAe,CAAC,CAAA;IACtE,MAAM,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAA;IAElG,wBAAwB,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAA;IAE7D,MAAM,iBAAiB,GAAG,MAAM,yBAAyB,CAAC,uBAAuB,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;IACtG,MAAM,cAAc,GAAG,CAAC,GAAG,iBAAiB,CAAC,CAAA;IAE7C,IAAI,sBAAsB,EAAE,CAAC;QAC3B,MAAM,mBAAmB,GAAG,MAAM,gCAAgC,CAAC,MAAM,CAAC,CAAA;QAC1E,cAAc,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,+BAA+B,CAAC,cAAc,EAAE,mBAAmB,EAAE,YAAY,CAAC,CAAA;IAExG,OAAO,EAAE,OAAO,EAAE,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Collection, CollectionSchema } from '../collections/types.js';
|
|
2
|
+
import type { ZohoCRMClient, ZohoCRMRecord } from './zoho-crm-client.js';
|
|
3
|
+
export interface ZohoCRMConversionOptions {
|
|
4
|
+
maxRecords?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function createDatabaseSchemaFromZohoCRMRecords(records: ZohoCRMRecord[], schemaName: string): CollectionSchema;
|
|
7
|
+
export declare function convertZohoCRMModuleToDatabaseCollection(moduleName: string, client: ZohoCRMClient, options?: ZohoCRMConversionOptions): Promise<Collection>;
|
|
8
|
+
//# sourceMappingURL=zoho-crm-to-database-collection-converter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoho-crm-to-database-collection-converter.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-to-database-collection-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAsB,MAAM,yBAAyB,CAAA;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAwHD,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAarH;AAED,wBAAsB,wCAAwC,CAC5D,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,UAAU,CAAC,CAmBrB"}
|