@revealui/core 0.2.1 → 0.5.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 (395) hide show
  1. package/dist/api/compression.d.ts.map +1 -1
  2. package/dist/api/payload-optimization.d.ts.map +1 -1
  3. package/dist/api/rate-limit.d.ts +29 -28
  4. package/dist/api/rate-limit.d.ts.map +1 -1
  5. package/dist/api/rate-limit.js +63 -3
  6. package/dist/api/response-cache.d.ts.map +1 -1
  7. package/dist/api/response-cache.js +1 -1
  8. package/dist/api/rest.d.ts.map +1 -1
  9. package/dist/api/rest.js +3 -2
  10. package/dist/auth/access.d.ts.map +1 -1
  11. package/dist/auth/index.d.ts.map +1 -1
  12. package/dist/cache/query-cache.d.ts +12 -10
  13. package/dist/cache/query-cache.d.ts.map +1 -1
  14. package/dist/cache/query-cache.js +38 -42
  15. package/dist/caching/index.d.ts +6 -0
  16. package/dist/caching/index.d.ts.map +1 -0
  17. package/dist/caching/index.js +5 -0
  18. package/dist/client/admin/RichText.d.ts +1 -1
  19. package/dist/client/admin/RichText.d.ts.map +1 -1
  20. package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
  21. package/dist/client/admin/components/AdminDashboard.js +195 -205
  22. package/dist/client/admin/components/CollectionList.d.ts.map +1 -1
  23. package/dist/client/admin/components/DocumentForm.d.ts.map +1 -1
  24. package/dist/client/admin/components/DocumentForm.js +130 -6
  25. package/dist/client/admin/components/GlobalForm.d.ts.map +1 -1
  26. package/dist/client/admin/context/ServerFunctionContext.d.ts +8 -0
  27. package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -0
  28. package/dist/client/admin/context/ServerFunctionContext.js +15 -0
  29. package/dist/client/admin/i18n/en.d.ts.map +1 -1
  30. package/dist/client/admin/index.d.ts +1 -0
  31. package/dist/client/admin/index.d.ts.map +1 -1
  32. package/dist/client/admin/index.js +1 -0
  33. package/dist/client/admin/layout.d.ts +1 -1
  34. package/dist/client/admin/layout.d.ts.map +1 -1
  35. package/dist/client/admin/layout.js +3 -2
  36. package/dist/client/admin/page.d.ts.map +1 -1
  37. package/dist/client/admin/utils/apiClient.d.ts.map +1 -1
  38. package/dist/client/admin/utils/apiClient.js +0 -4
  39. package/dist/client/admin/utils/index.d.ts +0 -1
  40. package/dist/client/admin/utils/index.d.ts.map +1 -1
  41. package/dist/client/admin/utils/index.js +0 -1
  42. package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -1
  43. package/dist/client/hooks.d.ts.map +1 -1
  44. package/dist/client/index.d.ts.map +1 -1
  45. package/dist/client/richtext/RichTextEditor.d.ts.map +1 -1
  46. package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -1
  47. package/dist/client/richtext/components/ImageNodeComponent.js +0 -1
  48. package/dist/client/richtext/components/ImageUploadButton.d.ts +2 -0
  49. package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -1
  50. package/dist/client/richtext/components/ImageUploadButton.js +30 -15
  51. package/dist/client/richtext/index.d.ts.map +1 -1
  52. package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -1
  53. package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -1
  54. package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -1
  55. package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -1
  56. package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -1
  57. package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +1 -3
  58. package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -1
  59. package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -1
  60. package/dist/client/ui/index.d.ts.map +1 -1
  61. package/dist/client/ui/index.js +1 -1
  62. package/dist/collections/CollectionOperations.d.ts +7 -7
  63. package/dist/collections/CollectionOperations.d.ts.map +1 -1
  64. package/dist/collections/CollectionOperations.js +15 -1
  65. package/dist/collections/hooks.d.ts.map +1 -1
  66. package/dist/collections/index.d.ts.map +1 -1
  67. package/dist/collections/operations/create.d.ts +4 -5
  68. package/dist/collections/operations/create.d.ts.map +1 -1
  69. package/dist/collections/operations/create.js +35 -6
  70. package/dist/collections/operations/createMany.d.ts +12 -0
  71. package/dist/collections/operations/createMany.d.ts.map +1 -0
  72. package/dist/collections/operations/createMany.js +43 -0
  73. package/dist/collections/operations/delete.d.ts +1 -1
  74. package/dist/collections/operations/delete.d.ts.map +1 -1
  75. package/dist/collections/operations/delete.js +31 -2
  76. package/dist/collections/operations/deleteMany.d.ts +11 -0
  77. package/dist/collections/operations/deleteMany.d.ts.map +1 -0
  78. package/dist/collections/operations/deleteMany.js +50 -0
  79. package/dist/collections/operations/fieldHooks.d.ts +2 -2
  80. package/dist/collections/operations/fieldHooks.d.ts.map +1 -1
  81. package/dist/collections/operations/fieldHooks.js +4 -4
  82. package/dist/collections/operations/find.d.ts +2 -4
  83. package/dist/collections/operations/find.d.ts.map +1 -1
  84. package/dist/collections/operations/find.js +115 -8
  85. package/dist/collections/operations/findById.d.ts +3 -4
  86. package/dist/collections/operations/findById.d.ts.map +1 -1
  87. package/dist/collections/operations/findById.js +53 -1
  88. package/dist/collections/operations/sqlAdapter.d.ts +23 -0
  89. package/dist/collections/operations/sqlAdapter.d.ts.map +1 -0
  90. package/dist/collections/operations/sqlAdapter.js +76 -0
  91. package/dist/collections/operations/update.d.ts +3 -5
  92. package/dist/collections/operations/update.d.ts.map +1 -1
  93. package/dist/collections/operations/update.js +103 -11
  94. package/dist/collections/operations/updateMany.d.ts +11 -0
  95. package/dist/collections/operations/updateMany.d.ts.map +1 -0
  96. package/dist/collections/operations/updateMany.js +52 -0
  97. package/dist/collections/registry.d.ts +12 -0
  98. package/dist/collections/registry.d.ts.map +1 -0
  99. package/dist/collections/registry.js +38 -0
  100. package/dist/config/index.d.ts.map +1 -1
  101. package/dist/config/runtime.d.ts.map +1 -1
  102. package/dist/config/utils.d.ts +0 -10
  103. package/dist/config/utils.d.ts.map +1 -1
  104. package/dist/config/utils.js +0 -13
  105. package/dist/database/index.d.ts +3 -0
  106. package/dist/database/index.d.ts.map +1 -1
  107. package/dist/database/index.js +1 -5
  108. package/dist/database/safe-parse.d.ts.map +1 -1
  109. package/dist/database/ssl-config.d.ts.map +1 -1
  110. package/dist/database/type-adapter.d.ts.map +1 -1
  111. package/dist/database/universal-postgres.d.ts.map +1 -1
  112. package/dist/database/universal-postgres.js +6 -1
  113. package/dist/dataloader.d.ts.map +1 -1
  114. package/dist/error-handling/error-boundary.d.ts.map +1 -1
  115. package/dist/error-handling/error-reporter.d.ts +1 -1
  116. package/dist/error-handling/error-reporter.d.ts.map +1 -1
  117. package/dist/error-handling/error-reporter.js +19 -5
  118. package/dist/error-handling/fallback-components.d.ts.map +1 -1
  119. package/dist/error-handling/fallback-components.js +1 -1
  120. package/dist/error-handling/index.d.ts +2 -4
  121. package/dist/error-handling/index.d.ts.map +1 -1
  122. package/dist/error-handling/index.js +1 -4
  123. package/dist/factories/builders.d.ts.map +1 -1
  124. package/dist/factories/index.d.ts.map +1 -1
  125. package/dist/features.d.ts +7 -7
  126. package/dist/features.d.ts.map +1 -1
  127. package/dist/features.js +2 -2
  128. package/dist/fieldTraversal.d.ts.map +1 -1
  129. package/dist/fields/config/types.d.ts.map +1 -1
  130. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  131. package/dist/fields/getFieldPaths.d.ts.map +1 -1
  132. package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
  133. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  134. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  135. package/dist/generated/types/cms.d.ts.map +1 -1
  136. package/dist/generated/types/cms.js +0 -1
  137. package/dist/generated/types/neon.d.ts.map +1 -1
  138. package/dist/generated/types/neon.js +4 -2
  139. package/dist/globals/GlobalOperations.d.ts.map +1 -1
  140. package/dist/globals/GlobalOperations.js +16 -4
  141. package/dist/globals/index.d.ts.map +1 -1
  142. package/dist/index.d.ts +15 -4
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +15 -5
  145. package/dist/instance/RevealUIInstance.d.ts.map +1 -1
  146. package/dist/instance/RevealUIInstance.js +6 -19
  147. package/dist/instance/index.d.ts.map +1 -1
  148. package/dist/instance/logger.d.ts.map +1 -1
  149. package/dist/instance/methods/create.d.ts.map +1 -1
  150. package/dist/instance/methods/create.js +0 -3
  151. package/dist/instance/methods/delete.d.ts.map +1 -1
  152. package/dist/instance/methods/delete.js +1 -4
  153. package/dist/instance/methods/find.d.ts.map +1 -1
  154. package/dist/instance/methods/find.js +0 -3
  155. package/dist/instance/methods/findById.d.ts.map +1 -1
  156. package/dist/instance/methods/findById.js +0 -3
  157. package/dist/instance/methods/hooks.d.ts.map +1 -1
  158. package/dist/instance/methods/update.d.ts.map +1 -1
  159. package/dist/instance/methods/update.js +0 -3
  160. package/dist/jobs/index.d.ts +16 -0
  161. package/dist/jobs/index.d.ts.map +1 -0
  162. package/dist/jobs/index.js +14 -0
  163. package/dist/jobs/queue.d.ts +57 -0
  164. package/dist/jobs/queue.d.ts.map +1 -0
  165. package/dist/jobs/queue.js +134 -0
  166. package/dist/license-encryption.d.ts +21 -0
  167. package/dist/license-encryption.d.ts.map +1 -0
  168. package/dist/license-encryption.js +74 -0
  169. package/dist/license.d.ts +26 -3
  170. package/dist/license.d.ts.map +1 -1
  171. package/dist/license.js +87 -7
  172. package/dist/monitoring/alerts.d.ts +4 -4
  173. package/dist/monitoring/alerts.d.ts.map +1 -1
  174. package/dist/monitoring/cleanup-manager.d.ts.map +1 -1
  175. package/dist/monitoring/health-monitor.d.ts.map +1 -1
  176. package/dist/monitoring/index.d.ts.map +1 -1
  177. package/dist/monitoring/process-registry.d.ts.map +1 -1
  178. package/dist/monitoring/query-monitor.d.ts.map +1 -1
  179. package/dist/monitoring/types.d.ts.map +1 -1
  180. package/dist/monitoring/zombie-detector.d.ts.map +1 -1
  181. package/dist/monitoring/zombie-detector.js +5 -0
  182. package/dist/nextjs/index.d.ts.map +1 -1
  183. package/dist/nextjs/utilities.d.ts.map +1 -1
  184. package/dist/nextjs/withRevealUI.d.ts.map +1 -1
  185. package/dist/observability/alerts.d.ts.map +1 -1
  186. package/dist/observability/alerts.js +1 -2
  187. package/dist/observability/health-check.d.ts +0 -4
  188. package/dist/observability/health-check.d.ts.map +1 -1
  189. package/dist/observability/health-check.js +0 -36
  190. package/dist/observability/index.d.ts.map +1 -1
  191. package/dist/observability/logger.d.ts.map +1 -1
  192. package/dist/observability/logger.js +1 -1
  193. package/dist/observability/metrics.d.ts.map +1 -1
  194. package/dist/observability/tracing.d.ts.map +1 -1
  195. package/dist/observability/tracing.js +0 -1
  196. package/dist/plugins/form-builder.d.ts.map +1 -1
  197. package/dist/plugins/index.d.ts.map +1 -1
  198. package/dist/plugins/nested-docs.d.ts +4 -0
  199. package/dist/plugins/nested-docs.d.ts.map +1 -1
  200. package/dist/plugins/nested-docs.js +50 -6
  201. package/dist/plugins/redirects.d.ts.map +1 -1
  202. package/dist/queries/index.d.ts.map +1 -1
  203. package/dist/queries/queryBuilder.d.ts.map +1 -1
  204. package/dist/queries/queryBuilder.js +13 -5
  205. package/dist/relationships/analyzer.d.ts.map +1 -1
  206. package/dist/relationships/analyzer.js +8 -0
  207. package/dist/relationships/index.d.ts.map +1 -1
  208. package/dist/relationships/populate-core.d.ts +57 -0
  209. package/dist/relationships/populate-core.d.ts.map +1 -0
  210. package/dist/relationships/populate-core.js +116 -0
  211. package/dist/relationships/populate-helpers.d.ts +5 -51
  212. package/dist/relationships/populate-helpers.d.ts.map +1 -1
  213. package/dist/relationships/populate-helpers.js +4 -109
  214. package/dist/relationships/population.d.ts +1 -9
  215. package/dist/relationships/population.d.ts.map +1 -1
  216. package/dist/relationships/population.js +8 -3
  217. package/dist/revealui.d.ts.map +1 -1
  218. package/dist/richtext/exports/client/rcc.d.ts.map +1 -1
  219. package/dist/richtext/exports/client/rcc.js +1 -1
  220. package/dist/richtext/exports/server/rsc.d.ts +17 -0
  221. package/dist/richtext/exports/server/rsc.d.ts.map +1 -1
  222. package/dist/richtext/exports/server/rsc.js +61 -5
  223. package/dist/richtext/index.d.ts.map +1 -1
  224. package/dist/richtext/lexical.d.ts.map +1 -1
  225. package/dist/security/index.d.ts +3 -16
  226. package/dist/security/index.d.ts.map +1 -1
  227. package/dist/security/index.js +3 -16
  228. package/dist/server/index.d.ts.map +1 -1
  229. package/dist/server/renderPage.d.ts.map +1 -1
  230. package/dist/storage/index.d.ts +1 -0
  231. package/dist/storage/index.d.ts.map +1 -1
  232. package/dist/storage/index.js +2 -4
  233. package/dist/storage/vercel-blob.d.ts.map +1 -1
  234. package/dist/storage/vercel-blob.js +3 -0
  235. package/dist/translations/index.d.ts.map +1 -1
  236. package/dist/types/access.d.ts.map +1 -1
  237. package/dist/types/api.d.ts.map +1 -1
  238. package/dist/types/cms.d.ts.map +1 -1
  239. package/dist/types/config.d.ts.map +1 -1
  240. package/dist/types/core.d.ts +1 -1
  241. package/dist/types/core.d.ts.map +1 -1
  242. package/dist/types/extensions.d.ts.map +1 -1
  243. package/dist/types/frontend.d.ts.map +1 -1
  244. package/dist/types/generated.d.ts.map +1 -1
  245. package/dist/types/hooks.d.ts.map +1 -1
  246. package/dist/types/index.d.ts +1 -1
  247. package/dist/types/index.d.ts.map +1 -1
  248. package/dist/types/interfaces/app.d.ts.map +1 -1
  249. package/dist/types/jobs.d.ts.map +1 -1
  250. package/dist/types/legacy.d.ts.map +1 -1
  251. package/dist/types/plugins.d.ts.map +1 -1
  252. package/dist/types/query.d.ts.map +1 -1
  253. package/dist/types/request.d.ts.map +1 -1
  254. package/dist/types/richtext.d.ts.map +1 -1
  255. package/dist/types/runtime.d.ts +60 -1
  256. package/dist/types/runtime.d.ts.map +1 -1
  257. package/dist/types/schema.d.ts.map +1 -1
  258. package/dist/types/user.d.ts.map +1 -1
  259. package/dist/utils/access-conversion.d.ts.map +1 -1
  260. package/dist/utils/api-wrapper.d.ts.map +1 -1
  261. package/dist/utils/api-wrapper.js +1 -1
  262. package/dist/utils/block-conversion.d.ts.map +1 -1
  263. package/dist/utils/cache.d.ts.map +1 -1
  264. package/dist/utils/deep-clone.js +0 -1
  265. package/dist/utils/error-responses.d.ts.map +1 -1
  266. package/dist/utils/error-responses.js +2 -3
  267. package/dist/utils/errors.d.ts +36 -0
  268. package/dist/utils/errors.d.ts.map +1 -1
  269. package/dist/utils/errors.js +103 -0
  270. package/dist/utils/field-conversion.d.ts +1 -1
  271. package/dist/utils/field-conversion.d.ts.map +1 -1
  272. package/dist/utils/flattenResult.d.ts.map +1 -1
  273. package/dist/utils/flattenResult.js +0 -1
  274. package/dist/utils/getBlockSelect.d.ts.map +1 -1
  275. package/dist/utils/getSelectMode.d.ts.map +1 -1
  276. package/dist/utils/isValidID.d.ts.map +1 -1
  277. package/dist/utils/json-parsing.d.ts.map +1 -1
  278. package/dist/utils/logger-client.d.ts.map +1 -1
  279. package/dist/utils/logger-server.d.ts.map +1 -1
  280. package/dist/utils/logger.d.ts.map +1 -1
  281. package/dist/utils/request-context.d.ts.map +1 -1
  282. package/dist/utils/stripUnselectedFields.d.ts.map +1 -1
  283. package/dist/utils/type-guards.d.ts.map +1 -1
  284. package/package.json +58 -26
  285. package/dist/caching/app-cache.d.ts +0 -237
  286. package/dist/caching/app-cache.d.ts.map +0 -1
  287. package/dist/caching/app-cache.js +0 -430
  288. package/dist/caching/cdn-config.d.ts +0 -155
  289. package/dist/caching/cdn-config.d.ts.map +0 -1
  290. package/dist/caching/cdn-config.js +0 -411
  291. package/dist/caching/edge-cache.d.ts +0 -177
  292. package/dist/caching/edge-cache.d.ts.map +0 -1
  293. package/dist/caching/edge-cache.js +0 -385
  294. package/dist/caching/service-worker.d.ts +0 -154
  295. package/dist/caching/service-worker.d.ts.map +0 -1
  296. package/dist/caching/service-worker.js +0 -437
  297. package/dist/client/admin/utils/auth.d.ts +0 -23
  298. package/dist/client/admin/utils/auth.d.ts.map +0 -1
  299. package/dist/client/admin/utils/auth.js +0 -52
  300. package/dist/client/http/client.d.ts +0 -15
  301. package/dist/client/http/client.d.ts.map +0 -1
  302. package/dist/client/http/client.js +0 -49
  303. package/dist/client/http/fetchBanner.d.ts +0 -18
  304. package/dist/client/http/fetchBanner.d.ts.map +0 -1
  305. package/dist/client/http/fetchBanner.js +0 -44
  306. package/dist/client/http/fetchCard.d.ts +0 -18
  307. package/dist/client/http/fetchCard.d.ts.map +0 -1
  308. package/dist/client/http/fetchCard.js +0 -46
  309. package/dist/client/http/fetchEvents.d.ts +0 -18
  310. package/dist/client/http/fetchEvents.d.ts.map +0 -1
  311. package/dist/client/http/fetchEvents.js +0 -44
  312. package/dist/client/http/fetchHero.d.ts +0 -17
  313. package/dist/client/http/fetchHero.d.ts.map +0 -1
  314. package/dist/client/http/fetchHero.js +0 -55
  315. package/dist/client/http/fetchMainInfos.d.ts +0 -17
  316. package/dist/client/http/fetchMainInfos.d.ts.map +0 -1
  317. package/dist/client/http/fetchMainInfos.js +0 -44
  318. package/dist/client/http/fetchVideos.d.ts +0 -13
  319. package/dist/client/http/fetchVideos.d.ts.map +0 -1
  320. package/dist/client/http/fetchVideos.js +0 -36
  321. package/dist/client/http/index.d.ts +0 -19
  322. package/dist/client/http/index.d.ts.map +0 -1
  323. package/dist/client/http/index.js +0 -11
  324. package/dist/error-handling/circuit-breaker.d.ts +0 -262
  325. package/dist/error-handling/circuit-breaker.d.ts.map +0 -1
  326. package/dist/error-handling/circuit-breaker.js +0 -542
  327. package/dist/error-handling/retry.d.ts +0 -194
  328. package/dist/error-handling/retry.d.ts.map +0 -1
  329. package/dist/error-handling/retry.js +0 -450
  330. package/dist/errors/index.d.ts +0 -23
  331. package/dist/errors/index.d.ts.map +0 -1
  332. package/dist/errors/index.js +0 -40
  333. package/dist/generated/agents/index.d.ts +0 -8
  334. package/dist/generated/agents/index.d.ts.map +0 -1
  335. package/dist/generated/agents/index.js +0 -7
  336. package/dist/generated/components/index.d.ts +0 -8
  337. package/dist/generated/components/index.d.ts.map +0 -1
  338. package/dist/generated/components/index.js +0 -7
  339. package/dist/generated/functions/index.d.ts +0 -8
  340. package/dist/generated/functions/index.d.ts.map +0 -1
  341. package/dist/generated/functions/index.js +0 -7
  342. package/dist/generated/hooks/index.d.ts +0 -8
  343. package/dist/generated/hooks/index.d.ts.map +0 -1
  344. package/dist/generated/hooks/index.js +0 -7
  345. package/dist/generated/plans/index.d.ts +0 -8
  346. package/dist/generated/plans/index.d.ts.map +0 -1
  347. package/dist/generated/plans/index.js +0 -7
  348. package/dist/generated/prompts/index.d.ts +0 -8
  349. package/dist/generated/prompts/index.d.ts.map +0 -1
  350. package/dist/generated/prompts/index.js +0 -7
  351. package/dist/generated/tools/index.d.ts +0 -8
  352. package/dist/generated/tools/index.d.ts.map +0 -1
  353. package/dist/generated/tools/index.js +0 -7
  354. package/dist/generated/types/supabase.d.ts +0 -193
  355. package/dist/generated/types/supabase.d.ts.map +0 -1
  356. package/dist/generated/types/supabase.js +0 -5
  357. package/dist/optimization/asset-optimizer.d.ts +0 -202
  358. package/dist/optimization/asset-optimizer.d.ts.map +0 -1
  359. package/dist/optimization/asset-optimizer.js +0 -312
  360. package/dist/optimization/build-optimizer.d.ts +0 -202
  361. package/dist/optimization/build-optimizer.d.ts.map +0 -1
  362. package/dist/optimization/build-optimizer.js +0 -271
  363. package/dist/optimization/bundle-analyzer.d.ts +0 -98
  364. package/dist/optimization/bundle-analyzer.d.ts.map +0 -1
  365. package/dist/optimization/bundle-analyzer.js +0 -322
  366. package/dist/optimization/code-splitting.d.ts +0 -131
  367. package/dist/optimization/code-splitting.d.ts.map +0 -1
  368. package/dist/optimization/code-splitting.js +0 -277
  369. package/dist/plugin/index.d.ts +0 -12
  370. package/dist/plugin/index.d.ts.map +0 -1
  371. package/dist/plugin/index.js +0 -4
  372. package/dist/security/audit.d.ts +0 -188
  373. package/dist/security/audit.d.ts.map +0 -1
  374. package/dist/security/audit.js +0 -431
  375. package/dist/security/auth.d.ts +0 -241
  376. package/dist/security/auth.d.ts.map +0 -1
  377. package/dist/security/auth.js +0 -476
  378. package/dist/security/authorization.d.ts +0 -235
  379. package/dist/security/authorization.d.ts.map +0 -1
  380. package/dist/security/authorization.js +0 -434
  381. package/dist/security/encryption.d.ts +0 -214
  382. package/dist/security/encryption.d.ts.map +0 -1
  383. package/dist/security/encryption.js +0 -517
  384. package/dist/security/gdpr.d.ts +0 -300
  385. package/dist/security/gdpr.d.ts.map +0 -1
  386. package/dist/security/gdpr.js +0 -465
  387. package/dist/security/headers.d.ts +0 -182
  388. package/dist/security/headers.d.ts.map +0 -1
  389. package/dist/security/headers.js +0 -402
  390. package/dist/utils/jwt-validation.d.ts +0 -14
  391. package/dist/utils/jwt-validation.d.ts.map +0 -1
  392. package/dist/utils/jwt-validation.js +0 -36
  393. package/dist/utils/request-headers.d.ts +0 -15
  394. package/dist/utils/request-headers.d.ts.map +0 -1
  395. package/dist/utils/request-headers.js +0 -31
