@carlonicora/nextjs-jsonapi 6.12.1 → 6.13.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/{ApiData-DPKNfY-9.d.mts → ApiData-Be8yxCOX.d.mts} +2 -0
- package/dist/{ApiData-DPKNfY-9.d.ts → ApiData-Be8yxCOX.d.ts} +2 -0
- package/dist/{BlockNoteEditor-N2NBYCPC.mjs → BlockNoteEditor-22Q4DJBU.mjs} +20 -8
- package/dist/BlockNoteEditor-22Q4DJBU.mjs.map +1 -0
- package/dist/{BlockNoteEditor-CBYKEXAQ.js → BlockNoteEditor-2VLPSEKS.js} +34 -22
- package/dist/BlockNoteEditor-2VLPSEKS.js.map +1 -0
- package/dist/{BlockNoteViewer-WGCDB7IJ.js → BlockNoteViewer-2XYASA5Y.js} +8 -5
- package/dist/BlockNoteViewer-2XYASA5Y.js.map +1 -0
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs → BlockNoteViewer-NBW2H6LC.mjs} +7 -4
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs.map → BlockNoteViewer-NBW2H6LC.mjs.map} +1 -1
- package/dist/{JsonApiRequest-A66XK5WT.mjs → JsonApiRequest-F6TMJ42G.mjs} +2 -2
- package/dist/JsonApiRequest-WISJZSDE.js +26 -0
- package/dist/{JsonApiRequest-FZGPLNUF.js.map → JsonApiRequest-WISJZSDE.js.map} +1 -1
- package/dist/billing/index.js +499 -494
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/chunk-27LQDGNP.mjs +317 -0
- package/dist/chunk-27LQDGNP.mjs.map +1 -0
- package/dist/{chunk-6NZKWIOR.js → chunk-2H342HNN.js} +956 -929
- package/dist/chunk-2H342HNN.js.map +1 -0
- package/dist/{chunk-KSYQEKJX.js → chunk-2SV4SS6N.js} +14 -14
- package/dist/{chunk-KSYQEKJX.js.map → chunk-2SV4SS6N.js.map} +1 -1
- package/dist/{chunk-4FNGWALA.mjs → chunk-47BBY5KA.mjs} +6 -4
- package/dist/{chunk-4FNGWALA.mjs.map → chunk-47BBY5KA.mjs.map} +1 -1
- package/dist/chunk-6JUCIWDC.mjs +570 -0
- package/dist/chunk-6JUCIWDC.mjs.map +1 -0
- package/dist/chunk-7DBJTNSU.mjs +1049 -0
- package/dist/chunk-7DBJTNSU.mjs.map +1 -0
- package/dist/chunk-7JZHPMGW.mjs +704 -0
- package/dist/chunk-7JZHPMGW.mjs.map +1 -0
- package/dist/{chunk-L6PYFQTO.js → chunk-7ZHTPFFT.js} +16 -14
- package/dist/chunk-7ZHTPFFT.js.map +1 -0
- package/dist/chunk-B6JGKDP2.js +214 -0
- package/dist/chunk-B6JGKDP2.js.map +1 -0
- package/dist/{chunk-3YW35YHQ.mjs → chunk-BH6JWIKI.mjs} +5 -5
- package/dist/chunk-BZ5J2FIV.js +570 -0
- package/dist/chunk-BZ5J2FIV.js.map +1 -0
- package/dist/{chunk-V5MI7RNB.mjs → chunk-DGWOVYEC.mjs} +2 -2
- package/dist/chunk-DOCIFE6A.mjs +212 -0
- package/dist/chunk-DOCIFE6A.mjs.map +1 -0
- package/dist/chunk-GB6DBFYY.js +25 -0
- package/dist/chunk-GB6DBFYY.js.map +1 -0
- package/dist/{chunk-6XJOQFCP.mjs → chunk-H4NLDX5G.mjs} +59 -32
- package/dist/chunk-H4NLDX5G.mjs.map +1 -0
- package/dist/{chunk-EWCY6QJA.mjs → chunk-JJMMT24D.mjs} +37 -3
- package/dist/chunk-JJMMT24D.mjs.map +1 -0
- package/dist/{chunk-JTPRJNT2.js → chunk-KMW7UNL2.js} +38 -3
- package/dist/chunk-KMW7UNL2.js.map +1 -0
- package/dist/chunk-MHB36MYE.js +317 -0
- package/dist/chunk-MHB36MYE.js.map +1 -0
- package/dist/{chunk-FF4EIQ6H.js → chunk-MOGEGWXW.js} +1039 -1680
- package/dist/chunk-MOGEGWXW.js.map +1 -0
- package/dist/{chunk-AA52ORW2.mjs → chunk-P445QGOC.mjs} +61 -702
- package/dist/chunk-P445QGOC.mjs.map +1 -0
- package/dist/chunk-PV4Z5W6V.js +212 -0
- package/dist/chunk-PV4Z5W6V.js.map +1 -0
- package/dist/chunk-PXDUJ47N.js +1049 -0
- package/dist/chunk-PXDUJ47N.js.map +1 -0
- package/dist/{chunk-GHE4VT2R.js → chunk-QKNGZDSQ.js} +2 -2
- package/dist/{chunk-GHE4VT2R.js.map → chunk-QKNGZDSQ.js.map} +1 -1
- package/dist/chunk-W62MHDWM.js +704 -0
- package/dist/chunk-W62MHDWM.js.map +1 -0
- package/dist/chunk-XXP3TQHF.mjs +25 -0
- package/dist/chunk-XXP3TQHF.mjs.map +1 -0
- package/dist/chunk-YRKIFYOE.mjs +214 -0
- package/dist/chunk-YRKIFYOE.mjs.map +1 -0
- package/dist/{chunk-O3PDL2CV.js → chunk-Z4POQWFG.js} +40 -6
- package/dist/chunk-Z4POQWFG.js.map +1 -0
- package/dist/{chunk-PI56A4DG.mjs → chunk-ZLTOUZN2.mjs} +37 -2
- package/dist/chunk-ZLTOUZN2.mjs.map +1 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +14 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +24 -19
- package/dist/components/index.d.mts +7 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +11 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -6
- package/dist/contexts/index.d.mts +1 -1
- package/dist/contexts/index.d.ts +1 -1
- package/dist/contexts/index.js +11 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +10 -6
- package/dist/core/index.d.mts +128 -2
- package/dist/core/index.d.ts +128 -2
- package/dist/core/index.js +17 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +22 -9
- package/dist/email-automations/index.js +101 -96
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +13 -8
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.js +128 -123
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +13 -8
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +11 -8
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +9 -6
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/blog/index.js +158 -153
- package/dist/features/blog/index.js.map +1 -1
- package/dist/features/blog/index.mjs +14 -9
- package/dist/features/blog/index.mjs.map +1 -1
- package/dist/features/blog/server.js +30 -26
- package/dist/features/blog/server.js.map +1 -1
- package/dist/features/blog/server.mjs +10 -6
- package/dist/features/blog/server.mjs.map +1 -1
- package/dist/features/help/index.js +44 -40
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +10 -6
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.js +134 -129
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +13 -8
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -11
- package/dist/lifecycle-4GUOTB46.js +23 -0
- package/dist/lifecycle-4GUOTB46.js.map +1 -0
- package/dist/lifecycle-LKGPRBS7.mjs +23 -0
- package/dist/local-transport-7H3SPZSA.js +15 -0
- package/dist/local-transport-7H3SPZSA.js.map +1 -0
- package/dist/local-transport-QYFKA6AN.mjs +15 -0
- package/dist/local-transport-QYFKA6AN.mjs.map +1 -0
- package/dist/offline/index.d.mts +607 -0
- package/dist/offline/index.d.ts +607 -0
- package/dist/offline/index.js +1052 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/offline/index.mjs +1052 -0
- package/dist/offline/index.mjs.map +1 -0
- package/dist/offline/sqlite/device-worker.mjs +62 -0
- package/dist/offline/sqlite/index.mjs +17392 -0
- package/dist/offline/sqlite/sqlite3-opfs-async-proxy.js +881 -0
- package/dist/offline/sqlite/sqlite3.wasm +0 -0
- package/dist/request-KTBV6HHH.js +10 -0
- package/dist/request-KTBV6HHH.js.map +1 -0
- package/dist/request-SQOUNWZ4.mjs +10 -0
- package/dist/request-SQOUNWZ4.mjs.map +1 -0
- package/dist/server/cachedGet.d.mts +1 -1
- package/dist/server/cachedGet.d.ts +1 -1
- package/dist/server/cachedGet.stub.d.mts +1 -1
- package/dist/server/cachedGet.stub.d.ts +1 -1
- package/dist/server/index.d.mts +28 -2
- package/dist/server/index.d.ts +28 -2
- package/dist/server/index.js +18 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +18 -8
- package/dist/{useSocket-IRHtk2xc.d.ts → useSocket-Bo9M0t0J.d.ts} +3 -1
- package/dist/{useSocket-C8fqU4od.d.mts → useSocket-J5qanQPN.d.mts} +3 -1
- package/dist/write-through-FDQ7N4YI.js +15 -0
- package/dist/write-through-FDQ7N4YI.js.map +1 -0
- package/dist/write-through-R25VQMH6.mjs +15 -0
- package/dist/write-through-R25VQMH6.mjs.map +1 -0
- package/package.json +7 -1
- package/pwa/sw.js +277 -26
- package/src/client/request.ts +37 -0
- package/src/components/containers/RoundPageContainer.tsx +8 -8
- package/src/components/editors/BlockNoteEditor.tsx +14 -0
- package/src/components/editors/__tests__/BlockNoteEditor.empty-change.spec.tsx +205 -0
- package/src/contexts/SocketContext.tsx +7 -1
- package/src/contexts/__tests__/SocketContext.session.spec.tsx +52 -5
- package/src/core/factories/RehydrationFactory.ts +28 -8
- package/src/core/factories/__tests__/RehydrationFactory.spec.ts +33 -0
- package/src/core/index.ts +3 -0
- package/src/core/interfaces/ApiData.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +3 -0
- package/src/features/auth/components/forms/Logout.tsx +8 -1
- package/src/features/auth/components/forms/__tests__/Logout.spec.tsx +62 -0
- package/src/hooks/__tests__/useSocket.pause.spec.ts +39 -0
- package/src/hooks/useSocket.ts +20 -1
- package/src/offline/__tests__/answer-builders.spec.ts +176 -0
- package/src/offline/__tests__/device-switch.spec.ts +179 -0
- package/src/offline/__tests__/generic-answers.spec.ts +380 -0
- package/src/offline/__tests__/local-transport.spec.ts +150 -0
- package/src/offline/__tests__/logout.spec.ts +122 -0
- package/src/offline/__tests__/offline-fixtures.ts +89 -0
- package/src/offline/__tests__/router.spec.ts +56 -0
- package/src/offline/__tests__/state.spec.ts +62 -0
- package/src/offline/__tests__/write-through.spec.ts +137 -0
- package/src/offline/config.ts +229 -0
- package/src/offline/configure.ts +14 -0
- package/src/offline/device-switch.ts +75 -0
- package/src/offline/generic-answers.ts +706 -0
- package/src/offline/index.ts +67 -0
- package/src/offline/local-transport.ts +189 -0
- package/src/offline/logout.ts +41 -0
- package/src/offline/router.ts +41 -0
- package/src/offline/server/__tests__/build-offline-manifest.spec.ts +76 -0
- package/src/offline/server/build-offline-manifest.ts +49 -0
- package/src/offline/state-hooks.ts +10 -0
- package/src/offline/state.ts +143 -0
- package/src/offline/store/DeviceStore.ts +112 -0
- package/src/offline/store/__tests__/device-store-lifecycle.spec.ts +343 -0
- package/src/offline/store/__tests__/shared-database.spec.ts +151 -0
- package/src/offline/store/__tests__/sql-device-store.spec.ts +399 -0
- package/src/offline/store/lifecycle.ts +315 -0
- package/src/offline/store/schema.ts +101 -0
- package/src/offline/store/shared-database.ts +321 -0
- package/src/offline/store/sql-device-store.ts +469 -0
- package/src/offline/store/worker-client.ts +71 -0
- package/src/offline/store/worker.ts +87 -0
- package/src/offline/sync/__tests__/conflicts.spec.ts +185 -0
- package/src/offline/sync/__tests__/queue-drain.spec.ts +364 -0
- package/src/offline/sync/__tests__/runtime.spec.ts +337 -0
- package/src/offline/sync/__tests__/sync-fixtures.ts +103 -0
- package/src/offline/sync/__tests__/sync-root.spec.ts +727 -0
- package/src/offline/sync/artwork-cache.ts +67 -0
- package/src/offline/sync/conflicts.ts +211 -0
- package/src/offline/sync/counts.ts +39 -0
- package/src/offline/sync/drain-queue.ts +246 -0
- package/src/offline/sync/known-roots.ts +37 -0
- package/src/offline/sync/models/OfflineChangeSet.ts +34 -0
- package/src/offline/sync/models/OfflineChangeSetInterface.ts +54 -0
- package/src/offline/sync/models/RootSync.ts +68 -0
- package/src/offline/sync/models/RootSyncInterface.ts +20 -0
- package/src/offline/sync/models/__tests__/OfflineChangeSet.spec.ts +47 -0
- package/src/offline/sync/models/__tests__/RootSync.spec.ts +54 -0
- package/src/offline/sync/models/index.ts +5 -0
- package/src/offline/sync/models/offline.modules.ts +14 -0
- package/src/offline/sync/runtime.ts +226 -0
- package/src/offline/sync/session-refresh.ts +32 -0
- package/src/offline/sync/sync-root.ts +336 -0
- package/src/offline/sync/waiting.ts +40 -0
- package/src/offline/types.ts +115 -0
- package/src/offline/write-through.ts +189 -0
- package/src/pwa/__tests__/sw.spec.ts +358 -1
- package/src/server/index.ts +5 -0
- package/src/unified/__tests__/JsonApiRequest.offline.spec.ts +243 -0
- package/dist/BlockNoteEditor-CBYKEXAQ.js.map +0 -1
- package/dist/BlockNoteEditor-N2NBYCPC.mjs.map +0 -1
- package/dist/BlockNoteViewer-WGCDB7IJ.js.map +0 -1
- package/dist/JsonApiRequest-FZGPLNUF.js +0 -26
- package/dist/chunk-6NZKWIOR.js.map +0 -1
- package/dist/chunk-6XJOQFCP.mjs.map +0 -1
- package/dist/chunk-AA52ORW2.mjs.map +0 -1
- package/dist/chunk-EWCY6QJA.mjs.map +0 -1
- package/dist/chunk-FF4EIQ6H.js.map +0 -1
- package/dist/chunk-JTPRJNT2.js.map +0 -1
- package/dist/chunk-L6PYFQTO.js.map +0 -1
- package/dist/chunk-O3PDL2CV.js.map +0 -1
- package/dist/chunk-PI56A4DG.mjs.map +0 -1
- package/dist/request-5RLK2AM3.mjs +0 -9
- package/dist/request-EUGTI3BE.js +0 -9
- package/dist/request-EUGTI3BE.js.map +0 -1
- /package/dist/{JsonApiRequest-A66XK5WT.mjs.map → JsonApiRequest-F6TMJ42G.mjs.map} +0 -0
- /package/dist/{chunk-3YW35YHQ.mjs.map → chunk-BH6JWIKI.mjs.map} +0 -0
- /package/dist/{chunk-V5MI7RNB.mjs.map → chunk-DGWOVYEC.mjs.map} +0 -0
- /package/dist/{request-5RLK2AM3.mjs.map → lifecycle-LKGPRBS7.mjs.map} +0 -0
|
@@ -1,261 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractApiData,
|
|
3
|
+
EndpointCreator,
|
|
4
|
+
ModuleRegistry,
|
|
5
|
+
Modules,
|
|
6
|
+
RehydrationFactory,
|
|
7
|
+
RootSync,
|
|
8
|
+
getI18nDefaultLocale,
|
|
9
|
+
getI18nServerLocale,
|
|
10
|
+
getI18nSupportedLocales
|
|
11
|
+
} from "./chunk-6JUCIWDC.mjs";
|
|
12
|
+
import {
|
|
13
|
+
ClientJsonApiDelete,
|
|
14
|
+
ClientJsonApiGet,
|
|
15
|
+
ClientJsonApiPatch,
|
|
16
|
+
ClientJsonApiPost,
|
|
17
|
+
ClientJsonApiPut
|
|
18
|
+
} from "./chunk-DOCIFE6A.mjs";
|
|
1
19
|
import {
|
|
2
20
|
DataClassRegistry,
|
|
3
|
-
ENV,
|
|
4
|
-
JsonApiDataFactory,
|
|
5
21
|
JsonApiDelete,
|
|
6
22
|
JsonApiGet,
|
|
7
|
-
JsonApiPost
|
|
8
|
-
|
|
9
|
-
setBootstrapper,
|
|
10
|
-
translateResponse,
|
|
11
|
-
tryBootstrap
|
|
12
|
-
} from "./chunk-V5MI7RNB.mjs";
|
|
13
|
-
import {
|
|
14
|
-
getClientToken
|
|
15
|
-
} from "./chunk-AUXK7QSA.mjs";
|
|
16
|
-
import {
|
|
17
|
-
directFetch
|
|
18
|
-
} from "./chunk-PI56A4DG.mjs";
|
|
23
|
+
JsonApiPost
|
|
24
|
+
} from "./chunk-DGWOVYEC.mjs";
|
|
19
25
|
import {
|
|
20
26
|
__name
|
|
21
27
|
} from "./chunk-PAWJFY3S.mjs";
|
|
22
28
|
|
|
23
|
-
// src/core/factories/RehydrationFactory.ts
|
|
24
|
-
var RehydrationFactory = class {
|
|
25
|
-
static {
|
|
26
|
-
__name(this, "RehydrationFactory");
|
|
27
|
-
}
|
|
28
|
-
static rehydrate(classKey, data) {
|
|
29
|
-
const factoryClass = DataClassRegistry.get(classKey);
|
|
30
|
-
const instance = new factoryClass();
|
|
31
|
-
return instance.rehydrate(data);
|
|
32
|
-
}
|
|
33
|
-
static rehydrateList(classKey, data) {
|
|
34
|
-
const factoryClass = DataClassRegistry.get(classKey);
|
|
35
|
-
const response = data.map((item) => {
|
|
36
|
-
const instance = new factoryClass();
|
|
37
|
-
return instance.rehydrate(item);
|
|
38
|
-
});
|
|
39
|
-
return response;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// src/core/abstracts/AbstractApiData.ts
|
|
44
|
-
var AbstractApiData = class _AbstractApiData {
|
|
45
|
-
static {
|
|
46
|
-
__name(this, "AbstractApiData");
|
|
47
|
-
}
|
|
48
|
-
static identifierFields = ["name"];
|
|
49
|
-
get identifier() {
|
|
50
|
-
const fields = this.constructor.identifierFields;
|
|
51
|
-
return fields.map((field) => this._jsonApi?.attributes?.[field]).filter((v) => v != null && v !== "").join(" ");
|
|
52
|
-
}
|
|
53
|
-
_jsonApi;
|
|
54
|
-
_included;
|
|
55
|
-
_id;
|
|
56
|
-
_type;
|
|
57
|
-
_createdAt;
|
|
58
|
-
_updatedAt;
|
|
59
|
-
_self;
|
|
60
|
-
get type() {
|
|
61
|
-
if (!this._type) throw new Error("Type is not set.");
|
|
62
|
-
return this._type;
|
|
63
|
-
}
|
|
64
|
-
get id() {
|
|
65
|
-
if (!this._id) throw new Error("Id is not set.");
|
|
66
|
-
return this._id;
|
|
67
|
-
}
|
|
68
|
-
get self() {
|
|
69
|
-
return this._self;
|
|
70
|
-
}
|
|
71
|
-
get createdAt() {
|
|
72
|
-
return this._createdAt ?? /* @__PURE__ */ new Date();
|
|
73
|
-
}
|
|
74
|
-
get updatedAt() {
|
|
75
|
-
return this._updatedAt ?? /* @__PURE__ */ new Date();
|
|
76
|
-
}
|
|
77
|
-
get included() {
|
|
78
|
-
return this._included ?? [];
|
|
79
|
-
}
|
|
80
|
-
get jsonApi() {
|
|
81
|
-
return this._jsonApi;
|
|
82
|
-
}
|
|
83
|
-
ingestJsonApi(_data) {
|
|
84
|
-
}
|
|
85
|
-
generateApiUrl(_params) {
|
|
86
|
-
throw new Error("Method not implemented.");
|
|
87
|
-
}
|
|
88
|
-
createJsonApi(_data) {
|
|
89
|
-
throw new Error("Method not implemented.");
|
|
90
|
-
}
|
|
91
|
-
_readIncluded(data, type, dataType) {
|
|
92
|
-
if (data.included === void 0 || data.included.length === 0 || data.jsonApi.relationships === void 0 || data.jsonApi.relationships[type] === void 0 || data.jsonApi.relationships[type].data === void 0) {
|
|
93
|
-
return void 0;
|
|
94
|
-
}
|
|
95
|
-
if (Array.isArray(data.jsonApi.relationships[type].data)) {
|
|
96
|
-
const response = data.jsonApi.relationships[type].data.map((jsonApiData) => {
|
|
97
|
-
const includedData2 = data.included.find(
|
|
98
|
-
(includedData3) => includedData3.id === jsonApiData.id && includedData3.type === jsonApiData.type
|
|
99
|
-
);
|
|
100
|
-
if (includedData2 === void 0) return void 0;
|
|
101
|
-
return RehydrationFactory.rehydrate(dataType, {
|
|
102
|
-
jsonApi: includedData2,
|
|
103
|
-
included: data.included
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
return response.filter((item) => item !== void 0);
|
|
107
|
-
}
|
|
108
|
-
const includedData = data.included.find(
|
|
109
|
-
(includedData2) => includedData2.id === data.jsonApi.relationships[type].data.id && includedData2.type === data.jsonApi.relationships[type].data.type
|
|
110
|
-
);
|
|
111
|
-
if (includedData === void 0 && data.allData !== void 0) {
|
|
112
|
-
const fallbackData = data.allData.find(
|
|
113
|
-
(includedData2) => includedData2.id === data.jsonApi.relationships[type].data.id && includedData2.type === data.jsonApi.relationships[type].data.type
|
|
114
|
-
);
|
|
115
|
-
if (fallbackData !== void 0) {
|
|
116
|
-
return RehydrationFactory.rehydrate(dataType, {
|
|
117
|
-
jsonApi: fallbackData,
|
|
118
|
-
included: data.included
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (includedData === void 0) return void 0;
|
|
123
|
-
return RehydrationFactory.rehydrate(dataType, {
|
|
124
|
-
jsonApi: includedData,
|
|
125
|
-
included: data.included
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Read included relationships with polymorphic type resolution.
|
|
130
|
-
* Determines the correct model class based on the JSON:API type in included data.
|
|
131
|
-
*/
|
|
132
|
-
_readIncludedPolymorphic(data, relationshipKey, candidateModules) {
|
|
133
|
-
if (!data.included?.length || !data.jsonApi.relationships?.[relationshipKey]?.data) {
|
|
134
|
-
return void 0;
|
|
135
|
-
}
|
|
136
|
-
const relData = data.jsonApi.relationships[relationshipKey].data;
|
|
137
|
-
const typeToModule = /* @__PURE__ */ new Map();
|
|
138
|
-
for (const mod of candidateModules) {
|
|
139
|
-
typeToModule.set(mod.name, mod);
|
|
140
|
-
}
|
|
141
|
-
if (Array.isArray(relData)) {
|
|
142
|
-
const result = [];
|
|
143
|
-
for (const item of relData) {
|
|
144
|
-
const includedItem2 = data.included.find((inc) => inc.id === item.id && inc.type === item.type);
|
|
145
|
-
if (!includedItem2) continue;
|
|
146
|
-
const module2 = typeToModule.get(includedItem2.type);
|
|
147
|
-
if (!module2) continue;
|
|
148
|
-
result.push(
|
|
149
|
-
RehydrationFactory.rehydrate(module2, {
|
|
150
|
-
jsonApi: includedItem2,
|
|
151
|
-
included: data.included
|
|
152
|
-
})
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
return result.length > 0 ? result : void 0;
|
|
156
|
-
}
|
|
157
|
-
const includedItem = data.included.find((inc) => inc.id === relData.id && inc.type === relData.type);
|
|
158
|
-
if (!includedItem) return void 0;
|
|
159
|
-
const module = typeToModule.get(includedItem.type);
|
|
160
|
-
if (!module) return void 0;
|
|
161
|
-
return RehydrationFactory.rehydrate(module, {
|
|
162
|
-
jsonApi: includedItem,
|
|
163
|
-
included: data.included
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Read included relationship data and augment with relationship meta properties.
|
|
168
|
-
* Handles both single relationships (one-to-one) and array relationships (one-to-many).
|
|
169
|
-
*
|
|
170
|
-
* For single relationships: meta is read from `relationships[type].meta`
|
|
171
|
-
* For array relationships: per-item meta is read from `relationships[type].data[].meta`
|
|
172
|
-
*
|
|
173
|
-
* @param data - Hydrated JSON:API data
|
|
174
|
-
* @param type - Relationship type key (e.g., "guide", "persons")
|
|
175
|
-
* @param dataType - Module reference for rehydration
|
|
176
|
-
* @returns Related object(s) augmented with meta properties, or undefined
|
|
177
|
-
*/
|
|
178
|
-
_readIncludedWithMeta(data, type, dataType) {
|
|
179
|
-
if (data.included === void 0 || data.included.length === 0 || data.jsonApi.relationships === void 0 || data.jsonApi.relationships[type] === void 0 || data.jsonApi.relationships[type].data === void 0) {
|
|
180
|
-
return void 0;
|
|
181
|
-
}
|
|
182
|
-
const relationshipData = data.jsonApi.relationships[type].data;
|
|
183
|
-
if (Array.isArray(relationshipData)) {
|
|
184
|
-
const result = [];
|
|
185
|
-
for (const item of relationshipData) {
|
|
186
|
-
const includedData2 = data.included.find((inc) => inc.id === item.id && inc.type === item.type);
|
|
187
|
-
if (!includedData2) continue;
|
|
188
|
-
const entity2 = RehydrationFactory.rehydrate(dataType, {
|
|
189
|
-
jsonApi: includedData2,
|
|
190
|
-
included: data.included
|
|
191
|
-
});
|
|
192
|
-
if (item.meta) {
|
|
193
|
-
_AbstractApiData._mergeMeta(entity2, item.meta);
|
|
194
|
-
}
|
|
195
|
-
result.push(entity2);
|
|
196
|
-
}
|
|
197
|
-
return result;
|
|
198
|
-
}
|
|
199
|
-
const includedData = data.included.find(
|
|
200
|
-
(inc) => inc.id === relationshipData.id && inc.type === relationshipData.type
|
|
201
|
-
);
|
|
202
|
-
if (!includedData) {
|
|
203
|
-
if (data.allData !== void 0) {
|
|
204
|
-
const fallbackData = data.allData.find(
|
|
205
|
-
(inc) => inc.id === relationshipData.id && inc.type === relationshipData.type
|
|
206
|
-
);
|
|
207
|
-
if (fallbackData) {
|
|
208
|
-
const entity2 = RehydrationFactory.rehydrate(dataType, {
|
|
209
|
-
jsonApi: fallbackData,
|
|
210
|
-
included: data.included
|
|
211
|
-
});
|
|
212
|
-
const relationshipMeta2 = data.jsonApi.relationships[type].meta;
|
|
213
|
-
if (relationshipMeta2) {
|
|
214
|
-
_AbstractApiData._mergeMeta(entity2, relationshipMeta2);
|
|
215
|
-
}
|
|
216
|
-
return entity2;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return void 0;
|
|
220
|
-
}
|
|
221
|
-
const entity = RehydrationFactory.rehydrate(dataType, {
|
|
222
|
-
jsonApi: includedData,
|
|
223
|
-
included: data.included
|
|
224
|
-
});
|
|
225
|
-
const relationshipMeta = data.jsonApi.relationships[type].meta;
|
|
226
|
-
if (relationshipMeta) {
|
|
227
|
-
_AbstractApiData._mergeMeta(entity, relationshipMeta);
|
|
228
|
-
}
|
|
229
|
-
return entity;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Copies relationship meta onto a rehydrated entity as own data properties. Object.assign throws
|
|
233
|
-
* when the model declares a getter-only accessor of the same name (an app's `Chunk` with
|
|
234
|
-
* `get relevance()`); an own property shadows that getter, so the model reads the meta value.
|
|
235
|
-
*/
|
|
236
|
-
static _mergeMeta(entity, meta) {
|
|
237
|
-
for (const [key, value] of Object.entries(meta)) {
|
|
238
|
-
Object.defineProperty(entity, key, { value, writable: true, enumerable: true, configurable: true });
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
dehydrate() {
|
|
242
|
-
return {
|
|
243
|
-
jsonApi: this._jsonApi,
|
|
244
|
-
included: this._included ?? []
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
rehydrate(data) {
|
|
248
|
-
this._jsonApi = data.jsonApi;
|
|
249
|
-
this._included = data.included;
|
|
250
|
-
this._type = this._jsonApi.type;
|
|
251
|
-
this._id = this._jsonApi.id;
|
|
252
|
-
this._createdAt = this._jsonApi.meta?.createdAt !== void 0 ? new Date(this._jsonApi.meta.createdAt) : void 0;
|
|
253
|
-
this._updatedAt = this._jsonApi.meta?.updatedAt !== void 0 ? new Date(this._jsonApi.meta.updatedAt) : void 0;
|
|
254
|
-
this._self = this._jsonApi.links?.self ?? void 0;
|
|
255
|
-
return this;
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
|
|
259
29
|
// src/core/abstracts/lastApiResponse.ts
|
|
260
30
|
var lastApiTotal = void 0;
|
|
261
31
|
var lastApiMeta = void 0;
|
|
@@ -281,66 +51,6 @@ function clearLastApiMeta() {
|
|
|
281
51
|
}
|
|
282
52
|
__name(clearLastApiMeta, "clearLastApiMeta");
|
|
283
53
|
|
|
284
|
-
// src/i18n/config.ts
|
|
285
|
-
var _config = null;
|
|
286
|
-
function configureI18n(config) {
|
|
287
|
-
_config = config;
|
|
288
|
-
}
|
|
289
|
-
__name(configureI18n, "configureI18n");
|
|
290
|
-
function useI18nRouter() {
|
|
291
|
-
if (!_config?.useRouter) {
|
|
292
|
-
throw new Error("i18n not configured. Call configureI18n() at app startup.");
|
|
293
|
-
}
|
|
294
|
-
return _config.useRouter();
|
|
295
|
-
}
|
|
296
|
-
__name(useI18nRouter, "useI18nRouter");
|
|
297
|
-
function useI18nTranslations(namespace) {
|
|
298
|
-
if (!_config?.useTranslations) {
|
|
299
|
-
return (key) => key;
|
|
300
|
-
}
|
|
301
|
-
return _config.useTranslations(namespace);
|
|
302
|
-
}
|
|
303
|
-
__name(useI18nTranslations, "useI18nTranslations");
|
|
304
|
-
function getI18nLink() {
|
|
305
|
-
if (!_config?.Link) {
|
|
306
|
-
throw new Error("i18n not configured. Call configureI18n() at app startup.");
|
|
307
|
-
}
|
|
308
|
-
return _config.Link;
|
|
309
|
-
}
|
|
310
|
-
__name(getI18nLink, "getI18nLink");
|
|
311
|
-
function useI18nLocale() {
|
|
312
|
-
if (_config?.useLocale) {
|
|
313
|
-
return _config.useLocale();
|
|
314
|
-
}
|
|
315
|
-
return "en";
|
|
316
|
-
}
|
|
317
|
-
__name(useI18nLocale, "useI18nLocale");
|
|
318
|
-
async function getI18nServerLocale() {
|
|
319
|
-
if (!_config?.getLocale) {
|
|
320
|
-
throw new Error("i18n not configured. Call configureI18n() with getLocale at app startup.");
|
|
321
|
-
}
|
|
322
|
-
return _config.getLocale();
|
|
323
|
-
}
|
|
324
|
-
__name(getI18nServerLocale, "getI18nServerLocale");
|
|
325
|
-
function useI18nDateFnsLocale() {
|
|
326
|
-
if (_config?.useDateFnsLocale) {
|
|
327
|
-
return _config.useDateFnsLocale();
|
|
328
|
-
}
|
|
329
|
-
return void 0;
|
|
330
|
-
}
|
|
331
|
-
__name(useI18nDateFnsLocale, "useI18nDateFnsLocale");
|
|
332
|
-
function getI18nSupportedLocales() {
|
|
333
|
-
if (_config?.supportedLocales && _config.supportedLocales.length > 0) {
|
|
334
|
-
return _config.supportedLocales;
|
|
335
|
-
}
|
|
336
|
-
return ["en"];
|
|
337
|
-
}
|
|
338
|
-
__name(getI18nSupportedLocales, "getI18nSupportedLocales");
|
|
339
|
-
function getI18nDefaultLocale() {
|
|
340
|
-
return getI18nSupportedLocales()[0];
|
|
341
|
-
}
|
|
342
|
-
__name(getI18nDefaultLocale, "getI18nDefaultLocale");
|
|
343
|
-
|
|
344
54
|
// src/core/abstracts/AbstractService.ts
|
|
345
55
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
346
56
|
HttpMethod2["GET"] = "GET";
|
|
@@ -409,7 +119,7 @@ var AbstractService = class {
|
|
|
409
119
|
* Make an API call with automatic environment detection and error handling.
|
|
410
120
|
*/
|
|
411
121
|
static async callApi(params) {
|
|
412
|
-
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-
|
|
122
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-F6TMJ42G.mjs");
|
|
413
123
|
let apiResponse;
|
|
414
124
|
let language = "en";
|
|
415
125
|
if (typeof window === "undefined") {
|
|
@@ -506,7 +216,7 @@ var AbstractService = class {
|
|
|
506
216
|
* Make an API call and return both data and meta from the response.
|
|
507
217
|
*/
|
|
508
218
|
static async callApiWithMeta(params) {
|
|
509
|
-
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-
|
|
219
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-F6TMJ42G.mjs");
|
|
510
220
|
let apiResponse;
|
|
511
221
|
let language = "en";
|
|
512
222
|
if (typeof window === "undefined") {
|
|
@@ -591,7 +301,7 @@ var AbstractService = class {
|
|
|
591
301
|
* Get raw JSON:API response data without deserialization.
|
|
592
302
|
*/
|
|
593
303
|
static async getRawData(params) {
|
|
594
|
-
const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-
|
|
304
|
+
const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-F6TMJ42G.mjs");
|
|
595
305
|
let language = "en";
|
|
596
306
|
if (typeof window === "undefined") {
|
|
597
307
|
language = await getI18nServerLocale();
|
|
@@ -621,185 +331,6 @@ var AbstractService = class {
|
|
|
621
331
|
}
|
|
622
332
|
};
|
|
623
333
|
|
|
624
|
-
// src/client/JsonApiClient.ts
|
|
625
|
-
var _clientConfig = null;
|
|
626
|
-
function configureClientJsonApi(config) {
|
|
627
|
-
_clientConfig = config;
|
|
628
|
-
if (config.bootstrapper) {
|
|
629
|
-
setBootstrapper(config.bootstrapper);
|
|
630
|
-
config.bootstrapper();
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
__name(configureClientJsonApi, "configureClientJsonApi");
|
|
634
|
-
function getClientApiUrl() {
|
|
635
|
-
if (_clientConfig?.apiUrl) {
|
|
636
|
-
return _clientConfig.apiUrl;
|
|
637
|
-
}
|
|
638
|
-
const envUrl = ENV.API_URL;
|
|
639
|
-
if (!envUrl) {
|
|
640
|
-
throw new Error(
|
|
641
|
-
"API URL not configured. Use configureClientJsonApi() or set NEXT_PUBLIC_API_URL environment variable."
|
|
642
|
-
);
|
|
643
|
-
}
|
|
644
|
-
return envUrl;
|
|
645
|
-
}
|
|
646
|
-
__name(getClientApiUrl, "getClientApiUrl");
|
|
647
|
-
function getClientAppUrl() {
|
|
648
|
-
if (_clientConfig?.appUrl) {
|
|
649
|
-
return _clientConfig.appUrl;
|
|
650
|
-
}
|
|
651
|
-
const envUrl = ENV.APP_URL;
|
|
652
|
-
if (!envUrl) {
|
|
653
|
-
throw new Error(
|
|
654
|
-
"App URL not configured. Use configureClientJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable."
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
return envUrl.trim().replace(/\/+$/, "");
|
|
658
|
-
}
|
|
659
|
-
__name(getClientAppUrl, "getClientAppUrl");
|
|
660
|
-
function getClientTrackablePages() {
|
|
661
|
-
return _clientConfig?.trackablePages ?? [];
|
|
662
|
-
}
|
|
663
|
-
__name(getClientTrackablePages, "getClientTrackablePages");
|
|
664
|
-
function runClientBootstrapper() {
|
|
665
|
-
if (_clientConfig?.bootstrapper) {
|
|
666
|
-
_clientConfig.bootstrapper();
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
__name(runClientBootstrapper, "runClientBootstrapper");
|
|
670
|
-
function buildClientUrl(endpoint, baseUrl) {
|
|
671
|
-
if (endpoint.startsWith("http")) return endpoint;
|
|
672
|
-
const apiUrl = baseUrl ?? getClientApiUrl();
|
|
673
|
-
return `${apiUrl}${endpoint}`;
|
|
674
|
-
}
|
|
675
|
-
__name(buildClientUrl, "buildClientUrl");
|
|
676
|
-
async function ClientJsonApiGet(params) {
|
|
677
|
-
runClientBootstrapper();
|
|
678
|
-
const token = await getClientToken();
|
|
679
|
-
const apiResponse = await directFetch({
|
|
680
|
-
method: "GET",
|
|
681
|
-
url: buildClientUrl(params.endpoint, params.baseUrl),
|
|
682
|
-
token,
|
|
683
|
-
companyId: params.companyId,
|
|
684
|
-
language: params.language,
|
|
685
|
-
additionalHeaders: _clientConfig?.additionalHeaders
|
|
686
|
-
});
|
|
687
|
-
return translateResponse({
|
|
688
|
-
classKey: params.classKey,
|
|
689
|
-
apiResponse,
|
|
690
|
-
companyId: params.companyId,
|
|
691
|
-
language: params.language,
|
|
692
|
-
paginationHandler: /* @__PURE__ */ __name(async (endpoint) => ClientJsonApiGet({
|
|
693
|
-
classKey: params.classKey,
|
|
694
|
-
endpoint,
|
|
695
|
-
companyId: params.companyId,
|
|
696
|
-
language: params.language,
|
|
697
|
-
baseUrl: params.baseUrl
|
|
698
|
-
}), "paginationHandler")
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
__name(ClientJsonApiGet, "ClientJsonApiGet");
|
|
702
|
-
async function ClientJsonApiPost(params) {
|
|
703
|
-
runClientBootstrapper();
|
|
704
|
-
const token = await getClientToken();
|
|
705
|
-
let body = params.body;
|
|
706
|
-
if (!body) {
|
|
707
|
-
body = {};
|
|
708
|
-
} else if (params.overridesJsonApiCreation !== true) {
|
|
709
|
-
body = JsonApiDataFactory.create(params.classKey, body);
|
|
710
|
-
}
|
|
711
|
-
const apiResponse = await directFetch({
|
|
712
|
-
method: "POST",
|
|
713
|
-
url: buildClientUrl(params.endpoint, params.baseUrl),
|
|
714
|
-
token,
|
|
715
|
-
body,
|
|
716
|
-
files: params.files,
|
|
717
|
-
companyId: params.companyId,
|
|
718
|
-
language: params.language,
|
|
719
|
-
additionalHeaders: _clientConfig?.additionalHeaders
|
|
720
|
-
});
|
|
721
|
-
return translateResponse({
|
|
722
|
-
classKey: params.responseType ?? params.classKey,
|
|
723
|
-
apiResponse,
|
|
724
|
-
companyId: params.companyId,
|
|
725
|
-
language: params.language
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
__name(ClientJsonApiPost, "ClientJsonApiPost");
|
|
729
|
-
async function ClientJsonApiPut(params) {
|
|
730
|
-
runClientBootstrapper();
|
|
731
|
-
const token = await getClientToken();
|
|
732
|
-
let body = params.body;
|
|
733
|
-
if (!body) {
|
|
734
|
-
body = {};
|
|
735
|
-
} else {
|
|
736
|
-
body = JsonApiDataFactory.create(params.classKey, body);
|
|
737
|
-
}
|
|
738
|
-
const apiResponse = await directFetch({
|
|
739
|
-
method: "PUT",
|
|
740
|
-
url: buildClientUrl(params.endpoint, params.baseUrl),
|
|
741
|
-
token,
|
|
742
|
-
body,
|
|
743
|
-
files: params.files,
|
|
744
|
-
companyId: params.companyId,
|
|
745
|
-
language: params.language,
|
|
746
|
-
additionalHeaders: _clientConfig?.additionalHeaders
|
|
747
|
-
});
|
|
748
|
-
return translateResponse({
|
|
749
|
-
classKey: params.responseType ?? params.classKey,
|
|
750
|
-
apiResponse,
|
|
751
|
-
companyId: params.companyId,
|
|
752
|
-
language: params.language
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
__name(ClientJsonApiPut, "ClientJsonApiPut");
|
|
756
|
-
async function ClientJsonApiPatch(params) {
|
|
757
|
-
runClientBootstrapper();
|
|
758
|
-
const token = await getClientToken();
|
|
759
|
-
let body = params.body;
|
|
760
|
-
if (!body) {
|
|
761
|
-
body = {};
|
|
762
|
-
} else if (params.overridesJsonApiCreation !== true) {
|
|
763
|
-
body = JsonApiDataFactory.create(params.classKey, body);
|
|
764
|
-
}
|
|
765
|
-
const apiResponse = await directFetch({
|
|
766
|
-
method: "PATCH",
|
|
767
|
-
url: buildClientUrl(params.endpoint, params.baseUrl),
|
|
768
|
-
token,
|
|
769
|
-
body,
|
|
770
|
-
files: params.files,
|
|
771
|
-
companyId: params.companyId,
|
|
772
|
-
language: params.language,
|
|
773
|
-
additionalHeaders: _clientConfig?.additionalHeaders
|
|
774
|
-
});
|
|
775
|
-
return translateResponse({
|
|
776
|
-
classKey: params.responseType ?? params.classKey,
|
|
777
|
-
apiResponse,
|
|
778
|
-
companyId: params.companyId,
|
|
779
|
-
language: params.language
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
__name(ClientJsonApiPatch, "ClientJsonApiPatch");
|
|
783
|
-
async function ClientJsonApiDelete(params) {
|
|
784
|
-
runClientBootstrapper();
|
|
785
|
-
const token = await getClientToken();
|
|
786
|
-
const apiResponse = await directFetch({
|
|
787
|
-
method: "DELETE",
|
|
788
|
-
url: buildClientUrl(params.endpoint, params.baseUrl),
|
|
789
|
-
token,
|
|
790
|
-
companyId: params.companyId,
|
|
791
|
-
language: params.language,
|
|
792
|
-
additionalHeaders: _clientConfig?.additionalHeaders
|
|
793
|
-
});
|
|
794
|
-
return translateResponse({
|
|
795
|
-
classKey: params.responseType ?? params.classKey,
|
|
796
|
-
apiResponse,
|
|
797
|
-
companyId: params.companyId,
|
|
798
|
-
language: params.language
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
__name(ClientJsonApiDelete, "ClientJsonApiDelete");
|
|
802
|
-
|
|
803
334
|
// src/core/abstracts/ClientAbstractService.ts
|
|
804
335
|
var ClientHttpMethod = /* @__PURE__ */ ((ClientHttpMethod2) => {
|
|
805
336
|
ClientHttpMethod2["GET"] = "GET";
|
|
@@ -1014,185 +545,6 @@ var ModuleRegistrar = class {
|
|
|
1014
545
|
}
|
|
1015
546
|
};
|
|
1016
547
|
|
|
1017
|
-
// src/core/registry/ModuleRegistry.ts
|
|
1018
|
-
var MODULES_KEY = /* @__PURE__ */ Symbol.for("nextjs-jsonapi:modules");
|
|
1019
|
-
var globalStore = globalThis;
|
|
1020
|
-
if (!globalStore[MODULES_KEY]) {
|
|
1021
|
-
globalStore[MODULES_KEY] = /* @__PURE__ */ new Map();
|
|
1022
|
-
}
|
|
1023
|
-
var ModuleRegistryClass = class {
|
|
1024
|
-
static {
|
|
1025
|
-
__name(this, "ModuleRegistryClass");
|
|
1026
|
-
}
|
|
1027
|
-
get _modules() {
|
|
1028
|
-
return globalStore[MODULES_KEY];
|
|
1029
|
-
}
|
|
1030
|
-
register(name, module) {
|
|
1031
|
-
this._modules.set(name, module);
|
|
1032
|
-
}
|
|
1033
|
-
get(name) {
|
|
1034
|
-
let module = this._modules.get(name);
|
|
1035
|
-
if (!module) {
|
|
1036
|
-
const didBootstrap = tryBootstrap();
|
|
1037
|
-
if (didBootstrap) {
|
|
1038
|
-
module = this._modules.get(name);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
if (!module) {
|
|
1042
|
-
const hint = hasBootstrapper() ? "Bootstrap was called but module still not found. Check module registration." : "No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.";
|
|
1043
|
-
throw new Error(`Module "${String(name)}" not registered. ${hint}`);
|
|
1044
|
-
}
|
|
1045
|
-
return module;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* True when a module is registered under `name`. Never throws, so a component
|
|
1049
|
-
* can check for an opt-in module the app may not have registered.
|
|
1050
|
-
*/
|
|
1051
|
-
has(name) {
|
|
1052
|
-
if (this._modules.size === 0) tryBootstrap();
|
|
1053
|
-
return this._modules.has(name);
|
|
1054
|
-
}
|
|
1055
|
-
findByName(moduleName) {
|
|
1056
|
-
if (this._modules.size === 0) {
|
|
1057
|
-
tryBootstrap();
|
|
1058
|
-
}
|
|
1059
|
-
for (const module of this._modules.values()) {
|
|
1060
|
-
if (module.name === moduleName) {
|
|
1061
|
-
return module;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
throw new Error(`Module not found: ${moduleName}`);
|
|
1065
|
-
}
|
|
1066
|
-
getAllPageUrls() {
|
|
1067
|
-
if (this._modules.size === 0) {
|
|
1068
|
-
tryBootstrap();
|
|
1069
|
-
}
|
|
1070
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1071
|
-
const result = [];
|
|
1072
|
-
for (const [key, module] of this._modules.entries()) {
|
|
1073
|
-
const m = module;
|
|
1074
|
-
if (m.pageUrl && !seen.has(m.pageUrl)) {
|
|
1075
|
-
seen.add(m.pageUrl);
|
|
1076
|
-
result.push({ id: m.pageUrl, text: key });
|
|
1077
|
-
result.push({ id: `${m.pageUrl}/:id`, text: `${key} (detail)` });
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
return result.sort((a, b) => a.text.localeCompare(b.text));
|
|
1081
|
-
}
|
|
1082
|
-
findByModelName(modelName) {
|
|
1083
|
-
let module = this._modules.get(modelName);
|
|
1084
|
-
if (!module) {
|
|
1085
|
-
const didBootstrap = tryBootstrap();
|
|
1086
|
-
if (didBootstrap) {
|
|
1087
|
-
module = this._modules.get(modelName);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
if (!module) {
|
|
1091
|
-
throw new Error(`Module not found for model: ${modelName}`);
|
|
1092
|
-
}
|
|
1093
|
-
return module;
|
|
1094
|
-
}
|
|
1095
|
-
findByFeature(feature) {
|
|
1096
|
-
const response = [];
|
|
1097
|
-
for (const module of this._modules.values()) {
|
|
1098
|
-
const m = module;
|
|
1099
|
-
if (m.feature === feature) {
|
|
1100
|
-
response.push(m);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
return response;
|
|
1104
|
-
}
|
|
1105
|
-
getAll() {
|
|
1106
|
-
if (this._modules.size === 0) {
|
|
1107
|
-
tryBootstrap();
|
|
1108
|
-
}
|
|
1109
|
-
return Array.from(this._modules.values());
|
|
1110
|
-
}
|
|
1111
|
-
};
|
|
1112
|
-
var ModuleRegistry = new ModuleRegistryClass();
|
|
1113
|
-
var Modules = new Proxy({}, {
|
|
1114
|
-
get(_, prop) {
|
|
1115
|
-
if (prop === "findByName") {
|
|
1116
|
-
return (name) => ModuleRegistry.findByName(name);
|
|
1117
|
-
}
|
|
1118
|
-
if (prop === "findByModelName") {
|
|
1119
|
-
return (name) => ModuleRegistry.findByModelName(name);
|
|
1120
|
-
}
|
|
1121
|
-
if (prop === "findByFeature") {
|
|
1122
|
-
return (feature) => ModuleRegistry.findByFeature(feature);
|
|
1123
|
-
}
|
|
1124
|
-
return ModuleRegistry.get(prop);
|
|
1125
|
-
}
|
|
1126
|
-
});
|
|
1127
|
-
|
|
1128
|
-
// src/core/endpoint/EndpointCreator.ts
|
|
1129
|
-
var EndpointCreator = class {
|
|
1130
|
-
static {
|
|
1131
|
-
__name(this, "EndpointCreator");
|
|
1132
|
-
}
|
|
1133
|
-
_endpoint;
|
|
1134
|
-
constructor(params) {
|
|
1135
|
-
this._endpoint = {
|
|
1136
|
-
endpoint: params.endpoint,
|
|
1137
|
-
id: params.id,
|
|
1138
|
-
childEndpoint: params.childEndpoint,
|
|
1139
|
-
childId: params.childId,
|
|
1140
|
-
additionalParams: params.additionalParams ?? []
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
endpoint(value) {
|
|
1144
|
-
this._endpoint.endpoint = value;
|
|
1145
|
-
return this;
|
|
1146
|
-
}
|
|
1147
|
-
id(value) {
|
|
1148
|
-
this._endpoint.id = value;
|
|
1149
|
-
return this;
|
|
1150
|
-
}
|
|
1151
|
-
childEndpoint(value) {
|
|
1152
|
-
this._endpoint.childEndpoint = value;
|
|
1153
|
-
return this;
|
|
1154
|
-
}
|
|
1155
|
-
childId(value) {
|
|
1156
|
-
this._endpoint.childId = value;
|
|
1157
|
-
return this;
|
|
1158
|
-
}
|
|
1159
|
-
set additionalParams(value) {
|
|
1160
|
-
this._endpoint.additionalParams = value;
|
|
1161
|
-
}
|
|
1162
|
-
addAdditionalParam(key, value) {
|
|
1163
|
-
if (!this._endpoint.additionalParams) this._endpoint.additionalParams = [];
|
|
1164
|
-
this._endpoint.additionalParams.push({ key, value });
|
|
1165
|
-
return this;
|
|
1166
|
-
}
|
|
1167
|
-
limitToType(selectors) {
|
|
1168
|
-
this.addAdditionalParam(`include`, selectors.join(","));
|
|
1169
|
-
return this;
|
|
1170
|
-
}
|
|
1171
|
-
limitToFields(selectors) {
|
|
1172
|
-
if (selectors.length === 0) return this;
|
|
1173
|
-
selectors.forEach((selector) => {
|
|
1174
|
-
const fieldString = selector.fields.join(",");
|
|
1175
|
-
this.addAdditionalParam(`fields[${selector.type}]`, fieldString);
|
|
1176
|
-
});
|
|
1177
|
-
return this;
|
|
1178
|
-
}
|
|
1179
|
-
generate() {
|
|
1180
|
-
let additionalParams = "";
|
|
1181
|
-
if (this._endpoint.additionalParams) {
|
|
1182
|
-
additionalParams = this._endpoint.additionalParams.map((param) => `${param.key}=${param.value}`).join("&");
|
|
1183
|
-
}
|
|
1184
|
-
let response = ``;
|
|
1185
|
-
response += `${typeof this._endpoint.endpoint === "string" ? this._endpoint.endpoint : this._endpoint.endpoint.name}`;
|
|
1186
|
-
if (this._endpoint.id) response += `/${this._endpoint.id}`;
|
|
1187
|
-
if (this._endpoint.childEndpoint) {
|
|
1188
|
-
response += `/${typeof this._endpoint.childEndpoint === "string" ? this._endpoint.childEndpoint : this._endpoint.childEndpoint.name}`;
|
|
1189
|
-
}
|
|
1190
|
-
if (this._endpoint.childId) response += `/${this._endpoint.childId}`;
|
|
1191
|
-
if (additionalParams) response += `?${additionalParams}`;
|
|
1192
|
-
return response;
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
|
-
|
|
1196
548
|
// src/core/fields/FieldSelector.ts
|
|
1197
549
|
function createJsonApiInclusion(dataType, fields) {
|
|
1198
550
|
return {
|
|
@@ -1288,12 +640,12 @@ import * as React2 from "react";
|
|
|
1288
640
|
var MOBILE_BREAKPOINT = 768;
|
|
1289
641
|
var VIEWPORT_COOKIE_NAME = "viewport_mobile";
|
|
1290
642
|
var VIEWPORT_CONTEXT_KEY = /* @__PURE__ */ Symbol.for("nextjs-jsonapi:viewportContext");
|
|
1291
|
-
var
|
|
643
|
+
var globalStore = globalThis;
|
|
1292
644
|
function getViewportContext() {
|
|
1293
|
-
if (
|
|
1294
|
-
|
|
645
|
+
if (globalStore[VIEWPORT_CONTEXT_KEY] === void 0) {
|
|
646
|
+
globalStore[VIEWPORT_CONTEXT_KEY] = React2.createContext(void 0);
|
|
1295
647
|
}
|
|
1296
|
-
return
|
|
648
|
+
return globalStore[VIEWPORT_CONTEXT_KEY];
|
|
1297
649
|
}
|
|
1298
650
|
__name(getViewportContext, "getViewportContext");
|
|
1299
651
|
function measureViewport() {
|
|
@@ -10840,9 +10192,6 @@ var UserService = class extends AbstractService {
|
|
|
10840
10192
|
}
|
|
10841
10193
|
};
|
|
10842
10194
|
|
|
10843
|
-
// src/features/user/data/user.storage.ts
|
|
10844
|
-
var CURRENT_USER_STORAGE_KEY = "user";
|
|
10845
|
-
|
|
10846
10195
|
// src/features/user/author.module.ts
|
|
10847
10196
|
var AuthorModule = /* @__PURE__ */ __name((factory) => factory({
|
|
10848
10197
|
pageUrl: "/authors",
|
|
@@ -11942,6 +11291,37 @@ var referralAdminModules = /* @__PURE__ */ __name((factory) => ({
|
|
|
11942
11291
|
})
|
|
11943
11292
|
}), "referralAdminModules");
|
|
11944
11293
|
|
|
11294
|
+
// src/offline/sync/models/OfflineChangeSet.ts
|
|
11295
|
+
var OfflineChangeSet = class extends AbstractApiData {
|
|
11296
|
+
static {
|
|
11297
|
+
__name(this, "OfflineChangeSet");
|
|
11298
|
+
}
|
|
11299
|
+
_results;
|
|
11300
|
+
get results() {
|
|
11301
|
+
return this._results ?? [];
|
|
11302
|
+
}
|
|
11303
|
+
rehydrate(data) {
|
|
11304
|
+
super.rehydrate(data);
|
|
11305
|
+
this._results = data.jsonApi.attributes?.results ?? [];
|
|
11306
|
+
return this;
|
|
11307
|
+
}
|
|
11308
|
+
createJsonApi(data) {
|
|
11309
|
+
return {
|
|
11310
|
+
data: {
|
|
11311
|
+
type: Modules.OfflineChangeSet.name,
|
|
11312
|
+
id: data.id,
|
|
11313
|
+
attributes: { changes: data.changes }
|
|
11314
|
+
}
|
|
11315
|
+
};
|
|
11316
|
+
}
|
|
11317
|
+
};
|
|
11318
|
+
|
|
11319
|
+
// src/offline/sync/models/offline.modules.ts
|
|
11320
|
+
var offlineModules = /* @__PURE__ */ __name((factory) => ({
|
|
11321
|
+
OfflineChangeSet: factory({ name: "offline-change-sets", model: OfflineChangeSet }),
|
|
11322
|
+
RootSync: factory({ name: "root-syncs", model: RootSync })
|
|
11323
|
+
}), "offlineModules");
|
|
11324
|
+
|
|
11945
11325
|
// src/features/tokenusage/tokenusage-admin.module.ts
|
|
11946
11326
|
import { CoinsIcon } from "lucide-react";
|
|
11947
11327
|
|
|
@@ -12926,41 +12306,19 @@ var AuditLogModule = /* @__PURE__ */ __name((factory) => factory({
|
|
|
12926
12306
|
}), "AuditLogModule");
|
|
12927
12307
|
|
|
12928
12308
|
export {
|
|
12929
|
-
RehydrationFactory,
|
|
12930
|
-
AbstractApiData,
|
|
12931
12309
|
getLastApiTotal,
|
|
12932
12310
|
clearLastApiTotal,
|
|
12933
12311
|
getLastApiMeta,
|
|
12934
12312
|
clearLastApiMeta,
|
|
12935
|
-
configureI18n,
|
|
12936
|
-
useI18nRouter,
|
|
12937
|
-
useI18nTranslations,
|
|
12938
|
-
getI18nLink,
|
|
12939
|
-
useI18nLocale,
|
|
12940
|
-
useI18nDateFnsLocale,
|
|
12941
|
-
getI18nSupportedLocales,
|
|
12942
12313
|
HttpMethod,
|
|
12943
12314
|
setGlobalErrorHandler,
|
|
12944
12315
|
getGlobalErrorHandler,
|
|
12945
12316
|
AbstractService,
|
|
12946
|
-
configureClientJsonApi,
|
|
12947
|
-
getClientApiUrl,
|
|
12948
|
-
getClientAppUrl,
|
|
12949
|
-
getClientTrackablePages,
|
|
12950
|
-
buildClientUrl,
|
|
12951
|
-
ClientJsonApiGet,
|
|
12952
|
-
ClientJsonApiPost,
|
|
12953
|
-
ClientJsonApiPut,
|
|
12954
|
-
ClientJsonApiPatch,
|
|
12955
|
-
ClientJsonApiDelete,
|
|
12956
12317
|
ClientHttpMethod,
|
|
12957
12318
|
setClientGlobalErrorHandler,
|
|
12958
12319
|
getClientGlobalErrorHandler,
|
|
12959
12320
|
ClientAbstractService,
|
|
12960
12321
|
ModuleRegistrar,
|
|
12961
|
-
ModuleRegistry,
|
|
12962
|
-
Modules,
|
|
12963
|
-
EndpointCreator,
|
|
12964
12322
|
createJsonApiInclusion,
|
|
12965
12323
|
rehydrate,
|
|
12966
12324
|
rehydrateList,
|
|
@@ -13223,7 +12581,6 @@ export {
|
|
|
13223
12581
|
User,
|
|
13224
12582
|
UserFields,
|
|
13225
12583
|
UserService,
|
|
13226
|
-
CURRENT_USER_STORAGE_KEY,
|
|
13227
12584
|
AuthorModule,
|
|
13228
12585
|
UserModule,
|
|
13229
12586
|
OAuthClient,
|
|
@@ -13254,6 +12611,8 @@ export {
|
|
|
13254
12611
|
ReferralModule,
|
|
13255
12612
|
ReferralStatsModule,
|
|
13256
12613
|
referralAdminModules,
|
|
12614
|
+
OfflineChangeSet,
|
|
12615
|
+
offlineModules,
|
|
13257
12616
|
TokenUsageAdminBreakdown,
|
|
13258
12617
|
TokenUsageAdminSummary,
|
|
13259
12618
|
TokenUsageAdminTimeline,
|
|
@@ -13277,4 +12636,4 @@ export {
|
|
|
13277
12636
|
AuditLogService,
|
|
13278
12637
|
AuditLogModule
|
|
13279
12638
|
};
|
|
13280
|
-
//# sourceMappingURL=chunk-
|
|
12639
|
+
//# sourceMappingURL=chunk-P445QGOC.mjs.map
|