@carlonicora/nextjs-jsonapi 6.14.1 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/{BlockNoteEditor-UIAX72XW.js → BlockNoteEditor-GWDYMS6R.js} +20 -20
  2. package/dist/{BlockNoteEditor-UIAX72XW.js.map → BlockNoteEditor-GWDYMS6R.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-I3J6YYXK.mjs → BlockNoteEditor-HNP5UAJT.mjs} +5 -5
  4. package/dist/{BlockNoteViewer-HIUAJQRI.mjs → BlockNoteViewer-X4UEVI2A.mjs} +3 -3
  5. package/dist/{BlockNoteViewer-APBOPT4B.js → BlockNoteViewer-XYKFY77F.js} +4 -4
  6. package/dist/{BlockNoteViewer-APBOPT4B.js.map → BlockNoteViewer-XYKFY77F.js.map} +1 -1
  7. package/dist/EmailPurpose-DOsSqM5K.d.mts +3 -0
  8. package/dist/EmailPurpose-DOsSqM5K.d.ts +3 -0
  9. package/dist/billing/index.js +492 -492
  10. package/dist/billing/index.mjs +4 -4
  11. package/dist/{chunk-4XLDBOSE.js → chunk-A7Y5YW7Q.js} +1 -1
  12. package/dist/{chunk-4XLDBOSE.js.map → chunk-A7Y5YW7Q.js.map} +1 -1
  13. package/dist/{chunk-ZYSNJKOP.js → chunk-DFA566KY.js} +4 -4
  14. package/dist/{chunk-ZYSNJKOP.js.map → chunk-DFA566KY.js.map} +1 -1
  15. package/dist/{chunk-DJXSCARG.js → chunk-I5BQLY7V.js} +9 -9
  16. package/dist/{chunk-DJXSCARG.js.map → chunk-I5BQLY7V.js.map} +1 -1
  17. package/dist/{chunk-RFKSJIQB.mjs → chunk-KMPBSOFB.mjs} +138 -5
  18. package/dist/chunk-KMPBSOFB.mjs.map +1 -0
  19. package/dist/{chunk-UOTHRJD2.mjs → chunk-OKBJEIOP.mjs} +1 -1
  20. package/dist/chunk-OKBJEIOP.mjs.map +1 -0
  21. package/dist/{chunk-PMESKNKL.js → chunk-OO2DBP6L.js} +1106 -973
  22. package/dist/chunk-OO2DBP6L.js.map +1 -0
  23. package/dist/{chunk-HAW5PNJG.mjs → chunk-TY5YWBLL.mjs} +3 -3
  24. package/dist/{chunk-RT7XFGIN.js → chunk-UGDYZW4K.js} +1035 -997
  25. package/dist/chunk-UGDYZW4K.js.map +1 -0
  26. package/dist/{chunk-RYY7USSW.mjs → chunk-YEZGASBX.mjs} +50 -12
  27. package/dist/{chunk-RYY7USSW.mjs.map → chunk-YEZGASBX.mjs.map} +1 -1
  28. package/dist/{chunk-OUEYZOLB.mjs → chunk-YVKWACDP.mjs} +2 -2
  29. package/dist/client/index.js +5 -5
  30. package/dist/client/index.mjs +4 -4
  31. package/dist/components/editors/server.d.mts +7 -1
  32. package/dist/components/editors/server.d.ts +7 -1
  33. package/dist/components/editors/server.js +17 -4
  34. package/dist/components/editors/server.js.map +1 -1
  35. package/dist/components/editors/server.mjs +17 -4
  36. package/dist/components/editors/server.mjs.map +1 -1
  37. package/dist/components/index.d.mts +3 -2
  38. package/dist/components/index.d.ts +3 -2
  39. package/dist/components/index.js +5 -5
  40. package/dist/components/index.mjs +4 -4
  41. package/dist/contexts/index.js +5 -5
  42. package/dist/contexts/index.mjs +4 -4
  43. package/dist/core/index.d.mts +92 -7
  44. package/dist/core/index.d.ts +92 -7
  45. package/dist/core/index.js +7 -3
  46. package/dist/core/index.js.map +1 -1
  47. package/dist/core/index.mjs +6 -2
  48. package/dist/{email-automation-enrollment.fields-BZvF14qx.d.mts → email-automation-enrollment.fields-CPsgxLif.d.mts} +11 -1
  49. package/dist/{email-automation-enrollment.fields-Cp3VMzFq.d.ts → email-automation-enrollment.fields-CVicSamF.d.ts} +11 -1
  50. package/dist/email-automations/index.d.mts +19 -5
  51. package/dist/email-automations/index.d.ts +19 -5
  52. package/dist/email-automations/index.js +356 -129
  53. package/dist/email-automations/index.js.map +1 -1
  54. package/dist/email-automations/index.mjs +306 -79
  55. package/dist/email-automations/index.mjs.map +1 -1
  56. package/dist/features/analytics/index.js +121 -121
  57. package/dist/features/analytics/index.mjs +4 -4
  58. package/dist/features/analytics/server.js +5 -5
  59. package/dist/features/analytics/server.mjs +3 -3
  60. package/dist/features/blog/index.js +151 -151
  61. package/dist/features/blog/index.mjs +4 -4
  62. package/dist/features/blog/server.js +17 -17
  63. package/dist/features/blog/server.mjs +2 -2
  64. package/dist/features/help/index.js +38 -38
  65. package/dist/features/help/index.mjs +4 -4
  66. package/dist/features/tokenusage/index.js +127 -127
  67. package/dist/features/tokenusage/index.mjs +4 -4
  68. package/dist/index.d.mts +4 -3
  69. package/dist/index.d.ts +4 -3
  70. package/dist/index.js +8 -4
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +7 -3
  73. package/dist/offline/index.js +14 -14
  74. package/dist/offline/index.mjs +1 -1
  75. package/dist/{referral-admin.interface-RVO-ZTJz.d.mts → referral-admin.interface-DTj4LzXx.d.mts} +3 -0
  76. package/dist/{referral-admin.interface-CnytdDaQ.d.ts → referral-admin.interface-DeSCw3Pp.d.ts} +3 -0
  77. package/dist/server/index.js +4 -4
  78. package/dist/server/index.mjs +3 -3
  79. package/messages/en.json +35 -3
  80. package/messages/it.json +35 -3
  81. package/package.json +1 -1
  82. package/src/components/editors/server/__tests__/renderBlockNoteMarkdown.spec.ts +45 -0
  83. package/src/components/editors/server/renderBlockNoteHTML.ts +2 -18
  84. package/src/components/editors/server/renderBlockNoteMarkdown.ts +10 -0
  85. package/src/components/editors/server/serverEditor.ts +25 -0
  86. package/src/components/editors/server-entry.ts +1 -0
  87. package/src/core/index.ts +1 -0
  88. package/src/core/registry/ModuleRegistry.ts +1 -0
  89. package/src/features/email-automation/EmailAutomationCandidateModule.ts +12 -0
  90. package/src/features/email-automation/EmailAutomationModule.ts +1 -0
  91. package/src/features/email-automation/components/__tests__/EmailAutomationEditor.spec.tsx +74 -9
  92. package/src/features/email-automation/components/forms/EmailAutomationAddPersonDialog.tsx +226 -0
  93. package/src/features/email-automation/components/forms/EmailAutomationEditor.tsx +23 -0
  94. package/src/features/email-automation/components/forms/EmailStepEditor.tsx +7 -3
  95. package/src/features/email-automation/components/index.ts +1 -0
  96. package/src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx +38 -20
  97. package/src/features/email-automation/components/lists/EmailAutomationsList.tsx +1 -0
  98. package/src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx +9 -4
  99. package/src/features/email-automation/data/EmailAutomation.ts +9 -0
  100. package/src/features/email-automation/data/EmailAutomationCandidate.ts +66 -0
  101. package/src/features/email-automation/data/EmailAutomationCandidateInterface.ts +19 -0
  102. package/src/features/email-automation/data/EmailAutomationEnrollment.ts +16 -2
  103. package/src/features/email-automation/data/EmailAutomationEnrollmentInterface.ts +7 -0
  104. package/src/features/email-automation/data/EmailAutomationInterface.ts +3 -0
  105. package/src/features/email-automation/data/EmailAutomationService.ts +53 -1
  106. package/src/features/email-automation/data/EmailPurpose.ts +1 -0
  107. package/src/features/email-automation/data/__tests__/email-automation-models.spec.ts +70 -0
  108. package/src/features/email-automation/data/email-automation.fields.ts +1 -0
  109. package/src/features/email-automation/data/index.ts +2 -0
  110. package/src/features/email-automation/hooks/useEmailAutomationTableStructure.tsx +19 -0
  111. package/src/features/email-automation/index.ts +2 -0
  112. package/src/features/email-blast/EmailBlastModule.ts +1 -0
  113. package/src/features/email-blast/components/forms/EmailBlastEditor.tsx +33 -4
  114. package/src/features/email-blast/components/lists/EmailBlastsList.tsx +1 -0
  115. package/src/features/email-blast/data/EmailBlast.ts +10 -1
  116. package/src/features/email-blast/data/EmailBlastInterface.ts +3 -0
  117. package/src/features/email-blast/data/__tests__/EmailBlast.spec.ts +18 -0
  118. package/src/features/email-blast/data/email-blast.fields.ts +1 -0
  119. package/src/features/email-blast/hooks/useEmailBlastTableStructure.tsx +15 -0
  120. package/dist/chunk-PMESKNKL.js.map +0 -1
  121. package/dist/chunk-RFKSJIQB.mjs.map +0 -1
  122. package/dist/chunk-RT7XFGIN.js.map +0 -1
  123. package/dist/chunk-UOTHRJD2.mjs.map +0 -1
  124. /package/dist/{BlockNoteEditor-I3J6YYXK.mjs.map → BlockNoteEditor-HNP5UAJT.mjs.map} +0 -0
  125. /package/dist/{BlockNoteViewer-HIUAJQRI.mjs.map → BlockNoteViewer-X4UEVI2A.mjs.map} +0 -0
  126. /package/dist/{chunk-HAW5PNJG.mjs.map → chunk-TY5YWBLL.mjs.map} +0 -0
  127. /package/dist/{chunk-OUEYZOLB.mjs.map → chunk-YVKWACDP.mjs.map} +0 -0
@@ -81,11 +81,11 @@ import {
81
81
  useCurrentUserContext,
82
82
  useDataListRetriever,
83
83
  usePageUrlGenerator
84
- } from "../chunk-RYY7USSW.mjs";
84
+ } from "../chunk-YEZGASBX.mjs";
85
85
  import "../chunk-VOXD3ZLY.mjs";
86
86
  import {
87
87
  getStripePublishableKey
88
- } from "../chunk-HAW5PNJG.mjs";
88
+ } from "../chunk-TY5YWBLL.mjs";
89
89
  import {
90
90
  getRoleId
91
91
  } from "../chunk-PW42LRSL.mjs";
@@ -112,13 +112,13 @@ import {
112
112
  resolveChangePlanTarget,
113
113
  showToast,
114
114
  toPromotionCodeResult
115
- } from "../chunk-RFKSJIQB.mjs";
115
+ } from "../chunk-KMPBSOFB.mjs";
116
116
  import "../chunk-OY65RYD3.mjs";
117
117
  import {
118
118
  Modules,
119
119
  useI18nLocale,
120
120
  useI18nRouter
121
- } from "../chunk-UOTHRJD2.mjs";
121
+ } from "../chunk-OKBJEIOP.mjs";
122
122
  import "../chunk-AUD6ZLBB.mjs";
123
123
  import "../chunk-M3N7LPHX.mjs";
124
124
  import "../chunk-4ZJIUTIV.mjs";
