electrodb
Advanced tools
Comparing version 0.9.47 to 0.9.48
{ | ||
"name": "electrodb", | ||
"version": "0.9.47", | ||
"version": "0.9.48", | ||
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const { QueryTypes, MethodTypes } = require("./types"); | ||
const v = require("./validations"); | ||
const e = require("./errors"); | ||
@@ -360,2 +361,5 @@ | ||
action(entity, state, options = {}) { | ||
if (!v.isStringHasLength(options.table) && !v.isStringHasLength(entity._getTableName())) { | ||
throw new e.ElectroError(e.ErrorCodes.MissingTable, `Table name not defined. Table names must be either defined on the model, instance configuration, or as a query option.`); | ||
} | ||
if (state.query.method === MethodTypes.query) { | ||
@@ -362,0 +366,0 @@ return entity._queryParams(state, options); |
@@ -467,3 +467,3 @@ "use strict"; | ||
if (option.limit) config.params.Limit = option.limit; | ||
if (option.table) config.params.Limit = option.table; | ||
if (option.table) config.params.TableName = option.table; | ||
config.page = Object.assign({}, config.page, option.page); | ||
@@ -1483,3 +1483,7 @@ config.params = Object.assign({}, config.params, option.params); | ||
if (seenIndexes[indexName] !== undefined) { | ||
throw new e.ElectroError(e.ErrorCodes.DuplicateIndexes, `Duplicate index defined in model: ${accessPattern} ${indexName || "(PRIMARY INDEX)"}`); | ||
if (indexName === "") { | ||
throw new e.ElectroError(e.ErrorCodes.DuplicateIndexes, `Duplicate index defined in model: ${accessPattern} ${indexName || "(PRIMARY INDEX)"}. This could be because you forgot to specify the index name of a secondary index defined in your model.`); | ||
} else { | ||
throw new e.ElectroError(e.ErrorCodes.DuplicateIndexes, `Duplicate index defined in model: ${accessPattern} ${indexName || "(PRIMARY INDEX)"}`); | ||
} | ||
} | ||
@@ -1691,5 +1695,2 @@ seenIndexes[indexName] = indexName; | ||
} | ||
if (typeof table !== "string" || table.length === 0) { | ||
throw new e.ElectroError(e.ErrorCodes.InvalidConfig, `config.table must be string`); | ||
} | ||
/** end beta/v1 condition **/ | ||
@@ -1696,0 +1697,0 @@ |
@@ -118,2 +118,8 @@ // # Errors: | ||
}, | ||
MissingTable: { | ||
code: 2003, | ||
section: "missing-table", | ||
name: "MissingTable", | ||
sym: ErrorCode | ||
}, | ||
InvalidAttribute: { | ||
@@ -120,0 +126,0 @@ code: 3001, |
Sorry, the diff of this file is too big to display
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
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
223200
3646
2999