clarkie/dynogels

model.dynamoCreateTableParams is not a function

Closed this issue · 5 comments

Hi!

Thanks for creating this library. it just works!

I have a small case here,

const dynogels = require('dynogels');
const Joi = require('joi');

const indexes = [
  {
    hashKey: 'id',
    rangeKey: 'dateCreated',
    type: 'global',
    name: 'dateCreatedIndex',
  },
  {
    hashKey: 'id',
    rangeKey: 'userId',
    type: 'global',
    name: 'userIdIndex',
  },
];

const schema = {
  id: dynogels.types.uuid(),
  userId: Joi.string(),
  itemType: Joi.string(),
  dateUpdated: Joi.string(),
  dateCreated: Joi.string(),
};

const schemaDefinition = {
  hashKey: 'id',
  rangeKey: 'dateCreated',
  timestamps: true,
  updatedAt: 'dateUpdated',
  createdAt: 'dateCreated',
  schema,
  indexes,
  validation: { allowUnknown: false },
};

const model = dynogels.define('testTable', schemaDefinition);

// here, this function
const params = model.dynamoCreateTableParams();

it gives me

(node:31741) UnhandledPromiseRejectionWarning: TypeError: model.dynamoCreateTableParams is not a function

This function is in the current master but we haven't done an npm release since adding this function. If you want to use this function before we push a new release, you can install the module from github.

This is the documentation from the latest release: https://github.com/clarkie/dynogels/blob/v9.0.0/README.md

ok that makes sense, because I searched for the function on node_modules package and it does not exist. thanks for the heads up though

Thanks for the library! This feature is in the current docs. Is this going to be published to NPM soon?

@kevinswarner The readme on Github will always show the version from master, not the current release. See npm for documentation on the current npm release.

Ah. Thanks. Was looking at master of course.