Comparing version 0.3.6 to 0.3.7
@@ -16,4 +16,4 @@ 'use strict'; | ||
sessionToken: process.env.AWS_SESSION_TOKEN, | ||
region: process.env.SERVERLESS_REGION || 'us-east1', | ||
endpoint: process.env.DYNAMODB_ENDPOINT || 'http://localhost:8000' | ||
region: process.env.AWS_REGION || 'us-east-1', | ||
endpoint: process.env.AWS_DYNAMODB_ENDPOINT || 'http://localhost:8000' | ||
}; | ||
@@ -20,0 +20,0 @@ |
@@ -56,3 +56,5 @@ 'use strict'; | ||
* @param {string} opts.humanName - Custom human name (for errors). | ||
* @param {string} opts.table - Custom table to query from. | ||
* @param {string} opts.tablePrefix - Custom table to query from. | ||
* @param {string} opts.tableName - Custom table to query from. | ||
* @param {string} opts.tableSuffix - Custom table to query from. | ||
* @param {function(fields: object, fieldName: string): object} opts.validations - Validation function, should resolve the [modified] fields. | ||
@@ -69,10 +71,11 @@ */ | ||
opts.table = undefined; // todo: remove me. | ||
this.name = opts.name || schema.name; | ||
this.humanName = opts.humanName || _inflected2.default.humanize(this.name); | ||
this.table = (process.env.NODE_ENV === 'test' ? '_test_' : '') + (opts.table || _inflected2.default.tableize(schema.name)); | ||
this.fields = schema._typeConfig.fields(); | ||
this.defaultQueryKey = 'uuid'; // opts.defaultQueryKey || 'uuid'; // todo: implement defaultQueryKey | ||
this.validations = opts.validations; | ||
this.tablePrefix = opts.tablePrefix || ''; | ||
this.tableSuffix = opts.tableSuffix || ''; | ||
this.tableName = this.tablePrefix + (process.env.NODE_ENV === 'test' ? '_test_' : '') + (opts.tableName || _inflected2.default.tableize(schema.name)) + this.tableSuffix; | ||
} | ||
@@ -99,3 +102,3 @@ | ||
pyrope.findByIndex({ | ||
tableName: _this.table, | ||
tableName: _this.tableName, | ||
index: index | ||
@@ -141,3 +144,3 @@ }).then(function (records) { | ||
pyrope.all(_extends({ | ||
tableName: _this2.table | ||
tableName: _this2.tableName | ||
}, optsAll)).then(function (records) { | ||
@@ -198,3 +201,3 @@ if (records.Cursor) { | ||
pyrope.create({ | ||
tableName: _this3.table, | ||
tableName: _this3.tableName, | ||
fields: fields | ||
@@ -362,3 +365,3 @@ }).then(function (record) { | ||
pyrope.update({ | ||
tableName: _this4.table, | ||
tableName: _this4.tableName, | ||
index: index, | ||
@@ -502,3 +505,3 @@ fields: fields | ||
pyrope.destroy({ | ||
tableName: _this5.table, | ||
tableName: _this5.tableName, | ||
index: index | ||
@@ -557,3 +560,3 @@ }).then(function (record) { | ||
return pyrope.getAssociations({ | ||
tableName: (0, _utils.buildAssociationTableName)(_this5.name, currKey), | ||
tableName: (0, _utils.buildAssociationTableName)(_this5.name, currKey, _this5.tablePrefix, _this5.tableSuffix), | ||
items: [{ index: _defineProperty({}, parentIndexKey, parentIndexValue) }, { index: currKey }] | ||
@@ -659,3 +662,3 @@ }).then(function (assoc) { | ||
return new Promise(function (resolve, reject) { | ||
var tableName = _this6.table; | ||
var tableName = _this6.tableName; | ||
@@ -697,3 +700,3 @@ pyrope.count({ | ||
childIndexKey = _inflected2.default.underscore(_inflected2.default.singularize(childIndexKey)); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this7.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this7.name, childIndexKey, _this7.tablePrefix, _this7.tableSuffix); | ||
@@ -755,3 +758,3 @@ // console.log(tableName); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this8.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this8.name, childIndexKey, _this8.tablePrefix, _this8.tableSuffix); | ||
// console.log(tableName); | ||
@@ -793,3 +796,3 @@ | ||
var parentIndexValue = uuid; | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this9.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this9.name, childIndexKey, _this9.tablePrefix, _this9.tableSuffix); | ||
@@ -848,3 +851,3 @@ pyrope.getAssociations({ | ||
childIndexKey = _inflected2.default.underscore(_inflected2.default.singularize(childIndexKey)); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this10.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this10.name, childIndexKey, _this10.tablePrefix, _this10.tableSuffix); | ||
@@ -909,3 +912,3 @@ pyrope.getAssociations({ | ||
var childIndexKey = _inflected2.default.underscore(_inflected2.default.singularize(Object.keys(childIndex)[0])); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this11.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this11.name, childIndexKey, _this11.tablePrefix, _this11.tableSuffix); | ||
@@ -968,3 +971,3 @@ var items = void 0; | ||
var parentIndexValue = uuid; | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this12.name, childIndexKey); | ||
var tableName = opts.table || (0, _utils.buildAssociationTableName)(_this12.name, childIndexKey, _this12.tablePrefix, _this12.tableSuffix); | ||
// console.log(tableName); | ||
@@ -971,0 +974,0 @@ |
@@ -160,3 +160,3 @@ 'use strict'; | ||
var buildAssociationTableName = exports.buildAssociationTableName = function buildAssociationTableName(modelName, associationKey) { | ||
var buildAssociationTableName = exports.buildAssociationTableName = function buildAssociationTableName(modelName, associationKey, prefix, suffix) { | ||
var table = (0, _underscore.sortBy)([modelName, associationKey].map(function (t) { | ||
@@ -172,3 +172,3 @@ return _inflected2.default.tableize(t); | ||
return table; | ||
return (prefix || '') + table + (suffix || ''); | ||
}; | ||
@@ -175,0 +175,0 @@ |
{ | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"name": "pyrope", | ||
@@ -4,0 +4,0 @@ "description": "Pyrope is a Node.js promise-based ORM for GraphQL and AWS DynamoDB.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
96359
1895