@wanasapps/zcrm-core
v1.1.1
Published
Reusable Zoho CRM V8/V9 core services — 100% API surface coverage (405 operations / 28 services), OAuth2 auth, metadata extraction, standalone-function operations, and Deluge formatting.
Readme
@wanasapps/zcrm-core
Reusable Zoho CRM V8 core services, shared by Wanas Apps'
Zoho tooling — the zone CLI and the
Zoho CRM IDE Extension for VS Code.
It bundles the host-agnostic pieces:
authService— OAuth2 authorization-code + refresh flow with dependency-injection seams (configure({ credentials, store, logger, http }), asynchydrate(), a single-flight refresh mutex, and token revocation). No host assumptions.apiClient— Zoho V8 REST client with a global concurrency gate, automatic token refresh + rate-limit retries on reads, and a no-retry path (postNoRetry) for executing/mutating endpoints (so a function can't double-execute).crmMetadataService— the full org metadata extraction engine (extract(onProgress, outputDir, options)), writing the.zcrm/.store+crm/tree to an absoluteoutputDir.functionService— single standalone-function operations:getRemoteCode(read-only),pullOne,pushCode,createFunction,runTest/executeTest.delugeFormatter/delugeSignature— re-exports of@wanasapps/deluge-core. Deluge runs in nine Zoho products, so the language tooling lives there; these paths are kept so existing imports keep working. One implementation, so the extractor and other Deluge tools cannot format the same file differently.
Install
npm install @wanasapps/zcrm-core@wanasapps/deluge-core comes with it. @wanasapps/zoho-auth is an optional peer: install it
alongside and any tool that already signed in with the shared session gets these services for free
(no second login). Without it, zohoAuthAdapter.defaultPorts() returns null and your host must
inject its own credential/store ports via authService.configure().
Usage
const { authService, crmMetadataService } = require('@wanasapps/zcrm-core');
// or import a specific module by subpath:
const apiClient = require('@wanasapps/zcrm-core/src/utils/apiClient');Inject your host's storage/credentials/logger before authenticating:
authService.configure({ credentials, store, logger });
await authService.hydrate();
await crmMetadataService.extract(onProgress, '/abs/path/to/workspace', { concurrency: 5 });