@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.
- package/dist/{BlockNoteEditor-WBCUJKNR.mjs → BlockNoteEditor-J7R24CYB.mjs} +5 -5
- package/dist/{BlockNoteEditor-XFHT44IV.js → BlockNoteEditor-XMBFXTHB.js} +15 -15
- package/dist/{BlockNoteEditor-XFHT44IV.js.map → BlockNoteEditor-XMBFXTHB.js.map} +1 -1
- package/dist/JsonApiRequest-CRRH5B5V.js +24 -0
- package/dist/{JsonApiRequest-MUPAO7DI.js.map → JsonApiRequest-CRRH5B5V.js.map} +1 -1
- package/dist/{JsonApiRequest-XCQHVVYD.mjs → JsonApiRequest-I2S75QTJ.mjs} +2 -2
- package/dist/billing/index.js +347 -347
- package/dist/billing/index.mjs +4 -4
- package/dist/{chunk-WLS4D6VG.js → chunk-4MN547K7.js} +8 -1
- package/dist/chunk-4MN547K7.js.map +1 -0
- package/dist/{chunk-GCQUTWZ2.mjs → chunk-BTKJFMFL.mjs} +8 -1
- package/dist/chunk-BTKJFMFL.mjs.map +1 -0
- package/dist/{chunk-4HMQNMP6.mjs → chunk-BUCV5VFT.mjs} +2 -2
- package/dist/{chunk-OMYDD2UE.js → chunk-HY357JCN.js} +565 -565
- package/dist/chunk-HY357JCN.js.map +1 -0
- package/dist/{chunk-LM4SDN4Y.mjs → chunk-IPVXH3VC.mjs} +43 -5
- package/dist/chunk-IPVXH3VC.mjs.map +1 -0
- package/dist/{chunk-YM7XSACC.mjs → chunk-LYQMDZO7.mjs} +6 -6
- package/dist/chunk-LYQMDZO7.mjs.map +1 -0
- package/dist/{chunk-5PUPWZB4.js → chunk-ULHMVHDS.js} +137 -99
- package/dist/chunk-ULHMVHDS.js.map +1 -0
- package/dist/{chunk-GP3MDKGE.js → chunk-V63TFESU.js} +3 -3
- package/dist/{chunk-GP3MDKGE.js.map → chunk-V63TFESU.js.map} +1 -1
- package/dist/client/index.js +5 -5
- package/dist/client/index.mjs +4 -4
- package/dist/components/index.js +5 -5
- package/dist/components/index.mjs +4 -4
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.d.mts +12 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +3 -3
- package/dist/core/index.mjs +2 -2
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/dist/server/index.js +12 -12
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/components/tables/cells/cell.date.tsx +1 -3
- package/src/core/abstracts/AbstractApiData.ts +56 -0
- package/src/core/abstracts/__tests__/readIncludedPolymorphic.spec.ts +195 -0
- package/src/core/registry/DataClassRegistry.ts +8 -0
- package/src/core/registry/__tests__/DataClassRegistry.getByJsonApiType.spec.ts +138 -0
- package/dist/JsonApiRequest-MUPAO7DI.js +0 -24
- package/dist/chunk-5PUPWZB4.js.map +0 -1
- package/dist/chunk-GCQUTWZ2.mjs.map +0 -1
- package/dist/chunk-LM4SDN4Y.mjs.map +0 -1
- package/dist/chunk-OMYDD2UE.js.map +0 -1
- package/dist/chunk-WLS4D6VG.js.map +0 -1
- package/dist/chunk-YM7XSACC.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-WBCUJKNR.mjs.map → BlockNoteEditor-J7R24CYB.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-XCQHVVYD.mjs.map → JsonApiRequest-I2S75QTJ.mjs.map} +0 -0
- /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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
6738
|
+
//# sourceMappingURL=chunk-IPVXH3VC.mjs.map
|