ketting 7.0.1 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +1 -1
  2. package/browser/ketting.min.js +1 -1
  3. package/browser/ketting.min.js.map +1 -1
  4. package/dist/client.d.ts +24 -4
  5. package/dist/client.js +96 -29
  6. package/dist/client.js.map +1 -1
  7. package/dist/http/error.js +1 -1
  8. package/dist/http/error.js.map +1 -1
  9. package/dist/http/fetch-polyfill.js.map +1 -1
  10. package/dist/http/fetcher.js +3 -3
  11. package/dist/http/fetcher.js.map +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +7 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/link.js +2 -2
  16. package/dist/link.js.map +1 -1
  17. package/dist/middlewares/accept-header.js +1 -1
  18. package/dist/middlewares/accept-header.js.map +1 -1
  19. package/dist/middlewares/cache.js +30 -25
  20. package/dist/middlewares/cache.js.map +1 -1
  21. package/dist/middlewares/warning.js +2 -1
  22. package/dist/middlewares/warning.js.map +1 -1
  23. package/dist/resource.d.ts +1 -1
  24. package/dist/resource.js +6 -6
  25. package/dist/resource.js.map +1 -1
  26. package/dist/src/client.d.ts +24 -4
  27. package/dist/src/index.d.ts +3 -1
  28. package/dist/src/resource.d.ts +1 -1
  29. package/dist/state/base-state.js +6 -4
  30. package/dist/state/base-state.js.map +1 -1
  31. package/dist/state/binary.js +1 -1
  32. package/dist/state/binary.js.map +1 -1
  33. package/dist/state/collection-json.js +1 -1
  34. package/dist/state/collection-json.js.map +1 -1
  35. package/dist/state/hal.js +13 -9
  36. package/dist/state/hal.js.map +1 -1
  37. package/dist/state/head.js +1 -1
  38. package/dist/state/head.js.map +1 -1
  39. package/dist/state/html.js +3 -3
  40. package/dist/state/html.js.map +1 -1
  41. package/dist/state/jsonapi.js +1 -1
  42. package/dist/state/jsonapi.js.map +1 -1
  43. package/dist/state/siren.js +3 -3
  44. package/dist/state/siren.js.map +1 -1
  45. package/dist/state/text.js +1 -1
  46. package/dist/state/text.js.map +1 -1
  47. package/dist/util/html.js +2 -2
  48. package/dist/util/html.js.map +1 -1
  49. package/dist/util/html.web.js +2 -2
  50. package/dist/util/html.web.js.map +1 -1
  51. package/dist/util/uri-template.js +1 -1
  52. package/dist/util/uri-template.js.map +1 -1
  53. package/dist/util/uri.js +3 -3
  54. package/dist/util/uri.js.map +1 -1
  55. package/dist/util/uri.web.js +1 -1
  56. package/dist/util/uri.web.js.map +1 -1
  57. package/package.json +11 -10
  58. package/src/action.ts +2 -2
  59. package/src/client.ts +119 -34
  60. package/src/field.ts +9 -9
  61. package/src/http/error.ts +7 -7
  62. package/src/http/fetch-polyfill.ts +4 -4
  63. package/src/http/fetcher.ts +3 -3
  64. package/src/index.ts +3 -5
  65. package/src/link.ts +10 -10
  66. package/src/middlewares/accept-header.ts +1 -1
  67. package/src/middlewares/cache.ts +31 -24
  68. package/src/middlewares/warning.ts +1 -0
  69. package/src/resource.ts +8 -8
  70. package/src/state/base-state.ts +5 -3
  71. package/src/state/collection-json.ts +28 -28
  72. package/src/state/hal.ts +12 -7
  73. package/src/state/interface.ts +2 -2
  74. package/src/state/jsonapi.ts +9 -9
  75. package/src/state/siren.ts +23 -23
  76. package/src/types.ts +1 -1
  77. package/src/util/html.ts +10 -10
  78. package/src/util/html.web.ts +7 -7
  79. package/src/util/uri.ts +1 -1
  80. package/src/util/uri.web.ts +2 -2
  81. package/changelog.md +0 -894
