@ingeno/pipedream-services 1.0.57 → 1.0.58
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/zoho-crm/index.d.ts +1 -0
- package/dist/zoho-crm/index.d.ts.map +1 -1
- package/dist/zoho-crm/index.js +1 -0
- package/dist/zoho-crm/index.js.map +1 -1
- package/dist/zoho-crm/zoho-crm-fetcher.d.ts +22 -0
- package/dist/zoho-crm/zoho-crm-fetcher.d.ts.map +1 -0
- package/dist/zoho-crm/zoho-crm-fetcher.js +43 -0
- package/dist/zoho-crm/zoho-crm-fetcher.js.map +1 -0
- package/package.json +1 -1
package/dist/zoho-crm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA"}
|
package/dist/zoho-crm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zoho-crm/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zoho-crm/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PostgresAuth } from '../index.js';
|
|
2
|
+
export interface ZohoCRMFetchOptions {
|
|
3
|
+
zohoCredentials: any;
|
|
4
|
+
postgresCredentials: PostgresAuth;
|
|
5
|
+
modules: string[];
|
|
6
|
+
maxResults?: number;
|
|
7
|
+
tablesPrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ZohoCRMFetchResult {
|
|
10
|
+
summary: Array<{
|
|
11
|
+
table: string;
|
|
12
|
+
records: number;
|
|
13
|
+
}>;
|
|
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
|
+
export declare function fetchZohoCRMData(options: ZohoCRMFetchOptions): Promise<ZohoCRMFetchResult>;
|
|
22
|
+
//# sourceMappingURL=zoho-crm-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoho-crm-fetcher.d.ts","sourceRoot":"","sources":["../../src/zoho-crm/zoho-crm-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8F,YAAY,EAAE,MAAM,aAAa,CAAA;AAEtI,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,GAAG,CAAA;IACpB,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;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiDhG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ZohoCRMClient, ZohoAuth, collectionSummary, collectionsToTables, fillTables, processModule } from '../index.js';
|
|
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
|
|
11
|
+
const zohoAuth = new ZohoAuth(zohoCredentials);
|
|
12
|
+
const accessToken = await zohoAuth.getAccessToken();
|
|
13
|
+
const client = new ZohoCRMClient({
|
|
14
|
+
accessToken,
|
|
15
|
+
apiDomain: zohoCredentials.api_domain
|
|
16
|
+
});
|
|
17
|
+
console.log(`Fetching data from modules: ${modules.join(', ')}`);
|
|
18
|
+
console.log(`Max results per module: ${maxResults || 'all'}`);
|
|
19
|
+
const collections = [];
|
|
20
|
+
// Process each module using the generic processor
|
|
21
|
+
for (const moduleName of modules) {
|
|
22
|
+
console.log(`Fetching ${moduleName}...`);
|
|
23
|
+
const collection = await processModule(moduleName, client, { maxRecords: maxResults || undefined });
|
|
24
|
+
collections.push(collection);
|
|
25
|
+
}
|
|
26
|
+
// Log summary
|
|
27
|
+
collectionSummary(collections);
|
|
28
|
+
// Convert to table format
|
|
29
|
+
const tablesRows = collectionsToTables(collections);
|
|
30
|
+
// Fill PostgreSQL tables
|
|
31
|
+
await fillTables({
|
|
32
|
+
auth: postgresCredentials,
|
|
33
|
+
tablesRows,
|
|
34
|
+
tablesPrefix
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
summary: collections.map(c => ({
|
|
38
|
+
table: `${tablesPrefix}${c.schema.name}`,
|
|
39
|
+
records: c.objects.length
|
|
40
|
+
}))
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=zoho-crm-fetcher.js.map
|
|
@@ -0,0 +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,aAAa,EAAgB,MAAM,aAAa,CAAA;AActI;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA4B;IACjE,MAAM,EACJ,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,UAAU,EACV,YAAY,GAAG,WAAW,EAC3B,GAAG,OAAO,CAAA;IAEX,kCAAkC;IAClC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAA;IAC9C,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAA;IAEnD,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC;QAC/B,WAAW;QACX,SAAS,EAAE,eAAe,CAAC,UAAU;KACtC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAChE,OAAO,CAAC,GAAG,CAAC,2BAA2B,UAAU,IAAI,KAAK,EAAE,CAAC,CAAA;IAE7D,MAAM,WAAW,GAAG,EAAE,CAAA;IAEtB,kDAAkD;IAClD,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,YAAY,UAAU,KAAK,CAAC,CAAA;QACxC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,IAAI,SAAS,EAAE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