@alchemy_cms/json_api 0.26.0 → 1.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,286 @@
1
+ # Changelog
2
+
3
+ ## [v1.1.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v1.0.0) (2022-09-16)
4
+
5
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v1.0.0...v1.1.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - JS: Add support for deserializing camelCased attributes [\#65](https://github.com/AlchemyCMS/alchemy-json_api/pull/65) ([tvdeyen](https://github.com/tvdeyen))
10
+
11
+ ## [v1.0.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v1.0.0) (2022-09-09)
12
+
13
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.26.0...v1.0.0)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Allow key transforms [\#64](https://github.com/AlchemyCMS/alchemy-json_api/pull/64) ([tvdeyen](https://github.com/tvdeyen))
18
+ - Add deserializer JS files [\#63](https://github.com/AlchemyCMS/alchemy-json_api/pull/63) ([tvdeyen](https://github.com/tvdeyen))
19
+ - Add nodes API controller [\#61](https://github.com/AlchemyCMS/alchemy-json_api/pull/61) ([tvdeyen](https://github.com/tvdeyen))
20
+ - Add a session store to dummy app [\#60](https://github.com/AlchemyCMS/alchemy-json_api/pull/60) ([tvdeyen](https://github.com/tvdeyen))
21
+
22
+ ## [v0.26.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.26.0) (2022-05-10)
23
+
24
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.25.0...v0.26.0)
25
+
26
+ **Merged pull requests:**
27
+
28
+ - Return image mime type with srcset responses [\#59](https://github.com/AlchemyCMS/alchemy-json_api/pull/59) ([tvdeyen](https://github.com/tvdeyen))
29
+
30
+ ## [v0.25.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.25.0) (2021-11-15)
31
+
32
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.24.0...v0.25.0)
33
+
34
+ **Merged pull requests:**
35
+
36
+ - Add support for disabled cache per page [\#58](https://github.com/AlchemyCMS/alchemy-json_api/pull/58) ([tvdeyen](https://github.com/tvdeyen))
37
+
38
+ ## [v0.24.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.24.0) (2021-11-05)
39
+
40
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.23.0...v0.24.0)
41
+
42
+ **Merged pull requests:**
43
+
44
+ - Add srcset support [\#57](https://github.com/AlchemyCMS/alchemy-json_api/pull/57) ([tvdeyen](https://github.com/tvdeyen))
45
+
46
+ ## [v0.23.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.23.0) (2021-10-28)
47
+
48
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.22.0...v0.23.0)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Do not throw error if filter returns empty result [\#56](https://github.com/AlchemyCMS/alchemy-json_api/pull/56) ([tvdeyen](https://github.com/tvdeyen))
53
+
54
+ ## [v0.22.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.22.0) (2021-10-25)
55
+
56
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.21.0...v0.22.0)
57
+
58
+ **Merged pull requests:**
59
+
60
+ - Add url\_path attribute to page serializer [\#55](https://github.com/AlchemyCMS/alchemy-json_api/pull/55) ([tvdeyen](https://github.com/tvdeyen))
61
+
62
+ ## [v0.21.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.21.0) (2021-09-17)
63
+
64
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.20.0...v0.21.0)
65
+
66
+ **Merged pull requests:**
67
+
68
+ - Add caching [\#54](https://github.com/AlchemyCMS/alchemy-json_api/pull/54) ([tvdeyen](https://github.com/tvdeyen))
69
+ - Allow urlname as page filter [\#53](https://github.com/AlchemyCMS/alchemy-json_api/pull/53) ([tvdeyen](https://github.com/tvdeyen))
70
+
71
+ ## [v0.20.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.20.0) (2021-07-07)
72
+
73
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.15.0...v0.20.0)
74
+
75
+ **Merged pull requests:**
76
+
77
+ - More essence serializers [\#52](https://github.com/AlchemyCMS/alchemy-json_api/pull/52) ([tvdeyen](https://github.com/tvdeyen))
78
+ - Add support for Alchemy Ingredients [\#51](https://github.com/AlchemyCMS/alchemy-json_api/pull/51) ([tvdeyen](https://github.com/tvdeyen))
79
+
80
+ ## [v0.15.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.15.0) (2021-05-19)
81
+
82
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.14.0...v0.15.0)
83
+
84
+ **Merged pull requests:**
85
+
86
+ - Return real image dimensions [\#50](https://github.com/AlchemyCMS/alchemy-json_api/pull/50) ([tvdeyen](https://github.com/tvdeyen))
87
+
88
+ ## [v0.14.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.14.0) (2021-04-27)
89
+
90
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.13.0...v0.14.0)
91
+
92
+ **Merged pull requests:**
93
+
94
+ - Add ancestors relationship to page serializer [\#49](https://github.com/AlchemyCMS/alchemy-json_api/pull/49) ([tvdeyen](https://github.com/tvdeyen))
95
+ - Join to page version in PagesController [\#48](https://github.com/AlchemyCMS/alchemy-json_api/pull/48) ([mamhoff](https://github.com/mamhoff))
96
+ - Serialize the new sanitized\_body column from Alchemy [\#47](https://github.com/AlchemyCMS/alchemy-json_api/pull/47) ([mamhoff](https://github.com/mamhoff))
97
+ - Admin controller fixes [\#46](https://github.com/AlchemyCMS/alchemy-json_api/pull/46) ([tvdeyen](https://github.com/tvdeyen))
98
+
99
+ ## [v0.13.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.13.0) (2021-03-05)
100
+
101
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.12.2...v0.13.0)
102
+
103
+ **Merged pull requests:**
104
+
105
+ - Fix loading of alchemy factories [\#45](https://github.com/AlchemyCMS/alchemy-json_api/pull/45) ([tvdeyen](https://github.com/tvdeyen))
106
+ - Add support for page versions [\#44](https://github.com/AlchemyCMS/alchemy-json_api/pull/44) ([tvdeyen](https://github.com/tvdeyen))
107
+ - Preload legacy page URLs [\#43](https://github.com/AlchemyCMS/alchemy-json_api/pull/43) ([pelargir](https://github.com/pelargir))
108
+ - Add legacy URLs to page serializer [\#42](https://github.com/AlchemyCMS/alchemy-json_api/pull/42) ([pelargir](https://github.com/pelargir))
109
+ - Fix pagination related specs [\#41](https://github.com/AlchemyCMS/alchemy-json_api/pull/41) ([tvdeyen](https://github.com/tvdeyen))
110
+ - Remove tests for trashed elements [\#40](https://github.com/AlchemyCMS/alchemy-json_api/pull/40) ([tvdeyen](https://github.com/tvdeyen))
111
+ - Fix factory loading [\#39](https://github.com/AlchemyCMS/alchemy-json_api/pull/39) ([tvdeyen](https://github.com/tvdeyen))
112
+
113
+ ## [v0.12.2](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.12.2) (2021-01-27)
114
+
115
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.12.1...v0.12.2)
116
+
117
+ **Merged pull requests:**
118
+
119
+ - Add missing Alchemy::Logger include to Element [\#37](https://github.com/AlchemyCMS/alchemy-json_api/pull/37) ([pelargir](https://github.com/pelargir))
120
+
121
+ ## [v0.12.1](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.12.1) (2021-01-26)
122
+
123
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.12.0...v0.12.1)
124
+
125
+ **Merged pull requests:**
126
+
127
+ - Fix essence serializer RSpec behavior [\#36](https://github.com/AlchemyCMS/alchemy-json_api/pull/36) ([tvdeyen](https://github.com/tvdeyen))
128
+
129
+ ## [v0.12.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.12.0) (2021-01-25)
130
+
131
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.11.0...v0.12.0)
132
+
133
+ **Merged pull requests:**
134
+
135
+ - Eager load nodes children [\#34](https://github.com/AlchemyCMS/alchemy-json_api/pull/34) ([tvdeyen](https://github.com/tvdeyen))
136
+ - Fixes element filtering for nested elements [\#33](https://github.com/AlchemyCMS/alchemy-json_api/pull/33) ([tvdeyen](https://github.com/tvdeyen))
137
+
138
+ ## [v0.11.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.11.0) (2021-01-21)
139
+
140
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.10.1...v0.11.0)
141
+
142
+ **Merged pull requests:**
143
+
144
+ - Remove admin features from serializers [\#32](https://github.com/AlchemyCMS/alchemy-json_api/pull/32) ([tvdeyen](https://github.com/tvdeyen))
145
+ - Optimize elements loading [\#31](https://github.com/AlchemyCMS/alchemy-json_api/pull/31) ([tvdeyen](https://github.com/tvdeyen))
146
+ - Add deprecated attribute to elements and contents [\#30](https://github.com/AlchemyCMS/alchemy-json_api/pull/30) ([tvdeyen](https://github.com/tvdeyen))
147
+ - Revert removal of deprecated elements [\#29](https://github.com/AlchemyCMS/alchemy-json_api/pull/29) ([tvdeyen](https://github.com/tvdeyen))
148
+
149
+ ## [v0.10.1](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.10.1) (2021-01-19)
150
+
151
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.10.0...v0.10.1)
152
+
153
+ **Merged pull requests:**
154
+
155
+ - Remove deprecated elements from all element relations [\#28](https://github.com/AlchemyCMS/alchemy-json_api/pull/28) ([tvdeyen](https://github.com/tvdeyen))
156
+
157
+ ## [v0.10.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.10.0) (2021-01-18)
158
+
159
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.9.1...v0.10.0)
160
+
161
+ **Merged pull requests:**
162
+
163
+ - Test with all supported Alchemy versions [\#27](https://github.com/AlchemyCMS/alchemy-json_api/pull/27) ([tvdeyen](https://github.com/tvdeyen))
164
+ - Do not include deprecated elements and essences [\#26](https://github.com/AlchemyCMS/alchemy-json_api/pull/26) ([tvdeyen](https://github.com/tvdeyen))
165
+ - Allow Alchemy 6 [\#25](https://github.com/AlchemyCMS/alchemy-json_api/pull/25) ([tvdeyen](https://github.com/tvdeyen))
166
+
167
+ ## [v0.9.1](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.9.1) (2020-12-09)
168
+
169
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.9.0...v0.9.1)
170
+
171
+ **Merged pull requests:**
172
+
173
+ - Return all layoutpages regardless of publication status [\#24](https://github.com/AlchemyCMS/alchemy-json_api/pull/24) ([tvdeyen](https://github.com/tvdeyen))
174
+
175
+ ## [v0.9.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.9.0) (2020-11-30)
176
+
177
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.8.1...v0.9.0)
178
+
179
+ **Closed issues:**
180
+
181
+ - Use jsonapi-serializer instead of fast\_jsonapi [\#22](https://github.com/AlchemyCMS/alchemy-json_api/issues/22)
182
+
183
+ **Merged pull requests:**
184
+
185
+ - Switch from fast\_jsonapi to jsonapi-serializer [\#23](https://github.com/AlchemyCMS/alchemy-json_api/pull/23) ([tvdeyen](https://github.com/tvdeyen))
186
+
187
+ ## [v0.8.1](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.8.1) (2020-11-17)
188
+
189
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.8.0...v0.8.1)
190
+
191
+ **Merged pull requests:**
192
+
193
+ - Fix page base scope for anonymous users [\#20](https://github.com/AlchemyCMS/alchemy-json_api/pull/20) ([tvdeyen](https://github.com/tvdeyen))
194
+
195
+ ## [v0.8.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.8.0) (2020-11-16)
196
+
197
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.7.2...v0.8.0)
198
+
199
+ **Merged pull requests:**
200
+
201
+ - Add authorization [\#19](https://github.com/AlchemyCMS/alchemy-json_api/pull/19) ([tvdeyen](https://github.com/tvdeyen))
202
+
203
+ ## [v0.7.2](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.7.2) (2020-11-16)
204
+
205
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.7.1...v0.7.2)
206
+
207
+ **Merged pull requests:**
208
+
209
+ - Fully qualify the names of Serializer classes [\#18](https://github.com/AlchemyCMS/alchemy-json_api/pull/18) ([mamhoff](https://github.com/mamhoff))
210
+
211
+ ## [v0.7.1](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.7.1) (2020-11-16)
212
+
213
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.7.0...v0.7.1)
214
+
215
+ **Merged pull requests:**
216
+
217
+ - Specify Record Type and Serializer Class for all relations [\#17](https://github.com/AlchemyCMS/alchemy-json_api/pull/17) ([mamhoff](https://github.com/mamhoff))
218
+
219
+ ## [v0.7.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.7.0) (2020-11-16)
220
+
221
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.6.0...v0.7.0)
222
+
223
+ **Merged pull requests:**
224
+
225
+ - Log errors into standard out [\#16](https://github.com/AlchemyCMS/alchemy-json_api/pull/16) ([mamhoff](https://github.com/mamhoff))
226
+
227
+ ## [v0.6.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.6.0) (2020-11-12)
228
+
229
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.5.0...v0.6.0)
230
+
231
+ **Merged pull requests:**
232
+
233
+ - Revert "Only include errors mixin in production mode" [\#15](https://github.com/AlchemyCMS/alchemy-json_api/pull/15) ([tvdeyen](https://github.com/tvdeyen))
234
+
235
+ ## [v0.5.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.5.0) (2020-11-06)
236
+
237
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.4.0...v0.5.0)
238
+
239
+ **Merged pull requests:**
240
+
241
+ - Add fixed\_elements relationship to element serializer [\#14](https://github.com/AlchemyCMS/alchemy-json_api/pull/14) ([tvdeyen](https://github.com/tvdeyen))
242
+ - Rename element\_type into name [\#13](https://github.com/AlchemyCMS/alchemy-json_api/pull/13) ([tvdeyen](https://github.com/tvdeyen))
243
+ - Only include errors mixin in production mode [\#12](https://github.com/AlchemyCMS/alchemy-json_api/pull/12) ([tvdeyen](https://github.com/tvdeyen))
244
+
245
+ ## [v0.4.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.4.0) (2020-10-28)
246
+
247
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.3.0...v0.4.0)
248
+
249
+ **Merged pull requests:**
250
+
251
+ - Use full module paths in serializers [\#11](https://github.com/AlchemyCMS/alchemy-json_api/pull/11) ([tvdeyen](https://github.com/tvdeyen))
252
+
253
+ ## [v0.3.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.3.0) (2020-10-28)
254
+
255
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.2.0...v0.3.0)
256
+
257
+ **Merged pull requests:**
258
+
259
+ - Add EssencePageSerializer [\#10](https://github.com/AlchemyCMS/alchemy-json_api/pull/10) ([tvdeyen](https://github.com/tvdeyen))
260
+ - Remove link\_helper [\#9](https://github.com/AlchemyCMS/alchemy-json_api/pull/9) ([tvdeyen](https://github.com/tvdeyen))
261
+ - Expose essence serializer behavior [\#8](https://github.com/AlchemyCMS/alchemy-json_api/pull/8) ([tvdeyen](https://github.com/tvdeyen))
262
+ - Add support for nested urlnames [\#7](https://github.com/AlchemyCMS/alchemy-json_api/pull/7) ([tvdeyen](https://github.com/tvdeyen))
263
+
264
+ ## [v0.2.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.2.0) (2020-09-15)
265
+
266
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/v0.1.0...v0.2.0)
267
+
268
+ **Merged pull requests:**
269
+
270
+ - Fix specs, bump version [\#6](https://github.com/AlchemyCMS/alchemy-json_api/pull/6) ([mamhoff](https://github.com/mamhoff))
271
+ - Add pagination to pages endpoint [\#5](https://github.com/AlchemyCMS/alchemy-json_api/pull/5) ([tvdeyen](https://github.com/tvdeyen))
272
+
273
+ ## [v0.1.0](https://github.com/AlchemyCMS/alchemy-json_api/tree/v0.1.0) (2020-05-15)
274
+
275
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-json_api/compare/f51e01b16ad44b372edbaf983b041b6b6ed383b6...v0.1.0)
276
+
277
+ **Merged pull requests:**
278
+
279
+ - Do not render trashed elements [\#4](https://github.com/AlchemyCMS/alchemy-json_api/pull/4) ([mamhoff](https://github.com/mamhoff))
280
+ - Add Rufo and Rubocop [\#3](https://github.com/AlchemyCMS/alchemy-json_api/pull/3) ([mamhoff](https://github.com/mamhoff))
281
+ - Add Layout Pages Controller [\#2](https://github.com/AlchemyCMS/alchemy-json_api/pull/2) ([mamhoff](https://github.com/mamhoff))
282
+ - Add Language Serializer [\#1](https://github.com/AlchemyCMS/alchemy-json_api/pull/1) ([mamhoff](https://github.com/mamhoff))
283
+
284
+
285
+
286
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
package/README.md CHANGED
@@ -57,6 +57,16 @@ const pages = deserializePages(data)
57
57
  console.log(pages[0].name) // => Homepage
58
58
  ```
59
59
 
60
+ ## Key transforms
61
+
62
+ If you ever want to change how Alchemy serializes attributes you can set
63
+
64
+ ```rb
65
+ Alchemy::JsonApi.key_transform = :camel_lower
66
+ ```
67
+
68
+ It defaults to `:underscore`.
69
+
60
70
  ## Contributing
61
71
  Contribution directions go here.
62
72
 
@@ -86,13 +86,15 @@ function findJsonApiIncluded(included, type, id, options) {
86
86
  function filterDeprecatedElements(elements) {
87
87
  const els = [];
88
88
  elements.forEach(element => {
89
- var _element$nested_eleme, _element$essences;
90
-
91
- if (((_element$nested_eleme = element.nested_elements) === null || _element$nested_eleme === void 0 ? void 0 : _element$nested_eleme.length) > 0) {
89
+ if (element.nested_elements?.length > 0) {
92
90
  element.nested_elements = filterDeprecatedElements(element.nested_elements);
93
91
  }
94
92
 
95
- if (((_element$essences = element.essences) === null || _element$essences === void 0 ? void 0 : _element$essences.length) > 0) {
93
+ if (element.nestedElements?.length > 0) {
94
+ element.nestedElements = filterDeprecatedElements(element.nestedElements);
95
+ }
96
+
97
+ if (element.essences?.length > 0) {
96
98
  element.essences = element.essences.filter(essence => {
97
99
  return !essence.deprecated;
98
100
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/json_api",
3
- "version": "0.26.0",
3
+ "version": "1.1.0",
4
4
  "description": "JSON API deserializer for AlchemyCMS",
5
5
  "license": "BSD-3-Clause",
6
6
  "repository": {