@carlonicora/nextjs-jsonapi 1.46.0 → 1.47.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 (53) hide show
  1. package/dist/{BlockNoteEditor-WBCUJKNR.mjs → BlockNoteEditor-J7R24CYB.mjs} +5 -5
  2. package/dist/{BlockNoteEditor-XFHT44IV.js → BlockNoteEditor-XMBFXTHB.js} +15 -15
  3. package/dist/{BlockNoteEditor-XFHT44IV.js.map → BlockNoteEditor-XMBFXTHB.js.map} +1 -1
  4. package/dist/JsonApiRequest-CRRH5B5V.js +24 -0
  5. package/dist/{JsonApiRequest-MUPAO7DI.js.map → JsonApiRequest-CRRH5B5V.js.map} +1 -1
  6. package/dist/{JsonApiRequest-XCQHVVYD.mjs → JsonApiRequest-I2S75QTJ.mjs} +2 -2
  7. package/dist/billing/index.js +347 -347
  8. package/dist/billing/index.mjs +4 -4
  9. package/dist/{chunk-WLS4D6VG.js → chunk-4MN547K7.js} +8 -1
  10. package/dist/chunk-4MN547K7.js.map +1 -0
  11. package/dist/{chunk-GCQUTWZ2.mjs → chunk-BTKJFMFL.mjs} +8 -1
  12. package/dist/chunk-BTKJFMFL.mjs.map +1 -0
  13. package/dist/{chunk-4HMQNMP6.mjs → chunk-BUCV5VFT.mjs} +2 -2
  14. package/dist/{chunk-OMYDD2UE.js → chunk-HY357JCN.js} +565 -565
  15. package/dist/chunk-HY357JCN.js.map +1 -0
  16. package/dist/{chunk-LM4SDN4Y.mjs → chunk-IPVXH3VC.mjs} +43 -5
  17. package/dist/chunk-IPVXH3VC.mjs.map +1 -0
  18. package/dist/{chunk-YM7XSACC.mjs → chunk-LYQMDZO7.mjs} +6 -6
  19. package/dist/chunk-LYQMDZO7.mjs.map +1 -0
  20. package/dist/{chunk-5PUPWZB4.js → chunk-ULHMVHDS.js} +137 -99
  21. package/dist/chunk-ULHMVHDS.js.map +1 -0
  22. package/dist/{chunk-GP3MDKGE.js → chunk-V63TFESU.js} +3 -3
  23. package/dist/{chunk-GP3MDKGE.js.map → chunk-V63TFESU.js.map} +1 -1
  24. package/dist/client/index.js +5 -5
  25. package/dist/client/index.mjs +4 -4
  26. package/dist/components/index.js +5 -5
  27. package/dist/components/index.mjs +4 -4
  28. package/dist/contexts/index.js +5 -5
  29. package/dist/contexts/index.mjs +4 -4
  30. package/dist/core/index.d.mts +12 -0
  31. package/dist/core/index.d.ts +12 -0
  32. package/dist/core/index.js +3 -3
  33. package/dist/core/index.mjs +2 -2
  34. package/dist/index.js +4 -4
  35. package/dist/index.mjs +3 -3
  36. package/dist/server/index.js +12 -12
  37. package/dist/server/index.mjs +2 -2
  38. package/package.json +1 -1
  39. package/src/components/tables/cells/cell.date.tsx +1 -3
  40. package/src/core/abstracts/AbstractApiData.ts +56 -0
  41. package/src/core/abstracts/__tests__/readIncludedPolymorphic.spec.ts +195 -0
  42. package/src/core/registry/DataClassRegistry.ts +8 -0
  43. package/src/core/registry/__tests__/DataClassRegistry.getByJsonApiType.spec.ts +138 -0
  44. package/dist/JsonApiRequest-MUPAO7DI.js +0 -24
  45. package/dist/chunk-5PUPWZB4.js.map +0 -1
  46. package/dist/chunk-GCQUTWZ2.mjs.map +0 -1
  47. package/dist/chunk-LM4SDN4Y.mjs.map +0 -1
  48. package/dist/chunk-OMYDD2UE.js.map +0 -1
  49. package/dist/chunk-WLS4D6VG.js.map +0 -1
  50. package/dist/chunk-YM7XSACC.mjs.map +0 -1
  51. /package/dist/{BlockNoteEditor-WBCUJKNR.mjs.map → BlockNoteEditor-J7R24CYB.mjs.map} +0 -0
  52. /package/dist/{JsonApiRequest-XCQHVVYD.mjs.map → JsonApiRequest-I2S75QTJ.mjs.map} +0 -0
  53. /package/dist/{chunk-4HMQNMP6.mjs.map → chunk-BUCV5VFT.mjs.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  setBootstrapper,
15
15
  translateResponse,
16
16
  tryBootstrap
17
- } from "./chunk-GCQUTWZ2.mjs";
17
+ } from "./chunk-BTKJFMFL.mjs";
18
18
  import {
19
19
  __name
20
20
  } from "./chunk-PAWJFY3S.mjs";
