@carlonicora/nextjs-jsonapi 6.20.1 → 6.20.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/package.json
CHANGED
|
@@ -195,7 +195,10 @@ describe("RehydrationFactory", () => {
|
|
|
195
195
|
for (const ref of data.jsonApi.relationships?.links?.data ?? []) {
|
|
196
196
|
const target = data.included.find((item: any) => item.type === ref.type && item.id === ref.id);
|
|
197
197
|
if (!target) continue;
|
|
198
|
-
const node = RehydrationFactory.rehydrate<any>(nodeModule as any, {
|
|
198
|
+
const node = RehydrationFactory.rehydrate<any>(nodeModule as any, {
|
|
199
|
+
jsonApi: target,
|
|
200
|
+
included: data.included,
|
|
201
|
+
});
|
|
199
202
|
if (node) this.links.push(node);
|
|
200
203
|
}
|
|
201
204
|
return this;
|
|
@@ -229,7 +232,12 @@ describe("RehydrationFactory", () => {
|
|
|
229
232
|
it("densely linked included data is rehydrated in linear, not exponential, work", () => {
|
|
230
233
|
// Twelve resources, each linked to every other one: every path through them would be 11! chains.
|
|
231
234
|
const ids = Array.from({ length: 12 }, (_, index) => `n${index}`);
|
|
232
|
-
const included = ids.map((id) =>
|
|
235
|
+
const included = ids.map((id) =>
|
|
236
|
+
node(
|
|
237
|
+
id,
|
|
238
|
+
ids.filter((other) => other !== id),
|
|
239
|
+
),
|
|
240
|
+
);
|
|
233
241
|
|
|
234
242
|
const result = RehydrationFactory.rehydrate<any>(nodeModule as any, { jsonApi: included[0], included });
|
|
235
243
|
|
|
@@ -614,10 +614,12 @@ describe("syncRoot", () => {
|
|
|
614
614
|
const calls = JsonApiGet.mock.calls.map((call) => call[0]);
|
|
615
615
|
// The target reads run concurrently, in any order.
|
|
616
616
|
expect(calls[0].endpoint).toBe("roots/C/sync");
|
|
617
|
-
expect(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
expect(
|
|
618
|
+
calls
|
|
619
|
+
.slice(1)
|
|
620
|
+
.map((call) => call.endpoint)
|
|
621
|
+
.sort(),
|
|
622
|
+
).toEqual(["roots/C/clues/k1/player-notes", "roots/C/sessions/s1/player-notes"]);
|
|
621
623
|
expect(calls.slice(1).every((call) => call.classKey === PlayerNotes)).toBe(true);
|
|
622
624
|
expect((await store.getRecord("player-notes", "p1"))?.updatedAt).toEqual(new Date("2026-10-31T10:00:00.000Z"));
|
|
623
625
|
expect(await store.getRecord("player-notes", "p3")).toBeDefined();
|