package/changelog.md DELETED
@@ -1,894 +0,0 @@
1
- ChangeLog
2
- =========
3
-
4
- 7.0.1 (2021-05-04)
5
- ------------------
6
-
7
- * No longer testing Node 10 and Node 15. Added Node 16.
8
- * Actions are now retained when caching. Before this, action information was
9
- dropped which meant that any actions in embedded resources were not
10
- accessible. (@hugothomas)
11
-
12
-
13
- 7.0.0 (2021-04-11)
14
- ------------------
15
-
16
- * New major version! See Github for a list of changes.
17
- * `Title` header is now defined as a HTTP Entity Header.
18
-
19
-
20
- 7.0.0-beta.5 (2021-03-08)
21
- -------------------------
22
-
23
- * `label` and `value` were parsed in reverse.
24
-
25
-
26
- 7.0.0-beta.4 (2021-02-26)
27
- ------------------------
28
-
29
- * Added renderAs 'checkbox' to multi-select fields in actions.
30
- * Export `OptionDataSource`.
31
-
32
-
33
- 7.0.0-beta.3 (2021-02-21)
34
- -------------------------
35
-
36
- * Support for HAL Forms version `2021-02-20`, which adds the 'options'
37
- property.
38
- * Kettings now has support for 'dropdown' fields, allowing users to provide
39
- lists of possible options in 3 different ways:
40
- 1. An inline list
41
- 2. An external HTTP resource (JSON body or CSV body)
42
- 3. Provided as links from a hypermedia source.
43
- Only 1 and 2 are supported by HAL Forms, 3 is just an internal feature until
44
- there is a format that has first-class support for this.
45
- * A bit of a rewrite of 'fields' again. Only a single type is exported, and
46
- all the types are cleaned up.
47
-
48
- 7.0.0-beta.2 (2021-01-25)
49
- -------------------------
50
-
51
- * Support for Siren 'title' on fields. This was an oversight.
52
-
53
-
54
- 7.0.0-beta.1 (2021-01-25)
55
- -------------------------
56
-
57
- * Remove support for `Prefer-Push`. Browsers are basically dropping HTTP/2
58
- Push, and not enough work is done to make this very interesting.
59
- [More background](https://evertpot.com/http-2-push-is-dead/).
60
- * Revert 'unifiying URLs' PR, we're back to using `url.resolve` in node.
61
-
62
-
63
- 7.0.0-beta.0 (2021-01-19)
64
- -------------------------
65
-
66
- * Note: this release has a number of BC breaks, which will only affect you if
67
- you wrote custom format parsers. See the wiki for more details.
68
- * #326: State objects now have `follow()` and `followAll()` methods.
69
- * #322: Add `type`, `status`, `detail`, `instance` properties to `Problem`
70
- class, for better support of [`application/problem+json`][6]. (@sazzer).
71
- * #327: If a response is received with a `Content-Location` header, the
72
- response will now immediately get stored in the cache.
73
- * Support for [`draft-dalal-deprecation-header`][7]. Ketting will now emit
74
- warnings if a `Deprecation` header is detected, and will also provide
75
- information from the `Sunset` header and include the uri of the `deprecation`
76
- link relation.
77
- * Support for the latest [HAL-Forms][5] features, including `target`, `step`,
78
- `min`, `max`, `type`, `minLength`, `maxLength`, `placeholder`, `cols`, `rows`.
79
- * Support multiple HAL Forms, as per the latest spec updates. Before only a
80
- 'default' form was supported.
81
- * Add `textarea` form field type.
82
- * #324: Only use `{cache: 'no-cache'}` with `.refresh()`, not `.get()`.
83
- * Fixed a subtle URL resolving bug in browsers. (Node was not affected).
84
-
85
- 6.2.0 (2020-12-01)
86
- ------------------
87
-
88
- * Updated `fetch-mw-oauth2`, which has a few new features:
89
- * Fixed a race condition where two 401's in quick succession could result
90
- in two OAuth2 refresh requests, ultimately causing 1 to fail.
91
- * Preemptively refresh if we know when the access token will expire.
92
-
93
-
94
- 6.1.4 (2020-11-30)
95
- ------------------
96
-
97
- * #302: Templated links without template data don't work.
98
-
99
-
100
- 6.1.3 (2020-11-19)
101
- ------------------
102
-
103
- * Add a `getCache()` function to Resource, which allows a user to get the
104
- latest Resource State in a synchronous manner.
105
- * #292: Parse Siren's 'value' property in action fields.
106
- * `fetch-mw-oauth2` dependency had a bug related to refreshing tokens. This
107
- release ships with a version without that bug.
108
-
109
-
110
- 6.1.2 (2020-11-09)
111
- ------------------
112
-
113
- * Update the `fetch-mw-oauth2` dependency, which adds an `onAuthError` event.
114
-
115
-
116
- 6.1.1 (2020-11-05)
117
- ------------------
118
-
119
- * `state.links.delete()` can now take a `href` argument to delete a specific
120
- link from its list.
121
- * Improvements in error messaging.
122
- * Upgrade to Webpack 5
123
-
124
-
125
- 6.1.0 (2020-10-04)
126
- ------------------
127
-
128
- * Large changes in the actions/form system. This should still be considered
129
- experimental and could cause some minor BC breaks.
130
- * Actions are now effectively a serialization of a HTML form, and it's now
131
- possible to introspect information such as the `target`, `method`,
132
- `contentType`, etc.
133
- * Some refactoring in the `State` objects, simplifiying these significantly.
134
-
135
-
136
- 6.0.4 (2020-10-04)
137
- ------------------
138
-
139
- * State objects now have an `actions()` method that return all defined
140
- actions.
141
-
142
-
143
- 6.0.3 (2020-09-30)
144
- ------------------
145
-
146
- * #241: Add `application/prs.hal-forms+json` to Accept header and treat as
147
- HAL (@reda-alaoui).
148
- * #260: `action()` could not be successfully called on a HAL action.
149
- (@reda-alaoui).
150
- * Add `action()` function to `State` interface.
151
-
152
-
153
- 6.0.2 (2020-09-28)
154
- ------------------
155
-
156
- * #248: Parse JSON objects that have an array at the top-level.
157
- * #257: `ETag` and `Last-Modified` are now treated as 'Content headers', which
158
- means they will get returned from `getContentHeaders()`.
159
-
160
-
161
- 6.0.1 (2020-09-09)
162
- ------------------
163
-
164
- * Quick re-release. Some files were left in the `dist/` directory that were
165
- not cleaned up.
166
-
167
-
168
- 6.0.0 (2020-09-09)
169
- ------------------
170
-
171
- * New major release!
172
- * Added support for [Siren][1] action fields.
173
- * Added support for [HAL Forms][4].
174
-
175
-
176
- 6.0.0-beta.2 (2020-08-15)
177
- -------------------------
178
-
179
- * Support `draft-nottingham-link-hint` on Links.
180
- * Added: `client.fetcher.advertiseKetting`. Setting this to false will cause
181
- Ketting to *not* set the `User-Agent` header.
182
- * `Resource.patch()` will now return a `State `object if the server responded
183
- with `200 OK` and a body.
184
-
185
-
186
- 6.0.0-beta.1 (2020-08-10)
187
- -------------------------
188
-
189
- * #229: Embedded resources were not cached. (@madsmadsen)
190
- * #230: Respect `headers` property in options of `refresh()` function.
191
- (@madsmadsen)
192
- * Lots of Ketting 6 doc updates.
193
- * JSDocs everywhere gotten a fresh proof read.
194
-
195
-
196
- 6.0.0-beta.0 (2020-07-06)
197
- -------------------------
198
-
199
- * Switched from tslint to eslint.
200
- * Feature complete!
201
-
202
-
203
- 6.0.0-alpha.7 (2020-06-19)
204
- --------------------------
205
-
206
- * `isState()` type guard is exported.
207
-
208
-
209
- 6.0.0-alpha.6 (2020-06-16)
210
- --------------------------
211
-
212
- * The Links object now has a default 'context', making it easier to add
213
- relative links.
214
- * Links now has an easier to use API for setting or adding new links.
215
- * Links now has a `.delete()` method to delete by `rel`.
216
-
217
-
218
- 6.0.0-alpha.5 (2020-06-08)
219
- --------------------------
220
-
221
- * Added 'actions', allowing users to automatically submit actions and/or Forms
222
- for supported formats.
223
- * Action support is added for `text/html` and `application/vnd.siren+json`
224
- * Supported content-types for actions are `application/json` and
225
- `application/x-www-form-urlencoded`.
226
- * `State` objects now have a reference to `Client`.
227
- * `resolve()` function is now a package export, providing a cross-platform
228
- function for resolving urls.
229
- * `Resource` has now a `updateCache` function for local state changes without
230
- submitting to the server.
231
- * `refresh()` now emits an `update` event.
232
-
233
-
234
- 6.0.0-alpha.4 (2020-05-11)
235
- --------------------------
236
-
237
- * Fixing bugs related to `patch()`, `post()` in the browser build.
238
-
239
-
240
- 6.0.0-alpha.3 (2020-05-10)
241
- --------------------------
242
-
243
- * `Resources` implement EventEmitter, and can emit `stale`, `update` and
244
- `delete` events.
245
- * The 'body' property on State is now 'data'
246
- * #141: Added `head()` function and ability to follow links just through `HEAD`
247
- methods via the `Link` header.
248
- * Added a `NeverCache` and `ShortCache` if automatically storing every `State`
249
- object until invalidation is not desired.
250
- * When calling `put()` with a new `State` object, that object will now be placed
251
- in cache.
252
- * When refreshing, `fetch()` is now given the 'reload' cache setting, so that
253
- `refresh()` is a true Refresh, even with a browser cache.
254
- * #130: Support relative bookmark URIs when using Ketting in a browser.
255
- * Siren was not correctly parsed.
256
- * Add `.clone()` method to all `State` object.
257
-
258
-
259
-
260
- 6.0.0-alpha.2 (2020-05-03)
261
- --------------------------
262
-
263
- * `State` is now exported.
264
- * #184: Added a new `postFollow()` function that takes over the role of
265
- `post()`. `post()` is now intended for RPC-like operations and form
266
- submissions.
267
-
268
-
269
- 6.0.0-alpha.1 (2020-05-03)
270
- --------------------------
271
-
272
- * Re-release. The build contained a few older files that weren't meant to be
273
- packaged.
274
-
275
-
276
- 6.0.0-alpha.0 (2020-04-28)
277
- --------------------------
278
-
279
- * Big BC-breaking rewrite. Changes are numerous, but the important ones are
280
- listed here.
281
- * `Resource.get()` now returns a `State` object instead of just a response
282
- body. This object has methods to make it easier to manipulate and get
283
- information about the response, including links. It's also a stable,
284
- non-async object.
285
- * `Ketting` class is now called `Client`. It's still exposed as `Ketting`
286
- as well for BC purposes.
287
- * `Client.getResource()` has been removed. Use `Client.go()` instead.
288
- * A HTTP Fetch middleware system has been added, for easier manipulation of
289
- requests and responses. Middlewares can be added for every request, or
290
- for specific origins (domains).
291
- * All authentication settings have been removed, and reimplemented as
292
- fetch middlewares. They take roughly the same options, but the setup
293
- has changed.
294
- * `Resource.get()`, `Resource.put()`, etc. can now all take custom headers
295
- and other options to manipulate the request.
296
- * In the past you could just send a body with `Resource.post()`, `.put()`,
297
- .`patch()`. Now this body must be a wrapped in an object with at least a `.body`
298
- property. This is an annoying BC break but will allow for more flexibility
299
- that was previous impossible.
300
- * Proper support for 'binary' resources.
301
- * Hal Links will now be reserialized on `put()`.
302
- * `Resource.link`, `Resource.links` and `Resource.hasLink` has been deprecated,
303
- but not removed.
304
- * `Link` objects are now a simple typescript type, and no longer implemented
305
- as a class.
306
- * `FollowerOne` is now `FollowPromiseOne` and `FollowerMany` is now
307
- `FollowPromiseMany`.
308
- * All things called `Representor` has been removed, and rewritten with
309
- a completely new API. A `HAL representor` is now a `HalState`.
310
- * #175: Nested embedded items are now also placed in the cache.
311
-
312
-
313
- 5.2.1 (2020-03-03)
314
- ------------------
315
-
316
- * Use the `title=` attribute from the HTTP Link header, if it exists.
317
-
318
- 5.2.0 (2020-02-17)
319
- ------------------
320
-
321
- * Added 'finally()' to custom follower promises.
322
- * All representors are now exported in the `representor` namespace.
323
-
324
-
325
- 5.1.2 (2020-02-12)
326
- ------------------
327
-
328
- * Correct return type on followAll, so it may be chained with preFetch.
329
- This was only an issue when doing 'multiple hops'.
330
-
331
-
332
- 5.1.1 (2020-01-10)
333
- ------------------
334
-
335
- * #173: De-duplicate HAL links if they appear in _embedded and _links.
336
-
337
-
338
- 5.1.0 (2020-01-05)
339
- ------------------
340
-
341
- * Support for the [Collection+json][4] format.
342
- * Added a `preferTransclude()` method on the Follower objects. This
343
- automatically adds a `Prefer: tranclude="rel"` header.
344
-
345
-
346
- 5.0.1 (2019-12-09)
347
- ------------------
348
-
349
- * Update all dependencies.
350
-
351
-
352
- 5.0.0 (2019-11-22)
353
- ------------------
354
-
355
- * This version is the exact same as the previous alpha.
356
-
357
-
358
- 5.0.0-alpha.7 (2019-11-12)
359
- --------------------------
360
-
361
- * Added `hasLink` on Resources and Representations.
362
-
363
-
364
- 5.0.0-alpha.6 (2019-11-06)
365
- --------------------------
366
-
367
- * Fixed a bug in `getOptions()`
368
-
369
-
370
- 5.0.0-alpha.5 (2019-11-06)
371
- --------------------------
372
-
373
- * Added a `preferPush()` method to 'Follower' objects, allowing you to
374
- automatically send [`Prefer-Push`][3] headers when following links.
375
- * Moved all functionality related to the 'Repreprentor' in a utility class,
376
- making both the `Ketting` and `Resource` classes simpler.
377
- * Simplified `Resource.refresh()`, making it easier to read and do less work.
378
- * When calling `.post()`, the function will only return a new resource if the
379
- HTTP response code was `201`.
380
- * If the HTTP response code to a `post()` call was `205`, it will now return
381
- the current resource.
382
- * Removed the logic for automatically adding `Prefer-Push` headers. This was
383
- unreliable, and usually did the wrong thing. The new system is 100% opt-in
384
- and developer-driven.
385
- * Added `Ketting.getOptions()` to return a list of options that were passed to
386
- Ketting. The options will be enhanced with OAuth2 refresh and access tokens
387
- as they become available, meaning that it can be used to place in
388
- LocalStorage to remember sessions. This feature is experimental and
389
- incomplete. It might change even in minor versions.
390
-
391
-
392
- 5.0.0-alpha.4 (2019-10-31)
393
- --------------------------
394
-
395
- * This version is identical to the last, but fixes an issue on npmjs.com.
396
- Updating is not needed.
397
-
398
-
399
- 5.0.0-alpha.3 (2019-10-31)
400
- --------------------------
401
-
402
- * It's now possible to tell Ketting to prefetch every resource when following
403
- links via `Resource.follow('foo').preFetch()`.
404
- * `Link` and `LinkNotFound` are now both exported.
405
- * Documentation overhaul.
406
-
407
-
408
- 5.0.0-alpha.2 (2019-10-21)
409
- --------------------------
410
-
411
- * Slight tweak to the webpack build, so that other typescript + webpack
412
- projects can use the webpack build and use the minified files.
413
-
414
-
415
- 5.0.0-alpha.1 (2019-10-21)
416
- --------------------------
417
-
418
- * Now supports the 'invalidates' link rel. When specified in a HTTP response,
419
- Ketting will automatically clear the cache of any related resources.
420
- See [draft-nottingham-linked-cache-inv-04][2].
421
-
422
-
423
- 5.0.0-alpha.0 (2019-10-18)
424
- --------------------------
425
-
426
- * Support for the [Siren][1] format.
427
- * Rewrite of the 'representation' system, which is responsible for supporting
428
- all the different media types. This results in a few small BC breaks.
429
- * NEW: `follow()` and `followAll()` now throw `LinkNotFound` instead of the
430
- generic `Error` when a link could not be found.
431
- * NEW: Resources now have a `link(rel: string)` function, which returns a
432
- a single `Link` object.
433
- * BC BREAK: `Ketting.getRepresentor()` is now `Ketting.createRepresentation()`
434
- and is responsible for constructing the object instead of just returning a
435
- constructor.
436
- * BC Break: `body`, `links` and `embedded` on `Representor` objects are all
437
- gone and replaced with `getBody()`, `getLinks()` and `getEmbedded()`.
438
- * BUG: Hal is now more lenient with broken responses.
439
- * NEW: Compatible with Typescript's `strictNullChecks` setting. Overall
440
- stronger typing all around.
441
- * NEW: Hal responses from the HAL representor are now properly typed.
442
- * CHANGE: Link chaining system has been rewritten, opening the door to new
443
- features that weren't possible before.
444
-
445
- 4.0.4 (2019-10-31)
446
- ------------------
447
-
448
- * This version is identical to the last, but fixes an issue on npmjs.com.
449
- Updating is not needed.
450
-
451
-
452
- 4.0.3 (2019-09-11)
453
- ------------------
454
-
455
- * The internal resource cache will now evict items for any non-safe HTTP
456
- method.
457
-
458
-
459
- 4.0.2 (2019-09-05)
460
- ------------------
461
-
462
- * Broke Typescript exports again
463
-
464
-
465
- 4.0.1 (2019-09-05)
466
- ------------------
467
-
468
- * Fix Typescript defintion files so Ketting may be imported correctly.
469
-
470
-
471
- 4.0.0 (2019-09-04)
472
- ------------------
473
-
474
- * #129: Using the package in non-typescript node.js now works with a simple
475
- `const Ketting = require('ketting')`.
476
- * #129: Fixed the browser distribution. the `Ketting` constructor is
477
- registered globally again.
478
-
479
-
480
- 4.0.0-alpha.0 (2019-04-22)
481
- --------------------------
482
-
483
- * The old format for OAuth2 setup is now no longer supported.
484
- * It's now possible to specify per-domain authentication using wildcards.
485
- This allows you to set up specific authentication credentials for specific
486
- domains. This might be useful in case you talk to multiple API's with a
487
- single client.
488
-
489
-
490
- 3.1.0 (2019-03-28)
491
- ------------------
492
-
493
- * If Ketting anticipates that a user might want to fetch multiple resources
494
- in sequence (a follow chain), it will now add `Prefer-Push` header and
495
- a `Prefer: transclude` header. Both are experimental internet drafts to
496
- suggest to a server to do a HTTP/2 push or embed a child resource
497
- respecitvely. This feature is experimental and might change as these drafts
498
- change.
499
-
500
-
501
- 3.0.2 (2019-03-19)
502
- ------------------
503
-
504
- * A mistake was made when releasing version 3. A branched was not merged in
505
- entirely, which caused some of the new OAuth2 features to be partially
506
- missing. This has now been corrected.
507
-
508
-
509
- 3.0.1 (2019-03-18)
510
- ------------------
511
-
512
- * Updated dependencies
513
-
514
- 3.0.0 (2019-03-18)
515
- ------------------
516
-
517
- * Switched OAuth2 implementation from `client-oauth2` to `fetch-mw-oauth2`.
518
- This adds support for `authorization_code` auth, removes 11 dependencies and
519
- reduces the minified Ketting build from 69KB to 28KB.
520
- * OAuth2 options now have a new format. The old format is still supported, but
521
- will be removed from a future version.
522
- * The `baseHref` propertyname was renamed to `Context` on the `Link` type. The
523
- new name matches the name from RFC8288. This is a small BC break.
524
-
525
-
526
- 2.5.1 (2019-03-01)
527
- ------------------
528
-
529
- * #120: The system that de-duplicates identical requests will cache failures
530
- forever. This is now fixed. Highly recommended update.
531
-
532
-
533
- 2.5.0 (2019-01-22)
534
- ------------------
535
-
536
- * Basic JSON:API support. Currently only links appearing in the top-level
537
- document are supported.
538
- * #113: Support for Typescript environments that don't have `esModuleInterop`
539
- set to true.
540
- * Added a 'go' function for easily getting resources based on relative uris.
541
-
542
-
543
- 2.4.1 (2018-11-07)
544
- ------------------
545
-
546
- * If a link appears in both `_embedded` and `_links`, they will be
547
- de-duplicated. HAL technically requires links to appear in both places, so
548
- scanning `_embedded` should not be needed. However, most implementations will
549
- not add links `_links` if they were already `_embedded`. This change caters
550
- both usages.
551
-
552
-
553
- 2.4.0 (2018-11-05)
554
- ------------------
555
-
556
- * The `Resource` class is now a generic typescript type. This allows a user
557
- of the library to define specific 'types of resources' and leverage static
558
- typing for `GET` and `PUT` requests.
559
- * A few documentation updates.
560
-
561
-
562
- 2.3.0 (2018-10-10)
563
- ------------------
564
-
565
- * Better handling of `Content-Types`. When following HAL links that have a
566
- `type` parameter, the type is rememebered and used in `Accept` and
567
- `Content-Type` headers, for `GET`, `PUT` and `POST` requests.
568
- * If no `type` was provided, it will use the last `Content-Type` header from
569
- `GET` response.
570
- * If that `GET` request never happened, it uses the first 'default'
571
- `Content-Type` from client.contentTypes, and enumerates all mime-types from
572
- that list for `Accept` headers.
573
- * No longer incorrectly sends `text/plain` Content-Types.
574
- * Optimization: If multiple calls are made to ask for a Resource's current
575
- representation, all these calls are coalesced into one. The big benefit is
576
- that there are no longer multiple parallel `GET` requests.
577
- * Webpack browser build is set to 'production' mode.
578
- * Fixed: After refreshing an OAuth2 token, the new access token wasn't used.
579
-
580
-
581
- 2.2.1 (2018-09-19)
582
- ------------------
583
-
584
- * Refreshing OAuth2 tokens without having a refresh_token.
585
- `client_credentials` in particular shouldn't return a `refresh_token`, so
586
- for these cases, new access tokens are acquired using a new
587
- `client_credentials` request.
588
-
589
-
590
- 2.2.0 (2018-09-18)
591
- ------------------
592
-
593
- * Support for OAuth2 `client_credentials` grant.
594
-
595
-
596
- 2.1.0 (2018-09-14)
597
- ------------------
598
-
599
- * No longer ships with `cross-fetch` and `whatwg-fetch`. To use this library
600
- in a browser, you must run this in a browser that supports `fetch` or
601
- provide your own polyfill.
602
- * Updated dependencies
603
-
604
-
605
- 2.0.4 (2018-09-12)
606
- ------------------
607
-
608
- * Fixed bug: HAL title values weren't parsed.
609
-
610
-
611
- 2.0.3 (2018-08-23)
612
- ------------------
613
-
614
- * Exporting 'Resource' for TS purposes.
615
-
616
-
617
- 2.0.2 (2018-08-23)
618
- ------------------
619
-
620
- * Updated dependencies
621
- * Fixed a typescript definition problem.
622
-
623
-
624
- 2.0.1 (2018-06-17)
625
- ------------------
626
-
627
- * Same as last build.
628
-
629
- 2.0.0 (2018-06-17)
630
- ------------------
631
-
632
- * #71: Total conversion to Typescript.
633
- * BC break: Minified files are now in the `browser/` directory, not the `dist/`
634
- directory.
635
- * #78: Webpack build had a broken version of `querystring`, which caused
636
- `Link:` header parsing to fail in browsers.
637
- * #80: `resource.fetch()` would throw an exception with some combinations
638
- of arguments.
639
- * #90: `get()` and `refresh()` will now throw an Error when a server did not
640
- include a content-type.
641
- * #89: Refactored OAuth utility to be a bit more clear.
642
- * #83: Support for `resource.patch()`. The implementation is pretty basic. Let
643
- us know how you would like to use it!
644
-
645
-
646
- 1.1.0 (2018-04-07)
647
- ------------------
648
-
649
- * #70: Moved all source from `lib/` to `src/`. This is prepping for typescript
650
- support.
651
- * #73: Mocha tests can now be ran in a browser.
652
- * #76: Fixed a browser bug: Headers is not a constructor.
653
-
654
-
655
- 1.0.0 (2018-03-25)
656
- ------------------
657
-
658
- * #66: Support for Accept header weighing with the q= parameter.
659
- * #68: Updated all dependencies to their latest version.
660
-
661
-
662
- 0.10.3 (2018-01-31)
663
- -------------------
664
-
665
- * #63: It was not possible to expand templated links with variables after more
666
- than one chained hop. (@mhum).
667
-
668
-
669
- 0.10.2 (2018-01-31)
670
- -------------------
671
-
672
- * #62: It was not possible to override headers such as `Content-Type` when
673
- calling `Resource.fetch()`, if these were also set in the `fetchInit`
674
- defaults. (@mhum).
675
-
676
-
677
- 0.10.1 (2018-01-31)
678
- -------------------
679
-
680
- * #60: Chaining more than 2 `follow` statements did not work.
681
-
682
-
683
- 0.10.0 (2017-11-16)
684
- -------------------
685
-
686
- * #19: Support for OAuth2 access and refresh tokens. When used, the library
687
- can automatically refresh the access token if the previous one expired. It
688
- can also supports the `client_credentials` OAuth2 grant (@mhum).
689
-
690
-
691
- 0.9.0 (2017-09-23)
692
- ------------------
693
-
694
- * #52: Now using the new URL object in browsers for resolving relative urls,
695
- and falling back to a DOM based url resolving mechanism if it's not
696
- available. This causes the browser distribution to drop another 10KB to
697
- 46KB.
698
- * Moved a bunch of utility objects into a `util/` directory, so it's more
699
- clear what the important API's are.
700
- * #55: Fixed another problem related to the fetchInit function in firefox.
701
-
702
-
703
- 0.8.3 (2017-09-10)
704
- -----------------
705
-
706
- * Including the sourcemap file in the NPM distribution.
707
-
708
-
709
- 0.8.2 (2017-09-10)
710
- -----------------
711
-
712
- * #53: Regression related to the new 'fetchInit' option.
713
- * Now generating source maps.
714
-
715
-
716
- 0.8.1 (2017-09-04)
717
- ------------------
718
-
719
- * #50: Allow Fetch settings to be passed to the constructor of Ketting, so that
720
- settings such as `credentials: include` may be passed.
721
-
722
-
723
- 0.8.0 (2017-08-28)
724
- ------------------
725
-
726
- * #49: Removed support for expanding CURIEs in HAL. This was in conflict with
727
- the HAL standard. The canonical relation type is the prefix in the REL, not
728
- the expanded CURIE uri.
729
-
730
-
731
- 0.7.1 (2017-08-24)
732
- ------------------
733
-
734
- * Lots of documentation updates.
735
- * Including web distribution in NPM package.
736
-
737
-
738
- 0.7.0 (2017-08-21)
739
- ------------------
740
-
741
- * This library is now called Ketting. It used to be called Restl. Ketting is
742
- the dutch word for chain.
743
- * Automatically expanding Curies in the HAL `_link` object.
744
-
745
-
746
- 0.6.0 (2017-08-20)
747
- ------------------
748
-
749
- * #15: Browser support via webpack!
750
- * #45: Removed Bluebird dependency.
751
- * #16: Parsing the HTTP `Link` header (RFC5988).
752
- * #30: Added support for automatically parsing `application/problem+json` error
753
- responses and throwing better exceptions. (RFC7807).
754
- * #47: Link object now uses an object as its only constructor argument.
755
-
756
-
757
- 0.5.0 (2017-08-08)
758
- ------------------
759
-
760
- * #41: Support for parsing HTML5. The library can now extract `link` and `a`
761
- elements with `rel` attributes.
762
- * Removed the `accept` option. This should now be controlled with the
763
- `contentTypes` property.
764
- * #40: Removed support for the Requests library. This library now only used
765
- the Fetch API, to make it compatible with browsers in the future.
766
-
767
-
768
- 0.4.2 (2017-08-03)
769
- ------------------
770
-
771
- * #39: Making it easier to fire off custom HTTP requests on a resource using
772
- the Fetch API. You can now just provide the `init` argument without providing
773
- a url.
774
-
775
-
776
- 0.4.1 (2017-07-07)
777
- ------------------
778
-
779
- * #38: Add HTTP response to HTTP-related exceptions.
780
-
781
-
782
- 0.4.0 (2017-07-07)
783
- ------------------
784
-
785
- * #37: Support for templated uris.
786
-
787
-
788
- 0.3.2 (2017-04-27)
789
- ------------------
790
-
791
- * #33: Support for OAuth2 Bearer token.
792
-
793
-
794
- 0.3.1 (2017-04-26)
795
- ------------------
796
-
797
- * #31: Support for setting a standard `Content-Type` HTTP header.
798
-
799
-
800
- 0.3.0 (2017-04-24)
801
- ------------------
802
-
803
- * #28: Support for Basic Authentication
804
-
805
-
806
- 0.2.1 (2017-04-21)
807
- ------------------
808
-
809
- * #27: Fixed exception messages, they missed the HTTP status code.
810
-
811
-
812
- 0.2.0 (2017-04-21)
813
- ------------------
814
-
815
- * #17: Now using the Fetch API instead of the requests library. The requests
816
- library is kept around for BC purposes, but this will eventually be removed.
817
- * #25: the resourceCache was accidentally shared between Client instances.
818
-
819
-
820
- 0.1.2 (2017-04-19)
821
- ------------------
822
-
823
- * #11: Added test framework.
824
- * #11: Added `follow()` function on Client object for an easy shortcut.
825
-
826
-
827
- 0.1.1 (2017-04-03)
828
- ------------------
829
-
830
- * #10: Returning the response body from the `refresh()` function, similar to
831
- `GET` but cache-defeating.
832
-
833
-
834
- 0.1.0 (2017-02-13)
835
- ------------------
836
-
837
- * #7: Strip `_embedded` and `_links` from `Representation.body`. They are
838
- already available through `Representation.embedded` and
839
- `Representation.links`.
840
- * Added a cache for resources in the Client object, which ensures that if you
841
- request the same resource twice, you'll end up with the same object.
842
- * #6: Automatically parse `_embedded` and treat items in this object as real
843
- resources.
844
- * Fixed a bug in `post()`.
845
- * Allowing custom headers to be set, and allowing default headers to be
846
- overridden.
847
- * Automatically resolve all urls from `links()`.
848
-
849
-
850
- 0.0.4 (2017-02-06)
851
- -----------------
852
-
853
- * Bugfixes.
854
- * Linting with eslint.
855
-
856
-
857
- 0.0.3 (2017-02-06)
858
- ------------------
859
-
860
- * Now using Bluebird for promises, so we can extend them.
861
- * #2: Custom requests are now possible on `Resource` objects.
862
- * #3: Promises returned from `follow()` now have a `follow()` function
863
- themselves, making it extremely easy to hop from link to link.
864
- * Added a `post()` method for making new resources. This function returns a
865
- `Resource` object again if the response contained a `Location` header.
866
- * #4: Things in the `_embedded` property are now also treated as links and can
867
- be followed.
868
- * The `links()` method on Resource now have a `rel` argument for easy filtering.
869
- * Added a `followAll()` function for getting collections.
870
-
871
-
872
- 0.0.2 (2017-01-03)
873
- ------------------
874
-
875
- * `PUT` request.
876
- * `DELETE` request.
877
-
878
-
879
- 0.0.1 (2016-12-28)
880
- ------------------
881
-
882
- * First version!
883
- * Parses HAL `_links`.
884
- * Follows links.
885
- * `GET` requests.
886
- * `refresh()` function.
887
-
888
- [1]: https://github.com/kevinswiber/siren
889
- [2]: https://tools.ietf.org/html/draft-nottingham-linked-cache-inv-04
890
- [3]: https://tools.ietf.org/html/draft-pot-prefer-push
891
- [4]: http://amundsen.com/media-types/collection/format/
892
- [5]: http://rwcbook.github.io/hal-forms/
893
- [6]: https://tools.ietf.org/html/rfc7807 "Problem Details for HTTP APIs"
894
- [7]: https://tools.ietf.org/html/draft-dalal-deprecation-header-03 "The Deprecation HTTP Header Field"