Registry / data / leadconduit-integration

leadconduit-integration

JSON →
library0.6.3jsnpmunverified

The `leadconduit-integration` package provides a specialized set of Node.js utility functions designed to streamline the development of integrations with the LeadConduit platform. Currently at version 0.6.3, it offers core functionalities such as the `HttpError` class, which allows developers to construct immediate HTTP responses with specific status codes, headers, and body content for inbound integrations, effectively short-circuiting request processing. Additionally, it includes a `test.parser` helper, invaluable for simulating and parsing richly typed LeadConduit data during unit testing, transforming raw input objects into structured, validated data based on predefined request variable configurations. Given its highly specialized niche within the LeadConduit ecosystem, its release cadence is typically driven by internal development needs rather than a strict public schedule. Its primary differentiator is its direct utility for simplifying common integration patterns and data handling specific to the LeadConduit platform, abstracting away much of the boilerplate associated with bespoke integration development for that environment.

npm install leadconduit-integration
INSTALL
IMPORT
SIG · LEADCONDUIT-INTEGR
L
leadconduit-integration
datajavascriptv0.6.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HttpError
import { HttpError } from 'leadconduit-integration';
import HttpError from 'leadconduit-integration'; const HttpError = require('leadconduit-integration');
HttpError is a named export. The README shows CommonJS `require('leadconduit-integration').HttpError`, which is also a correct way to access it in CJS projects.
test.parser
import { test } from 'leadconduit-integration'; const parser = test.parser;
import { parser } from 'leadconduit-integration'; const parser = require('leadconduit-integration').parser;
The `parser` function is a nested utility under the `test` object. Access it via `test.parser` from the named ESM export, or `require('leadconduit-integration').test.parser` in CommonJS.
CommonJS named exports
const { HttpError, test } = require('leadconduit-integration');
const lcIntegration = require('leadconduit-integration'); // then expect lcIntegration.HttpError to be a class directly without destructuring
This is the idiomatic way to destructure named exports in CommonJS, providing direct access to `HttpError` and the `test` utility object.

Demonstrates how to handle immediate HTTP responses using `HttpError` in an inbound integration, and how to use `test.parser` to simulate and parse richly typed LeadConduit data for unit testing purposes.

import { HttpError, test } from 'leadconduit-integration'; // Example 1: Handling immediate HTTP responses in an inbound integration function handleIncomingRequest(req: { method?: string }): { status: number; body: string; headers?: Record<string, string> } { const method = req.method?.toLowerCase(); if (method !== 'get' && method !== 'post') { throw new HttpError( 415, { 'Content-Type': 'text/plain', Allow: 'GET, POST' }, `The ${method?.toUpperCase() || 'UNKNOWN'} method is not allowed` ); } console.log(`Processing ${method?.toUpperCase()} request...`); // ... actual request processing logic ... return { status: 200, body: 'Request handled successfully!' }; } try { handleIncomingRequest({ method: 'PUT' }); // Simulate an unsupported method } catch (e) { if (e instanceof HttpError) { console.log(`\nCaught HttpError: Status ${e.status}, Body: '${e.body}'`); } else { console.error(`\nAn unexpected error occurred: ${e instanceof Error ? e.message : String(e)}`); } } // Example 2: Using test.parser to simulate and parse richly typed data for tests const requestVariables = [ { name: 'zip_code', type: 'postal_code' }, { name: 'contact_phone', type: 'phone' }, { name: 'age_years', type: 'integer' }, { name: 'enrollment_date', type: 'date' } ]; const parseLeadData = test.parser(requestVariables); const rawLeadInput = { first_name: 'Alice', zip_code: '90210', contact_phone: '1-800-555-0199', age_years: '25', enrollment_date: '2023-11-15' }; const parsedLeadData = parseLeadData(rawLeadInput); console.log('\nParsed Lead Data for Testing:'); console.log(JSON.stringify(parsedLeadData, null, 2));
Debug
Known issues
breakingThis package is currently in a pre-1.0 release phase (v0.6.3). Breaking changes may be introduced in minor version updates without strictly adhering to semantic versioning for major increments. Always review the release notes carefully when upgrading.
fix
Always pin to exact versions or test thoroughly before deploying new minor versions in production environments. Refer to the GitHub repository for release notes and detailed changes.
affects: <1.0.0
gotchaThe documentation and examples primarily feature CommonJS (`require`) syntax. While the package supports ESM `import` statements, users integrating into pure ESM projects should ensure their build setup correctly handles named exports, especially for nested utilities like `test.parser`.
fix
For ESM, use named imports: `import { HttpError, test } from 'leadconduit-integration';`. For nested properties, access them directly: `const parser = test.parser;`.
affects: >=0.1.0
gotchaThis is a highly specialized utility module designed for LeadConduit integrations. Its concepts (e.g., 'request vars', 'type parser') are specific to the LeadConduit platform. Developers unfamiliar with LeadConduit's integration patterns might find it difficult to use without prior context.
fix
Refer to the official LeadConduit documentation for context on integration development and data structures before implementing with this library.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: require is not a function
Attempting to use `require()` in an ECMAScript Module (ESM) context without proper transpilation or a Node.js wrapper.
fix
Use ESM `import { HttpError, test } from 'leadconduit-integration';` instead of `require()`. Ensure your Node.js project is configured for ESM (e.g., `"type": "module"` in `package.json`) or use a bundler that handles CommonJS interoperability.
TypeError: HttpError is not a constructor
Incorrectly importing `HttpError` as a default export, or not accessing it as a named property from the `require()` result.
fix
Use named import `import { HttpError } from 'leadconduit-integration';` for ESM, or destructure from `require`: `const { HttpError } = require('leadconduit-integration');` for CommonJS.
TypeError: Cannot read properties of undefined (reading 'parser')
Attempting to access `parser` from an `undefined` `test` object, often due to incorrect import or destructuring of the `test` utility.
fix
Ensure `test` is correctly imported as a named export (`import { test } from 'leadconduit-integration';`) or accessed as a property of the main CommonJS `require` object (`const parser = require('leadconduit-integration').test.parser;`). Then, access `parser` via `test.parser`.
Upgrade
Version history
0.6.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
leadconduit-integration — npm install leadconduit-integration · libregistry