@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
|
@@ -8,7 +8,10 @@ var _chunkIBS6NI7Djs = require('./chunk-IBS6NI7D.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkUVXEP2EDjs = require('./chunk-UVXEP2ED.js');
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
var _chunkLXKSUWAVjs = require('./chunk-LXKSUWAV.js');
|
|
@@ -22,12 +25,12 @@ var RehydrationFactory = class {
|
|
|
22
25
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "RehydrationFactory");
|
|
23
26
|
}
|
|
24
27
|
static rehydrate(classKey, data) {
|
|
25
|
-
const factoryClass =
|
|
28
|
+
const factoryClass = _chunkUVXEP2EDjs.DataClassRegistry.get(classKey);
|
|
26
29
|
const instance = new factoryClass();
|
|
27
30
|
return instance.rehydrate(data);
|
|
28
31
|
}
|
|
29
32
|
static rehydrateList(classKey, data) {
|
|
30
|
-
const factoryClass =
|
|
33
|
+
const factoryClass = _chunkUVXEP2EDjs.DataClassRegistry.get(classKey);
|
|
31
34
|
const response = data.map((item) => {
|
|
32
35
|
const instance = new factoryClass();
|
|
33
36
|
return instance.rehydrate(item);
|
|
@@ -224,7 +227,7 @@ var AbstractService = class {
|
|
|
224
227
|
* Make an API call with automatic environment detection and error handling.
|
|
225
228
|
*/
|
|
226
229
|
static async callApi(params) {
|
|
227
|
-
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
230
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-FZAFAES3.js")));
|
|
228
231
|
let apiResponse;
|
|
229
232
|
let language = "en";
|
|
230
233
|
if (typeof window === "undefined") {
|
|
@@ -309,7 +312,7 @@ var AbstractService = class {
|
|
|
309
312
|
* Get raw JSON:API response data without deserialization.
|
|
310
313
|
*/
|
|
311
314
|
static async getRawData(params) {
|
|
312
|
-
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
315
|
+
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-FZAFAES3.js")));
|
|
313
316
|
let language = "en";
|
|
314
317
|
if (typeof window === "undefined") {
|
|
315
318
|
const { getLocale } = await Promise.resolve().then(() => _interopRequireWildcard(require("next-intl/server")));
|
|
@@ -343,6 +346,7 @@ var _clientConfig = null;
|
|
|
343
346
|
function configureClientJsonApi(config) {
|
|
344
347
|
_clientConfig = config;
|
|
345
348
|
if (config.bootstrapper) {
|
|
349
|
+
_chunkUVXEP2EDjs.setBootstrapper.call(void 0, config.bootstrapper);
|
|
346
350
|
config.bootstrapper();
|
|
347
351
|
}
|
|
348
352
|
}
|
|
@@ -399,7 +403,7 @@ async function ClientJsonApiGet(params) {
|
|
|
399
403
|
language: params.language,
|
|
400
404
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _19 => _19.additionalHeaders])
|
|
401
405
|
});
|
|
402
|
-
return
|
|
406
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
403
407
|
classKey: params.classKey,
|
|
404
408
|
apiResponse,
|
|
405
409
|
companyId: params.companyId,
|
|
@@ -420,7 +424,7 @@ async function ClientJsonApiPost(params) {
|
|
|
420
424
|
if (!body) {
|
|
421
425
|
body = {};
|
|
422
426
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
423
|
-
body =
|
|
427
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
424
428
|
}
|
|
425
429
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
426
430
|
method: "POST",
|
|
@@ -432,7 +436,7 @@ async function ClientJsonApiPost(params) {
|
|
|
432
436
|
language: params.language,
|
|
433
437
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _20 => _20.additionalHeaders])
|
|
434
438
|
});
|
|
435
|
-
return
|
|
439
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
436
440
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
437
441
|
apiResponse,
|
|
438
442
|
companyId: params.companyId,
|
|
@@ -447,7 +451,7 @@ async function ClientJsonApiPut(params) {
|
|
|
447
451
|
if (!body) {
|
|
448
452
|
body = {};
|
|
449
453
|
} else {
|
|
450
|
-
body =
|
|
454
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
451
455
|
}
|
|
452
456
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
453
457
|
method: "PUT",
|
|
@@ -459,7 +463,7 @@ async function ClientJsonApiPut(params) {
|
|
|
459
463
|
language: params.language,
|
|
460
464
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _21 => _21.additionalHeaders])
|
|
461
465
|
});
|
|
462
|
-
return
|
|
466
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
463
467
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
464
468
|
apiResponse,
|
|
465
469
|
companyId: params.companyId,
|
|
@@ -474,7 +478,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
474
478
|
if (!body) {
|
|
475
479
|
body = {};
|
|
476
480
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
477
|
-
body =
|
|
481
|
+
body = _chunkUVXEP2EDjs.JsonApiDataFactory.create(params.classKey, body);
|
|
478
482
|
}
|
|
479
483
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
480
484
|
method: "PATCH",
|
|
@@ -486,7 +490,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
486
490
|
language: params.language,
|
|
487
491
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _22 => _22.additionalHeaders])
|
|
488
492
|
});
|
|
489
|
-
return
|
|
493
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
490
494
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
491
495
|
apiResponse,
|
|
492
496
|
companyId: params.companyId,
|
|
@@ -505,7 +509,7 @@ async function ClientJsonApiDelete(params) {
|
|
|
505
509
|
language: params.language,
|
|
506
510
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _23 => _23.additionalHeaders])
|
|
507
511
|
});
|
|
508
|
-
return
|
|
512
|
+
return _chunkUVXEP2EDjs.translateResponse.call(void 0, {
|
|
509
513
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
510
514
|
apiResponse,
|
|
511
515
|
companyId: params.companyId,
|
|
@@ -707,7 +711,7 @@ var ModuleRegistrar = (_class = class {
|
|
|
707
711
|
}).map((key) => modulesClass[key]);
|
|
708
712
|
data.forEach((item) => {
|
|
709
713
|
if (item && item.model) {
|
|
710
|
-
|
|
714
|
+
_chunkUVXEP2EDjs.DataClassRegistry.registerObjectClass(item, item.model);
|
|
711
715
|
}
|
|
712
716
|
});
|
|
713
717
|
this._isBootstrapped = true;
|
|
@@ -717,7 +721,7 @@ var ModuleRegistrar = (_class = class {
|
|
|
717
721
|
*/
|
|
718
722
|
static reset() {
|
|
719
723
|
this._isBootstrapped = false;
|
|
720
|
-
|
|
724
|
+
_chunkUVXEP2EDjs.DataClassRegistry.clear();
|
|
721
725
|
}
|
|
722
726
|
}, _class.__initStatic(), _class);
|
|
723
727
|
|
|
@@ -731,13 +735,23 @@ var ModuleRegistryClass = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
731
735
|
this._modules.set(name, module);
|
|
732
736
|
}
|
|
733
737
|
get(name) {
|
|
734
|
-
|
|
738
|
+
let module = this._modules.get(name);
|
|
739
|
+
if (!module) {
|
|
740
|
+
const didBootstrap = _chunkUVXEP2EDjs.tryBootstrap.call(void 0, );
|
|
741
|
+
if (didBootstrap) {
|
|
742
|
+
module = this._modules.get(name);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
735
745
|
if (!module) {
|
|
736
|
-
|
|
746
|
+
const hint = _chunkUVXEP2EDjs.hasBootstrapper.call(void 0, ) ? "Bootstrap was called but module still not found. Check module registration." : "No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.";
|
|
747
|
+
throw new Error(`Module "${String(name)}" not registered. ${hint}`);
|
|
737
748
|
}
|
|
738
749
|
return module;
|
|
739
750
|
}
|
|
740
751
|
findByName(moduleName) {
|
|
752
|
+
if (this._modules.size === 0) {
|
|
753
|
+
_chunkUVXEP2EDjs.tryBootstrap.call(void 0, );
|
|
754
|
+
}
|
|
741
755
|
for (const module of this._modules.values()) {
|
|
742
756
|
if (module.name === moduleName) {
|
|
743
757
|
return module;
|
|
@@ -746,7 +760,13 @@ var ModuleRegistryClass = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
746
760
|
throw new Error(`Module not found: ${moduleName}`);
|
|
747
761
|
}
|
|
748
762
|
findByModelName(modelName) {
|
|
749
|
-
|
|
763
|
+
let module = this._modules.get(modelName);
|
|
764
|
+
if (!module) {
|
|
765
|
+
const didBootstrap = _chunkUVXEP2EDjs.tryBootstrap.call(void 0, );
|
|
766
|
+
if (didBootstrap) {
|
|
767
|
+
module = this._modules.get(modelName);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
750
770
|
if (!module) {
|
|
751
771
|
throw new Error(`Module not found for model: ${modelName}`);
|
|
752
772
|
}
|
|
@@ -2102,7 +2122,7 @@ var AuthService = class extends AbstractService {
|
|
|
2102
2122
|
}
|
|
2103
2123
|
static async login(params) {
|
|
2104
2124
|
const language = params.language || "en-US";
|
|
2105
|
-
const apiResponse = await
|
|
2125
|
+
const apiResponse = await _chunkUVXEP2EDjs.JsonApiPost.call(void 0, {
|
|
2106
2126
|
classKey: Modules.Auth,
|
|
2107
2127
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
|
|
2108
2128
|
body: { email: params.email, password: params.password },
|
|
@@ -2130,7 +2150,7 @@ var AuthService = class extends AbstractService {
|
|
|
2130
2150
|
}
|
|
2131
2151
|
static async logout(params) {
|
|
2132
2152
|
const language = _optionalChain([params, 'optionalAccess', _55 => _55.language]) || "en-US";
|
|
2133
|
-
await
|
|
2153
|
+
await _chunkUVXEP2EDjs.JsonApiDelete.call(void 0, {
|
|
2134
2154
|
classKey: Modules.Auth,
|
|
2135
2155
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
|
|
2136
2156
|
language
|
|
@@ -2142,7 +2162,7 @@ var AuthService = class extends AbstractService {
|
|
|
2142
2162
|
}
|
|
2143
2163
|
static async initialiseForgotPassword(params) {
|
|
2144
2164
|
const language = params.language || "en-US";
|
|
2145
|
-
const response = await
|
|
2165
|
+
const response = await _chunkUVXEP2EDjs.JsonApiPost.call(void 0, {
|
|
2146
2166
|
classKey: Modules.Auth,
|
|
2147
2167
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
|
|
2148
2168
|
body: { email: params.email },
|
|
@@ -2171,7 +2191,7 @@ var AuthService = class extends AbstractService {
|
|
|
2171
2191
|
}
|
|
2172
2192
|
static async validateCode(params) {
|
|
2173
2193
|
const language = params.language || "en-US";
|
|
2174
|
-
const apiResponse = await
|
|
2194
|
+
const apiResponse = await _chunkUVXEP2EDjs.JsonApiGet.call(void 0, {
|
|
2175
2195
|
classKey: Modules.Auth,
|
|
2176
2196
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
|
|
2177
2197
|
language
|
|
@@ -3455,4 +3475,4 @@ var AuthorModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory
|
|
|
3455
3475
|
|
|
3456
3476
|
|
|
3457
3477
|
exports.RehydrationFactory = RehydrationFactory; exports.AbstractApiData = AbstractApiData; exports.HttpMethod = HttpMethod; exports.setGlobalErrorHandler = setGlobalErrorHandler; exports.getGlobalErrorHandler = getGlobalErrorHandler; exports.AbstractService = AbstractService; exports.configureClientJsonApi = configureClientJsonApi; exports.getClientApiUrl = getClientApiUrl; exports.getClientAppUrl = getClientAppUrl; exports.getClientTrackablePages = getClientTrackablePages; exports.ClientJsonApiGet = ClientJsonApiGet; exports.ClientJsonApiPost = ClientJsonApiPost; exports.ClientJsonApiPut = ClientJsonApiPut; exports.ClientJsonApiPatch = ClientJsonApiPatch; exports.ClientJsonApiDelete = ClientJsonApiDelete; exports.ClientHttpMethod = ClientHttpMethod; exports.setClientGlobalErrorHandler = setClientGlobalErrorHandler; exports.getClientGlobalErrorHandler = getClientGlobalErrorHandler; exports.ClientAbstractService = ClientAbstractService; exports.ModuleRegistrar = ModuleRegistrar; exports.ModuleRegistry = ModuleRegistry; exports.Modules = Modules; exports.EndpointCreator = EndpointCreator; exports.createJsonApiInclusion = createJsonApiInclusion; exports.rehydrate = rehydrate; exports.rehydrateList = rehydrateList; exports.cn = cn; exports.composeRefs = composeRefs; exports.useComposedRefs = useComposedRefs; exports.useIsMobile = useIsMobile; exports.formatDate = formatDate; exports.exists = exists; exports.TableOptions = TableOptions; exports.getTableOptions = getTableOptions; exports.getTableComponents = getTableComponents; exports.userObjectSchema = userObjectSchema; exports.entityObjectSchema = entityObjectSchema; exports.BlockNoteDiffUtil = BlockNoteDiffUtil; exports.BlockNoteWordDiffRendererUtil = BlockNoteWordDiffRendererUtil; exports.getIconByModule = getIconByModule; exports.getIcon = getIcon; exports.getIconByModuleName = getIconByModuleName; exports.getLucideIcon = getLucideIcon; exports.getLucideIconByModule = getLucideIconByModule; exports.getLucideIconByModuleName = getLucideIconByModuleName; exports.Action = Action; exports.checkPermissions = checkPermissions; exports.checkPermissionsFromServer = checkPermissionsFromServer; exports.getValueFromPath = getValueFromPath; exports.Auth = Auth; exports.configureAuth = configureAuth; exports.getTokenHandler = getTokenHandler; exports.AuthService = AuthService; exports.AuthComponent = AuthComponent; exports.AuthModule = AuthModule; exports.Company = Company; exports.CompanyFields = CompanyFields; exports.CompanyService = CompanyService; exports.CompanyModule = CompanyModule; exports.Content = Content; exports.ContentFields = ContentFields; exports.ContentService = ContentService; exports.ContentModule = ContentModule; exports.Feature = Feature; exports.FeatureService = FeatureService; exports.FeatureModule = FeatureModule; exports.Module = Module; exports.ModuleModule = ModuleModule; exports.Notification = Notification; exports.NotificationFields = NotificationFields; exports.NotificationService = NotificationService; exports.NotificationModule = NotificationModule; exports.Push = Push; exports.PushService = PushService; exports.PushModule = PushModule; exports.Role = Role; exports.RoleFields = RoleFields; exports.RoleService = RoleService; exports.RoleModule = RoleModule; exports.S3 = S3; exports.S3Module = S3Module; exports.S3Service = S3Service; exports.User = User; exports.UserFields = UserFields; exports.UserService = UserService; exports.UserModule = UserModule; exports.AuthorModule = AuthorModule;
|
|
3458
|
-
//# sourceMappingURL=chunk-
|
|
3478
|
+
//# sourceMappingURL=chunk-LPBABDEP.js.map
|