Skip to content
Phillip Markert edited this page Nov 16, 2016 · 1 revision

2016-11-11: v0.26.*

I'm finally getting close to publishing the 1.0 version of hyperpotamus. I have had a significant list of backlog issues that I've been slowly tackling throughout the year, but about a month ago, I made a major decision that significantly impacted my closure velocity. Unfortunately, some of those new features require backwards incompatible changes. For some of those changes, I had anticipated and hinted about them in the wiki for a long time now, and they've finally come to reality.

The most significant change is to the macro/interpolation syntax. Previously, there were some symbols that could be added to the opening delimiter to indicate transformational behaviors such as <%+ %> for url encoding, <%- %> for url decoding, <%@ %> for array access, <%$ %> for random values, etc. These symbols could be combined with other symbols (sometimes, depending upon the combination), but as a script developer, one could not influence the order in which the transformations were applied. Most importantly, however, nobody knew what the symbols meant. I often found myself needing to look them up in the reference wiki or in the source-code. Scripts would end up with esoteric macros such as <%#$?:+ date %> and nobody would have an idea of what the symbols meant. Additionally, it was very easy to overlook the symbols when reading a script. I've now replaced the underlying interpolation/macro engine with a customized version of Markup.js.

Hyperpotamus now has some significant improvements because of this change:

  1. The transformation syntax is now handled via pipes/filters instead of prefix symbols. These named filters/pipes are much clearer to read, more powerful to use, and ultimately easier to extend/scale.

    As a result:

    • <%? value %> becomes <% value | optional,default_value %>
    • <%+ value %> becomes <% value | urlencode %>
    • <%- value %> becomes <% value | urldecode %>
    • <%@ array %> becomes <% array | current %>
    • <%& array %> becomes <% array | join %>
    • <%$ range %> becomes <% range | random %> and <%$ array %> becomes <% array | random %>
    • <%: date|YYYY-MM-DD %> becomes <% date | date_format,YYYY-MM-DD %>
    • <%# value %> becomes <% value | csv_safe %>

    Filters can be combined and composed more easily now. It is also easier to add new filters, so I have dramatically increased the number of available filters. In addition to the pipes supported by Markup.js natively, you can also see pipes for documentation about new filters built into hyperpotamus.

  2. The new macro engine now supports handling child objects and arrays. Previously, only simple string-based keys worked. Now you can use paths like <% object.child.1.id %> to access child elements, arrays, etc.

  3. The new object reference syntax <%! object_path %> also typed data values to be retrieved (instead of always converting them to a string values). This is very helpful for constructing JSON requests, for example.

  4. Because of the expanded feature-set, I have been able to replace and remove many plugins that previously required an entire action element. Some of those values are now able to be done inline with a macro and pipe. For example, the moment plugin for parsing and formatting dates has been replaced with the date_format, date_parse, and date_add pipes.

Another positive breaking change with this release is that the ambiguity between response and actions for step properties has now been resolved. In fact, requests are no longer treated as a special processing-phase by hyperpotamus, but is just another regular plugin now. The .response property is only available on request elements. The processor also does a better job of normalizing shortcuts such that steps are no longer required.

Clone this wiki locally