clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

model.dynamoCreateTableParams is not a function #160

Closed shierro closed 6 years ago

shierro commented 6 years ago

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
cdhowie commented 6 years ago

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

shierro commented 6 years ago

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

kevinswarner commented 5 years ago

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

cdhowie commented 5 years ago

@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.

kevinswarner commented 5 years ago

Ah. Thanks. Was looking at master of course.