hal-browser
Advanced tools
Comparing version 0.6.3 to 0.7.0
@@ -0,1 +1,7 @@ | ||
0.7.0 (2019-02-06) | ||
================== | ||
* Automatically render HTML forms for templated links, where possible. | ||
0.6.3 (2019-01-18) | ||
@@ -2,0 +8,0 @@ ================== |
@@ -9,3 +9,3 @@ "use strict"; | ||
for (const link of links) { | ||
if (options.hiddenRels.includes(link.rel) || link.rel in options.navigationLinks) { | ||
if (options.hiddenRels.includes(link.rel) || link.rel in options.navigationLinks || link.rendered) { | ||
continue; | ||
@@ -12,0 +12,0 @@ } |
@@ -8,2 +8,3 @@ "use strict"; | ||
const embedded_1 = __importDefault(require("./embedded")); | ||
const forms_1 = __importDefault(require("./forms")); | ||
const hal_body_1 = __importDefault(require("./hal-body")); | ||
@@ -17,4 +18,7 @@ const links_table_1 = __importDefault(require("./links-table")); | ||
async function resource(ctx, body, links, options) { | ||
const formsHtml = forms_1.default(links, options); | ||
const linksHtml = links_table_1.default(links, options); | ||
return ` | ||
${links_table_1.default(links, options)} | ||
${linksHtml} | ||
${formsHtml} | ||
${await parseBody(ctx, body)} | ||
@@ -21,0 +25,0 @@ ${await embedded_1.default(ctx, body, options)} |
@@ -66,2 +66,3 @@ /** | ||
templated?: boolean; | ||
rendered?: boolean; | ||
}; |
{ | ||
"name": "hal-browser", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"description": "A HAL browser middleware", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -88,4 +88,35 @@ HAL browser | ||
![Screenshot from 0.5.0](https://github.com/evert/hal-browser/blob/master/screenshots/0.5.0.png) | ||
![Screenshot from 0.7.0](https://github.com/evert/hal-browser/blob/master/screenshots/0.7.0.png) | ||
This screenshot is an example of the browser automatically formatting a .csv | ||
and parsing HTTP `Link` headers: | ||
![Screenshot from 0.7.0](https://github.com/evert/hal-browser/blob/master/screenshots/0.7.0-csv.png) | ||
The following example converts this: | ||
```json | ||
{ | ||
"_links": { | ||
"self": { | ||
"href": "/testing/form" | ||
}, | ||
"up": { | ||
"href": "/testing", | ||
"title": "Back to testing home" | ||
}, | ||
"my-form": { | ||
"href": "/testing/form{?startDate}{?endDate}", | ||
"title": "Search by date range", | ||
"templated": true | ||
} | ||
} | ||
} | ||
``` | ||
And automatically turns the templated link into a form: | ||
![Screenshot from 0.7.0](https://github.com/evert/hal-browser/blob/master/screenshots/0.7.0-form.png) | ||
Supported frameworks | ||
@@ -201,3 +232,2 @@ -------------------- | ||
* Show metadata, such as `Last-Modified` | ||
* Automatically generate forms for templated links. | ||
@@ -204,0 +234,0 @@ [1]: https://github.com/curveballjs/core |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
81979
71
1407
237