@carlonicora/nextjs-jsonapi 1.114.0 → 1.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{AssistantMessageInterface-BuUZFkE5.d.mts → AssistantMessageInterface-Ca0G0vZw.d.mts} +1 -1
  2. package/dist/{AssistantMessageInterface-CQwh5tEb.d.ts → AssistantMessageInterface-DEZ5AnVl.d.ts} +1 -1
  3. package/dist/{BlockNoteEditor-DT5L5AAB.js → BlockNoteEditor-R6U4PCQ7.js} +19 -19
  4. package/dist/{BlockNoteEditor-DT5L5AAB.js.map → BlockNoteEditor-R6U4PCQ7.js.map} +1 -1
  5. package/dist/{BlockNoteEditor-HIEAHXR4.mjs → BlockNoteEditor-RFRK3STN.mjs} +4 -4
  6. package/dist/{auth.interface-CXBF8Mhi.d.mts → auth.interface-r3XKYOrQ.d.mts} +1 -1
  7. package/dist/{auth.interface-8b601idJ.d.ts → auth.interface-yivTb46w.d.ts} +1 -1
  8. package/dist/billing/index.js +346 -346
  9. package/dist/billing/index.mjs +3 -3
  10. package/dist/{chunk-4BUZUKER.js → chunk-6KLR3WJQ.js} +7 -7
  11. package/dist/{chunk-4BUZUKER.js.map → chunk-6KLR3WJQ.js.map} +1 -1
  12. package/dist/{chunk-FBTTIGLL.mjs → chunk-M7XAKLSP.mjs} +14 -5
  13. package/dist/chunk-M7XAKLSP.mjs.map +1 -0
  14. package/dist/{chunk-TVOW47AP.mjs → chunk-RKUUGCYB.mjs} +4 -4
  15. package/dist/{chunk-7EQ46GUL.js → chunk-S2PTWBN6.js} +30 -21
  16. package/dist/chunk-S2PTWBN6.js.map +1 -0
  17. package/dist/{chunk-VA2KFKHD.js → chunk-SPRFCAQI.js} +695 -695
  18. package/dist/{chunk-VA2KFKHD.js.map → chunk-SPRFCAQI.js.map} +1 -1
  19. package/dist/{chunk-DJSH6VHF.mjs → chunk-WEPQD5MP.mjs} +2 -2
  20. package/dist/client/index.d.mts +2 -2
  21. package/dist/client/index.d.ts +2 -2
  22. package/dist/client/index.js +4 -4
  23. package/dist/client/index.mjs +3 -3
  24. package/dist/components/index.d.mts +3 -3
  25. package/dist/components/index.d.ts +3 -3
  26. package/dist/components/index.js +4 -4
  27. package/dist/components/index.mjs +3 -3
  28. package/dist/contexts/index.d.mts +3 -3
  29. package/dist/contexts/index.d.ts +3 -3
  30. package/dist/contexts/index.js +4 -4
  31. package/dist/contexts/index.mjs +3 -3
  32. package/dist/core/index.d.mts +10 -8
  33. package/dist/core/index.d.ts +10 -8
  34. package/dist/core/index.js +2 -2
  35. package/dist/core/index.mjs +1 -1
  36. package/dist/features/help/index.js +36 -36
  37. package/dist/features/help/index.mjs +3 -3
  38. package/dist/index.d.mts +5 -5
  39. package/dist/index.d.ts +5 -5
  40. package/dist/index.js +3 -3
  41. package/dist/index.mjs +2 -2
  42. package/dist/{notification.interface-DIxR23eS.d.mts → notification.interface-B3kNUTZs.d.mts} +2 -1
  43. package/dist/{notification.interface-C1T1C2ee.d.ts → notification.interface-LKFmZndR.d.ts} +2 -1
  44. package/dist/{s3.service-0BTClOYO.d.mts → s3.service-CihgBy97.d.mts} +5 -2
  45. package/dist/{s3.service-CT27Fm1s.d.ts → s3.service-Cyvfk3qV.d.ts} +5 -2
  46. package/dist/server/index.d.mts +3 -3
  47. package/dist/server/index.d.ts +3 -3
  48. package/dist/server/index.js +3 -3
  49. package/dist/server/index.mjs +1 -1
  50. package/dist/{useSocket-B1fMIr17.d.mts → useSocket-BSjn1Rlb.d.mts} +1 -1
  51. package/dist/{useSocket-BdJTBXKv.d.ts → useSocket-BsbaGPqE.d.ts} +1 -1
  52. package/package.json +1 -1
  53. package/src/core/abstracts/AbstractService.ts +6 -3
  54. package/src/features/notification/data/notification.interface.ts +2 -2
  55. package/src/features/notification/data/notification.ts +21 -5
  56. package/dist/chunk-7EQ46GUL.js.map +0 -1
  57. package/dist/chunk-FBTTIGLL.mjs.map +0 -1
  58. /package/dist/{BlockNoteEditor-HIEAHXR4.mjs.map → BlockNoteEditor-RFRK3STN.mjs.map} +0 -0
  59. /package/dist/{chunk-TVOW47AP.mjs.map → chunk-RKUUGCYB.mjs.map} +0 -0
  60. /package/dist/{chunk-DJSH6VHF.mjs.map → chunk-WEPQD5MP.mjs.map} +0 -0
