Registry / serialization / messaging-api-common

messaging-api-common

JSON →
library1.0.4jsnpmunverified

messaging-api-common provides shared utilities (case conversion and Axios request interceptors) for the messaging-apis family of chatbot SDKs (Messenger, LINE, Slack, Viber, Telegram). Currently at v1.0.4 (Jan 2021) with no further releases; the project has moved to v1.1.x of other packages but this common package remains unchanged. Keys differ from alternatives by offering both shallow and deep snakecase/camelcase/pascalcase conversions plus a factory for Axios interceptors. TypeScript types are included.

npm install messaging-api-common
INSTALL
IMPORT
SIG · MESSAGING-API-COMM
M
messaging-api-common
serializationjavascriptv1.0.4
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.

snakecaseKeysDeep
import { snakecaseKeysDeep } from 'messaging-api-common'
const { snakecaseKeysDeep } = require('messaging-api-common')
Package supports both ESM and CJS. Use ESM for tree-shaking.
camelcaseKeys
import { camelcaseKeys } from 'messaging-api-common'
const camelcaseKeys = require('messaging-api-common').camelcaseKeys
Named export, not default.
createRequestInterceptor
import { createRequestInterceptor } from 'messaging-api-common'
import createRequestInterceptor from 'messaging-api-common'
It's a named export, not default.

Demonstrates deep snakecase conversion, shallow camelcase conversion, and adding an Axios request interceptor.

import { snakecaseKeysDeep, camelcaseKeys, createRequestInterceptor } from 'messaging-api-common'; import axios from 'axios'; // Case conversion const original = { fooBar: { barFoo: 1, bazQux: [ { nestedKey: true } ] } }; const snake = snakecaseKeysDeep(original); console.log(snake); // { foo_bar: { bar_foo: 1, baz_qux: [ { nested_key: true } ] } } const camel = camelcaseKeys(snake.foo_bar, { deep: false }); console.log(camel); // { barFoo: 1 } // Axios interceptor const instance = axios.create({ baseURL: 'https://api.example.com' }); instance.interceptors.request.use(createRequestInterceptor()); instance.get('/data').then(console.log);
Debug
Known issues
gotchasnakecaseKeys and camelcaseKeys do NOT deep-convert by default. Use snakecaseKeysDeep and camelcaseKeysDeep for deep conversion.
fix
Use the *Deep variants for recursive conversion.
affects: >=1.0.0
deprecatedThe package is no longer actively maintained; major version 1.0.0 introduced breaking changes (camelcase keys).
fix
Migrate to newer messaging-apis packages that include these utilities internally.
affects: 1.0.0
gotchapascalcaseKeys does NOT handle arrays properly; it converts array elements to PascalCase strings which may not be intended.
fix
Manually handle arrays or use a custom conversion function.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'snakecaseKeysDeep' of 'require(...)' as it is undefined.
Using CJS require on a package that resolves to ESM in some bundler configurations.
fix
Use import syntax or set type: 'module' in package.json and use import.
Error: Cannot find module 'messaging-api-common'
Package not installed or bundler misconfigured.
fix
Run 'npm install messaging-api-common' and ensure the package is in 'dependencies'.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
messaging-api-common — npm install messaging-api-common · libregistry