Registry / storage / stentor-storage

stentor-storage

JSON →
library1.72.4jsnpmunverified

Stentor Storage provides a persistent storage abstraction for the stentor assistant framework. It defines StorageService interface and default implementations (DynamoDB, S3) for managing user-level data like session attributes, conversation state, and account linking tokens. Version 1.72.4 targets Node 12–24 (requires stentor-models 1.x). It is released as needed alongside stentor ecosystem packages. Key differentiator: opinionated schema with built-in encryption and TTL support, unlike generic storage libraries.

npm install stentor-storage
INSTALL
IMPORT
SIG · STENTOR-STORAGE
S
stentor-storage
storagejavascriptv1.72.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

StorageService
import { StorageService } from '@xapp/stentor-storage'
const { StorageService } = require('@xapp/stentor-storage')
TypeScript type, ESM import preferred. CJS require works but loses type inference.
DynamoStorageService
import { DynamoStorageService } from '@xapp/stentor-storage'
import DynamoStorageService from '@xapp/stentor-storage'
Named export only; default export not provided.
getStorage
import { getStorage } from '@xapp/stentor-storage'
Factory function that returns appropriate storage service based on configuration.
S3KeyValueStorage
import { S3KeyValueStorage } from '@xapp/stentor-storage'
import { S3KeyValueStore } from '@xapp/stentor-storage'
Exact name is S3KeyValueStorage, not Store.

Demonstrates two common usage patterns: using the factory function getStorage() with config, and directly instantiating DynamoStorageService with store() and retrieve() methods.

import { DynamoStorageService, getStorage } from '@xapp/stentor-storage'; import { UserData } from 'stentor-models'; // Option 1: Use factory with environment config const storage = getStorage({ provider: 'dynamo', tableName: 'users' }); await storage.store<UserData>('user123', { firstName: 'Jane' }); const data = await storage.retrieve<UserData>('user123'); // Option 2: Direct DynamoDB service const dyStorage = new DynamoStorageService({ tableName: process.env.DYNAMO_TABLE ?? 'stentor-users', region: 'us-east-1', }); await dyStorage.store('sess456', { intent: 'Greeting' }); const session = await dyStorage.retrieve('sess456');
Debug
Known issues
breakingIn v2.0.0 (upcoming), the factory function getStorage() will no longer accept a provider string; an options object is required.
fix
Update calls to getStorage({ provider: 'dynamo', ... }) instead of getStorage('dynamo', ...).
affects: >=1.0.0 <2.0.0
deprecatedS3KeyValueStorage is deprecated in favor of S3JsonStorage, which handles JSON serialization automatically.
fix
Replace S3KeyValueStorage usage with S3JsonStorage for new projects.
affects: >=1.50.0
gotchaThe store() method overwrites the entire object; partial updates must read-modify-write manually.
fix
Always retrieve data before store if you need to preserve existing fields.
affects: >=1.0.0
gotchaTTL is not automatically enabled; you must explicitly pass ttlInSeconds option to DynamoStorageService constructor.
fix
Add ttlInSeconds to DynamoStorageService options for auto-expiry.
affects: >=1.0.0
Errors
Common errors & fixes
ERROR: ValidationException: The provided key element does not match the schema
Using a non-existent hash key (e.g., 'id' instead of 'userId') on DynamoDB table.
fix
Verify that the table's hash key is 'userId' (default) or adjust DynamoStorageService keyAttribute option.
TypeError: storage.store is not a function
Importing DynamoStorageService as default instead of named export, or using module without stentor-models peer dependency.
fix
Check import: import { DynamoStorageService } from '@xapp/stentor-storage'. Ensure stentor-models is installed.
Error: The table 'xxx' does not exist.
DynamoDB table name missing or incorrect environment variable.
fix
Set DYNAMO_TABLE environment variable or pass tableName option to DynamoStorageService.
Upgrade
Version history
1.72.4latest on npm
Audit
Dependencies
stentor-modelsrequiredDefines StorageService interface and related types used by this package
Agent activity
17 hits · last 30 days
node
16
Resources
stentor-storage — npm install stentor-storage · libregistry