Skip to content

Releases: sensedeep/dynamodb-onetable

v1.3.0

18 Apr 00:58
Compare
Choose a tag to compare

Minor Feature Release

Compatibility

The following items break compatibility

  • The optional params.metrics should now be an object to receive metrics for scan/find. Metrics are not returned on the items[], but are returned in the metrics object.

Features

  • None

Fixes

  • Fix metrics for find/scan. Now returned in metrics {}
  • Fixed TypeScript paginated results to return start and next properties on result. Added Paged type.
  • Fixed TypeScript OneParams.start type to be 'object' was 'boolean' #19

See

v1.2.6

13 Apr 05:50
Compare
Choose a tag to compare

Minor Patch Release

Features

  • None

Fixes

  • Fix import of Dynamo for AWS V3 users with Typescript #16

See

v1.2.5

13 Apr 04:26
Compare
Choose a tag to compare

Minor Patch Release

Features

  • None

Fixes

  • Fix TypeScript trailing semicolons #15
  • Fix TypeScript AnyModel missing constructor type

See

v1.2.4

13 Apr 02:43
Compare
Choose a tag to compare

Minor Patch Release

Features

  • None

Fixes

  • Fix TypeScript Table.intercept definition op. #15

See

v1.2.3

12 Apr 00:51
Compare
Choose a tag to compare

Minor Patch Release

Features

  • None

Fixes

  • Batch write with incorrect expression op. #14

See

v1.2.2

11 Apr 07:14
Compare
Choose a tag to compare

Minor Patch Release

Features

  • Models inherit table indexes by default.

Fixes

  • Fix model constructor for typescript. #13
  • Update README for TypeScript model constructor instructions

See

v1.2.1

07 Apr 20:28
Compare
Choose a tag to compare

Minor Patch Release

Features

  • None

Fixes

  • Fix missing extensions in index.js. #12

See

v1.2.0

06 Apr 22:44
Compare
Choose a tag to compare

Minor Feature Release

Features

  • Initial TypeScript schema typing support #9.

TypeScript Support

  • Model and Table APIs are typed. With TypeScript, the Model constructor is now generic.
  • Schemas dynamically converted to types without any manual step.
  • Schemas indexes and models are fully typed via the Table and Model constructor APIs.
  • Entity types created from schemas with access to properties fully typed.
  • The Model level API is fully typed -- this is the preferred access pattern.
  • The Table get/update/find APIs are not generic and not typed. You need to cast the return.

Basic TypeScript Usage

import {Entity, Model, Table} from 'dynamodb-onetable'
import DynamoDB from 'aws-sdk/clients/dynamodb'
import schema from './schema.js'

const client = new DynamoDB.DocumentClient()

const table = new Table({ name: 'MyTable', client, schema })

//.  Create an entity type
type Account = Entity<typeof schema.models.Account>

//.   Create an access model
let AccountModel = new Model<Account>(table, 'Account')

//.   Fully typed access for return entity and for get parameters and options
let account = await AccountModel.get({id: '1234'}, {log: true})

//.   Stand alone schema
let BlogSchema = {
    pk:        { type: String, value: 'blog:${email}' },

    email:     { type: String, required: true },
    message:{ type: String, required: true },
    date:      { type: Date, required: true },
}

//.   Add the schema
table.addModel('Blog', BlogSchema)

//.   Get an entity type
type Blog = Entity<typeof BlogSchema>

//.   Retrieve a model from the table. Cast required.
let BlogModel: Model<Blog> = table.getModel('Blog')

//.   Fully typed access
let blog = await BlogModel.get({email: 'roadrunner@acme.com'})
blog.email = 'coyote@acme.com'.   // OK
blog.unknown = 42. // Fail

//  Untyped parameters and result
blog = await table.get('Blog', {name: 'roadrunner@acme.com'})

Fixes

  • Fix schema mapping to warn if map components are missing in a write API

See

v1.1.0

04 Apr 01:54
Compare
Choose a tag to compare

Minor Milestone Release

Features

  • Add one-to-many attribute mapping
  • Support various binary types: Buffer, ArrayBuffer, DataView
  • Add params.transform for custom data format transformations
  • Add schema.index.follow to set a GSI into a global follow mode
  • Updated doc

One to Many attribute mapping

The schema field map property can be used to set an alternate or shorter attribute name when storing in the database. Previously, this map value was a simple string which defined the real attribute name.

This release allows the map value to be a two part pair of the form: 'obj.name'. Using this form the item property will be stored in an object attribute named "obj" with the given name. This allows multiple item properties to be aggregated together into a single attribute for storage in the DynamoDB table.

This is most useful for GSIs which project keys and a single data field to minimize the storage footprint of the index. Using one-to-many attribute mappings, multiple models (entities) can project different attributes into a single GSI data attribute. When coupled with sparse indexes, this makes using GSIs much more flexible and cost effective to implement your query access patterns.

Fixes

See

v1.0.0

22 Mar 02:47
Compare
Choose a tag to compare

Major Milestone Release

Features

  • Schema supported one-table access to DynamoDB APIs.
  • Efficient storage and access of multiple entities in a single DynamoDB table.
  • High level API with type marshaling, validations, and extended query capability for get/delete/update operations.
  • Bidirectional conversion of DynamoDB types to Javascript types.
  • Option to invoke DynamoDB or simply generate API parameters.
  • Generation of Conditional, Filter, Key and Update expressions.
  • Schema item definitions for attribute types, default values, enums and validations.
  • Powerful field level validations with required and transactional unique attributes.
  • Easy parameterization of filter and conditional queries.
  • Multi-page response aggregation.
  • Compound and templated key management.
  • Encrypted fields.
  • Support for Batch, Transactions, GSI, LSI indexes.
  • Intercept hooks to modify DynamoDB requests and responses.
  • Controllable logging to see exact parameter, data and responses.
  • Simple, easy to read source to modify (< 1000 lines).
  • Safety options to prevent "rm -fr *".
  • Integrated metrics.
  • No module dependencies.
  • Support for the AWS SDK v3 and v2

Fixes

  • None

See