@@ -567,4 +567,4 @@ var RootSync = (_class2 = class extends AbstractApiData {constructor(...args) {
567
567
 
568
568
 
569
569
  exports.RehydrationFactory = RehydrationFactory; exports.AbstractApiData = AbstractApiData; exports.configureI18n = configureI18n; exports.useI18nRouter = useI18nRouter; exports.useI18nTranslations = useI18nTranslations; exports.getI18nLink = getI18nLink; exports.useI18nLocale = useI18nLocale; exports.getI18nServerLocale = getI18nServerLocale; exports.useI18nDateFnsLocale = useI18nDateFnsLocale; exports.getI18nSupportedLocales = getI18nSupportedLocales; exports.getI18nDefaultLocale = getI18nDefaultLocale; exports.ModuleRegistry = ModuleRegistry; exports.Modules = Modules; exports.EndpointCreator = EndpointCreator; exports.ROOT_SYNC_ENDPOINT = ROOT_SYNC_ENDPOINT; exports.RootSync = RootSync;
570
- //# sourceMappingURL=chunk-4XLDBOSE.js.map
570
+ //# sourceMappingURL=chunk-A7Y5YW7Q.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-4XLDBOSE.js","../src/core/factories/RehydrationFactory.ts","../src/core/abstracts/AbstractApiData.ts","../src/i18n/config.ts","../src/core/registry/ModuleRegistry.ts","../src/core/endpoint/EndpointCreator.ts","../src/offline/sync/models/RootSync.ts"],"names":["includedData","includedItem","module","entity"],"mappings":"AAAA;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACCA,IAAM,WAAA,kBAAa,IAAI,GAAA,CAAY,CAAA;AAEnC,IAAM,MAAA,kBAAQ,qCAAA,CAAC,IAAA,EAAA,GAA2D;AACxE,EAAA,MAAM,SAAA,kBAAW,IAAA,6BAAM,SAAA;AACvB,EAAA,uBAAO,QAAA,6BAAU,OAAA,mBAAQ,QAAA,6BAAU,KAAA,EAAK,CAAA,EAAA;AAF5B;AAK2D;AACjD,EAAA;AACD,EAAA;AACW,EAAA;AACd,EAAA;AACd,EAAA;AACS,IAAA;AACX,EAAA;AACqB,IAAA;AACvB,EAAA;AACF;AAVS;AAYuB;AAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAIzB,EAAA;AACoC,IAAA;AAER,IAAA;AACjC,EAAA;AAKO,EAAA;AACkC,IAAA;AAE3B,IAAA;AACc,MAAA;AAC1B,IAAA;AACF,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ES,IAAA;AAEe,IAAA;AACL,IAAA;AAElB,MAAA;AAIhB,IAAA;AAC4B,IAAA;AACU,IAAA;AAE/B,IAAA;AACT,EAAA;AACF;AL8Y2C;AACA;AMzeT;AAGJ;AAA6C,EAAA;AAAA,IAAA;AAAA,EAAA;AACjE,EAAA;AACmB,iBAAA;AACnB,EAAA;AACA,EAAA;AACA,EAAA;AAEe,EAAA;AACkB,IAAA;AAC3B,IAAA;AACd,EAAA;AAEsB,EAAA;AACR,IAAA;AACd,EAAA;AAEmC,EAAA;AACrB,IAAA;AACd,EAAA;AAE+B,EAAA;AACJ,IAAA;AAC3B,EAAA;AAE4B,EAAA;AACH,IAAA;AACzB,EAAA;AAEoD,EAAA;AAC9B,IAAA;AAEY,IAAA;AACF,IAAA;AACI,IAAA;AACJ,IAAA;AACS,IAAA;AACzB,MAAA;AACF,MAAA;AACyB,MAAA;AACnC,IAAA;AACqC,IAAA;AACtB,MAAA;AACF,MAAA;AACA,MAAA;AACF,MAAA;AACA,MAAA;AACW,MAAA;AACtB,IAAA;AAEK,IAAA;AACT,EAAA;AAEgC,EAAA;AACd,IAAA;AAClB,EAAA;AACF;ANme2C;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-4XLDBOSE.js","sourcesContent":[null,"import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * The resources being rehydrated right now, along the current chain of relationships. A resource\n * met again inside its own chain (A's relationship leads to B, B's back to A) is a circle in the\n * `included` data: following it would recurse until the stack overflows, so it is skipped there.\n */\nconst inProgress = new Set<string>();\n\nconst keyOf = (data: JsonApiHydratedDataInterface): string | undefined => {\n const resource = data?.jsonApi;\n return resource?.type && resource?.id ? `${resource.type}:${resource.id}` : undefined;\n};\n\nfunction guarded<T>(data: JsonApiHydratedDataInterface, run: () => T): T {\n const key = keyOf(data);\n if (!key) return run();\n if (inProgress.has(key)) return undefined as T;\n inProgress.add(key);\n try {\n return run();\n } finally {\n inProgress.delete(key);\n }\n}\n\nexport class RehydrationFactory {\n public static rehydrate<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface,\n ): T {\n const factoryClass = DataClassRegistry.get(classKey);\n\n return guarded(data, () => new factoryClass().rehydrate(data) as T);\n }\n\n public static rehydrateList<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface[],\n ): T[] {\n const factoryClass = DataClassRegistry.get(classKey);\n\n return data.map((item: JsonApiHydratedDataInterface) =>\n guarded(item, () => new factoryClass().rehydrate(item) as T),\n );\n }\n}\n","import { RehydrationFactory } from \"../factories/RehydrationFactory\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\n\nexport abstract class AbstractApiData implements ApiDataInterface {\n static identifierFields: string[] = [\"name\"];\n\n get identifier(): string {\n const fields = (this.constructor as typeof AbstractApiData).identifierFields;\n return fields\n .map((field) => this._jsonApi?.attributes?.[field])\n .filter((v) => v != null && v !== \"\")\n .join(\" \");\n }\n\n protected _jsonApi?: any;\n protected _included?: any[];\n\n protected _id?: string;\n protected _type?: string;\n protected _createdAt?: Date;\n protected _updatedAt?: Date;\n\n protected _self?: string;\n\n get type(): string {\n if (!this._type) throw new Error(\"Type is not set.\");\n return this._type;\n }\n\n get id(): string {\n if (!this._id) throw new Error(\"Id is not set.\");\n return this._id;\n }\n\n get self(): string | undefined {\n return this._self;\n }\n\n get createdAt(): Date {\n return this._createdAt ?? new Date();\n }\n\n get updatedAt(): Date {\n return this._updatedAt ?? new Date();\n }\n\n get included(): any[] {\n return this._included ?? [];\n }\n\n get jsonApi(): any {\n return this._jsonApi;\n }\n\n ingestJsonApi(_data: JsonApiHydratedDataInterface): void {}\n\n generateApiUrl(_params?: any): string {\n throw new Error(\"Method not implemented.\");\n }\n\n createJsonApi(_data?: any): any {\n throw new Error(\"Method not implemented.\");\n }\n\n protected _readIncluded<T extends ApiDataInterface>(\n data: JsonApiHydratedDataInterface,\n type: string,\n dataType: ApiRequestDataTypeInterface,\n ): T | T[] | undefined {\n if (\n data.included === undefined ||\n data.included.length === 0 ||\n data.jsonApi.relationships === undefined ||\n data.jsonApi.relationships[type] === undefined ||\n data.jsonApi.relationships[type].data === undefined\n ) {\n return undefined;\n }\n\n if (Array.isArray(data.jsonApi.relationships[type].data)) {\n const response: T[] = data.jsonApi.relationships[type].data.map((jsonApiData: any) => {\n const includedData = data.included.find(\n (includedData: any) => includedData.id === jsonApiData.id && includedData.type === jsonApiData.type,\n );\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n });\n\n return response.filter((item: T | undefined) => item !== undefined) as T[];\n }\n\n const includedData = data.included.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n\n if (includedData === undefined && data.allData !== undefined) {\n // Try to find in allData as a fallback\n const fallbackData = data.allData.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n if (fallbackData !== undefined) {\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: fallbackData,\n included: data.included,\n }) as T;\n }\n }\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n }\n\n /**\n * Read included relationships with polymorphic type resolution.\n * Determines the correct model class based on the JSON:API type in included data.\n */\n protected _readIncludedPolymorphic<T extends ApiDataInterface>(\n data: JsonApiHydratedDataInterface,\n relationshipKey: string,\n candidateModules: ApiRequestDataTypeInterface[],\n ): T | T[] | undefined {\n // Validate relationship exists\n if (!data.included?.length || !data.jsonApi.relationships?.[relationshipKey]?.data) {\n return undefined;\n }\n\n const relData = data.jsonApi.relationships[relationshipKey].data;\n\n // Build lookup map: JSON:API type -> module\n const typeToModule = new Map<string, ApiRequestDataTypeInterface>();\n for (const mod of candidateModules) {\n typeToModule.set(mod.name, mod);\n }\n\n if (Array.isArray(relData)) {\n // Many relationship\n const result: T[] = [];\n for (const item of relData) {\n const includedItem = data.included.find((inc: any) => inc.id === item.id && inc.type === item.type);\n if (!includedItem) continue;\n\n // Resolve module by JSON:API type\n const module = typeToModule.get(includedItem.type);\n if (!module) continue;\n\n result.push(\n RehydrationFactory.rehydrate(module, {\n jsonApi: includedItem,\n included: data.included,\n }) as T,\n );\n }\n return result.length > 0 ? result : undefined;\n }\n\n // Single relationship\n const includedItem = data.included.find((inc: any) => inc.id === relData.id && inc.type === relData.type);\n if (!includedItem) return undefined;\n\n const module = typeToModule.get(includedItem.type);\n if (!module) return undefined;\n\n return RehydrationFactory.rehydrate(module, {\n jsonApi: includedItem,\n included: data.included,\n }) as T;\n }\n\n /**\n * Read included relationship data and augment with relationship meta properties.\n * Handles both single relationships (one-to-one) and array relationships (one-to-many).\n *\n * For single relationships: meta is read from `relationships[type].meta`\n * For array relationships: per-item meta is read from `relationships[type].data[].meta`\n *\n * @param data - Hydrated JSON:API data\n * @param type - Relationship type key (e.g., \"guide\", \"persons\")\n * @param dataType - Module reference for rehydration\n * @returns Related object(s) augmented with meta properties, or undefined\n */\n protected _readIncludedWithMeta<T extends ApiDataInterface, M extends Record<string, any>>(\n data: JsonApiHydratedDataInterface,\n type: string,\n dataType: ApiRequestDataTypeInterface,\n ): (T & M) | (T & M)[] | undefined {\n // Check if relationship exists\n if (\n data.included === undefined ||\n data.included.length === 0 ||\n data.jsonApi.relationships === undefined ||\n data.jsonApi.relationships[type] === undefined ||\n data.jsonApi.relationships[type].data === undefined\n ) {\n return undefined;\n }\n\n const relationshipData = data.jsonApi.relationships[type].data;\n\n // Handle array relationships with per-item meta\n if (Array.isArray(relationshipData)) {\n const result: (T & M)[] = [];\n\n for (const item of relationshipData) {\n const includedData = data.included.find((inc: any) => inc.id === item.id && inc.type === item.type);\n\n if (!includedData) continue;\n\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n\n // Merge per-item meta from relationships[type].data[].meta\n if (item.meta) {\n AbstractApiData._mergeMeta(entity, item.meta);\n }\n\n result.push(entity as T & M);\n }\n\n return result;\n }\n\n // Handle single relationship\n const includedData = data.included.find(\n (inc: any) => inc.id === relationshipData.id && inc.type === relationshipData.type,\n );\n\n if (!includedData) {\n // Try to find in allData as a fallback\n if (data.allData !== undefined) {\n const fallbackData = data.allData.find(\n (inc: any) => inc.id === relationshipData.id && inc.type === relationshipData.type,\n );\n if (fallbackData) {\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: fallbackData,\n included: data.included,\n }) as T;\n\n // Merge relationship-level meta for single relationships\n const relationshipMeta = data.jsonApi.relationships[type].meta;\n if (relationshipMeta) {\n AbstractApiData._mergeMeta(entity, relationshipMeta);\n }\n return entity as T & M;\n }\n }\n return undefined;\n }\n\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n\n // Merge relationship-level meta for single relationships\n const relationshipMeta = data.jsonApi.relationships[type].meta;\n if (relationshipMeta) {\n AbstractApiData._mergeMeta(entity, relationshipMeta);\n }\n\n return entity as T & M;\n }\n\n /**\n * Copies relationship meta onto a rehydrated entity as own data properties. Object.assign throws\n * when the model declares a getter-only accessor of the same name (an app's `Chunk` with\n * `get relevance()`); an own property shadows that getter, so the model reads the meta value.\n */\n private static _mergeMeta(entity: object, meta: Record<string, any>): void {\n for (const [key, value] of Object.entries(meta)) {\n Object.defineProperty(entity, key, { value, writable: true, enumerable: true, configurable: true });\n }\n }\n\n dehydrate(): JsonApiHydratedDataInterface {\n return {\n jsonApi: this._jsonApi,\n included: this._included ?? [],\n };\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n this._jsonApi = data.jsonApi;\n this._included = data.included;\n\n this._type = this._jsonApi.type;\n this._id = this._jsonApi.id;\n this._createdAt = this._jsonApi.meta?.createdAt !== undefined ? new Date(this._jsonApi.meta.createdAt) : undefined;\n this._updatedAt = this._jsonApi.meta?.updatedAt !== undefined ? new Date(this._jsonApi.meta.updatedAt) : undefined;\n\n this._self = this._jsonApi.links?.self ?? undefined;\n\n return this;\n }\n}\n","import { ComponentType } from \"react\";\n\n// Types for injected hooks\nexport interface I18nRouter {\n push: (href: string) => void;\n replace: (href: string) => void;\n back: () => void;\n forward: () => void;\n refresh: () => void;\n prefetch: (href: string) => void;\n}\n\nexport type UseRouterHook = () => I18nRouter;\nexport type UseTranslationsHook = (namespace?: string) => (key: string, values?: Record<string, any>) => string;\nexport type UseLocaleHook = () => string;\nexport type GetLocaleFunction = () => Promise<string>;\n\nexport type UseDateFnsLocaleHook = () => any; // date-fns Locale type\nexport type LinkComponent = ComponentType<{ href: string; children: React.ReactNode; [key: string]: any }>;\n\nexport interface I18nConfig {\n useRouter: UseRouterHook;\n useTranslations: UseTranslationsHook;\n useLocale?: UseLocaleHook;\n useDateFnsLocale?: UseDateFnsLocaleHook;\n Link: LinkComponent;\n usePathname: () => string;\n /**\n * Server-side locale for API requests (pass next-intl's `getLocale` from `next-intl/server`).\n *\n * The library never imports next-intl itself: instrumentation loads the library, and\n * next-intl's `getLocale` pulls in the app's `i18n/request.ts`, which reads\n * `next/root-params` — a module only allowed inside the app directory.\n */\n getLocale: GetLocaleFunction;\n /**\n * Locales the app supports. The first entry is the fallback.\n * Defaults to `[\"en\"]` when omitted.\n */\n supportedLocales?: string[];\n}\n\n// Private storage\nlet _config: I18nConfig | null = null;\n\n// Configuration function (called by app at startup)\nexport function configureI18n(config: I18nConfig): void {\n _config = config;\n}\n\n// Hooks for library components to use\nexport function useI18nRouter(): I18nRouter {\n if (!_config?.useRouter) {\n throw new Error(\"i18n not configured. Call configureI18n() at app startup.\");\n }\n return _config.useRouter();\n}\n\nexport function useI18nTranslations(namespace?: string): (key: string, values?: Record<string, any>) => string {\n if (!_config?.useTranslations) {\n // Fallback: return key as-is (safe for server/client)\n return (key: string) => key;\n }\n return _config.useTranslations(namespace);\n}\n\nexport function getI18nLink(): LinkComponent {\n if (!_config?.Link) {\n throw new Error(\"i18n not configured. Call configureI18n() at app startup.\");\n }\n return _config.Link;\n}\n\nexport function useI18nLocale(): string {\n if (_config?.useLocale) {\n return _config.useLocale();\n }\n // Fallback to English (safe for server/client)\n return \"en\";\n}\n\n/** The server-side locale from the app's `getLocale`. Throws when `configureI18n` has not run. */\nexport async function getI18nServerLocale(): Promise<string> {\n if (!_config?.getLocale) {\n throw new Error(\"i18n not configured. Call configureI18n() with getLocale at app startup.\");\n }\n return _config.getLocale();\n}\n\nexport function useI18nDateFnsLocale(): any {\n if (_config?.useDateFnsLocale) {\n return _config.useDateFnsLocale();\n }\n // Fallback to undefined (Calendar will use default)\n return undefined;\n}\n\n/** The app's supported locales. Defaults to `[\"en\"]` when not configured. */\nexport function getI18nSupportedLocales(): string[] {\n if (_config?.supportedLocales && _config.supportedLocales.length > 0) {\n return _config.supportedLocales;\n }\n return [\"en\"];\n}\n\n/** The app's default locale: the first supported locale (`\"en\"` when not configured). */\nexport function getI18nDefaultLocale(): string {\n return getI18nSupportedLocales()[0];\n}\n","import { ModuleWithPermissions } from \"../../permissions/types\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { hasBootstrapper, tryBootstrap } from \"./bootstrapStore\";\n\n// Foundation module types - defined by LIBRARY\nexport interface FoundationModuleDefinitions {\n S3: ModuleWithPermissions;\n Auth: ModuleWithPermissions;\n User: ModuleWithPermissions;\n Author: ModuleWithPermissions;\n Company: ModuleWithPermissions;\n Role: ModuleWithPermissions;\n Notification: ModuleWithPermissions;\n Push: ModuleWithPermissions;\n Feature: ModuleWithPermissions;\n Module: ModuleWithPermissions;\n Content: ModuleWithPermissions;\n HowTo: ModuleWithPermissions;\n HandbookPage: ModuleWithPermissions;\n HandbookSection: ModuleWithPermissions;\n HandbookThread: ModuleWithPermissions;\n HandbookThreadMessage: ModuleWithPermissions;\n Assistant: ModuleWithPermissions;\n AssistantMessage: ModuleWithPermissions;\n AssistantAction: ModuleWithPermissions;\n Chunk: ModuleWithPermissions;\n // Billing modules - READ: all users, UPDATE: CompanyAdministrator, ADMIN: Administrator\n Billing: ModuleWithPermissions;\n StripeCustomer: ModuleWithPermissions;\n StripePaymentMethod: ModuleWithPermissions;\n StripeSubscription: ModuleWithPermissions;\n StripeInvoice: ModuleWithPermissions;\n StripeProduct: ModuleWithPermissions;\n StripePrice: ModuleWithPermissions;\n StripeUsage: ModuleWithPermissions;\n StripePromotionCode: ModuleWithPermissions;\n StripeCoupon: ModuleWithPermissions;\n StripeCouponCode: ModuleWithPermissions;\n StripeCouponOffer: ModuleWithPermissions;\n // AI connection administration\n AiConnection: ModuleWithPermissions;\n // OAuth modules\n OAuth: ModuleWithPermissions;\n // Waitlist modules\n Waitlist: ModuleWithPermissions;\n WaitlistStats: ModuleWithPermissions;\n // Email automation modules\n EmailAutomation: ModuleWithPermissions;\n EmailAutomationStep: ModuleWithPermissions;\n EmailAutomationEnrollment: ModuleWithPermissions;\n EmailAutomationTrigger: ModuleWithPermissions;\n // Email blast modules\n EmailBlast: ModuleWithPermissions;\n EmailBlastDelivery: ModuleWithPermissions;\n EmailBlastAudience: ModuleWithPermissions;\n // Blog modules\n BlogPost: ModuleWithPermissions;\n BlogPostTranslation: ModuleWithPermissions;\n BlogCategory: ModuleWithPermissions;\n BlogCategoryTranslation: ModuleWithPermissions;\n BlogSettings: ModuleWithPermissions;\n // Referral modules\n Referral: ModuleWithPermissions;\n ReferralStats: ModuleWithPermissions;\n // Referral link visits and the administrative referral report (opt-in: registered by apps that spread referralAdminModules)\n ReferralVisit: ModuleWithPermissions;\n ReferralAdminSummary: ModuleWithPermissions;\n ReferralAdminReferrer: ModuleWithPermissions;\n ReferralAdminReferral: ModuleWithPermissions;\n // Two-factor authentication modules\n TotpAuthenticator: ModuleWithPermissions;\n TotpSetup: ModuleWithPermissions;\n TotpVerify: ModuleWithPermissions;\n TotpVerifyLogin: ModuleWithPermissions;\n Passkey: ModuleWithPermissions;\n PasskeyRegistrationOptions: ModuleWithPermissions;\n PasskeyRegistrationVerify: ModuleWithPermissions;\n PasskeyRename: ModuleWithPermissions;\n PasskeyVerifyLogin: ModuleWithPermissions;\n PasskeyAuthenticationOptions: ModuleWithPermissions;\n TwoFactorEnable: ModuleWithPermissions;\n TwoFactorChallenge: ModuleWithPermissions;\n TwoFactorStatus: ModuleWithPermissions;\n BackupCodeVerify: ModuleWithPermissions;\n // OAuth sign-up awaiting consent\n PendingRegistration: ModuleWithPermissions;\n // RBAC modules\n PermissionMapping: ModuleWithPermissions;\n ModulePaths: ModuleWithPermissions;\n RbacMatrix: ModuleWithPermissions;\n // Audit modules\n AuditLog: ModuleWithPermissions;\n // Administrative token-usage reporting modules\n TokenUsageAdminSummary: ModuleWithPermissions;\n TokenUsageAdminTimeline: ModuleWithPermissions;\n TokenUsageAdminBreakdown: ModuleWithPermissions;\n // Self-service token-usage reporting modules\n TokenUsageReportSummary: ModuleWithPermissions;\n TokenUsageReportTimeline: ModuleWithPermissions;\n TokenUsageReportBreakdown: ModuleWithPermissions;\n // First-party web analytics modules (tracker + administrative dashboard)\n AnalyticsEvent: ModuleWithPermissions;\n AnalyticsSummary: ModuleWithPermissions;\n AnalyticsTimeline: ModuleWithPermissions;\n AnalyticsBreakdown: ModuleWithPermissions;\n AnalyticsSession: ModuleWithPermissions;\n AnalyticsPageView: ModuleWithPermissions;\n // Account deletion (opt-in: registered only by apps that enable it)\n AccountDeletion: ModuleWithPermissions;\n // Offline mode (opt-in: registered by apps that spread offlineModules)\n OfflineChangeSet: ModuleWithPermissions;\n RootSync: ModuleWithPermissions;\n}\n\n// App-specific modules - apps will augment this interface ONLY\n\nexport interface AppModuleDefinitions {}\n\n// Combined type for full autocompletion\nexport type ModuleDefinitions = FoundationModuleDefinitions & AppModuleDefinitions;\n\n// Symbol key to avoid conflicts with other globals\nconst MODULES_KEY = Symbol.for(\"nextjs-jsonapi:modules\");\n\n// Use globalThis to persist module registry across HMR reloads\nconst globalStore = globalThis as unknown as {\n [MODULES_KEY]?: Map<string, ApiRequestDataTypeInterface>;\n};\n\n// Initialize global modules map if not set\nif (!globalStore[MODULES_KEY]) {\n globalStore[MODULES_KEY] = new Map();\n}\n\nclass ModuleRegistryClass {\n private get _modules(): Map<string, ApiRequestDataTypeInterface> {\n return globalStore[MODULES_KEY]!;\n }\n\n register<K extends string>(name: K, module: ApiRequestDataTypeInterface): void {\n this._modules.set(name, module);\n }\n\n get<K extends keyof ModuleDefinitions>(name: K): ModuleDefinitions[K] {\n let module = this._modules.get(name as string);\n\n // Self-healing: if module not found, try bootstrapping first\n if (!module) {\n const didBootstrap = tryBootstrap();\n if (didBootstrap) {\n // Retry after bootstrap\n module = this._modules.get(name as string);\n }\n }\n\n if (!module) {\n // Provide helpful error message based on state\n const hint = hasBootstrapper()\n ? \"Bootstrap was called but module still not found. Check module registration.\"\n : \"No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.\";\n throw new Error(`Module \"${String(name)}\" not registered. ${hint}`);\n }\n\n return module as ModuleDefinitions[K];\n }\n\n /**\n * True when a module is registered under `name`. Never throws, so a component\n * can check for an opt-in module the app may not have registered.\n */\n has(name: string): boolean {\n // Bootstrap only an empty registry (as findByName does): an app that never\n // registers `name` must not re-run its bootstrapper on every check.\n if (this._modules.size === 0) tryBootstrap();\n return this._modules.has(name);\n }\n\n findByName(moduleName: string): ModuleWithPermissions {\n // Self-healing: try bootstrap if registry is empty\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n\n // Search by module's name property (e.g., \"topics\", \"articles\")\n for (const module of this._modules.values()) {\n if ((module as ModuleWithPermissions).name === moduleName) {\n return module as ModuleWithPermissions;\n }\n }\n throw new Error(`Module not found: ${moduleName}`);\n }\n\n getAllPageUrls(): { id: string; text: string }[] {\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n\n const seen = new Set<string>();\n const result: { id: string; text: string }[] = [];\n for (const [key, module] of this._modules.entries()) {\n const m = module as ModuleWithPermissions;\n if (m.pageUrl && !seen.has(m.pageUrl)) {\n seen.add(m.pageUrl);\n result.push({ id: m.pageUrl, text: key });\n result.push({ id: `${m.pageUrl}/:id`, text: `${key} (detail)` });\n }\n }\n return result.sort((a, b) => a.text.localeCompare(b.text));\n }\n\n findByModelName(modelName: string): ModuleWithPermissions {\n // Direct lookup by registry key (e.g., \"Article\", \"Document\")\n let module = this._modules.get(modelName);\n\n // Self-healing: if not found, try bootstrapping\n if (!module) {\n const didBootstrap = tryBootstrap();\n if (didBootstrap) {\n module = this._modules.get(modelName);\n }\n }\n\n if (!module) {\n throw new Error(`Module not found for model: ${modelName}`);\n }\n return module as ModuleWithPermissions;\n }\n\n findByFeature(feature: string): ModuleWithPermissions[] {\n const response: ModuleWithPermissions[] = [];\n\n for (const module of this._modules.values()) {\n const m = module as ModuleWithPermissions;\n if (m.feature === feature) {\n response.push(m);\n }\n }\n\n return response;\n }\n\n getAll(): ApiRequestDataTypeInterface[] {\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n return Array.from(this._modules.values());\n }\n}\n\nexport const ModuleRegistry = new ModuleRegistryClass();\n\n// Proxy object for Modules.X syntax with autocompletion\nexport const Modules = new Proxy({} as ModuleDefinitions, {\n get(_, prop: string) {\n if (prop === \"findByName\") {\n return (name: string) => ModuleRegistry.findByName(name);\n }\n if (prop === \"findByModelName\") {\n return (name: string) => ModuleRegistry.findByModelName(name);\n }\n if (prop === \"findByFeature\") {\n return (feature: string) => ModuleRegistry.findByFeature(feature);\n }\n return ModuleRegistry.get(prop as keyof ModuleDefinitions);\n },\n}) as ModuleDefinitions & {\n findByName: (name: string) => ModuleWithPermissions;\n findByModelName: (name: string) => ModuleWithPermissions;\n findByFeature: (feature: string) => ModuleWithPermissions[];\n};\n","import { FieldSelector } from \"../fields/FieldSelector\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport type EndpointQuery = {\n endpoint: ApiRequestDataTypeInterface | string;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string | string[] }[];\n};\n\nexport class EndpointCreator {\n private _endpoint: EndpointQuery;\n\n constructor(params: {\n endpoint: ApiRequestDataTypeInterface | string;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string }[];\n }) {\n this._endpoint = {\n endpoint: params.endpoint,\n id: params.id,\n childEndpoint: params.childEndpoint,\n childId: params.childId,\n additionalParams: params.additionalParams ?? [],\n };\n }\n\n endpoint(value: ApiRequestDataTypeInterface | string): EndpointCreator {\n this._endpoint.endpoint = value;\n return this;\n }\n\n id(value: string): EndpointCreator {\n this._endpoint.id = value;\n return this;\n }\n\n childEndpoint(value: ApiRequestDataTypeInterface | string): EndpointCreator {\n this._endpoint.childEndpoint = value;\n return this;\n }\n\n childId(value: string): EndpointCreator {\n this._endpoint.childId = value;\n return this;\n }\n\n set additionalParams(value: { key: string; value: string }[]) {\n this._endpoint.additionalParams = value;\n }\n\n addAdditionalParam(key: string, value: string | string[]): EndpointCreator {\n if (!this._endpoint.additionalParams) this._endpoint.additionalParams = [];\n this._endpoint.additionalParams.push({ key, value });\n return this;\n }\n\n limitToType(selectors: string[]): this {\n this.addAdditionalParam(`include`, selectors.join(\",\"));\n return this;\n }\n\n limitToFields(selectors: FieldSelector<any>[]): this {\n if (selectors.length === 0) return this;\n\n selectors.forEach((selector) => {\n const fieldString = selector.fields.join(\",\");\n this.addAdditionalParam(`fields[${selector.type}]`, fieldString);\n });\n\n return this;\n }\n\n generate(): string {\n let additionalParams = \"\";\n if (this._endpoint.additionalParams) {\n additionalParams = this._endpoint.additionalParams.map((param) => `${param.key}=${param.value}`).join(\"&\");\n }\n\n let response = ``;\n response += `${\n typeof this._endpoint.endpoint === \"string\" ? this._endpoint.endpoint : this._endpoint.endpoint.name\n }`;\n if (this._endpoint.id) response += `/${this._endpoint.id}`;\n if (this._endpoint.childEndpoint) {\n response += `/${\n typeof this._endpoint.childEndpoint === \"string\"\n ? this._endpoint.childEndpoint\n : this._endpoint.childEndpoint.name\n }`;\n }\n if (this._endpoint.childId) response += `/${this._endpoint.childId}`;\n if (additionalParams) response += `?${additionalParams}`;\n\n return response;\n }\n}\n","import { AbstractApiData } from \"../../../core/abstracts/AbstractApiData\";\nimport { JsonApiHydratedDataInterface } from \"../../../core/interfaces/JsonApiHydratedDataInterface\";\nimport { RootSyncEntry, RootSyncInterface, RootSyncLink } from \"./RootSyncInterface\";\n\n/**\n * Child path of the sync answer under the root module record\n * (`GET /<root endpoint>/:id/sync`), the same value as the app API's sync meta endpoint\n * (in Wyrdli, `campaignSyncMeta.endpoint`).\n */\nexport const ROOT_SYNC_ENDPOINT = \"sync\";\n\n/** The sync answer for one root record (`root-syncs`, id = root record id). Read-only. */\nexport class RootSync extends AbstractApiData implements RootSyncInterface {\n private _serverTime?: Date;\n private _locked: boolean = false;\n private _lockedFrom?: Date;\n private _entries?: RootSyncEntry[];\n private _links?: RootSyncLink[];\n\n get serverTime(): Date {\n if (!this._serverTime) throw new Error(\"serverTime is not set.\");\n return this._serverTime;\n }\n\n get locked(): boolean {\n return this._locked;\n }\n\n get lockedFrom(): Date | undefined {\n return this._lockedFrom;\n }\n\n get entries(): RootSyncEntry[] {\n return this._entries ?? [];\n }\n\n get links(): RootSyncLink[] {\n return this._links ?? [];\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n const attributes = data.jsonApi.attributes ?? {};\n this._serverTime = attributes.serverTime ? new Date(attributes.serverTime) : undefined;\n this._locked = Boolean(attributes.locked);\n this._lockedFrom = attributes.lockedFrom ? new Date(attributes.lockedFrom) : undefined;\n this._entries = (attributes.entries ?? []).map((entry: { type: string; id: string; updatedAt: string }) => ({\n type: entry.type,\n id: entry.id,\n updatedAt: new Date(entry.updatedAt),\n }));\n this._links = (attributes.links ?? []).map((link: RootSyncLink) => ({\n fromType: link.fromType,\n fromId: link.fromId,\n toType: link.toType,\n toId: link.toId,\n kind: link.kind,\n props: link.props ?? {},\n }));\n\n return this;\n }\n\n createJsonApi(_data?: any): any {\n throw new Error(\"RootSync is read-only and cannot be created\");\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-A7Y5YW7Q.js","../src/core/factories/RehydrationFactory.ts","../src/core/abstracts/AbstractApiData.ts","../src/i18n/config.ts","../src/core/registry/ModuleRegistry.ts","../src/core/endpoint/EndpointCreator.ts","../src/offline/sync/models/RootSync.ts"],"names":["includedData","includedItem","module","entity"],"mappings":"AAAA;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACCA,IAAM,WAAA,kBAAa,IAAI,GAAA,CAAY,CAAA;AAEnC,IAAM,MAAA,kBAAQ,qCAAA,CAAC,IAAA,EAAA,GAA2D;AACxE,EAAA,MAAM,SAAA,kBAAW,IAAA,6BAAM,SAAA;AACvB,EAAA,uBAAO,QAAA,6BAAU,OAAA,mBAAQ,QAAA,6BAAU,KAAA,EAAK,CAAA,EAAA;AAF5B;AAK2D;AACjD,EAAA;AACD,EAAA;AACW,EAAA;AACd,EAAA;AACd,EAAA;AACS,IAAA;AACX,EAAA;AACqB,IAAA;AACvB,EAAA;AACF;AAVS;AAYuB;AAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAIzB,EAAA;AACoC,IAAA;AAER,IAAA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,EAAA;AAEmB,EAAA;AACM,IAAA;AACc,IAAA;AACD,MAAA;AACpC,IAAA;AAEe,IAAA;AAES,IAAA;AAEe,IAAA;AACL,IAAA;AAElB,MAAA;AAIhB,IAAA;AAC4B,IAAA;AACU,IAAA;AAE/B,IAAA;AACT,EAAA;AACF;AL8Y2C;AACA;AMzeT;AAGJ;AAA6C,EAAA;AAAA,IAAA;AAAA,EAAA;AACjE,EAAA;AACmB,iBAAA;AACnB,EAAA;AACA,EAAA;AACA,EAAA;AAEe,EAAA;AACkB,IAAA;AAC3B,IAAA;AACd,EAAA;AAEsB,EAAA;AACR,IAAA;AACd,EAAA;AAEmC,EAAA;AACrB,IAAA;AACd,EAAA;AAE+B,EAAA;AACJ,IAAA;AAC3B,EAAA;AAE4B,EAAA;AACH,IAAA;AACzB,EAAA;AAEoD,EAAA;AAC9B,IAAA;AAEY,IAAA;AACF,IAAA;AACI,IAAA;AACJ,IAAA;AACS,IAAA;AACzB,MAAA;AACF,MAAA;AACyB,MAAA;AACnC,IAAA;AACqC,IAAA;AACtB,MAAA;AACF,MAAA;AACA,MAAA;AACF,MAAA;AACA,MAAA;AACW,MAAA;AACtB,IAAA;AAEK,IAAA;AACT,EAAA;AAEgC,EAAA;AACd,IAAA;AAClB,EAAA;AACF;ANme2C;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-A7Y5YW7Q.js","sourcesContent":[null,"import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * The resources being rehydrated right now, along the current chain of relationships. A resource\n * met again inside its own chain (A's relationship leads to B, B's back to A) is a circle in the\n * `included` data: following it would recurse until the stack overflows, so it is skipped there.\n */\nconst inProgress = new Set<string>();\n\nconst keyOf = (data: JsonApiHydratedDataInterface): string | undefined => {\n const resource = data?.jsonApi;\n return resource?.type && resource?.id ? `${resource.type}:${resource.id}` : undefined;\n};\n\nfunction guarded<T>(data: JsonApiHydratedDataInterface, run: () => T): T {\n const key = keyOf(data);\n if (!key) return run();\n if (inProgress.has(key)) return undefined as T;\n inProgress.add(key);\n try {\n return run();\n } finally {\n inProgress.delete(key);\n }\n}\n\nexport class RehydrationFactory {\n public static rehydrate<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface,\n ): T {\n const factoryClass = DataClassRegistry.get(classKey);\n\n return guarded(data, () => new factoryClass().rehydrate(data) as T);\n }\n\n public static rehydrateList<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface[],\n ): T[] {\n const factoryClass = DataClassRegistry.get(classKey);\n\n return data.map((item: JsonApiHydratedDataInterface) =>\n guarded(item, () => new factoryClass().rehydrate(item) as T),\n );\n }\n}\n","import { RehydrationFactory } from \"../factories/RehydrationFactory\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../interfaces/JsonApiHydratedDataInterface\";\n\nexport abstract class AbstractApiData implements ApiDataInterface {\n static identifierFields: string[] = [\"name\"];\n\n get identifier(): string {\n const fields = (this.constructor as typeof AbstractApiData).identifierFields;\n return fields\n .map((field) => this._jsonApi?.attributes?.[field])\n .filter((v) => v != null && v !== \"\")\n .join(\" \");\n }\n\n protected _jsonApi?: any;\n protected _included?: any[];\n\n protected _id?: string;\n protected _type?: string;\n protected _createdAt?: Date;\n protected _updatedAt?: Date;\n\n protected _self?: string;\n\n get type(): string {\n if (!this._type) throw new Error(\"Type is not set.\");\n return this._type;\n }\n\n get id(): string {\n if (!this._id) throw new Error(\"Id is not set.\");\n return this._id;\n }\n\n get self(): string | undefined {\n return this._self;\n }\n\n get createdAt(): Date {\n return this._createdAt ?? new Date();\n }\n\n get updatedAt(): Date {\n return this._updatedAt ?? new Date();\n }\n\n get included(): any[] {\n return this._included ?? [];\n }\n\n get jsonApi(): any {\n return this._jsonApi;\n }\n\n ingestJsonApi(_data: JsonApiHydratedDataInterface): void {}\n\n generateApiUrl(_params?: any): string {\n throw new Error(\"Method not implemented.\");\n }\n\n createJsonApi(_data?: any): any {\n throw new Error(\"Method not implemented.\");\n }\n\n protected _readIncluded<T extends ApiDataInterface>(\n data: JsonApiHydratedDataInterface,\n type: string,\n dataType: ApiRequestDataTypeInterface,\n ): T | T[] | undefined {\n if (\n data.included === undefined ||\n data.included.length === 0 ||\n data.jsonApi.relationships === undefined ||\n data.jsonApi.relationships[type] === undefined ||\n data.jsonApi.relationships[type].data === undefined\n ) {\n return undefined;\n }\n\n if (Array.isArray(data.jsonApi.relationships[type].data)) {\n const response: T[] = data.jsonApi.relationships[type].data.map((jsonApiData: any) => {\n const includedData = data.included.find(\n (includedData: any) => includedData.id === jsonApiData.id && includedData.type === jsonApiData.type,\n );\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n });\n\n return response.filter((item: T | undefined) => item !== undefined) as T[];\n }\n\n const includedData = data.included.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n\n if (includedData === undefined && data.allData !== undefined) {\n // Try to find in allData as a fallback\n const fallbackData = data.allData.find(\n (includedData: any) =>\n includedData.id === data.jsonApi.relationships[type].data.id &&\n includedData.type === data.jsonApi.relationships[type].data.type,\n );\n if (fallbackData !== undefined) {\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: fallbackData,\n included: data.included,\n }) as T;\n }\n }\n\n if (includedData === undefined) return undefined;\n\n return RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n }\n\n /**\n * Read included relationships with polymorphic type resolution.\n * Determines the correct model class based on the JSON:API type in included data.\n */\n protected _readIncludedPolymorphic<T extends ApiDataInterface>(\n data: JsonApiHydratedDataInterface,\n relationshipKey: string,\n candidateModules: ApiRequestDataTypeInterface[],\n ): T | T[] | undefined {\n // Validate relationship exists\n if (!data.included?.length || !data.jsonApi.relationships?.[relationshipKey]?.data) {\n return undefined;\n }\n\n const relData = data.jsonApi.relationships[relationshipKey].data;\n\n // Build lookup map: JSON:API type -> module\n const typeToModule = new Map<string, ApiRequestDataTypeInterface>();\n for (const mod of candidateModules) {\n typeToModule.set(mod.name, mod);\n }\n\n if (Array.isArray(relData)) {\n // Many relationship\n const result: T[] = [];\n for (const item of relData) {\n const includedItem = data.included.find((inc: any) => inc.id === item.id && inc.type === item.type);\n if (!includedItem) continue;\n\n // Resolve module by JSON:API type\n const module = typeToModule.get(includedItem.type);\n if (!module) continue;\n\n result.push(\n RehydrationFactory.rehydrate(module, {\n jsonApi: includedItem,\n included: data.included,\n }) as T,\n );\n }\n return result.length > 0 ? result : undefined;\n }\n\n // Single relationship\n const includedItem = data.included.find((inc: any) => inc.id === relData.id && inc.type === relData.type);\n if (!includedItem) return undefined;\n\n const module = typeToModule.get(includedItem.type);\n if (!module) return undefined;\n\n return RehydrationFactory.rehydrate(module, {\n jsonApi: includedItem,\n included: data.included,\n }) as T;\n }\n\n /**\n * Read included relationship data and augment with relationship meta properties.\n * Handles both single relationships (one-to-one) and array relationships (one-to-many).\n *\n * For single relationships: meta is read from `relationships[type].meta`\n * For array relationships: per-item meta is read from `relationships[type].data[].meta`\n *\n * @param data - Hydrated JSON:API data\n * @param type - Relationship type key (e.g., \"guide\", \"persons\")\n * @param dataType - Module reference for rehydration\n * @returns Related object(s) augmented with meta properties, or undefined\n */\n protected _readIncludedWithMeta<T extends ApiDataInterface, M extends Record<string, any>>(\n data: JsonApiHydratedDataInterface,\n type: string,\n dataType: ApiRequestDataTypeInterface,\n ): (T & M) | (T & M)[] | undefined {\n // Check if relationship exists\n if (\n data.included === undefined ||\n data.included.length === 0 ||\n data.jsonApi.relationships === undefined ||\n data.jsonApi.relationships[type] === undefined ||\n data.jsonApi.relationships[type].data === undefined\n ) {\n return undefined;\n }\n\n const relationshipData = data.jsonApi.relationships[type].data;\n\n // Handle array relationships with per-item meta\n if (Array.isArray(relationshipData)) {\n const result: (T & M)[] = [];\n\n for (const item of relationshipData) {\n const includedData = data.included.find((inc: any) => inc.id === item.id && inc.type === item.type);\n\n if (!includedData) continue;\n\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n\n // Merge per-item meta from relationships[type].data[].meta\n if (item.meta) {\n AbstractApiData._mergeMeta(entity, item.meta);\n }\n\n result.push(entity as T & M);\n }\n\n return result;\n }\n\n // Handle single relationship\n const includedData = data.included.find(\n (inc: any) => inc.id === relationshipData.id && inc.type === relationshipData.type,\n );\n\n if (!includedData) {\n // Try to find in allData as a fallback\n if (data.allData !== undefined) {\n const fallbackData = data.allData.find(\n (inc: any) => inc.id === relationshipData.id && inc.type === relationshipData.type,\n );\n if (fallbackData) {\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: fallbackData,\n included: data.included,\n }) as T;\n\n // Merge relationship-level meta for single relationships\n const relationshipMeta = data.jsonApi.relationships[type].meta;\n if (relationshipMeta) {\n AbstractApiData._mergeMeta(entity, relationshipMeta);\n }\n return entity as T & M;\n }\n }\n return undefined;\n }\n\n const entity = RehydrationFactory.rehydrate(dataType, {\n jsonApi: includedData,\n included: data.included,\n }) as T;\n\n // Merge relationship-level meta for single relationships\n const relationshipMeta = data.jsonApi.relationships[type].meta;\n if (relationshipMeta) {\n AbstractApiData._mergeMeta(entity, relationshipMeta);\n }\n\n return entity as T & M;\n }\n\n /**\n * Copies relationship meta onto a rehydrated entity as own data properties. Object.assign throws\n * when the model declares a getter-only accessor of the same name (an app's `Chunk` with\n * `get relevance()`); an own property shadows that getter, so the model reads the meta value.\n */\n private static _mergeMeta(entity: object, meta: Record<string, any>): void {\n for (const [key, value] of Object.entries(meta)) {\n Object.defineProperty(entity, key, { value, writable: true, enumerable: true, configurable: true });\n }\n }\n\n dehydrate(): JsonApiHydratedDataInterface {\n return {\n jsonApi: this._jsonApi,\n included: this._included ?? [],\n };\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n this._jsonApi = data.jsonApi;\n this._included = data.included;\n\n this._type = this._jsonApi.type;\n this._id = this._jsonApi.id;\n this._createdAt = this._jsonApi.meta?.createdAt !== undefined ? new Date(this._jsonApi.meta.createdAt) : undefined;\n this._updatedAt = this._jsonApi.meta?.updatedAt !== undefined ? new Date(this._jsonApi.meta.updatedAt) : undefined;\n\n this._self = this._jsonApi.links?.self ?? undefined;\n\n return this;\n }\n}\n","import { ComponentType } from \"react\";\n\n// Types for injected hooks\nexport interface I18nRouter {\n push: (href: string) => void;\n replace: (href: string) => void;\n back: () => void;\n forward: () => void;\n refresh: () => void;\n prefetch: (href: string) => void;\n}\n\nexport type UseRouterHook = () => I18nRouter;\nexport type UseTranslationsHook = (namespace?: string) => (key: string, values?: Record<string, any>) => string;\nexport type UseLocaleHook = () => string;\nexport type GetLocaleFunction = () => Promise<string>;\n\nexport type UseDateFnsLocaleHook = () => any; // date-fns Locale type\nexport type LinkComponent = ComponentType<{ href: string; children: React.ReactNode; [key: string]: any }>;\n\nexport interface I18nConfig {\n useRouter: UseRouterHook;\n useTranslations: UseTranslationsHook;\n useLocale?: UseLocaleHook;\n useDateFnsLocale?: UseDateFnsLocaleHook;\n Link: LinkComponent;\n usePathname: () => string;\n /**\n * Server-side locale for API requests (pass next-intl's `getLocale` from `next-intl/server`).\n *\n * The library never imports next-intl itself: instrumentation loads the library, and\n * next-intl's `getLocale` pulls in the app's `i18n/request.ts`, which reads\n * `next/root-params` — a module only allowed inside the app directory.\n */\n getLocale: GetLocaleFunction;\n /**\n * Locales the app supports. The first entry is the fallback.\n * Defaults to `[\"en\"]` when omitted.\n */\n supportedLocales?: string[];\n}\n\n// Private storage\nlet _config: I18nConfig | null = null;\n\n// Configuration function (called by app at startup)\nexport function configureI18n(config: I18nConfig): void {\n _config = config;\n}\n\n// Hooks for library components to use\nexport function useI18nRouter(): I18nRouter {\n if (!_config?.useRouter) {\n throw new Error(\"i18n not configured. Call configureI18n() at app startup.\");\n }\n return _config.useRouter();\n}\n\nexport function useI18nTranslations(namespace?: string): (key: string, values?: Record<string, any>) => string {\n if (!_config?.useTranslations) {\n // Fallback: return key as-is (safe for server/client)\n return (key: string) => key;\n }\n return _config.useTranslations(namespace);\n}\n\nexport function getI18nLink(): LinkComponent {\n if (!_config?.Link) {\n throw new Error(\"i18n not configured. Call configureI18n() at app startup.\");\n }\n return _config.Link;\n}\n\nexport function useI18nLocale(): string {\n if (_config?.useLocale) {\n return _config.useLocale();\n }\n // Fallback to English (safe for server/client)\n return \"en\";\n}\n\n/** The server-side locale from the app's `getLocale`. Throws when `configureI18n` has not run. */\nexport async function getI18nServerLocale(): Promise<string> {\n if (!_config?.getLocale) {\n throw new Error(\"i18n not configured. Call configureI18n() with getLocale at app startup.\");\n }\n return _config.getLocale();\n}\n\nexport function useI18nDateFnsLocale(): any {\n if (_config?.useDateFnsLocale) {\n return _config.useDateFnsLocale();\n }\n // Fallback to undefined (Calendar will use default)\n return undefined;\n}\n\n/** The app's supported locales. Defaults to `[\"en\"]` when not configured. */\nexport function getI18nSupportedLocales(): string[] {\n if (_config?.supportedLocales && _config.supportedLocales.length > 0) {\n return _config.supportedLocales;\n }\n return [\"en\"];\n}\n\n/** The app's default locale: the first supported locale (`\"en\"` when not configured). */\nexport function getI18nDefaultLocale(): string {\n return getI18nSupportedLocales()[0];\n}\n","import { ModuleWithPermissions } from \"../../permissions/types\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { hasBootstrapper, tryBootstrap } from \"./bootstrapStore\";\n\n// Foundation module types - defined by LIBRARY\nexport interface FoundationModuleDefinitions {\n S3: ModuleWithPermissions;\n Auth: ModuleWithPermissions;\n User: ModuleWithPermissions;\n Author: ModuleWithPermissions;\n Company: ModuleWithPermissions;\n Role: ModuleWithPermissions;\n Notification: ModuleWithPermissions;\n Push: ModuleWithPermissions;\n Feature: ModuleWithPermissions;\n Module: ModuleWithPermissions;\n Content: ModuleWithPermissions;\n HowTo: ModuleWithPermissions;\n HandbookPage: ModuleWithPermissions;\n HandbookSection: ModuleWithPermissions;\n HandbookThread: ModuleWithPermissions;\n HandbookThreadMessage: ModuleWithPermissions;\n Assistant: ModuleWithPermissions;\n AssistantMessage: ModuleWithPermissions;\n AssistantAction: ModuleWithPermissions;\n Chunk: ModuleWithPermissions;\n // Billing modules - READ: all users, UPDATE: CompanyAdministrator, ADMIN: Administrator\n Billing: ModuleWithPermissions;\n StripeCustomer: ModuleWithPermissions;\n StripePaymentMethod: ModuleWithPermissions;\n StripeSubscription: ModuleWithPermissions;\n StripeInvoice: ModuleWithPermissions;\n StripeProduct: ModuleWithPermissions;\n StripePrice: ModuleWithPermissions;\n StripeUsage: ModuleWithPermissions;\n StripePromotionCode: ModuleWithPermissions;\n StripeCoupon: ModuleWithPermissions;\n StripeCouponCode: ModuleWithPermissions;\n StripeCouponOffer: ModuleWithPermissions;\n // AI connection administration\n AiConnection: ModuleWithPermissions;\n // OAuth modules\n OAuth: ModuleWithPermissions;\n // Waitlist modules\n Waitlist: ModuleWithPermissions;\n WaitlistStats: ModuleWithPermissions;\n // Email automation modules\n EmailAutomation: ModuleWithPermissions;\n EmailAutomationStep: ModuleWithPermissions;\n EmailAutomationEnrollment: ModuleWithPermissions;\n EmailAutomationTrigger: ModuleWithPermissions;\n EmailAutomationCandidate: ModuleWithPermissions;\n // Email blast modules\n EmailBlast: ModuleWithPermissions;\n EmailBlastDelivery: ModuleWithPermissions;\n EmailBlastAudience: ModuleWithPermissions;\n // Blog modules\n BlogPost: ModuleWithPermissions;\n BlogPostTranslation: ModuleWithPermissions;\n BlogCategory: ModuleWithPermissions;\n BlogCategoryTranslation: ModuleWithPermissions;\n BlogSettings: ModuleWithPermissions;\n // Referral modules\n Referral: ModuleWithPermissions;\n ReferralStats: ModuleWithPermissions;\n // Referral link visits and the administrative referral report (opt-in: registered by apps that spread referralAdminModules)\n ReferralVisit: ModuleWithPermissions;\n ReferralAdminSummary: ModuleWithPermissions;\n ReferralAdminReferrer: ModuleWithPermissions;\n ReferralAdminReferral: ModuleWithPermissions;\n // Two-factor authentication modules\n TotpAuthenticator: ModuleWithPermissions;\n TotpSetup: ModuleWithPermissions;\n TotpVerify: ModuleWithPermissions;\n TotpVerifyLogin: ModuleWithPermissions;\n Passkey: ModuleWithPermissions;\n PasskeyRegistrationOptions: ModuleWithPermissions;\n PasskeyRegistrationVerify: ModuleWithPermissions;\n PasskeyRename: ModuleWithPermissions;\n PasskeyVerifyLogin: ModuleWithPermissions;\n PasskeyAuthenticationOptions: ModuleWithPermissions;\n TwoFactorEnable: ModuleWithPermissions;\n TwoFactorChallenge: ModuleWithPermissions;\n TwoFactorStatus: ModuleWithPermissions;\n BackupCodeVerify: ModuleWithPermissions;\n // OAuth sign-up awaiting consent\n PendingRegistration: ModuleWithPermissions;\n // RBAC modules\n PermissionMapping: ModuleWithPermissions;\n ModulePaths: ModuleWithPermissions;\n RbacMatrix: ModuleWithPermissions;\n // Audit modules\n AuditLog: ModuleWithPermissions;\n // Administrative token-usage reporting modules\n TokenUsageAdminSummary: ModuleWithPermissions;\n TokenUsageAdminTimeline: ModuleWithPermissions;\n TokenUsageAdminBreakdown: ModuleWithPermissions;\n // Self-service token-usage reporting modules\n TokenUsageReportSummary: ModuleWithPermissions;\n TokenUsageReportTimeline: ModuleWithPermissions;\n TokenUsageReportBreakdown: ModuleWithPermissions;\n // First-party web analytics modules (tracker + administrative dashboard)\n AnalyticsEvent: ModuleWithPermissions;\n AnalyticsSummary: ModuleWithPermissions;\n AnalyticsTimeline: ModuleWithPermissions;\n AnalyticsBreakdown: ModuleWithPermissions;\n AnalyticsSession: ModuleWithPermissions;\n AnalyticsPageView: ModuleWithPermissions;\n // Account deletion (opt-in: registered only by apps that enable it)\n AccountDeletion: ModuleWithPermissions;\n // Offline mode (opt-in: registered by apps that spread offlineModules)\n OfflineChangeSet: ModuleWithPermissions;\n RootSync: ModuleWithPermissions;\n}\n\n// App-specific modules - apps will augment this interface ONLY\n\nexport interface AppModuleDefinitions {}\n\n// Combined type for full autocompletion\nexport type ModuleDefinitions = FoundationModuleDefinitions & AppModuleDefinitions;\n\n// Symbol key to avoid conflicts with other globals\nconst MODULES_KEY = Symbol.for(\"nextjs-jsonapi:modules\");\n\n// Use globalThis to persist module registry across HMR reloads\nconst globalStore = globalThis as unknown as {\n [MODULES_KEY]?: Map<string, ApiRequestDataTypeInterface>;\n};\n\n// Initialize global modules map if not set\nif (!globalStore[MODULES_KEY]) {\n globalStore[MODULES_KEY] = new Map();\n}\n\nclass ModuleRegistryClass {\n private get _modules(): Map<string, ApiRequestDataTypeInterface> {\n return globalStore[MODULES_KEY]!;\n }\n\n register<K extends string>(name: K, module: ApiRequestDataTypeInterface): void {\n this._modules.set(name, module);\n }\n\n get<K extends keyof ModuleDefinitions>(name: K): ModuleDefinitions[K] {\n let module = this._modules.get(name as string);\n\n // Self-healing: if module not found, try bootstrapping first\n if (!module) {\n const didBootstrap = tryBootstrap();\n if (didBootstrap) {\n // Retry after bootstrap\n module = this._modules.get(name as string);\n }\n }\n\n if (!module) {\n // Provide helpful error message based on state\n const hint = hasBootstrapper()\n ? \"Bootstrap was called but module still not found. Check module registration.\"\n : \"No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.\";\n throw new Error(`Module \"${String(name)}\" not registered. ${hint}`);\n }\n\n return module as ModuleDefinitions[K];\n }\n\n /**\n * True when a module is registered under `name`. Never throws, so a component\n * can check for an opt-in module the app may not have registered.\n */\n has(name: string): boolean {\n // Bootstrap only an empty registry (as findByName does): an app that never\n // registers `name` must not re-run its bootstrapper on every check.\n if (this._modules.size === 0) tryBootstrap();\n return this._modules.has(name);\n }\n\n findByName(moduleName: string): ModuleWithPermissions {\n // Self-healing: try bootstrap if registry is empty\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n\n // Search by module's name property (e.g., \"topics\", \"articles\")\n for (const module of this._modules.values()) {\n if ((module as ModuleWithPermissions).name === moduleName) {\n return module as ModuleWithPermissions;\n }\n }\n throw new Error(`Module not found: ${moduleName}`);\n }\n\n getAllPageUrls(): { id: string; text: string }[] {\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n\n const seen = new Set<string>();\n const result: { id: string; text: string }[] = [];\n for (const [key, module] of this._modules.entries()) {\n const m = module as ModuleWithPermissions;\n if (m.pageUrl && !seen.has(m.pageUrl)) {\n seen.add(m.pageUrl);\n result.push({ id: m.pageUrl, text: key });\n result.push({ id: `${m.pageUrl}/:id`, text: `${key} (detail)` });\n }\n }\n return result.sort((a, b) => a.text.localeCompare(b.text));\n }\n\n findByModelName(modelName: string): ModuleWithPermissions {\n // Direct lookup by registry key (e.g., \"Article\", \"Document\")\n let module = this._modules.get(modelName);\n\n // Self-healing: if not found, try bootstrapping\n if (!module) {\n const didBootstrap = tryBootstrap();\n if (didBootstrap) {\n module = this._modules.get(modelName);\n }\n }\n\n if (!module) {\n throw new Error(`Module not found for model: ${modelName}`);\n }\n return module as ModuleWithPermissions;\n }\n\n findByFeature(feature: string): ModuleWithPermissions[] {\n const response: ModuleWithPermissions[] = [];\n\n for (const module of this._modules.values()) {\n const m = module as ModuleWithPermissions;\n if (m.feature === feature) {\n response.push(m);\n }\n }\n\n return response;\n }\n\n getAll(): ApiRequestDataTypeInterface[] {\n if (this._modules.size === 0) {\n tryBootstrap();\n }\n return Array.from(this._modules.values());\n }\n}\n\nexport const ModuleRegistry = new ModuleRegistryClass();\n\n// Proxy object for Modules.X syntax with autocompletion\nexport const Modules = new Proxy({} as ModuleDefinitions, {\n get(_, prop: string) {\n if (prop === \"findByName\") {\n return (name: string) => ModuleRegistry.findByName(name);\n }\n if (prop === \"findByModelName\") {\n return (name: string) => ModuleRegistry.findByModelName(name);\n }\n if (prop === \"findByFeature\") {\n return (feature: string) => ModuleRegistry.findByFeature(feature);\n }\n return ModuleRegistry.get(prop as keyof ModuleDefinitions);\n },\n}) as ModuleDefinitions & {\n findByName: (name: string) => ModuleWithPermissions;\n findByModelName: (name: string) => ModuleWithPermissions;\n findByFeature: (feature: string) => ModuleWithPermissions[];\n};\n","import { FieldSelector } from \"../fields/FieldSelector\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport type EndpointQuery = {\n endpoint: ApiRequestDataTypeInterface | string;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string | string[] }[];\n};\n\nexport class EndpointCreator {\n private _endpoint: EndpointQuery;\n\n constructor(params: {\n endpoint: ApiRequestDataTypeInterface | string;\n id?: string;\n childEndpoint?: ApiRequestDataTypeInterface | string;\n childId?: string;\n additionalParams?: { key: string; value: string }[];\n }) {\n this._endpoint = {\n endpoint: params.endpoint,\n id: params.id,\n childEndpoint: params.childEndpoint,\n childId: params.childId,\n additionalParams: params.additionalParams ?? [],\n };\n }\n\n endpoint(value: ApiRequestDataTypeInterface | string): EndpointCreator {\n this._endpoint.endpoint = value;\n return this;\n }\n\n id(value: string): EndpointCreator {\n this._endpoint.id = value;\n return this;\n }\n\n childEndpoint(value: ApiRequestDataTypeInterface | string): EndpointCreator {\n this._endpoint.childEndpoint = value;\n return this;\n }\n\n childId(value: string): EndpointCreator {\n this._endpoint.childId = value;\n return this;\n }\n\n set additionalParams(value: { key: string; value: string }[]) {\n this._endpoint.additionalParams = value;\n }\n\n addAdditionalParam(key: string, value: string | string[]): EndpointCreator {\n if (!this._endpoint.additionalParams) this._endpoint.additionalParams = [];\n this._endpoint.additionalParams.push({ key, value });\n return this;\n }\n\n limitToType(selectors: string[]): this {\n this.addAdditionalParam(`include`, selectors.join(\",\"));\n return this;\n }\n\n limitToFields(selectors: FieldSelector<any>[]): this {\n if (selectors.length === 0) return this;\n\n selectors.forEach((selector) => {\n const fieldString = selector.fields.join(\",\");\n this.addAdditionalParam(`fields[${selector.type}]`, fieldString);\n });\n\n return this;\n }\n\n generate(): string {\n let additionalParams = \"\";\n if (this._endpoint.additionalParams) {\n additionalParams = this._endpoint.additionalParams.map((param) => `${param.key}=${param.value}`).join(\"&\");\n }\n\n let response = ``;\n response += `${\n typeof this._endpoint.endpoint === \"string\" ? this._endpoint.endpoint : this._endpoint.endpoint.name\n }`;\n if (this._endpoint.id) response += `/${this._endpoint.id}`;\n if (this._endpoint.childEndpoint) {\n response += `/${\n typeof this._endpoint.childEndpoint === \"string\"\n ? this._endpoint.childEndpoint\n : this._endpoint.childEndpoint.name\n }`;\n }\n if (this._endpoint.childId) response += `/${this._endpoint.childId}`;\n if (additionalParams) response += `?${additionalParams}`;\n\n return response;\n }\n}\n","import { AbstractApiData } from \"../../../core/abstracts/AbstractApiData\";\nimport { JsonApiHydratedDataInterface } from \"../../../core/interfaces/JsonApiHydratedDataInterface\";\nimport { RootSyncEntry, RootSyncInterface, RootSyncLink } from \"./RootSyncInterface\";\n\n/**\n * Child path of the sync answer under the root module record\n * (`GET /<root endpoint>/:id/sync`), the same value as the app API's sync meta endpoint\n * (in Wyrdli, `campaignSyncMeta.endpoint`).\n */\nexport const ROOT_SYNC_ENDPOINT = \"sync\";\n\n/** The sync answer for one root record (`root-syncs`, id = root record id). Read-only. */\nexport class RootSync extends AbstractApiData implements RootSyncInterface {\n private _serverTime?: Date;\n private _locked: boolean = false;\n private _lockedFrom?: Date;\n private _entries?: RootSyncEntry[];\n private _links?: RootSyncLink[];\n\n get serverTime(): Date {\n if (!this._serverTime) throw new Error(\"serverTime is not set.\");\n return this._serverTime;\n }\n\n get locked(): boolean {\n return this._locked;\n }\n\n get lockedFrom(): Date | undefined {\n return this._lockedFrom;\n }\n\n get entries(): RootSyncEntry[] {\n return this._entries ?? [];\n }\n\n get links(): RootSyncLink[] {\n return this._links ?? [];\n }\n\n rehydrate(data: JsonApiHydratedDataInterface): this {\n super.rehydrate(data);\n\n const attributes = data.jsonApi.attributes ?? {};\n this._serverTime = attributes.serverTime ? new Date(attributes.serverTime) : undefined;\n this._locked = Boolean(attributes.locked);\n this._lockedFrom = attributes.lockedFrom ? new Date(attributes.lockedFrom) : undefined;\n this._entries = (attributes.entries ?? []).map((entry: { type: string; id: string; updatedAt: string }) => ({\n type: entry.type,\n id: entry.id,\n updatedAt: new Date(entry.updatedAt),\n }));\n this._links = (attributes.links ?? []).map((link: RootSyncLink) => ({\n fromType: link.fromType,\n fromId: link.fromId,\n toType: link.toType,\n toId: link.toId,\n kind: link.kind,\n props: link.props ?? {},\n }));\n\n return this;\n }\n\n createJsonApi(_data?: any): any {\n throw new Error(\"RootSync is read-only and cannot be created\");\n }\n}\n"]}
@@ -4,7 +4,7 @@ var _chunkG4JR3SFVjs = require('./chunk-G4JR3SFV.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkPMESKNKLjs = require('./chunk-PMESKNKL.js');
7
+ var _chunkOO2DBP6Ljs = require('./chunk-OO2DBP6L.js');
8
8
 
9
9
 
10
10
  var _chunk7QVYU63Ejs = require('./chunk-7QVYU63E.js');
@@ -40,7 +40,7 @@ var ServerSession = class {
40
40
  const headerStore = await _headers.headers.call(void 0, );
41
41
  const token = _optionalChain([cookieStore, 'access', _ => _.get, 'call', _2 => _2("token"), 'optionalAccess', _3 => _3.value]) || void 0;
42
42
  const roles = _optionalChain([cookieStore, 'access', _4 => _4.get, 'call', _5 => _5("roles"), 'optionalAccess', _6 => _6.value]);
43
- const viewportCookie = _optionalChain([cookieStore, 'access', _7 => _7.get, 'call', _8 => _8(_chunkPMESKNKLjs.VIEWPORT_COOKIE_NAME), 'optionalAccess', _9 => _9.value]);
43
+ const viewportCookie = _optionalChain([cookieStore, 'access', _7 => _7.get, 'call', _8 => _8(_chunkOO2DBP6Ljs.VIEWPORT_COOKIE_NAME), 'optionalAccess', _9 => _9.value]);
44
44
  return {
45
45
  isLogged: !!token,
46
46
  isAdministrator: !!roles && roles.includes(_chunkG4JR3SFVjs.getRoleId.call(void 0, ).Administrator),
@@ -88,7 +88,7 @@ var ServerSession = class {
88
88
  if (!rawModules) return false;
89
89
  const modules = JSON.parse(_pako.ungzip.call(void 0, Buffer.from(rawModules, "base64"), { toText: true }));
90
90
  const selectedModule = modules.find((module) => module.id === params.module.moduleId);
91
- return _chunkPMESKNKLjs.checkPermissionsFromServer.call(void 0, {
91
+ return _chunkOO2DBP6Ljs.checkPermissionsFromServer.call(void 0, {
92
92
  module: params.module,
93
93
  action: params.action,
94
94
  data: params.data,
@@ -138,4 +138,4 @@ _chunk7QVYU63Ejs.__name.call(void 0, readBuildId, "readBuildId");
138
138
 
139
139
 
140
140
  exports.invalidateCacheTag = invalidateCacheTag; exports.invalidateCacheTags = invalidateCacheTags; exports.updateCacheTag = updateCacheTag; exports.ServerSession = ServerSession; exports.buildOfflineManifest = buildOfflineManifest;
141
- //# sourceMappingURL=chunk-ZYSNJKOP.js.map
141
+ //# sourceMappingURL=chunk-DFA566KY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-ZYSNJKOP.js","../src/server/cache.ts","../src/server/ServerSession.ts","../src/offline/server/build-offline-manifest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACTA,mCAAyC;AAkBzC,MAAA,SAAsB,kBAAA,CAAmB,GAAA,EAAa,QAAA,EAAwB,KAAA,EAAsB;AAClG,EAAA,kCAAA,GAAc,EAAK,OAAO,CAAA;AAC5B;AAFsB,qCAAA,kBAAA,EAAA,oBAAA,CAAA;AAUtB,MAAA,SAAsB,mBAAA,CAAoB,IAAA,EAAgB,QAAA,EAAwB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IAAI,CAAA,CAAE,KAAA,CAAM,cAAA,CAAK,GAAG,CAAA,CAAE,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAGlC,EAAA;AAC/B,EAAA;AAC3B;AAZsB;AAcyD;AACzE,EAAA;AACmE,IAAA;AACvD,EAAA;AACgD,IAAA;AACyB,IAAA;AACzF,EAAA;AACF;AAPe;AH2FgG;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-ZYSNJKOP.js","sourcesContent":[null,"// Server-only utilities (NOT server actions - these cannot be called from client components)\n\nimport { revalidateTag, updateTag } from \"next/cache\";\n\nimport type { CacheProfile } from \"./cacheProfiles\";\n\nexport { CACHE_PROFILES, type CacheProfile } from \"./cacheProfiles\";\n\n/**\n * Revalidate a cache tag to invalidate cached data.\n * Next.js 16+ requires a profile parameter.\n *\n * With `\"max\"` the tagged entries are marked stale and served stale-while-revalidate\n * (a one-year window): the next request still gets the old data while fresh data loads\n * in the background. It is not an immediate invalidation. A Server Action that must\n * read its own write uses `updateCacheTag` instead.\n *\n * @param tag - The cache tag to invalidate\n * @param profile - The cache profile whose `expire` bounds how long stale data may be served (defaults to \"max\")\n */\nexport async function invalidateCacheTag(tag: string, profile: CacheProfile = \"max\"): Promise<void> {\n revalidateTag(tag, profile);\n}\n\n/**\n * Revalidate multiple cache tags.\n *\n * @param tags - Array of cache tags to invalidate\n * @param profile - The cache profile, see `invalidateCacheTag` (defaults to \"max\", stale-while-revalidate)\n */\nexport async function invalidateCacheTags(tags: string[], profile: CacheProfile = \"max\"): Promise<void> {\n for (const tag of tags) {\n revalidateTag(tag, profile);\n }\n}\n\n/**\n * Expire a cache tag immediately, so the same request reads fresh data (read-your-own-writes).\n * Wraps `updateTag`, which works in Server Actions only. Route Handlers use `invalidateCacheTag`.\n *\n * @param tag - The cache tag to expire\n */\nexport async function updateCacheTag(tag: string): Promise<void> {\n updateTag(tag);\n}\n","import { cookies, headers } from \"next/headers\";\nimport { redirect } from \"next/navigation\";\nimport { userAgent } from \"next/server\";\nimport { ungzip } from \"pako\";\nimport { Action, checkPermissionsFromServer, ModuleWithPermissions } from \"../permissions\";\nimport { getRoleId } from \"../roles/config\";\nimport { VIEWPORT_COOKIE_NAME } from \"../utils/use-mobile\";\n\nexport interface SessionSnapshot {\n isLogged: boolean;\n isAdministrator: boolean;\n token?: string;\n sidebarOpen: boolean;\n isMobile: boolean;\n}\n\nexport class ServerSession {\n static async read(): Promise<SessionSnapshot> {\n const cookieStore = await cookies();\n const headerStore = await headers();\n\n const token = cookieStore.get(\"token\")?.value || undefined;\n const roles = cookieStore.get(\"roles\")?.value;\n const viewportCookie = cookieStore.get(VIEWPORT_COOKIE_NAME)?.value;\n\n return {\n isLogged: !!token,\n isAdministrator: !!roles && roles.includes(getRoleId().Administrator),\n token,\n sidebarOpen: cookieStore.get(\"sidebar_state\")?.value !== \"false\",\n isMobile: viewportCookie ? viewportCookie === \"1\" : userAgent({ headers: headerStore }).device.type === \"mobile\",\n };\n }\n\n static async isLogged() {\n const cookieStore = await cookies();\n const token = cookieStore.get(\"token\");\n\n if (!token || !token.value) return false;\n return true;\n }\n\n static async companyId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"companyId\")?.value ?? \"\";\n }\n\n static async userId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"userId\")?.value ?? \"\";\n }\n\n static async checkPermission<M extends ModuleWithPermissions>(params: { module: M; action: Action; data?: any }) {\n if (!(await this.hasPermissionToModule(params))) redirect(`/401`);\n }\n\n static async hasRole(roleId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const roles = cookieStore.get(\"roles\")?.value;\n\n if (!roles || !roles.includes(roleId)) return false;\n\n return true;\n }\n\n static async hasFeature(featureId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const features = cookieStore.get(\"features\")?.value;\n\n if (!features || !features.includes(featureId)) return false;\n\n return true;\n }\n\n static async hasPermissionToModule<M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }): Promise<boolean> {\n const cookieStore = await cookies();\n\n if (params.module.feature) {\n const features = cookieStore.get(\"features\")?.value;\n\n if (features && !features.includes(params.module.feature)) return false;\n }\n\n const rawModules = cookieStore.get(\"modules\")?.value;\n if (!rawModules) return false;\n\n const modules: {\n id: string;\n permissions: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n }[] = JSON.parse(ungzip(Buffer.from(rawModules, \"base64\"), { toText: true }));\n\n const selectedModule = modules.find((module) => module.id === params.module.moduleId);\n\n return checkPermissionsFromServer({\n module: params.module,\n action: params.action,\n data: params.data,\n userId: await this.userId(),\n selectedModule: selectedModule,\n });\n\n // if (!selectedModule) return false;\n\n // if (!selectedModule.permissions[params.action]) return false;\n // if (typeof selectedModule.permissions[params.action] === \"boolean\")\n // return selectedModule.permissions[params.action] as boolean;\n\n // if (!params.data) return false;\n\n // return params.data[selectedModule.permissions[params.action] as string] === this.userId;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport type OfflineManifest = { buildId: string; assets: string[] };\n\nasync function listFiles(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) files.push(...(await listFiles(full)));\n else if (entry.isFile()) files.push(full);\n }\n return files;\n}\n\n/**\n * Describes the running build for the service worker's offline shell precache\n * (`/offline-manifest.json`): the build id from `<distDir>/BUILD_ID` and every\n * file under `<distDir>/static`, as the `/_next/static/...` URL Next serves it at.\n * `next dev` writes no BUILD_ID (its folder is `.next/dev`): the id is then derived from the\n * asset list, whose chunk names carry content hashes, so an edit gives a new id and the\n * service worker refreshes the shell.\n * `distDir` must be the value the app's next.config uses. `extraAssets` are further same-origin\n * URLs the shell needs with no network (the SQLite files the device worker loads).\n */\nexport async function buildOfflineManifest(params: {\n distDir: string;\n extraAssets?: string[];\n}): Promise<OfflineManifest> {\n const staticDir = path.join(params.distDir, \"static\");\n const files = await listFiles(staticDir);\n const assets = files\n .map((file) => `/_next/static/${path.relative(staticDir, file).split(path.sep).join(\"/\")}`)\n .concat(params.extraAssets ?? [])\n .sort();\n const buildId = await readBuildId(params.distDir, assets);\n return { buildId, assets };\n}\n\nasync function readBuildId(distDir: string, assets: string[]): Promise<string> {\n try {\n return (await readFile(path.join(distDir, \"BUILD_ID\"), \"utf8\")).trim();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n return `dev-${createHash(\"sha256\").update(assets.join(\"\\n\")).digest(\"hex\").slice(0, 16)}`;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-DFA566KY.js","../src/server/cache.ts","../src/server/ServerSession.ts","../src/offline/server/build-offline-manifest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACTA,mCAAyC;AAkBzC,MAAA,SAAsB,kBAAA,CAAmB,GAAA,EAAa,QAAA,EAAwB,KAAA,EAAsB;AAClG,EAAA,kCAAA,GAAc,EAAK,OAAO,CAAA;AAC5B;AAFsB,qCAAA,kBAAA,EAAA,oBAAA,CAAA;AAUtB,MAAA,SAAsB,mBAAA,CAAoB,IAAA,EAAgB,QAAA,EAAwB,KAAA,EAAsB;AACtG,EAAA,IAAA,CAAA,MAAW,IAAA,GAAO,IAAA,EAAM;AACtB,IAAA,kCAAA,GAAc,EAAK,OAAO,CAAA;AAAA,EAC5B;AACF;AAJsB,qCAAA,mBAAA,EAAA,qBAAA,CAAA;AAYtB,MAAA,SAAsB,cAAA,CAAe,GAAA,EAA4B;AAC/D,EAAA,8BAAA,GAAa,CAAA;AACf;AAFsB,qCAAA,cAAA,EAAA,gBAAA,CAAA;ADftB;AACA;AE5BA,uCA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k-DFA566KY.js","sourcesContent":[null,"// Server-only utilities (NOT server actions - these cannot be called from client components)\n\nimport { revalidateTag, updateTag } from \"next/cache\";\n\nimport type { CacheProfile } from \"./cacheProfiles\";\n\nexport { CACHE_PROFILES, type CacheProfile } from \"./cacheProfiles\";\n\n/**\n * Revalidate a cache tag to invalidate cached data.\n * Next.js 16+ requires a profile parameter.\n *\n * With `\"max\"` the tagged entries are marked stale and served stale-while-revalidate\n * (a one-year window): the next request still gets the old data while fresh data loads\n * in the background. It is not an immediate invalidation. A Server Action that must\n * read its own write uses `updateCacheTag` instead.\n *\n * @param tag - The cache tag to invalidate\n * @param profile - The cache profile whose `expire` bounds how long stale data may be served (defaults to \"max\")\n */\nexport async function invalidateCacheTag(tag: string, profile: CacheProfile = \"max\"): Promise<void> {\n revalidateTag(tag, profile);\n}\n\n/**\n * Revalidate multiple cache tags.\n *\n * @param tags - Array of cache tags to invalidate\n * @param profile - The cache profile, see `invalidateCacheTag` (defaults to \"max\", stale-while-revalidate)\n */\nexport async function invalidateCacheTags(tags: string[], profile: CacheProfile = \"max\"): Promise<void> {\n for (const tag of tags) {\n revalidateTag(tag, profile);\n }\n}\n\n/**\n * Expire a cache tag immediately, so the same request reads fresh data (read-your-own-writes).\n * Wraps `updateTag`, which works in Server Actions only. Route Handlers use `invalidateCacheTag`.\n *\n * @param tag - The cache tag to expire\n */\nexport async function updateCacheTag(tag: string): Promise<void> {\n updateTag(tag);\n}\n","import { cookies, headers } from \"next/headers\";\nimport { redirect } from \"next/navigation\";\nimport { userAgent } from \"next/server\";\nimport { ungzip } from \"pako\";\nimport { Action, checkPermissionsFromServer, ModuleWithPermissions } from \"../permissions\";\nimport { getRoleId } from \"../roles/config\";\nimport { VIEWPORT_COOKIE_NAME } from \"../utils/use-mobile\";\n\nexport interface SessionSnapshot {\n isLogged: boolean;\n isAdministrator: boolean;\n token?: string;\n sidebarOpen: boolean;\n isMobile: boolean;\n}\n\nexport class ServerSession {\n static async read(): Promise<SessionSnapshot> {\n const cookieStore = await cookies();\n const headerStore = await headers();\n\n const token = cookieStore.get(\"token\")?.value || undefined;\n const roles = cookieStore.get(\"roles\")?.value;\n const viewportCookie = cookieStore.get(VIEWPORT_COOKIE_NAME)?.value;\n\n return {\n isLogged: !!token,\n isAdministrator: !!roles && roles.includes(getRoleId().Administrator),\n token,\n sidebarOpen: cookieStore.get(\"sidebar_state\")?.value !== \"false\",\n isMobile: viewportCookie ? viewportCookie === \"1\" : userAgent({ headers: headerStore }).device.type === \"mobile\",\n };\n }\n\n static async isLogged() {\n const cookieStore = await cookies();\n const token = cookieStore.get(\"token\");\n\n if (!token || !token.value) return false;\n return true;\n }\n\n static async companyId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"companyId\")?.value ?? \"\";\n }\n\n static async userId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"userId\")?.value ?? \"\";\n }\n\n static async checkPermission<M extends ModuleWithPermissions>(params: { module: M; action: Action; data?: any }) {\n if (!(await this.hasPermissionToModule(params))) redirect(`/401`);\n }\n\n static async hasRole(roleId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const roles = cookieStore.get(\"roles\")?.value;\n\n if (!roles || !roles.includes(roleId)) return false;\n\n return true;\n }\n\n static async hasFeature(featureId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const features = cookieStore.get(\"features\")?.value;\n\n if (!features || !features.includes(featureId)) return false;\n\n return true;\n }\n\n static async hasPermissionToModule<M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }): Promise<boolean> {\n const cookieStore = await cookies();\n\n if (params.module.feature) {\n const features = cookieStore.get(\"features\")?.value;\n\n if (features && !features.includes(params.module.feature)) return false;\n }\n\n const rawModules = cookieStore.get(\"modules\")?.value;\n if (!rawModules) return false;\n\n const modules: {\n id: string;\n permissions: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n }[] = JSON.parse(ungzip(Buffer.from(rawModules, \"base64\"), { toText: true }));\n\n const selectedModule = modules.find((module) => module.id === params.module.moduleId);\n\n return checkPermissionsFromServer({\n module: params.module,\n action: params.action,\n data: params.data,\n userId: await this.userId(),\n selectedModule: selectedModule,\n });\n\n // if (!selectedModule) return false;\n\n // if (!selectedModule.permissions[params.action]) return false;\n // if (typeof selectedModule.permissions[params.action] === \"boolean\")\n // return selectedModule.permissions[params.action] as boolean;\n\n // if (!params.data) return false;\n\n // return params.data[selectedModule.permissions[params.action] as string] === this.userId;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport type OfflineManifest = { buildId: string; assets: string[] };\n\nasync function listFiles(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) files.push(...(await listFiles(full)));\n else if (entry.isFile()) files.push(full);\n }\n return files;\n}\n\n/**\n * Describes the running build for the service worker's offline shell precache\n * (`/offline-manifest.json`): the build id from `<distDir>/BUILD_ID` and every\n * file under `<distDir>/static`, as the `/_next/static/...` URL Next serves it at.\n * `next dev` writes no BUILD_ID (its folder is `.next/dev`): the id is then derived from the\n * asset list, whose chunk names carry content hashes, so an edit gives a new id and the\n * service worker refreshes the shell.\n * `distDir` must be the value the app's next.config uses. `extraAssets` are further same-origin\n * URLs the shell needs with no network (the SQLite files the device worker loads).\n */\nexport async function buildOfflineManifest(params: {\n distDir: string;\n extraAssets?: string[];\n}): Promise<OfflineManifest> {\n const staticDir = path.join(params.distDir, \"static\");\n const files = await listFiles(staticDir);\n const assets = files\n .map((file) => `/_next/static/${path.relative(staticDir, file).split(path.sep).join(\"/\")}`)\n .concat(params.extraAssets ?? [])\n .sort();\n const buildId = await readBuildId(params.distDir, assets);\n return { buildId, assets };\n}\n\nasync function readBuildId(distDir: string, assets: string[]): Promise<string> {\n try {\n return (await readFile(path.join(distDir, \"BUILD_ID\"), \"utf8\")).trim();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n return `dev-${createHash(\"sha256\").update(assets.join(\"\\n\")).digest(\"hex\").slice(0, 16)}`;\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkPMESKNKLjs = require('./chunk-PMESKNKL.js');
3
+ var _chunkOO2DBP6Ljs = require('./chunk-OO2DBP6L.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk4XLDBOSEjs = require('./chunk-4XLDBOSE.js');
8
+ var _chunkA7Y5YW7Qjs = require('./chunk-A7Y5YW7Q.js');
9
9
 
10
10
 
11
11
 
@@ -126,7 +126,7 @@ function getWaitlistConfig() {
126
126
  }
127
127
  _chunk7QVYU63Ejs.__name.call(void 0, getWaitlistConfig, "getWaitlistConfig");
128
128
  function useWaitlistText() {
129
- const t = _chunk4XLDBOSEjs.useI18nTranslations.call(void 0, );
129
+ const t = _chunkA7Y5YW7Qjs.useI18nTranslations.call(void 0, );
130
130
  const translate = getWaitlistConfig().translate === true;
131
131
  return (value) => {
132
132
  if (!value) return void 0;
@@ -264,7 +264,7 @@ var COMPANY_ADMINISTRATOR_ROLE_ID = "2e1eee00-6cba-4506-9059-ccd24e4ea5b0";
264
264
  var ACTION_TYPES = ["read", "create", "update", "delete"];
265
265
 
266
266
  // src/features/rbac/data/RbacService.ts
267
- var RbacService = class extends _chunkPMESKNKLjs.AbstractService {
267
+ var RbacService = class extends _chunkOO2DBP6Ljs.AbstractService {
268
268
  static {
269
269
  _chunk7QVYU63Ejs.__name.call(void 0, this, "RbacService");
270
270
  }
@@ -275,9 +275,9 @@ var RbacService = class extends _chunkPMESKNKLjs.AbstractService {
275
275
  * Dev-only endpoint — see class header.
276
276
  */
277
277
  static async fetchMatrix() {
278
- const endpoint = new (0, _chunk4XLDBOSEjs.EndpointCreator)({ endpoint: _chunk4XLDBOSEjs.Modules.RbacMatrix }).generate();
278
+ const endpoint = new (0, _chunkA7Y5YW7Qjs.EndpointCreator)({ endpoint: _chunkA7Y5YW7Qjs.Modules.RbacMatrix }).generate();
279
279
  const model = await this.callApi({
280
- type: _chunk4XLDBOSEjs.Modules.RbacMatrix,
280
+ type: _chunkA7Y5YW7Qjs.Modules.RbacMatrix,
281
281
  method: "GET" /* GET */,
282
282
  endpoint
283
283
  });
@@ -297,9 +297,9 @@ var RbacService = class extends _chunkPMESKNKLjs.AbstractService {
297
297
  * Dev-only endpoint — see class header.
298
298
  */
299
299
  static async saveMatrix(args) {
300
- const endpoint = new (0, _chunk4XLDBOSEjs.EndpointCreator)({ endpoint: _chunk4XLDBOSEjs.Modules.RbacMatrix }).generate();
300
+ const endpoint = new (0, _chunkA7Y5YW7Qjs.EndpointCreator)({ endpoint: _chunkA7Y5YW7Qjs.Modules.RbacMatrix }).generate();
301
301
  const model = await this.callApi({
302
- type: _chunk4XLDBOSEjs.Modules.RbacMatrix,
302
+ type: _chunkA7Y5YW7Qjs.Modules.RbacMatrix,
303
303
  method: "PUT" /* PUT */,
304
304
  endpoint,
305
305
  input: args
@@ -342,4 +342,4 @@ var RbacService = class extends _chunkPMESKNKLjs.AbstractService {
342
342
 
343
343
 
344
344
  exports._getStaticHelpContent = _getStaticHelpContent; exports.configureJsonApi = configureJsonApi; exports.configureClientConfig = configureClientConfig; exports.getApiUrl = getApiUrl; exports.getPublicApiUrl = getPublicApiUrl; exports.getAppUrl = getAppUrl; exports.getTrackablePages = getTrackablePages; exports.getStripePublishableKey = getStripePublishableKey; exports.configureLogin = configureLogin; exports.isDiscordAuthEnabled = isDiscordAuthEnabled; exports.isGoogleAuthEnabled = isGoogleAuthEnabled; exports.isInternalAuthEnabled = isInternalAuthEnabled; exports.isRegistrationAllowed = isRegistrationAllowed; exports.getRegistrationMode = getRegistrationMode; exports.configureWaitlist = configureWaitlist; exports.getWaitlistConfig = getWaitlistConfig; exports.useWaitlistText = useWaitlistText; exports.configureReferral = configureReferral; exports.getReferralConfig = getReferralConfig; exports.isReferralEnabled = isReferralEnabled; exports.SIGNUP_SOURCE_COOKIE = SIGNUP_SOURCE_COOKIE; exports.SIGNUP_SOURCE_COOKIE_MAX_AGE = SIGNUP_SOURCE_COOKIE_MAX_AGE; exports.SIGNUP_SOURCE_FIELDS = SIGNUP_SOURCE_FIELDS; exports.readSignupSourceFromLocation = readSignupSourceFromLocation; exports.captureSignupSource = captureSignupSource; exports.getSignupSource = getSignupSource; exports.COMPANY_ADMINISTRATOR_ROLE_ID = COMPANY_ADMINISTRATOR_ROLE_ID; exports.ACTION_TYPES = ACTION_TYPES; exports.RbacService = RbacService;
345
- //# sourceMappingURL=chunk-DJXSCARG.js.map
345
+ //# sourceMappingURL=chunk-I5BQLY7V.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-DJXSCARG.js","../src/core/registry/helpStore.ts","../src/client/config.ts","../src/login/config.ts","../src/features/waitlist/config/waitlist.config.ts","../src/features/referral/config.ts","../src/features/signup-source/signup-source.ts","../src/features/rbac/data/RbacTypes.ts","../src/features/rbac/data/RbacService.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACLA,IAAM,iBAAA,kBAAmB,MAAA,CAAO,GAAA,CAAI,4BAA4B,C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A;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-DJXSCARG.js","sourcesContent":[null,"/**\n * Centralized help-content store accessible from client and server contexts.\n * Uses a globalThis Symbol key to persist across HMR/Turbopack reloads and to\n * bridge between the client-side `configureJsonApi` (in `client/config.ts`)\n * and the HelpProvider context. Holds the brand-only HelpContentConfig.\n *\n * NO external dependencies to avoid circular imports.\n *\n * Pattern mirrors `bootstrapStore.ts`.\n */\n\nconst HELP_CONTENT_KEY = Symbol.for(\"nextjs-jsonapi:helpContent\");\n\nconst globalStore = globalThis as unknown as {\n [HELP_CONTENT_KEY]?: unknown | null;\n};\n\nif (globalStore[HELP_CONTENT_KEY] === undefined) {\n globalStore[HELP_CONTENT_KEY] = null;\n}\n\nexport function _setStaticHelpContent(cfg: unknown | null): void {\n globalStore[HELP_CONTENT_KEY] = cfg;\n}\n\nexport function _getStaticHelpContent<T = unknown>(): T | null {\n return (globalStore[HELP_CONTENT_KEY] as T | null) ?? null;\n}\n","\"use client\";\n\nimport { ModuleWithPermissions } from \"../permissions/types\";\nimport { ENV } from \"../core/env\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { _setStaticHelpContent } from \"../core/registry/helpStore\";\nimport type { HelpContentConfig } from \"../features/help/interfaces/help-content-config.interface\";\n\n// Config storage for client-side contexts\nlet _clientConfig: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n stripePublishableKey?: string;\n} | null = null;\n\n/**\n * Configure the JSON:API client. This is the main configuration function.\n * This is typically called during app initialization.\n * @param config.helpContent - Optional help-content config (brand only). Forwarded to the help feature's globalThis-backed store; not stored on the client config.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n stripePublishableKey?: string;\n helpContent?: HelpContentConfig;\n}): void {\n const { helpContent, ...rest } = config;\n _clientConfig = rest;\n if (helpContent) {\n _setStaticHelpContent(helpContent);\n }\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\n/**\n * Configure the client config. This is typically called during app initialization.\n * @deprecated Use configureJsonApi instead\n */\nexport function configureClientConfig(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n}): void {\n _clientConfig = config;\n}\n\n/**\n * Get the configured API URL.\n *\n * This may resolve to an internal/private host (e.g. a docker-network\n * hostname) when configured to do so for SSR fetches. Do NOT use this for\n * URLs that are rendered into HTML and followed by the browser — use\n * `getPublicApiUrl()` instead.\n */\nexport function getApiUrl(): string {\n if (_clientConfig?.apiUrl) {\n return _clientConfig.apiUrl;\n }\n return ENV.API_URL;\n}\n\n/**\n * Get the public-facing API URL.\n *\n * Always sourced from `NEXT_PUBLIC_API_URL` so it is identical on server\n * and client, and reachable from the user's browser. Use for any URL that\n * gets rendered into HTML the browser will navigate to (links, redirects,\n * OAuth hrefs).\n */\nexport function getPublicApiUrl(): string {\n return ENV.API_URL;\n}\n\n/**\n * Get the configured app URL.\n */\nexport function getAppUrl(): string {\n if (_clientConfig?.appUrl) {\n return _clientConfig.appUrl;\n }\n if (ENV.APP_URL_ALTERNATE) {\n return ENV.APP_URL_ALTERNATE;\n }\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n return \"\";\n}\n\n/**\n * Get the configured trackable pages.\n */\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _clientConfig?.trackablePages ?? [];\n}\n\n/**\n * Get the configured Stripe publishable key.\n */\nexport function getStripePublishableKey(): string | undefined {\n return _clientConfig?.stripePublishableKey;\n}\n","let _useDiscordAuth: boolean = false;\nlet _useGoogleAuth: boolean = false;\nlet _useInternalAuth: boolean = true;\nlet _allowRegistration: boolean = true;\nlet _registrationMode: \"open\" | \"closed\" | \"waitlist\" = \"open\";\n\nexport type RegistrationMode = \"open\" | \"closed\" | \"waitlist\";\n\nexport interface LoginConfig {\n discordClientId?: string;\n googleClientId?: string;\n useInternalAuth?: boolean;\n allowRegistration?: boolean;\n registrationMode?: RegistrationMode;\n}\n\nexport function configureLogin(params: LoginConfig): void {\n _useDiscordAuth = !!params.discordClientId;\n _useGoogleAuth = !!params.googleClientId;\n _useInternalAuth = params.useInternalAuth ?? true;\n _allowRegistration = params.allowRegistration ?? true;\n _registrationMode = params.registrationMode ?? \"open\";\n}\n\nexport function isDiscordAuthEnabled(): boolean {\n return _useDiscordAuth;\n}\n\nexport function isGoogleAuthEnabled(): boolean {\n return _useGoogleAuth;\n}\n\nexport function isInternalAuthEnabled(): boolean {\n return _useInternalAuth;\n}\n\nexport function isRegistrationAllowed(): boolean {\n return _allowRegistration;\n}\n\nexport function getRegistrationMode(): RegistrationMode {\n return _registrationMode;\n}\n","import { useI18nTranslations } from \"../../../i18n\";\n\nexport type QuestionnaireFieldType = \"text\" | \"textarea\" | \"select\" | \"checkbox\";\n\nexport interface QuestionnaireOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface QuestionnaireField {\n id: string;\n type: QuestionnaireFieldType;\n label: string;\n description?: string;\n placeholder?: string;\n required?: boolean;\n options?: QuestionnaireOption[];\n}\n\nexport interface WaitlistConfig {\n questionnaire?: QuestionnaireField[];\n heroTitle?: string;\n heroSubtitle?: string;\n heroDescription?: string;\n benefits?: string[];\n /**\n * When true, every text above (hero title, subtitle, description, benefits and\n * the questionnaire's labels, descriptions, placeholders and option labels) is\n * a message key and renders through `t()`. Defaults to false: the strings\n * render as given.\n */\n translate?: boolean;\n}\n\nlet _waitlistConfig: WaitlistConfig = {};\n\nexport function configureWaitlist(config: WaitlistConfig): void {\n _waitlistConfig = config;\n}\n\nexport function getWaitlistConfig(): WaitlistConfig {\n return _waitlistConfig;\n}\n\n/**\n * Resolves a waitlist config text: `t(value)` when the config sets\n * `translate`, the value itself otherwise. Empty values stay undefined.\n */\nexport function useWaitlistText(): (value?: string) => string | undefined {\n const t = useI18nTranslations();\n const translate = getWaitlistConfig().translate === true;\n\n return (value?: string) => {\n if (!value) return undefined;\n return translate ? t(value) : value;\n };\n}\n","/**\n * Configuration interface for frontend referral feature.\n */\nexport interface ReferralConfig {\n /**\n * Whether the referral feature is enabled.\n * When false, components render nothing and hooks return null.\n * @default false\n */\n enabled?: boolean;\n\n /**\n * Name of the cookie used to store referral codes.\n * @default \"referral_code\"\n */\n cookieName?: string;\n\n /**\n * Number of days the referral cookie is valid.\n * @default 30\n */\n cookieDays?: number;\n\n /**\n * Query parameter name for referral code in URL.\n * @default \"ref\"\n */\n urlParamName?: string;\n\n /**\n * Base URL for referral links.\n * @default window.location.origin (client-side only)\n */\n referralUrlBase?: string;\n\n /**\n * Path to append to base URL for referral links.\n * @default \"/\"\n */\n referralPath?: string;\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_REFERRAL_CONFIG: Required<ReferralConfig> = {\n enabled: false,\n cookieName: \"referral_code\",\n cookieDays: 30,\n urlParamName: \"ref\",\n referralUrlBase: \"\",\n referralPath: \"/\",\n};\n\n// Private storage for configuration\nlet _referralConfig: Required<ReferralConfig> = { ...DEFAULT_REFERRAL_CONFIG };\n\n/**\n * Configure referral feature settings.\n * Call this at app startup to enable and configure referral functionality.\n *\n * @example\n * ```typescript\n * import { configureReferral } from \"@carlonicora/nextjs-jsonapi\";\n *\n * configureReferral({\n * enabled: process.env.NEXT_PUBLIC_REFERRAL_ENABLED === 'true',\n * cookieDays: 30,\n * });\n * ```\n */\nexport function configureReferral(config: ReferralConfig): void {\n _referralConfig = { ...DEFAULT_REFERRAL_CONFIG, ...config };\n}\n\n/**\n * Get the current referral configuration.\n * @internal\n */\nexport function getReferralConfig(): Required<ReferralConfig> {\n return _referralConfig;\n}\n\n/**\n * Check if referral feature is enabled.\n */\nexport function isReferralEnabled(): boolean {\n return _referralConfig.enabled;\n}\n","export type SignupSource = {\n sourceRef?: string;\n sourceUtmSource?: string;\n sourceUtmMedium?: string;\n sourceUtmCampaign?: string;\n sourceReferrer?: string;\n sourceLandingPath?: string;\n};\n\nexport const SIGNUP_SOURCE_COOKIE = \"signup_source\";\nexport const SIGNUP_SOURCE_COOKIE_MAX_AGE = 2592000;\n\n/** The six source fields, in display order. */\nexport const SIGNUP_SOURCE_FIELDS: readonly (keyof SignupSource)[] = [\n \"sourceRef\",\n \"sourceUtmSource\",\n \"sourceUtmMedium\",\n \"sourceUtmCampaign\",\n \"sourceReferrer\",\n \"sourceLandingPath\",\n];\n\nconst SIGNUP_SOURCE_MAX_LENGTH = 200;\n\n// First touch for the current page session. Survives client navigations, lost on a full reload.\nlet memorySource: SignupSource | undefined;\n\nfunction clean(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n return trimmed.slice(0, SIGNUP_SOURCE_MAX_LENGTH);\n}\n\nfunction sanitise(input: unknown): SignupSource | undefined {\n if (!input || typeof input !== \"object\") return undefined;\n const result: SignupSource = {};\n for (const field of SIGNUP_SOURCE_FIELDS) {\n const value = clean((input as Record<string, unknown>)[field]);\n if (value !== undefined) result[field] = value;\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Pure. Reads ref and utm_source/medium/campaign from the URL, the referrer host when it is not ownHost,\n * and the landing path. Returns undefined for a direct visit (no ref, no UTM, no external referrer).\n */\nexport function readSignupSourceFromLocation(params: {\n url: string;\n referrer: string;\n ownHost: string;\n}): SignupSource | undefined {\n let url: URL;\n try {\n url = new URL(params.url);\n } catch {\n return undefined;\n }\n\n const sourceRef = clean(url.searchParams.get(\"ref\"));\n const sourceUtmSource = clean(url.searchParams.get(\"utm_source\"));\n const sourceUtmMedium = clean(url.searchParams.get(\"utm_medium\"));\n const sourceUtmCampaign = clean(url.searchParams.get(\"utm_campaign\"));\n\n let sourceReferrer: string | undefined;\n if (params.referrer) {\n try {\n const referrerHost = new URL(params.referrer).host;\n if (referrerHost && referrerHost !== params.ownHost) sourceReferrer = clean(referrerHost);\n } catch {\n sourceReferrer = undefined;\n }\n }\n\n if (!sourceRef && !sourceUtmSource && !sourceUtmMedium && !sourceUtmCampaign && !sourceReferrer) return undefined;\n\n return sanitise({\n sourceRef,\n sourceUtmSource,\n sourceUtmMedium,\n sourceUtmCampaign,\n sourceReferrer,\n sourceLandingPath: url.pathname,\n });\n}\n\nfunction readSignupSourceCookie(): SignupSource | undefined {\n if (typeof document === \"undefined\") return undefined;\n const cookies = document.cookie ? document.cookie.split(\"; \") : [];\n for (const cookie of cookies) {\n const separator = cookie.indexOf(\"=\");\n if (separator === -1) continue;\n if (cookie.slice(0, separator) !== SIGNUP_SOURCE_COOKIE) continue;\n const value = cookie.slice(separator + 1);\n if (!value) return undefined;\n try {\n return sanitise(JSON.parse(decodeURIComponent(value)));\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction writeSignupSourceCookie(source: SignupSource): void {\n document.cookie = `${SIGNUP_SOURCE_COOKIE}=${encodeURIComponent(JSON.stringify(source))}; path=/; max-age=${SIGNUP_SOURCE_COOKIE_MAX_AGE}; SameSite=Lax`;\n}\n\n/**\n * First touch: an existing in-memory value or cookie is never overwritten.\n * Writes the cookie only when persist is true and no cookie exists yet.\n */\nexport function captureSignupSource(params: { persist: boolean }): void {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n\n const existingCookie = readSignupSourceCookie();\n\n if (!memorySource) {\n memorySource =\n existingCookie ??\n readSignupSourceFromLocation({\n url: window.location.href,\n referrer: document.referrer,\n ownHost: window.location.host,\n });\n }\n\n if (params.persist && !existingCookie && memorySource) writeSignupSourceCookie(memorySource);\n}\n\n/** The in-memory value, else the cookie value, else undefined. */\nexport function getSignupSource(): SignupSource | undefined {\n return memorySource ?? readSignupSourceCookie();\n}\n","export const COMPANY_ADMINISTRATOR_ROLE_ID = \"2e1eee00-6cba-4506-9059-ccd24e4ea5b0\";\n\nexport type PermissionValue = boolean | string;\n\nexport type ActionType = \"read\" | \"create\" | \"update\" | \"delete\";\n\nexport const ACTION_TYPES: ActionType[] = [\"read\", \"create\", \"update\", \"delete\"];\n\n/** The permissions object shape used by both Module and PermissionMapping entities */\nexport type PermissionsMap = {\n create?: PermissionValue;\n read?: PermissionValue;\n update?: PermissionValue;\n delete?: PermissionValue;\n};\n\n/**\n * Declarative-RBAC matrix types.\n *\n * Mirror of the library types defined in\n * `packages/nestjs-neo4jsonapi/src/foundations/rbac/dsl/types.ts`.\n * Frontend does not import from backend, so the shape is redefined here.\n *\n * A `PermToken` represents a single permission entry:\n * - `scope: true` → unconditional (e.g. full read of the module)\n * - `scope: false` → nothing (rarely used, mostly a placeholder)\n * - `scope: \"path\"` → scoped by relationship path (e.g. \"orders.account\")\n */\nexport type PermToken = { action: string; scope: boolean | string };\n\n/**\n * A per-module block of the matrix. Always has a `default` row (permissions\n * granted to every role). Additional keys are role IDs → role-specific\n * permission tokens that are unioned with `default` to produce the effective\n * permissions for that role in that module.\n */\nexport type RbacModuleBlock = { default: PermToken[] } & Record<string, PermToken[]>;\n\n/**\n * The full RBAC matrix as served by the dev endpoint `GET /_dev/rbac/matrix`.\n * Keys are module IDs; values are module blocks.\n */\nexport type RbacMatrix = Record<string, RbacModuleBlock>;\n","import { AbstractService, EndpointCreator, HttpMethod, Modules } from \"../../../core\";\nimport type { RbacMatrixModel } from \"./RbacMatrixModel\";\nimport type { RbacMatrix } from \"./RbacTypes\";\n\n/**\n * RbacService — fetches RBAC configuration for the admin UI.\n *\n * Declarative-matrix methods (`fetchMatrix`, `saveMatrix`) talk to the\n * dev-only endpoints added in\n * `packages/nestjs-neo4jsonapi/.../rbac-dev.controller.ts`. The controller\n * speaks JSON:API (singleton resource with `type: \"rbac-matrix\"`, `id:\n * \"singleton\"`), so these methods go through the standard `callApi()`\n * pipeline like every other service in the codebase.\n *\n * The backend only registers these routes when `devMode` is enabled on\n * `RbacModule.register` (see `apps/api/src/features/features.modules.ts`).\n * In production the routes return 404; callers should guard with a dev-mode\n * check.\n */\nexport class RbacService extends AbstractService {\n /**\n * Fetch the current RBAC matrix plus each module's known BFS relationship\n * paths (used by the permission picker as scope suggestions).\n *\n * Dev-only endpoint — see class header.\n */\n static async fetchMatrix(): Promise<{\n matrix: RbacMatrix;\n modulePaths: Record<string, readonly string[]>;\n }> {\n const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();\n\n const model = await this.callApi<RbacMatrixModel>({\n type: Modules.RbacMatrix,\n method: HttpMethod.GET,\n endpoint,\n });\n\n return {\n matrix: model.matrix ?? {},\n modulePaths: model.modulePaths ?? {},\n };\n }\n\n /**\n * Persist a matrix back to the declarative `permissions.ts` file.\n *\n * The backend serializes the matrix to formatted TypeScript using the\n * provided `roleNames` / `moduleNames` lookup tables (so the emitted file\n * references `RoleId.X` / `ModuleId.X` rather than raw UUIDs) and writes\n * it to `outputPath` (absolute, or relative to the repo root).\n *\n * Dev-only endpoint — see class header.\n */\n static async saveMatrix(args: {\n matrix: RbacMatrix;\n roleNames: Record<string, string>;\n moduleNames: Record<string, string>;\n outputPath: string;\n }): Promise<{ bytesWritten: number; path: string }> {\n const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();\n\n const model = await this.callApi<RbacMatrixModel>({\n type: Modules.RbacMatrix,\n method: HttpMethod.PUT,\n endpoint,\n input: args,\n });\n\n return {\n bytesWritten: model.bytesWritten ?? 0,\n path: model.path ?? \"\",\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-I5BQLY7V.js","../src/core/registry/helpStore.ts","../src/client/config.ts","../src/login/config.ts","../src/features/waitlist/config/waitlist.config.ts","../src/features/referral/config.ts","../src/features/signup-source/signup-source.ts","../src/features/rbac/data/RbacTypes.ts","../src/features/rbac/data/RbacService.ts"],"names":[],"mapp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AA;AAMM,IAAA;AAEH,IAAA;AACE,MAAA;AACd,MAAA;AACA,MAAA;AACO,MAAA;AACR,IAAA;AAEM,IAAA;AACS,MAAA;AACF,MAAA;AACd,IAAA;AACF,EAAA;AACF;AR8OqB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-I5BQLY7V.js","sourcesContent":[null,"/**\n * Centralized help-content store accessible from client and server contexts.\n * Uses a globalThis Symbol key to persist across HMR/Turbopack reloads and to\n * bridge between the client-side `configureJsonApi` (in `client/config.ts`)\n * and the HelpProvider context. Holds the brand-only HelpContentConfig.\n *\n * NO external dependencies to avoid circular imports.\n *\n * Pattern mirrors `bootstrapStore.ts`.\n */\n\nconst HELP_CONTENT_KEY = Symbol.for(\"nextjs-jsonapi:helpContent\");\n\nconst globalStore = globalThis as unknown as {\n [HELP_CONTENT_KEY]?: unknown | null;\n};\n\nif (globalStore[HELP_CONTENT_KEY] === undefined) {\n globalStore[HELP_CONTENT_KEY] = null;\n}\n\nexport function _setStaticHelpContent(cfg: unknown | null): void {\n globalStore[HELP_CONTENT_KEY] = cfg;\n}\n\nexport function _getStaticHelpContent<T = unknown>(): T | null {\n return (globalStore[HELP_CONTENT_KEY] as T | null) ?? null;\n}\n","\"use client\";\n\nimport { ModuleWithPermissions } from \"../permissions/types\";\nimport { ENV } from \"../core/env\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { _setStaticHelpContent } from \"../core/registry/helpStore\";\nimport type { HelpContentConfig } from \"../features/help/interfaces/help-content-config.interface\";\n\n// Config storage for client-side contexts\nlet _clientConfig: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n stripePublishableKey?: string;\n} | null = null;\n\n/**\n * Configure the JSON:API client. This is the main configuration function.\n * This is typically called during app initialization.\n * @param config.helpContent - Optional help-content config (brand only). Forwarded to the help feature's globalThis-backed store; not stored on the client config.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n stripePublishableKey?: string;\n helpContent?: HelpContentConfig;\n}): void {\n const { helpContent, ...rest } = config;\n _clientConfig = rest;\n if (helpContent) {\n _setStaticHelpContent(helpContent);\n }\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\n/**\n * Configure the client config. This is typically called during app initialization.\n * @deprecated Use configureJsonApi instead\n */\nexport function configureClientConfig(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n}): void {\n _clientConfig = config;\n}\n\n/**\n * Get the configured API URL.\n *\n * This may resolve to an internal/private host (e.g. a docker-network\n * hostname) when configured to do so for SSR fetches. Do NOT use this for\n * URLs that are rendered into HTML and followed by the browser — use\n * `getPublicApiUrl()` instead.\n */\nexport function getApiUrl(): string {\n if (_clientConfig?.apiUrl) {\n return _clientConfig.apiUrl;\n }\n return ENV.API_URL;\n}\n\n/**\n * Get the public-facing API URL.\n *\n * Always sourced from `NEXT_PUBLIC_API_URL` so it is identical on server\n * and client, and reachable from the user's browser. Use for any URL that\n * gets rendered into HTML the browser will navigate to (links, redirects,\n * OAuth hrefs).\n */\nexport function getPublicApiUrl(): string {\n return ENV.API_URL;\n}\n\n/**\n * Get the configured app URL.\n */\nexport function getAppUrl(): string {\n if (_clientConfig?.appUrl) {\n return _clientConfig.appUrl;\n }\n if (ENV.APP_URL_ALTERNATE) {\n return ENV.APP_URL_ALTERNATE;\n }\n if (typeof window !== \"undefined\") {\n return window.location.origin;\n }\n return \"\";\n}\n\n/**\n * Get the configured trackable pages.\n */\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _clientConfig?.trackablePages ?? [];\n}\n\n/**\n * Get the configured Stripe publishable key.\n */\nexport function getStripePublishableKey(): string | undefined {\n return _clientConfig?.stripePublishableKey;\n}\n","let _useDiscordAuth: boolean = false;\nlet _useGoogleAuth: boolean = false;\nlet _useInternalAuth: boolean = true;\nlet _allowRegistration: boolean = true;\nlet _registrationMode: \"open\" | \"closed\" | \"waitlist\" = \"open\";\n\nexport type RegistrationMode = \"open\" | \"closed\" | \"waitlist\";\n\nexport interface LoginConfig {\n discordClientId?: string;\n googleClientId?: string;\n useInternalAuth?: boolean;\n allowRegistration?: boolean;\n registrationMode?: RegistrationMode;\n}\n\nexport function configureLogin(params: LoginConfig): void {\n _useDiscordAuth = !!params.discordClientId;\n _useGoogleAuth = !!params.googleClientId;\n _useInternalAuth = params.useInternalAuth ?? true;\n _allowRegistration = params.allowRegistration ?? true;\n _registrationMode = params.registrationMode ?? \"open\";\n}\n\nexport function isDiscordAuthEnabled(): boolean {\n return _useDiscordAuth;\n}\n\nexport function isGoogleAuthEnabled(): boolean {\n return _useGoogleAuth;\n}\n\nexport function isInternalAuthEnabled(): boolean {\n return _useInternalAuth;\n}\n\nexport function isRegistrationAllowed(): boolean {\n return _allowRegistration;\n}\n\nexport function getRegistrationMode(): RegistrationMode {\n return _registrationMode;\n}\n","import { useI18nTranslations } from \"../../../i18n\";\n\nexport type QuestionnaireFieldType = \"text\" | \"textarea\" | \"select\" | \"checkbox\";\n\nexport interface QuestionnaireOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface QuestionnaireField {\n id: string;\n type: QuestionnaireFieldType;\n label: string;\n description?: string;\n placeholder?: string;\n required?: boolean;\n options?: QuestionnaireOption[];\n}\n\nexport interface WaitlistConfig {\n questionnaire?: QuestionnaireField[];\n heroTitle?: string;\n heroSubtitle?: string;\n heroDescription?: string;\n benefits?: string[];\n /**\n * When true, every text above (hero title, subtitle, description, benefits and\n * the questionnaire's labels, descriptions, placeholders and option labels) is\n * a message key and renders through `t()`. Defaults to false: the strings\n * render as given.\n */\n translate?: boolean;\n}\n\nlet _waitlistConfig: WaitlistConfig = {};\n\nexport function configureWaitlist(config: WaitlistConfig): void {\n _waitlistConfig = config;\n}\n\nexport function getWaitlistConfig(): WaitlistConfig {\n return _waitlistConfig;\n}\n\n/**\n * Resolves a waitlist config text: `t(value)` when the config sets\n * `translate`, the value itself otherwise. Empty values stay undefined.\n */\nexport function useWaitlistText(): (value?: string) => string | undefined {\n const t = useI18nTranslations();\n const translate = getWaitlistConfig().translate === true;\n\n return (value?: string) => {\n if (!value) return undefined;\n return translate ? t(value) : value;\n };\n}\n","/**\n * Configuration interface for frontend referral feature.\n */\nexport interface ReferralConfig {\n /**\n * Whether the referral feature is enabled.\n * When false, components render nothing and hooks return null.\n * @default false\n */\n enabled?: boolean;\n\n /**\n * Name of the cookie used to store referral codes.\n * @default \"referral_code\"\n */\n cookieName?: string;\n\n /**\n * Number of days the referral cookie is valid.\n * @default 30\n */\n cookieDays?: number;\n\n /**\n * Query parameter name for referral code in URL.\n * @default \"ref\"\n */\n urlParamName?: string;\n\n /**\n * Base URL for referral links.\n * @default window.location.origin (client-side only)\n */\n referralUrlBase?: string;\n\n /**\n * Path to append to base URL for referral links.\n * @default \"/\"\n */\n referralPath?: string;\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_REFERRAL_CONFIG: Required<ReferralConfig> = {\n enabled: false,\n cookieName: \"referral_code\",\n cookieDays: 30,\n urlParamName: \"ref\",\n referralUrlBase: \"\",\n referralPath: \"/\",\n};\n\n// Private storage for configuration\nlet _referralConfig: Required<ReferralConfig> = { ...DEFAULT_REFERRAL_CONFIG };\n\n/**\n * Configure referral feature settings.\n * Call this at app startup to enable and configure referral functionality.\n *\n * @example\n * ```typescript\n * import { configureReferral } from \"@carlonicora/nextjs-jsonapi\";\n *\n * configureReferral({\n * enabled: process.env.NEXT_PUBLIC_REFERRAL_ENABLED === 'true',\n * cookieDays: 30,\n * });\n * ```\n */\nexport function configureReferral(config: ReferralConfig): void {\n _referralConfig = { ...DEFAULT_REFERRAL_CONFIG, ...config };\n}\n\n/**\n * Get the current referral configuration.\n * @internal\n */\nexport function getReferralConfig(): Required<ReferralConfig> {\n return _referralConfig;\n}\n\n/**\n * Check if referral feature is enabled.\n */\nexport function isReferralEnabled(): boolean {\n return _referralConfig.enabled;\n}\n","export type SignupSource = {\n sourceRef?: string;\n sourceUtmSource?: string;\n sourceUtmMedium?: string;\n sourceUtmCampaign?: string;\n sourceReferrer?: string;\n sourceLandingPath?: string;\n};\n\nexport const SIGNUP_SOURCE_COOKIE = \"signup_source\";\nexport const SIGNUP_SOURCE_COOKIE_MAX_AGE = 2592000;\n\n/** The six source fields, in display order. */\nexport const SIGNUP_SOURCE_FIELDS: readonly (keyof SignupSource)[] = [\n \"sourceRef\",\n \"sourceUtmSource\",\n \"sourceUtmMedium\",\n \"sourceUtmCampaign\",\n \"sourceReferrer\",\n \"sourceLandingPath\",\n];\n\nconst SIGNUP_SOURCE_MAX_LENGTH = 200;\n\n// First touch for the current page session. Survives client navigations, lost on a full reload.\nlet memorySource: SignupSource | undefined;\n\nfunction clean(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n return trimmed.slice(0, SIGNUP_SOURCE_MAX_LENGTH);\n}\n\nfunction sanitise(input: unknown): SignupSource | undefined {\n if (!input || typeof input !== \"object\") return undefined;\n const result: SignupSource = {};\n for (const field of SIGNUP_SOURCE_FIELDS) {\n const value = clean((input as Record<string, unknown>)[field]);\n if (value !== undefined) result[field] = value;\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Pure. Reads ref and utm_source/medium/campaign from the URL, the referrer host when it is not ownHost,\n * and the landing path. Returns undefined for a direct visit (no ref, no UTM, no external referrer).\n */\nexport function readSignupSourceFromLocation(params: {\n url: string;\n referrer: string;\n ownHost: string;\n}): SignupSource | undefined {\n let url: URL;\n try {\n url = new URL(params.url);\n } catch {\n return undefined;\n }\n\n const sourceRef = clean(url.searchParams.get(\"ref\"));\n const sourceUtmSource = clean(url.searchParams.get(\"utm_source\"));\n const sourceUtmMedium = clean(url.searchParams.get(\"utm_medium\"));\n const sourceUtmCampaign = clean(url.searchParams.get(\"utm_campaign\"));\n\n let sourceReferrer: string | undefined;\n if (params.referrer) {\n try {\n const referrerHost = new URL(params.referrer).host;\n if (referrerHost && referrerHost !== params.ownHost) sourceReferrer = clean(referrerHost);\n } catch {\n sourceReferrer = undefined;\n }\n }\n\n if (!sourceRef && !sourceUtmSource && !sourceUtmMedium && !sourceUtmCampaign && !sourceReferrer) return undefined;\n\n return sanitise({\n sourceRef,\n sourceUtmSource,\n sourceUtmMedium,\n sourceUtmCampaign,\n sourceReferrer,\n sourceLandingPath: url.pathname,\n });\n}\n\nfunction readSignupSourceCookie(): SignupSource | undefined {\n if (typeof document === \"undefined\") return undefined;\n const cookies = document.cookie ? document.cookie.split(\"; \") : [];\n for (const cookie of cookies) {\n const separator = cookie.indexOf(\"=\");\n if (separator === -1) continue;\n if (cookie.slice(0, separator) !== SIGNUP_SOURCE_COOKIE) continue;\n const value = cookie.slice(separator + 1);\n if (!value) return undefined;\n try {\n return sanitise(JSON.parse(decodeURIComponent(value)));\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction writeSignupSourceCookie(source: SignupSource): void {\n document.cookie = `${SIGNUP_SOURCE_COOKIE}=${encodeURIComponent(JSON.stringify(source))}; path=/; max-age=${SIGNUP_SOURCE_COOKIE_MAX_AGE}; SameSite=Lax`;\n}\n\n/**\n * First touch: an existing in-memory value or cookie is never overwritten.\n * Writes the cookie only when persist is true and no cookie exists yet.\n */\nexport function captureSignupSource(params: { persist: boolean }): void {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n\n const existingCookie = readSignupSourceCookie();\n\n if (!memorySource) {\n memorySource =\n existingCookie ??\n readSignupSourceFromLocation({\n url: window.location.href,\n referrer: document.referrer,\n ownHost: window.location.host,\n });\n }\n\n if (params.persist && !existingCookie && memorySource) writeSignupSourceCookie(memorySource);\n}\n\n/** The in-memory value, else the cookie value, else undefined. */\nexport function getSignupSource(): SignupSource | undefined {\n return memorySource ?? readSignupSourceCookie();\n}\n","export const COMPANY_ADMINISTRATOR_ROLE_ID = \"2e1eee00-6cba-4506-9059-ccd24e4ea5b0\";\n\nexport type PermissionValue = boolean | string;\n\nexport type ActionType = \"read\" | \"create\" | \"update\" | \"delete\";\n\nexport const ACTION_TYPES: ActionType[] = [\"read\", \"create\", \"update\", \"delete\"];\n\n/** The permissions object shape used by both Module and PermissionMapping entities */\nexport type PermissionsMap = {\n create?: PermissionValue;\n read?: PermissionValue;\n update?: PermissionValue;\n delete?: PermissionValue;\n};\n\n/**\n * Declarative-RBAC matrix types.\n *\n * Mirror of the library types defined in\n * `packages/nestjs-neo4jsonapi/src/foundations/rbac/dsl/types.ts`.\n * Frontend does not import from backend, so the shape is redefined here.\n *\n * A `PermToken` represents a single permission entry:\n * - `scope: true` → unconditional (e.g. full read of the module)\n * - `scope: false` → nothing (rarely used, mostly a placeholder)\n * - `scope: \"path\"` → scoped by relationship path (e.g. \"orders.account\")\n */\nexport type PermToken = { action: string; scope: boolean | string };\n\n/**\n * A per-module block of the matrix. Always has a `default` row (permissions\n * granted to every role). Additional keys are role IDs → role-specific\n * permission tokens that are unioned with `default` to produce the effective\n * permissions for that role in that module.\n */\nexport type RbacModuleBlock = { default: PermToken[] } & Record<string, PermToken[]>;\n\n/**\n * The full RBAC matrix as served by the dev endpoint `GET /_dev/rbac/matrix`.\n * Keys are module IDs; values are module blocks.\n */\nexport type RbacMatrix = Record<string, RbacModuleBlock>;\n","import { AbstractService, EndpointCreator, HttpMethod, Modules } from \"../../../core\";\nimport type { RbacMatrixModel } from \"./RbacMatrixModel\";\nimport type { RbacMatrix } from \"./RbacTypes\";\n\n/**\n * RbacService — fetches RBAC configuration for the admin UI.\n *\n * Declarative-matrix methods (`fetchMatrix`, `saveMatrix`) talk to the\n * dev-only endpoints added in\n * `packages/nestjs-neo4jsonapi/.../rbac-dev.controller.ts`. The controller\n * speaks JSON:API (singleton resource with `type: \"rbac-matrix\"`, `id:\n * \"singleton\"`), so these methods go through the standard `callApi()`\n * pipeline like every other service in the codebase.\n *\n * The backend only registers these routes when `devMode` is enabled on\n * `RbacModule.register` (see `apps/api/src/features/features.modules.ts`).\n * In production the routes return 404; callers should guard with a dev-mode\n * check.\n */\nexport class RbacService extends AbstractService {\n /**\n * Fetch the current RBAC matrix plus each module's known BFS relationship\n * paths (used by the permission picker as scope suggestions).\n *\n * Dev-only endpoint — see class header.\n */\n static async fetchMatrix(): Promise<{\n matrix: RbacMatrix;\n modulePaths: Record<string, readonly string[]>;\n }> {\n const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();\n\n const model = await this.callApi<RbacMatrixModel>({\n type: Modules.RbacMatrix,\n method: HttpMethod.GET,\n endpoint,\n });\n\n return {\n matrix: model.matrix ?? {},\n modulePaths: model.modulePaths ?? {},\n };\n }\n\n /**\n * Persist a matrix back to the declarative `permissions.ts` file.\n *\n * The backend serializes the matrix to formatted TypeScript using the\n * provided `roleNames` / `moduleNames` lookup tables (so the emitted file\n * references `RoleId.X` / `ModuleId.X` rather than raw UUIDs) and writes\n * it to `outputPath` (absolute, or relative to the repo root).\n *\n * Dev-only endpoint — see class header.\n */\n static async saveMatrix(args: {\n matrix: RbacMatrix;\n roleNames: Record<string, string>;\n moduleNames: Record<string, string>;\n outputPath: string;\n }): Promise<{ bytesWritten: number; path: string }> {\n const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();\n\n const model = await this.callApi<RbacMatrixModel>({\n type: Modules.RbacMatrix,\n method: HttpMethod.PUT,\n endpoint,\n input: args,\n });\n\n return {\n bytesWritten: model.bytesWritten ?? 0,\n path: model.path ?? \"\",\n };\n }\n}\n"]}