@@ -146,6 +146,7 @@ export abstract class AbstractService {
146
146
  responseType?: ApiRequestDataTypeInterface;
147
147
  files?: { [key: string]: File | Blob } | File | Blob;
148
148
  token?: string;
149
+ suppressGlobalError?: boolean;
149
150
  }): Promise<T> {
150
151
  // Dynamic import to avoid bundling issues
151
152
  const { JsonApiGet, JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } =
@@ -222,7 +223,7 @@ export abstract class AbstractService {
222
223
  }
223
224
 
224
225
  if (!apiResponse.ok) {
225
- if (globalErrorHandler && typeof window !== "undefined") {
226
+ if (globalErrorHandler && typeof window !== "undefined" && !params.suppressGlobalError) {
226
227
  globalErrorHandler(apiResponse.response, apiResponse.error);
227
228
  return undefined as any;
228
229
  } else {
@@ -257,6 +258,7 @@ export abstract class AbstractService {
257
258
  overridesJsonApiCreation?: boolean;
258
259
  responseType?: ApiRequestDataTypeInterface;
259
260
  files?: { [key: string]: File | Blob } | File | Blob;
261
+ suppressGlobalError?: boolean;
260
262
  }): Promise<{ data: T; meta?: Record<string, any> }> {
261
263
  // Dynamic import to avoid bundling issues
262
264
  const { JsonApiGet, JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } =
@@ -332,7 +334,7 @@ export abstract class AbstractService {
332
334
  }
333
335
 
334
336
  if (!apiResponse.ok) {
335
- if (globalErrorHandler && typeof window !== "undefined") {
337
+ if (globalErrorHandler && typeof window !== "undefined" && !params.suppressGlobalError) {
336
338
  globalErrorHandler(apiResponse.response, apiResponse.error);
337
339
  return { data: undefined as any, meta: undefined };
338
340
  } else {
@@ -357,6 +359,7 @@ export abstract class AbstractService {
357
359
  method: HttpMethod;
358
360
  endpoint: string;
359
361
  companyId?: string;
362
+ suppressGlobalError?: boolean;
360
363
  }): Promise<any> {
361
364
  const { JsonApiGet } = await import("../../unified/JsonApiRequest");
362
365
 
@@ -378,7 +381,7 @@ export abstract class AbstractService {
378
381
  });
379
382
 
380
383
  if (!apiResponse.ok) {
381
- if (globalErrorHandler && typeof window !== "undefined") {
384
+ if (globalErrorHandler && typeof window !== "undefined" && !params.suppressGlobalError) {
382
385
  globalErrorHandler(apiResponse.response, apiResponse.error);
383
386
  return undefined as any;
384
387
  } else {
@@ -1,5 +1,4 @@
1
1
  import { ApiDataInterface } from "../../../core";
2
- import { UserInterface } from "../../user";
3
2
 
4
3
  export type NotificationInput = {
5
4
  id: string;
@@ -12,5 +11,6 @@ export interface NotificationInterface extends ApiDataInterface {
12
11
  get message(): string | undefined;
13
12
  get actionUrl(): string | undefined;
14
13
 
15
- get actor(): UserInterface | undefined;
14
+ get actor(): ApiDataInterface | undefined;
15
+ get subject(): ApiDataInterface | undefined;
16
16
  }
@@ -1,5 +1,4 @@
1
- import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from "../../../core";
2
- import { UserInterface } from "../../user";
1
+ import { AbstractApiData, ApiDataInterface, JsonApiHydratedDataInterface, Modules } from "../../../core";
3
2
  import { NotificationInput, NotificationInterface } from "./notification.interface";
4
3
 
5
4
  export class Notification extends AbstractApiData implements NotificationInterface {
@@ -8,7 +7,8 @@ export class Notification extends AbstractApiData implements NotificationInterfa
8
7
  private _message?: string;
9
8
  private _actionUrl?: string;
10
9
 
11
- private _actor?: UserInterface;
10
+ private _actor?: ApiDataInterface;
11
+ private _subject?: ApiDataInterface;
12
12
 
13
13
  get notificationType(): string {
14
14
  if (this._notificationType === undefined) throw new Error("notificationType is not set");
@@ -27,10 +27,14 @@ export class Notification extends AbstractApiData implements NotificationInterfa
27
27
  return this._actionUrl;
28
28
  }
29
29
 
30
- get actor(): UserInterface | undefined {
30
+ get actor(): ApiDataInterface | undefined {
31
31
  return this._actor;
32
32
  }
33
33
 
34
+ get subject(): ApiDataInterface | undefined {
35
+ return this._subject;
36
+ }
37
+
34
38
  rehydrate(data: JsonApiHydratedDataInterface): this {
35
39
  super.rehydrate(data);
36
40
 
@@ -39,7 +43,19 @@ export class Notification extends AbstractApiData implements NotificationInterfa
39
43
  this._message = data.jsonApi.attributes.message;
40
44
  this._actionUrl = data.jsonApi.attributes.actionUrl;
41
45
 
42
- this._actor = this._readIncluded(data, "actor", Modules.User) as UserInterface;
46
+ const rels = (data.jsonApi.relationships ?? {}) as Record<string, { data?: { type: string; id: string } }>;
47
+
48
+ const actorType = rels.actor?.data?.type;
49
+ this._actor = actorType
50
+ ? (this._readIncluded(data, "actor", Modules.findByName(actorType)) as ApiDataInterface)
51
+ : undefined;
52
+
53
+ const subjectName = Object.keys(rels).find((name) => name !== "actor" && rels[name]?.data?.type);
54
+ const subjectType = subjectName ? rels[subjectName]?.data?.type : undefined;
55
+ this._subject =
56
+ subjectName && subjectType
57
+ ? (this._readIncluded(data, subjectName, Modules.findByName(subjectType)) as ApiDataInterface)
58
+ : undefined;
43
59
 
44
60
  return this;
45
61
  }