Registry / aws / cmp-aws-database

cmp-aws-database

JSON →
library1.7.1jsnpmunverified

Defines global tables for the Craft My Plate application ecosystem, providing a shared database schema and utilities for AWS-based deployments. Current stable version is 1.7.1, released as needed alongside the main application. It is tightly coupled with the Craft My Plate monorepo and is not designed for independent use. Export models include DynamoDB table definitions and helper functions for common database operations.

npm install cmp-aws-database
INSTALL
IMPORT
SIG · CMP-AWS-DATABASE
C
cmp-aws-database
awsjavascriptv1.7.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

UserTable
✓ import { UserTable } from 'cmp-aws-database'
✗ const UserTable = require('cmp-aws-database').UserTable
Package is ESM-only; require() will fail. Use named import.
RecipeTable
✓ import { RecipeTable } from 'cmp-aws-database'
✗ import RecipeTable from 'cmp-aws-database'
RecipeTable is a named export, not default. Do not use default import.
getDatabaseClient
✓ import { getDatabaseClient } from 'cmp-aws-database'
Function to obtain a configured DynamoDB client.

Initializes the database client and creates a user item in the UserTable.

import { UserTable, RecipeTable, getDatabaseClient } from 'cmp-aws-database'; const client = getDatabaseClient({ region: 'us-east-1', accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '' }); async function createUser(userId: string, name: string) { const params = { TableName: UserTable.name, Item: { userId, name, createdAt: new Date().toISOString() } }; await client.put(params).promise(); console.log('User created'); } createUser('123', 'Alice').catch(console.error);
Debug
Known issues
breakingVersion 2.0 removes support for Node.js 14 and below.
fix
Upgrade Node.js to version 16 or higher.
affects: >=2.0.0
gotchaTable names are defined as constants (e.g., 'cmp-users'). Do not hardcode table names; use the exported constants.
fix
Import the table constant (e.g., UserTable.name) to avoid mismatches.
affects: >=1.0.0
deprecatedThe function 'getDB' is deprecated in favor of 'getDatabaseClient'.
fix
Replace getDB() with getDatabaseClient().
affects: >=1.5.0
gotchaAll tables are defined in the us-east-1 region by default. If your stack uses a different region, you must override it in the client configuration.
fix
Pass region explicitly to getDatabaseClient().
affects: >=1.0.0
breakingIn version 1.6.0, the schema validation library changed from Joi to Zod. Existing implicit validation will break.
fix
Update validation logic to use Zod schemas exposed by the package.
affects: >=1.6.0 <1.6.0
Errors
Common errors & fixes
Cannot find module 'cmp-aws-database' or its corresponding type declarations.
The package is not installed or TypeScript cannot locate its types.
fix
Run 'npm install cmp-aws-database' and ensure tsconfig.json includes 'moduleResolution': 'node'.
TypeError: UserTable.name is undefined
Importing incorrectly (e.g., using default import instead of named import).
fix
Use 'import { UserTable } from 'cmp-aws-database''.
ValidationError: "name" is required
Missing required field when putting item into a table with Zod validation.
fix
Ensure all required fields per the Zod schema are provided in the item object.
Region is missing
getDatabaseClient() called without region option.
fix
Provide region in the config object to getDatabaseClient().
Upgrade
Version history
1.7.1latest on npm
Audit
Dependencies
aws-sdkrequiredRequired for AWS DynamoDB client and table operations.
zodoptionalUsed for schema validation of table items.
Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
1
Resources
cmp-aws-database — npm install cmp-aws-database · libregistry