All notable changes to this project will be documented in this file. Breaking changes to feature functionality will trigger a new Major Version increase. Significant feature improvements and major bug fixes will trigger Minor Version increases. Small, maintenance and additive changes will trigger Patch Version increases.
- Bulk Operations to return the original object passed to the operation if that object was returned by DynamoDB as unprocessed.
- new
.match()method to replace original Find method functionality. [read more] - New
templateproperty on Model for building custom composite key templates. Thetemplateproperty also brings forward a new syntax similar to template literal syntax. [read more] - New custom composite key syntax using the
templateproperty. [read more] - Numeric table keys now possible. Before PK and SK values could only be strings, Numeric Keys are now supported through the
templatesindex property. [read more]
- Rename of
facetsproperty on Model tocompositefor arrays andtemplatefor string templates. [read more] - Get method now returns
nullwhen value is not found. Prior functionality returned an empty object. [read more] - Strict enforcement of all SK composite attributes being present when performing
.get(),.put(),.create(),.delete(),.remove(),.update(),.patch()operations. - Find method now does not add filters for values supplied, Find now only identifies an Index (if possible) and fulfills the Composite Attributes of that Index (if possible). [read more]
- Query Option
lastEvaluatedKeyRawwhen used with pagination replaced Query Optionpagerwith option values:"raw","item","named". Default set to"named". [read more] - Query Option
lastEvaluatedKeyRawwhen used with bulk operations replaced Query Optionunprocessedwith option values:"raw","item". Default set to"item". [read more]
- Removing
facetsproperty from documentation, examples, and TypeScript typing. Replaced withcompositeproperty for arrays andtemplatefor string templates. [read more] - Fully deprecated custom facet string format. Facet strings defined attributes with a prefixed
:as in:storeIdwould resolve tostoreId. This has been replaced by thetemplatesyntax, surrounding the attribute with${...}. [read more]
- Expanding "collection" concept to include sub-collections. Sub-collections will allow for more precise cross-entity queries to be modeled. [read more]
- Addressed edge-case when modeling sparse indexes that would leave unable to be queried via secondary index. [read more]
- Added new syntax for Attribute Property
watchto trigger whenever any attribute is updated/retrieved. [read more]
- The Attribute Property
readOnlyis now enforced beforewatchproperties are evaluated. This allows properties that use the Attribute Propertywatchto deliberately circumnavigatereadOnlyenforcement. [read more]
- Added new update methods
append,add,subtract,data,remove,delete, anddatafor improved support of all DynamoDB update methods. [read more]
- The property names of
ExpressionAttributeValuesunderwent some change in this release due to the addition of new update operations. This is not a breaking change but if you have tests to match on the exact params returned from ElectroDB these will likely break. [read more]
- New Attribute types
map,list,set. [read more] - New Query Options, and support for,
ReturnValuesas requested in Issue#71. [read more] - New type definitions for recently released update methods
append,add,subtract,data,remove, anddelete. [read more]
- Attributes that have been flagged as
requiredare now not possible to be removed (using the update methodremove()) from a stored Item. This was an oversight from the last release. - Attributes that have been flagged as
hiddennow skips invoking that attribute's getter method.
- Issues that prevented the nesting of update
value()operation. - TypeScript type definitions for
get()method now incorporate potential fornullresponse. - Type definitions for
value()andname()where clause operations.
- New entity method
parse()to expose ElectroDB formatting for values retrieved outside ElectroDB. [read more]
- Newly added method
parse()had critical typo. Method now has an improved api, and appropriate tests [read more]
- Added support for choosing the case ElectroDB will use when modeling a Partition or Sort Key. [read more]
- Added support for indexes to use fields that are shared with attribute fields. This should help users leverage ElectroDB with existing tables. [read more]
- Added Query Option
ignoreOwnershipto bypass ElectroDB checks/interrogations for ownership of an item before returning it. [read more]
- Typedef support for RegExp validation on string attributes
- RegExp validation issue resulting in undefined (but not required) values being tested.
- Typing for
.page()method pager. Now includes the destructured keys associated with the index being queried. [read more] - Adding documentation, and expanding typing for the query option
limit, for use in.params()calls. [read more]
- ElectroDB would throw when an
undefinedproperty was passed to query. This has been changed to not throw if a partial query on that index can be accomplished with the data provided.
- Updates did not include composite attributes involved in primary index. Though these values cannot be changed, they should be
seton update method calls in case the update results in an item insert. [read more]
- Updates did not include composite attributes involved in primary index. Though these values cannot be changed, they should be
seton update method calls in case the update results in an item insert. [read more]
- Improved .npmignore to remove playground oriented files, and created official directory to keep playground in sync with library changes.
- Adding Entity identifiers to all update operations. When primary index composite attributes were added in 1.4.4, entities were written properly but did not include the identifiers. This resulted in entities being written but not being readable without the query option
ignoreOwnershipbeing used.
- Using
add()update mutation now resolves toADD #prop :propupdate expression instead of aSET #prop = #prop + :prop
- Fixed param naming conflict during updates, when map attribute shares a name with another (separate) attribute.
- Addressed issue#90 to flip batchGet's response tuple type definition.
- Queries will now fully paginate all responses. Prior to this change, ElectroDB would only return items from a single ElectroDB query result. Now ElectroDB will paginate through all query results. This will impact both uses of entity queries and service collections. [read more]
- The query option
limithas an extended meaning with the change to automatically paginate records on query. The optionlimitnow represents a target for the number of items to return from DynamoDB. If this option is passed, Queries on entities and through collections will paginate DynamoDB until this limit is reached or all items for that query have been returned. [read more]
- A new query option
pageshas been added to coincide with the change to automatically paginate all records when queried. Thepagesoption sets a max number of pagination iterations ElectroDB will perform on a query. When this option is paired withlimit, ElectroDB will respect the first condition reached. [read more]
- Exporting TypeScript interfaces for
ElectroErrorandElectroValidationError - Errors thrown within an attribute's validate callback are now wrapped and accessible after being thrown. Prior to this change, only the
messageof the error thrown by a validation function was persisted back through to the user, now the error itself is also accessible. Reference the exported interface typedef forElectroValidationErrorhere to see the new properties available on a thrown validation error.
- As a byproduct of enhancing validation errors, the format of message text on a validation error has changed. This could be breaking if your app had a hardcoded dependency on the exact text of a thrown validation error.
- For Set attributes, the callback functions
get,set, andvalidateare now consistently given an Array of values. These functions would sometimes (incorrectly) be called with a DynamoDB DocClient Set.
- In some cases the
find()andmatch()methods would incorrectly select an index without a complete partition key. This would result in validation exceptions preventing the user from querying if an index definition and provided attribute object aligned improperly. This was fixed and a slightly more robust mechanism for ranking indexes was made.
- The methods
create,patch, andremovewill now refer to primary table keys through parameters via ExpressionAttributeNames when usingattribute_exists()/attribute_not_exists()DynamoDB conditions. Prior to this they were referenced directly which would fail in cases where key names include illegal characters. Parameter implementation change only, non-breaking.
- Add
dataupdate operationifNotExiststo allow for use of the UpdateExpression function "if_not_exists()".
- New feature: "Listeners". Listeners open the door to some really cool tooling that was not possible because of how ElectroDB augments raw DynamoDB responses and did not provide easy access to raw DynamoDB parameters. [read more]
- Adding support for the v3 DynamoDBClient. This change also brings in a new ElectroDB dependency @aws-sdk/lib-dynamodb. [read more]
- Fixed issue#111,
updatemethod specific query option typing no longer lost when using awheremethod in a query chain - Fixing incorrect typing for exposed
UpdateEntityItemtype. Exported type was missing composite key attributes
- Expected typings for the injected v2 client now include methods for
transactWriteandtransactGet
- Map attributes will now always resolve to least an empty object on a
createandputmethods (instead of just the root map) - In the past, default values for property attributes on maps only resolves when a user provided an object to place the values on. Now default values within maps attributes will now always resolve onto the object on
createandputmethods.
- Solidifying default application methodology: default values for nested properties will be applied up until an undefined default occurs or default callback returns undefined
- Issue impacting the successful propagation loggers and listeners from a Service definition to Entity children
- Removing validation that requires at least one attribute to be provided in a PK composite. This opens the door to static PKs if the user so chooses
- Removing validation that an attribute used for one index cannot be used by another. ElectroDB will now simply validate that all composite attributes associated with an indexed field are identical, and that a field is not used as both a PK and SK in separate indexes. This change allows for LSIs to be used with ElectroDB
- Add new batchGet query option,
preserveBatchOrder, which will ensure the order returned by a batchGet will be the same as the order provided. [read more]
- TypeScript 4.7 introduced changes that caused type inference issues with the Entity, Service, and exposed types. A re-vamp of some typing was done to rectify these issues, new tests and existing tests were made work with the latest versions of TypeScript and tsd.
- Project now is more deliberate about the types exposed via the package. This is because I have moved away from a single type definition file (which by default exports all types). If you had a dependency on a type that used to be exposed, open a ticket and I can expose it. In the future exposed types will be the only types officially supported by semver.
- Exported additional types
- Reorganizing type definition files into single file again to appease the frontend dependency overlords in https://electrodb.fun
- Adding support for "ProjectionExpressions" via the Query Option:
attributes[read more]
- Sort keys for queries will now match on equality when all sort key composite attributes are provided in full. Prior to this release, ElectroDB would use
begins_with(...)which could potentially result in data leakages if a sort key's value was the starting prefix to another sort key value. [read more]
- Added support for attribute types "enum string set" and "enum number set". This will allow users to define a finite list of values (strings or numbers ) supported for a set [read more]
- TypeScript support for "Custom Attributes", bring your own types to express complex attributes. [read more]
[2.0.0] - 2022-09-19 [read more]
- Additional exported types to match new response structures. [read more]
- Changing response structure on all methods to be an object with query results on a
dataproperty. [read more] - Pagination is now performed via the
.go()terminal method, and the LastEvaluatedKey is now returned a stringcursor. [read more] - The
go()terminal method now only queries one page by default. To auto-page (to match functionality prior to this change), pass the query optionpageswith a value of'all'. [read more]
- The boolean query option
rawandreturnKeyshave been deprecated (still accepted for the time being) and replaced with the query optiondata, which accepts the values'raw','includeKeys','attributes'orundefined.
.page()terminal method. All pagination is now done through the.go()method. Queries and scans now return acursorproperty (of type "string") to be passed on subsequent pagination requests. [read more]
- Added a new attribute property
paddingto aid with zero padding patterns. [read more]
- Defect with sort key composition that would treat falsely values as absent attributes.
- Now exporting
ElectroValidationErrorandElectroErroras classes, so they can be more easily interrogated/triaged by user error handling.
- On
updateandpatchoperations, thedatamethod did not properly apply mutation constraints forrequiredandreadOnly. Data will now correctly throw in a similar manner the to individual mutation methods.
- A BIG addition to the library: Clustered Indexes. Clustered indexes allow for Collections to be composed of more similar, homogenous data.
- The addition of new Entity and Service methods:
setTableName,getTableName,setClient,getClient.
- Addressed GitHub issue #144, root map attributes would set an empty object regardless if the user supplied it.
- (since rolled back)
The return type from an update/patch call now returns an Entity item whenall_neworall_oldresponse options are passed
- Backed out the response typing change added in
2.2.2. The type of record coming back from an update is more complex than one might expect. Because update operations can result in a record insert, the response type is not necessarily a TableItem. I am backing out this change for now until I can be more sure of an appropriate typing.
- New function to help with Custom Types: CustomAttributeType. This replaces
createCustomAttribute(now depreciated) because of the unfortunate widening caused by the initial implementation. [read more)]
- The function
createCustomAttributeis now deprecated. The function still operates as it did, though any changes related to Custom Attribute types will see development focused onCustomAttributeTyperather than this function.
- Addressed issue#162: attribute validation functions were not invoked when updating through the
datamethod. - Conditional filters can now be added to
getoperations. DynamoDBgetdoes not allow for filtering but the TransactWrite/TransactGet methods allow forConditionCheckwhich is essentiallyget+conditions.
- Addressed issue#172, where clause mishandling of nested attribute references
- Addressed issue where scans would incorrectly accumulate filters across usages
- Adding new update method:
upsert. Upsert is similar toputin that it will create a record if one does not exist, exceptupsertperform an update if that record already exists.
- Address issue#179, the query option
tablewas not correctly propagated, resulting a failure for that declared the table name was "missing"
- Upsert method would silently disregard
whereclause usage, and would not add condition expression to parameters.
- Issue #182: Addressed inconsistency with
removeanddeletefunctionality betweenupdateandpatchmethods.
- First code contribution by user @NoahDavey (via PR-197). Fixes boolean evaluation during upsert
- Fixes issue that resulted in provided undefined values from becoming involuntarily set via updates
- Updated documentation links in error message to direct traffic to https://electrodb.dev
- Adds the new filter expression methods:
size(),type()andescape. Addresses Issue#208 [read more] - Adds the
createSchema()function for helping create and type ElectroDB schemas without instantiating an Entity. Addresses Issue#167. [read more]
- Recently added
createSchema()function would validate but not return the schema object provided
- Restores
ignoreOwnershipexecution option. Addresses Issue #194 which calls out regression withignoreOwnership. This flag is now appropriately applied to "query", "get", and "scan" operations.
- Adds transaction functionality:
getandwritetransactions are now supported in ElectroDB via transact write and transact get methods.
- The previous version exported typings directly from the AWS dynamodb client package which, because it was so large, caused the playground to take a massive performance hit. Instead, the library now expose a simplistic version of those types instead.
- Adds new query execution option
hydrate. When a GSI uses aKEYS_ONLYprojection, thehydrateoption will perform the query and then a subsequentbatchGetto "hydrate" the results. - Adds new
conversionmethods to help transform values between "composite attributes", "keys", and "cursors". - Adds improved return typing for
patchoperations. The response type forpatchnow returns an Entity item when passed the execution options{ response: 'all_new' }or{ response: 'all_old' }.
- A common issue amongst new users, was unexpected errors when using a terminal method twice on a query chain. This would often come up when a user called
.params()to log out parameters and then call.go()on the same chain. The fix was to prevent duplicative side effects from occurring on each subsequent terminal method call. - Fixes typing issue with transactGet api that would type
response.dataasneverwhen the transaction included more than one element.
- For queries, ElectroDB now trims the ExclusiveStartKey object to only include the keys associated with the index provided. DynamoDB currently rejects queries when properties not associated with the keys of the queried index are provided on the ExclusiveStartKey. By removing irrelevant properties, ElectroDB offers users more flexibility and opportunities for dynamic querying.
- Fixes return typing for
delete,remove,updateandupsertoperations. These types were incorrect and did not reflect the real values returned. Instead of breaking the APIs, changing response types toT | null, the new response type is now the Entity's key composite values by default. You can also now use the Execution Optionresponseto get back the item as it exists in the table. This is the closed I could get to a non-breaking change that also fixes the incorrect return typing for these methods. - Fixes typing for
containswhere conditions to accept collection element values (e.g.,setandlisttype attributes). - The exported type
UpdateEntityItemwas incorrectly typed, it now includes the correct typing as the values that can be passed to thesetmethod
- Upsert operations now take into consideration
readOnlyattributes when applying changes. If an attribute is configured asreadOnlyElectroDB will apply the property with anif_not_existsset operation to prevent overwriting the existing value if one is set.
- Upsert now only allies
if_not_exists()if the attribute is not a composite attribute in an index.
- Fixed bug reported via Issue #271: Root map object with required flag would not set empty object even when it was provided.
- Adds new
castoption for indexes to allow users to cast index values to a different type than their composite attribute. This change comers from a user requested feature and addresses issue #237
- Fixed edge case when model defines an index without composites while using the template syntax that prevented
ignoreOwnershipfrom correctly gating return records
- Fixes bug with creating sets when client is provided or changed after initial Entity construction
- Fixes bug reported via Issue #281: ElectroDB failed to use an attribute's
fieldname when it was updated viawatch. - Fixes bug reported via Issue #229: ElectroDB would generate empty string keys on item creating. This would occur only in cases where a key's field name matched an attribute's field name.
- Relaxes validation surrounding the use of composite attributes appearing as composite attributes in both the partition and sort key for the same index. Reported in Issue#265, validation surrounding this pattern have been relaxed to only throw when a composite attribute in both the pk and sk AND the sk contains greater than one composite attribute. This constraint is critical for ElectroDB to reliably generate/format sort key values.
- Addresses Issue #277 Introduces new
composite()method forupdateandpatchoperations. Thecompositemethod is used to help electrodb complete and format keys when updating a subset of the key's composite attributes. Prior to this update, updating a key partially resulted in an invalid query error, which caused difficulties when some composite attributes were flagged as readOnly. [read more] - Adds more deliberate collection validation to ensure entity compatibility. This will allow for indexes defined with "template" be used with collections. This also might cause some existing implementations to now throw on service instantiation, however that would mean these services were never valid to begin with.
- Version
2.9.0was accidentally published without the dependency@aws-sdk/lib-dynamodb
- The
composite()method forupdateandpatchnow adds a condition expression that allows for cases where the composite attribute doesn't exist. Prior to this change the condition used a strict equals check on the attribute value (e.g.#prop1 = :prop1). This change now revises that expression to(#prop1 = :prop1 OR attribute_not_exists(#prop1)).
- Reverts change in
2.9.2. Thecomposite()method no longer allows forattribute_not_exists().
- Composite attributes that used the attribute option
watch, and were not provided to thecreateorputmethods, were not property applied to their composite keys. This addresses the issue brought forward in discussion #292.
- The
upsertmethod now supportsadd,subtract,append,set, andifNotExistsoperations. Addresses Issue #286. - The
addandsubtractoperations provided to thedatacallback operation withupdateandpatchmethods now supports a third parameter for supply a defaultValue. Addresses Issue #297. - A condition expression operation called
fieldthat allows for references to raw field names as they exist in the table. This can be used withescapeandvalueto create custom filter expressions.
- Transact
upsertnow supportsadd,subtract,append,set, andifNotExistsoperations. Addresses Issue #301.
- Addresses Issue #308 and Issue #228
- Addresses edge case that filtered valid items when item lacked entity identifiers (created outside ElectroDB) when keys (pk or sk) were numeric.
NOTE: This version is deprecated, this version introduced code that significantly increased latency. That code was fixed in
2.10.7
- Adds
causeproperty toElectroError, currently populated when error originates from the AWS Client, to help with error triage. This also adds the ability to provide an error type to ElectroError to type the error located oncause.
- Addresses bug in
patchandupdatemethods that caused key composite attributes to be set with their attribute name not their "field" name. This would impact users who both use theupdatemethod to create new items and use alternative field name definitions for their composite keys. All other users would likely be silently impacted by this issue.
- Addresses Issue #321, fixing expression attribute name and value formatting to remove non-alphanumeric and underscore characters.
- Fixes latency issue introduced in
2.10.4affecting all queries discovered and brought forward by Ross Gerbasi. Thank you, Ross Gerbasi!
- Adds new property
scopeto index definitions, allowing users to further isolate partition keys beyond justserviceparticipation. This implements an RFC that was thoughtfully put forward by @Sam3d in Issue #290. Thank you, Brooke for your contribution!
- Adds support for nested usage of
anyandCustomAttributeTypeattribute types. Prior to this release,anyandCustomAttributeTypecould only be used with root attributes. This change adds support forCustomAttributeTypeto be used withmapattributes. - Adds new
conditionproperty on index definitions to prevent unnecessary GSI writes & hot partitions for certain data models. The providedconditioncallback will be invoked at query-time, passed all attributes set on that mutation, and if it returnsfalsethe index will not be written to your DynamoDB table. Addresses Issue #330.
- Adds more sophisticated custom attribute type extraction. Patch provided by GitHub user @wentsul with an assist by @adriancooney via PR #332. Thank you both for this great addition!
- Fixes bug where
scanappended invalid filters if some cases. In cases where attributes are used as keys or composite templates contain no prefixes thescanoperation would append invalid filters to parameters. This bug was identified by discord user @engi22, thank you!
- Collection queries returned an
undefinedcursor (currently typed asstring | null) when using theraw:trueexecution option. Fixed to returnnullinstead ofundefined. - Removed superfluous and unused files,
./library-data.jsonandtest.csv, accidentally published in version2.12.2.
- Adds new query execution option
countwhich allows you to specify a specific item count to return from a query. This is useful for cases where you must return a specific/consistent number of items from a query, a deceptively difficult task with DynamoDB and Single Table Design.
- Fixes custom attribute type extraction for union types with RecordItem. Patch provided by GitHub user @wentsul via PR #346. Thank you for another great addition!
- Addresses Issue #366 with unexpected outcomes from index
conditionusage. Discussion inside the issue ticket revealed complexities associated with the implementation of theconditioncallback. Previously, a callback returningfalsewould simply not write the fields associated with an index on update. Through discussion with @sam3d and @nonken, it was revealed that this behavior could lead to inconsistencies between indexes and attributes. Furthermore, this behavior did not align with user expectations/intuitions, which expected afalseresponse to trigger the removal of the item from the index. To achieve this, it was discussed that the presence of aconditioncallback should add a new runtime validation check on all mutations to verify all member attributes of the index must be provided if a mutation operation affects one of the attributes. Previously ElectroDB would validate only that composite members of an index field (a partition or sort key) within an index were fully provided; now, when a condition callback is present, it will validate that all members from both fields are provided. If you are unable to update/patch all member attributes, because some are readOnly, you can also use the composite method on update and patch. More information and the discussion around the reasoning behind this change can be found here. Failure to provide all attributes will result in an Invalid Index Composite Attributes Provided Error.
- Further fixes in service of Issue #366. A bug was discovered that the logic to validate the presence of an attribute was a simple falsey check instead of a check that the value was
undefined. This caused empty strings, zero values, and the boolean valuefalseto incorrectly be considered missing.
- Raised via Issue #196 and Issue #390, a breaking change was made to the project's dependency
@aws-sdk/lib-dynamodb. The change resulted in the errorError: Cannot find module '@aws-sdk/lib-dynamodb/dist-cjs/commands/utils'. This change updates ElectroDB's dependency version to the static version3.395.0, a version known to be compadible. Thank you github users @miyamonz, @kevinlonigro, @srodriki, @pablote, @sargisshahinyan, and @arpadgabor!
- Raised via Issue #196 and Discussion 361; When using a clustered index with an empty composite array,
updateandpatchmethods would not correctly form the complete sort key value for the index. This would prevent impacted items from being queried via an Entity, though they could be queried via a collection on a Service. Thank you to github users @daniel7byte and @santiagomera for raising this issue!
- Updated
@aws-sdk/lib-dynamodbdependency from pinned version3.395.0to latest release^3.654.0. This impacts users using the v3 aws-sdk. - Adds dependency
@aws-sdk/util-dynamodbfor unmarshalling functionality.
- Fixed typing for "batchGet" where return type was not defined as a Promise in some cases. This change is the 2.0.0 hotfix, the corresponding 3.0.0 change was introduced in 3.2.0.
- ElectroDB is changing how it generates query parameters to give more control to users. Prior to
v3, query operations that used thegt,lte, orbetweenmethods would incur additional post-processing, including additional filter expressions and some sort key hacks. The post-processing was an attempt to bridge an interface gap between attribute-level considerations and key-level considerations. Checkout the GitHub issue championed by @rcoundon and @PaulJNewell77 here to learn more. Withv3, ElectroDB will not apply post-processing to queries of any type and abstains from adding implicit/erroneous filter expressions to queries by default. This change should provide additional control to users to achieve more advanced queries, but also introduces some additional complexity. There are many factors related to sorting and using comparison queries that are not intuitive, and the simplest way to mitigate this is by using additional filter expressions to ensure the items returned will match expectations. To ease migration and adoption, I have added a new execution option calledcompare; To recreatev2functionality without further changes, use the execution option{ compare: "v2" }. This value is marked as deprecated and will be removed at a later date, but should allow users to safely upgrade tov3and experiment with the impact of this change on their existing data. The newcompareoption has other values that will continue to see support, however; to learn more about this new option, checkout Comparison Queries. - The
validatecallback on attributes now expects a strict return type ofboolean. Additionally, the semantic meaning of a boolean response has flipped. The callback should returntruefor "valid" values andfalsefor "invalid" values. If your validation function throws an error, ElectroDB will still behave as it previously did inv2, by catching and wrapping the error. - Providing the execution option
limiton queries now only applies aLimitparameter to its request to DynamoDB. Previously, thelimitoption would cause ElectroDB to effectively "seek" DynamoDB until the limit was at least reached. The execution optioncountcan be used in similar cases wherelimitwas used, but performance may vary depending on your data and use case.
- The execution options
includeKeysandrawwere deprecated in version2.0.0and have now been removed in favor of the execution optiondata. To migrate fromv2, use the options{ data: "includeKeys" }and{ data: "raw" }respectively.
- Response typing and formatting logic for
delete
- The execution option
{ compare: "attributes" }used incorrect expression comparisons that impactedltequeries on indexes with a single composite key.
- Issue #464; When specifying return attributes on retrieval methods, ElectroDB would unexpectedly return null or missing values if the options chosen resulted in an empty object being returned. This behavior could be confused with no results being found. ElectroDB now returns the empty object in these cases.
- ElectroDB Error objects no contain a
params()method. If your operation resulted in an error thrown by the DynamoDB client, you can call theparams()method to get the compiled parameters sent to DynamoDB. This can be helpful for debugging. Note, that if the error was thrown prior to parameter creation (validation errors, invalid query errors, etc) then theparams()method will return the valuenull.
- When updating an item with a map attribute, if you attempt to set multiple keys that are identical after removing non-word characters
(\w), Electro will generate the same expression attribute name for both keys. This occurs even though the original keys are different, leading to conflicts in the update operation. This update introduces a new change that ensures that each key will generate a unique expression attribute name. Contribution provided by @anatolzak via PR #461. Thank you for your contribution!
- Fixed typing for "batchGet" where return type was not defined as a Promise in some cases.
- Issue #416; You can now use reverse indexes on keys defined with a
template. Previously, ElectroDB would throw if your entity definition used apkfield as anskfield (and vice versa) across two indexes. This constraint has been lifted if the impacted keys are defined with atemplate. Eventually I would like to allow this for indexes without the use oftemplate, but until then, this change should help some users who have been impacted by this constraint.
- Issue #416; You can now use reverse indexes without the use of
template.
- Issue #475; Fixes issue where some users reported errors exporting entities and/or types when using the
CustomAttributeTypefunction. They would receive an error similar toExported variable '...' has or is using name 'OpaquePrimitiveSymbol' from external module "..." but cannot be named..
- Issue #483: This fix addresses the problem where ElectroDB returned an empty object when the get method was called for a non-existent item and the
attributesparameter was specified. It now correctly returnsnullas expected.
- Issue #439; Fixed missing TypeScript types for
attributesproperty onscan,find, andmatchmethods.
- Reduced ElectroDB's pre/post-processing overhead before/after DynamoDB requests by as much as 85% in some cases.
- Issue #510; Fixes the issue where ElectroDB did not create the ProjectionExpression DynamoDB parameter when scanning a table and specifying attributes to return.
- Issue #343; Fixed issue where ElectroDB would attempt to double set an attribute's value on
upsertif an index key used the attribute's name as it's field name. This would cause theupsertto fail because DyanmoDB prevents duplicate set operations to the same field.
- Issue #530; Fixed issue where ElectroDB would attempt to set a table index field's value on
upsertif an index key used an attribute's name as it's field name. This would cause theupsertto fail because DyanmoDB prevents set operations on table index fields.
- Adds option to pass ignoreOwnership during entity creation. We are migrating our codebase to use electrodb. Devs sometimes forget to include this flag and it fails silently because types are not narrowed down from the flags passed inside the .go({...}). It will be convenient if there was an option to pass in ignoreOwnership when creating entities so that errors are minimized. Contribution provided by @xamogh via PR #457. Thank you for your contribution!
- Issue #519; The
concurrencyoption has been deprecated in the TS types, which did not affect any runtime behavior, in favor of theconcurrentoption. Contribution provided by @anatolzak via PR #520. Thank you for your contribution!
- Issue #516; Fixed the missing ProjectionExpression parameter when performing a batchGet with specific attributes to return. Contribution provided by @anatolzak via PR #517. Thank you for your contribution!
- Issue #540 Rolls back a change introduced in 3.5.0 (via 533) that caused over-filtering in collection queries, resulting in some collection members not being returned.
- Issue #507; You can now scan an index. See docs Contribution provided by @anatolzak
- Issue #508; Added support for INCLUDE projection type in index definitions, allowing selective attribute projection for optimized query performance and cost reduction. See docs Contribution provided by @anatolzak
- Issue #548; Fixed invalid
ProjectionExpressiongenerated for entities without a sort key when using theattributesoption. An empty string was incorrectly added toExpressionAttributeNames, causing DynamoDB to reject the request.
- Fast follow to 3.6.0, relaxes projection attribute constraint on collection entities. 3.6.0 required [collection] member entities to all share the same attributes when using a
projectiondefined index. This constraint came from the original scope of 3.6.0. Thankfully, due to the work of @anatolzak, 3.6.0 shipped with robust collection typing and this no longer was a concern.
Adds support for multi-attribute indexes read more.
- Issue #543; New
clientoption forgo()method allowing dynamic DynamoDB client override at query execution time. This enables use cases like multi-region routing, per-request client selection, and easier testing. Supported for all operation types: entity operations, collection queries, batch operations, and transactions.
- Issue #553; Fixed
parsemethod returning data instead ofnullfor invalid items. - Issue #561; Fixed
parsemethod not allowing theignoreOwnershipoption to be overridden.
- Issue #556; Fixed
whereclause on projected indexes exposing all entity attributes instead of only projected attributes when the index has non-empty SK composites. Calling.where()directly now correctly restricts to projected attributes, matching the existing behavior of.gte().where()and other SK operation chains.
- Issue #558; Fixed composite index (
type: "composite") projection types being too narrow.keys_onlyreturned{}and array projections omitted pk/sk composite attributes from the response type, even though DynamoDB always returns them as native columns. Response types,attributesparameter, and collection queries now correctly include composite key attributes. - Issue #559; Fixed composite index query response types marking pk/sk composite attributes as optional even though composite indexes are sparse — items only appear in the index if all key attributes are present, so they are always defined in query results.
- Issue #554; Fixed
hydrate: truereturning no items when querying composite type indexes withkeys_onlyorincludeprojections.