@carlonicora/nextjs-jsonapi 4.0.4 → 4.0.5

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 (63) hide show
  1. package/dist/{BlockNoteEditor-BXMTGKDV.js → BlockNoteEditor-H6EXQD46.js} +20 -20
  2. package/dist/{BlockNoteEditor-BXMTGKDV.js.map → BlockNoteEditor-H6EXQD46.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-FGVQP35E.mjs → BlockNoteEditor-L3STMBP2.mjs} +5 -5
  4. package/dist/{BlockNoteViewer-DQYT6IJW.mjs → BlockNoteViewer-4THJHQMK.mjs} +3 -3
  5. package/dist/{BlockNoteViewer-YH7G66PS.js → BlockNoteViewer-TEC7DN2N.js} +4 -4
  6. package/dist/{BlockNoteViewer-YH7G66PS.js.map → BlockNoteViewer-TEC7DN2N.js.map} +1 -1
  7. package/dist/{JsonApiRequest-MEP6AXDT.mjs → JsonApiRequest-A66XK5WT.mjs} +2 -2
  8. package/dist/JsonApiRequest-FZGPLNUF.js +26 -0
  9. package/dist/{JsonApiRequest-OB6WL4LA.js.map → JsonApiRequest-FZGPLNUF.js.map} +1 -1
  10. package/dist/billing/index.js +400 -400
  11. package/dist/billing/index.mjs +4 -4
  12. package/dist/{chunk-NFCXUAE6.js → chunk-3JET3LL7.js} +837 -837
  13. package/dist/{chunk-NFCXUAE6.js.map → chunk-3JET3LL7.js.map} +1 -1
  14. package/dist/{chunk-6OFANJTE.js → chunk-5PNDDYGL.js} +32 -32
  15. package/dist/{chunk-6OFANJTE.js.map → chunk-5PNDDYGL.js.map} +1 -1
  16. package/dist/{chunk-5W5MN7JP.js → chunk-7ZRQOLSV.js} +13 -13
  17. package/dist/{chunk-5W5MN7JP.js.map → chunk-7ZRQOLSV.js.map} +1 -1
  18. package/dist/{chunk-TWBZ2GSX.js → chunk-C2WQXUL5.js} +3 -3
  19. package/dist/{chunk-TWBZ2GSX.js.map → chunk-C2WQXUL5.js.map} +1 -1
  20. package/dist/{chunk-JEQ34Z5E.js → chunk-DYTKNSHY.js} +15 -15
  21. package/dist/{chunk-JEQ34Z5E.js.map → chunk-DYTKNSHY.js.map} +1 -1
  22. package/dist/{chunk-WGVNJXZO.js → chunk-GHE4VT2R.js} +12 -12
  23. package/dist/{chunk-WGVNJXZO.js.map → chunk-GHE4VT2R.js.map} +1 -1
  24. package/dist/{chunk-3CZ2GK5R.mjs → chunk-IOG22OAO.mjs} +3 -3
  25. package/dist/{chunk-WJC4SYRL.mjs → chunk-KX2776OK.mjs} +8 -8
  26. package/dist/{chunk-R6ZYB4VN.mjs → chunk-RDI62FAT.mjs} +2 -2
  27. package/dist/{chunk-7SCREMTX.mjs → chunk-V5MI7RNB.mjs} +2 -2
  28. package/dist/chunk-V5MI7RNB.mjs.map +1 -0
  29. package/dist/{chunk-ADZSH3MG.mjs → chunk-XTOEN5GN.mjs} +3 -3
  30. package/dist/{chunk-AQZ3T4BR.mjs → chunk-Z3226FM6.mjs} +5 -5
  31. package/dist/client/index.js +5 -5
  32. package/dist/client/index.mjs +4 -4
  33. package/dist/components/index.js +5 -5
  34. package/dist/components/index.mjs +4 -4
  35. package/dist/contexts/index.js +5 -5
  36. package/dist/contexts/index.mjs +4 -4
  37. package/dist/core/index.js +3 -3
  38. package/dist/core/index.mjs +2 -2
  39. package/dist/features/analytics/index.js +123 -123
  40. package/dist/features/analytics/index.mjs +5 -5
  41. package/dist/features/analytics/server.js +5 -5
  42. package/dist/features/analytics/server.mjs +3 -3
  43. package/dist/features/help/index.js +38 -38
  44. package/dist/features/help/index.mjs +4 -4
  45. package/dist/features/tokenusage/index.js +126 -126
  46. package/dist/features/tokenusage/index.mjs +5 -5
  47. package/dist/index.js +4 -4
  48. package/dist/index.mjs +3 -3
  49. package/dist/server/index.js +4 -4
  50. package/dist/server/index.mjs +3 -3
  51. package/package.json +1 -1
  52. package/src/core/utils/__tests__/translateResponse.test.ts +17 -0
  53. package/src/core/utils/translateResponse.ts +7 -3
  54. package/dist/JsonApiRequest-OB6WL4LA.js +0 -26
  55. package/dist/chunk-7SCREMTX.mjs.map +0 -1
  56. /package/dist/{BlockNoteEditor-FGVQP35E.mjs.map → BlockNoteEditor-L3STMBP2.mjs.map} +0 -0
  57. /package/dist/{BlockNoteViewer-DQYT6IJW.mjs.map → BlockNoteViewer-4THJHQMK.mjs.map} +0 -0
  58. /package/dist/{JsonApiRequest-MEP6AXDT.mjs.map → JsonApiRequest-A66XK5WT.mjs.map} +0 -0
  59. /package/dist/{chunk-3CZ2GK5R.mjs.map → chunk-IOG22OAO.mjs.map} +0 -0
  60. /package/dist/{chunk-WJC4SYRL.mjs.map → chunk-KX2776OK.mjs.map} +0 -0
  61. /package/dist/{chunk-R6ZYB4VN.mjs.map → chunk-RDI62FAT.mjs.map} +0 -0
  62. /package/dist/{chunk-ADZSH3MG.mjs.map → chunk-XTOEN5GN.mjs.map} +0 -0
  63. /package/dist/{chunk-AQZ3T4BR.mjs.map → chunk-Z3226FM6.mjs.map} +0 -0
@@ -209,14 +209,14 @@ async function translateResponse(params) {
209
209
  response.ok = params.apiResponse.ok;
210
210
  response.response = params.apiResponse.status;
211
211
  if (!params.apiResponse.ok) {
212
- response.error = _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'access', _5 => _5.apiResponse, 'optionalAccess', _6 => _6.data, 'optionalAccess', _7 => _7.message]), () => ( _optionalChain([params, 'access', _8 => _8.apiResponse, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.error]))), () => ( params.apiResponse.statusText));
212
+ response.error = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'access', _5 => _5.apiResponse, 'optionalAccess', _6 => _6.data, 'optionalAccess', _7 => _7.errors, 'optionalAccess', _8 => _8[0], 'optionalAccess', _9 => _9.detail]), () => ( _optionalChain([params, 'access', _10 => _10.apiResponse, 'optionalAccess', _11 => _11.data, 'optionalAccess', _12 => _12.message]))), () => ( _optionalChain([params, 'access', _13 => _13.apiResponse, 'optionalAccess', _14 => _14.data, 'optionalAccess', _15 => _15.error]))), () => ( params.apiResponse.statusText));
213
213
  response.raw = params.apiResponse.data;
214
214
  return response;
215
215
  }
216
216
  if (params.apiResponse.status === 204) return response;
217
217
  if (params.apiResponse.data === void 0 || params.apiResponse.data === null) return response;
218
218
  response.raw = params.apiResponse.data;
219
- if (_optionalChain([params, 'access', _11 => _11.apiResponse, 'access', _12 => _12.data, 'optionalAccess', _13 => _13.meta])) {
219
+ if (_optionalChain([params, 'access', _16 => _16.apiResponse, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.meta])) {
220
220
  response.meta = params.apiResponse.data.meta;
221
221
  }
222
222
  try {
@@ -325,7 +325,7 @@ async function makeRequest(params) {
325
325
  }
326
326
  _chunk7QVYU63Ejs.__name.call(void 0, makeRequest, "makeRequest");
327
327
  function getApiUrl() {
328
- if (_optionalChain([_staticConfig, 'optionalAccess', _14 => _14.apiUrl])) {
328
+ if (_optionalChain([_staticConfig, 'optionalAccess', _19 => _19.apiUrl])) {
329
329
  return _staticConfig.apiUrl;
330
330
  }
331
331
  const envUrl = ENV.API_URL;
@@ -336,7 +336,7 @@ function getApiUrl() {
336
336
  }
337
337
  _chunk7QVYU63Ejs.__name.call(void 0, getApiUrl, "getApiUrl");
338
338
  function getAppUrl() {
339
- if (_optionalChain([_staticConfig, 'optionalAccess', _15 => _15.appUrl])) {
339
+ if (_optionalChain([_staticConfig, 'optionalAccess', _20 => _20.appUrl])) {
340
340
  return _staticConfig.appUrl;
341
341
  }
342
342
  const envUrl = ENV.APP_URL;
@@ -349,11 +349,11 @@ function getAppUrl() {
349
349
  }
350
350
  _chunk7QVYU63Ejs.__name.call(void 0, getAppUrl, "getAppUrl");
351
351
  function getTrackablePages() {
352
- return _nullishCoalesce(_optionalChain([_staticConfig, 'optionalAccess', _16 => _16.trackablePages]), () => ( []));
352
+ return _nullishCoalesce(_optionalChain([_staticConfig, 'optionalAccess', _21 => _21.trackablePages]), () => ( []));
353
353
  }
354
354
  _chunk7QVYU63Ejs.__name.call(void 0, getTrackablePages, "getTrackablePages");
355
355
  function runBootstrapper() {
356
- if (_optionalChain([_staticConfig, 'optionalAccess', _17 => _17.bootstrapper])) {
356
+ if (_optionalChain([_staticConfig, 'optionalAccess', _22 => _22.bootstrapper])) {
357
357
  _staticConfig.bootstrapper();
358
358
  }
359
359
  }
@@ -375,7 +375,7 @@ async function JsonApiGet(params) {
375
375
  cache: params.classKey.cache,
376
376
  companyId: params.companyId,
377
377
  language: params.language,
378
- additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _18 => _18.additionalHeaders])
378
+ additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _23 => _23.additionalHeaders])
379
379
  });
380
380
  return translateResponse({
381
381
  classKey: params.classKey,
@@ -410,7 +410,7 @@ async function JsonApiPost(params) {
410
410
  files: params.files,
411
411
  companyId: params.companyId,
412
412
  language: params.language,
413
- additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _19 => _19.additionalHeaders])
413
+ additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _24 => _24.additionalHeaders])
414
414
  });
