This Gist contains (incomplete) sources of what an implementation of blog in Jeph might look like when Jeph is completed and supports all needed functions (think of this code as soon-not-to-be-failing test).
First look at main.js, it creates some example data and calls jeph() with database-based handler. index.js creates blog's property model and sets basic transformations. archive.js, comment_aggregate.js, and post.js define transformations for blog/* types.
What is an transformation anyway? It takes an entity and if the entity matches given conditions, it adds some properties to it. A condition is any property of transformation that is not a function. true matches when property is present, false if it is not present. String and number match if property has given value. For example, { "jeph/type": true } matches an entity if it has property called jeph/type, { "jeph/type": "blog/post" } matches if the property's value is string blog/post. (Query uses same matching conditions).
A function property is a transformatter. It returns new value of property. The value can be result of some processing, or an Query object. If it's an Query, the query is executed everytime entity is retrieved from store.
Database-based handler is a Jeph handler, that processes request according to data read from database. It strips req.url from req.basePath and query (?) arguments and then queries the database for { "jeph/path": strippedUrl, "jeph/handle": true }. Then it calls entities jeph/handle with req, and res arguments, and this is set to the entity object. It's as simple as that.
fsmodule, support for Node modules (_tpl.js)Query.first()(archive.js),Query.all()instead ofQuery.fetch()- transformation returning query object (
archive.js) - transformation that depends on DB (when transformatter accepts db as its first argument) (
comment_aggregate.js) - transformation independent of DB (when transformatter does not have any parameters (
.length === 0)) (post.js) - transformation condition as array (also should be possible in query) (
main.js)