@zeroxsolutions/response 0.14.1 → 0.14.2

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 CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.14.2 (2026-09-29)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **response:** permit the fields of every declaration a type is reached by ([2ac6992](https://github.com/zeroxsolutions/zeroxsolutions/commit/2ac6992))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Claude Opus 5.5 (1M context)
10
+ - Lương Văn Tú
11
+
1
12
  ## 0.14.1 (2026-09-28)
2
13
 
3
14
  ### 🚀 Features
@@ -1 +1 @@
1
- {"version":3,"file":"document-shape.d.ts","sourceRoot":"","sources":["../src/document-shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EACnF,IAAI,EAAE,CAAC,EACP,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,CAAC,CAAA;CAAO,GACpC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAyB1B"}
1
+ {"version":3,"file":"document-shape.d.ts","sourceRoot":"","sources":["../src/document-shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EACnF,IAAI,EAAE,CAAC,EACP,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,CAAC,CAAA;CAAO,GACpC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CA+B1B"}
@@ -14,7 +14,16 @@
14
14
  */
15
15
  export function declaredDocumentShape(root, options = {}) {
16
16
  const maxDepth = options.maxIncludeDepth ?? 3;
17
- const reached = new Map([[root.type, root]]);
17
+ // A type two declarations reach (a whole resource under one relationship, its identifier alone under another) is
18
+ // one type to a fieldset, so it permits the fields of every declaration that reaches it.
19
+ const fields = new Map();
20
+ const reach = (resource) => {
21
+ const names = fields.get(resource.type) ?? new Set();
22
+ for (const name of [...Object.keys(resource.attributes.shape), ...Object.keys(resource.relationships)])
23
+ names.add(name);
24
+ fields.set(resource.type, names);
25
+ };
26
+ reach(root);
18
27
  const include = [];
19
28
  // A path never revisits a type: two resources naming each other make `class.subject.class...` infinite, and the
20
29
  // second lap addresses the same rows the first one already compounded.
@@ -27,14 +36,13 @@ export function declaredDocumentShape(root, options = {}) {
27
36
  continue;
28
37
  const path = prefix === '' ? name : `${prefix}.${name}`;
29
38
  include.push(path);
30
- reached.set(related.type, related);
39
+ reach(related);
31
40
  walk(related, path, new Set([...seen, related.type]), depth + 1);
32
41
  }
33
42
  };
34
43
  walk(root, '', new Set([root.type]), 0);
35
- const fields = Object.fromEntries([...reached.values()].map((resource) => [
36
- resource.type,
37
- [...Object.keys(resource.attributes.shape), ...Object.keys(resource.relationships)],
38
- ]));
39
- return { fields, include };
44
+ return {
45
+ fields: Object.fromEntries([...fields].map(([type, names]) => [type, [...names]])),
46
+ include,
47
+ };
40
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroxsolutions/response",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,