415
415
  return translateResponse({
416
416
  classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
@@ -437,7 +437,7 @@ async function JsonApiPut(params) {
437
437
  files: params.files,
438
438
  companyId: params.companyId,
439
439
  language: params.language,
440
- additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _20 => _20.additionalHeaders])
440
+ additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _25 => _25.additionalHeaders])
441
441
  });
442
442
  return translateResponse({
443
443
  classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
@@ -464,7 +464,7 @@ async function JsonApiPatch(params) {
464
464
  files: params.files,
465
465
  companyId: params.companyId,
466
466
  language: params.language,
467
- additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _21 => _21.additionalHeaders])
467
+ additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _26 => _26.additionalHeaders])
468
468
  });
469
469
  return translateResponse({
470
470
  classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
@@ -483,7 +483,7 @@ async function JsonApiDelete(params) {
483
483
  token,
484
484
  companyId: params.companyId,
485
485
  language: params.language,
486
- additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _22 => _22.additionalHeaders])
486
+ additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _27 => _27.additionalHeaders])
487
487
  });
488
488
  return translateResponse({
489
489
  classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
@@ -516,4 +516,4 @@ _chunk7QVYU63Ejs.__name.call(void 0, JsonApiDelete, "JsonApiDelete");
516
516
 
517
517
 
518
518
  exports.ENV = ENV; exports.DataClassRegistry = DataClassRegistry; exports.JsonApiDataFactory = JsonApiDataFactory; exports.setBootstrapper = setBootstrapper; exports.getBootstrapper = getBootstrapper; exports.tryBootstrap = tryBootstrap; exports.hasBootstrapper = hasBootstrapper; exports.resetBootstrapStore = resetBootstrapStore; exports.translateData = translateData; exports.translateResponse = translateResponse; exports.configureJsonApi = configureJsonApi; exports.getApiUrl = getApiUrl; exports.getAppUrl = getAppUrl; exports.getTrackablePages = getTrackablePages; exports.buildUrl = buildUrl; exports.JsonApiGet = JsonApiGet; exports.JsonApiPost = JsonApiPost; exports.JsonApiPut = JsonApiPut; exports.JsonApiPatch = JsonApiPatch; exports.JsonApiDelete = JsonApiDelete;
519
- //# sourceMappingURL=chunk-WGVNJXZO.js.map
519
+ //# sourceMappingURL=chunk-GHE4VT2R.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-WGVNJXZO.js","../src/core/env.ts","../src/core/registry/DataClassRegistry.ts","../src/core/factories/JsonApiDataFactory.ts","../src/core/registry/bootstrapStore.ts","../src/core/utils/translateResponse.ts","../src/unified/JsonApiRequest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;A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A;AACiB,EAAA;AAGpC,EAAA;AAAyB,IAAA;AACiB,IAAA;AACxC,IAAA;AACkB,IAAA;AACD,EAAA;AAErB;AA3BsB;ANqJtB;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-WGVNJXZO.js","sourcesContent":[null,"/**\n * The single place in this package that reads `process.env`.\n *\n * Everything else imports {@link ENV}. Centralising the reads keeps every\n * default in one place — the same contract `base.config.ts` provides on the\n * NestJS side — instead of scattering `process.env.X || \"…\"` across hooks,\n * clients and components where the fallbacks silently drift apart.\n *\n * WHY THE READS MUST STAY LITERAL: Next.js inlines `NEXT_PUBLIC_*` by textual\n * substitution at build time, replacing the exact expression\n * `process.env.NEXT_PUBLIC_FOO` with a string literal. A computed lookup\n * (`process.env[key]`) is NOT substituted and reads as `undefined` in the\n * browser bundle. Every entry below therefore spells its variable out in full,\n * and new entries must do the same.\n *\n * WHY GETTERS AND NOT PLAIN PROPERTIES: every call site this replaced read\n * `process.env` at CALL time, not at import time. A plain property would freeze\n * the value when the module is first imported, which breaks any consumer that\n * assigns the variable after boot — the package's own tests do exactly that.\n * Getters keep the read lazy while leaving the expression literal, so the build\n * time substitution still applies.\n *\n * Because that substitution happens before the code runs, no reference to\n * `process` survives into the client bundle — so this module is safe to import\n * from client components, server components, route handlers and middleware\n * alike. It deliberately carries no `\"use client\"` directive for that reason.\n *\n * Values are normalised (empty string rather than `undefined`, booleans rather\n * than string comparisons) so callers never repeat the parsing. Callers that\n * must distinguish \"unset\" from \"set to empty\" — the URL getters, which throw a\n * configuration error — check for an empty string.\n */\nexport const ENV = {\n /** Public API base URL (NEXT_PUBLIC_API_URL). Empty when unset. */\n get API_URL(): string {\n return process.env.NEXT_PUBLIC_API_URL ?? \"\";\n },\n /** Public app base URL (NEXT_PUBLIC_ADDRESS). Empty when unset. */\n get APP_URL(): string {\n return process.env.NEXT_PUBLIC_ADDRESS ?? \"\";\n },\n /**\n * Alternative app base URL (NEXT_PUBLIC_APP_URL), used only by\n * `client/config.ts`'s `getAppUrl()` before it falls back to\n * `window.location.origin`. Empty when unset.\n */\n get APP_URL_ALTERNATE(): string {\n return process.env.NEXT_PUBLIC_APP_URL ?? \"\";\n },\n /** Web-push VAPID public key (NEXT_PUBLIC_VAPID_PUBLIC_KEY). Empty when unset. */\n get VAPID_PUBLIC_KEY(): string {\n return process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? \"\";\n },\n /** Google Maps JS key (NEXT_PUBLIC_GOOGLE_MAPS_API_KEY). Empty disables autocomplete. */\n get GOOGLE_MAPS_API_KEY(): string {\n return process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? \"\";\n },\n /**\n * NEXT_PUBLIC_PRIVATE_INSTALLATION === \"true\", case-insensitively\n * (default false). A private installation is a single-tenant deployment.\n */\n get PRIVATE_INSTALLATION(): boolean {\n return process.env.NEXT_PUBLIC_PRIVATE_INSTALLATION?.toLowerCase() === \"true\";\n },\n /** NODE_ENV === \"production\" — set by the Next build, not by `.env`. */\n get IS_PRODUCTION(): boolean {\n return process.env.NODE_ENV === \"production\";\n },\n /** NODE_ENV === \"development\" — gates verbose client-side diagnostics. */\n get IS_DEVELOPMENT(): boolean {\n return process.env.NODE_ENV === \"development\";\n },\n};\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport class DataClassRegistry {\n // Use Map with string key (module.name) for reliable lookup\n // String keys are stable across HMR and module re-evaluations\n // Note: WeakMap with object identity was tried but fails during Next.js navigation\n // because module re-evaluation creates new object instances with different identity\n private static _map = new Map<string, { new (): ApiDataInterface }>();\n\n public static registerObjectClass(\n key: ApiRequestDataTypeInterface,\n classConstructor: { new (): ApiDataInterface },\n ): void {\n // Last registration wins. An earlier version skipped re-registration, which\n // silently pinned the registry to the FIRST constructor seen by the process.\n // In dev that made a long-lived `next dev` server keep rehydrating with the\n // pre-edit class after any model change, so SSR produced a different tree\n // from the freshly bundled client and React threw a hydration mismatch.\n // Production is unaffected either way: bootstrap runs once per process.\n this._map.set(key.name, classConstructor);\n }\n\n public static get(classKey: ApiRequestDataTypeInterface): {\n new (): ApiDataInterface;\n } {\n const response = this._map.get(classKey.name);\n if (!response) {\n throw new Error(\n `Class not registered for key: ${typeof classKey === \"string\" ? classKey : classKey.name}. Ensure bootstrap() was called.`,\n );\n }\n\n return response;\n }\n\n /**\n * Get class constructor by JSON:API type name.\n * Used for polymorphic rehydration where the type is determined at runtime.\n */\n public static getByJsonApiType(typeName: string): { new (): ApiDataInterface } | undefined {\n return this._map.get(typeName);\n }\n\n /**\n * Bootstrap the registry with all modules.\n * This is a convenience method for apps to register all their modules at once.\n *\n * @param modules - An object with module definitions (like the app's Modules class)\n */\n public static bootstrap(modules: Record<string, ApiRequestDataTypeInterface>): void {\n Object.values(modules).forEach((module) => {\n if (module && module.model) {\n this.registerObjectClass(module, module.model);\n }\n });\n }\n\n /**\n * Clear all registered classes. Useful for testing.\n */\n public static clear(): void {\n this._map.clear();\n }\n}\n\n// Export alias for backward compatibility\nexport { DataClassRegistry as DataClass };\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class JsonApiDataFactory {\n public static create(classKey: ApiRequestDataTypeInterface, data: any): any {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass() as ApiDataInterface;\n const result = instance.createJsonApi(data);\n return result;\n }\n}\n","/**\n * Centralized bootstrap store accessible from ModuleRegistry.\n * This file has NO external dependencies to avoid circular imports.\n *\n * The bootstrap store allows ModuleRegistry to call the app's bootstrapper\n * when modules are accessed before bootstrap() was called, providing\n * self-healing behavior for module evaluation order issues.\n *\n * IMPORTANT: We use globalThis to persist state across HMR/Turbopack\n * module re-evaluations in development mode. Without this, the bootstrapper\n * reference would be lost when modules are hot-reloaded, causing\n * \"Module not registered\" errors during navigation.\n */\n\ntype BootstrapperFn = () => void;\n\n// Symbol key to avoid conflicts with other globals\nconst BOOTSTRAP_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapper\");\nconst BOOTSTRAP_ATTEMPTED_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapAttempted\");\n\n// Use globalThis to persist across HMR reloads\nconst globalStore = globalThis as unknown as {\n [BOOTSTRAP_KEY]?: BootstrapperFn | null;\n [BOOTSTRAP_ATTEMPTED_KEY]?: boolean;\n};\n\n// Initialize from global if not set\nif (globalStore[BOOTSTRAP_KEY] === undefined) {\n globalStore[BOOTSTRAP_KEY] = null;\n}\nif (globalStore[BOOTSTRAP_ATTEMPTED_KEY] === undefined) {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = false;\n}\n\n// Getters/setters that use the global store\nfunction getBootstrapperInternal(): BootstrapperFn | null {\n return globalStore[BOOTSTRAP_KEY] ?? null;\n}\n\nfunction setBootstrapperInternal(fn: BootstrapperFn | null): void {\n globalStore[BOOTSTRAP_KEY] = fn;\n}\n\nfunction getBootstrapAttempted(): boolean {\n return globalStore[BOOTSTRAP_ATTEMPTED_KEY] ?? false;\n}\n\nfunction setBootstrapAttempted(value: boolean): void {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = value;\n}\n\n/**\n * Register the bootstrapper function.\n * Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.\n */\nexport function setBootstrapper(fn: BootstrapperFn): void {\n setBootstrapperInternal(fn);\n}\n\n/**\n * Get the registered bootstrapper function.\n * Returns null if no bootstrapper has been registered.\n */\nexport function getBootstrapper(): BootstrapperFn | null {\n return getBootstrapperInternal();\n}\n\n/**\n * Attempt to run the bootstrapper if one is registered.\n * Returns true if bootstrapper was executed, false if not available.\n * Safe to call multiple times - bootstrapper is expected to be idempotent.\n */\nexport function tryBootstrap(): boolean {\n const bootstrapper = getBootstrapperInternal();\n const attempted = getBootstrapAttempted();\n\n if (attempted && !bootstrapper) {\n // Already tried and no bootstrapper available\n return false;\n }\n setBootstrapAttempted(true);\n\n if (bootstrapper) {\n bootstrapper();\n return true;\n }\n return false;\n}\n\n/**\n * Check if a bootstrapper has been registered.\n */\nexport function hasBootstrapper(): boolean {\n return getBootstrapperInternal() !== null;\n}\n\n/**\n * Reset the bootstrap store. Useful for testing.\n */\nexport function resetBootstrapStore(): void {\n setBootstrapperInternal(null);\n setBootstrapAttempted(false);\n}\n","import { ApiData } from \"../interfaces/ApiData\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * Translates raw JSON:API data into typed objects.\n * Does not require API response metadata.\n */\nexport function translateData<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n data: any;\n}): T | T[] {\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n const included: any = params.data.included ?? [];\n\n if (Array.isArray(params.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.data.data });\n responseData.push(object as T);\n }\n\n return responseData as T[];\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.data.data,\n included: included,\n });\n\n return responseData as T;\n }\n}\n\n/**\n * Translates a full API response into a typed ApiResponseInterface.\n * Includes pagination support.\n */\nexport async function translateResponse<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n apiResponse: ApiData;\n companyId?: string;\n language: string;\n paginationHandler?: (endpoint: string) => Promise<ApiResponseInterface>;\n}): Promise<ApiResponseInterface> {\n const response: ApiResponseInterface = {\n ok: true,\n response: 0,\n data: [],\n error: \"\",\n };\n\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n response.ok = params.apiResponse.ok;\n response.response = params.apiResponse.status;\n\n if (!params.apiResponse.ok) {\n // `statusText` is empty over HTTP/2 (the reason phrase was removed from the protocol), so the\n // body is the only reliable source of error text. APIs in this stack use either key.\n response.error =\n params.apiResponse?.data?.message ?? params.apiResponse?.data?.error ?? params.apiResponse.statusText;\n response.raw = params.apiResponse.data;\n return response;\n }\n\n if (params.apiResponse.status === 204) return response;\n\n // A success with no body (e.g. a 200 from a handler that sends nothing —\n // @HttpCode is inert when a controller injects @Res, so \"204\" endpoints can\n // arrive as empty 200s) translates to an empty success, not a crash on\n // `.included` below.\n if (params.apiResponse.data === undefined || params.apiResponse.data === null) return response;\n\n response.raw = params.apiResponse.data;\n\n // Extract meta from JSON:API response\n if (params.apiResponse.data?.meta) {\n response.meta = params.apiResponse.data.meta;\n }\n\n try {\n // Check if response is JSON:API formatted (has a 'data' property)\n // If not, return the raw response data directly (e.g., { url: \"...\" } or { clientSecret: \"...\" })\n if (\n params.apiResponse.data &&\n typeof params.apiResponse.data === \"object\" &&\n !Array.isArray(params.apiResponse.data) &&\n params.apiResponse.data.data === undefined\n ) {\n response.data = params.apiResponse.data;\n return response;\n }\n\n const included: any = params.apiResponse.data.included ?? [];\n\n if (params.apiResponse.data.links) {\n response.self = params.apiResponse.data.links.self;\n\n if (params.apiResponse.data.links.next && params.paginationHandler) {\n response.next = params.apiResponse.data.links.next;\n response.nextPage = async () => params.paginationHandler!(params.apiResponse.data.links.next);\n }\n\n if (params.apiResponse.data.links.prev && params.paginationHandler) {\n response.prev = params.apiResponse.data.links.prev;\n response.prevPage = async () => params.paginationHandler!(params.apiResponse.data.links.prev);\n }\n }\n\n if (Array.isArray(params.apiResponse.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.apiResponse.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.apiResponse.data.data });\n responseData.push(object as T);\n }\n\n response.data = responseData;\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.apiResponse.data.data,\n included: included,\n });\n\n response.data = responseData;\n }\n } catch (e) {\n console.error(e);\n }\n\n return response;\n}\n","import { ENV } from \"../core/env\";\nimport { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\n\n// Type definitions for dynamically imported functions (avoiding typeof import to prevent bundling)\ntype DirectFetchFn = (params: {\n method: string;\n url: string;\n token?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype ServerRequestFn = (params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype GetTokenFn = () => Promise<string | undefined>;\n\n// These will be dynamically imported based on environment\nlet _directFetch: DirectFetchFn;\nlet _serverRequest: ServerRequestFn;\nlet _getClientToken: GetTokenFn;\nlet _getServerToken: GetTokenFn;\n\n// Config storage for non-React contexts\nlet _staticConfig: {\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 non-React contexts (e.g., server components).\n * For React contexts, use JsonApiProvider instead.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _staticConfig = config;\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\nasync function getToken(): Promise<string | undefined> {\n if (typeof window === \"undefined\") {\n // Server-side\n if (!_getServerToken) {\n const serverModule = await import(\"../server/token\");\n _getServerToken = serverModule.getServerToken;\n }\n return _getServerToken();\n } else {\n // Client-side\n if (!_getClientToken) {\n const clientModule = await import(\"../client/token\");\n _getClientToken = clientModule.getClientToken;\n }\n return _getClientToken();\n }\n}\n\nasync function makeRequest(params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}): Promise<ApiData> {\n if (typeof window !== \"undefined\") {\n // Client-side: use direct fetch\n if (!_directFetch) {\n const clientModule = await import(\"../client/request\");\n _directFetch = clientModule.directFetch;\n }\n return _directFetch({\n method: params.method,\n url: params.url,\n token: params.token,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n } else {\n // Server-side: use server request with caching\n if (!_serverRequest) {\n const serverModule = await import(\"../server/request\");\n _serverRequest = serverModule.serverRequest;\n }\n return _serverRequest({\n method: params.method,\n url: params.url,\n token: params.token,\n cache: params.cache,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n }\n}\n\nexport function getApiUrl(): string {\n if (_staticConfig?.apiUrl) {\n return _staticConfig.apiUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.API_URL;\n if (!envUrl) {\n throw new Error(\"API URL not configured. Use configureJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\");\n }\n return envUrl;\n}\n\nexport function getAppUrl(): string {\n if (_staticConfig?.appUrl) {\n return _staticConfig.appUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.APP_URL;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _staticConfig?.trackablePages ?? [];\n}\n\nfunction runBootstrapper(): void {\n if (_staticConfig?.bootstrapper) {\n _staticConfig.bootstrapper();\n }\n}\n\n/**\n * Resolve the final request URL for an endpoint.\n *\n * - `endpoint` starting with \"http\" is always passed through unchanged (existing behaviour).\n * - Otherwise, an explicit `baseUrl` (per-call override) takes precedence over the global\n * `getApiUrl()` resolution. Omitting `baseUrl` preserves today's behaviour exactly.\n */\nexport function buildUrl(endpoint: string, baseUrl?: string): string {\n if (endpoint.startsWith(\"http\")) return endpoint;\n const apiUrl = baseUrl ?? getApiUrl();\n return `${apiUrl}${endpoint}`;\n}\n\nexport async function JsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n // A cached server GET never sends the token, so it must not read the cookie either:\n // the read would make a public page dynamic.\n const isServerCached = typeof window === \"undefined\" && !!params.classKey.cache;\n const token = isServerCached ? undefined : (params.token ?? (await getToken()));\n\n const apiResponse = await makeRequest({\n method: \"GET\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n cache: params.classKey.cache,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n token: params.token,\n baseUrl: params.baseUrl,\n }),\n });\n}\n\nexport async function JsonApiPost(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"POST\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPut(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PUT\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPatch(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PATCH\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"DELETE\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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"]}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-GHE4VT2R.js","../src/core/env.ts","../src/core/registry/DataClassRegistry.ts","../src/core/factories/JsonApiDataFactory.ts","../src/core/registry/bootstrapStore.ts","../src/core/utils/translateResponse.ts","../src/unified/JsonApiRequest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;AC4BO,IAAM,IAAA,EAAM;AAAA;AAAA,EAEjB,IAAI,OAAA,CAAA,EAAkB;AACpB,IAAA,wBAAO,OAAA,CAAQ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sB;ANqJtB;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-GHE4VT2R.js","sourcesContent":[null,"/**\n * The single place in this package that reads `process.env`.\n *\n * Everything else imports {@link ENV}. Centralising the reads keeps every\n * default in one place — the same contract `base.config.ts` provides on the\n * NestJS side — instead of scattering `process.env.X || \"…\"` across hooks,\n * clients and components where the fallbacks silently drift apart.\n *\n * WHY THE READS MUST STAY LITERAL: Next.js inlines `NEXT_PUBLIC_*` by textual\n * substitution at build time, replacing the exact expression\n * `process.env.NEXT_PUBLIC_FOO` with a string literal. A computed lookup\n * (`process.env[key]`) is NOT substituted and reads as `undefined` in the\n * browser bundle. Every entry below therefore spells its variable out in full,\n * and new entries must do the same.\n *\n * WHY GETTERS AND NOT PLAIN PROPERTIES: every call site this replaced read\n * `process.env` at CALL time, not at import time. A plain property would freeze\n * the value when the module is first imported, which breaks any consumer that\n * assigns the variable after boot — the package's own tests do exactly that.\n * Getters keep the read lazy while leaving the expression literal, so the build\n * time substitution still applies.\n *\n * Because that substitution happens before the code runs, no reference to\n * `process` survives into the client bundle — so this module is safe to import\n * from client components, server components, route handlers and middleware\n * alike. It deliberately carries no `\"use client\"` directive for that reason.\n *\n * Values are normalised (empty string rather than `undefined`, booleans rather\n * than string comparisons) so callers never repeat the parsing. Callers that\n * must distinguish \"unset\" from \"set to empty\" — the URL getters, which throw a\n * configuration error — check for an empty string.\n */\nexport const ENV = {\n /** Public API base URL (NEXT_PUBLIC_API_URL). Empty when unset. */\n get API_URL(): string {\n return process.env.NEXT_PUBLIC_API_URL ?? \"\";\n },\n /** Public app base URL (NEXT_PUBLIC_ADDRESS). Empty when unset. */\n get APP_URL(): string {\n return process.env.NEXT_PUBLIC_ADDRESS ?? \"\";\n },\n /**\n * Alternative app base URL (NEXT_PUBLIC_APP_URL), used only by\n * `client/config.ts`'s `getAppUrl()` before it falls back to\n * `window.location.origin`. Empty when unset.\n */\n get APP_URL_ALTERNATE(): string {\n return process.env.NEXT_PUBLIC_APP_URL ?? \"\";\n },\n /** Web-push VAPID public key (NEXT_PUBLIC_VAPID_PUBLIC_KEY). Empty when unset. */\n get VAPID_PUBLIC_KEY(): string {\n return process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? \"\";\n },\n /** Google Maps JS key (NEXT_PUBLIC_GOOGLE_MAPS_API_KEY). Empty disables autocomplete. */\n get GOOGLE_MAPS_API_KEY(): string {\n return process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? \"\";\n },\n /**\n * NEXT_PUBLIC_PRIVATE_INSTALLATION === \"true\", case-insensitively\n * (default false). A private installation is a single-tenant deployment.\n */\n get PRIVATE_INSTALLATION(): boolean {\n return process.env.NEXT_PUBLIC_PRIVATE_INSTALLATION?.toLowerCase() === \"true\";\n },\n /** NODE_ENV === \"production\" — set by the Next build, not by `.env`. */\n get IS_PRODUCTION(): boolean {\n return process.env.NODE_ENV === \"production\";\n },\n /** NODE_ENV === \"development\" — gates verbose client-side diagnostics. */\n get IS_DEVELOPMENT(): boolean {\n return process.env.NODE_ENV === \"development\";\n },\n};\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport class DataClassRegistry {\n // Use Map with string key (module.name) for reliable lookup\n // String keys are stable across HMR and module re-evaluations\n // Note: WeakMap with object identity was tried but fails during Next.js navigation\n // because module re-evaluation creates new object instances with different identity\n private static _map = new Map<string, { new (): ApiDataInterface }>();\n\n public static registerObjectClass(\n key: ApiRequestDataTypeInterface,\n classConstructor: { new (): ApiDataInterface },\n ): void {\n // Last registration wins. An earlier version skipped re-registration, which\n // silently pinned the registry to the FIRST constructor seen by the process.\n // In dev that made a long-lived `next dev` server keep rehydrating with the\n // pre-edit class after any model change, so SSR produced a different tree\n // from the freshly bundled client and React threw a hydration mismatch.\n // Production is unaffected either way: bootstrap runs once per process.\n this._map.set(key.name, classConstructor);\n }\n\n public static get(classKey: ApiRequestDataTypeInterface): {\n new (): ApiDataInterface;\n } {\n const response = this._map.get(classKey.name);\n if (!response) {\n throw new Error(\n `Class not registered for key: ${typeof classKey === \"string\" ? classKey : classKey.name}. Ensure bootstrap() was called.`,\n );\n }\n\n return response;\n }\n\n /**\n * Get class constructor by JSON:API type name.\n * Used for polymorphic rehydration where the type is determined at runtime.\n */\n public static getByJsonApiType(typeName: string): { new (): ApiDataInterface } | undefined {\n return this._map.get(typeName);\n }\n\n /**\n * Bootstrap the registry with all modules.\n * This is a convenience method for apps to register all their modules at once.\n *\n * @param modules - An object with module definitions (like the app's Modules class)\n */\n public static bootstrap(modules: Record<string, ApiRequestDataTypeInterface>): void {\n Object.values(modules).forEach((module) => {\n if (module && module.model) {\n this.registerObjectClass(module, module.model);\n }\n });\n }\n\n /**\n * Clear all registered classes. Useful for testing.\n */\n public static clear(): void {\n this._map.clear();\n }\n}\n\n// Export alias for backward compatibility\nexport { DataClassRegistry as DataClass };\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class JsonApiDataFactory {\n public static create(classKey: ApiRequestDataTypeInterface, data: any): any {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass() as ApiDataInterface;\n const result = instance.createJsonApi(data);\n return result;\n }\n}\n","/**\n * Centralized bootstrap store accessible from ModuleRegistry.\n * This file has NO external dependencies to avoid circular imports.\n *\n * The bootstrap store allows ModuleRegistry to call the app's bootstrapper\n * when modules are accessed before bootstrap() was called, providing\n * self-healing behavior for module evaluation order issues.\n *\n * IMPORTANT: We use globalThis to persist state across HMR/Turbopack\n * module re-evaluations in development mode. Without this, the bootstrapper\n * reference would be lost when modules are hot-reloaded, causing\n * \"Module not registered\" errors during navigation.\n */\n\ntype BootstrapperFn = () => void;\n\n// Symbol key to avoid conflicts with other globals\nconst BOOTSTRAP_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapper\");\nconst BOOTSTRAP_ATTEMPTED_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapAttempted\");\n\n// Use globalThis to persist across HMR reloads\nconst globalStore = globalThis as unknown as {\n [BOOTSTRAP_KEY]?: BootstrapperFn | null;\n [BOOTSTRAP_ATTEMPTED_KEY]?: boolean;\n};\n\n// Initialize from global if not set\nif (globalStore[BOOTSTRAP_KEY] === undefined) {\n globalStore[BOOTSTRAP_KEY] = null;\n}\nif (globalStore[BOOTSTRAP_ATTEMPTED_KEY] === undefined) {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = false;\n}\n\n// Getters/setters that use the global store\nfunction getBootstrapperInternal(): BootstrapperFn | null {\n return globalStore[BOOTSTRAP_KEY] ?? null;\n}\n\nfunction setBootstrapperInternal(fn: BootstrapperFn | null): void {\n globalStore[BOOTSTRAP_KEY] = fn;\n}\n\nfunction getBootstrapAttempted(): boolean {\n return globalStore[BOOTSTRAP_ATTEMPTED_KEY] ?? false;\n}\n\nfunction setBootstrapAttempted(value: boolean): void {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = value;\n}\n\n/**\n * Register the bootstrapper function.\n * Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.\n */\nexport function setBootstrapper(fn: BootstrapperFn): void {\n setBootstrapperInternal(fn);\n}\n\n/**\n * Get the registered bootstrapper function.\n * Returns null if no bootstrapper has been registered.\n */\nexport function getBootstrapper(): BootstrapperFn | null {\n return getBootstrapperInternal();\n}\n\n/**\n * Attempt to run the bootstrapper if one is registered.\n * Returns true if bootstrapper was executed, false if not available.\n * Safe to call multiple times - bootstrapper is expected to be idempotent.\n */\nexport function tryBootstrap(): boolean {\n const bootstrapper = getBootstrapperInternal();\n const attempted = getBootstrapAttempted();\n\n if (attempted && !bootstrapper) {\n // Already tried and no bootstrapper available\n return false;\n }\n setBootstrapAttempted(true);\n\n if (bootstrapper) {\n bootstrapper();\n return true;\n }\n return false;\n}\n\n/**\n * Check if a bootstrapper has been registered.\n */\nexport function hasBootstrapper(): boolean {\n return getBootstrapperInternal() !== null;\n}\n\n/**\n * Reset the bootstrap store. Useful for testing.\n */\nexport function resetBootstrapStore(): void {\n setBootstrapperInternal(null);\n setBootstrapAttempted(false);\n}\n","import { ApiData } from \"../interfaces/ApiData\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * Translates raw JSON:API data into typed objects.\n * Does not require API response metadata.\n */\nexport function translateData<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n data: any;\n}): T | T[] {\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n const included: any = params.data.included ?? [];\n\n if (Array.isArray(params.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.data.data });\n responseData.push(object as T);\n }\n\n return responseData as T[];\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.data.data,\n included: included,\n });\n\n return responseData as T;\n }\n}\n\n/**\n * Translates a full API response into a typed ApiResponseInterface.\n * Includes pagination support.\n */\nexport async function translateResponse<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n apiResponse: ApiData;\n companyId?: string;\n language: string;\n paginationHandler?: (endpoint: string) => Promise<ApiResponseInterface>;\n}): Promise<ApiResponseInterface> {\n const response: ApiResponseInterface = {\n ok: true,\n response: 0,\n data: [],\n error: \"\",\n };\n\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n response.ok = params.apiResponse.ok;\n response.response = params.apiResponse.status;\n\n if (!params.apiResponse.ok) {\n // The nestjs-neo4jsonapi `HttpExceptionFilter` emits a JSON:API error document\n // (`errors: [{ status, title, detail, ... }]`), so `detail` is read first, then the legacy\n // `message`/`error` keys, then `statusText` (empty over HTTP/2).\n response.error =\n params.apiResponse?.data?.errors?.[0]?.detail ??\n params.apiResponse?.data?.message ??\n params.apiResponse?.data?.error ??\n params.apiResponse.statusText;\n response.raw = params.apiResponse.data;\n return response;\n }\n\n if (params.apiResponse.status === 204) return response;\n\n // A success with no body (e.g. a 200 from a handler that sends nothing —\n // @HttpCode is inert when a controller injects @Res, so \"204\" endpoints can\n // arrive as empty 200s) translates to an empty success, not a crash on\n // `.included` below.\n if (params.apiResponse.data === undefined || params.apiResponse.data === null) return response;\n\n response.raw = params.apiResponse.data;\n\n // Extract meta from JSON:API response\n if (params.apiResponse.data?.meta) {\n response.meta = params.apiResponse.data.meta;\n }\n\n try {\n // Check if response is JSON:API formatted (has a 'data' property)\n // If not, return the raw response data directly (e.g., { url: \"...\" } or { clientSecret: \"...\" })\n if (\n params.apiResponse.data &&\n typeof params.apiResponse.data === \"object\" &&\n !Array.isArray(params.apiResponse.data) &&\n params.apiResponse.data.data === undefined\n ) {\n response.data = params.apiResponse.data;\n return response;\n }\n\n const included: any = params.apiResponse.data.included ?? [];\n\n if (params.apiResponse.data.links) {\n response.self = params.apiResponse.data.links.self;\n\n if (params.apiResponse.data.links.next && params.paginationHandler) {\n response.next = params.apiResponse.data.links.next;\n response.nextPage = async () => params.paginationHandler!(params.apiResponse.data.links.next);\n }\n\n if (params.apiResponse.data.links.prev && params.paginationHandler) {\n response.prev = params.apiResponse.data.links.prev;\n response.prevPage = async () => params.paginationHandler!(params.apiResponse.data.links.prev);\n }\n }\n\n if (Array.isArray(params.apiResponse.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.apiResponse.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.apiResponse.data.data });\n responseData.push(object as T);\n }\n\n response.data = responseData;\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.apiResponse.data.data,\n included: included,\n });\n\n response.data = responseData;\n }\n } catch (e) {\n console.error(e);\n }\n\n return response;\n}\n","import { ENV } from \"../core/env\";\nimport { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\n\n// Type definitions for dynamically imported functions (avoiding typeof import to prevent bundling)\ntype DirectFetchFn = (params: {\n method: string;\n url: string;\n token?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype ServerRequestFn = (params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype GetTokenFn = () => Promise<string | undefined>;\n\n// These will be dynamically imported based on environment\nlet _directFetch: DirectFetchFn;\nlet _serverRequest: ServerRequestFn;\nlet _getClientToken: GetTokenFn;\nlet _getServerToken: GetTokenFn;\n\n// Config storage for non-React contexts\nlet _staticConfig: {\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 non-React contexts (e.g., server components).\n * For React contexts, use JsonApiProvider instead.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _staticConfig = config;\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\nasync function getToken(): Promise<string | undefined> {\n if (typeof window === \"undefined\") {\n // Server-side\n if (!_getServerToken) {\n const serverModule = await import(\"../server/token\");\n _getServerToken = serverModule.getServerToken;\n }\n return _getServerToken();\n } else {\n // Client-side\n if (!_getClientToken) {\n const clientModule = await import(\"../client/token\");\n _getClientToken = clientModule.getClientToken;\n }\n return _getClientToken();\n }\n}\n\nasync function makeRequest(params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}): Promise<ApiData> {\n if (typeof window !== \"undefined\") {\n // Client-side: use direct fetch\n if (!_directFetch) {\n const clientModule = await import(\"../client/request\");\n _directFetch = clientModule.directFetch;\n }\n return _directFetch({\n method: params.method,\n url: params.url,\n token: params.token,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n } else {\n // Server-side: use server request with caching\n if (!_serverRequest) {\n const serverModule = await import(\"../server/request\");\n _serverRequest = serverModule.serverRequest;\n }\n return _serverRequest({\n method: params.method,\n url: params.url,\n token: params.token,\n cache: params.cache,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n }\n}\n\nexport function getApiUrl(): string {\n if (_staticConfig?.apiUrl) {\n return _staticConfig.apiUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.API_URL;\n if (!envUrl) {\n throw new Error(\"API URL not configured. Use configureJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\");\n }\n return envUrl;\n}\n\nexport function getAppUrl(): string {\n if (_staticConfig?.appUrl) {\n return _staticConfig.appUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.APP_URL;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _staticConfig?.trackablePages ?? [];\n}\n\nfunction runBootstrapper(): void {\n if (_staticConfig?.bootstrapper) {\n _staticConfig.bootstrapper();\n }\n}\n\n/**\n * Resolve the final request URL for an endpoint.\n *\n * - `endpoint` starting with \"http\" is always passed through unchanged (existing behaviour).\n * - Otherwise, an explicit `baseUrl` (per-call override) takes precedence over the global\n * `getApiUrl()` resolution. Omitting `baseUrl` preserves today's behaviour exactly.\n */\nexport function buildUrl(endpoint: string, baseUrl?: string): string {\n if (endpoint.startsWith(\"http\")) return endpoint;\n const apiUrl = baseUrl ?? getApiUrl();\n return `${apiUrl}${endpoint}`;\n}\n\nexport async function JsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n // A cached server GET never sends the token, so it must not read the cookie either:\n // the read would make a public page dynamic.\n const isServerCached = typeof window === \"undefined\" && !!params.classKey.cache;\n const token = isServerCached ? undefined : (params.token ?? (await getToken()));\n\n const apiResponse = await makeRequest({\n method: \"GET\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n cache: params.classKey.cache,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n token: params.token,\n baseUrl: params.baseUrl,\n }),\n });\n}\n\nexport async function JsonApiPost(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"POST\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPut(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PUT\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPatch(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PATCH\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"DELETE\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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"]}
@@ -10,12 +10,12 @@ import {
10
10
  import {
11
11
  VIEWPORT_COOKIE_NAME,
12
12
  checkPermissionsFromServer
13
- } from "./chunk-AQZ3T4BR.mjs";
13
+ } from "./chunk-Z3226FM6.mjs";
14
14
  import {
15
15
  ENV,
16
16
  JsonApiDataFactory,
17
17
  translateResponse
18
- } from "./chunk-7SCREMTX.mjs";
18
+ } from "./chunk-V5MI7RNB.mjs";
19
19
  import {
20
20
  __name
21
21
  } from "./chunk-PAWJFY3S.mjs";
@@ -301,4 +301,4 @@ export {
301
301
  ServerJsonApiPatch,
302
302
  ServerJsonApiDelete
303
303
  };
304
- //# sourceMappingURL=chunk-3CZ2GK5R.mjs.map
304
+ //# sourceMappingURL=chunk-IOG22OAO.mjs.map
@@ -13,7 +13,7 @@ import {
13
13
  isInternalAuthEnabled,
14
14
  isReferralEnabled,
15
15
  isRegistrationAllowed
16
- } from "./chunk-ADZSH3MG.mjs";
16
+ } from "./chunk-XTOEN5GN.mjs";
17
17
  import {
18
18
  getRoleId,
19
19
  isRolesConfigured
@@ -84,10 +84,10 @@ import {
84
84
  useIsMobile,
85
85
  validateItalianTaxCode,
86
86
  validatePartitaIva
87
- } from "./chunk-AQZ3T4BR.mjs";
87
+ } from "./chunk-Z3226FM6.mjs";
88
88
  import {
89
89
  ENV
90
- } from "./chunk-7SCREMTX.mjs";
90
+ } from "./chunk-V5MI7RNB.mjs";
91
91
  import {
92
92
  JsonApiContext
93
93
  } from "./chunk-VOXD3ZLY.mjs";