@@ -119,6 +119,44 @@ var AbstractApiData = class {
119
119
  included: data.included
120
120
  });
121
121
  }
122
+ /**
123
+ * Read included relationships with polymorphic type resolution.
124
+ * Determines the correct model class based on the JSON:API type in included data.
125
+ */
126
+ _readIncludedPolymorphic(data, relationshipKey, candidateModules) {
127
+ if (!data.included?.length || !data.jsonApi.relationships?.[relationshipKey]?.data) {
128
+ return void 0;
129
+ }
130
+ const relData = data.jsonApi.relationships[relationshipKey].data;
131
+ const typeToModule = /* @__PURE__ */ new Map();
132
+ for (const mod of candidateModules) {
133
+ typeToModule.set(mod.name, mod);
134
+ }
135
+ if (Array.isArray(relData)) {
136
+ const result = [];
137
+ for (const item of relData) {
138
+ const includedItem2 = data.included.find((inc) => inc.id === item.id && inc.type === item.type);
139
+ if (!includedItem2) continue;
140
+ const module2 = typeToModule.get(includedItem2.type);
141
+ if (!module2) continue;
142
+ result.push(
143
+ RehydrationFactory.rehydrate(module2, {
144
+ jsonApi: includedItem2,
145
+ included: data.included
146
+ })
147
+ );
148
+ }
149
+ return result.length > 0 ? result : void 0;
150
+ }
151
+ const includedItem = data.included.find((inc) => inc.id === relData.id && inc.type === relData.type);
152
+ if (!includedItem) return void 0;
153
+ const module = typeToModule.get(includedItem.type);
154
+ if (!module) return void 0;
155
+ return RehydrationFactory.rehydrate(module, {
156
+ jsonApi: includedItem,
157
+ included: data.included
158
+ });
159
+ }
122
160
  /**
123
161
  * Read included relationship data and augment with relationship meta properties.
124
162
  * Handles both single relationships (one-to-one) and array relationships (one-to-many).
@@ -283,7 +321,7 @@ var AbstractService = class {
283
321
  * Make an API call with automatic environment detection and error handling.
284
322
  */
285
323
  static async callApi(params) {
286
- const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-XCQHVVYD.mjs");
324
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-I2S75QTJ.mjs");
287
325
  let apiResponse;
288
326
  let language = "en";
289
327
  if (typeof window === "undefined") {
@@ -373,7 +411,7 @@ var AbstractService = class {
373
411
  * Make an API call and return both data and meta from the response.
374
412
  */
375
413
  static async callApiWithMeta(params) {
376
- const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-XCQHVVYD.mjs");
414
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-I2S75QTJ.mjs");
377
415
  let apiResponse;
378
416
  let language = "en";
379
417
  if (typeof window === "undefined") {
@@ -458,7 +496,7 @@ var AbstractService = class {
458
496
  * Get raw JSON:API response data without deserialization.
459
497
  */
460
498
  static async getRawData(params) {
461
- const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-XCQHVVYD.mjs");
499
+ const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-I2S75QTJ.mjs");
462
500
  let language = "en";
463
501
  if (typeof window === "undefined") {
464
502
  const { getLocale } = await import("next-intl/server");
@@ -6697,4 +6735,4 @@ export {
6697
6735
  ReferralModule,
6698
6736
  ReferralStatsModule
6699
6737
  };
6700
- //# sourceMappingURL=chunk-LM4SDN4Y.mjs.map
6738
+ //# sourceMappingURL=chunk-IPVXH3VC.mjs.map