@carlonicora/nextjs-jsonapi 1.7.6 → 1.8.1

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 (58) hide show
  1. package/dist/{BlockNoteEditor-CCOSI7TW.js → BlockNoteEditor-KSPPX6JO.js} +13 -13
  2. package/dist/{BlockNoteEditor-CCOSI7TW.js.map → BlockNoteEditor-KSPPX6JO.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-KH7WWHBK.mjs → BlockNoteEditor-N534QVBR.mjs} +3 -3
  4. package/dist/{chunk-3HL4VFJ4.js → chunk-7Z7FEMEB.js} +56 -36
  5. package/dist/chunk-7Z7FEMEB.js.map +1 -0
  6. package/dist/{chunk-KFON36OE.js → chunk-B426TLJC.js} +358 -358
  7. package/dist/{chunk-KFON36OE.js.map → chunk-B426TLJC.js.map} +1 -1
  8. package/dist/{chunk-2O7ODHTG.mjs → chunk-CK5KLBZV.mjs} +21 -1
  9. package/dist/chunk-CK5KLBZV.mjs.map +1 -0
  10. package/dist/{chunk-2TCBJO4B.mjs → chunk-TLBZWOCU.mjs} +3 -3
  11. package/dist/client/index.js +3 -3
  12. package/dist/client/index.mjs +2 -2
  13. package/dist/components/index.js +3 -3
  14. package/dist/components/index.mjs +2 -2
  15. package/dist/contexts/index.js +3 -3
  16. package/dist/contexts/index.mjs +2 -2
  17. package/dist/core/index.d.mts +10 -0
  18. package/dist/core/index.d.ts +10 -0
  19. package/dist/core/index.js +2 -2
  20. package/dist/core/index.mjs +1 -1
  21. package/dist/index.js +2 -2
  22. package/dist/index.mjs +1 -1
  23. package/dist/scripts/generate-web-module/templates/components/editor.template.js +118 -12
  24. package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
  25. package/dist/scripts/generate-web-module/templates/data/interface.template.js +15 -2
  26. package/dist/scripts/generate-web-module/templates/data/interface.template.js.map +1 -1
  27. package/dist/scripts/generate-web-module/templates/data/model.template.js +32 -4
  28. package/dist/scripts/generate-web-module/templates/data/model.template.js.map +1 -1
  29. package/dist/scripts/generate-web-module/transformers/i18n-generator.d.ts.map +1 -1
  30. package/dist/scripts/generate-web-module/transformers/i18n-generator.js +16 -3
  31. package/dist/scripts/generate-web-module/transformers/i18n-generator.js.map +1 -1
  32. package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts +5 -2
  33. package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts.map +1 -1
  34. package/dist/scripts/generate-web-module/transformers/relationship-resolver.js +17 -7
  35. package/dist/scripts/generate-web-module/transformers/relationship-resolver.js.map +1 -1
  36. package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts +1 -0
  37. package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts.map +1 -1
  38. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +6 -0
  39. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
  40. package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts.map +1 -1
  41. package/dist/scripts/generate-web-module/utils/i18n-updater.js +36 -13
  42. package/dist/scripts/generate-web-module/utils/i18n-updater.js.map +1 -1
  43. package/dist/server/index.js +3 -3
  44. package/dist/server/index.mjs +1 -1
  45. package/package.json +1 -1
  46. package/scripts/generate-web-module/templates/components/editor.template.ts +125 -13
  47. package/scripts/generate-web-module/templates/data/interface.template.ts +18 -2
  48. package/scripts/generate-web-module/templates/data/model.template.ts +40 -6
  49. package/scripts/generate-web-module/transformers/i18n-generator.ts +18 -3
  50. package/scripts/generate-web-module/transformers/relationship-resolver.ts +18 -7
  51. package/scripts/generate-web-module/types/json-schema.interface.ts +1 -0
  52. package/scripts/generate-web-module/types/template-data.interface.ts +9 -0
  53. package/scripts/generate-web-module/utils/i18n-updater.ts +42 -15
  54. package/src/core/abstracts/AbstractApiData.ts +34 -0
  55. package/dist/chunk-2O7ODHTG.mjs.map +0 -1
  56. package/dist/chunk-3HL4VFJ4.js.map +0 -1
  57. /package/dist/{BlockNoteEditor-KH7WWHBK.mjs.map → BlockNoteEditor-N534QVBR.mjs.map} +0 -0
  58. /package/dist/{chunk-2TCBJO4B.mjs.map → chunk-TLBZWOCU.mjs.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-3HL4VFJ4.js","../src/core/factories/RehydrationFactory.ts","../src/core/abstracts/AbstractApiData.ts","../src/core/abstracts/AbstractService.ts","../src/client/JsonApiClient.ts","../src/core/abstracts/ClientAbstractService.ts","../src/core/registry/ModuleRegistrar.ts","../src/core/registry/ModuleRegistry.ts","../src/core/endpoint/EndpointCreator.ts","../src/core/fields/FieldSelector.ts","../src/core/utils/rehydrate.ts","../src/utils/cn.ts","../src/utils/compose-refs.ts","../src/utils/use-mobile.tsx","../src/utils/date-formatter.ts","../src/utils/exists.ts","../src/utils/table-options.ts","../src/utils/schemas/user.object.schema.ts","../src/utils/schemas/entity.object.schema.ts","../src/utils/blocknote-diff.util.ts","../src/utils/blocknote-word-diff-renderer.util.ts","../src/utils/icons.tsx","../src/permissions/types.ts","../src/permissions/check.ts","../src/features/auth/data/auth.ts","../src/features/auth/config.ts","../src/features/auth/data/auth.service.ts","../src/features/auth/enums/AuthComponent.ts","../src/features/auth/auth.module.ts","../src/features/company/data/company.ts","../src/features/company/data/company.fields.ts","../src/features/company/data/company.service.ts","../src/features/company/company.module.ts","../src/features/content/data/content.ts","../src/features/content/data/content.fields.ts","../src/features/content/data/content.service.ts","../src/features/content/content.module.ts","../src/features/feature/data/feature.ts","../src/features/feature/data/feature.service.ts","../src/features/feature/feature.module.ts","../src/features/module/data/module.ts","../src/features/module/module.module.ts","../src/features/notification/data/notification.ts","../src/features/notification/data/notification.fields.ts","../src/features/notification/data/notification.service.ts","../src/features/notification/notification.module.ts","../src/features/push/data/push.ts","../src/features/push/data/push.service.ts","../src/features/push/push.module.ts","../src/features/role/data/role.ts","../src/features/role/data/role.fields.ts","../src/features/role/data/role.service.ts","../src/features/role/role.module.ts","../src/features/s3/data/s3.ts","../src/features/s3/s3.module.ts","../src/features/s3/data/s3.service.ts","../src/features/user/data/user.ts","../src/features/user/data/user.fields.ts","../src/features/user/data/user.service.ts","../src/features/user/user.module.ts","../src/features/user/author.module.ts"],"names":["includedData","HttpMethod","JsonApiGet","JsonApiPost","JsonApiDelete","ClientHttpMethod","globalErrorHandler","Action","AuthComponent","CompanyFields","ContentFields","NotificationFields","RoleFields","UserFields"],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACbO,IAAM,mBAAA,EAAN,MAAyB;AAAA,EALhC,OAKgC;AAAA,IAAA,qCAAA,IAAA,EAAA,oBAAA,CAAA;AAAA,EAAA;AAAA,EAC9B,OAAc,SAAA,CACZ,QAAA,EACA,IAAA,EACG;AACH,IAAA,MAAM,aAAA,EAAe,kCAAA,CAAkB,GAAA,CAAI,QAAQ,CAAA;AAEnD,IAAA,MAAM,SAAA,EAAW,IAAI,YAAA,CAAa,CAAA;AAClC,IAAA,OAAO,QAAA,CAAS,SAAA,CAAU,IAAI,CAAA;AAAA,EAChC;AAAA,EAEA,OAAc,aAAA,CACZ,QAAA,EACA,IAAA,EACK;AACL,IAAA,MAAM,aAAA,EAAe,kCAAA,CAAkB,GAAA,CAAI,QAAQ,CAAA;AAEnD,IAAA,MAAM,SAAA,EAAW,IAAA,CAAK,GAAA,CAAI,CAAC,IAAA,EAAA,GAAuC;AAChE,MAAA,MAAM,SAAA,EAAW,IAAI,YAAA,CAAa,CAAA;AAClC,MAAA,OAAO,QAAA,CAAS,SAAA,CAAU,IAAI,CAAA;AAAA,IAChC,CAAC,CAAA;AAED,IAAA,OAAO,QAAA;AAAA,EACT;AACF,CAAA;ADQA;AACA;AEjCO,IAAe,gBAAA,EAAf,MAA2D;AAAA,EALlE,OAKkE;AAAA,IAAA,qCAAA,IA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R,IAAA;AACH,EAAA;AAEkF,EAAA;AAC7D,IAAA;AACH,MAAA;AACd,MAAA;AACc,MAAA;AACI,MAAA;AACnB,IAAA;AACH,EAAA;AACF;A1DogGiC;AACA;A2DtvGP;AAEb,EAAA;AACH,EAAA;AACC,EAAA;AACG,EAAA;AACE,EAAA;AACH,IAAA;AACG,MAAA;AACiB,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACzB,MAAA;AACF,IAAA;AACF,EAAA;AAfsB;A3DuwGO;AACA;A4DzwGL;AAEf,EAAA;AACH,EAAA;AACC,EAAA;AACG,EAAA;AALc;A5DgxGK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-3HL4VFJ4.js","sourcesContent":[null,"import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class RehydrationFactory {\n public static rehydrate<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface,\n ): T {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass();\n return instance.rehydrate(data) as T;\n }\n\n public static rehydrateList<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface[],\n ): T[] {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const response = data.map((item: JsonApiHydratedDataInterface) => {\n const instance = new factoryClass();\n return instance.rehydrate(item) as T;\n });\n\n return response;\n }\n}\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\nimport { RehydrationFactory } from \"../factories/RehydrationFactory\";\n\nexport abstract class AbstractApiData implements ApiDataInterface {\n protected _jsonApi?: any;\n protected _included?: any[];\n\n protected _id?: string;\n protected _type?: string;\n protected _createdAt?: Date;\n protected _updatedAt?: Date;\n\n protected _self?: string;\n\n get type(): string {\n if (!this._type) throw new Error(\"Type is not set.\");\n return this._type;\n }\n\n get id(): string {\n if (!this._id) throw new Error(\"Id is not set.\");\n return this._id;\n }\n\n get self(): string | undefined {\n return this._self;\n }\n\n get createdAt(): Date {\n return this._createdAt ?? new Date();\n }\n\n get updatedAt(): Date {\n return this._updatedAt ?? new Date();\n }\n\n get included(): any[] {\n return this._included ?? [];\n }\n\n get jsonApi(): any {\n return this._jsonApi;\n }\n\n ingestJsonApi(_data: JsonApiHydratedDataInterface): void {}\n\n generateApiUrl(_params?: any): string {\n throw new Error(\"Method not implemented.\");\n }\n\n createJsonApi(_data?: any): any {\n throw new Error(\"Method not implemented.\");\n }\n\n protected _readIncluded<T extends ApiDataInterface>(\n data: JsonApiHydratedDataInterface,\n type: string,\n dataType: ApiRequestDataTypeInterface,\n ): T | T[] | undefined {\n if (\n data.included === undefined ||\n data.included.length === 0 ||\n data.jsonApi.relationships === undefined ||\n data.jsonApi.relationships[type] === undefined ||\n data.jsonApi.relationships[type].data === undefined\n ) {\n return undefined;\n }\n\n if (Array.isArray(data.jsonApi.relationships[type].data)) {\n const response: T[] = data.jsonApi.relationships[type].data.map((jsonApiData: any) => {\n const includedData = data.included.find(\n (includedData: any) => includedData.id === jsonApiData.id && includedData.type === jsonApiData.type,\n );\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n });\n\n return response.filter((item: T | undefined) => item !== undefined) as T[];\n }\n\n const includedData = data.included.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n\n if (includedData === undefined && data.allData !== undefined) {\n // Try to find in allData as a fallback\n const fallbackData = data.allData.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n if (fallbackData !== undefined) {\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: fallbackData,\n included: data.included,\n }) as T;\n }\n }\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n }\n\n dehydrate(): JsonApiHydratedDataInterface {\n return {\n jsonApi: this._jsonApi,\n included: this._included ?? [],\n };\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n this._jsonApi = data.jsonApi;\n this._included = data.included;\n\n this._type = this._jsonApi.type;\n this._id = this._jsonApi.id;\n this._createdAt = this._jsonApi.meta?.createdAt !== undefined ? new Date(this._jsonApi.meta.createdAt) : undefined;\n this._updatedAt = this._jsonApi.meta?.updatedAt !== undefined ? new Date(this._jsonApi.meta.updatedAt) : undefined;\n\n this._self = this._jsonApi.links?.self ?? undefined;\n\n return this;\n }\n}\n","import { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\n\nexport enum HttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PUT = \"PUT\",\n PATCH = \"PATCH\",\n DELETE = \"DELETE\",\n}\n\nexport interface NextRef {\n next?: string;\n}\n\nexport interface PreviousRef {\n previous?: string;\n}\n\nexport interface SelfRef {\n self?: string;\n}\n\nlet globalErrorHandler: ((status: number, message: string) => void) | null = null;\n\n/**\n * Set a global error handler for API errors (client-side only).\n * This handler will be called instead of throwing errors.\n */\nexport function setGlobalErrorHandler(handler: (status: number, message: string) => void) {\n globalErrorHandler = handler;\n}\n\n/**\n * Get the current global error handler.\n */\nexport function getGlobalErrorHandler(): ((status: number, message: string) => void) | null {\n return globalErrorHandler;\n}\n\n/**\n * Abstract base class for services that interact with the JSON:API.\n * Extend this class to create feature-specific services.\n */\nexport abstract class AbstractService {\n /**\n * Extract locale from client-side URL pathname\n * URL structure: /{locale}/route-path (e.g., /it/accounts)\n * Fallback chain: URL locale → navigator.language → \"en\"\n */\n private static getClientLocale(): string {\n if (typeof window === \"undefined\") {\n return \"en\"; // Server-side fallback\n }\n\n // Extract locale from URL pathname (first segment after leading slash)\n const pathSegments = window.location.pathname.split(\"/\").filter(Boolean);\n const urlLocale = pathSegments[0];\n\n // Validate against supported locales (currently only \"en\")\n const supportedLocales = [\"en\"];\n if (urlLocale && supportedLocales.includes(urlLocale)) {\n return urlLocale;\n }\n\n // Fallback to navigator language\n const navigatorLocale = navigator.language.split(\"-\")[0];\n if (navigatorLocale && supportedLocales.includes(navigatorLocale)) {\n return navigatorLocale;\n }\n\n // Final fallback\n return \"en\";\n }\n\n static async next<T>(params: {\n type: ApiRequestDataTypeInterface;\n endpoint: string;\n next?: NextRef;\n previous?: PreviousRef;\n self?: SelfRef;\n }): Promise<T> {\n return await this.callApi<T>({\n method: HttpMethod.GET,\n type: params.type,\n endpoint: params.endpoint,\n next: params.next,\n previous: params.previous,\n self: params.self,\n });\n }\n\n /**\n * Fetch the previous page of results.\n */\n static async previous<T>(params: {\n type: ApiRequestDataTypeInterface;\n endpoint: string;\n next?: NextRef;\n previous?: PreviousRef;\n self?: SelfRef;\n }): Promise<T> {\n return await this.callApi<T>({\n method: HttpMethod.GET,\n type: params.type,\n endpoint: params.endpoint,\n next: params.next,\n previous: params.previous,\n self: params.self,\n });\n }\n\n /**\n * Make an API call with automatic environment detection and error handling.\n */\n protected static async callApi<T>(params: {\n type: ApiRequestDataTypeInterface;\n method: HttpMethod;\n endpoint: string;\n companyId?: string;\n input?: any;\n overridesJsonApiCreation?: boolean;\n next?: NextRef;\n previous?: PreviousRef;\n self?: SelfRef;\n responseType?: ApiRequestDataTypeInterface;\n files?: { [key: string]: File | Blob } | File | Blob;\n }): Promise<T> {\n // Dynamic import to avoid bundling issues\n const { JsonApiGet, JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } =\n await import(\"../../unified/JsonApiRequest\");\n\n let apiResponse: ApiResponseInterface;\n\n // Get language based on environment\n let language = \"en\";\n if (typeof window === \"undefined\") {\n const { getLocale } = await import(\"next-intl/server\");\n language = (await getLocale()) ?? \"en\";\n } else {\n // Client-side: extract locale from URL pathname\n language = this.getClientLocale();\n }\n\n switch (params.method) {\n case HttpMethod.GET:\n apiResponse = await JsonApiGet({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n });\n break;\n case HttpMethod.POST:\n apiResponse = await JsonApiPost({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case HttpMethod.PUT:\n apiResponse = await JsonApiPut({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case HttpMethod.PATCH:\n apiResponse = await JsonApiPatch({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case HttpMethod.DELETE:\n apiResponse = await JsonApiDelete({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n responseType: params.responseType,\n });\n break;\n default:\n throw new Error(\"Method not found\");\n }\n\n if (!apiResponse.ok) {\n if (globalErrorHandler && typeof window !== \"undefined\") {\n globalErrorHandler(apiResponse.response, apiResponse.error);\n return undefined as any;\n } else {\n const error = new Error(`${apiResponse.response}:${apiResponse.error}`) as any;\n error.status = apiResponse.response;\n error.digest = `HTTP_${apiResponse.response}`;\n throw error;\n }\n }\n\n if (apiResponse.next && params.next) params.next.next = apiResponse.next;\n if (apiResponse.prev && params.previous) params.previous.previous = apiResponse.prev;\n if (apiResponse.self && params.self) params.self.self = apiResponse.self;\n\n return apiResponse.data as T;\n }\n\n /**\n * Get raw JSON:API response data without deserialization.\n */\n protected static async getRawData(params: {\n type: ApiRequestDataTypeInterface;\n method: HttpMethod;\n endpoint: string;\n companyId?: string;\n }): Promise<any> {\n const { JsonApiGet } = await import(\"../../unified/JsonApiRequest\");\n\n let language = \"en\";\n\n if (typeof window === \"undefined\") {\n const { getLocale } = await import(\"next-intl/server\");\n language = (await getLocale()) ?? \"en\";\n } else {\n // Client-side: extract locale from URL pathname\n language = this.getClientLocale();\n }\n\n const apiResponse: ApiResponseInterface = await JsonApiGet({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n });\n\n if (!apiResponse.ok) {\n if (globalErrorHandler && typeof window !== \"undefined\") {\n globalErrorHandler(apiResponse.response, apiResponse.error);\n return undefined as any;\n } else {\n const error = new Error(`${apiResponse.response}:${apiResponse.error}`) as any;\n error.status = apiResponse.response;\n error.digest = `HTTP_${apiResponse.response}`;\n throw error;\n }\n }\n\n return apiResponse.raw;\n }\n}\n","\"use client\";\n\nimport { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\nimport { directFetch } from \"./request\";\nimport { getClientToken } from \"./token\";\n\n// Config storage for client contexts\nlet _clientConfig: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n} | null = null;\n\n/**\n * Configure the JSON:API client for browser contexts.\n * Call this in your client-side initialization or use JsonApiProvider.\n */\nexport function configureClientJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _clientConfig = config;\n if (config.bootstrapper) {\n config.bootstrapper();\n }\n}\n\nexport function getClientApiUrl(): string {\n if (_clientConfig?.apiUrl) {\n return _clientConfig.apiUrl;\n }\n const envUrl = process.env.NEXT_PUBLIC_API_URL;\n if (!envUrl) {\n throw new Error(\n \"API URL not configured. Use configureClientJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\",\n );\n }\n return envUrl;\n}\n\nexport function getClientAppUrl(): string {\n if (_clientConfig?.appUrl) {\n return _clientConfig.appUrl;\n }\n const envUrl = process.env.NEXT_PUBLIC_ADDRESS;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureClientJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getClientTrackablePages(): ModuleWithPermissions[] {\n return _clientConfig?.trackablePages ?? [];\n}\n\nfunction runClientBootstrapper(): void {\n if (_clientConfig?.bootstrapper) {\n _clientConfig.bootstrapper();\n }\n}\n\nfunction buildClientUrl(endpoint: string): string {\n const apiUrl = getClientApiUrl();\n return endpoint.startsWith(\"http\") ? endpoint : `${apiUrl}${endpoint}`;\n}\n\nexport async function ClientJsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n}): Promise<ApiResponseInterface> {\n runClientBootstrapper();\n const token = await getClientToken();\n\n const apiResponse = await directFetch({\n method: \"GET\",\n url: buildClientUrl(params.endpoint),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _clientConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n paginationHandler: async (endpoint: string) =>\n ClientJsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n }),\n });\n}\n\nexport async function ClientJsonApiPost(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n overridesJsonApiCreation?: boolean;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n}): Promise<ApiResponseInterface> {\n runClientBootstrapper();\n const token = await getClientToken();\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await directFetch({\n method: \"POST\",\n url: buildClientUrl(params.endpoint),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _clientConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function ClientJsonApiPut(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n}): Promise<ApiResponseInterface> {\n runClientBootstrapper();\n const token = await getClientToken();\n\n let body = params.body;\n if (!body) {\n body = {};\n } else {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await directFetch({\n method: \"PUT\",\n url: buildClientUrl(params.endpoint),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _clientConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function ClientJsonApiPatch(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n overridesJsonApiCreation?: boolean;\n responseType?: ApiRequestDataTypeInterface;\n language: string;\n}): Promise<ApiResponseInterface> {\n runClientBootstrapper();\n const token = await getClientToken();\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await directFetch({\n method: \"PATCH\",\n url: buildClientUrl(params.endpoint),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _clientConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function ClientJsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n}): Promise<ApiResponseInterface> {\n runClientBootstrapper();\n const token = await getClientToken();\n\n const apiResponse = await directFetch({\n method: \"DELETE\",\n url: buildClientUrl(params.endpoint),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _clientConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n","\"use client\";\n\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport {\n ClientJsonApiGet,\n ClientJsonApiPost,\n ClientJsonApiPut,\n ClientJsonApiPatch,\n ClientJsonApiDelete,\n} from \"../../client/JsonApiClient\";\n// Duplicated to avoid importing from AbstractService which pulls in server code\n// These are exported so client services can import them from here instead of core\nexport enum ClientHttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PUT = \"PUT\",\n PATCH = \"PATCH\",\n DELETE = \"DELETE\",\n}\n\nexport interface ClientNextRef {\n next?: string;\n}\n\nexport interface ClientPreviousRef {\n previous?: string;\n}\n\nexport interface ClientSelfRef {\n self?: string;\n}\n\nlet globalErrorHandler: ((status: number, message: string) => void) | null = null;\n\n/**\n * Set a global error handler for API errors (client-side only).\n * This handler will be called instead of throwing errors.\n */\nexport function setClientGlobalErrorHandler(handler: (status: number, message: string) => void) {\n globalErrorHandler = handler;\n}\n\n/**\n * Get the current global error handler.\n */\nexport function getClientGlobalErrorHandler(): ((status: number, message: string) => void) | null {\n return globalErrorHandler;\n}\n\n/**\n * Client-side abstract base class for services that interact with the JSON:API.\n * Use this for client components.\n */\nexport abstract class ClientAbstractService {\n /**\n * Extract locale from client-side URL pathname\n * URL structure: /{locale}/route-path (e.g., /it/accounts)\n * Fallback chain: URL locale → navigator.language → \"en\"\n */\n private static getClientLocale(): string {\n if (typeof window === \"undefined\") {\n return \"en\"; // Should not happen in client service\n }\n\n // Extract locale from URL pathname (first segment after leading slash)\n const pathSegments = window.location.pathname.split(\"/\").filter(Boolean);\n const urlLocale = pathSegments[0];\n\n // Validate against supported locales (currently only \"en\")\n const supportedLocales = [\"en\"];\n if (urlLocale && supportedLocales.includes(urlLocale)) {\n return urlLocale;\n }\n\n // Fallback to navigator language\n const navigatorLocale = navigator.language.split(\"-\")[0];\n if (navigatorLocale && supportedLocales.includes(navigatorLocale)) {\n return navigatorLocale;\n }\n\n // Final fallback\n return \"en\";\n }\n\n /**\n * Fetch the next page of results.\n */\n static async next<T>(params: {\n type: ApiRequestDataTypeInterface;\n endpoint: string;\n next?: ClientNextRef;\n previous?: ClientPreviousRef;\n self?: ClientSelfRef;\n }): Promise<T> {\n return await this.callApi<T>({\n method: ClientHttpMethod.GET,\n type: params.type,\n endpoint: params.endpoint,\n next: params.next,\n previous: params.previous,\n self: params.self,\n });\n }\n\n /**\n * Fetch the previous page of results.\n */\n static async previous<T>(params: {\n type: ApiRequestDataTypeInterface;\n endpoint: string;\n next?: ClientNextRef;\n previous?: ClientPreviousRef;\n self?: ClientSelfRef;\n }): Promise<T> {\n return await this.callApi<T>({\n method: ClientHttpMethod.GET,\n type: params.type,\n endpoint: params.endpoint,\n next: params.next,\n previous: params.previous,\n self: params.self,\n });\n }\n\n /**\n * Make a client-side API call.\n */\n protected static async callApi<T>(params: {\n type: ApiRequestDataTypeInterface;\n method: ClientHttpMethod;\n endpoint: string;\n companyId?: string;\n input?: any;\n overridesJsonApiCreation?: boolean;\n next?: ClientNextRef;\n previous?: ClientPreviousRef;\n self?: ClientSelfRef;\n responseType?: ApiRequestDataTypeInterface;\n files?: { [key: string]: File | Blob } | File | Blob;\n }): Promise<T> {\n let apiResponse: ApiResponseInterface;\n\n // Client-side: extract locale from URL pathname\n const language = this.getClientLocale();\n\n switch (params.method) {\n case ClientHttpMethod.GET:\n apiResponse = await ClientJsonApiGet({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n });\n break;\n case ClientHttpMethod.POST:\n apiResponse = await ClientJsonApiPost({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case ClientHttpMethod.PUT:\n apiResponse = await ClientJsonApiPut({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case ClientHttpMethod.PATCH:\n apiResponse = await ClientJsonApiPatch({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.input,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n language: language,\n responseType: params.responseType,\n files: params.files,\n });\n break;\n case ClientHttpMethod.DELETE:\n apiResponse = await ClientJsonApiDelete({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n responseType: params.responseType,\n });\n break;\n default:\n throw new Error(\"Method not found\");\n }\n\n if (!apiResponse.ok) {\n if (globalErrorHandler) {\n globalErrorHandler(apiResponse.response, apiResponse.error);\n return undefined as any;\n } else {\n const error = new Error(`${apiResponse.response}:${apiResponse.error}`) as any;\n error.status = apiResponse.response;\n error.digest = `HTTP_${apiResponse.response}`;\n throw error;\n }\n }\n\n if (apiResponse.next && params.next) params.next.next = apiResponse.next;\n if (apiResponse.prev && params.previous) params.previous.previous = apiResponse.prev;\n if (apiResponse.self && params.self) params.self.self = apiResponse.self;\n\n return apiResponse.data as T;\n }\n\n /**\n * Get raw JSON:API response data without deserialization.\n */\n protected static async getRawData(params: {\n type: ApiRequestDataTypeInterface;\n method: ClientHttpMethod;\n endpoint: string;\n companyId?: string;\n }): Promise<any> {\n const language = this.getClientLocale();\n\n const apiResponse: ApiResponseInterface = await ClientJsonApiGet({\n classKey: params.type,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language: language,\n });\n\n if (!apiResponse.ok) {\n if (globalErrorHandler) {\n globalErrorHandler(apiResponse.response, apiResponse.error);\n return undefined as any;\n } else {\n const error = new Error(`${apiResponse.response}:${apiResponse.error}`) as any;\n error.status = apiResponse.response;\n error.digest = `HTTP_${apiResponse.response}`;\n throw error;\n }\n }\n\n return apiResponse.raw;\n }\n}\n","import { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"./DataClassRegistry\";\n\n/**\n * Helper class to bootstrap the registry from a Modules-style class.\n * This supports the pattern where modules are defined as static getters.\n */\nexport class ModuleRegistrar {\n private static _isBootstrapped = false;\n\n /**\n * Bootstrap the registry from a Modules class.\n * Automatically detects static getters and registers their models.\n *\n * @param modulesClass - The Modules class with static getters\n */\n static bootstrap<T extends object>(modulesClass: T): void {\n if (this._isBootstrapped) return;\n\n const data = Object.getOwnPropertyNames(modulesClass)\n .filter((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(modulesClass, key);\n return descriptor && typeof descriptor.get === \"function\";\n })\n .map((key) => (modulesClass as any)[key] as ApiRequestDataTypeInterface);\n\n data.forEach((item) => {\n if (item && item.model) {\n DataClassRegistry.registerObjectClass(item, item.model);\n }\n });\n\n this._isBootstrapped = true;\n }\n\n /**\n * Reset the bootstrapped state. Useful for testing.\n */\n static reset(): void {\n this._isBootstrapped = false;\n DataClassRegistry.clear();\n }\n}\n","import { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ModuleWithPermissions } from \"../../permissions/types\";\n\n// Foundation module types - defined by LIBRARY\nexport interface FoundationModuleDefinitions {\n S3: ModuleWithPermissions;\n Auth: ModuleWithPermissions;\n User: ModuleWithPermissions;\n Author: ModuleWithPermissions;\n Company: ModuleWithPermissions;\n Role: ModuleWithPermissions;\n Notification: ModuleWithPermissions;\n Push: ModuleWithPermissions;\n Feature: ModuleWithPermissions;\n Module: ModuleWithPermissions;\n Content: ModuleWithPermissions;\n UserTopic: ModuleWithPermissions;\n UserExpertise: ModuleWithPermissions;\n}\n\n// App-specific modules - apps will augment this interface ONLY\n\nexport interface AppModuleDefinitions {}\n\n// Combined type for full autocompletion\nexport type ModuleDefinitions = FoundationModuleDefinitions & AppModuleDefinitions;\n\nclass ModuleRegistryClass {\n private _modules: Map<string, ApiRequestDataTypeInterface> = new Map();\n\n register<K extends string>(name: K, module: ApiRequestDataTypeInterface): void {\n this._modules.set(name, module);\n }\n\n get<K extends keyof ModuleDefinitions>(name: K): ModuleDefinitions[K] {\n const module = this._modules.get(name as string);\n if (!module) {\n throw new Error(`Module \"${String(name)}\" not registered. Call bootstrap() first.`);\n }\n return module as ModuleDefinitions[K];\n }\n\n findByName(moduleName: string): ModuleWithPermissions {\n // Search by module's name property (e.g., \"topics\", \"articles\")\n for (const module of this._modules.values()) {\n if ((module as ModuleWithPermissions).name === moduleName) {\n return module as ModuleWithPermissions;\n }\n }\n throw new Error(`Module not found: ${moduleName}`);\n }\n\n findByModelName(modelName: string): ModuleWithPermissions {\n // Direct lookup by registry key (e.g., \"Article\", \"Document\")\n const module = this._modules.get(modelName);\n if (!module) {\n throw new Error(`Module not found for model: ${modelName}`);\n }\n return module as ModuleWithPermissions;\n }\n}\n\nexport const ModuleRegistry = new ModuleRegistryClass();\n\n// Proxy object for Modules.X syntax with autocompletion\nexport const Modules = new Proxy({} as ModuleDefinitions, {\n get(_, prop: string) {\n if (prop === \"findByName\") {\n return (name: string) => ModuleRegistry.findByName(name);\n }\n if (prop === \"findByModelName\") {\n return (name: string) => ModuleRegistry.findByModelName(name);\n }\n return ModuleRegistry.get(prop as keyof ModuleDefinitions);\n },\n}) as ModuleDefinitions & {\n findByName: (name: string) => ModuleWithPermissions;\n findByModelName: (name: string) => ModuleWithPermissions;\n};\n","import { FieldSelector } from \"../fields/FieldSelector\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport type EndpointQuery = {\n endpoint: ApiRequestDataTypeInterface;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string | string[] }[];\n};\n\nexport class EndpointCreator {\n private _endpoint: EndpointQuery;\n\n constructor(params: {\n endpoint: ApiRequestDataTypeInterface;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string }[];\n }) {\n this._endpoint = {\n endpoint: params.endpoint,\n id: params.id,\n childEndpoint: params.childEndpoint,\n childId: params.childId,\n additionalParams: params.additionalParams ?? [],\n };\n }\n\n endpoint(value: ApiRequestDataTypeInterface): EndpointCreator {\n this._endpoint.endpoint = value;\n return this;\n }\n\n id(value: string): EndpointCreator {\n this._endpoint.id = value;\n return this;\n }\n\n childEndpoint(value: ApiRequestDataTypeInterface | string): EndpointCreator {\n this._endpoint.childEndpoint = value;\n return this;\n }\n\n childId(value: string): EndpointCreator {\n this._endpoint.childId = value;\n return this;\n }\n\n set additionalParams(value: { key: string; value: string }[]) {\n this._endpoint.additionalParams = value;\n }\n\n addAdditionalParam(key: string, value: string | string[]): EndpointCreator {\n if (!this._endpoint.additionalParams) this._endpoint.additionalParams = [];\n this._endpoint.additionalParams.push({ key, value });\n return this;\n }\n\n limitToType(selectors: string[]): this {\n this.addAdditionalParam(`include`, selectors.join(\",\"));\n return this;\n }\n\n limitToFields(selectors: FieldSelector<any>[]): this {\n if (selectors.length === 0) return this;\n\n selectors.forEach((selector) => {\n const fieldString = selector.fields.join(\",\");\n this.addAdditionalParam(`fields[${selector.type}]`, fieldString);\n });\n\n return this;\n }\n\n generate(): string {\n let additionalParams = \"\";\n if (this._endpoint.additionalParams) {\n additionalParams = this._endpoint.additionalParams.map((param) => `${param.key}=${param.value}`).join(\"&\");\n }\n\n let response = `${this._endpoint.endpoint.name}`;\n if (this._endpoint.id) response += `/${this._endpoint.id}`;\n if (this._endpoint.childEndpoint) {\n response += `/${\n typeof this._endpoint.childEndpoint === \"string\"\n ? this._endpoint.childEndpoint\n : this._endpoint.childEndpoint.name\n }`;\n }\n if (this._endpoint.childId) response += `/${this._endpoint.childId}`;\n if (additionalParams) response += `?${additionalParams}`;\n\n return response;\n }\n}\n","export type GetterKeys<T> = {\n [K in keyof T]: T[K] extends () => any ? never : K;\n}[keyof T];\n\nexport type FieldSelector<T> = {\n type: string;\n fields: ReadonlyArray<GetterKeys<T>>;\n};\n\nexport function createJsonApiInclusion<T>(dataType: string, fields: ReadonlyArray<GetterKeys<T>>): FieldSelector<T> {\n return {\n type: dataType,\n fields,\n };\n}\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\nimport { RehydrationFactory } from \"../factories/RehydrationFactory\";\n\n/**\n * Rehydrate a single dehydrated object back into its typed class instance.\n */\nexport function rehydrate<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface,\n): T {\n return RehydrationFactory.rehydrate(classKey, data) as T;\n}\n\n/**\n * Rehydrate a list of dehydrated objects back into typed class instances.\n */\nexport function rehydrateList<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface[],\n): T[] {\n return RehydrationFactory.rehydrateList(classKey, data) as T[];\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n\n if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n","\"use client\";\n\nimport * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n","type FormatOption = \"date\" | \"time\" | \"dateTime\" | \"timeSince\" | \"default\";\n\nexport const formatDate = (eventDate: Date, formatOption: FormatOption, locale: string = \"en-GB\"): string => {\n const formatPart = (date: Date, options: Intl.DateTimeFormatOptions): string =>\n new Intl.DateTimeFormat(locale, options).format(date);\n\n const now = new Date();\n const diff = now.getTime() - eventDate.getTime();\n\n if (formatOption === \"default\") {\n if (diff < 24 * 60 * 60 * 1000) formatOption = \"timeSince\";\n else formatOption = \"dateTime\";\n }\n\n if (formatOption === \"timeSince\") {\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n\n if (days > 0) return `${days} days ago`;\n if (hours > 0) return `${hours} hours ago`;\n if (minutes > 0) return `${minutes} minutes ago`;\n return `${seconds} seconds ago`;\n }\n\n // Define formatting options\n const dateOptions: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n };\n const timeOptions: Intl.DateTimeFormatOptions = {\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n // Format based on the option\n switch (formatOption) {\n case \"date\":\n return formatPart(eventDate, dateOptions);\n case \"time\":\n return formatPart(eventDate, timeOptions);\n case \"dateTime\":\n return `${formatPart(eventDate, dateOptions)} ${formatPart(eventDate, timeOptions)}`;\n default:\n throw new Error(\"Invalid format option\");\n }\n};\n\nexport type { FormatOption };\n","export const exists = <T>(itemOrArray: T | T[] | null | undefined): boolean => {\n if (!itemOrArray) return false;\n if (Array.isArray(itemOrArray)) {\n return itemOrArray.length > 0;\n }\n return true;\n};\n","import { Action, ModuleWithPermissions } from \"../permissions\";\nimport { cloneElement, createElement, Fragment, ReactElement } from \"react\";\n\nexport class TableOptions {\n private _components: ReactElement<any>[];\n private _hasPermissionToModule: <M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }) => boolean;\n\n constructor(\n hasPermissionToModule: <M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }) => boolean,\n ) {\n this._hasPermissionToModule = hasPermissionToModule;\n this._components = [];\n }\n\n addOption<M extends ModuleWithPermissions>(component: ReactElement<any> | null, module?: M, action?: Action): void {\n if (!component || (module && action && !this._hasPermissionToModule({ module, action }))) return;\n this._components.push(component);\n }\n\n getComponents(): ReactElement<any>[] {\n return this._components;\n }\n\n getOptions(): ReactElement<any> | null {\n if (this._components.length === 0) return null;\n\n const response: ReactElement<any>[] = this._components.map((option, index) =>\n cloneElement(option, { key: option.key ?? index }),\n );\n\n return createElement(Fragment, {}, response);\n }\n}\n\nexport function getTableOptions(params: {\n hasPermissionToModule: <M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }) => boolean;\n options: { component: ReactElement<any> | null; module?: ModuleWithPermissions; action?: Action }[];\n}): ReactElement<any> | null {\n const tableOptions = new TableOptions(params.hasPermissionToModule);\n params.options.forEach((option) => tableOptions.addOption(option.component, option.module, option.action));\n return tableOptions.getOptions();\n}\n\nexport function getTableComponents(params: {\n hasPermissionToModule: <M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }) => boolean;\n options: { component: ReactElement<any> | null; module?: ModuleWithPermissions; action?: Action }[];\n}): ReactElement<any>[] {\n const tableOptions = new TableOptions(params.hasPermissionToModule);\n params.options.forEach((option) => tableOptions.addOption(option.component, option.module, option.action));\n return tableOptions.getComponents();\n}\n","import { z } from \"zod\";\n\nexport const userObjectSchema = z.object({\n id: z.string(),\n name: z.string(),\n avatar: z.string().optional(),\n});\n\nexport type UserObject = z.infer<typeof userObjectSchema>;\n","import { z } from \"zod\";\n\nexport const entityObjectSchema = z.object({\n id: z.uuidv4(),\n name: z.string(),\n});\n\nexport type EntityObject = z.infer<typeof entityObjectSchema>;\n","import { PartialBlock } from \"@blocknote/core\";\n\nexport interface WordDiff {\n type: \"added\" | \"removed\" | \"unchanged\";\n text: string;\n diffId: string;\n accepted?: boolean;\n rejected?: boolean;\n}\n\nexport interface DiffBlock {\n id?: string;\n type?: string;\n props?: any;\n content?: any;\n children?: DiffBlock[];\n diffType?: \"added\" | \"removed\" | \"modified\" | \"unchanged\";\n originalContent?: any;\n diffId?: string;\n wordDiffs?: WordDiff[];\n accepted?: boolean;\n rejected?: boolean;\n}\n\nexport interface DiffResult {\n blocks: DiffBlock[];\n hasChanges: boolean;\n}\n\nexport interface BlockDiffOptions {\n ignoreIds?: boolean;\n compareContent?: boolean;\n similarityThreshold?: number;\n}\n\n/**\n * BlockNote Diff Utility\n * Implements a sophisticated diff algorithm for BlockNote document structures\n */\nexport class BlockNoteDiffUtil {\n private static readonly DEFAULT_OPTIONS: BlockDiffOptions = {\n ignoreIds: false,\n compareContent: true,\n similarityThreshold: 0.8,\n };\n\n /**\n * Compare two BlockNote documents and return diff result\n */\n static diff(\n originalBlocks: PartialBlock[] = [],\n newBlocks: PartialBlock[] = [],\n options: BlockDiffOptions = {},\n ): DiffResult {\n const opts = { ...this.DEFAULT_OPTIONS, ...options };\n\n // Create a map for efficient lookups\n const originalMap = new Map<string, PartialBlock>();\n const newMap = new Map<string, PartialBlock>();\n\n // Build maps based on block IDs\n originalBlocks.forEach((block) => {\n if (block.id) {\n originalMap.set(block.id, block);\n }\n });\n\n newBlocks.forEach((block) => {\n if (block.id) {\n newMap.set(block.id, block);\n }\n });\n\n const diffBlocks: DiffBlock[] = [];\n const processedNewIds = new Set<string>();\n\n // Process original blocks to find removed and modified blocks\n for (const originalBlock of originalBlocks) {\n const blockId = originalBlock.id;\n\n // Generate ID if missing\n const processId = blockId || crypto.randomUUID();\n const newBlock = blockId ? newMap.get(blockId) : null;\n\n if (!newBlock) {\n // Block was removed\n const removedBlock: DiffBlock = {\n ...originalBlock,\n id: processId,\n diffType: \"removed\",\n diffId: `removed-${processId}`,\n };\n diffBlocks.push(removedBlock);\n } else {\n // Block exists in both, check for modifications\n if (blockId) {\n processedNewIds.add(blockId);\n }\n\n if (this.areBlocksEqual(originalBlock, newBlock, opts)) {\n // Block is unchanged\n const unchangedBlock: DiffBlock = {\n ...newBlock,\n diffType: \"unchanged\",\n };\n diffBlocks.push(unchangedBlock);\n } else {\n // Block was modified - perform word-level diff\n const wordDiffs = this.generateWordDiffs(originalBlock.content, newBlock.content, processId);\n const modifiedBlock: DiffBlock = {\n ...newBlock,\n diffType: \"modified\",\n originalContent: originalBlock.content as any,\n diffId: `modified-${processId}`,\n wordDiffs: wordDiffs,\n };\n diffBlocks.push(modifiedBlock);\n }\n }\n }\n\n // Process new blocks to find added blocks\n for (const newBlock of newBlocks) {\n const blockId = newBlock.id;\n\n // Skip if block was already processed (has ID and was found in original)\n if (blockId && processedNewIds.has(blockId)) continue;\n\n // This is a new block (either no ID or ID not found in original)\n const generatedId = blockId || crypto.randomUUID();\n const addedBlock: DiffBlock = {\n ...newBlock,\n id: generatedId,\n diffType: \"added\",\n diffId: `added-${generatedId}`,\n };\n diffBlocks.push(addedBlock);\n }\n\n // Sort blocks to maintain original order as much as possible\n const sortedDiffBlocks = this.sortDiffBlocks(diffBlocks, originalBlocks, newBlocks);\n\n return {\n blocks: sortedDiffBlocks,\n hasChanges: sortedDiffBlocks.some((block) => block.diffType !== \"unchanged\"),\n };\n }\n\n /**\n * Compare two blocks for equality\n */\n private static areBlocksEqual(block1: PartialBlock, block2: PartialBlock, options: BlockDiffOptions): boolean {\n // Compare block type\n if (block1.type !== block2.type) {\n return false;\n }\n\n // Compare props (excluding diffType specific props)\n if (!this.deepEqual(block1.props, block2.props)) {\n return false;\n }\n\n // Compare content if enabled\n if (options.compareContent) {\n if (!this.deepEqual(block1.content, block2.content)) {\n return false;\n }\n }\n\n // Compare children recursively\n const children1 = block1.children || [];\n const children2 = block2.children || [];\n\n if (children1.length !== children2.length) {\n return false;\n }\n\n for (let i = 0; i < children1.length; i++) {\n if (!this.areBlocksEqual(children1[i], children2[i], options)) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Deep equality comparison for objects\n */\n private static deepEqual(obj1: any, obj2: any): boolean {\n if (obj1 === obj2) return true;\n\n if (obj1 == null || obj2 == null) return obj1 === obj2;\n\n if (typeof obj1 !== typeof obj2) return false;\n\n if (typeof obj1 !== \"object\") return obj1 === obj2;\n\n if (Array.isArray(obj1) !== Array.isArray(obj2)) return false;\n\n if (Array.isArray(obj1)) {\n if (obj1.length !== obj2.length) return false;\n for (let i = 0; i < obj1.length; i++) {\n if (!this.deepEqual(obj1[i], obj2[i])) return false;\n }\n return true;\n }\n\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n if (keys1.length !== keys2.length) return false;\n\n for (const key of keys1) {\n if (!keys2.includes(key)) return false;\n if (!this.deepEqual(obj1[key], obj2[key])) return false;\n }\n\n return true;\n }\n\n /**\n * Sort diff blocks to maintain logical order\n */\n private static sortDiffBlocks(\n diffBlocks: DiffBlock[],\n originalBlocks: PartialBlock[],\n newBlocks: PartialBlock[],\n ): DiffBlock[] {\n // Create position maps\n const originalPositions = new Map<string, number>();\n const newPositions = new Map<string, number>();\n\n originalBlocks.forEach((block, index) => {\n if (block.id) {\n originalPositions.set(block.id, index);\n }\n });\n\n newBlocks.forEach((block, index) => {\n if (block.id) {\n newPositions.set(block.id, index);\n }\n });\n\n return diffBlocks.sort((a, b) => {\n const aId = a.id;\n const bId = b.id;\n\n if (!aId || !bId) return 0;\n\n // Prioritize by new positions, fallback to original positions\n const aPos = newPositions.get(aId) ?? originalPositions.get(aId) ?? Infinity;\n const bPos = newPositions.get(bId) ?? originalPositions.get(bId) ?? Infinity;\n\n return aPos - bPos;\n });\n }\n\n /**\n * Calculate similarity between two text contents\n */\n private static calculateSimilarity(content1: any[], content2: any[]): number {\n if (!content1 || !content2) return 0;\n\n const text1 = this.extractTextFromContent(content1);\n const text2 = this.extractTextFromContent(content2);\n\n if (text1 === text2) return 1;\n if (!text1 || !text2) return 0;\n\n // Simple Levenshtein distance-based similarity\n const maxLength = Math.max(text1.length, text2.length);\n const distance = this.levenshteinDistance(text1, text2);\n\n return 1 - distance / maxLength;\n }\n\n /**\n * Extract plain text from BlockNote content array\n */\n private static extractTextFromContent(content: any[]): string {\n if (!Array.isArray(content)) return \"\";\n\n return content\n .map((item) => {\n if (item.type === \"text\") {\n return item.text || \"\";\n }\n return \"\";\n })\n .join(\"\");\n }\n\n /**\n * Calculate Levenshtein distance between two strings\n */\n private static levenshteinDistance(str1: string, str2: string): number {\n const matrix = Array(str2.length + 1)\n .fill(null)\n .map(() => Array(str1.length + 1).fill(null));\n\n for (let i = 0; i <= str1.length; i++) {\n matrix[0][i] = i;\n }\n\n for (let j = 0; j <= str2.length; j++) {\n matrix[j][0] = j;\n }\n\n for (let j = 1; j <= str2.length; j++) {\n for (let i = 1; i <= str1.length; i++) {\n const substitutionCost = str1[i - 1] === str2[j - 1] ? 0 : 1;\n matrix[j][i] = Math.min(\n matrix[j][i - 1] + 1, // deletion\n matrix[j - 1][i] + 1, // insertion\n matrix[j - 1][i - 1] + substitutionCost, // substitution\n );\n }\n }\n\n return matrix[str2.length][str1.length];\n }\n\n /**\n * Generate word-level diffs between two content arrays\n */\n static generateWordDiffs(originalContent: any, newContent: any, blockId: string): WordDiff[] {\n const originalText = this.extractTextFromContent(originalContent || []);\n const newText = this.extractTextFromContent(newContent || []);\n\n if (!originalText && !newText) return [];\n if (!originalText) {\n return newText\n .split(/\\s+/)\n .filter((word) => word.trim())\n .map((word, index) => ({\n type: \"added\" as const,\n text: word,\n diffId: `${blockId}-add-${index}`,\n accepted: false,\n rejected: false,\n }));\n }\n if (!newText) {\n return originalText\n .split(/\\s+/)\n .filter((word) => word.trim())\n .map((word, index) => ({\n type: \"removed\" as const,\n text: word,\n diffId: `${blockId}-remove-${index}`,\n accepted: false,\n rejected: false,\n }));\n }\n\n return this.diffWords(originalText, newText, blockId);\n }\n\n /**\n * Perform word-level diff using word-only approach (no space tokenization)\n */\n private static diffWords(text1: string, text2: string, blockId: string): WordDiff[] {\n const words1 = text1.split(/\\s+/).filter((word) => word.length > 0);\n const words2 = text2.split(/\\s+/).filter((word) => word.length > 0);\n\n const diffs = this.myersDiff(words1, words2);\n\n // Consolidate adjacent changes to reduce fragmentation\n const consolidatedDiffs = this.consolidateAdjacentChanges(diffs);\n\n const result: WordDiff[] = [];\n let diffIndex = 0;\n\n for (let i = 0; i < consolidatedDiffs.length; i++) {\n const diff = consolidatedDiffs[i];\n const isLastDiff = i === consolidatedDiffs.length - 1;\n\n switch (diff.type) {\n case \"equal\":\n result.push({\n type: \"unchanged\",\n text: diff.value,\n diffId: `${blockId}-unchanged-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n\n // Add space after word if not the last diff\n if (!isLastDiff) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n break;\n\n case \"delete\":\n // Check if this is a consolidated change or regular change\n if ((diff as any).consolidated) {\n // This is a consolidated deletion - check if next is consolidated insertion\n const nextDiff = i + 1 < consolidatedDiffs.length ? consolidatedDiffs[i + 1] : null;\n const isConsolidatedReplacement = nextDiff && nextDiff.type === \"insert\" && (nextDiff as any).consolidated;\n\n if (isConsolidatedReplacement) {\n // Use single shared diff ID for the entire consolidated change\n const replacementId = `${blockId}-replace-${diffIndex++}`;\n\n // Add the removed text\n result.push({\n type: \"removed\",\n text: diff.value,\n diffId: replacementId,\n accepted: false,\n rejected: false,\n });\n\n // Add the new text with same diff ID\n result.push({\n type: \"added\",\n text: nextDiff.value,\n diffId: replacementId,\n accepted: false,\n rejected: false,\n });\n\n // Skip the next insert since we handled it\n i++;\n\n // Add space after replacement if not the last\n if (i < consolidatedDiffs.length - 1) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n } else {\n // Consolidated deletion without replacement\n result.push({\n type: \"removed\",\n text: diff.value,\n diffId: `${blockId}-remove-${diffIndex++}`,\n accepted: false,\n rejected: false,\n });\n\n // Add space after deletion if not the last\n if (!isLastDiff) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n }\n } else {\n // Regular single-word processing\n const nextDiff = i + 1 < consolidatedDiffs.length ? consolidatedDiffs[i + 1] : null;\n const isReplacement =\n nextDiff && nextDiff.type === \"insert\" && this.areWordsSimilar(diff.value, nextDiff.value);\n\n if (isReplacement) {\n // Use single shared diff ID for both operations\n const replacementId = `${blockId}-replace-${diffIndex++}`;\n\n // Add the removed word\n result.push({\n type: \"removed\",\n text: diff.value,\n diffId: replacementId,\n accepted: false,\n rejected: false,\n });\n\n // Add the new word with same diff ID (no space between them)\n result.push({\n type: \"added\",\n text: nextDiff.value,\n diffId: replacementId,\n accepted: false,\n rejected: false,\n });\n\n // Skip the next insert since we handled it\n i++;\n\n // Add space after replacement if not the last\n if (i < consolidatedDiffs.length - 1) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n } else {\n // Regular deletion\n result.push({\n type: \"removed\",\n text: diff.value,\n diffId: `${blockId}-remove-${diffIndex++}`,\n accepted: false,\n rejected: false,\n });\n\n // Add space after deletion if not the last\n if (!isLastDiff) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n }\n }\n break;\n\n case \"insert\":\n // Only handle if not already processed as part of replacement or consolidation\n if ((diff as any).consolidated) {\n // This should have been handled in the delete case above\n const prevDiff = i > 0 ? consolidatedDiffs[i - 1] : null;\n const wasProcessedAsConsolidatedReplacement =\n prevDiff && prevDiff.type === \"delete\" && (prevDiff as any).consolidated;\n\n if (!wasProcessedAsConsolidatedReplacement) {\n // Standalone consolidated insertion\n result.push({\n type: \"added\",\n text: diff.value,\n diffId: `${blockId}-add-${diffIndex++}`,\n accepted: false,\n rejected: false,\n });\n\n // Add space after insertion if not the last\n if (!isLastDiff) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n }\n } else {\n // Regular single-word processing\n const prevDiff = i > 0 ? consolidatedDiffs[i - 1] : null;\n const wasProcessedAsReplacement =\n prevDiff && prevDiff.type === \"delete\" && this.areWordsSimilar(prevDiff.value, diff.value);\n\n if (!wasProcessedAsReplacement) {\n result.push({\n type: \"added\",\n text: diff.value,\n diffId: `${blockId}-add-${diffIndex++}`,\n accepted: false,\n rejected: false,\n });\n\n // Add space after insertion if not the last\n if (!isLastDiff) {\n result.push({\n type: \"unchanged\",\n text: \" \",\n diffId: `${blockId}-space-${diffIndex++}`,\n accepted: true,\n rejected: false,\n });\n }\n }\n }\n break;\n }\n }\n\n return result;\n } /**\n * Improved diff algorithm that better handles word insertions\n * Uses a combination of LCS and heuristics to minimize false changes\n */\n private static myersDiff(a: string[], b: string[]): Array<{ type: \"equal\" | \"delete\" | \"insert\"; value: string }> {\n if (a.length === 0) {\n return b.map((value) => ({ type: \"insert\" as const, value }));\n }\n if (b.length === 0) {\n return a.map((value) => ({ type: \"delete\" as const, value }));\n }\n\n // Use dynamic programming for optimal diff\n const dp = this.computeEditScript(a, b);\n return this.reconstructDiff(a, b, dp);\n }\n\n /**\n * Compute edit script using dynamic programming\n */\n private static computeEditScript(a: string[], b: string[]): number[][] {\n const m = a.length;\n const n = b.length;\n const dp: number[][] = Array(m + 1)\n .fill(null)\n .map(() => Array(n + 1).fill(0));\n\n // Initialize base cases\n for (let i = 0; i <= m; i++) dp[i][0] = i;\n for (let j = 0; j <= n; j++) dp[0][j] = j;\n\n // Fill the DP table\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n if (a[i - 1] === b[j - 1]) {\n dp[i][j] = dp[i - 1][j - 1]; // No operation needed\n } else {\n dp[i][j] =\n 1 +\n Math.min(\n dp[i - 1][j], // Delete from a\n dp[i][j - 1], // Insert into a\n dp[i - 1][j - 1], // Replace\n );\n }\n }\n }\n\n return dp;\n }\n\n /**\n * Reconstruct the actual diff from the DP table\n */\n private static reconstructDiff(\n a: string[],\n b: string[],\n dp: number[][],\n ): Array<{ type: \"equal\" | \"delete\" | \"insert\"; value: string; sharedDiffId?: boolean }> {\n const result: Array<{ type: \"equal\" | \"delete\" | \"insert\"; value: string; sharedDiffId?: boolean }> = [];\n let i = a.length;\n let j = b.length;\n\n while (i > 0 || j > 0) {\n if (i > 0 && j > 0 && a[i - 1] === b[j - 1]) {\n // Equal\n result.unshift({ type: \"equal\", value: a[i - 1] });\n i--;\n j--;\n } else {\n // Determine the best operation with preference for insert/delete over replace\n const deleteCost = i > 0 ? dp[i - 1][j] : Infinity;\n const insertCost = j > 0 ? dp[i][j - 1] : Infinity;\n const replaceCost = i > 0 && j > 0 ? dp[i - 1][j - 1] : Infinity;\n\n const minCost = Math.min(deleteCost, insertCost, replaceCost);\n\n // Prefer insertions and deletions over replacements when costs are equal\n if (minCost === insertCost && j > 0) {\n // Insert\n result.unshift({ type: \"insert\", value: b[j - 1] });\n j--;\n } else if (minCost === deleteCost && i > 0) {\n // Delete\n result.unshift({ type: \"delete\", value: a[i - 1] });\n i--;\n } else if (minCost === replaceCost && i > 0 && j > 0) {\n // Only use replace for similar words, otherwise prefer separate operations\n if (this.areWordsSimilar(a[i - 1], b[j - 1])) {\n // Similar words - treat as replacement with shared diffId\n result.unshift({ type: \"insert\", value: b[j - 1], sharedDiffId: true });\n result.unshift({ type: \"delete\", value: a[i - 1], sharedDiffId: true });\n i--;\n j--;\n } else {\n // Different words - prefer insert over delete when costs are equal\n result.unshift({ type: \"insert\", value: b[j - 1] });\n j--;\n }\n }\n }\n }\n\n return result;\n }\n\n /**\n * Consolidate adjacent changes to reduce fragmentation\n * e.g., if we have: delete \"Key\", insert \"Key!\", delete \"Challenges\"\n * We can consolidate this into: replace [\"Key\", \"Challenges\"] with [\"Key!\"]\n */\n private static consolidateAdjacentChanges(\n diffs: Array<{ type: \"equal\" | \"delete\" | \"insert\"; value: string }>,\n ): Array<{ type: \"equal\" | \"delete\" | \"insert\"; value: string; consolidated?: boolean }> {\n const result = [];\n let i = 0;\n\n while (i < diffs.length) {\n const current = diffs[i];\n\n if (current.type === \"equal\") {\n result.push(current);\n i++;\n continue;\n }\n\n // Look for patterns of adjacent changes that can be consolidated\n const changeSequence = [];\n let j = i;\n\n // Collect adjacent non-equal changes\n while (j < diffs.length && diffs[j].type !== \"equal\") {\n changeSequence.push(diffs[j]);\n j++;\n }\n\n if (changeSequence.length <= 1) {\n // Single change, no consolidation needed\n result.push(current);\n i++;\n continue;\n }\n\n // Check if we should consolidate this sequence\n const shouldConsolidate = this.shouldConsolidateChanges(\n changeSequence as Array<{ type: \"delete\" | \"insert\"; value: string }>,\n );\n\n if (shouldConsolidate) {\n // Create consolidated changes\n const deletedWords = changeSequence.filter((c) => c.type === \"delete\").map((c) => c.value);\n const insertedWords = changeSequence.filter((c) => c.type === \"insert\").map((c) => c.value);\n\n if (deletedWords.length > 0) {\n result.push({\n type: \"delete\" as const,\n value: deletedWords.join(\" \"),\n consolidated: true,\n });\n }\n\n if (insertedWords.length > 0) {\n result.push({\n type: \"insert\" as const,\n value: insertedWords.join(\" \"),\n consolidated: true,\n });\n }\n } else {\n // Don't consolidate, add individual changes\n changeSequence.forEach((change) => result.push(change));\n }\n\n i = j;\n }\n\n return result;\n }\n\n /**\n * Determine if a sequence of changes should be consolidated\n */\n private static shouldConsolidateChanges(changes: Array<{ type: \"delete\" | \"insert\"; value: string }>): boolean {\n // Consolidate if we have both deletions and insertions in the same sequence\n const hasDeletes = changes.some((c) => c.type === \"delete\");\n const hasInserts = changes.some((c) => c.type === \"insert\");\n\n // Only consolidate if we have both types of changes (replacements/modifications)\n // Pure additions or pure deletions are fine as separate changes\n return hasDeletes && hasInserts;\n }\n\n /**\n * Check if two words are similar enough to be considered a replacement\n */\n private static areWordsSimilar(word1: string, word2: string): boolean {\n // If words are exactly the same, they're similar\n if (word1 === word2) return true;\n\n // Consider words similar if they share more than 70% of their characters\n const maxLen = Math.max(word1.length, word2.length);\n const minLen = Math.min(word1.length, word2.length);\n\n // If one word is much longer than the other, they're not similar\n if (maxLen > minLen * 2) {\n return false;\n }\n\n // Special case: if one word is just the other plus punctuation, treat as separate changes\n // e.g., \"Key\" and \"Key!\" should not be considered similar for replacement\n const word1Clean = word1.replace(/[^\\w]/g, \"\");\n const word2Clean = word2.replace(/[^\\w]/g, \"\");\n\n if (word1Clean === word2Clean && word1 !== word2) {\n // One word is just the other with added punctuation - don't treat as replacement\n return false;\n }\n\n // Calculate character overlap using Levenshtein distance\n const distance = this.levenshteinDistance(word1, word2);\n const similarity = 1 - distance / maxLen;\n\n return similarity > 0.7; // Increased threshold to be more conservative\n }\n}\n","import { PartialBlock } from \"@blocknote/core\";\nimport { DiffBlock, WordDiff } from \"./blocknote-diff.util\";\n\nexport class BlockNoteWordDiffRendererUtil {\n static renderWordDiffs(\n diffBlocks: DiffBlock[],\n onAcceptChange?: (diffId: string) => void,\n onRejectChange?: (diffId: string) => void,\n acceptedChanges?: Set<string>,\n rejectedChanges?: Set<string>,\n ): PartialBlock[] {\n if (acceptedChanges || rejectedChanges) {\n diffBlocks = this.updateWordDiffStates(diffBlocks, acceptedChanges, rejectedChanges);\n }\n return diffBlocks.map((block) => this.renderDiffBlock(block, onAcceptChange, onRejectChange));\n }\n\n private static updateWordDiffStates(\n diffBlocks: DiffBlock[],\n acceptedChanges?: Set<string>,\n rejectedChanges?: Set<string>,\n ): DiffBlock[] {\n return diffBlocks.map((block) => {\n const updatedBlock = { ...block };\n\n if (updatedBlock.diffId) {\n updatedBlock.accepted = acceptedChanges?.has(updatedBlock.diffId) || false;\n updatedBlock.rejected = rejectedChanges?.has(updatedBlock.diffId) || false;\n }\n\n if (updatedBlock.wordDiffs) {\n updatedBlock.wordDiffs = updatedBlock.wordDiffs.map((wordDiff) => ({\n ...wordDiff,\n accepted: acceptedChanges?.has(wordDiff.diffId) || false,\n rejected: rejectedChanges?.has(wordDiff.diffId) || false,\n }));\n }\n\n if (updatedBlock.children) {\n updatedBlock.children = this.updateWordDiffStates(\n updatedBlock.children as DiffBlock[],\n acceptedChanges,\n rejectedChanges,\n );\n }\n\n return updatedBlock;\n });\n }\n\n private static renderDiffBlock(\n block: DiffBlock,\n onAcceptChange?: (diffId: string) => void,\n onRejectChange?: (diffId: string) => void,\n ): PartialBlock {\n if (block.diffType === \"modified\" && block.wordDiffs) {\n return this.renderWordLevelDiff(block, onAcceptChange, onRejectChange);\n }\n\n if (block.diffType === \"added\" || block.diffType === \"removed\") {\n return this.renderBlockLevelDiff(block, onAcceptChange, onRejectChange);\n }\n\n const baseBlock: PartialBlock = {\n id: block.id || crypto.randomUUID(),\n type: (block.type as any) || \"paragraph\",\n props: this.getBlockProps(block),\n content: Array.isArray(block.content) ? block.content : [],\n children: block.children?.map((child) =>\n this.renderDiffBlock(child as DiffBlock, onAcceptChange, onRejectChange),\n ),\n };\n\n return baseBlock;\n }\n\n private static renderBlockLevelDiff(\n block: DiffBlock,\n onAcceptChange?: (diffId: string) => void,\n onRejectChange?: (diffId: string) => void,\n ): PartialBlock {\n if (!block.diffId) {\n return {\n id: block.id || crypto.randomUUID(),\n type: (block.type as any) || \"paragraph\",\n props: block.props || {},\n content: Array.isArray(block.content) ? block.content : [],\n children: block.children?.map((child) =>\n this.renderDiffBlock(child as DiffBlock, onAcceptChange, onRejectChange),\n ),\n };\n }\n\n const blockAccepted = block.accepted || false;\n const blockRejected = block.rejected || false;\n\n let content = Array.isArray(block.content) ? [...block.content] : [];\n\n if (block.diffType === \"added\") {\n if (blockRejected) {\n return {\n id: block.id || crypto.randomUUID(),\n type: \"paragraph\",\n props: {},\n content: [],\n children: [],\n };\n } else if (!blockAccepted) {\n content = content.map((item: any) => ({\n ...item,\n styles: { ...item.styles, bold: true },\n }));\n\n content.push({\n type: \"diffActions\",\n props: { diffIds: block.diffId },\n });\n }\n } else if (block.diffType === \"removed\") {\n if (blockAccepted) {\n return {\n id: block.id || crypto.randomUUID(),\n type: \"paragraph\",\n props: {},\n content: [],\n children: [],\n };\n } else if (!blockRejected) {\n content = content.map((item: any) => ({\n ...item,\n styles: { ...item.styles, strike: true },\n }));\n\n content.push({\n type: \"diffActions\",\n props: { diffIds: block.diffId },\n });\n }\n }\n\n const baseBlock: PartialBlock = {\n id: block.id || crypto.randomUUID(),\n type: (block.type as any) || \"paragraph\",\n props: this.getBlockProps(block),\n content: content,\n children: block.children?.map((child) =>\n this.renderDiffBlock(child as DiffBlock, onAcceptChange, onRejectChange),\n ),\n };\n\n return baseBlock;\n }\n\n private static renderWordLevelDiff(\n block: DiffBlock,\n onAcceptChange?: (diffId: string) => void,\n onRejectChange?: (diffId: string) => void,\n ): PartialBlock {\n if (!block.wordDiffs) {\n return {\n id: block.id || crypto.randomUUID(),\n type: (block.type as any) || \"paragraph\",\n props: block.props || {},\n content: Array.isArray(block.content) ? block.content : [],\n children: [],\n };\n }\n\n const content = this.groupAndRenderWordDiffs(block.wordDiffs);\n\n return {\n id: block.id || crypto.randomUUID(),\n type: (block.type as any) || \"paragraph\",\n props: block.props || {},\n content: Array.isArray(content) ? content : [],\n children:\n block.children?.map((child) => this.renderDiffBlock(child as DiffBlock, onAcceptChange, onRejectChange)) || [],\n };\n }\n\n private static groupAndRenderWordDiffs(wordDiffs: WordDiff[]): any[] {\n const content: any[] = [];\n\n for (let i = 0; i < wordDiffs.length; i++) {\n const wordDiff = wordDiffs[i];\n\n const isLastOfGroup = this.isLastDiffInGroup(wordDiffs, i);\n\n const textContent = this.createTextContent(wordDiff, isLastOfGroup);\n if (textContent) {\n if (Array.isArray(textContent)) {\n content.push(...textContent);\n } else {\n content.push(textContent);\n }\n }\n }\n\n const cleanedContent = this.cleanupSpaces(content);\n\n return cleanedContent;\n }\n\n private static cleanupSpaces(content: any[]): any[] {\n const filtered = content.filter((item) => item !== null && item !== undefined);\n\n const cleaned: any[] = [];\n\n for (let i = 0; i < filtered.length; i++) {\n const current = filtered[i];\n\n if (current.type === \"text\" && current.text === \" \") {\n const lastItem = cleaned[cleaned.length - 1];\n\n if (\n i === 0 ||\n i === filtered.length - 1 ||\n (lastItem && lastItem.type === \"text\" && lastItem.text === \" \") ||\n (lastItem && lastItem.type === \"diffActions\")\n ) {\n continue;\n }\n }\n\n if (current.type === \"diffActions\") {\n const nextItem = i + 1 < filtered.length ? filtered[i + 1] : null;\n\n cleaned.push(current);\n\n if (nextItem && nextItem.type === \"text\" && nextItem.text !== \" \" && nextItem.type !== \"diffActions\") {\n cleaned.push({\n type: \"text\",\n text: \" \",\n styles: {},\n });\n }\n\n continue;\n }\n\n cleaned.push(current);\n }\n\n return cleaned;\n }\n\n private static isLastDiffInGroup(wordDiffs: WordDiff[], currentIndex: number): boolean {\n const currentDiff = wordDiffs[currentIndex];\n\n if (currentDiff.type === \"unchanged\") {\n return false;\n }\n\n for (let i = currentIndex + 1; i < wordDiffs.length; i++) {\n const nextDiff = wordDiffs[i];\n\n if (nextDiff.diffId === currentDiff.diffId && (nextDiff.type === \"added\" || nextDiff.type === \"removed\")) {\n return false;\n }\n\n if (nextDiff.type !== \"unchanged\" && nextDiff.diffId !== currentDiff.diffId) {\n break;\n }\n }\n\n return true;\n }\n\n private static createTextContent(wordDiff: WordDiff, isLastOfGroup?: boolean): any[] | any {\n switch (wordDiff.type) {\n case \"added\":\n if (wordDiff.accepted) {\n return {\n type: \"text\",\n text: wordDiff.text,\n styles: {},\n };\n } else if (wordDiff.rejected) {\n return null;\n } else {\n if (wordDiff.text.trim() === \"\") {\n return {\n type: \"text\",\n text: wordDiff.text,\n styles: { backgroundColor: \"#dcfce7\" },\n };\n } else {\n const baseContent = {\n type: \"text\",\n text: wordDiff.text,\n styles: { bold: true },\n };\n\n if (isLastOfGroup) {\n return [\n baseContent,\n {\n type: \"diffActions\",\n props: { diffIds: wordDiff.diffId },\n },\n ];\n } else {\n return baseContent;\n }\n }\n }\n\n case \"removed\":\n if (wordDiff.accepted) {\n return null;\n } else if (wordDiff.rejected) {\n return {\n type: \"text\",\n text: wordDiff.text,\n styles: {},\n };\n } else {\n if (wordDiff.text.trim() === \"\") {\n return {\n type: \"text\",\n text: wordDiff.text,\n styles: { strike: true },\n };\n } else {\n const baseContent = {\n type: \"text\",\n text: wordDiff.text,\n styles: { strike: true },\n };\n\n if (isLastOfGroup) {\n return [\n baseContent,\n {\n type: \"diffActions\",\n props: { diffIds: wordDiff.diffId },\n },\n ];\n } else {\n return baseContent;\n }\n }\n }\n\n case \"unchanged\":\n default:\n return {\n type: \"text\",\n text: wordDiff.text,\n styles: {},\n };\n }\n }\n\n private static getBlockProps(block: DiffBlock): any {\n const baseProps = block.props || {};\n\n return baseProps;\n }\n\n static generateChangeSummary(diffBlocks: DiffBlock[]): {\n totalWords: number;\n addedWords: number;\n removedWords: number;\n acceptedChanges: number;\n rejectedChanges: number;\n pendingChanges: number;\n } {\n let totalWords = 0;\n let addedWords = 0;\n let removedWords = 0;\n let acceptedChanges = 0;\n let rejectedChanges = 0;\n let pendingChanges = 0;\n\n const processBlock = (block: DiffBlock) => {\n if (block.wordDiffs) {\n block.wordDiffs.forEach((wordDiff) => {\n totalWords++;\n\n if (wordDiff.type === \"added\") {\n addedWords++;\n } else if (wordDiff.type === \"removed\") {\n removedWords++;\n }\n\n if (wordDiff.accepted) {\n acceptedChanges++;\n } else if (wordDiff.rejected) {\n rejectedChanges++;\n } else if (wordDiff.type !== \"unchanged\") {\n pendingChanges++;\n }\n });\n }\n\n if (block.children) {\n block.children.forEach((child) => processBlock(child as DiffBlock));\n }\n };\n\n diffBlocks.forEach(processBlock);\n\n return {\n totalWords,\n addedWords,\n removedWords,\n acceptedChanges,\n rejectedChanges,\n pendingChanges,\n };\n }\n}\n","import { LucideIcon } from \"lucide-react\";\nimport { ReactNode } from \"react\";\nimport { ApiDataInterface, Modules } from \"../core\";\nimport { ContentInterface } from \"../features/content/data/content.interface\";\nimport { ModuleWithPermissions } from \"../permissions\";\nimport { cn } from \"./cn\";\n\nexport const getIconByModule = (params: { module: ModuleWithPermissions; className?: string }): ReactNode => {\n const IconComponent = getLucideIconByModule({ module: params.module });\n if (!IconComponent) return null;\n return <IconComponent className={cn(``, params.className)} />;\n};\n\nexport const getIcon = (params: { element: ApiDataInterface; className?: string }): ReactNode => {\n const IconComponent = getLucideIcon({ element: params.element });\n if (!IconComponent) return null;\n return <IconComponent className={cn(``, params.className)} />;\n};\n\nexport const getIconByModuleName = (params: { name: string; className?: string }): ReactNode => {\n return getIconByModule({ module: Modules.findByModelName(params.name), className: params.className });\n};\n\nexport const getLucideIcon = (params: { element: ApiDataInterface }): LucideIcon | null => {\n if (params.element.type === \"contents\") {\n const contentType = (params.element as ContentInterface).contentType;\n if (!contentType) return null;\n return getLucideIconByModule({ module: Modules.findByModelName(contentType) });\n }\n\n return getLucideIconByModule({ module: Modules.findByName(params.element.type) });\n};\n\nexport const getLucideIconByModule = (params: { module: ModuleWithPermissions }): LucideIcon | null => {\n return params.module.icon ?? null;\n};\n\nexport const getLucideIconByModuleName = (params: { name: string }): LucideIcon | null => {\n return getLucideIconByModule({ module: Modules.findByModelName(params.name) });\n};\n","import { LucideIcon } from \"lucide-react\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { FieldSelector } from \"../core/fields/FieldSelector\";\n\n/**\n * Permission actions\n */\nexport enum Action {\n Read = \"read\",\n Create = \"create\",\n Update = \"update\",\n Delete = \"delete\",\n}\n\n/**\n * Generic permission check type.\n * Can be a boolean or a function that checks permissions dynamically.\n * @template T - The data type being checked\n * @template U - The user type (defaults to PermissionUser)\n */\nexport type PermissionCheck<T, U = PermissionUser> = boolean | ((user?: U | string, data?: T) => boolean);\n\n/**\n * Page URL configuration for modules\n */\nexport type PageUrl = {\n pageUrl?: string;\n};\n\n/**\n * Module permission definition wrapper\n */\nexport type ModulePermissionDefinition<T> = {\n interface: T;\n};\n\n/**\n * Base module definition\n */\nexport type ModuleDefinition = {\n pageUrl?: string;\n name: string;\n model: any;\n feature?: string;\n moduleId?: string;\n};\n\n/**\n * Permission configuration for a module.\n * Can be a boolean (allow/deny all) or a string path for dynamic checks.\n */\nexport interface PermissionConfig {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n}\n\n/**\n * Generic interface for a module that has permissions.\n * Apps should ensure their Module class implements this.\n */\nexport interface PermissionModule {\n id: string;\n permissions: PermissionConfig;\n}\n\n/**\n * Generic interface for a user that has modules with permissions.\n * Apps should ensure their User class implements this.\n */\nexport interface PermissionUser {\n id: string;\n modules: PermissionModule[];\n}\n\n/**\n * Module definition with permissions - extends ApiRequestDataTypeInterface\n */\nexport type ModuleWithPermissions = ApiRequestDataTypeInterface & {\n pageUrl?: string;\n feature?: string;\n moduleId?: string;\n icon?: LucideIcon;\n inclusions?: Record<\n string,\n {\n types?: string[];\n fields?: FieldSelector<any>[];\n }\n >;\n};\n\n/**\n * Factory type for creating module definitions\n */\nexport type ModuleFactory = (params: {\n pageUrl?: string;\n name: string;\n cache?: string | \"days\" | \"default\" | \"hours\" | \"max\" | \"minutes\" | \"seconds\" | \"weeks\";\n model: any;\n feature?: string;\n moduleId?: string;\n icon?: LucideIcon;\n inclusions?: Record<\n string,\n {\n types?: string[];\n fields?: FieldSelector<any>[];\n }\n >;\n}) => ModuleWithPermissions;\n","import { Action, ModuleWithPermissions, PermissionModule, PermissionUser } from \"./types\";\n\n/**\n * Check if a user has permission to perform an action on a module.\n *\n * @param module - The module to check permissions for\n * @param action - The action to check (read, create, update, delete)\n * @param user - The user with their modules and permissions\n * @param data - Optional data object for path-based permission checks\n */\nexport function checkPermissions<T extends PermissionUser>(params: {\n module: ModuleWithPermissions;\n action: Action;\n user: T;\n data?: any;\n}): boolean {\n const selectedModule = params.user.modules.find((module: PermissionModule) => module.id === params.module.moduleId);\n\n if (!selectedModule) return false;\n const permissionConfig = selectedModule.permissions[params.action];\n\n if (!permissionConfig) return false;\n if (typeof permissionConfig === \"boolean\") return permissionConfig as boolean;\n\n if (!params.data) return true;\n\n try {\n const singlePermissionConfig = permissionConfig.split(\"|\").map((p) => p.trim());\n\n for (const path of singlePermissionConfig) {\n if (getValueFromPath(params.data, path, params.user.id)) return true;\n }\n return false;\n } catch {\n if (typeof permissionConfig === \"string\") {\n return getValueFromPath(params.data, permissionConfig, params.user.id);\n }\n }\n\n return false;\n}\n\n/**\n * Check permissions from server context where user object is not fully available.\n *\n * @param module - The module to check permissions for\n * @param action - The action to check\n * @param userId - The user's ID\n * @param selectedModule - The selected module with its permissions\n * @param data - Optional data object for path-based permission checks\n */\nexport function checkPermissionsFromServer(params: {\n module: ModuleWithPermissions;\n action: Action;\n userId: string;\n selectedModule?: PermissionModule;\n data?: any;\n}): boolean {\n if (!params.selectedModule) return false;\n const permissionConfig = params.selectedModule.permissions[params.action];\n\n if (!permissionConfig) return false;\n if (typeof permissionConfig === \"boolean\") return permissionConfig as boolean;\n\n if (!params.data) return true;\n\n try {\n const singlePermissionConfig = permissionConfig.split(\"|\").map((p) => p.trim());\n\n for (const path of singlePermissionConfig) {\n if (getValueFromPath(params.data, path, params.userId)) return true;\n }\n return false;\n } catch {\n if (typeof permissionConfig === \"string\") {\n return getValueFromPath(params.data, permissionConfig, params.userId);\n }\n }\n\n return false;\n}\n\n/**\n * Traverse an object path and check if the value matches the user ID.\n * Handles nested objects, arrays, and various data structures.\n */\nexport function getValueFromPath(obj: any, path: string, userId: string): any {\n const parts = path.split(\".\");\n let current = obj;\n\n for (const part of parts) {\n if (!current) return false;\n\n if (Array.isArray(current)) {\n let found = false;\n for (const item of current) {\n const result = getValueFromPath(item, parts.slice(parts.indexOf(part)).join(\".\"), userId);\n if (result === userId || result === true) {\n found = true;\n break;\n }\n }\n return found;\n } else if (current[part] !== undefined) {\n current = current[part];\n } else {\n return false;\n }\n }\n\n if (Array.isArray(current)) {\n // If final value is an array, check if any element has id matching userId\n return current.some((item: any) => {\n if (typeof item === \"object\" && item.id !== undefined) {\n return item.id.toString() === userId;\n }\n return item.toString() === userId;\n });\n }\n\n // Direct comparison for primitive values or objects with id\n if (typeof current === \"object\" && current.id !== undefined) {\n return current.id.toString() === userId;\n }\n\n return current.toString() === userId;\n}\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { UserInterface } from \"../../user/data/user.interface\";\nimport { AuthInput, AuthInterface } from \"./auth.interface\";\n\nexport class Auth extends AbstractApiData implements AuthInterface {\n private _token?: string;\n private _refreshToken?: string;\n private _user?: UserInterface;\n\n get token(): string {\n if (!this._token) throw new Error(\"Token is not defined\");\n return this._token;\n }\n\n get refreshToken(): string {\n if (!this._refreshToken) throw new Error(\"Refresh token is not defined\");\n return this._refreshToken;\n }\n\n get user(): UserInterface {\n if (!this._user) throw new Error(\"User is not defined\");\n return this._user;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._token = data.jsonApi.attributes.token ?? undefined;\n this._refreshToken = data.jsonApi.attributes.refreshToken ?? undefined;\n\n this._user = this._readIncluded(data, \"user\", Modules.User) as UserInterface;\n\n return this;\n }\n\n createJsonApi(data: AuthInput) {\n const response: any = {\n data: {\n type: Modules.Auth.name,\n attributes: {},\n },\n };\n\n if (data.id) response.data.id = data.id;\n if (data.email !== undefined) response.data.attributes.email = data.email;\n if (data.name !== undefined) response.data.attributes.name = data.name;\n if (data.companyName !== undefined) response.data.attributes.companyName = data.companyName;\n if (data.password !== undefined) response.data.attributes.password = data.password;\n if (data.partitaIva !== undefined) response.data.attributes.partitaIva = data.partitaIva;\n if (data.codiceFiscale !== undefined) response.data.attributes.codiceFiscale = data.codiceFiscale;\n\n return response;\n }\n}\n","/**\n * Token parameters for authentication cookie management\n */\nexport interface TokenParams {\n token?: string;\n refreshToken?: string;\n userId?: string;\n companyId?: string;\n licenseExpirationDate?: Date;\n roles?: string[];\n features?: string[];\n modules?: {\n id: string;\n permissions: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n }[];\n}\n\n/**\n * Token handler interface for dependency injection\n * Apps must provide implementations of these functions via configureAuth()\n */\nexport interface TokenHandler {\n updateToken: (params: TokenParams) => Promise<void>;\n removeToken: () => Promise<void>;\n}\n\n// Private storage for the injected token handler\nlet _tokenHandler: TokenHandler | null = null;\n\n/**\n * Configure authentication token handling\n * Call this at app startup to provide Server Actions for cookie management\n *\n * @example\n * ```typescript\n * import { configureAuth } from \"@carlonicora/nextjs-jsonapi/features\";\n * import { updateToken, removeToken } from \"@/features/auth/utils/AuthCookies\";\n *\n * configureAuth({ updateToken, removeToken });\n * ```\n */\nexport function configureAuth(handler: TokenHandler): void {\n _tokenHandler = handler;\n}\n\n/**\n * Internal getter for AuthService to access the token handler\n * @internal\n */\nexport function getTokenHandler(): TokenHandler | null {\n return _tokenHandler;\n}\n","import { AuthInput, AuthInterface } from \".\";\nimport { JsonApiDelete, JsonApiGet, JsonApiPost } from \"../../../unified\";\nimport {\n AbstractService,\n ApiResponseInterface,\n EndpointCreator,\n HttpMethod,\n JsonApiHydratedDataInterface,\n Modules,\n rehydrate,\n} from \"../../../core\";\nimport { UserInterface } from \"../../user\";\nimport { getTokenHandler } from \"../config\";\n\nexport class AuthService extends AbstractService {\n static async login(params: { email: string; password: string; language?: string }): Promise<UserInterface> {\n const language = params.language || \"en-US\";\n\n const apiResponse: ApiResponseInterface = await JsonApiPost({\n classKey: Modules.Auth,\n endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: \"login\" }).generate(),\n body: { email: params.email, password: params.password } as AuthInput,\n language: language,\n });\n\n if (!apiResponse.ok) throw new Error(apiResponse.error);\n\n const auth = apiResponse.data as AuthInterface;\n\n // Use injected token handler if configured\n const handler = getTokenHandler();\n if (handler) {\n await handler.updateToken({\n token: auth.token,\n refreshToken: auth.refreshToken,\n userId: auth.user.id,\n companyId: auth.user.company?.id,\n licenseExpirationDate: auth.user.company?.licenseExpirationDate,\n roles: auth.user.roles.map((role) => role.id),\n features: auth.user.company?.features?.map((feature) => feature.id) ?? [],\n modules: auth.user.modules.map((module) => ({\n id: module.id,\n permissions: module.permissions,\n })),\n });\n }\n\n return auth.user;\n }\n\n static async logout(params?: { language?: string }): Promise<void> {\n const language = params?.language || \"en-US\";\n\n await JsonApiDelete({\n classKey: Modules.Auth,\n endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),\n language: language,\n });\n\n // Use injected token handler if configured\n const handler = getTokenHandler();\n if (handler) {\n await handler.removeToken();\n }\n }\n\n static async initialiseForgotPassword(params: { email: string; language?: string }): Promise<void> {\n const language = params.language || \"en-US\";\n\n const response: ApiResponseInterface = await JsonApiPost({\n classKey: Modules.Auth,\n endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: \"forgot\" }).generate(),\n body: { email: params.email } as AuthInput,\n language: language,\n });\n\n if (!response.ok) {\n throw new Error(response.error);\n }\n }\n\n static async register(params: AuthInput): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: \"register\" });\n\n await this.callApi({\n type: Modules.Auth,\n method: HttpMethod.POST,\n endpoint: endpoint.generate(),\n input: params,\n });\n }\n\n static async activate(params: { activationCode: string }): Promise<void> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.Auth,\n id: \"activate\",\n childEndpoint: params.activationCode,\n });\n\n await this.callApi({ type: Modules.Auth, method: HttpMethod.POST, endpoint: endpoint.generate() });\n }\n\n static async validateCode(params: { code: string; language?: string }): Promise<void> {\n const language = params.language || \"en-US\";\n\n const apiResponse: ApiResponseInterface = await JsonApiGet({\n classKey: Modules.Auth,\n endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: \"validate\", childEndpoint: params.code }).generate(),\n language: language,\n });\n\n if (!apiResponse.ok) throw new Error(apiResponse.error);\n }\n\n static async resetPassword(params: { code: string; password: string }): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: \"reset\", childEndpoint: params.code });\n\n const input: AuthInput = { password: params.password };\n\n await this.callApi({ type: Modules.Auth, method: HttpMethod.POST, endpoint: endpoint.generate(), input: input });\n }\n\n static async acceptInvitation(params: { code: string; password: string }): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: \"invitation\", childEndpoint: params.code });\n\n const input: AuthInput = { password: params.password };\n\n await this.callApi({ type: Modules.Auth, method: HttpMethod.POST, endpoint: endpoint.generate(), input: input });\n }\n\n static async findToken(params: { tokenCode: string }): Promise<AuthInterface> {\n return await this.callApi<AuthInterface>({\n type: Modules.Auth,\n method: HttpMethod.POST,\n endpoint: new EndpointCreator({ endpoint: Modules.Auth }).addAdditionalParam(\"code\", params.tokenCode).generate(),\n });\n }\n\n static async saveToken(params: { dehydratedAuth: JsonApiHydratedDataInterface }): Promise<void> {\n const auth: AuthInterface = rehydrate(Modules.Auth, params.dehydratedAuth) as AuthInterface;\n\n const handler = getTokenHandler();\n if (handler) {\n await handler.updateToken({\n token: auth.token,\n refreshToken: auth.refreshToken,\n userId: auth.user.id,\n companyId: auth.user.company?.id,\n licenseExpirationDate: auth.user.company?.licenseExpirationDate,\n roles: auth.user.roles.map((role) => role.id),\n features: auth.user.company?.features?.map((feature) => feature.id) ?? [],\n modules: auth.user.modules.map((module) => ({\n id: module.id,\n permissions: module.permissions,\n })),\n });\n }\n }\n}\n","export enum AuthComponent {\n Login,\n ForgotPassword,\n ResetPassword,\n ActivateAccount,\n AcceptInvitation,\n Register,\n Landing,\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Auth } from \".\";\n\nexport const AuthModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/auth\",\n name: \"auth\",\n model: Auth,\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { FeatureInterface } from \"../../feature\";\nimport { ModuleInterface } from \"../../module\";\nimport { CompanyInput, CompanyInterface } from \"./company.interface\";\n\nexport class Company extends AbstractApiData implements CompanyInterface {\n private _name?: string;\n private _logo?: string;\n private _logoUrl?: string;\n private _configurations?: any;\n\n private _licenseExpirationDate?: Date;\n\n private _features?: FeatureInterface[];\n private _modules?: ModuleInterface[];\n\n get name(): string {\n if (this._name === undefined) throw new Error(\"Name is not defined\");\n return this._name;\n }\n\n get logo(): string | undefined {\n return this._logo;\n }\n\n get logoUrl(): string | undefined {\n return this._logoUrl;\n }\n\n get licenseExpirationDate(): Date | undefined {\n return this._licenseExpirationDate;\n }\n\n get features(): FeatureInterface[] {\n return this._features ?? [];\n }\n\n get modules(): ModuleInterface[] {\n return this._modules ?? [];\n }\n\n get configurations(): any | undefined {\n return this._configurations;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._name = data.jsonApi.attributes.name;\n this._configurations = data.jsonApi.attributes.configurations\n ? JSON.parse(data.jsonApi.attributes.configurations)\n : undefined;\n this._logo = data.jsonApi.attributes.logo;\n this._logoUrl = data.jsonApi.attributes.logoUrl;\n\n this._licenseExpirationDate = data.jsonApi.attributes.licenseExpirationDate\n ? new Date(data.jsonApi.attributes.licenseExpirationDate)\n : undefined;\n\n this._features = this._readIncluded<FeatureInterface>(data, \"features\", Modules.Feature) as FeatureInterface[];\n this._modules = this._readIncluded<ModuleInterface>(data, \"modules\", Modules.Module) as ModuleInterface[];\n\n return this;\n }\n\n createJsonApi(data: CompanyInput) {\n const response: any = {\n data: {\n type: Modules.Company.name,\n id: data.id,\n attributes: {},\n meta: {},\n relationships: {},\n },\n included: [],\n };\n\n if (data.name) response.data.attributes.name = data.name;\n if (data.configurations) response.data.attributes.configurations = JSON.stringify(data.configurations);\n if (data.logo) response.data.attributes.logo = data.logo;\n if (data.license) response.data.attributes.license = data.license;\n if (data.privateKey) response.data.attributes.privateKey = data.privateKey;\n\n if (data.featureIds && data.featureIds.length > 0) {\n response.data.relationships.features = {\n data: data.featureIds.map((featureId) => ({\n type: Modules.Feature.name,\n id: featureId,\n })),\n };\n }\n\n if (data.moduleIds && data.moduleIds.length > 0) {\n response.data.relationships.modules = {\n data: data.moduleIds.map((moduleId) => ({\n type: Modules.Module.name,\n id: moduleId,\n })),\n };\n }\n\n return response;\n }\n}\n","export enum CompanyFields {\n companyId = \"companyId\",\n name = \"name\",\n createdAt = \"createdAt\",\n updatedAt = \"updatedAt\",\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef } from \"../../../core\";\nimport { CompanyInput, CompanyInterface } from \"./company.interface\";\n\nexport class CompanyService extends AbstractService {\n static async findOne(params: { companyId: string }): Promise<CompanyInterface> {\n return this.callApi<CompanyInterface>({\n type: Modules.Company,\n method: HttpMethod.GET,\n endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate(),\n });\n }\n\n static async findMany(params: { search?: string; next?: NextRef }): Promise<CompanyInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Company });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi<CompanyInterface[]>({\n type: Modules.Company,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async delete(params: { companyId: string }): Promise<void> {\n await this.callApi({\n type: Modules.Company,\n method: HttpMethod.DELETE,\n endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate(),\n });\n }\n\n static async create(params: CompanyInput): Promise<CompanyInterface> {\n return this.callApi({\n type: Modules.Company,\n method: HttpMethod.POST,\n endpoint: new EndpointCreator({ endpoint: Modules.Company }).generate(),\n input: params,\n });\n }\n\n static async update(params: CompanyInput): Promise<CompanyInterface> {\n return this.callApi({\n type: Modules.Company,\n method: HttpMethod.PUT,\n endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id }).generate(),\n input: params,\n });\n }\n\n static async updateConfigurations(params: CompanyInput): Promise<CompanyInterface> {\n return this.callApi({\n type: Modules.Company,\n method: HttpMethod.PUT,\n endpoint: new EndpointCreator({\n endpoint: Modules.Company,\n id: params.id,\n childEndpoint: \"configurations\",\n }).generate(),\n input: params,\n });\n }\n\n static async activateLicense(params: CompanyInput): Promise<CompanyInterface> {\n return this.callApi({\n type: Modules.Company,\n method: HttpMethod.PUT,\n endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id, childEndpoint: \"license\" }).generate(),\n input: params,\n });\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Company } from \".\";\n\nexport const CompanyModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/companies\",\n name: \"companies\",\n model: Company,\n moduleId: \"f9e77c8f-bfd1-4fd4-80b0-e1d891ab7113\",\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { SearchResultInterface } from \"../../search/interfaces/search.result.interface\";\nimport { UserInterface } from \"../../user\";\nimport { ContentInput, ContentInterface } from \"./content.interface\";\n\nexport class Content extends AbstractApiData implements ContentInterface, SearchResultInterface {\n private _contentType?: string;\n\n private _name?: string;\n private _abstract?: string;\n private _tldr?: string;\n private _aiStatus?: string;\n private _relevance?: number;\n\n private _author?: UserInterface;\n private _editors?: UserInterface[];\n\n get searchResult(): string {\n return this._name ?? \"\";\n }\n\n get contentType(): string | undefined {\n return this._contentType;\n }\n\n get name(): string {\n if (this._name === undefined) throw new Error(\"JsonApi error: content name is missing\");\n return this._name;\n }\n\n get abstract(): string | undefined {\n return this._abstract;\n }\n\n get tldr(): string | undefined {\n return this._tldr;\n }\n\n get aiStatus(): string {\n return this._aiStatus ?? \"\";\n }\n\n get relevance(): number | undefined {\n return this._relevance;\n }\n\n get author(): UserInterface {\n if (this._author === undefined) throw new Error(\"JsonApi error: document author is missing\");\n return this._author;\n }\n\n get editors(): UserInterface[] {\n return this._editors ?? [];\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._contentType = data.jsonApi.meta.contentType;\n\n this._name = data.jsonApi.attributes.name;\n this._abstract = data.jsonApi.attributes.abstract;\n this._tldr = data.jsonApi.attributes.tldr;\n this._aiStatus = data.jsonApi.meta.aiStatus;\n this._relevance = data.jsonApi.meta.relevance;\n\n this._author = this._readIncluded(data, \"author\", Modules.User) as UserInterface;\n this._editors = this._readIncluded(data, \"editors\", Modules.User) as UserInterface[];\n\n return this;\n }\n\n protected addContentInput(response: any, data: ContentInput) {\n if (data.name) response.data.attributes.name = data.name;\n\n if (data.authorId) {\n response.data.relationships.author = {\n data: {\n type: Modules.User.name,\n id: data.authorId,\n },\n };\n }\n }\n}\n","export enum ContentFields {\n contentId = \"contentId\",\n\n name = \"name\",\n relevance = \"relevance\",\n\n authors = \"authors\",\n\n createdAt = \"createdAt\",\n updatedAt = \"updatedAt\",\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef, PreviousRef } from \"../../../core\";\nimport { ContentInterface } from \"./content.interface\";\n\nexport class ContentService extends AbstractService {\n static async findMany(params: {\n contentIds?: string[];\n search?: string;\n fetchAll?: boolean;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<ContentInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Content });\n\n if (params.contentIds) {\n endpoint.addAdditionalParam(\"contentIds\", params.contentIds.join(\",\"));\n endpoint.addAdditionalParam(\"fetchAll\", \"true\");\n } else {\n if (params.fetchAll) endpoint.addAdditionalParam(\"fetchAll\", \"true\");\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n }\n if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);\n if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);\n\n return this.callApi({\n type: Modules.Content,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findRelevant(params: { id: string; next?: NextRef; prev?: PreviousRef }): Promise<ContentInterface[]> {\n const endpoint: EndpointCreator = new EndpointCreator({\n endpoint: Modules.Content,\n id: params.id,\n childEndpoint: \"relevance\",\n });\n\n if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);\n if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);\n\n return this.callApi<ContentInterface[]>({\n type: Modules.Content,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findManyByAuthor(params: {\n userId: string;\n search?: string;\n fetchAll?: boolean;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<ContentInterface[]> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.Author,\n id: params.userId,\n childEndpoint: Modules.Content,\n });\n\n if (params.fetchAll) endpoint.addAdditionalParam(\"fetchAll\", \"true\");\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);\n if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);\n\n return this.callApi({\n type: Modules.Content,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n}\n","import { createJsonApiInclusion } from \"../../core\";\nimport { ModuleFactory } from \"../../permissions\";\nimport { Content } from \".\";\n\nexport const ContentModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/contents\",\n name: \"contents\",\n model: Content,\n inclusions: {\n lists: {\n fields: [\n createJsonApiInclusion(\"content\", [`name`, `tldr`, `abstract`, `aiStatus`, `relevance`]),\n createJsonApiInclusion(\"users\", [`name`, `avatar`]),\n createJsonApiInclusion(\"topics\", [`name`]),\n createJsonApiInclusion(\"expertises\", [`name`]),\n ],\n },\n },\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { ModuleInterface } from \"../../module\";\nimport { FeatureInterface } from \"./feature.interface\";\n\nexport class Feature extends AbstractApiData implements FeatureInterface {\n private _name?: string;\n private _isProduction?: boolean;\n\n private _modules: ModuleInterface[] = [];\n\n get name(): string {\n return this._name ?? \"\";\n }\n\n get isProduction(): boolean {\n return this._isProduction == true ? true : false;\n }\n\n get modules(): ModuleInterface[] {\n return this._modules;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._name = data.jsonApi.attributes.name;\n this._isProduction = data.jsonApi.attributes.isProduction ?? false;\n\n this._modules = this._readIncluded(data, `modules`, Modules.Module) as ModuleInterface[];\n\n return this;\n }\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef } from \"../../../core\";\nimport { FeatureInterface } from \"./feature.interface\";\n\nexport class FeatureService extends AbstractService {\n static async findMany(params: { companyId?: string; search?: string; next?: NextRef }): Promise<FeatureInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Feature });\n\n if (params.companyId) endpoint.endpoint(Modules.Company).id(params.companyId).childEndpoint(Modules.Feature);\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi<FeatureInterface[]>({\n type: Modules.Feature,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Feature } from \"./data/feature\";\n\nexport const FeatureModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/features\",\n name: \"features\",\n model: Feature,\n moduleId: \"025fdd23-2803-4360-9fd9-eaa3612c2e23\",\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface } from \"../../../core\";\nimport { ModuleInterface } from \"./module.interface\";\n\nexport class Module extends AbstractApiData implements ModuleInterface {\n private _name?: string;\n private _isCore?: boolean;\n private _permissions?: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n\n get name(): string {\n if (!this._name) throw new Error(\"Name is not defined\");\n return this._name ?? \"\";\n }\n\n get isCore(): boolean {\n return this._isCore ?? false;\n }\n\n get permissions(): {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n } {\n if (!this._permissions) throw new Error(\"Permissions is not defined\");\n return this._permissions;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._name = data.jsonApi.attributes.name;\n this._isCore = data.jsonApi.attributes.isCore;\n this._permissions = data.jsonApi.meta.permissions;\n\n return this;\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Module } from \"./data\";\n\nexport const ModuleModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/modules\",\n name: \"modules\",\n model: Module,\n moduleId: \"25ffd868-8341-4ca7-963b-6e1c56b03b1d\",\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { UserInterface } from \"../../user\";\nimport { NotificationInput, NotificationInterface } from \"./notification.interface\";\n\nexport class Notification extends AbstractApiData implements NotificationInterface {\n private _notificationType?: string;\n private _isRead?: boolean;\n\n private _actor?: UserInterface;\n\n get notificationType(): string {\n if (this._notificationType === undefined) throw new Error(\"notificationType is not set\");\n return this._notificationType;\n }\n\n get isRead(): boolean {\n return this._isRead === undefined ? false : this._isRead;\n }\n\n get actor(): UserInterface | undefined {\n return this._actor;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._notificationType = data.jsonApi.attributes.notificationType;\n this._isRead = data.jsonApi.attributes.isRead;\n\n this._actor = this._readIncluded(data, \"actor\", Modules.User) as UserInterface;\n\n return this;\n }\n\n createJsonApi(data: NotificationInput) {\n const response: any = {\n data: {\n type: Modules.Notification.name,\n id: data.id,\n attributes: {\n isRead: data.isRead,\n },\n meta: {},\n relationships: {},\n },\n included: [],\n };\n\n return response;\n }\n}\n","export enum NotificationFields {\n notificationId = \"notificationId\",\n\n name = \"name\",\n\n createdAt = \"createdAt\",\n updatedAt = \"updatedAt\",\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef } from \"../../../core\";\nimport { NotificationInterface } from \"./notification.interface\";\n\nexport class NotificationService extends AbstractService {\n static async findMany(params: { isArchived?: boolean; next?: NextRef }): Promise<NotificationInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Notification });\n\n if (params.isArchived) endpoint.addAdditionalParam(\"isArchived\", \"true\");\n\n return this.callApi<NotificationInterface[]>({\n type: Modules.Notification,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async markAsRead(params: { data: any }): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Notification });\n await this.callApi({\n type: Modules.Notification,\n method: HttpMethod.PATCH,\n endpoint: endpoint.generate(),\n input: params.data,\n overridesJsonApiCreation: true,\n });\n }\n\n static async archive(params: { id: string }): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Notification, id: params.id, childEndpoint: \"archive\" });\n\n await this.callApi({ type: Modules.Notification, method: HttpMethod.POST, endpoint: endpoint.generate() });\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Notification } from \"./data/notification\";\n\nexport const NotificationModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/notifications\",\n name: \"notifications\",\n model: Notification,\n moduleId: \"9259d704-c670-4e77-a3a1-a728ffc5be3d\",\n });\n","import { AbstractApiData, Modules } from \"../../../core\";\nimport { PushInput, PushInterface } from \"./push.interface\";\n\nexport class Push extends AbstractApiData implements PushInterface {\n createJsonApi(data: PushInput) {\n const response: any = {\n data: {\n type: Modules.Push.name,\n attributes: {\n key: data.key,\n },\n },\n included: [],\n };\n\n return response;\n }\n}\n","import { AbstractService, HttpMethod } from \"../../../core\";\nimport { EndpointCreator } from \"../../../core\";\nimport { Modules } from \"../../../core\";\n\nexport class PushService extends AbstractService {\n static async register(params: { data: any }): Promise<void> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Push });\n\n await this.callApi({\n type: Modules.Push,\n method: HttpMethod.POST,\n endpoint: endpoint.generate(),\n input: params.data,\n overridesJsonApiCreation: true,\n });\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Push } from \"./data/push\";\n\nexport const PushModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/push\",\n name: \"push\",\n model: Push,\n moduleId: \"\",\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { FeatureInterface } from \"../../feature\";\nimport { RoleInput, RoleInterface } from \"./role.interface\";\n\nexport class Role extends AbstractApiData implements RoleInterface {\n private _name?: string;\n private _description?: string;\n private _isSelectable?: boolean;\n\n private _requiredFeature?: FeatureInterface;\n\n get name(): string {\n if (!this._name) throw new Error(\"Name is not defined\");\n return this._name;\n }\n\n get description(): string {\n return this._description ?? \"\";\n }\n\n get isSelectable(): boolean {\n return this._isSelectable ?? false;\n }\n\n get requiredFeature(): FeatureInterface | undefined {\n return this._requiredFeature;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._name = data.jsonApi.attributes.name ?? undefined;\n this._description = data.jsonApi.attributes.description ?? undefined;\n this._isSelectable = data.jsonApi.attributes.isSelectable ?? undefined;\n\n this._requiredFeature = this._readIncluded<FeatureInterface>(\n data,\n \"requiredFeature\",\n Modules.Feature,\n ) as FeatureInterface;\n\n return this;\n }\n\n createJsonApi(data: RoleInput) {\n const response: any = {\n data: {\n type: Modules.Role.name,\n id: data.id,\n attributes: {\n name: data.name,\n },\n meta: {},\n },\n included: [],\n };\n\n if (data.description !== undefined) response.data.attributes.description = data.description;\n\n return response;\n }\n}\n","export enum RoleFields {\n roleId = \"roleId\",\n name = \"name\",\n description = \"description\",\n\n createdAt = \"createdAt\",\n updatedAt = \"updatedAt\",\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef, PreviousRef } from \"../../../core\";\nimport { RoleInput, RoleInterface } from \"./role.interface\";\n\nexport class RoleService extends AbstractService {\n static async findById(params: { roleId: string }): Promise<RoleInterface> {\n return this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.GET,\n endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),\n });\n }\n\n static async findAllRoles(params: { search?: string; next?: NextRef }): Promise<RoleInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Role });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.Role,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findAllRolesByUser(params: {\n userId: string;\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<RoleInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.User, id: params.userId, childEndpoint: Modules.Role });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.Role,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findAllRolesUserNotIn(params: {\n userId: string;\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<RoleInterface[]> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.User,\n id: params.userId,\n childEndpoint: Modules.Role,\n }).addAdditionalParam(\"userNotIn\", \"true\");\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.Role,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async addUserToRole(params: { userId: string; roleId: string }): Promise<void> {\n this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.POST,\n endpoint: new EndpointCreator({\n endpoint: Modules.Role,\n id: params.roleId,\n childEndpoint: Modules.User,\n childId: params.userId,\n }).generate(),\n });\n }\n\n static async removeUserFromRole(params: { userId: string; roleId: string }): Promise<void> {\n this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.DELETE,\n endpoint: new EndpointCreator({\n endpoint: Modules.Role,\n id: params.roleId,\n childEndpoint: Modules.User,\n childId: params.userId,\n }).generate(),\n });\n }\n\n static async create(params: { roleId: string; name: string; description?: string }): Promise<RoleInterface> {\n return this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.POST,\n endpoint: new EndpointCreator({ endpoint: Modules.Role }).generate(),\n input: { id: params.roleId, name: params.name, description: params.description } as RoleInput,\n });\n }\n\n static async update(params: { roleId: string; name: string; description?: string }): Promise<RoleInterface> {\n return this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.PUT,\n endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),\n input: { id: params.roleId, name: params.name, description: params.description } as RoleInput,\n });\n }\n\n static async delete(params: { roleId: string }): Promise<RoleInterface> {\n return this.callApi<RoleInterface>({\n type: Modules.Role,\n method: HttpMethod.DELETE,\n endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),\n });\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { Role } from \"./data/role\";\n\nexport const RoleModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/roles\",\n name: \"roles\",\n model: Role,\n moduleId: \"9f6416e6-7b9b-4e1a-a99f-833191eca8a9\",\n });\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { S3Input, S3Interface } from \"./s3.interface\";\n\nexport class S3 extends AbstractApiData implements S3Interface {\n private _url?: string;\n private _storageType?: string;\n private _contentType?: string;\n private _blobType?: string;\n private _acl?: string;\n\n get url(): string {\n if (!this._url) throw new Error(\"Image URL is not set.\");\n return this._url;\n }\n\n get headers(): Record<string, string> {\n const headers: Record<string, string> = {};\n\n if (this._contentType) {\n headers[\"Content-Type\"] = this._contentType;\n }\n\n if (this._blobType) {\n headers[\"x-ms-blob-type\"] = this._blobType;\n }\n\n if (this._acl) {\n headers[\"x-amz-acl\"] = this._acl;\n }\n\n return headers;\n }\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._url = data.jsonApi.attributes.url ?? undefined;\n this._storageType = data.jsonApi.attributes.storageType ?? undefined;\n this._contentType = data.jsonApi.attributes.contentType ?? undefined;\n this._blobType = data.jsonApi.attributes.blobType ?? undefined;\n this._acl = data.jsonApi.attributes.acl ?? undefined;\n\n return this;\n }\n\n createJsonApi(data: S3Input) {\n const response: any = {\n data: {\n type: Modules.S3.name,\n attributes: {\n key: data.key,\n },\n },\n included: [],\n };\n\n if (data.contentType) response.data.attributes.contentType = data.contentType;\n\n return response;\n }\n}\n","import { ModuleFactory } from \"../../permissions\";\nimport { S3 } from \"./data/s3\";\n\nexport const S3Module = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/s3\",\n name: \"s3\",\n model: S3,\n moduleId: \"db41ba46-e171-4324-8845-99353eba8568\",\n });\n","import { AbstractService, EndpointCreator, HttpMethod, Modules } from \"../../../core\";\nimport { S3Interface } from \"./s3.interface\";\n\nexport class S3Service extends AbstractService {\n static async getPreSignedUrl(params: { key: string; contentType: string; isPublic?: boolean }): Promise<S3Interface> {\n const endpoint = new EndpointCreator({ endpoint: Modules.S3 })\n .addAdditionalParam(\"key\", params.key)\n .addAdditionalParam(\"contentType\", params.contentType);\n\n if (params.isPublic) endpoint.addAdditionalParam(\"isPublic\", \"true\");\n\n return this.callApi<S3Interface>({ type: Modules.S3, method: HttpMethod.GET, endpoint: endpoint.generate() });\n }\n\n static async getSignedUrl(params: { key: string; isPublic?: boolean }): Promise<S3Interface> {\n const endpoint = new EndpointCreator({ endpoint: Modules.S3, id: \"sign\" }).addAdditionalParam(\"key\", params.key);\n\n if (params.isPublic) endpoint.addAdditionalParam(\"isPublic\", \"true\");\n\n return this.callApi<S3Interface>({ type: Modules.S3, method: HttpMethod.GET, endpoint: endpoint.generate() });\n }\n\n static async deleteFile(params: { key: string }): Promise<void> {\n this.callApi<S3Interface>({\n type: Modules.S3,\n method: HttpMethod.DELETE,\n endpoint: new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam(\"key\", params.key).generate(),\n });\n }\n}\n","import { AbstractApiData, JsonApiHydratedDataInterface, Modules } from \"../../../core\";\nimport { CompanyInterface } from \"../../company\";\nimport { ModuleInterface } from \"../../module\";\nimport { RoleInterface } from \"../../role\";\nimport { SearchResultInterface } from \"../../search\";\nimport { UserInput, UserInterface } from \"./user.interface\";\n\nexport class User extends AbstractApiData implements UserInterface, SearchResultInterface {\n private _name?: string;\n private _email?: string;\n private _title?: string;\n private _bio?: string;\n private _avatar?: string;\n private _avatarUrl?: string;\n private _phone?: string;\n private _rate?: number;\n\n private _isActivated?: boolean;\n private _isDeleted?: boolean;\n private _lastLogin?: Date;\n\n private _relevance?: number;\n\n private _roles: RoleInterface[] = [];\n private _company?: CompanyInterface;\n private _modules: ModuleInterface[] = [];\n\n get searchResult(): string {\n return this._name ?? \"\";\n }\n\n get name(): string {\n return this._name ?? \"\";\n }\n\n get email(): string {\n return this._email ?? \"\";\n }\n\n get title(): string {\n return this._title ?? \"\";\n }\n\n get bio(): string {\n return this._bio ?? \"\";\n }\n\n get avatar(): string | undefined {\n return this._avatar;\n }\n\n get avatarUrl(): string | undefined {\n return this._avatarUrl;\n }\n\n get phone(): string | undefined {\n return this._phone;\n }\n\n get rate(): number | undefined {\n return this._rate;\n }\n\n get relevance(): number | undefined {\n return this._relevance;\n }\n\n get isActivated(): boolean {\n return this._isActivated ?? false;\n }\n\n get isDeleted(): boolean {\n return this._isDeleted ?? false;\n }\n\n get lastLogin(): Date | undefined {\n return this._lastLogin;\n }\n\n get roles(): RoleInterface[] {\n return this._roles;\n }\n\n get company(): CompanyInterface | undefined {\n return this._company;\n }\n\n get modules(): ModuleInterface[] {\n return this._modules;\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n this._name = data.jsonApi.attributes.name;\n this._email = data.jsonApi.attributes.email;\n this._title = data.jsonApi.attributes.title;\n this._bio = data.jsonApi.attributes.bio;\n this._phone = data.jsonApi.attributes.phone;\n this._rate = data.jsonApi.attributes.rate;\n\n this._avatar = data.jsonApi.attributes.avatar;\n this._avatarUrl = data.jsonApi.attributes.avatarUrl;\n\n this._isActivated = data.jsonApi.meta.isActive;\n this._isDeleted = data.jsonApi.meta.isDeleted;\n this._lastLogin = data.jsonApi.meta.lastLogin ? new Date(data.jsonApi.meta.lastLogin) : undefined;\n\n this._relevance = data.jsonApi.meta.relevance;\n\n this._roles = this._readIncluded(data, \"roles\", Modules.Role) as RoleInterface[];\n this._company = this._readIncluded(data, \"company\", Modules.Company) as CompanyInterface;\n this._modules = this._readIncluded(data, \"modules\", Modules.Module) as ModuleInterface[];\n\n return this;\n }\n\n createJsonApi(data: UserInput) {\n const response: any = {\n data: {\n type: Modules.User.name,\n id: data.id,\n attributes: {\n name: data.name,\n },\n meta: {},\n relationships: {},\n },\n included: [],\n };\n\n if (data.email !== undefined) response.data.attributes.email = data.email;\n if (data.title !== undefined) response.data.attributes.title = data.title;\n if (data.bio !== undefined) response.data.attributes.bio = data.bio;\n if (data.phone !== undefined) response.data.attributes.phone = data.phone;\n if (data.password !== undefined) response.data.attributes.password = data.password;\n if (data.sendInvitationEmail) response.data.attributes.sendInvitationEmail = true;\n if (data.adminCreated) response.data.attributes.adminCreated = true;\n if (data.avatar) response.data.attributes.avatar = data.avatar;\n if (data.rate !== undefined) response.data.attributes.rate = data.rate;\n\n if (data.roleIds) {\n response.data.relationships.roles = {\n data: data.roleIds.map((roleId) => ({\n type: Modules.Role.name,\n id: roleId,\n })),\n };\n }\n\n if (data.companyId) {\n response.data.relationships.company = {\n data: {\n type: Modules.Company.name,\n id: data.companyId,\n },\n };\n }\n\n return response;\n }\n}\n","export enum UserFields {\n userId = \"userId\",\n name = \"name\",\n email = \"email\",\n relevance = \"relevance\",\n createdAt = \"createdAt\",\n updatedAt = \"updatedAt\",\n}\n","import { AbstractService, EndpointCreator, HttpMethod, Modules, NextRef, PreviousRef } from \"../../../core\";\nimport { UserInput, UserInterface } from \"./user.interface\";\n\nexport class UserService extends AbstractService {\n static async findFullUser(): Promise<UserInterface> {\n const endpoint = new EndpointCreator({ endpoint: Modules.User, id: \"me\", childEndpoint: \"full\" });\n\n return this.callApi<UserInterface>({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n });\n }\n\n static async findById(params: { userId: string }): Promise<UserInterface> {\n return this.callApi<UserInterface>({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),\n });\n }\n\n static async findByEmail(params: { email: string }): Promise<UserInterface> {\n const endpoint = new EndpointCreator({ endpoint: Modules.User, id: \"email\", childEndpoint: params.email });\n\n return this.callApi<UserInterface>({ type: Modules.User, method: HttpMethod.GET, endpoint: endpoint.generate() });\n }\n\n static async findMany(params: {\n roleId?: string;\n search?: string;\n fetchAll?: boolean;\n includeDeleted?: boolean;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.User });\n\n if (params.roleId) endpoint.addAdditionalParam(\"roleId\", params.roleId);\n\n if (params.includeDeleted) endpoint.addAdditionalParam(\"includeDeleted\", \"true\");\n if (params.fetchAll) endpoint.addAdditionalParam(\"fetchAll\", \"true\");\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findManyByContentIds(params: {\n contentIds: string[];\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.User });\n\n endpoint.addAdditionalParam(\"contentIds\", params.contentIds.map((id) => id).join(\",\"));\n endpoint.addAdditionalParam(\"includeDeleted\", \"true\");\n endpoint.addAdditionalParam(\"fetchAll\", \"true\");\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findRelevant(params: { id: string; next?: NextRef; prev?: PreviousRef }): Promise<UserInterface[]> {\n const endpoint: EndpointCreator = new EndpointCreator({\n endpoint: Modules.Content,\n id: params.id,\n childEndpoint: \"user-relevance\",\n });\n\n if (Modules.User.inclusions?.lists?.fields) endpoint.limitToFields(Modules.User.inclusions.lists.fields);\n if (Modules.User.inclusions?.lists?.types) endpoint.limitToType(Modules.User.inclusions.lists.types);\n\n return this.callApi<UserInterface[]>({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findManyForAmin(params: {\n companyId?: string;\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n if (!params.companyId) return [];\n\n const endpoint = new EndpointCreator({\n endpoint: Modules.Company,\n id: params.companyId,\n childEndpoint: Modules.User,\n });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n previous: params.prev,\n });\n }\n\n static async findAllUsers(params: {\n companyId: string;\n search?: string;\n limitToRoles?: string[];\n isDeleted?: boolean;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.Company,\n id: params.companyId,\n childEndpoint: Modules.User,\n });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n if (params.isDeleted) endpoint.addAdditionalParam(\"isDeleted\", \"true\");\n if (params.limitToRoles && params.limitToRoles.length > 0)\n endpoint.addAdditionalParam(\"limitToRoles\", params.limitToRoles.join(\",\"));\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findAllUsersByRole(params: {\n roleId: string;\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n const endpoint = new EndpointCreator({ endpoint: Modules.Role, id: params.roleId, childEndpoint: Modules.User });\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async findAllUsersNotInRole(params: {\n roleId: string;\n search?: string;\n next?: NextRef;\n prev?: PreviousRef;\n }): Promise<UserInterface[]> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.Role,\n id: params.roleId,\n childEndpoint: Modules.User,\n }).addAdditionalParam(\"notInRole\", \"true\");\n\n if (params.search) endpoint.addAdditionalParam(\"search\", params.search);\n\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.GET,\n endpoint: endpoint.generate(),\n next: params.next,\n });\n }\n\n static async create(params: UserInput): Promise<UserInterface> {\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.POST,\n endpoint: new EndpointCreator({ endpoint: Modules.User }).generate(),\n companyId: params.companyId,\n input: params,\n });\n }\n\n static async reactivate(params: { userId: string }): Promise<UserInterface> {\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.PATCH,\n endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),\n });\n }\n\n static async sendInvitation(params: { userId: string; companyId?: string }): Promise<void> {\n const endpoint = new EndpointCreator({\n endpoint: Modules.User,\n id: params.userId,\n childEndpoint: \"send-invitation-email\",\n });\n\n if (params.companyId) endpoint.addAdditionalParam(\"companyId\", params.companyId);\n\n this.callApi({\n type: Modules.User,\n method: HttpMethod.POST,\n endpoint: endpoint.generate(),\n });\n }\n\n static async update(params: UserInput): Promise<UserInterface> {\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.PUT,\n endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id }).generate(),\n companyId: params.companyId,\n input: params,\n });\n }\n\n static async patchRate(params: UserInput): Promise<UserInterface> {\n return this.callApi({\n type: Modules.User,\n method: HttpMethod.PATCH,\n endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id, childEndpoint: \"rates\" }).generate(),\n companyId: params.companyId,\n input: params,\n });\n }\n\n static async delete(params: { userId: string; companyId: string }): Promise<void> {\n await this.callApi({\n type: Modules.User,\n method: HttpMethod.DELETE,\n endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),\n companyId: params.companyId,\n });\n }\n}\n","import { User } from \"./data/user\";\nimport { createJsonApiInclusion } from \"../../core\";\nimport { ModuleFactory } from \"../../permissions\";\n\nexport const UserModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/users\",\n name: \"users\",\n model: User,\n moduleId: \"04cfc677-0fd2-4f5e-adf4-2483a00c0277\",\n inclusions: {\n lists: {\n fields: [\n createJsonApiInclusion(\"users\", [`name`, `email`, `avatar`, `title`]),\n createJsonApiInclusion(\"usertopics\", [`level`]),\n createJsonApiInclusion(\"userexpertises\", [`level`]),\n createJsonApiInclusion(\"topics\", [`name`]),\n ],\n },\n },\n });\n","import { ModuleFactory } from \"../../permissions\";\nimport { User } from \"./data\";\n\nexport const AuthorModule = (factory: ModuleFactory) =>\n factory({\n pageUrl: \"/authors\",\n name: \"authors\",\n model: User,\n moduleId: \"04cfc677-0fd2-4f5e-adf4-2483a00c0277\",\n });\n"]}