@@ -10559,7 +10559,7 @@ import { useRef as useRef18 } from "react";
10559
10559
  import dynamic from "next/dynamic";
10560
10560
  import React18 from "react";
10561
10561
  import { jsx as jsx90 } from "react/jsx-runtime";
10562
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-FGVQP35E.mjs"), {
10562
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-L3STMBP2.mjs"), {
10563
10563
  ssr: false
10564
10564
  });
10565
10565
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -16701,7 +16701,7 @@ __name(BlockNoteEditorMentionSuggestionMenu, "BlockNoteEditorMentionSuggestionMe
16701
16701
  import dynamic2 from "next/dynamic";
16702
16702
  import React29 from "react";
16703
16703
  import { jsx as jsx177 } from "react/jsx-runtime";
16704
- var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-DQYT6IJW.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
16704
+ var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-4THJHQMK.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
16705
16705
  var BlockNoteViewerContainer = React29.memo(/* @__PURE__ */ __name(function ViewerContainer(props) {
16706
16706
  return /* @__PURE__ */ jsx177(BlockNoteViewer, { ...props });
16707
16707
  }, "ViewerContainer"));
@@ -16942,7 +16942,7 @@ function useJsonApiGet(params) {
16942
16942
  setLoading(true);
16943
16943
  setError(null);
16944
16944
  try {
16945
- const { JsonApiGet } = await import("./JsonApiRequest-MEP6AXDT.mjs");
16945
+ const { JsonApiGet } = await import("./JsonApiRequest-A66XK5WT.mjs");
16946
16946
  const language = navigator.language.split("-")[0] || "en";
16947
16947
  const apiResponse = await JsonApiGet({
16948
16948
  classKey: params.classKey,
@@ -17047,7 +17047,7 @@ function useJsonApiMutation(config) {
17047
17047
  setLoading(true);
17048
17048
  setError(null);
17049
17049
  try {
17050
- const { JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await import("./JsonApiRequest-MEP6AXDT.mjs");
17050
+ const { JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await import("./JsonApiRequest-A66XK5WT.mjs");
17051
17051
  const language = navigator.language.split("-")[0] || "en";
17052
17052
  let apiResponse;
17053
17053
  switch (config.method) {
@@ -27915,4 +27915,4 @@ export {
27915
27915
  useOAuthClients,
27916
27916
  useOAuthClient
27917
27917
  };
27918
- //# sourceMappingURL=chunk-WJC4SYRL.mjs.map
27918
+ //# sourceMappingURL=chunk-KX2776OK.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTokenUsageCurrency
3
- } from "./chunk-AQZ3T4BR.mjs";
3
+ } from "./chunk-Z3226FM6.mjs";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-PAWJFY3S.mjs";
@@ -107,4 +107,4 @@ export {
107
107
  SEQUENTIAL_RAMP,
108
108
  seriesColor
109
109
  };
110
- //# sourceMappingURL=chunk-R6ZYB4VN.mjs.map
110
+ //# sourceMappingURL=chunk-RDI62FAT.mjs.map
@@ -209,7 +209,7 @@ async function translateResponse(params) {
209
209
  response.ok = params.apiResponse.ok;
210
210
  response.response = params.apiResponse.status;
211
211
  if (!params.apiResponse.ok) {
212
- response.error = params.apiResponse?.data?.message ?? params.apiResponse?.data?.error ?? params.apiResponse.statusText;
212
+ response.error = params.apiResponse?.data?.errors?.[0]?.detail ?? params.apiResponse?.data?.message ?? params.apiResponse?.data?.error ?? params.apiResponse.statusText;
213
213
  response.raw = params.apiResponse.data;
214
214
  return response;
215
215
  }
@@ -516,4 +516,4 @@ export {
516
516
  JsonApiPatch,
517
517
  JsonApiDelete
518
518
  };
519
- //# sourceMappingURL=chunk-7SCREMTX.mjs.map
519
+ //# sourceMappingURL=chunk-V5MI7RNB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/env.ts","../src/core/registry/DataClassRegistry.ts","../src/core/factories/JsonApiDataFactory.ts","../src/core/registry/bootstrapStore.ts","../src/core/utils/translateResponse.ts","../src/unified/JsonApiRequest.ts"],"sourcesContent":["/**\n * The single place in this package that reads `process.env`.\n *\n * Everything else imports {@link ENV}. Centralising the reads keeps every\n * default in one place — the same contract `base.config.ts` provides on the\n * NestJS side — instead of scattering `process.env.X || \"…\"` across hooks,\n * clients and components where the fallbacks silently drift apart.\n *\n * WHY THE READS MUST STAY LITERAL: Next.js inlines `NEXT_PUBLIC_*` by textual\n * substitution at build time, replacing the exact expression\n * `process.env.NEXT_PUBLIC_FOO` with a string literal. A computed lookup\n * (`process.env[key]`) is NOT substituted and reads as `undefined` in the\n * browser bundle. Every entry below therefore spells its variable out in full,\n * and new entries must do the same.\n *\n * WHY GETTERS AND NOT PLAIN PROPERTIES: every call site this replaced read\n * `process.env` at CALL time, not at import time. A plain property would freeze\n * the value when the module is first imported, which breaks any consumer that\n * assigns the variable after boot — the package's own tests do exactly that.\n * Getters keep the read lazy while leaving the expression literal, so the build\n * time substitution still applies.\n *\n * Because that substitution happens before the code runs, no reference to\n * `process` survives into the client bundle — so this module is safe to import\n * from client components, server components, route handlers and middleware\n * alike. It deliberately carries no `\"use client\"` directive for that reason.\n *\n * Values are normalised (empty string rather than `undefined`, booleans rather\n * than string comparisons) so callers never repeat the parsing. Callers that\n * must distinguish \"unset\" from \"set to empty\" — the URL getters, which throw a\n * configuration error — check for an empty string.\n */\nexport const ENV = {\n /** Public API base URL (NEXT_PUBLIC_API_URL). Empty when unset. */\n get API_URL(): string {\n return process.env.NEXT_PUBLIC_API_URL ?? \"\";\n },\n /** Public app base URL (NEXT_PUBLIC_ADDRESS). Empty when unset. */\n get APP_URL(): string {\n return process.env.NEXT_PUBLIC_ADDRESS ?? \"\";\n },\n /**\n * Alternative app base URL (NEXT_PUBLIC_APP_URL), used only by\n * `client/config.ts`'s `getAppUrl()` before it falls back to\n * `window.location.origin`. Empty when unset.\n */\n get APP_URL_ALTERNATE(): string {\n return process.env.NEXT_PUBLIC_APP_URL ?? \"\";\n },\n /** Web-push VAPID public key (NEXT_PUBLIC_VAPID_PUBLIC_KEY). Empty when unset. */\n get VAPID_PUBLIC_KEY(): string {\n return process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? \"\";\n },\n /** Google Maps JS key (NEXT_PUBLIC_GOOGLE_MAPS_API_KEY). Empty disables autocomplete. */\n get GOOGLE_MAPS_API_KEY(): string {\n return process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? \"\";\n },\n /**\n * NEXT_PUBLIC_PRIVATE_INSTALLATION === \"true\", case-insensitively\n * (default false). A private installation is a single-tenant deployment.\n */\n get PRIVATE_INSTALLATION(): boolean {\n return process.env.NEXT_PUBLIC_PRIVATE_INSTALLATION?.toLowerCase() === \"true\";\n },\n /** NODE_ENV === \"production\" — set by the Next build, not by `.env`. */\n get IS_PRODUCTION(): boolean {\n return process.env.NODE_ENV === \"production\";\n },\n /** NODE_ENV === \"development\" — gates verbose client-side diagnostics. */\n get IS_DEVELOPMENT(): boolean {\n return process.env.NODE_ENV === \"development\";\n },\n};\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport class DataClassRegistry {\n // Use Map with string key (module.name) for reliable lookup\n // String keys are stable across HMR and module re-evaluations\n // Note: WeakMap with object identity was tried but fails during Next.js navigation\n // because module re-evaluation creates new object instances with different identity\n private static _map = new Map<string, { new (): ApiDataInterface }>();\n\n public static registerObjectClass(\n key: ApiRequestDataTypeInterface,\n classConstructor: { new (): ApiDataInterface },\n ): void {\n // Last registration wins. An earlier version skipped re-registration, which\n // silently pinned the registry to the FIRST constructor seen by the process.\n // In dev that made a long-lived `next dev` server keep rehydrating with the\n // pre-edit class after any model change, so SSR produced a different tree\n // from the freshly bundled client and React threw a hydration mismatch.\n // Production is unaffected either way: bootstrap runs once per process.\n this._map.set(key.name, classConstructor);\n }\n\n public static get(classKey: ApiRequestDataTypeInterface): {\n new (): ApiDataInterface;\n } {\n const response = this._map.get(classKey.name);\n if (!response) {\n throw new Error(\n `Class not registered for key: ${typeof classKey === \"string\" ? classKey : classKey.name}. Ensure bootstrap() was called.`,\n );\n }\n\n return response;\n }\n\n /**\n * Get class constructor by JSON:API type name.\n * Used for polymorphic rehydration where the type is determined at runtime.\n */\n public static getByJsonApiType(typeName: string): { new (): ApiDataInterface } | undefined {\n return this._map.get(typeName);\n }\n\n /**\n * Bootstrap the registry with all modules.\n * This is a convenience method for apps to register all their modules at once.\n *\n * @param modules - An object with module definitions (like the app's Modules class)\n */\n public static bootstrap(modules: Record<string, ApiRequestDataTypeInterface>): void {\n Object.values(modules).forEach((module) => {\n if (module && module.model) {\n this.registerObjectClass(module, module.model);\n }\n });\n }\n\n /**\n * Clear all registered classes. Useful for testing.\n */\n public static clear(): void {\n this._map.clear();\n }\n}\n\n// Export alias for backward compatibility\nexport { DataClassRegistry as DataClass };\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class JsonApiDataFactory {\n public static create(classKey: ApiRequestDataTypeInterface, data: any): any {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass() as ApiDataInterface;\n const result = instance.createJsonApi(data);\n return result;\n }\n}\n","/**\n * Centralized bootstrap store accessible from ModuleRegistry.\n * This file has NO external dependencies to avoid circular imports.\n *\n * The bootstrap store allows ModuleRegistry to call the app's bootstrapper\n * when modules are accessed before bootstrap() was called, providing\n * self-healing behavior for module evaluation order issues.\n *\n * IMPORTANT: We use globalThis to persist state across HMR/Turbopack\n * module re-evaluations in development mode. Without this, the bootstrapper\n * reference would be lost when modules are hot-reloaded, causing\n * \"Module not registered\" errors during navigation.\n */\n\ntype BootstrapperFn = () => void;\n\n// Symbol key to avoid conflicts with other globals\nconst BOOTSTRAP_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapper\");\nconst BOOTSTRAP_ATTEMPTED_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapAttempted\");\n\n// Use globalThis to persist across HMR reloads\nconst globalStore = globalThis as unknown as {\n [BOOTSTRAP_KEY]?: BootstrapperFn | null;\n [BOOTSTRAP_ATTEMPTED_KEY]?: boolean;\n};\n\n// Initialize from global if not set\nif (globalStore[BOOTSTRAP_KEY] === undefined) {\n globalStore[BOOTSTRAP_KEY] = null;\n}\nif (globalStore[BOOTSTRAP_ATTEMPTED_KEY] === undefined) {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = false;\n}\n\n// Getters/setters that use the global store\nfunction getBootstrapperInternal(): BootstrapperFn | null {\n return globalStore[BOOTSTRAP_KEY] ?? null;\n}\n\nfunction setBootstrapperInternal(fn: BootstrapperFn | null): void {\n globalStore[BOOTSTRAP_KEY] = fn;\n}\n\nfunction getBootstrapAttempted(): boolean {\n return globalStore[BOOTSTRAP_ATTEMPTED_KEY] ?? false;\n}\n\nfunction setBootstrapAttempted(value: boolean): void {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = value;\n}\n\n/**\n * Register the bootstrapper function.\n * Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.\n */\nexport function setBootstrapper(fn: BootstrapperFn): void {\n setBootstrapperInternal(fn);\n}\n\n/**\n * Get the registered bootstrapper function.\n * Returns null if no bootstrapper has been registered.\n */\nexport function getBootstrapper(): BootstrapperFn | null {\n return getBootstrapperInternal();\n}\n\n/**\n * Attempt to run the bootstrapper if one is registered.\n * Returns true if bootstrapper was executed, false if not available.\n * Safe to call multiple times - bootstrapper is expected to be idempotent.\n */\nexport function tryBootstrap(): boolean {\n const bootstrapper = getBootstrapperInternal();\n const attempted = getBootstrapAttempted();\n\n if (attempted && !bootstrapper) {\n // Already tried and no bootstrapper available\n return false;\n }\n setBootstrapAttempted(true);\n\n if (bootstrapper) {\n bootstrapper();\n return true;\n }\n return false;\n}\n\n/**\n * Check if a bootstrapper has been registered.\n */\nexport function hasBootstrapper(): boolean {\n return getBootstrapperInternal() !== null;\n}\n\n/**\n * Reset the bootstrap store. Useful for testing.\n */\nexport function resetBootstrapStore(): void {\n setBootstrapperInternal(null);\n setBootstrapAttempted(false);\n}\n","import { ApiData } from \"../interfaces/ApiData\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * Translates raw JSON:API data into typed objects.\n * Does not require API response metadata.\n */\nexport function translateData<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n data: any;\n}): T | T[] {\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n const included: any = params.data.included ?? [];\n\n if (Array.isArray(params.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.data.data });\n responseData.push(object as T);\n }\n\n return responseData as T[];\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.data.data,\n included: included,\n });\n\n return responseData as T;\n }\n}\n\n/**\n * Translates a full API response into a typed ApiResponseInterface.\n * Includes pagination support.\n */\nexport async function translateResponse<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n apiResponse: ApiData;\n companyId?: string;\n language: string;\n paginationHandler?: (endpoint: string) => Promise<ApiResponseInterface>;\n}): Promise<ApiResponseInterface> {\n const response: ApiResponseInterface = {\n ok: true,\n response: 0,\n data: [],\n error: \"\",\n };\n\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n response.ok = params.apiResponse.ok;\n response.response = params.apiResponse.status;\n\n if (!params.apiResponse.ok) {\n // The nestjs-neo4jsonapi `HttpExceptionFilter` emits a JSON:API error document\n // (`errors: [{ status, title, detail, ... }]`), so `detail` is read first, then the legacy\n // `message`/`error` keys, then `statusText` (empty over HTTP/2).\n response.error =\n params.apiResponse?.data?.errors?.[0]?.detail ??\n params.apiResponse?.data?.message ??\n params.apiResponse?.data?.error ??\n params.apiResponse.statusText;\n response.raw = params.apiResponse.data;\n return response;\n }\n\n if (params.apiResponse.status === 204) return response;\n\n // A success with no body (e.g. a 200 from a handler that sends nothing —\n // @HttpCode is inert when a controller injects @Res, so \"204\" endpoints can\n // arrive as empty 200s) translates to an empty success, not a crash on\n // `.included` below.\n if (params.apiResponse.data === undefined || params.apiResponse.data === null) return response;\n\n response.raw = params.apiResponse.data;\n\n // Extract meta from JSON:API response\n if (params.apiResponse.data?.meta) {\n response.meta = params.apiResponse.data.meta;\n }\n\n try {\n // Check if response is JSON:API formatted (has a 'data' property)\n // If not, return the raw response data directly (e.g., { url: \"...\" } or { clientSecret: \"...\" })\n if (\n params.apiResponse.data &&\n typeof params.apiResponse.data === \"object\" &&\n !Array.isArray(params.apiResponse.data) &&\n params.apiResponse.data.data === undefined\n ) {\n response.data = params.apiResponse.data;\n return response;\n }\n\n const included: any = params.apiResponse.data.included ?? [];\n\n if (params.apiResponse.data.links) {\n response.self = params.apiResponse.data.links.self;\n\n if (params.apiResponse.data.links.next && params.paginationHandler) {\n response.next = params.apiResponse.data.links.next;\n response.nextPage = async () => params.paginationHandler!(params.apiResponse.data.links.next);\n }\n\n if (params.apiResponse.data.links.prev && params.paginationHandler) {\n response.prev = params.apiResponse.data.links.prev;\n response.prevPage = async () => params.paginationHandler!(params.apiResponse.data.links.prev);\n }\n }\n\n if (Array.isArray(params.apiResponse.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.apiResponse.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.apiResponse.data.data });\n responseData.push(object as T);\n }\n\n response.data = responseData;\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.apiResponse.data.data,\n included: included,\n });\n\n response.data = responseData;\n }\n } catch (e) {\n console.error(e);\n }\n\n return response;\n}\n","import { ENV } from \"../core/env\";\nimport { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\n\n// Type definitions for dynamically imported functions (avoiding typeof import to prevent bundling)\ntype DirectFetchFn = (params: {\n method: string;\n url: string;\n token?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype ServerRequestFn = (params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype GetTokenFn = () => Promise<string | undefined>;\n\n// These will be dynamically imported based on environment\nlet _directFetch: DirectFetchFn;\nlet _serverRequest: ServerRequestFn;\nlet _getClientToken: GetTokenFn;\nlet _getServerToken: GetTokenFn;\n\n// Config storage for non-React contexts\nlet _staticConfig: {\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 non-React contexts (e.g., server components).\n * For React contexts, use JsonApiProvider instead.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _staticConfig = config;\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\nasync function getToken(): Promise<string | undefined> {\n if (typeof window === \"undefined\") {\n // Server-side\n if (!_getServerToken) {\n const serverModule = await import(\"../server/token\");\n _getServerToken = serverModule.getServerToken;\n }\n return _getServerToken();\n } else {\n // Client-side\n if (!_getClientToken) {\n const clientModule = await import(\"../client/token\");\n _getClientToken = clientModule.getClientToken;\n }\n return _getClientToken();\n }\n}\n\nasync function makeRequest(params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}): Promise<ApiData> {\n if (typeof window !== \"undefined\") {\n // Client-side: use direct fetch\n if (!_directFetch) {\n const clientModule = await import(\"../client/request\");\n _directFetch = clientModule.directFetch;\n }\n return _directFetch({\n method: params.method,\n url: params.url,\n token: params.token,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n } else {\n // Server-side: use server request with caching\n if (!_serverRequest) {\n const serverModule = await import(\"../server/request\");\n _serverRequest = serverModule.serverRequest;\n }\n return _serverRequest({\n method: params.method,\n url: params.url,\n token: params.token,\n cache: params.cache,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n }\n}\n\nexport function getApiUrl(): string {\n if (_staticConfig?.apiUrl) {\n return _staticConfig.apiUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.API_URL;\n if (!envUrl) {\n throw new Error(\"API URL not configured. Use configureJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\");\n }\n return envUrl;\n}\n\nexport function getAppUrl(): string {\n if (_staticConfig?.appUrl) {\n return _staticConfig.appUrl;\n }\n // Fallback to environment variable\n const envUrl = ENV.APP_URL;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _staticConfig?.trackablePages ?? [];\n}\n\nfunction runBootstrapper(): void {\n if (_staticConfig?.bootstrapper) {\n _staticConfig.bootstrapper();\n }\n}\n\n/**\n * Resolve the final request URL for an endpoint.\n *\n * - `endpoint` starting with \"http\" is always passed through unchanged (existing behaviour).\n * - Otherwise, an explicit `baseUrl` (per-call override) takes precedence over the global\n * `getApiUrl()` resolution. Omitting `baseUrl` preserves today's behaviour exactly.\n */\nexport function buildUrl(endpoint: string, baseUrl?: string): string {\n if (endpoint.startsWith(\"http\")) return endpoint;\n const apiUrl = baseUrl ?? getApiUrl();\n return `${apiUrl}${endpoint}`;\n}\n\nexport async function JsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n // A cached server GET never sends the token, so it must not read the cookie either:\n // the read would make a public page dynamic.\n const isServerCached = typeof window === \"undefined\" && !!params.classKey.cache;\n const token = isServerCached ? undefined : (params.token ?? (await getToken()));\n\n const apiResponse = await makeRequest({\n method: \"GET\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n cache: params.classKey.cache,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n token: params.token,\n baseUrl: params.baseUrl,\n }),\n });\n}\n\nexport async function JsonApiPost(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"POST\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPut(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PUT\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiPatch(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 token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\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 makeRequest({\n method: \"PATCH\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.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 JsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"DELETE\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n api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QAAM,cAAc,MAAM,YAAY;AAAA,IACpC,QAAQ;AAAA,IACR,KAAK,SAAS,OAAO,UAAU,OAAO,OAAO;AAAA,IAC7C;AAAA,IACA;AAAA,IACA,OAAO,OAAO;AAAA,IACd,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,IACjB,mBAAmB,eAAe;AAAA,EACpC,CAAC;AAED,SAAO,kBAAkB;AAAA,IACvB,UAAU,OAAO,gBAAgB,OAAO;AAAA,IACxC;AAAA,IACA,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,EACnB,CAAC;AACH;AAvCsB;AAyCtB,eAAsB,cAAc,QAQF;AAChC,kBAAgB;AAChB,QAAM,QAAQ,OAAO,SAAU,MAAM,SAAS;AAE9C,QAAM,cAAc,MAAM,YAAY;AAAA,IACpC,QAAQ;AAAA,IACR,KAAK,SAAS,OAAO,UAAU,OAAO,OAAO;AAAA,IAC7C;AAAA,IACA,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,IACjB,mBAAmB,eAAe;AAAA,EACpC,CAAC;AAED,SAAO,kBAAkB;AAAA,IACvB,UAAU,OAAO,gBAAgB,OAAO;AAAA,IACxC;AAAA,IACA,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,EACnB,CAAC;AACH;AA3BsB;","names":[]}
@@ -2,11 +2,11 @@ import {
2
2
  AbstractService,
3
3
  EndpointCreator,
4
4
  Modules
5
- } from "./chunk-AQZ3T4BR.mjs";
5
+ } from "./chunk-Z3226FM6.mjs";
6
6
  import {
7
7
  ENV,
8
8
  setBootstrapper
9
- } from "./chunk-7SCREMTX.mjs";
9
+ } from "./chunk-V5MI7RNB.mjs";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-PAWJFY3S.mjs";
@@ -222,4 +222,4 @@ export {
222
222
  ACTION_TYPES,
223
223
  RbacService
224
224
  };
225
- //# sourceMappingURL=chunk-ADZSH3MG.mjs.map
225
+ //# sourceMappingURL=chunk-XTOEN5GN.mjs.map
@@ -15,7 +15,7 @@ import {
15
15
  setBootstrapper,
16
16
  translateResponse,
17
17
  tryBootstrap
18
- } from "./chunk-7SCREMTX.mjs";
18
+ } from "./chunk-V5MI7RNB.mjs";
19
19
  import {
20
20
  __name
21
21
  } from "./chunk-PAWJFY3S.mjs";
@@ -392,7 +392,7 @@ var AbstractService = class {
392
392
  * Make an API call with automatic environment detection and error handling.
393
393
  */
394
394
  static async callApi(params) {
395
- const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-MEP6AXDT.mjs");
395
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-A66XK5WT.mjs");
396
396
  let apiResponse;
397
397
  let language = "en";
398
398
  if (typeof window === "undefined") {
@@ -489,7 +489,7 @@ var AbstractService = class {
489
489
  * Make an API call and return both data and meta from the response.
490
490
  */
491
491
  static async callApiWithMeta(params) {
492
- const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-MEP6AXDT.mjs");
492
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-A66XK5WT.mjs");
493
493
  let apiResponse;
494
494
  let language = "en";
495
495
  if (typeof window === "undefined") {
@@ -574,7 +574,7 @@ var AbstractService = class {
574
574
  * Get raw JSON:API response data without deserialization.
575
575
  */
576
576
  static async getRawData(params) {
577
- const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-MEP6AXDT.mjs");
577
+ const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-A66XK5WT.mjs");
578
578
  let language = "en";
579
579
  if (typeof window === "undefined") {
580
580
  language = await getI18nServerLocale();
@@ -10232,4 +10232,4 @@ export {
10232
10232
  AuditLogService,
10233
10233
  AuditLogModule
10234
10234
  };
10235
- //# sourceMappingURL=chunk-AQZ3T4BR.mjs.map
10235
+ //# sourceMappingURL=chunk-Z3226FM6.mjs.map
@@ -28,7 +28,7 @@
28
28
 
29
29
 
30
30
 
31
- var _chunkNFCXUAE6js = require('../chunk-NFCXUAE6.js');
31
+ var _chunk3JET3LL7js = require('../chunk-3JET3LL7.js');
32
32
 
33
33
 
34
34
 
@@ -37,7 +37,7 @@ var _chunkNFCXUAE6js = require('../chunk-NFCXUAE6.js');
37
37
 
38
38
 
39
39
 
40
- var _chunk5W5MN7JPjs = require('../chunk-5W5MN7JP.js');
40
+ var _chunk7ZRQOLSVjs = require('../chunk-7ZRQOLSV.js');
41
41
  require('../chunk-G4JR3SFV.js');
42
42
 
43
43
 
@@ -56,14 +56,14 @@ require('../chunk-G4JR3SFV.js');
56
56
 
57
57
 
58
58
 
59
- var _chunk6OFANJTEjs = require('../chunk-6OFANJTE.js');
59
+ var _chunk5PNDDYGLjs = require('../chunk-5PNDDYGL.js');
60
60
 
61
61
 
62
62
  var _chunkLXKSUWAVjs = require('../chunk-LXKSUWAV.js');
63
63
 
64
64
 
65
65
  var _chunkJTPRJNT2js = require('../chunk-JTPRJNT2.js');
66
- require('../chunk-WGVNJXZO.js');
66
+ require('../chunk-GHE4VT2R.js');
67
67
 
68
68
 
69
69
 
@@ -126,5 +126,5 @@ require('../chunk-7QVYU63E.js');
126
126
 
127
127
 
128
128
 
129
- exports.ClientJsonApiDelete = _chunk6OFANJTEjs.ClientJsonApiDelete; exports.ClientJsonApiGet = _chunk6OFANJTEjs.ClientJsonApiGet; exports.ClientJsonApiPatch = _chunk6OFANJTEjs.ClientJsonApiPatch; exports.ClientJsonApiPost = _chunk6OFANJTEjs.ClientJsonApiPost; exports.ClientJsonApiPut = _chunk6OFANJTEjs.ClientJsonApiPut; exports.JsonApiContext = _chunk3EPNHTMHjs.JsonApiContext; exports.JsonApiProvider = _chunkNFCXUAE6js.JsonApiProvider; exports.TableGeneratorRegistry = _chunkNFCXUAE6js.TableGeneratorRegistry; exports.buildClientUrl = _chunk6OFANJTEjs.buildClientUrl; exports.computeLayeredLayout = _chunkNFCXUAE6js.computeLayeredLayout; exports.configureClientConfig = _chunk5W5MN7JPjs.configureClientConfig; exports.configureClientJsonApi = _chunk6OFANJTEjs.configureClientJsonApi; exports.configureI18n = _chunk6OFANJTEjs.configureI18n; exports.configureJsonApi = _chunk5W5MN7JPjs.configureJsonApi; exports.directFetch = _chunkJTPRJNT2js.directFetch; exports.fitLayeredLayoutToAspectRatio = _chunkNFCXUAE6js.fitLayeredLayoutToAspectRatio; exports.getApiUrl = _chunk5W5MN7JPjs.getApiUrl; exports.getAppUrl = _chunk5W5MN7JPjs.getAppUrl; exports.getClientApiUrl = _chunk6OFANJTEjs.getClientApiUrl; exports.getClientAppUrl = _chunk6OFANJTEjs.getClientAppUrl; exports.getClientToken = _chunkLXKSUWAVjs.getClientToken; exports.getClientTrackablePages = _chunk6OFANJTEjs.getClientTrackablePages; exports.getI18nLink = _chunk6OFANJTEjs.getI18nLink; exports.getPublicApiUrl = _chunk5W5MN7JPjs.getPublicApiUrl; exports.getStripePublishableKey = _chunk5W5MN7JPjs.getStripePublishableKey; exports.getTrackablePages = _chunk5W5MN7JPjs.getTrackablePages; exports.registerTableGenerator = _chunkNFCXUAE6js.registerTableGenerator; exports.tableGeneratorRegistry = _chunkNFCXUAE6js.tableGeneratorRegistry; exports.useContentTableStructure = _chunkNFCXUAE6js.useContentTableStructure; exports.useCustomD3Graph = _chunkNFCXUAE6js.useCustomD3Graph; exports.useDataListRetriever = _chunkNFCXUAE6js.useDataListRetriever; exports.useDebounce = _chunkNFCXUAE6js.useDebounce; exports.useI18nDateFnsLocale = _chunk6OFANJTEjs.useI18nDateFnsLocale; exports.useI18nLocale = _chunk6OFANJTEjs.useI18nLocale; exports.useI18nRouter = _chunk6OFANJTEjs.useI18nRouter; exports.useI18nTranslations = _chunk6OFANJTEjs.useI18nTranslations; exports.useJsonApiConfig = _chunk3EPNHTMHjs.useJsonApiConfig; exports.useJsonApiConfigOptional = _chunk3EPNHTMHjs.useJsonApiConfigOptional; exports.useJsonApiGet = _chunkNFCXUAE6js.useJsonApiGet; exports.useJsonApiMutation = _chunkNFCXUAE6js.useJsonApiMutation; exports.useNotificationSync = _chunkNFCXUAE6js.useNotificationSync; exports.useOAuthClient = _chunkNFCXUAE6js.useOAuthClient; exports.useOAuthClients = _chunkNFCXUAE6js.useOAuthClients; exports.useOAuthConsent = _chunkNFCXUAE6js.useOAuthConsent; exports.usePageTracker = _chunkNFCXUAE6js.usePageTracker; exports.usePageUrlGenerator = _chunkNFCXUAE6js.usePageUrlGenerator; exports.useRehydration = _chunkNFCXUAE6js.useRehydration; exports.useRehydrationList = _chunkNFCXUAE6js.useRehydrationList; exports.useRoleTableStructure = _chunkNFCXUAE6js.useRoleTableStructure; exports.useSocket = _chunkNFCXUAE6js.useSocket; exports.useSubscriptionStatus = _chunkNFCXUAE6js.useSubscriptionStatus; exports.useTableGenerator = _chunkNFCXUAE6js.useTableGenerator; exports.useUrlRewriter = _chunkNFCXUAE6js.useUrlRewriter; exports.useUserSearch = _chunkNFCXUAE6js.useUserSearch; exports.useUserTableStructure = _chunkNFCXUAE6js.useUserTableStructure;
129
+ exports.ClientJsonApiDelete = _chunk5PNDDYGLjs.ClientJsonApiDelete; exports.ClientJsonApiGet = _chunk5PNDDYGLjs.ClientJsonApiGet; exports.ClientJsonApiPatch = _chunk5PNDDYGLjs.ClientJsonApiPatch; exports.ClientJsonApiPost = _chunk5PNDDYGLjs.ClientJsonApiPost; exports.ClientJsonApiPut = _chunk5PNDDYGLjs.ClientJsonApiPut; exports.JsonApiContext = _chunk3EPNHTMHjs.JsonApiContext; exports.JsonApiProvider = _chunk3JET3LL7js.JsonApiProvider; exports.TableGeneratorRegistry = _chunk3JET3LL7js.TableGeneratorRegistry; exports.buildClientUrl = _chunk5PNDDYGLjs.buildClientUrl; exports.computeLayeredLayout = _chunk3JET3LL7js.computeLayeredLayout; exports.configureClientConfig = _chunk7ZRQOLSVjs.configureClientConfig; exports.configureClientJsonApi = _chunk5PNDDYGLjs.configureClientJsonApi; exports.configureI18n = _chunk5PNDDYGLjs.configureI18n; exports.configureJsonApi = _chunk7ZRQOLSVjs.configureJsonApi; exports.directFetch = _chunkJTPRJNT2js.directFetch; exports.fitLayeredLayoutToAspectRatio = _chunk3JET3LL7js.fitLayeredLayoutToAspectRatio; exports.getApiUrl = _chunk7ZRQOLSVjs.getApiUrl; exports.getAppUrl = _chunk7ZRQOLSVjs.getAppUrl; exports.getClientApiUrl = _chunk5PNDDYGLjs.getClientApiUrl; exports.getClientAppUrl = _chunk5PNDDYGLjs.getClientAppUrl; exports.getClientToken = _chunkLXKSUWAVjs.getClientToken; exports.getClientTrackablePages = _chunk5PNDDYGLjs.getClientTrackablePages; exports.getI18nLink = _chunk5PNDDYGLjs.getI18nLink; exports.getPublicApiUrl = _chunk7ZRQOLSVjs.getPublicApiUrl; exports.getStripePublishableKey = _chunk7ZRQOLSVjs.getStripePublishableKey; exports.getTrackablePages = _chunk7ZRQOLSVjs.getTrackablePages; exports.registerTableGenerator = _chunk3JET3LL7js.registerTableGenerator; exports.tableGeneratorRegistry = _chunk3JET3LL7js.tableGeneratorRegistry; exports.useContentTableStructure = _chunk3JET3LL7js.useContentTableStructure; exports.useCustomD3Graph = _chunk3JET3LL7js.useCustomD3Graph; exports.useDataListRetriever = _chunk3JET3LL7js.useDataListRetriever; exports.useDebounce = _chunk3JET3LL7js.useDebounce; exports.useI18nDateFnsLocale = _chunk5PNDDYGLjs.useI18nDateFnsLocale; exports.useI18nLocale = _chunk5PNDDYGLjs.useI18nLocale; exports.useI18nRouter = _chunk5PNDDYGLjs.useI18nRouter; exports.useI18nTranslations = _chunk5PNDDYGLjs.useI18nTranslations; exports.useJsonApiConfig = _chunk3EPNHTMHjs.useJsonApiConfig; exports.useJsonApiConfigOptional = _chunk3EPNHTMHjs.useJsonApiConfigOptional; exports.useJsonApiGet = _chunk3JET3LL7js.useJsonApiGet; exports.useJsonApiMutation = _chunk3JET3LL7js.useJsonApiMutation; exports.useNotificationSync = _chunk3JET3LL7js.useNotificationSync; exports.useOAuthClient = _chunk3JET3LL7js.useOAuthClient; exports.useOAuthClients = _chunk3JET3LL7js.useOAuthClients; exports.useOAuthConsent = _chunk3JET3LL7js.useOAuthConsent; exports.usePageTracker = _chunk3JET3LL7js.usePageTracker; exports.usePageUrlGenerator = _chunk3JET3LL7js.usePageUrlGenerator; exports.useRehydration = _chunk3JET3LL7js.useRehydration; exports.useRehydrationList = _chunk3JET3LL7js.useRehydrationList; exports.useRoleTableStructure = _chunk3JET3LL7js.useRoleTableStructure; exports.useSocket = _chunk3JET3LL7js.useSocket; exports.useSubscriptionStatus = _chunk3JET3LL7js.useSubscriptionStatus; exports.useTableGenerator = _chunk3JET3LL7js.useTableGenerator; exports.useUrlRewriter = _chunk3JET3LL7js.useUrlRewriter; exports.useUserSearch = _chunk3JET3LL7js.useUserSearch; exports.useUserTableStructure = _chunk3JET3LL7js.useUserTableStructure;
130
130
  //# sourceMappingURL=index.js.map