@@ -1,402 +0,0 @@
1
- /**
2
- * Security Headers and CORS Configuration
3
- *
4
- * HTTP security headers and CORS policy management
5
- */
6
- /**
7
- * Security headers manager
8
- */
9
- export class SecurityHeaders {
10
- config;
11
- constructor(config = {}) {
12
- this.config = config;
13
- }
14
- /**
15
- * Get all security headers
16
- */
17
- getHeaders() {
18
- const headers = {};
19
- // Content Security Policy
20
- if (this.config.contentSecurityPolicy) {
21
- headers['Content-Security-Policy'] = this.buildCSP(this.config.contentSecurityPolicy);
22
- }
23
- // Strict Transport Security
24
- if (this.config.strictTransportSecurity) {
25
- headers['Strict-Transport-Security'] = this.buildHSTS(this.config.strictTransportSecurity);
26
- }
27
- // X-Frame-Options
28
- if (this.config.xFrameOptions) {
29
- headers['X-Frame-Options'] = this.config.xFrameOptions;
30
- }
31
- // X-Content-Type-Options
32
- if (this.config.xContentTypeOptions !== false) {
33
- headers['X-Content-Type-Options'] = 'nosniff';
34
- }
35
- // Referrer-Policy
36
- if (this.config.referrerPolicy) {
37
- headers['Referrer-Policy'] = this.config.referrerPolicy;
38
- }
39
- // Permissions-Policy
40
- if (this.config.permissionsPolicy) {
41
- headers['Permissions-Policy'] = this.buildPermissionsPolicy(this.config.permissionsPolicy);
42
- }
43
- // Cross-Origin headers
44
- if (this.config.crossOriginEmbedderPolicy) {
45
- headers['Cross-Origin-Embedder-Policy'] = this.config.crossOriginEmbedderPolicy;
46
- }
47
- if (this.config.crossOriginOpenerPolicy) {
48
- headers['Cross-Origin-Opener-Policy'] = this.config.crossOriginOpenerPolicy;
49
- }
50
- if (this.config.crossOriginResourcePolicy) {
51
- headers['Cross-Origin-Resource-Policy'] = this.config.crossOriginResourcePolicy;
52
- }
53
- return headers;
54
- }
55
- /**
56
- * Build Content Security Policy header
57
- */
58
- buildCSP(config) {
59
- if (typeof config === 'string') {
60
- return config;
61
- }
62
- const directives = [];
63
- const addDirective = (name, values) => {
64
- if (values && values.length > 0) {
65
- directives.push(`${name} ${values.join(' ')}`);
66
- }
67
- };
68
- addDirective('default-src', config.defaultSrc);
69
- addDirective('script-src', config.scriptSrc);
70
- addDirective('style-src', config.styleSrc);
71
- addDirective('img-src', config.imgSrc);
72
- addDirective('font-src', config.fontSrc);
73
- addDirective('connect-src', config.connectSrc);
74
- addDirective('frame-src', config.frameSrc);
75
- addDirective('object-src', config.objectSrc);
76
- addDirective('media-src', config.mediaSrc);
77
- addDirective('worker-src', config.workerSrc);
78
- addDirective('child-src', config.childSrc);
79
- addDirective('form-action', config.formAction);
80
- addDirective('frame-ancestors', config.frameAncestors);
81
- addDirective('base-uri', config.baseUri);
82
- addDirective('manifest-src', config.manifestSrc);
83
- if (config.upgradeInsecureRequests) {
84
- directives.push('upgrade-insecure-requests');
85
- }
86
- if (config.blockAllMixedContent) {
87
- directives.push('block-all-mixed-content');
88
- }
89
- if (config.reportUri) {
90
- directives.push(`report-uri ${config.reportUri}`);
91
- }
92
- if (config.reportTo) {
93
- directives.push(`report-to ${config.reportTo}`);
94
- }
95
- return directives.join('; ');
96
- }
97
- /**
98
- * Build HSTS header
99
- */
100
- buildHSTS(config) {
101
- if (config === true) {
102
- return 'max-age=31536000; includeSubDomains';
103
- }
104
- if (config === false) {
105
- return '';
106
- }
107
- // config is now HSTSConfig
108
- const parts = [`max-age=${config.maxAge}`];
109
- if (config.includeSubDomains) {
110
- parts.push('includeSubDomains');
111
- }
112
- if (config.preload) {
113
- parts.push('preload');
114
- }
115
- return parts.join('; ');
116
- }
117
- /**
118
- * Build Permissions-Policy header
119
- */
120
- buildPermissionsPolicy(config) {
121
- if (typeof config === 'string') {
122
- return config;
123
- }
124
- const policies = [];
125
- Object.entries(config).forEach(([feature, origins]) => {
126
- if (!origins || origins.length === 0) {
127
- policies.push(`${feature}=()`);
128
- }
129
- else if (origins.includes('*')) {
130
- policies.push(`${feature}=*`);
131
- }
132
- else {
133
- const originsList = origins.map((o) => `"${o}"`).join(' ');
134
- policies.push(`${feature}=(${originsList})`);
135
- }
136
- });
137
- return policies.join(', ');
138
- }
139
- /**
140
- * Apply headers to response
141
- */
142
- applyHeaders(response) {
143
- const headers = this.getHeaders();
144
- Object.entries(headers).forEach(([name, value]) => {
145
- response.headers.set(name, value);
146
- });
147
- return response;
148
- }
149
- }
150
- /**
151
- * CORS manager
152
- */
153
- export class CORSManager {
154
- config;
155
- constructor(config = {}) {
156
- this.config = {
157
- origin: config.origin ?? [],
158
- methods: config.methods || ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
159
- allowedHeaders: config.allowedHeaders || ['Content-Type', 'Authorization'],
160
- exposedHeaders: config.exposedHeaders || [],
161
- credentials: config.credentials ?? false,
162
- maxAge: config.maxAge || 86400,
163
- preflightContinue: config.preflightContinue ?? false,
164
- optionsSuccessStatus: config.optionsSuccessStatus || 204,
165
- };
166
- }
167
- /**
168
- * Check if origin is allowed
169
- */
170
- isOriginAllowed(origin) {
171
- const { origin: allowedOrigin } = this.config;
172
- if (allowedOrigin === '*') {
173
- return true;
174
- }
175
- if (typeof allowedOrigin === 'function') {
176
- return allowedOrigin(origin);
177
- }
178
- if (typeof allowedOrigin === 'string') {
179
- return origin === allowedOrigin;
180
- }
181
- if (Array.isArray(allowedOrigin)) {
182
- return allowedOrigin.includes(origin);
183
- }
184
- return false;
185
- }
186
- /**
187
- * Get CORS headers
188
- */
189
- getCORSHeaders(origin) {
190
- const headers = {};
191
- // Access-Control-Allow-Origin
192
- if (this.isOriginAllowed(origin)) {
193
- headers['Access-Control-Allow-Origin'] = this.config.origin === '*' ? '*' : origin;
194
- }
195
- // Access-Control-Allow-Credentials — incompatible with origin: '*' per Fetch spec
196
- if (this.config.credentials && this.config.origin !== '*') {
197
- headers['Access-Control-Allow-Credentials'] = 'true';
198
- }
199
- // Access-Control-Expose-Headers
200
- if (this.config.exposedHeaders.length > 0) {
201
- headers['Access-Control-Expose-Headers'] = this.config.exposedHeaders.join(', ');
202
- }
203
- return headers;
204
- }
205
- /**
206
- * Get preflight headers
207
- */
208
- getPreflightHeaders(origin) {
209
- const headers = this.getCORSHeaders(origin);
210
- // Access-Control-Allow-Methods
211
- headers['Access-Control-Allow-Methods'] = this.config.methods.join(', ');
212
- // Access-Control-Allow-Headers
213
- headers['Access-Control-Allow-Headers'] = this.config.allowedHeaders.join(', ');
214
- // Access-Control-Max-Age
215
- headers['Access-Control-Max-Age'] = this.config.maxAge.toString();
216
- return headers;
217
- }
218
- /**
219
- * Handle CORS request
220
- */
221
- handleRequest(request) {
222
- const origin = request.headers.get('Origin');
223
- if (!origin) {
224
- return null;
225
- }
226
- // Handle preflight
227
- if (request.method === 'OPTIONS') {
228
- return this.handlePreflight(request, origin);
229
- }
230
- return null;
231
- }
232
- /**
233
- * Handle preflight request
234
- */
235
- handlePreflight(_request, origin) {
236
- if (!this.isOriginAllowed(origin)) {
237
- return new Response(null, { status: 403 });
238
- }
239
- const headers = this.getPreflightHeaders(origin);
240
- return new Response(null, {
241
- status: this.config.optionsSuccessStatus,
242
- headers,
243
- });
244
- }
245
- /**
246
- * Apply CORS headers to response
247
- */
248
- applyHeaders(response, origin) {
249
- if (!this.isOriginAllowed(origin)) {
250
- return response;
251
- }
252
- const headers = this.getCORSHeaders(origin);
253
- Object.entries(headers).forEach(([name, value]) => {
254
- response.headers.set(name, value);
255
- });
256
- return response;
257
- }
258
- }
259
- /**
260
- * Common security header presets
261
- */
262
- export const SecurityPresets = {
263
- /**
264
- * Strict security (recommended for production)
265
- */
266
- strict: () => ({
267
- contentSecurityPolicy: {
268
- defaultSrc: ["'self'"],
269
- scriptSrc: ["'self'"],
270
- styleSrc: ["'self'", "'unsafe-inline'"],
271
- imgSrc: ["'self'", 'data:', 'https:'],
272
- fontSrc: ["'self'", 'data:'],
273
- connectSrc: ["'self'"],
274
- frameSrc: ["'none'"],
275
- objectSrc: ["'none'"],
276
- baseUri: ["'self'"],
277
- formAction: ["'self'"],
278
- frameAncestors: ["'none'"],
279
- upgradeInsecureRequests: true,
280
- },
281
- strictTransportSecurity: {
282
- maxAge: 31536000,
283
- includeSubDomains: true,
284
- preload: true,
285
- },
286
- xFrameOptions: 'DENY',
287
- xContentTypeOptions: true,
288
- referrerPolicy: 'strict-origin-when-cross-origin',
289
- crossOriginEmbedderPolicy: 'require-corp',
290
- crossOriginOpenerPolicy: 'same-origin',
291
- crossOriginResourcePolicy: 'same-origin',
292
- }),
293
- /**
294
- * Moderate security (balanced)
295
- */
296
- moderate: () => ({
297
- contentSecurityPolicy: {
298
- defaultSrc: ["'self'"],
299
- scriptSrc: ["'self'", "'unsafe-inline'"],
300
- styleSrc: ["'self'", "'unsafe-inline'"],
301
- imgSrc: ["'self'", 'data:', 'https:'],
302
- fontSrc: ["'self'", 'data:', 'https:'],
303
- connectSrc: ["'self'", 'https:'],
304
- frameAncestors: ["'self'"],
305
- },
306
- strictTransportSecurity: {
307
- maxAge: 31536000,
308
- includeSubDomains: true,
309
- },
310
- xFrameOptions: 'SAMEORIGIN',
311
- xContentTypeOptions: true,
312
- referrerPolicy: 'origin-when-cross-origin',
313
- }),
314
- /**
315
- * Development (permissive)
316
- */
317
- development: () => ({
318
- xContentTypeOptions: true,
319
- referrerPolicy: 'no-referrer-when-downgrade',
320
- }),
321
- };
322
- /**
323
- * Common CORS presets
324
- */
325
- export const CORSPresets = {
326
- /**
327
- * Strict CORS (same origin only)
328
- */
329
- strict: () => ({
330
- origin: [],
331
- methods: ['GET', 'POST', 'PUT', 'DELETE'],
332
- allowedHeaders: ['Content-Type', 'Authorization'],
333
- credentials: true,
334
- maxAge: 86400,
335
- }),
336
- /**
337
- * Moderate CORS (specific origins)
338
- */
339
- moderate: (allowedOrigins) => ({
340
- origin: allowedOrigins,
341
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
342
- allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
343
- exposedHeaders: ['X-Total-Count'],
344
- credentials: true,
345
- maxAge: 86400,
346
- }),
347
- /**
348
- * Permissive CORS (all origins)
349
- */
350
- permissive: () => ({
351
- origin: '*',
352
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
353
- allowedHeaders: ['*'],
354
- credentials: false,
355
- maxAge: 86400,
356
- }),
357
- /**
358
- * API CORS (for public APIs)
359
- */
360
- api: () => ({
361
- origin: '*',
362
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
363
- allowedHeaders: ['Content-Type', 'Authorization', 'X-API-Key'],
364
- exposedHeaders: ['X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-RateLimit-Reset'],
365
- credentials: false,
366
- maxAge: 86400,
367
- }),
368
- };
369
- /**
370
- * Security middleware creator
371
- */
372
- export function createSecurityMiddleware(securityConfig, corsConfig) {
373
- const security = new SecurityHeaders(securityConfig);
374
- const cors = new CORSManager(corsConfig);
375
- return async (request, next) => {
376
- const origin = request.headers.get('Origin');
377
- // Handle CORS preflight
378
- if (origin && request.method === 'OPTIONS') {
379
- const preflightResponse = cors.handleRequest(request);
380
- if (preflightResponse) {
381
- return preflightResponse;
382
- }
383
- }
384
- // Process request
385
- const response = await next();
386
- // Apply security headers
387
- security.applyHeaders(response);
388
- // Apply CORS headers
389
- if (origin) {
390
- cors.applyHeaders(response, origin);
391
- }
392
- return response;
393
- };
394
- }
395
- /**
396
- * Rate limiting headers
397
- */
398
- export function setRateLimitHeaders(response, limit, remaining, reset) {
399
- response.headers.set('X-RateLimit-Limit', limit.toString());
400
- response.headers.set('X-RateLimit-Remaining', remaining.toString());
401
- response.headers.set('X-RateLimit-Reset', reset.toString());
402
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * JWT Validation Utilities
3
- *
4
- * Utilities for validating JWT tokens from RevealRequest objects.
5
- */
6
- import type { RevealRequest } from '../types/index.js';
7
- /**
8
- * Validate JWT token from request authorization header
9
- *
10
- * @param req - RevealRequest object
11
- * @throws Error if token is invalid or expired
12
- */
13
- export declare function validateJWTFromRequest(req?: RevealRequest): Promise<void>;
14
- //# sourceMappingURL=jwt-validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-validation.d.ts","sourceRoot":"","sources":["../../src/utils/jwt-validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B/E"}
@@ -1,36 +0,0 @@
1
- /**
2
- * JWT Validation Utilities
3
- *
4
- * Utilities for validating JWT tokens from RevealRequest objects.
5
- */
6
- import { jwtVerify } from 'jose';
7
- import { extractAuthHeader } from './request-headers.js';
8
- /**
9
- * Validate JWT token from request authorization header
10
- *
11
- * @param req - RevealRequest object
12
- * @throws Error if token is invalid or expired
13
- */
14
- export async function validateJWTFromRequest(req) {
15
- const authHeader = extractAuthHeader(req);
16
- if (!authHeader || typeof authHeader !== 'string') {
17
- return; // No auth header, skip validation
18
- }
19
- // Extract token from "JWT <token>" format
20
- if (!authHeader.startsWith('JWT ')) {
21
- return; // Not a JWT token, skip validation
22
- }
23
- const token = authHeader.substring(4);
24
- const secret = process.env.REVEALUI_SECRET;
25
- if (!secret || secret.length < 32) {
26
- throw new Error('REVEALUI_SECRET must be set to a secure random value (minimum 32 characters). ' +
27
- 'Generate one with: openssl rand -base64 32');
28
- }
29
- try {
30
- await jwtVerify(token, new TextEncoder().encode(secret));
31
- }
32
- catch (_error) {
33
- // Token is invalid, expired, or tampered
34
- throw new Error('Invalid or expired token');
35
- }
36
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * Request Header Utilities
3
- *
4
- * Utilities for extracting headers from RevealRequest objects.
5
- * Handles various header types (Headers, Map, plain object).
6
- */
7
- import type { RevealRequest } from '../types/index.js';
8
- /**
9
- * Extract authorization header from request
10
- *
11
- * @param req - RevealRequest object
12
- * @returns Authorization header value or null if not found
13
- */
14
- export declare function extractAuthHeader(req?: RevealRequest): string | null;
15
- //# sourceMappingURL=request-headers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-headers.d.ts","sourceRoot":"","sources":["../../src/utils/request-headers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAqBpE"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Request Header Utilities
3
- *
4
- * Utilities for extracting headers from RevealRequest objects.
5
- * Handles various header types (Headers, Map, plain object).
6
- */
7
- /**
8
- * Extract authorization header from request
9
- *
10
- * @param req - RevealRequest object
11
- * @returns Authorization header value or null if not found
12
- */
13
- export function extractAuthHeader(req) {
14
- if (!req?.headers) {
15
- return null;
16
- }
17
- let authHeader;
18
- // Handle Headers object
19
- if (req.headers instanceof Headers) {
20
- authHeader = req.headers.get('authorization') || undefined;
21
- }
22
- // Handle Map object (used in tests) - type cast to avoid TS error
23
- else if (req.headers instanceof Map) {
24
- authHeader = req.headers.get('authorization') || undefined;
25
- }
26
- // Handle plain object with authorization property
27
- else if (typeof req.headers === 'object' && 'authorization' in req.headers) {
28
- authHeader = req.headers.authorization;
29
- }
30
- return authHeader || null;
31
- }