Skip to content

Releases: alpas/alpas

Alpas 0.16.0 Release Notes

11 Mar 04:31
Compare
Choose a tag to compare
Pre-release

New Features

  • Multi-part form support using Pantry.
  • Added few convenience session methods - intended() and previousUrl(). These methods are also available on an HttpCall object.
  • Added a new method, inRandomOrder(), for fetching entities in random order from a MySQL database.
  • Added render() and json() methods with ArgsBuilder as a lambda receiver.
  • Added HttpCall.entityParam() extension method that fetches an entity from a table by looking up an id route param.
  • Added an API to register a custom view function as easily as adding a custom tags.
  • Added a spoof() view function. (Resolves #27).
  • Added asynchronous support using CompletableFuture.
  • Added intReference() and longReference() as shortcuts for defining referencing columns.

Improvements

  • Updated to Kotlin 1.3.70

Bug Fixes

Breaking Changes

  • useCurrent attribute is set to false for bothcreatedAt() and updatedAt().

Alpas 0.15 Release Notes

18 Feb 22:08
Compare
Choose a tag to compare
Pre-release

This release brings even more exciting features and improvements to Alpas. Here are the highlights:

🎉 New Features

✔️ Resourceful Routes

You can create a resourceful routes for all the CRUD operations by using resources() method:
resources<PostController>("posts").name("posts")

✔️ Auto Port Selection

In dev mode Alpas automatically selects the next port if the selected port is in use already. Docs.

✔️ Ozone Extensions

Few useful methods and conventions are added in Ozone such as findOrCreate(attrs), findOne(attrs), findMany(), update(attrs), reference() etc. Docs.

✔️ Column Binding Conventions

Also added are four new column bindings - createdAt(), updatedAt(), increments(), bigIncrements().
Docs.

This means instead of this:

val id by bigInt("id").autoIncrement().unsigned().primaryKey().bindTo{ it.id }
val createdAt by timestamp("created_at").nullable().useCurrent().bindTo { it.createdAt }
val updatedAt by timestamp("updated_at").nullable().useCurrent().bindTo { it.updatedAt }

You can do this:

val id by bigIncrements()
val createdAt by createdAt()
val updatedAt by updatedAt()

✔️ Routes reloading without re-running the app

In dev mode, routes are now reloaded without restarting the app. For performance reason this is disabled in the prod mode.

✔️ Run migrations using a name property

This allows to run migrations even from a fat jar. Very helpful in production.

✔️ Added basic table modification support

You can now addColumn() and dropColumn()

✔️ Reference Constraint

You can now add a reference constraint on a column:

val userId by long("user_id").belongsTo(Users) { it.user }.unsigned().reference { onDeleteCascade() }

💄 Improvements

😀 Assets handling is more optimized.

😀 You can seed a database with database refresh by using --seed flag.

😀 Improved strong typing while overriding an entity's properties in an entity factory.

val user = from(UserFactory) {
    it.name to "Jane M. Doe"
    it.email to "[email protected]"
}

💔 Breaking Changes

There are few but significant breaking changes in this release:

🤦🏽‍♂️ Entity has been renamed to OzoneEntity and MigratingTable has been renamed to OzoneTable:

// Before: interface User : Entity<User>
// Now:
interface User : OzoneEntity<User> {
    // ...
   
   // Before: companion object : Entity.Factory<User>
   // Now:
    companion object : OzoneEntity.Of<User>()
}

// Before: object Users : MigratingTable<User>
// Now:
object Users : OzoneTable<User>("users") {
  // ...
}

🤦🏽‍♂️ EntityFactory now takes two parameters instead of one:

// Before: class UserFactory() : EntityFactory<User>()
// Now:
class UserFactory() : EntityFactory<User, Users>() {
   // ...
}

🤦🏽‍♂️ Methods Renamed:

  • onlyParams() method has been renamed to params()
  • paramAsString() method is now stringParam()
  • paramAsInt() is now intParam()
  • paramAsLong() is now longParam()
  • paramAsBool() is now boolParam()

Alpas 0.14 Release Notes

05 Feb 22:50
Compare
Choose a tag to compare
Pre-release

Packed with so many new features and improvements, this release is probably the biggest and the most exciting release since the initial public release few weeks ago.

New Features 🎉

  • Entity Factories and an accompanying make:factory command.
  • Database Seeder and accompanying make:seeder and db:seed commands.
  • link:web for instant refreshing of assets without recompiling.
  • link:templates for instant refreshing of templates without recompiling (even in the production mode!).
  • Added a few convenient methods to the Environment class such as storagePath(), rootPath(), etc.
  • A middleware can be appended from any service provider. Makes it very easy for third-party extensions to add their own middleware.
  • You can filter a redirect and modify it before committing the redirect.
  • You can now hook into an HttpCall's lifecycle and add variables, fetch variables etc.
  • JSON validation has been improved by allowing to always look into a JSON body during validation.
  • Added hasMany and belongsTo methods to fetch related models intuitively. They are also cached for performance reasons.
  • Flash messages set by a user can be fetched through an HttpCall.
  • Easily add a custom Pebble tag from anywhere.
  • Easily add a conditional Pebble tag from anywhere.
  • Extending Pebble is even easier now by just creating a class extending PebbleExtension and leaving it at the classpath. This will be discovered and loaded automatically.
  • Added a basic support for PostgreSQL migrations. CreateTable is still not supported.
  • Added a PostgresqlConnection class to start connecting with a Postgres database with much fuss.

Improvements 💄

  • Console commands listing is now colored. Coloring has been improved for other console outputs as well.

  • Routing is even more strongly typed and even more compact without compromising the readability. No more magic strings.

// before
get("/", HomeController::class, "index")

// now
get("/", HomeController::index)

// And of course, you can shorten it to
get<HomeController>()
  • Documentation has been heavily updated to cover topics such as CSRF Protection, Entity Relationships, etc.

Others 🐛

  • Updated Ktorm dependency to v2.6
  • Added bunch of new tests
  • Few bug fixes and internal API changes

Breaking Changes

  • JVM Target has been updated to 9 so if you get "Cannot inline bytecode built with JVM target 9" message then make sure to set kotlinOptions.jvmTarget = "9" in your build.gradle file.
  • The only other breaking changes should be from the usage of Pulsar test module. Some of the classes have been graduated to the core framework.

🙏 Thanks to @racharya @armgitaar @vanessagertman @damien-roche @vincentlauvlwj for their help to make this release possible.