Esme R. 판매

ElectroDB is a TypeScript/Node.js library that simplifies DynamoDB single-table design by managing entity isolation, composite keys, complex queries, filters, and pagination with strong type inference.
ElectroDB is a DynamoDB modeling library that enforces attribute schemas, composes hierarchical sort-key access patterns, and generates type-safe query/mutation chains against a single DynamoDB table. The typical buyer is a backend Node.js or TypeScript team that needs a structured abstraction over raw DynamoDB calls without sacrificing single-table design flexibility.
clauses.js - Query/mutation clause chain builder; produces DynamoDB parameter objects from chained method calls.client.js - DynamoDB client normalization and config wiring for both v2 and v3 SDK clients.conversions.js - Attribute value conversion utilities between JavaScript types and DynamoDB's wire format.entity.js - Core Entity class; the primary unit of modeling (CRUD, queries, transactions).errors.js - Typed error classes for schema violations, missing keys, and invalid operations.events.js - EventManager for lifecycle hooks: query, results, error, etc.filterOperations.js - Low-level filter expression operators (begins_with, between, contains, etc.).filters.js - FilterFactory that wraps filter operations into a composable API.operations.js - ExpressionState and formatExpressionName; manages ExpressionAttributeNames/Values state.schema.js - Schema class; parses and validates the entity model definition.service.js - Service class; groups multiple entities to enable cross-entity collection queries.set.js - DynamoDBSet wrapper for DynamoDB Set attribute types.transaction.js - Transaction helpers for transactWrite and transactGet operations.types.js - Shared constants and enumerations (KeyTypes, MethodTypes, ItemOperations, etc.).update.js - UpdateExpression builder for composing complex update statements.updateOperations.js - Low-level update operators (set, remove, add, delete, append).격리된 샌드박스를 띄워 서버에서 바로 실행하세요 — 로컬 설정 불필요.
이 버전에 대한 Tetrees AI Review
This JavaScript library / package completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
파이프라인 avcp-2026-08-04.1 · SHA-256 dcf8af94a560c22d…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
검토일 2026년 8월 4일
이 제품을 AI IDE, 웹 빌더 또는 클라우드 IDE로 바로 가져오세요.
Tetrees를 호환 AI IDE에 연결해 보유 제품을 불러오고, 판매자 업로드 권한을 노출하지 않은 채 검증된 ZIP을 받으세요.
아직 리뷰가 없습니다.
토론을 불러오는 중…
util.js - Internal utility helpers (instance detection, model version inference, key building).validations.js - Schema validation functions used across the library.where.js - WhereFactory and FilterExpression; condition expression composition.npm install @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb @aws-sdk/util-dynamodb jsonschema
No native build steps, pod installs, or Expo prebuild steps are required. This is a pure Node.js library.
source/ directory into your project, e.g. src/lib/electrodb/.import { Entity } from "./lib/electrodb/entity";
import { Service } from "./lib/electrodb/service";
"moduleResolution": "node" and "esModuleInterop": true in tsconfig.json. The source uses CommonJS (require), so set "module": "commonjs" or use a bundler that handles CJS interop.import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
const dynamo = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
client and table name into each Entity or Service constructor via the config object.AWS_REGION and credential env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) or use an IAM role; ElectroDB does not manage credentials itself.class Entity {
constructor(model: object, config?: { client?: DynamoDBDocumentClient; table?: string; listeners?: Function[]; logger?: Function });
get(key: object): ChainState;
put(item: object): ChainState;
update(key: object): ChainState;
delete(key: object): ChainState;
query: Record<string, (composite: object) => ChainState>;
scan: ChainState;
find(attributes: object): ChainState;
match(attributes: object): ChainState;
}
Entity is the primary modeling primitive. Define your attribute schema and indexes in model, provide a configured DynamoDB client and table name, then call query or mutation methods that return chainable clause builders. Call .go() on any chain to execute against DynamoDB.
class Service {
constructor(entities: Record<string, Entity>, config?: { client?: DynamoDBDocumentClient; table?: string });
collections: Record<string, (composite: object) => ChainState>;
}
Service groups multiple Entity instances that share a table, enabling cross-entity collection queries. Use it when you need to retrieve items of different types (e.g., Order and OrderItem) in a single paginated DynamoDB query via shared sort-key prefixes.
class ExpressionState {
constructor(options?: { prefix?: string });
names: Record<string, string>;
values: Record<string, unknown>;
expression: string;
incrementName(name: string): string;
}
ExpressionState accumulates ExpressionAttributeNames, ExpressionAttributeValues, and the expression string while building filter or update expressions. It is used internally by FilterFactory and UpdateExpression but can be composed directly when extending the library with custom expression logic.
A straightforward entity with a composite primary key, queried by partition key with a sort-key begins_with condition.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { Entity } from "./lib/electrodb/entity";
const client = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
const Order = new Entity(
{
model: { entity: "order", version: "1", service: "store" },
attributes: {
storeId: { type: "string" },
orderId: { type: "string" },
status: { type: "string", default: "pending" },
total: { type: "number" },
createdAt: { type: "string", default: () => new Date().toISOString() },
},
indexes: {
byStore: {
pk: { field: "pk", composite: ["storeId"] },
sk: { field: "sk", composite: ["orderId"] },
},
},
},
{ client, table: "acme-table" }
);
// Query all orders for a store
const { data } = await Order.query.byStore({ storeId: "store-1" }).go();
console.log(data);
// Query with sort key prefix
const { data: recent } = await Order.query
.byStore({ storeId: "store-1" })
.begins({ orderId: "2024" })
.go();
console.log(recent);
Demonstrates the full mutation lifecycle for a single entity record.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { Entity } from "./lib/electrodb/entity";
const client = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
const Product = new Entity(
{
model: { entity: "product", version: "1", service: "catalog" },
attributes: {
productId: { type: "string" },
name: { type: "string", required: true },
price: { type: "number" },
inStock: { type: "boolean", default: true },
},
indexes: {
primary: {
pk: { field: "pk", composite: ["productId"] },
sk: { field: "sk", composite: [] },
},
},
},
{ client, table: "acme-table" }
);
// Create
await Product.put({ productId: "p-001", name: "Widget", price: 9.99 }).go();
// Read
const { data: item } = await Product.get({ productId: "p-001" }).go();
// Update price
await Product.update({ productId: "p-001" }).set({ price: 7.99 }).go();
// Conditional delete
await Product.delete({ productId: "p-001" })
.where(({ inStock }, op) => op.eq(inStock, true))
.go();
Two entities sharing a table are grouped in a Service and queried together via a named collection.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { Entity } from "./lib/electrodb/entity";
import { Service } from "./lib/electrodb/service";
const client = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
const config = { client, table: "acme-table" };
const Customer = new Entity({
model: { entity: "customer", version: "1", service: "crm" },
attributes: {
customerId: { type: "string" },
name: { type: "string" },
},
indexes: {
primary: {
collection: "customerProfile",
pk: { field: "pk", composite: ["customerId"] },
sk: { field: "sk", composite: [] },
},
},
}, config);
const Address = new Entity({
model: { entity: "address", version: "1", service: "crm" },
attributes: {
customerId: { type: "string" },
addressId: { type: "string" },
street: { type: "string" },
},
indexes: {
primary: {
collection: "customerProfile",
pk: { field: "pk", composite: ["customerId"] },
sk: { field: "sk", composite: ["addressId"] },
},
},
}, config);
const CrmService = new Service({ Customer, Address });
// Returns both customer and address items in one DynamoDB query
const { data } = await CrmService.collections
.customerProfile({ customerId: "c-999" })
.go();
console.log(data.customer); // Customer items
console.log(data.address); // Address items
.where(), .begins(), .between(), .go(), .params()); the surface developers call directly after .query or .update.normalizeConfig when wiring custom clients.Entity class; orchestrates schema parsing, key building, clause chaining, and event emission.ElectroError subclasses to distinguish schema vs. DynamoDB errors.EventManager registers and fires lifecycle events (query, results, error) for logging and instrumentation.FilterFactory wraps filterOperations into the .where() fluent API surface.ExpressionState accumulates names/values maps; formatExpressionName deduplicates reserved-word attribute names.Schema and AttributeTraverser parse the model definition, validate attribute types, and build composite key metadata.Service class joins multiple entities, infers collection indexes, and routes collection queries.DynamoDBSet wraps native SDK Set types for DynamoDB SS, NS, BS attributes.transactWrite/transactGet parameter objects.KeyTypes, MethodTypes, ItemOperations, etc.) consumed by every other module.UpdateExpression builder composes SET, REMOVE, ADD, DELETE clauses into a valid DynamoDB UpdateExpression string.WhereFactory and FilterExpression; builds ConditionExpression and FilterExpression strings for queries and mutations.DynamoDBDocumentClient; passing a v2 client will silently produce wrong results. Fix: always use @aws-sdk/lib-dynamodb.table in config - Omitting table from the config object causes runtime errors only at query time, not at construction. Fix: always pass { client, table: "your-table-name" } to every Entity.require(); if your project uses ESM ("type": "module"), imports will fail. Fix: use createRequire or set "module": "commonjs" in tsconfig.name, status, count, etc. collide with DynamoDB reserved words. ElectroDB handles this automatically via formatExpressionName, but only when accessed through its API; raw params bypass this.LastEvaluatedKey as a base64 URL-safe cursor. Do not parse or construct it manually; always pass it back via .go({ cursor: prev }).Service declare the same collection name but different pk/sk field names, queries will silently return empty results. Fix: ensure all entities sharing a collection use identical field values for pk and sk.I have the ElectroDB library source in `src/lib/electrodb/` and a usage guide in `USAGE.md`.
The upstream package is `user@example.com`.
Please help me integrate ElectroDB into my existing Node.js/TypeScript project step by step:
1. Read `USAGE.md` and the files under `src/lib/electrodb/` to understand the real exports and APIs.
2. Create an Entity definition for my [describe your data model] with attributes [list attributes] and indexes [describe access patterns].
3. Wire up the DynamoDBDocumentClient from `@aws-sdk/lib-dynamodb` using my existing AWS config.
4. Import `Entity` from `src/lib/electrodb/entity.js` and `Service` from `src/lib/electrodb/service.js`.
5. Write typed query functions for my access patterns using the `.query.<indexName>()` chain and `.go()`.
6. Add a mutation flow: put, update (with `.set()`), and conditional delete (with `.where()`).
7. If I have multiple entities sharing a table, group them in a `Service` and expose collection queries.
8. Show how to handle pagination using the cursor returned by `.go()`.
9. Do not invent any methods or exports not present in `USAGE.md` or the source files.
ElectroDB is released under the MIT license. See source/LICENSE if present, or refer to the npm package page and the upstream repository for the authoritative license text. Credit: Tyler Walch (@tywalch).
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
전체 설치 가이드와 연동 프롬프트는 구매 후 열람할 수 있습니다.
Automation, Utilities & Developer Tools
무료