@carlonicora/nextjs-jsonapi 1.8.1 → 1.9.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-N534QVBR.mjs → BlockNoteEditor-MXNV2O43.mjs} +5 -5
- package/dist/{BlockNoteEditor-KSPPX6JO.js → BlockNoteEditor-O32YPSNN.js} +15 -15
- package/dist/{BlockNoteEditor-KSPPX6JO.js.map → BlockNoteEditor-O32YPSNN.js.map} +1 -1
- package/dist/{JsonApiRequest-SYZ6FGCA.mjs → JsonApiRequest-ARXYJ2AG.mjs} +2 -2
- package/dist/JsonApiRequest-FZAFAES3.js +24 -0
- package/dist/{JsonApiRequest-2OM5NDAW.js.map → JsonApiRequest-FZAFAES3.js.map} +1 -1
- package/dist/{chunk-IGOWVLJH.mjs → chunk-33UYFFIK.mjs} +5 -1
- package/dist/chunk-33UYFFIK.mjs.map +1 -0
- package/dist/{chunk-SAL7XW2G.mjs → chunk-CHNXYTKO.mjs} +40 -1
- package/dist/chunk-CHNXYTKO.mjs.map +1 -0
- package/dist/{chunk-AGWQ75PQ.js → chunk-I7OQ5WKX.js} +5 -1
- package/dist/chunk-I7OQ5WKX.js.map +1 -0
- package/dist/{chunk-7Z7FEMEB.js → chunk-LPBABDEP.js} +43 -23
- package/dist/chunk-LPBABDEP.js.map +1 -0
- package/dist/{chunk-CK5KLBZV.mjs → chunk-MOVONDSX.mjs} +28 -8
- package/dist/chunk-MOVONDSX.mjs.map +1 -0
- package/dist/{chunk-B426TLJC.js → chunk-PVN4DI3H.js} +395 -395
- package/dist/{chunk-B426TLJC.js.map → chunk-PVN4DI3H.js.map} +1 -1
- package/dist/{chunk-CKS6SVUK.js → chunk-UVXEP2ED.js} +41 -2
- package/dist/chunk-UVXEP2ED.js.map +1 -0
- package/dist/{chunk-TLBZWOCU.mjs → chunk-YHUK7PFT.mjs} +7 -7
- package/dist/chunk-YHUK7PFT.mjs.map +1 -0
- 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 +35 -1
- package/dist/core/index.d.ts +35 -1
- package/dist/core/index.js +13 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +13 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/server/index.js +12 -12
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/client/JsonApiClient.ts +2 -0
- package/src/client/config.ts +3 -1
- package/src/components/containers/PageContainer.tsx +1 -1
- package/src/core/registry/ModuleRegistry.ts +33 -3
- package/src/core/registry/bootstrapStore.ts +63 -0
- package/src/core/registry/index.ts +1 -0
- package/src/unified/JsonApiRequest.ts +3 -1
- package/dist/JsonApiRequest-2OM5NDAW.js +0 -24
- package/dist/chunk-7Z7FEMEB.js.map +0 -1
- package/dist/chunk-AGWQ75PQ.js.map +0 -1
- package/dist/chunk-CK5KLBZV.mjs.map +0 -1
- package/dist/chunk-CKS6SVUK.js.map +0 -1
- package/dist/chunk-IGOWVLJH.mjs.map +0 -1
- package/dist/chunk-SAL7XW2G.mjs.map +0 -1
- package/dist/chunk-TLBZWOCU.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-N534QVBR.mjs.map → BlockNoteEditor-MXNV2O43.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-SYZ6FGCA.mjs.map → JsonApiRequest-ARXYJ2AG.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getRoleId,
|
|
9
9
|
getTrackablePages,
|
|
10
10
|
isRolesConfigured
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-33UYFFIK.mjs";
|
|
12
12
|
import {
|
|
13
13
|
AbstractApiData,
|
|
14
14
|
AbstractService,
|
|
@@ -88,14 +88,19 @@ import {
|
|
|
88
88
|
useComposedRefs,
|
|
89
89
|
useIsMobile,
|
|
90
90
|
userObjectSchema
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-MOVONDSX.mjs";
|
|
92
92
|
import "./chunk-C7C7VY4F.mjs";
|
|
93
93
|
import {
|
|
94
94
|
DataClassRegistry,
|
|
95
95
|
JsonApiDataFactory,
|
|
96
|
+
getBootstrapper,
|
|
97
|
+
hasBootstrapper,
|
|
98
|
+
resetBootstrapStore,
|
|
99
|
+
setBootstrapper,
|
|
96
100
|
translateData,
|
|
97
|
-
translateResponse
|
|
98
|
-
|
|
101
|
+
translateResponse,
|
|
102
|
+
tryBootstrap
|
|
103
|
+
} from "./chunk-CHNXYTKO.mjs";
|
|
99
104
|
import "./chunk-AUXK7QSA.mjs";
|
|
100
105
|
import "./chunk-PAWJFY3S.mjs";
|
|
101
106
|
export {
|
|
@@ -167,6 +172,7 @@ export {
|
|
|
167
172
|
formatDate,
|
|
168
173
|
getApiUrl,
|
|
169
174
|
getAppUrl,
|
|
175
|
+
getBootstrapper,
|
|
170
176
|
getClientGlobalErrorHandler,
|
|
171
177
|
getGlobalErrorHandler,
|
|
172
178
|
getIcon,
|
|
@@ -181,13 +187,17 @@ export {
|
|
|
181
187
|
getTokenHandler,
|
|
182
188
|
getTrackablePages,
|
|
183
189
|
getValueFromPath,
|
|
190
|
+
hasBootstrapper,
|
|
184
191
|
isRolesConfigured,
|
|
185
192
|
rehydrate,
|
|
186
193
|
rehydrateList,
|
|
194
|
+
resetBootstrapStore,
|
|
195
|
+
setBootstrapper,
|
|
187
196
|
setClientGlobalErrorHandler,
|
|
188
197
|
setGlobalErrorHandler,
|
|
189
198
|
translateData,
|
|
190
199
|
translateResponse,
|
|
200
|
+
tryBootstrap,
|
|
191
201
|
useComposedRefs,
|
|
192
202
|
useIsMobile,
|
|
193
203
|
userObjectSchema
|
package/dist/server/index.js
CHANGED
|
@@ -12,12 +12,12 @@ var _chunk3ZPK4QOBjs = require('../chunk-3ZPK4QOB.js');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkLPBABDEPjs = require('../chunk-LPBABDEP.js');
|
|
16
16
|
require('../chunk-IBS6NI7D.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkUVXEP2EDjs = require('../chunk-UVXEP2ED.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkYUO55Q5Ajs = require('../chunk-YUO55Q5A.js');
|
|
@@ -93,7 +93,7 @@ var ServerSession = class {
|
|
|
93
93
|
if (!rawModules) return false;
|
|
94
94
|
const modules = JSON.parse(_zlib2.default.gunzipSync(Buffer.from(rawModules, "base64")).toString());
|
|
95
95
|
const selectedModule = modules.find((module) => module.id === params.module.moduleId);
|
|
96
|
-
return
|
|
96
|
+
return _chunkLPBABDEPjs.checkPermissionsFromServer.call(void 0, {
|
|
97
97
|
module: params.module,
|
|
98
98
|
action: params.action,
|
|
99
99
|
data: params.data,
|
|
@@ -165,7 +165,7 @@ async function ServerJsonApiGet(params) {
|
|
|
165
165
|
language: params.language,
|
|
166
166
|
additionalHeaders: _optionalChain([_serverConfig, 'optionalAccess', _26 => _26.additionalHeaders])
|
|
167
167
|
});
|
|
168
|
-
return
|
|
168
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
169
169
|
classKey: params.classKey,
|
|
170
170
|
apiResponse,
|
|
171
171
|
companyId: params.companyId,
|
|
@@ -186,7 +186,7 @@ async function ServerJsonApiPost(params) {
|
|
|
186
186
|
if (!body) {
|
|
187
187
|
body = {};
|
|
188
188
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
189
|
-
body =
|
|
189
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
190
190
|
}
|
|
191
191
|
const apiResponse = await _chunk3ZPK4QOBjs.serverRequest.call(void 0, {
|
|
192
192
|
method: "POST",
|
|
@@ -198,7 +198,7 @@ async function ServerJsonApiPost(params) {
|
|
|
198
198
|
language: params.language,
|
|
199
199
|
additionalHeaders: _optionalChain([_serverConfig, 'optionalAccess', _27 => _27.additionalHeaders])
|
|
200
200
|
});
|
|
201
|
-
return
|
|
201
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
202
202
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
203
203
|
apiResponse,
|
|
204
204
|
companyId: params.companyId,
|
|
@@ -213,7 +213,7 @@ async function ServerJsonApiPut(params) {
|
|
|
213
213
|
if (!body) {
|
|
214
214
|
body = {};
|
|
215
215
|
} else {
|
|
216
|
-
body =
|
|
216
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
217
217
|
}
|
|
218
218
|
const apiResponse = await _chunk3ZPK4QOBjs.serverRequest.call(void 0, {
|
|
219
219
|
method: "PUT",
|
|
@@ -225,7 +225,7 @@ async function ServerJsonApiPut(params) {
|
|
|
225
225
|
language: params.language,
|
|
226
226
|
additionalHeaders: _optionalChain([_serverConfig, 'optionalAccess', _28 => _28.additionalHeaders])
|
|
227
227
|
});
|
|
228
|
-
return
|
|
228
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
229
229
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
230
230
|
apiResponse,
|
|
231
231
|
companyId: params.companyId,
|
|
@@ -240,7 +240,7 @@ async function ServerJsonApiPatch(params) {
|
|
|
240
240
|
if (!body) {
|
|
241
241
|
body = {};
|
|
242
242
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
243
|
-
body =
|
|
243
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
244
244
|
}
|
|
245
245
|
const apiResponse = await _chunk3ZPK4QOBjs.serverRequest.call(void 0, {
|
|
246
246
|
method: "PATCH",
|
|
@@ -252,7 +252,7 @@ async function ServerJsonApiPatch(params) {
|
|
|
252
252
|
language: params.language,
|
|
253
253
|
additionalHeaders: _optionalChain([_serverConfig, 'optionalAccess', _29 => _29.additionalHeaders])
|
|
254
254
|
});
|
|
255
|
-
return
|
|
255
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
256
256
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
257
257
|
apiResponse,
|
|
258
258
|
companyId: params.companyId,
|
|
@@ -271,7 +271,7 @@ async function ServerJsonApiDelete(params) {
|
|
|
271
271
|
language: params.language,
|
|
272
272
|
additionalHeaders: _optionalChain([_serverConfig, 'optionalAccess', _30 => _30.additionalHeaders])
|
|
273
273
|
});
|
|
274
|
-
return
|
|
274
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
275
275
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
276
276
|
apiResponse,
|
|
277
277
|
companyId: params.companyId,
|
|
@@ -303,5 +303,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ServerJsonApiDelete, "ServerJsonApiDelete")
|
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
|
|
306
|
-
exports.ServerAuthService =
|
|
306
|
+
exports.ServerAuthService = _chunkLPBABDEPjs.AuthService; exports.ServerCompanyService = _chunkLPBABDEPjs.CompanyService; exports.ServerContentService = _chunkLPBABDEPjs.ContentService; exports.ServerFeatureService = _chunkLPBABDEPjs.FeatureService; exports.ServerJsonApiDelete = ServerJsonApiDelete; exports.ServerJsonApiGet = ServerJsonApiGet; exports.ServerJsonApiPatch = ServerJsonApiPatch; exports.ServerJsonApiPost = ServerJsonApiPost; exports.ServerJsonApiPut = ServerJsonApiPut; exports.ServerNotificationService = _chunkLPBABDEPjs.NotificationService; exports.ServerPushService = _chunkLPBABDEPjs.PushService; exports.ServerRoleService = _chunkLPBABDEPjs.RoleService; exports.ServerS3Service = _chunkLPBABDEPjs.S3Service; exports.ServerSession = ServerSession; exports.ServerUserService = _chunkLPBABDEPjs.UserService; exports.configureServerJsonApi = configureServerJsonApi; exports.getServerApiUrl = getServerApiUrl; exports.getServerAppUrl = getServerAppUrl; exports.getServerToken = _chunkYUO55Q5Ajs.getServerToken; exports.getServerTrackablePages = getServerTrackablePages; exports.invalidateCacheTag = invalidateCacheTag; exports.invalidateCacheTags = invalidateCacheTags; exports.serverRequest = _chunk3ZPK4QOBjs.serverRequest;
|
|
307
307
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.mjs
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
S3Service,
|
|
13
13
|
UserService,
|
|
14
14
|
checkPermissionsFromServer
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-MOVONDSX.mjs";
|
|
16
16
|
import "../chunk-C7C7VY4F.mjs";
|
|
17
17
|
import {
|
|
18
18
|
JsonApiDataFactory,
|
|
19
19
|
translateResponse
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-CHNXYTKO.mjs";
|
|
21
21
|
import {
|
|
22
22
|
getServerToken
|
|
23
23
|
} from "../chunk-F5UNXZ3J.mjs";
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { JsonApiDataFactory } from "../core/factories/JsonApiDataFactory";
|
|
4
4
|
import { ApiRequestDataTypeInterface } from "../core/interfaces/ApiRequestDataTypeInterface";
|
|
5
5
|
import { ApiResponseInterface } from "../core/interfaces/ApiResponseInterface";
|
|
6
|
+
import { setBootstrapper } from "../core/registry/bootstrapStore";
|
|
6
7
|
import { translateResponse } from "../core/utils/translateResponse";
|
|
7
8
|
import { ModuleWithPermissions } from "../permissions/types";
|
|
8
9
|
import { directFetch } from "./request";
|
|
@@ -30,6 +31,7 @@ export function configureClientJsonApi(config: {
|
|
|
30
31
|
}): void {
|
|
31
32
|
_clientConfig = config;
|
|
32
33
|
if (config.bootstrapper) {
|
|
34
|
+
setBootstrapper(config.bootstrapper);
|
|
33
35
|
config.bootstrapper();
|
|
34
36
|
}
|
|
35
37
|
}
|
package/src/client/config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ModuleWithPermissions } from "../permissions/types";
|
|
4
|
+
import { setBootstrapper } from "../core/registry/bootstrapStore";
|
|
4
5
|
|
|
5
6
|
// Config storage for client-side contexts
|
|
6
7
|
let _clientConfig: {
|
|
@@ -23,8 +24,9 @@ export function configureJsonApi(config: {
|
|
|
23
24
|
additionalHeaders?: Record<string, string>;
|
|
24
25
|
}): void {
|
|
25
26
|
_clientConfig = config;
|
|
26
|
-
//
|
|
27
|
+
// Register and call bootstrapper to register all modules
|
|
27
28
|
if (config.bootstrapper) {
|
|
29
|
+
setBootstrapper(config.bootstrapper);
|
|
28
30
|
config.bootstrapper();
|
|
29
31
|
}
|
|
30
32
|
}
|
|
@@ -9,7 +9,7 @@ export function PageContainer({ children, testId, className }: PageContainerProp
|
|
|
9
9
|
return (
|
|
10
10
|
<div className={`flex h-full w-full flex-col`} data-testid={testId}>
|
|
11
11
|
<Header />
|
|
12
|
-
<main className={cn(`flex w-full flex-1 flex-col gap-y-4 pt-4 pl-4 pr-4`, className)}>{children}</main>
|
|
12
|
+
<main className={cn(`flex w-full flex-1 flex-col gap-y-4 pt-4 pl-4 pr-4 pb-20`, className)}>{children}</main>
|
|
13
13
|
</div>
|
|
14
14
|
);
|
|
15
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiRequestDataTypeInterface } from "../interfaces/ApiRequestDataTypeInterface";
|
|
2
2
|
import { ModuleWithPermissions } from "../../permissions/types";
|
|
3
|
+
import { tryBootstrap, hasBootstrapper } from "./bootstrapStore";
|
|
3
4
|
|
|
4
5
|
// Foundation module types - defined by LIBRARY
|
|
5
6
|
export interface FoundationModuleDefinitions {
|
|
@@ -33,14 +34,34 @@ class ModuleRegistryClass {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
get<K extends keyof ModuleDefinitions>(name: K): ModuleDefinitions[K] {
|
|
36
|
-
|
|
37
|
+
let module = this._modules.get(name as string);
|
|
38
|
+
|
|
39
|
+
// Self-healing: if module not found, try bootstrapping first
|
|
37
40
|
if (!module) {
|
|
38
|
-
|
|
41
|
+
const didBootstrap = tryBootstrap();
|
|
42
|
+
if (didBootstrap) {
|
|
43
|
+
// Retry after bootstrap
|
|
44
|
+
module = this._modules.get(name as string);
|
|
45
|
+
}
|
|
39
46
|
}
|
|
47
|
+
|
|
48
|
+
if (!module) {
|
|
49
|
+
// Provide helpful error message based on state
|
|
50
|
+
const hint = hasBootstrapper()
|
|
51
|
+
? "Bootstrap was called but module still not found. Check module registration."
|
|
52
|
+
: "No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.";
|
|
53
|
+
throw new Error(`Module "${String(name)}" not registered. ${hint}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
return module as ModuleDefinitions[K];
|
|
41
57
|
}
|
|
42
58
|
|
|
43
59
|
findByName(moduleName: string): ModuleWithPermissions {
|
|
60
|
+
// Self-healing: try bootstrap if registry is empty
|
|
61
|
+
if (this._modules.size === 0) {
|
|
62
|
+
tryBootstrap();
|
|
63
|
+
}
|
|
64
|
+
|
|
44
65
|
// Search by module's name property (e.g., "topics", "articles")
|
|
45
66
|
for (const module of this._modules.values()) {
|
|
46
67
|
if ((module as ModuleWithPermissions).name === moduleName) {
|
|
@@ -52,7 +73,16 @@ class ModuleRegistryClass {
|
|
|
52
73
|
|
|
53
74
|
findByModelName(modelName: string): ModuleWithPermissions {
|
|
54
75
|
// Direct lookup by registry key (e.g., "Article", "Document")
|
|
55
|
-
|
|
76
|
+
let module = this._modules.get(modelName);
|
|
77
|
+
|
|
78
|
+
// Self-healing: if not found, try bootstrapping
|
|
79
|
+
if (!module) {
|
|
80
|
+
const didBootstrap = tryBootstrap();
|
|
81
|
+
if (didBootstrap) {
|
|
82
|
+
module = this._modules.get(modelName);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
56
86
|
if (!module) {
|
|
57
87
|
throw new Error(`Module not found for model: ${modelName}`);
|
|
58
88
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized bootstrap store accessible from ModuleRegistry.
|
|
3
|
+
* This file has NO external dependencies to avoid circular imports.
|
|
4
|
+
*
|
|
5
|
+
* The bootstrap store allows ModuleRegistry to call the app's bootstrapper
|
|
6
|
+
* when modules are accessed before bootstrap() was called, providing
|
|
7
|
+
* self-healing behavior for module evaluation order issues.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type BootstrapperFn = () => void;
|
|
11
|
+
|
|
12
|
+
let _bootstrapper: BootstrapperFn | null = null;
|
|
13
|
+
let _bootstrapAttempted = false;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Register the bootstrapper function.
|
|
17
|
+
* Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.
|
|
18
|
+
*/
|
|
19
|
+
export function setBootstrapper(fn: BootstrapperFn): void {
|
|
20
|
+
_bootstrapper = fn;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get the registered bootstrapper function.
|
|
25
|
+
* Returns null if no bootstrapper has been registered.
|
|
26
|
+
*/
|
|
27
|
+
export function getBootstrapper(): BootstrapperFn | null {
|
|
28
|
+
return _bootstrapper;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Attempt to run the bootstrapper if one is registered.
|
|
33
|
+
* Returns true if bootstrapper was executed, false if not available.
|
|
34
|
+
* Safe to call multiple times - bootstrapper is expected to be idempotent.
|
|
35
|
+
*/
|
|
36
|
+
export function tryBootstrap(): boolean {
|
|
37
|
+
if (_bootstrapAttempted && !_bootstrapper) {
|
|
38
|
+
// Already tried and no bootstrapper available
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
_bootstrapAttempted = true;
|
|
42
|
+
|
|
43
|
+
if (_bootstrapper) {
|
|
44
|
+
_bootstrapper();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if a bootstrapper has been registered.
|
|
52
|
+
*/
|
|
53
|
+
export function hasBootstrapper(): boolean {
|
|
54
|
+
return _bootstrapper !== null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Reset the bootstrap store. Useful for testing.
|
|
59
|
+
*/
|
|
60
|
+
export function resetBootstrapStore(): void {
|
|
61
|
+
_bootstrapper = null;
|
|
62
|
+
_bootstrapAttempted = false;
|
|
63
|
+
}
|
|
@@ -2,6 +2,7 @@ import { JsonApiDataFactory } from "../core/factories/JsonApiDataFactory";
|
|
|
2
2
|
import { ApiData } from "../core/interfaces/ApiData";
|
|
3
3
|
import { ApiRequestDataTypeInterface } from "../core/interfaces/ApiRequestDataTypeInterface";
|
|
4
4
|
import { ApiResponseInterface } from "../core/interfaces/ApiResponseInterface";
|
|
5
|
+
import { setBootstrapper } from "../core/registry/bootstrapStore";
|
|
5
6
|
import { translateResponse } from "../core/utils/translateResponse";
|
|
6
7
|
import { ModuleWithPermissions } from "../permissions/types";
|
|
7
8
|
|
|
@@ -58,8 +59,9 @@ export function configureJsonApi(config: {
|
|
|
58
59
|
additionalHeaders?: Record<string, string>;
|
|
59
60
|
}): void {
|
|
60
61
|
_staticConfig = config;
|
|
61
|
-
//
|
|
62
|
+
// Register and call bootstrapper to register all modules
|
|
62
63
|
if (config.bootstrapper) {
|
|
64
|
+
setBootstrapper(config.bootstrapper);
|
|
63
65
|
config.bootstrapper();
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunkCKS6SVUKjs = require('./chunk-CKS6SVUK.js');
|
|
12
|
-
require('./chunk-7QVYU63E.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
exports.JsonApiDelete = _chunkCKS6SVUKjs.JsonApiDelete; exports.JsonApiGet = _chunkCKS6SVUKjs.JsonApiGet; exports.JsonApiPatch = _chunkCKS6SVUKjs.JsonApiPatch; exports.JsonApiPost = _chunkCKS6SVUKjs.JsonApiPost; exports.JsonApiPut = _chunkCKS6SVUKjs.JsonApiPut; exports.configureJsonApi = _chunkCKS6SVUKjs.configureJsonApi; exports.getApiUrl = _chunkCKS6SVUKjs.getApiUrl; exports.getAppUrl = _chunkCKS6SVUKjs.getAppUrl; exports.getTrackablePages = _chunkCKS6SVUKjs.getTrackablePages;
|
|
24
|
-
//# sourceMappingURL=JsonApiRequest-2OM5NDAW.js.map
|