Skip to content

Releases: haltcase/trilogy

v2.0.0-rc.1

19 Aug 05:10
Compare
Choose a tag to compare
v2.0.0-rc.1 Pre-release
Pre-release
yarn add trilogy@2.0.0-rc.1

v1.4.5

25 Apr 03:52
Compare
Choose a tag to compare

No changes since 1.4.4 - this release restores the v1 release line to the latest tag, where a v2 beta was accidentally published.

v2.0.0-beta.2

21 Jan 05:48
Compare
Choose a tag to compare
v2.0.0-beta.2 Pre-release
Pre-release
npm i trilogy@2.0.0-beta.2

v1.4.4

09 Jan 00:40
Compare
Choose a tag to compare
BUG FIXES
  • enforcers: groupBy -> group (3eaed9a)

v1.4.3

09 Jan 00:18
Compare
Choose a tag to compare
BUG FIXES
  • handle tuple where clauses correctly (efbea74)

v1.4.2

08 Dec 08:34
Compare
Choose a tag to compare
BUG FIXES
  • create: prevent error while searching for last object (5379bb5)
  • types: handle nullish values when casting (e8193c6), closes #79
PERFORMANCE
  • util: use indexOf instead of some() (559dbe0)

v1.4.1

16 Nov 23:35
Compare
Choose a tag to compare

Small patch for TypeScript users to correctly export types.

BUG FIXES

v1.4.0

04 Nov 00:23
Compare
Choose a tag to compare
FEATURES
  • model: allow multiple indices in model definitions, #72 (07ebe16)

v1.3.0

25 Aug 04:45
Compare
Choose a tag to compare

This release brings a pair of exciting features!

First up is the ability to define getters and setters when creating models.
These are useful for things like formatting after selects and conforming
data before inserts.

const people = await db.model('people', {
  name: String,
  username: {
    type: String,
    get (username) {
      return `username is: ${username}`
    },
    set (username) {
      // remove anything that isn't alphanumeric or underscore
      return username.replace(/[^\w]/gi, '')
    }
  }
})

await people.create({
  name: 'Bo Lingen',
  username: 'ci.ty]ci[d/e'
})
// -> { name: 'Bo Lingen', username: 'citycide' }

await people.get('username', { name: 'Bo Lingen' })
// -> 'username is: citycide'

// can use `getRaw()` and `setRaw()` to bypass getters / setters
// other methods may also accept a `raw` property in their options object
await people.getRaw('username', { name: 'Bo Lingen' })
// -> 'citycide'

There's also a new memory-only mode - if the file path is exactly ':memory:',
no file will be created and an in-memory store will be used. This doesn't
persist any data but is useful for speed and performance reasons. For example,
most of trilogy's tests now use in-memory databases to avoid tons of disk usage.

const db = new Trilogy(':memory:')
BUG FIXES
  • always return promises in async functions (009f079)
FEATURES
  • add support for in-memory database (8587f4b)
  • add getters & setters (ab5cd7b)
  • add getRaw() & setRaw() (5fe1f80)
PERFORMANCE
  • model: use assignments in constructor (73e6ebd)
  • util: optimize each() and map() (040084d)

v1.2.1

25 Jul 19:55
Compare
Choose a tag to compare
BUG FIXES
  • immediately create db file for both clients (7423312)
  • fix .mjs module by removing module.exports usage (e1d57c3)