@nocobase/app-server 0.11.1-alpha.5 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. package/README.md +295 -0
  2. package/dist/application/index.d.ts +128 -0
  3. package/dist/application/index.d.ts.map +1 -0
  4. package/dist/application/index.js +386 -0
  5. package/dist/application/index.js.map +1 -0
  6. package/dist/caching/config.d.ts +2 -0
  7. package/dist/caching/config.d.ts.map +1 -0
  8. package/dist/caching/config.js +2 -0
  9. package/dist/caching/config.js.map +1 -0
  10. package/dist/caching/index.d.ts +5 -0
  11. package/dist/caching/index.d.ts.map +1 -0
  12. package/dist/caching/index.js +4 -0
  13. package/dist/caching/index.js.map +1 -0
  14. package/dist/caching/provider.d.ts +8 -0
  15. package/dist/caching/provider.d.ts.map +1 -0
  16. package/dist/caching/provider.js +14 -0
  17. package/dist/caching/provider.js.map +1 -0
  18. package/dist/caching/token.d.ts +4 -0
  19. package/dist/caching/token.d.ts.map +1 -0
  20. package/dist/caching/token.js +3 -0
  21. package/dist/caching/token.js.map +1 -0
  22. package/dist/config/app-config-types.d.ts +44 -0
  23. package/dist/config/app-config-types.d.ts.map +1 -0
  24. package/dist/config/app-config-types.js +2 -0
  25. package/dist/config/app-config-types.js.map +1 -0
  26. package/dist/config/app-config.d.ts +60 -0
  27. package/dist/config/app-config.d.ts.map +1 -0
  28. package/dist/config/app-config.js +247 -0
  29. package/dist/config/app-config.js.map +1 -0
  30. package/dist/config/context.d.ts +3 -0
  31. package/dist/config/context.d.ts.map +1 -0
  32. package/dist/config/context.js +7 -0
  33. package/dist/config/context.js.map +1 -0
  34. package/dist/config/define-app-config.d.ts +71 -0
  35. package/dist/config/define-app-config.d.ts.map +1 -0
  36. package/dist/config/define-app-config.js +48 -0
  37. package/dist/config/define-app-config.js.map +1 -0
  38. package/dist/config/index.d.ts +13 -0
  39. package/dist/config/index.d.ts.map +1 -0
  40. package/dist/config/index.js +11 -0
  41. package/dist/config/index.js.map +1 -0
  42. package/dist/config/not-configured.d.ts +23 -0
  43. package/dist/config/not-configured.d.ts.map +1 -0
  44. package/dist/config/not-configured.js +31 -0
  45. package/dist/config/not-configured.js.map +1 -0
  46. package/dist/config/paths.d.ts +27 -0
  47. package/dist/config/paths.d.ts.map +1 -0
  48. package/dist/config/paths.js +27 -0
  49. package/dist/config/paths.js.map +1 -0
  50. package/dist/config/placeholder-secret.d.ts +19 -0
  51. package/dist/config/placeholder-secret.d.ts.map +1 -0
  52. package/dist/config/placeholder-secret.js +26 -0
  53. package/dist/config/placeholder-secret.js.map +1 -0
  54. package/dist/config/runtime-environment.d.ts +11 -0
  55. package/dist/config/runtime-environment.d.ts.map +1 -0
  56. package/dist/config/runtime-environment.js +20 -0
  57. package/dist/config/runtime-environment.js.map +1 -0
  58. package/dist/config/types.d.ts +12 -0
  59. package/dist/config/types.d.ts.map +1 -0
  60. package/dist/config/types.js +2 -0
  61. package/dist/config/types.js.map +1 -0
  62. package/dist/config/validation.d.ts +36 -0
  63. package/dist/config/validation.d.ts.map +1 -0
  64. package/dist/config/validation.js +186 -0
  65. package/dist/config/validation.js.map +1 -0
  66. package/dist/config/variables.d.ts +57 -0
  67. package/dist/config/variables.d.ts.map +1 -0
  68. package/dist/config/variables.js +89 -0
  69. package/dist/config/variables.js.map +1 -0
  70. package/dist/database/collections-artifact.d.ts +99 -0
  71. package/dist/database/collections-artifact.d.ts.map +1 -0
  72. package/dist/database/collections-artifact.js +397 -0
  73. package/dist/database/collections-artifact.js.map +1 -0
  74. package/dist/database/collections-directory.d.ts +36 -0
  75. package/dist/database/collections-directory.d.ts.map +1 -0
  76. package/dist/database/collections-directory.js +115 -0
  77. package/dist/database/collections-directory.js.map +1 -0
  78. package/dist/database/collections-doctor.d.ts +43 -0
  79. package/dist/database/collections-doctor.d.ts.map +1 -0
  80. package/dist/database/collections-doctor.js +88 -0
  81. package/dist/database/collections-doctor.js.map +1 -0
  82. package/dist/database/connection-check.d.ts +25 -0
  83. package/dist/database/connection-check.d.ts.map +1 -0
  84. package/dist/database/connection-check.js +65 -0
  85. package/dist/database/connection-check.js.map +1 -0
  86. package/dist/database/connection-selection.d.ts +16 -0
  87. package/dist/database/connection-selection.d.ts.map +1 -0
  88. package/dist/database/connection-selection.js +30 -0
  89. package/dist/database/connection-selection.js.map +1 -0
  90. package/dist/database/define-app-database-config.d.ts +49 -0
  91. package/dist/database/define-app-database-config.d.ts.map +1 -0
  92. package/dist/database/define-app-database-config.js +73 -0
  93. package/dist/database/define-app-database-config.js.map +1 -0
  94. package/dist/database/environment.d.ts +11 -0
  95. package/dist/database/environment.d.ts.map +1 -0
  96. package/dist/database/environment.js +49 -0
  97. package/dist/database/environment.js.map +1 -0
  98. package/dist/database/index.d.ts +17 -0
  99. package/dist/database/index.d.ts.map +1 -0
  100. package/dist/database/index.js +16 -0
  101. package/dist/database/index.js.map +1 -0
  102. package/dist/database/manager.d.ts +16 -0
  103. package/dist/database/manager.d.ts.map +1 -0
  104. package/dist/database/manager.js +83 -0
  105. package/dist/database/manager.js.map +1 -0
  106. package/dist/database/migrator.d.ts +88 -0
  107. package/dist/database/migrator.d.ts.map +1 -0
  108. package/dist/database/migrator.js +143 -0
  109. package/dist/database/migrator.js.map +1 -0
  110. package/dist/database/ownership.d.ts +6 -0
  111. package/dist/database/ownership.d.ts.map +1 -0
  112. package/dist/database/ownership.js +50 -0
  113. package/dist/database/ownership.js.map +1 -0
  114. package/dist/database/plan.d.ts +36 -0
  115. package/dist/database/plan.d.ts.map +1 -0
  116. package/dist/database/plan.js +136 -0
  117. package/dist/database/plan.js.map +1 -0
  118. package/dist/database/provider.d.ts +43 -0
  119. package/dist/database/provider.d.ts.map +1 -0
  120. package/dist/database/provider.js +171 -0
  121. package/dist/database/provider.js.map +1 -0
  122. package/dist/database/resolve-config.d.ts +42 -0
  123. package/dist/database/resolve-config.d.ts.map +1 -0
  124. package/dist/database/resolve-config.js +118 -0
  125. package/dist/database/resolve-config.js.map +1 -0
  126. package/dist/database/seeder.d.ts +50 -0
  127. package/dist/database/seeder.d.ts.map +1 -0
  128. package/dist/database/seeder.js +117 -0
  129. package/dist/database/seeder.js.map +1 -0
  130. package/dist/database/storage.d.ts +10 -0
  131. package/dist/database/storage.d.ts.map +1 -0
  132. package/dist/database/storage.js +37 -0
  133. package/dist/database/storage.js.map +1 -0
  134. package/dist/database/task-config.d.ts +7 -0
  135. package/dist/database/task-config.d.ts.map +1 -0
  136. package/dist/database/task-config.js +19 -0
  137. package/dist/database/task-config.js.map +1 -0
  138. package/dist/database/task-container.d.ts +3 -0
  139. package/dist/database/task-container.d.ts.map +1 -0
  140. package/dist/database/task-container.js +34 -0
  141. package/dist/database/task-container.js.map +1 -0
  142. package/dist/database/tasks.d.ts +104 -0
  143. package/dist/database/tasks.d.ts.map +1 -0
  144. package/dist/database/tasks.js +350 -0
  145. package/dist/database/tasks.js.map +1 -0
  146. package/dist/database/types.d.ts +92 -0
  147. package/dist/database/types.d.ts.map +1 -0
  148. package/dist/database/types.js +2 -0
  149. package/dist/database/types.js.map +1 -0
  150. package/dist/drive/config.d.ts +2 -0
  151. package/dist/drive/config.d.ts.map +1 -0
  152. package/dist/drive/config.js +2 -0
  153. package/dist/drive/config.js.map +1 -0
  154. package/dist/drive/index.d.ts +5 -0
  155. package/dist/drive/index.d.ts.map +1 -0
  156. package/dist/drive/index.js +4 -0
  157. package/dist/drive/index.js.map +1 -0
  158. package/dist/drive/provider.d.ts +9 -0
  159. package/dist/drive/provider.d.ts.map +1 -0
  160. package/dist/drive/provider.js +22 -0
  161. package/dist/drive/provider.js.map +1 -0
  162. package/dist/drive/token.d.ts +4 -0
  163. package/dist/drive/token.d.ts.map +1 -0
  164. package/dist/drive/token.js +3 -0
  165. package/dist/drive/token.js.map +1 -0
  166. package/dist/i18n/index.d.ts +37 -0
  167. package/dist/i18n/index.d.ts.map +1 -0
  168. package/dist/i18n/index.js +44 -0
  169. package/dist/i18n/index.js.map +1 -0
  170. package/dist/id-generator/config.d.ts +2 -0
  171. package/dist/id-generator/config.d.ts.map +1 -0
  172. package/dist/id-generator/config.js +2 -0
  173. package/dist/id-generator/config.js.map +1 -0
  174. package/dist/id-generator/index.d.ts +5 -0
  175. package/dist/id-generator/index.d.ts.map +1 -0
  176. package/dist/id-generator/index.js +4 -0
  177. package/dist/id-generator/index.js.map +1 -0
  178. package/dist/id-generator/provider.d.ts +7 -0
  179. package/dist/id-generator/provider.d.ts.map +1 -0
  180. package/dist/id-generator/provider.js +11 -0
  181. package/dist/id-generator/provider.js.map +1 -0
  182. package/dist/id-generator/token.d.ts +4 -0
  183. package/dist/id-generator/token.d.ts.map +1 -0
  184. package/dist/id-generator/token.js +3 -0
  185. package/dist/id-generator/token.js.map +1 -0
  186. package/dist/index.d.ts +20 -0
  187. package/dist/index.d.ts.map +1 -0
  188. package/dist/index.js +20 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/jobs/config.d.ts +2 -0
  191. package/dist/jobs/config.d.ts.map +1 -0
  192. package/dist/jobs/config.js +2 -0
  193. package/dist/jobs/config.js.map +1 -0
  194. package/dist/jobs/index.d.ts +4 -0
  195. package/dist/jobs/index.d.ts.map +1 -0
  196. package/dist/jobs/index.js +4 -0
  197. package/dist/jobs/index.js.map +1 -0
  198. package/dist/jobs/provider.d.ts +23 -0
  199. package/dist/jobs/provider.d.ts.map +1 -0
  200. package/dist/jobs/provider.js +55 -0
  201. package/dist/jobs/provider.js.map +1 -0
  202. package/dist/jobs/token.d.ts +8 -0
  203. package/dist/jobs/token.d.ts.map +1 -0
  204. package/dist/jobs/token.js +7 -0
  205. package/dist/jobs/token.js.map +1 -0
  206. package/dist/logging/config.d.ts +16 -0
  207. package/dist/logging/config.d.ts.map +1 -0
  208. package/dist/logging/config.js +26 -0
  209. package/dist/logging/config.js.map +1 -0
  210. package/dist/logging/index.d.ts +5 -0
  211. package/dist/logging/index.d.ts.map +1 -0
  212. package/dist/logging/index.js +5 -0
  213. package/dist/logging/index.js.map +1 -0
  214. package/dist/logging/middleware.d.ts +13 -0
  215. package/dist/logging/middleware.d.ts.map +1 -0
  216. package/dist/logging/middleware.js +128 -0
  217. package/dist/logging/middleware.js.map +1 -0
  218. package/dist/logging/provider.d.ts +9 -0
  219. package/dist/logging/provider.d.ts.map +1 -0
  220. package/dist/logging/provider.js +95 -0
  221. package/dist/logging/provider.js.map +1 -0
  222. package/dist/logging/token.d.ts +4 -0
  223. package/dist/logging/token.d.ts.map +1 -0
  224. package/dist/logging/token.js +3 -0
  225. package/dist/logging/token.js.map +1 -0
  226. package/dist/node/config.d.ts +6 -0
  227. package/dist/node/config.d.ts.map +1 -0
  228. package/dist/node/config.js +2 -0
  229. package/dist/node/config.js.map +1 -0
  230. package/dist/node/index.d.ts +6 -0
  231. package/dist/node/index.d.ts.map +1 -0
  232. package/dist/node/index.js +6 -0
  233. package/dist/node/index.js.map +1 -0
  234. package/dist/node/not-configured-message.d.ts +10 -0
  235. package/dist/node/not-configured-message.d.ts.map +1 -0
  236. package/dist/node/not-configured-message.js +24 -0
  237. package/dist/node/not-configured-message.js.map +1 -0
  238. package/dist/node/proxy.d.ts +25 -0
  239. package/dist/node/proxy.d.ts.map +1 -0
  240. package/dist/node/proxy.js +229 -0
  241. package/dist/node/proxy.js.map +1 -0
  242. package/dist/node/runtime.d.ts +45 -0
  243. package/dist/node/runtime.d.ts.map +1 -0
  244. package/dist/node/runtime.js +176 -0
  245. package/dist/node/runtime.js.map +1 -0
  246. package/dist/node/scope.d.ts +55 -0
  247. package/dist/node/scope.d.ts.map +1 -0
  248. package/dist/node/scope.js +115 -0
  249. package/dist/node/scope.js.map +1 -0
  250. package/dist/node/server.d.ts +80 -0
  251. package/dist/node/server.d.ts.map +1 -0
  252. package/dist/node/server.js +283 -0
  253. package/dist/node/server.js.map +1 -0
  254. package/dist/plugins/define.d.ts +4 -0
  255. package/dist/plugins/define.d.ts.map +1 -0
  256. package/dist/plugins/define.js +45 -0
  257. package/dist/plugins/define.js.map +1 -0
  258. package/dist/plugins/index.d.ts +27 -0
  259. package/dist/plugins/index.d.ts.map +1 -0
  260. package/dist/plugins/index.js +4 -0
  261. package/dist/plugins/index.js.map +1 -0
  262. package/dist/plugins/inspect.d.ts +79 -0
  263. package/dist/plugins/inspect.d.ts.map +1 -0
  264. package/dist/plugins/inspect.js +142 -0
  265. package/dist/plugins/inspect.js.map +1 -0
  266. package/dist/plugins/resolve.d.ts +14 -0
  267. package/dist/plugins/resolve.d.ts.map +1 -0
  268. package/dist/plugins/resolve.js +101 -0
  269. package/dist/plugins/resolve.js.map +1 -0
  270. package/dist/plugins/types.d.ts +91 -0
  271. package/dist/plugins/types.d.ts.map +1 -0
  272. package/dist/plugins/types.js +2 -0
  273. package/dist/plugins/types.js.map +1 -0
  274. package/dist/proxy/http-proxy.d.ts +8 -0
  275. package/dist/proxy/http-proxy.d.ts.map +1 -0
  276. package/dist/proxy/http-proxy.js +59 -0
  277. package/dist/proxy/http-proxy.js.map +1 -0
  278. package/dist/proxy/index.d.ts +3 -0
  279. package/dist/proxy/index.d.ts.map +1 -0
  280. package/dist/proxy/index.js +3 -0
  281. package/dist/proxy/index.js.map +1 -0
  282. package/dist/proxy/origin.d.ts +12 -0
  283. package/dist/proxy/origin.d.ts.map +1 -0
  284. package/dist/proxy/origin.js +61 -0
  285. package/dist/proxy/origin.js.map +1 -0
  286. package/dist/queue/config.d.ts +4 -0
  287. package/dist/queue/config.d.ts.map +1 -0
  288. package/dist/queue/config.js +2 -0
  289. package/dist/queue/config.js.map +1 -0
  290. package/dist/queue/index.d.ts +4 -0
  291. package/dist/queue/index.d.ts.map +1 -0
  292. package/dist/queue/index.js +4 -0
  293. package/dist/queue/index.js.map +1 -0
  294. package/dist/queue/provider.d.ts +24 -0
  295. package/dist/queue/provider.d.ts.map +1 -0
  296. package/dist/queue/provider.js +57 -0
  297. package/dist/queue/provider.js.map +1 -0
  298. package/dist/queue/token.d.ts +9 -0
  299. package/dist/queue/token.d.ts.map +1 -0
  300. package/dist/queue/token.js +8 -0
  301. package/dist/queue/token.js.map +1 -0
  302. package/dist/realtime/index.d.ts +6 -0
  303. package/dist/realtime/index.d.ts.map +1 -0
  304. package/dist/realtime/index.js +6 -0
  305. package/dist/realtime/index.js.map +1 -0
  306. package/dist/realtime/provider.d.ts +10 -0
  307. package/dist/realtime/provider.d.ts.map +1 -0
  308. package/dist/realtime/provider.js +19 -0
  309. package/dist/realtime/provider.js.map +1 -0
  310. package/dist/realtime/service.d.ts +9 -0
  311. package/dist/realtime/service.d.ts.map +1 -0
  312. package/dist/realtime/service.js +347 -0
  313. package/dist/realtime/service.js.map +1 -0
  314. package/dist/realtime/types.d.ts +74 -0
  315. package/dist/realtime/types.d.ts.map +1 -0
  316. package/dist/realtime/types.js +4 -0
  317. package/dist/realtime/types.js.map +1 -0
  318. package/dist/realtime/websocket.d.ts +7 -0
  319. package/dist/realtime/websocket.d.ts.map +1 -0
  320. package/dist/realtime/websocket.js +57 -0
  321. package/dist/realtime/websocket.js.map +1 -0
  322. package/dist/router/api-error.d.ts +171 -0
  323. package/dist/router/api-error.d.ts.map +1 -0
  324. package/dist/router/api-error.js +291 -0
  325. package/dist/router/api-error.js.map +1 -0
  326. package/dist/router/api-limits.d.ts +80 -0
  327. package/dist/router/api-limits.d.ts.map +1 -0
  328. package/dist/router/api-limits.js +281 -0
  329. package/dist/router/api-limits.js.map +1 -0
  330. package/dist/router/cli/derive.d.ts +32 -0
  331. package/dist/router/cli/derive.d.ts.map +1 -0
  332. package/dist/router/cli/derive.js +548 -0
  333. package/dist/router/cli/derive.js.map +1 -0
  334. package/dist/router/cli/index.d.ts +6 -0
  335. package/dist/router/cli/index.d.ts.map +1 -0
  336. package/dist/router/cli/index.js +6 -0
  337. package/dist/router/cli/index.js.map +1 -0
  338. package/dist/router/cli/reference.d.ts +9 -0
  339. package/dist/router/cli/reference.d.ts.map +1 -0
  340. package/dist/router/cli/reference.js +64 -0
  341. package/dist/router/cli/reference.js.map +1 -0
  342. package/dist/router/cli/routes.d.ts +9 -0
  343. package/dist/router/cli/routes.d.ts.map +1 -0
  344. package/dist/router/cli/routes.js +228 -0
  345. package/dist/router/cli/routes.js.map +1 -0
  346. package/dist/router/cli/service.d.ts +50 -0
  347. package/dist/router/cli/service.d.ts.map +1 -0
  348. package/dist/router/cli/service.js +104 -0
  349. package/dist/router/cli/service.js.map +1 -0
  350. package/dist/router/cli/types.d.ts +278 -0
  351. package/dist/router/cli/types.d.ts.map +1 -0
  352. package/dist/router/cli/types.js +18 -0
  353. package/dist/router/cli/types.js.map +1 -0
  354. package/dist/router/duplicate-routes.d.ts +25 -0
  355. package/dist/router/duplicate-routes.d.ts.map +1 -0
  356. package/dist/router/duplicate-routes.js +51 -0
  357. package/dist/router/duplicate-routes.js.map +1 -0
  358. package/dist/router/health.d.ts +7 -0
  359. package/dist/router/health.d.ts.map +1 -0
  360. package/dist/router/health.js +48 -0
  361. package/dist/router/health.js.map +1 -0
  362. package/dist/router/index.d.ts +26 -0
  363. package/dist/router/index.d.ts.map +1 -0
  364. package/dist/router/index.js +29 -0
  365. package/dist/router/index.js.map +1 -0
  366. package/dist/router/openapi/components.d.ts +24 -0
  367. package/dist/router/openapi/components.d.ts.map +1 -0
  368. package/dist/router/openapi/components.js +128 -0
  369. package/dist/router/openapi/components.js.map +1 -0
  370. package/dist/router/openapi/declared.d.ts +19 -0
  371. package/dist/router/openapi/declared.d.ts.map +1 -0
  372. package/dist/router/openapi/declared.js +46 -0
  373. package/dist/router/openapi/declared.js.map +1 -0
  374. package/dist/router/openapi/describe.d.ts +82 -0
  375. package/dist/router/openapi/describe.d.ts.map +1 -0
  376. package/dist/router/openapi/describe.js +207 -0
  377. package/dist/router/openapi/describe.js.map +1 -0
  378. package/dist/router/openapi/docs-routes.d.ts +10 -0
  379. package/dist/router/openapi/docs-routes.d.ts.map +1 -0
  380. package/dist/router/openapi/docs-routes.js +157 -0
  381. package/dist/router/openapi/docs-routes.js.map +1 -0
  382. package/dist/router/openapi/document.d.ts +151 -0
  383. package/dist/router/openapi/document.d.ts.map +1 -0
  384. package/dist/router/openapi/document.js +471 -0
  385. package/dist/router/openapi/document.js.map +1 -0
  386. package/dist/router/openapi/index.d.ts +7 -0
  387. package/dist/router/openapi/index.d.ts.map +1 -0
  388. package/dist/router/openapi/index.js +7 -0
  389. package/dist/router/openapi/index.js.map +1 -0
  390. package/dist/router/openapi/repository-document.d.ts +30 -0
  391. package/dist/router/openapi/repository-document.d.ts.map +1 -0
  392. package/dist/router/openapi/repository-document.js +812 -0
  393. package/dist/router/openapi/repository-document.js.map +1 -0
  394. package/dist/router/openapi/schema.d.ts +30 -0
  395. package/dist/router/openapi/schema.d.ts.map +1 -0
  396. package/dist/router/openapi/schema.js +301 -0
  397. package/dist/router/openapi/schema.js.map +1 -0
  398. package/dist/router/openapi/service.d.ts +101 -0
  399. package/dist/router/openapi/service.d.ts.map +1 -0
  400. package/dist/router/openapi/service.js +162 -0
  401. package/dist/router/openapi/service.js.map +1 -0
  402. package/dist/router/repository-constraints.d.ts +15 -0
  403. package/dist/router/repository-constraints.d.ts.map +1 -0
  404. package/dist/router/repository-constraints.js +14 -0
  405. package/dist/router/repository-constraints.js.map +1 -0
  406. package/dist/router/repository-routes.d.ts +90 -0
  407. package/dist/router/repository-routes.d.ts.map +1 -0
  408. package/dist/router/repository-routes.js +452 -0
  409. package/dist/router/repository-routes.js.map +1 -0
  410. package/dist/router/routes.d.ts +24 -0
  411. package/dist/router/routes.d.ts.map +1 -0
  412. package/dist/router/routes.js +19 -0
  413. package/dist/router/routes.js.map +1 -0
  414. package/dist/runtime/application.d.ts +8 -0
  415. package/dist/runtime/application.d.ts.map +1 -0
  416. package/dist/runtime/application.js +22 -0
  417. package/dist/runtime/application.js.map +1 -0
  418. package/dist/runtime/definition.d.ts +50 -0
  419. package/dist/runtime/definition.d.ts.map +1 -0
  420. package/dist/runtime/definition.js +82 -0
  421. package/dist/runtime/definition.js.map +1 -0
  422. package/dist/runtime/index.d.ts +8 -0
  423. package/dist/runtime/index.d.ts.map +1 -0
  424. package/dist/runtime/index.js +7 -0
  425. package/dist/runtime/index.js.map +1 -0
  426. package/dist/runtime/lifecycle.d.ts +29 -0
  427. package/dist/runtime/lifecycle.d.ts.map +1 -0
  428. package/dist/runtime/lifecycle.js +104 -0
  429. package/dist/runtime/lifecycle.js.map +1 -0
  430. package/dist/runtime/mount.d.ts +4 -0
  431. package/dist/runtime/mount.d.ts.map +1 -0
  432. package/dist/runtime/mount.js +47 -0
  433. package/dist/runtime/mount.js.map +1 -0
  434. package/dist/runtime/scope.d.ts +29 -0
  435. package/dist/runtime/scope.d.ts.map +1 -0
  436. package/dist/runtime/scope.js +48 -0
  437. package/dist/runtime/scope.js.map +1 -0
  438. package/dist/runtime/types.d.ts +55 -0
  439. package/dist/runtime/types.d.ts.map +1 -0
  440. package/dist/runtime/types.js +2 -0
  441. package/dist/runtime/types.js.map +1 -0
  442. package/dist/sample-data/index.d.ts +3 -0
  443. package/dist/sample-data/index.d.ts.map +1 -0
  444. package/dist/sample-data/index.js +3 -0
  445. package/dist/sample-data/index.js.map +1 -0
  446. package/dist/sample-data/registry.d.ts +4 -0
  447. package/dist/sample-data/registry.d.ts.map +1 -0
  448. package/dist/sample-data/registry.js +74 -0
  449. package/dist/sample-data/registry.js.map +1 -0
  450. package/dist/sample-data/token.d.ts +64 -0
  451. package/dist/sample-data/token.d.ts.map +1 -0
  452. package/dist/sample-data/token.js +7 -0
  453. package/dist/sample-data/token.js.map +1 -0
  454. package/dist/secrets/config.d.ts +15 -0
  455. package/dist/secrets/config.d.ts.map +1 -0
  456. package/dist/secrets/config.js +43 -0
  457. package/dist/secrets/config.js.map +1 -0
  458. package/dist/secrets/index.d.ts +6 -0
  459. package/dist/secrets/index.d.ts.map +1 -0
  460. package/dist/secrets/index.js +6 -0
  461. package/dist/secrets/index.js.map +1 -0
  462. package/dist/secrets/provider.d.ts +7 -0
  463. package/dist/secrets/provider.d.ts.map +1 -0
  464. package/dist/secrets/provider.js +10 -0
  465. package/dist/secrets/provider.js.map +1 -0
  466. package/dist/secrets/service.d.ts +64 -0
  467. package/dist/secrets/service.d.ts.map +1 -0
  468. package/dist/secrets/service.js +47 -0
  469. package/dist/secrets/service.js.map +1 -0
  470. package/dist/secrets/table-store.d.ts +34 -0
  471. package/dist/secrets/table-store.d.ts.map +1 -0
  472. package/dist/secrets/table-store.js +118 -0
  473. package/dist/secrets/table-store.js.map +1 -0
  474. package/dist/secrets/token.d.ts +4 -0
  475. package/dist/secrets/token.d.ts.map +1 -0
  476. package/dist/secrets/token.js +3 -0
  477. package/dist/secrets/token.js.map +1 -0
  478. package/dist/session/config.d.ts +10 -0
  479. package/dist/session/config.d.ts.map +1 -0
  480. package/dist/session/config.js +2 -0
  481. package/dist/session/config.js.map +1 -0
  482. package/dist/session/index.d.ts +4 -0
  483. package/dist/session/index.d.ts.map +1 -0
  484. package/dist/session/index.js +4 -0
  485. package/dist/session/index.js.map +1 -0
  486. package/dist/session/provider.d.ts +26 -0
  487. package/dist/session/provider.d.ts.map +1 -0
  488. package/dist/session/provider.js +69 -0
  489. package/dist/session/provider.js.map +1 -0
  490. package/dist/session/token.d.ts +4 -0
  491. package/dist/session/token.d.ts.map +1 -0
  492. package/dist/session/token.js +3 -0
  493. package/dist/session/token.js.map +1 -0
  494. package/dist/spa/config.d.ts +5 -0
  495. package/dist/spa/config.d.ts.map +1 -0
  496. package/dist/spa/config.js +2 -0
  497. package/dist/spa/config.js.map +1 -0
  498. package/dist/spa/content-types.d.ts +2 -0
  499. package/dist/spa/content-types.d.ts.map +1 -0
  500. package/dist/spa/content-types.js +25 -0
  501. package/dist/spa/content-types.js.map +1 -0
  502. package/dist/spa/index.d.ts +9 -0
  503. package/dist/spa/index.d.ts.map +1 -0
  504. package/dist/spa/index.js +9 -0
  505. package/dist/spa/index.js.map +1 -0
  506. package/dist/spa/provider.d.ts +13 -0
  507. package/dist/spa/provider.d.ts.map +1 -0
  508. package/dist/spa/provider.js +90 -0
  509. package/dist/spa/provider.js.map +1 -0
  510. package/dist/spa/routes.d.ts +4 -0
  511. package/dist/spa/routes.d.ts.map +1 -0
  512. package/dist/spa/routes.js +58 -0
  513. package/dist/spa/routes.js.map +1 -0
  514. package/dist/spa/runtime-html.d.ts +14 -0
  515. package/dist/spa/runtime-html.d.ts.map +1 -0
  516. package/dist/spa/runtime-html.js +85 -0
  517. package/dist/spa/runtime-html.js.map +1 -0
  518. package/dist/spa/serve-index.d.ts +9 -0
  519. package/dist/spa/serve-index.d.ts.map +1 -0
  520. package/dist/spa/serve-index.js +12 -0
  521. package/dist/spa/serve-index.js.map +1 -0
  522. package/dist/spa/static-assets.d.ts +7 -0
  523. package/dist/spa/static-assets.d.ts.map +1 -0
  524. package/dist/spa/static-assets.js +90 -0
  525. package/dist/spa/static-assets.js.map +1 -0
  526. package/dist/spa/types.d.ts +23 -0
  527. package/dist/spa/types.d.ts.map +1 -0
  528. package/dist/spa/types.js +2 -0
  529. package/dist/spa/types.js.map +1 -0
  530. package/dist/support/index.d.ts +4 -0
  531. package/dist/support/index.d.ts.map +1 -0
  532. package/dist/support/index.js +4 -0
  533. package/dist/support/index.js.map +1 -0
  534. package/dist/support/paths.d.ts +10 -0
  535. package/dist/support/paths.d.ts.map +1 -0
  536. package/dist/support/paths.js +25 -0
  537. package/dist/support/paths.js.map +1 -0
  538. package/dist/support/redirects.d.ts +3 -0
  539. package/dist/support/redirects.d.ts.map +1 -0
  540. package/dist/support/redirects.js +48 -0
  541. package/dist/support/redirects.js.map +1 -0
  542. package/dist/support/requests.d.ts +2 -0
  543. package/dist/support/requests.d.ts.map +1 -0
  544. package/dist/support/requests.js +13 -0
  545. package/dist/support/requests.js.map +1 -0
  546. package/dist/swagger-ui/LICENSE +202 -0
  547. package/dist/swagger-ui/NOTICE +2 -0
  548. package/dist/swagger-ui/favicon-16x16.png +0 -0
  549. package/dist/swagger-ui/favicon-32x32.png +0 -0
  550. package/dist/swagger-ui/swagger-ui-bundle.js +2 -0
  551. package/dist/swagger-ui/swagger-ui-bundle.js.LICENSE.txt +129 -0
  552. package/dist/swagger-ui/swagger-ui.css +3 -0
  553. package/dist/websocket.d.ts +61 -0
  554. package/dist/websocket.d.ts.map +1 -0
  555. package/dist/websocket.js +371 -0
  556. package/dist/websocket.js.map +1 -0
  557. package/package.json +193 -12
  558. package/LICENSE +0 -661
  559. package/lib/config/cache.d.ts +0 -2
  560. package/lib/config/cache.js +0 -16
  561. package/lib/config/database.d.ts +0 -3
  562. package/lib/config/database.js +0 -25
  563. package/lib/config/index.d.ts +0 -10
  564. package/lib/config/index.js +0 -20
  565. package/lib/config/logger.d.ts +0 -3
  566. package/lib/config/logger.js +0 -11
  567. package/lib/config/plugins.d.ts +0 -3
  568. package/lib/config/plugins.js +0 -8
  569. package/lib/config/resourcer.d.ts +0 -4
  570. package/lib/config/resourcer.js +0 -10
  571. package/lib/index.d.ts +0 -3
  572. package/lib/index.js +0 -21
  573. package/src/config/cache.ts +0 -5
  574. package/src/config/database.ts +0 -21
  575. package/src/config/index.ts +0 -13
  576. package/src/config/logger.ts +0 -6
  577. package/src/config/plugins.ts +0 -3
  578. package/src/config/resourcer.ts +0 -3
  579. package/src/index.ts +0 -10
@@ -0,0 +1,247 @@
1
+ import { existsSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { isDeepStrictEqual } from 'node:util';
4
+ import { Config } from '@nocobase/config';
5
+ import { jsonParser } from '@nocobase/config/parsers/json';
6
+ import { tomlParser } from '@nocobase/config/parsers/toml';
7
+ import { yamlParser } from '@nocobase/config/parsers/yaml';
8
+ import { fileProvider } from '@nocobase/config/providers/file';
9
+ import { environmentProvider, } from '@nocobase/config/providers/env';
10
+ import { AppConfigInvalidError, collectPublicConfig, listPublicPaths, validateConfigSections, } from './validation.js';
11
+ export class AppConfig {
12
+ sources = [];
13
+ listeners = new Map();
14
+ current;
15
+ defaults = new Config();
16
+ overrides = new Config();
17
+ sections = new Map();
18
+ reloadPromise;
19
+ logger;
20
+ loadDurationMs;
21
+ /** Attach diagnostics after the logging configuration has been resolved. */
22
+ setLogger(logger) {
23
+ this.logger = logger;
24
+ if (this.loadDurationMs !== undefined) {
25
+ logger.debug({ durationMs: this.loadDurationMs }, 'App configuration loaded');
26
+ this.loadDurationMs = undefined;
27
+ }
28
+ }
29
+ load(provider, parser, options) {
30
+ if (this.current) {
31
+ throw new Error('Config sources cannot be added after loading.');
32
+ }
33
+ this.sources.push({ provider, parser, options });
34
+ return this;
35
+ }
36
+ loadFile(filePath, options = {}) {
37
+ const resolvedPath = resolveConfigFilePath(filePath);
38
+ const extension = path.extname(resolvedPath).toLowerCase();
39
+ const parser = extension === '.toml'
40
+ ? tomlParser()
41
+ : extension === '.yml' || extension === '.yaml'
42
+ ? yamlParser()
43
+ : extension === '.json'
44
+ ? jsonParser()
45
+ : undefined;
46
+ if (!parser) {
47
+ throw new Error(`Unsupported application config file extension "${extension || '(none)'}". Expected .toml, .yml, .yaml, or .json.`);
48
+ }
49
+ return this.load(fileProvider(resolvedPath, options), parser);
50
+ }
51
+ async loadAll() {
52
+ const startedAt = Date.now();
53
+ const next = await this.loadConfig();
54
+ this.current = next;
55
+ this.loadDurationMs = Date.now() - startedAt;
56
+ if (this.logger)
57
+ this.setLogger(this.logger);
58
+ }
59
+ get(key) {
60
+ return this.requireCurrent().get(key);
61
+ }
62
+ mergeDefaults(values) {
63
+ this.requireCurrent();
64
+ const defaults = this.defaults.copy();
65
+ defaults.merge(new Config({}, values));
66
+ const next = defaults.copy();
67
+ next.merge(this.overrides);
68
+ this.defaults = defaults;
69
+ this.current = next;
70
+ }
71
+ /**
72
+ * Registers the validators and public paths sections declare, as collected by `defaultAppConfigs`. A section
73
+ * registered twice keeps both sets: every validator runs and the public paths are combined.
74
+ */
75
+ defineSections(sections) {
76
+ for (const [section, rules] of sections) {
77
+ const existing = this.sections.get(section);
78
+ this.sections.set(section, existing
79
+ ? {
80
+ validators: [...existing.validators, ...rules.validators],
81
+ public: [...new Set([...existing.public, ...rules.public])],
82
+ env: { ...existing.env, ...rules.env },
83
+ }
84
+ : rules);
85
+ }
86
+ }
87
+ /**
88
+ * Adds the environment variables sections declare, as one more source above everything already loaded, and
89
+ * recomputes the configuration. Called once the sections are known, which is after the application's own sources
90
+ * were loaded; a variable an application also maps itself to the same field is harmless.
91
+ */
92
+ async loadSectionEnvironment(environment) {
93
+ const mappings = {};
94
+ for (const [section, rules] of this.sections) {
95
+ for (const [variable, mapping] of Object.entries(rules.env ?? {})) {
96
+ const absolute = { ...mapping, path: `${section}.${mapping.path}` };
97
+ const existing = mappings[variable];
98
+ if (existing && existing.path !== absolute.path) {
99
+ throw new Error(`Environment variable ${variable} is declared for both ${existing.path} and ${absolute.path}.`);
100
+ }
101
+ mappings[variable] = absolute;
102
+ }
103
+ }
104
+ if (Object.keys(mappings).length === 0)
105
+ return;
106
+ this.sources.push({
107
+ provider: environmentProvider(environment, {
108
+ name: 'section-environment',
109
+ mappings,
110
+ }),
111
+ });
112
+ this.current = await this.loadConfig();
113
+ }
114
+ /** Every environment variable the sections declare, with the absolute path it sets, such as `{ AUTH_SECRET: 'auth.secret' }`. */
115
+ sectionEnvironmentVariables() {
116
+ const paths = {};
117
+ for (const [variable, mapping] of Object.entries(this.environmentVariableMappings()))
118
+ paths[variable] = mapping.path;
119
+ return paths;
120
+ }
121
+ /**
122
+ * Every environment variable the sections declare, with its mapping and the path made absolute, such as
123
+ * `{ AUTH_SECRET: { path: 'auth.secret', type: 'string', generate: 'secret' } }`.
124
+ */
125
+ environmentVariableMappings() {
126
+ const variables = {};
127
+ for (const [section, rules] of this.sections) {
128
+ for (const [variable, mapping] of Object.entries(rules.env ?? {})) {
129
+ variables[variable] = {
130
+ ...mapping,
131
+ path: `${section}.${mapping.path}`,
132
+ };
133
+ }
134
+ }
135
+ return variables;
136
+ }
137
+ /** Every issue the declared rules find in the current configuration, warnings included. Throws nothing. */
138
+ async validate() {
139
+ if (this.sections.size === 0)
140
+ return [];
141
+ return validateConfigSections(this.requireCurrent().raw(), this.overrides.raw(), this.sections);
142
+ }
143
+ /** The values sections publish to the browser, nested under their section names. */
144
+ publicValues() {
145
+ if (this.sections.size === 0)
146
+ return {};
147
+ return collectPublicConfig(this.requireCurrent().raw(), this.sections);
148
+ }
149
+ /** Every published path in full, such as `auth.emailAndPassword.disableSignUp`. */
150
+ publicPaths() {
151
+ return listPublicPaths(this.sections);
152
+ }
153
+ raw() {
154
+ return this.requireCurrent().raw();
155
+ }
156
+ /** The defaults and the values the application's own sources supply, kept apart. See {@link AppConfigLayers}. */
157
+ layers() {
158
+ this.requireCurrent();
159
+ return {
160
+ defaults: this.defaults.copy().raw(),
161
+ overrides: this.overrides.copy().raw(),
162
+ };
163
+ }
164
+ subscribe(namespace, listener) {
165
+ const listeners = this.listeners.get(namespace) ?? new Set();
166
+ listeners.add(listener);
167
+ this.listeners.set(namespace, listeners);
168
+ return () => {
169
+ listeners.delete(listener);
170
+ };
171
+ }
172
+ reload() {
173
+ const startedAt = Date.now();
174
+ this.reloadPromise ??= this.performReload()
175
+ .then((result) => {
176
+ this.logger?.debug({
177
+ changedNamespaces: result.changedNamespaces,
178
+ durationMs: Date.now() - startedAt,
179
+ }, 'App configuration reloaded');
180
+ return result;
181
+ })
182
+ .finally(() => {
183
+ this.reloadPromise = undefined;
184
+ });
185
+ return this.reloadPromise;
186
+ }
187
+ async performReload() {
188
+ const previous = this.requireCurrent();
189
+ const previousOverrides = this.overrides;
190
+ const next = await this.loadConfig();
191
+ // A reload that breaks a declared rule is refused and the running configuration stays as it was.
192
+ const issues = await validateConfigSections(next.raw(), this.overrides.raw(), this.sections);
193
+ if (issues.some((issue) => issue.level === 'error')) {
194
+ this.overrides = previousOverrides;
195
+ throw new AppConfigInvalidError(issues);
196
+ }
197
+ const namespaces = new Set([...previous.mapKeys(''), ...next.mapKeys('')]);
198
+ const changedNamespaces = [...namespaces]
199
+ .filter((namespace) => !isDeepStrictEqual(previous.get(namespace), next.get(namespace)))
200
+ .sort();
201
+ if (changedNamespaces.length === 0) {
202
+ return { changedNamespaces };
203
+ }
204
+ this.current = next;
205
+ for (const namespace of changedNamespaces) {
206
+ const listeners = this.listeners.get(namespace);
207
+ if (!listeners)
208
+ continue;
209
+ for (const listener of listeners) {
210
+ await listener({
211
+ previous: previous.get(namespace),
212
+ current: next.get(namespace),
213
+ });
214
+ }
215
+ }
216
+ return { changedNamespaces };
217
+ }
218
+ async loadConfig() {
219
+ const overrides = new Config();
220
+ for (const source of this.sources) {
221
+ await overrides.load(source.provider, source.parser, source.options);
222
+ }
223
+ const next = this.defaults.copy();
224
+ next.merge(overrides);
225
+ this.overrides = overrides;
226
+ return next;
227
+ }
228
+ requireCurrent() {
229
+ if (!this.current) {
230
+ throw new Error('Application config has not been initialized.');
231
+ }
232
+ return this.current;
233
+ }
234
+ }
235
+ function resolveConfigFilePath(filePath) {
236
+ if (path.extname(filePath))
237
+ return filePath;
238
+ const candidates = ['.yml', '.yaml', '.toml', '.json'].map((extension) => `${filePath}${extension}`);
239
+ return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
240
+ }
241
+ /** Resolve deployment configuration independently of the compiled code directory. */
242
+ export function resolveDefaultAppConfigFile(paths) {
243
+ const candidate = path.join(paths.deploymentRootDir, 'config');
244
+ const resolved = resolveConfigFilePath(candidate);
245
+ return existsSync(resolved) ? resolved : candidate;
246
+ }
247
+ //# sourceMappingURL=app-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/config/app-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAkB,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,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,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ConfigContext, CreateConfigContextOptions } from './types.js';
2
+ export declare function createConfigContext(options: CreateConfigContextOptions): ConfigContext;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/config/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE5E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,aAAa,CAKf"}
@@ -0,0 +1,7 @@
1
+ export function createConfigContext(options) {
2
+ return {
3
+ environment: options.env,
4
+ paths: options.paths,
5
+ };
6
+ }
7
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/config/context.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CACjC,OAAmC;IAEnC,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,GAAG;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,71 @@
1
+ import type { EnvironmentMapping } from '@nocobase/config/providers/env';
2
+ import type { AppRuntimeContext } from '../runtime/definition.js';
3
+ /** A problem a validator found, with its path relative to the section it validated. */
4
+ export interface ConfigValidationContext {
5
+ error(path: string, message: string, options?: ConfigIssueOptions): void;
6
+ warning(path: string, message: string, options?: ConfigIssueOptions): void;
7
+ /** Whether the value at `path` came from a configuration file or the environment rather than code defaults. */
8
+ isUserProvided(path: string): boolean;
9
+ }
10
+ export interface ConfigIssueOptions {
11
+ /** A command or change that resolves the issue, written so it can be applied as is. */
12
+ readonly fix?: string;
13
+ }
14
+ /**
15
+ * Checks one section's final value — code defaults merged with the configuration file and the environment.
16
+ *
17
+ * It runs at startup, on every reload and in `config check`, so it may read local files but must not reach the
18
+ * network or write anything. The value is typed as the section, but it came from user input: check it as untrusted.
19
+ */
20
+ export type ConfigValidator<T> = (value: T, context: ConfigValidationContext) => void | Promise<void>;
21
+ export interface AppConfigDefinition<T extends object> {
22
+ readonly defaults: T | ((runtime: AppRuntimeContext) => T);
23
+ readonly validate?: ConfigValidator<T> | readonly ConfigValidator<T>[];
24
+ /**
25
+ * Leaf paths, relative to the section, that the browser may read through `config.public`. Anything not listed is
26
+ * never sent.
27
+ */
28
+ readonly public?: readonly string[];
29
+ /**
30
+ * Environment variables that set fields of this section, with paths relative to it, such as
31
+ * `{ AUTH_SECRET: envString('secret') }`. The owner of the section declares them here so that whoever reads a
32
+ * setting also maps it. `pnpm nocobase config env` lists every declared variable.
33
+ */
34
+ readonly env?: Readonly<Record<string, EnvironmentMapping>>;
35
+ }
36
+ /** What a section declares beyond its defaults, as the runtime reads it. */
37
+ export interface AppConfigRules {
38
+ readonly validators: readonly ConfigValidator<never>[];
39
+ readonly public: readonly string[];
40
+ readonly env?: Readonly<Record<string, EnvironmentMapping>>;
41
+ }
42
+ export interface AppConfigFactory<T extends object = object> {
43
+ (runtime: AppRuntimeContext): T;
44
+ /** Present on a factory made by `defineAppConfig` with a validator or public paths. */
45
+ readonly rules?: AppConfigRules;
46
+ /** Present on a factory made by `defaultAppConfigs`: the rules of each section it combines, by section name. */
47
+ readonly sections?: ReadonlyMap<string, AppConfigRules>;
48
+ }
49
+ /**
50
+ * Declares one configuration section.
51
+ *
52
+ * A function is the shorthand for `{ defaults }`, so an existing `defineAppConfig((runtime) => ({ ... }))` keeps
53
+ * working unchanged.
54
+ */
55
+ export declare function defineAppConfig<T extends object>(definition: AppConfigDefinition<T> | ((runtime: AppRuntimeContext) => T)): AppConfigFactory<T>;
56
+ export declare function defaultAppConfigs<T extends Record<string, AppConfigFactory>>(configs: T): AppConfigFactory<{
57
+ [K in keyof T]: ReturnType<T[K]>;
58
+ }>;
59
+ export interface AppIdentityConfig {
60
+ readonly name: string;
61
+ readonly publicOrigin?: string;
62
+ readonly publicBasePath: string;
63
+ readonly internalBasePath: string;
64
+ readonly publicApiUrl: string;
65
+ /**
66
+ * Load sample data on the first start: the seeds declared with `sample: true` and what plugins register on
67
+ * `sampleDataToken`. Read only while the application's database is being installed; `APP_SAMPLE_DATA` sets it.
68
+ */
69
+ readonly sampleData?: boolean;
70
+ }
71
+ //# sourceMappingURL=define-app-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-app-config.d.ts","sourceRoot":"","sources":["../../src/config/define-app-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,uFAAuF;AACvF,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC3E,+GAA+G;IAC/G,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,uFAAuF;IACvF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAC/B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,uBAAuB,KAC7B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACnD,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,KAAK,CAAC,CAAC,CAAC;IAC3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AAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAexD;AAOD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Declares one configuration section.
3
+ *
4
+ * A function is the shorthand for `{ defaults }`, so an existing `defineAppConfig((runtime) => ({ ... }))` keeps
5
+ * working unchanged.
6
+ */
7
+ export function defineAppConfig(definition) {
8
+ if (typeof definition === 'function') {
9
+ return (runtime) => definition(runtime);
10
+ }
11
+ const { defaults } = definition;
12
+ // An object is returned as is rather than cloned: defaults may hold functions and instances, such as Better Auth
13
+ // plugins, and merging into the configuration copies what it keeps.
14
+ const factory = (runtime) => typeof defaults === 'function' ? defaults(runtime) : defaults;
15
+ const validators = toArray(definition.validate);
16
+ const publicPaths = [...(definition.public ?? [])];
17
+ const env = { ...definition.env };
18
+ if (validators.length === 0 &&
19
+ publicPaths.length === 0 &&
20
+ Object.keys(env).length === 0) {
21
+ return factory;
22
+ }
23
+ return Object.assign(factory, {
24
+ rules: Object.freeze({
25
+ validators: Object.freeze(validators),
26
+ public: Object.freeze(publicPaths),
27
+ env: Object.freeze(env),
28
+ }),
29
+ });
30
+ }
31
+ export function defaultAppConfigs(configs) {
32
+ const sections = new Map();
33
+ for (const [key, configure] of Object.entries(configs)) {
34
+ if (configure.rules)
35
+ sections.set(key, configure.rules);
36
+ }
37
+ const factory = (runtime) => Object.fromEntries(Object.entries(configs).map(([key, configure]) => [
38
+ key,
39
+ configure(runtime),
40
+ ]));
41
+ return Object.assign(factory, { sections });
42
+ }
43
+ function toArray(value) {
44
+ if (value === undefined)
45
+ return [];
46
+ return Array.isArray(value) ? [...value] : [value];
47
+ }
48
+ //# sourceMappingURL=define-app-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-app-config.js","sourceRoot":"","sources":["../../src/config/define-app-config.ts"],"names":[],"mappings":"AA2DA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAwE;IAExE,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;QACrC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;IAChC,iHAAiH;IACjH,oEAAoE;IACpE,MAAM,OAAO,GAAG,CAAC,OAA0B,EAAK,EAAE,CAChD,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC;IAClC,IACE,UAAU,CAAC,MAAM,KAAK,CAAC;QACvB,WAAW,CAAC,MAAM,KAAK,CAAC;QACxB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAC7B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;QAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;YACnB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YAClC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;SACxB,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAAU;IAEV,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IACnD,KAAK,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,IAAI,SAAS,CAAC,KAAK;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,OAAO,GAAG,CACd,OAA0B,EACY,EAAE,CACxC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;QAChD,GAAG;QACH,SAAS,CAAC,OAAO,CAAC;KACnB,CAAC,CACqC,CAAC;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,OAAO,CAAI,KAAmC;IACrD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAI,KAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAU,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { AppConfig, resolveDefaultAppConfigFile } from './app-config.js';
2
+ export { envBoolean, envInteger, envString, envStrings, isSecretPath, type EnvironmentMapping, type EnvironmentMetadata, type EnvironmentValueGenerator, } from '@nocobase/config/providers/env';
3
+ export { buildVariablesManifest, isExamplePlaceholder, KNOWN_EXAMPLE_PLACEHOLDERS, requiredOf, type BuildVariablesManifestOptions, type VariablesManifest, type VariablesManifestEntry, } from './variables.js';
4
+ export { defineAppConfig, defaultAppConfigs, type AppConfigDefinition, type AppConfigFactory, type AppConfigRules, type AppIdentityConfig, type ConfigIssueOptions, type ConfigValidationContext, type ConfigValidator, } from './define-app-config.js';
5
+ export { AppConfigInvalidError, findAppConfigInvalid, formatConfigIssues, type ConfigIssue, } from './validation.js';
6
+ export type * from './app-config-types.js';
7
+ export * from './context.js';
8
+ export * from './not-configured.js';
9
+ export * from './placeholder-secret.js';
10
+ export * from './paths.js';
11
+ export { RUNTIME_ENVIRONMENT_VARIABLES, type RuntimeEnvironmentVariable, } from './runtime-environment.js';
12
+ export type * from './types.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,0BAA0B,EAC1B,UAAU,EACV,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AACzB,mBAAmB,uBAAuB,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,6BAA6B,EAC7B,KAAK,0BAA0B,GAChC,MAAM,0BAA0B,CAAC;AAClC,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { AppConfig, resolveDefaultAppConfigFile } from './app-config.js';
2
+ export { envBoolean, envInteger, envString, envStrings, isSecretPath, } from '@nocobase/config/providers/env';
3
+ export { buildVariablesManifest, isExamplePlaceholder, KNOWN_EXAMPLE_PLACEHOLDERS, requiredOf, } from './variables.js';
4
+ export { defineAppConfig, defaultAppConfigs, } from './define-app-config.js';
5
+ export { AppConfigInvalidError, findAppConfigInvalid, formatConfigIssues, } from './validation.js';
6
+ export * from './context.js';
7
+ export * from './not-configured.js';
8
+ export * from './placeholder-secret.js';
9
+ export * from './paths.js';
10
+ export { RUNTIME_ENVIRONMENT_VARIABLES, } from './runtime-environment.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,GAIb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,0BAA0B,EAC1B,UAAU,GAIX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,iBAAiB,GAQlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GAEnB,MAAM,iBAAiB,CAAC;AAEzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,6BAA6B,GAE9B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface ApplicationNotConfiguredDetails {
2
+ /** The configuration key that is missing, such as `auth.secret`. */
3
+ readonly key?: string;
4
+ /** The environment variable that can supply it instead, when the application maps one. */
5
+ readonly environmentVariable?: string;
6
+ }
7
+ /**
8
+ * The application has nothing to start with: no configuration supplies what it cannot run without.
9
+ *
10
+ * It states what is missing and nothing more. The remedy depends on how the application is run — a standalone start
11
+ * points at `pnpm nocobase config init`, while an application hosted by a Hub is configured through the Hub — so the entry point
12
+ * that prints the error adds it, and a Hub showing the same error to an operator does not pass on advice that does not
13
+ * apply. Recognised by `name` as well as by class, so a second copy of this package in the process is still
14
+ * recognised.
15
+ */
16
+ export declare class ApplicationNotConfiguredError extends Error {
17
+ readonly key?: string;
18
+ readonly environmentVariable?: string;
19
+ constructor(message: string, details?: ApplicationNotConfiguredDetails);
20
+ }
21
+ /** Whether `error`, or anything in its cause chain, reports an application that has not been configured. */
22
+ export declare function findApplicationNotConfigured(error: unknown): ApplicationNotConfiguredError | undefined;
23
+ //# sourceMappingURL=not-configured.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-configured.d.ts","sourceRoot":"","sources":["../../src/config/not-configured.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,+BAA+B;IAC9C,oEAAoE;IACpE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,0FAA0F;IAC1F,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,SAAgB,GAAG,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAgB,mBAAmB,CAAC,EAAE,MAAM,CAAC;gBAG3C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,+BAAoC;CAOhD;AAED,4GAA4G;AAC5G,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,6BAA6B,GAAG,SAAS,CAW3C"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The application has nothing to start with: no configuration supplies what it cannot run without.
3
+ *
4
+ * It states what is missing and nothing more. The remedy depends on how the application is run — a standalone start
5
+ * points at `pnpm nocobase config init`, while an application hosted by a Hub is configured through the Hub — so the entry point
6
+ * that prints the error adds it, and a Hub showing the same error to an operator does not pass on advice that does not
7
+ * apply. Recognised by `name` as well as by class, so a second copy of this package in the process is still
8
+ * recognised.
9
+ */
10
+ export class ApplicationNotConfiguredError extends Error {
11
+ key;
12
+ environmentVariable;
13
+ constructor(message, details = {}) {
14
+ super(message);
15
+ this.name = 'ApplicationNotConfiguredError';
16
+ this.key = details.key;
17
+ this.environmentVariable = details.environmentVariable;
18
+ }
19
+ }
20
+ /** Whether `error`, or anything in its cause chain, reports an application that has not been configured. */
21
+ export function findApplicationNotConfigured(error) {
22
+ let current = error;
23
+ for (let depth = 0; depth < 5 && current instanceof Error; depth += 1) {
24
+ if (current instanceof ApplicationNotConfiguredError ||
25
+ current.name === 'ApplicationNotConfiguredError')
26
+ return current;
27
+ current = current.cause;
28
+ }
29
+ return undefined;
30
+ }
31
+ //# sourceMappingURL=not-configured.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-configured.js","sourceRoot":"","sources":["../../src/config/not-configured.ts"],"names":[],"mappings":"AAOA;;;;;;;;GAQG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtC,GAAG,CAAU;IACb,mBAAmB,CAAU;IAE7C,YACE,OAAe,EACf,UAA2C,EAAE;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IACzD,CAAC;CACF;AAED,4GAA4G;AAC5G,MAAM,UAAU,4BAA4B,CAC1C,KAAc;IAEd,IAAI,OAAO,GAAY,KAAK,CAAC;IAC7B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,OAAO,YAAY,KAAK,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACtE,IACE,OAAO,YAAY,6BAA6B;YAChD,OAAO,CAAC,IAAI,KAAK,+BAA+B;YAEhD,OAAO,OAAO,CAAC;QACjB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,27 @@
1
+ export interface AppPathOptions {
2
+ readonly rootDir: string;
3
+ readonly deploymentRootDir?: string;
4
+ readonly serverDir?: string;
5
+ readonly databaseDir?: string;
6
+ readonly clientDir?: string;
7
+ readonly configDir?: string;
8
+ readonly storageDir?: string;
9
+ }
10
+ export interface AppPaths {
11
+ readonly rootDir: string;
12
+ readonly deploymentRootDir: string;
13
+ readonly serverDir: string;
14
+ readonly databaseDir: string;
15
+ readonly clientDir: string;
16
+ readonly configDir: string;
17
+ readonly storageDir: string;
18
+ root(relativePath?: string): string;
19
+ server(relativePath?: string): string;
20
+ database(relativePath?: string): string;
21
+ client(relativePath?: string): string;
22
+ config(relativePath?: string): string;
23
+ storage(relativePath?: string): string;
24
+ }
25
+ /** Resolve directory inputs once; all application consumers share this object. */
26
+ export declare function createAppPaths(options: AppPathOptions): AppPaths;
27
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/config/paths.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,QAAQ,CA6BhE"}
@@ -0,0 +1,27 @@
1
+ import path from 'node:path';
2
+ /** Resolve directory inputs once; all application consumers share this object. */
3
+ export function createAppPaths(options) {
4
+ const rootDir = path.resolve(options.rootDir);
5
+ const deploymentRootDir = path.resolve(rootDir, options.deploymentRootDir ?? '.');
6
+ const serverDir = path.resolve(rootDir, options.serverDir ?? 'server');
7
+ const databaseDir = path.resolve(rootDir, options.databaseDir ?? 'database');
8
+ const clientDir = path.resolve(rootDir, options.clientDir ?? 'client');
9
+ const configDir = path.resolve(serverDir, options.configDir ?? 'config');
10
+ const storageDir = path.resolve(deploymentRootDir, options.storageDir ?? 'storage');
11
+ return Object.freeze({
12
+ rootDir,
13
+ deploymentRootDir,
14
+ serverDir,
15
+ databaseDir,
16
+ clientDir,
17
+ configDir,
18
+ storageDir,
19
+ root: (relativePath = '') => path.resolve(rootDir, relativePath),
20
+ server: (relativePath = '') => path.resolve(serverDir, relativePath),
21
+ database: (relativePath = '') => path.resolve(databaseDir, relativePath),
22
+ client: (relativePath = '') => path.resolve(clientDir, relativePath),
23
+ config: (relativePath = '') => path.resolve(configDir, relativePath),
24
+ storage: (relativePath = '') => path.resolve(storageDir, relativePath),
25
+ });
26
+ }
27
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/config/paths.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AA4B7B,kFAAkF;AAClF,MAAM,UAAU,cAAc,CAAC,OAAuB;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CACpC,OAAO,EACP,OAAO,CAAC,iBAAiB,IAAI,GAAG,CACjC,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;IAC7E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;IACzE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,iBAAiB,EACjB,OAAO,CAAC,UAAU,IAAI,SAAS,CAChC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO;QACP,iBAAiB;QACjB,SAAS;QACT,WAAW;QACX,SAAS;QACT,SAAS;QACT,UAAU;QACV,IAAI,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC;QAChE,MAAM,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC;QACpE,QAAQ,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC;QACxE,MAAM,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC;QACpE,MAAM,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC;QACpE,OAAO,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC;KACvE,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The value `config.example.yml` ships for every secret it declares.
3
+ *
4
+ * The example carries live keys rather than commented-out ones, so that `@nocobase/create-app` can fill them in by
5
+ * replacing a value instead of by uncommenting a line. That makes one thing possible that a commented placeholder did
6
+ * not: a `config.yml` copied from the example by hand starts with a secret that is present, non-empty, identical
7
+ * across every installation, and published in this repository. Nothing downstream can tell it apart from a real one,
8
+ * so it is rejected here instead.
9
+ */
10
+ export declare const PLACEHOLDER_SECRET = "replace-with-a-unique-secret";
11
+ export declare function isPlaceholderSecret(value: string | undefined): boolean;
12
+ /**
13
+ * Rejects a secret still left at the example's placeholder.
14
+ *
15
+ * `key` names the setting as it is written in configuration, such as `auth.secret`, because that is what the reader
16
+ * has to go and change.
17
+ */
18
+ export declare function assertSecretIsNotPlaceholder(value: string | undefined, key: string): void;
19
+ //# sourceMappingURL=placeholder-secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-secret.d.ts","sourceRoot":"","sources":["../../src/config/placeholder-secret.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AAEjE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,GACV,IAAI,CAQN"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The value `config.example.yml` ships for every secret it declares.
3
+ *
4
+ * The example carries live keys rather than commented-out ones, so that `@nocobase/create-app` can fill them in by
5
+ * replacing a value instead of by uncommenting a line. That makes one thing possible that a commented placeholder did
6
+ * not: a `config.yml` copied from the example by hand starts with a secret that is present, non-empty, identical
7
+ * across every installation, and published in this repository. Nothing downstream can tell it apart from a real one,
8
+ * so it is rejected here instead.
9
+ */
10
+ export const PLACEHOLDER_SECRET = 'replace-with-a-unique-secret';
11
+ export function isPlaceholderSecret(value) {
12
+ return value?.trim() === PLACEHOLDER_SECRET;
13
+ }
14
+ /**
15
+ * Rejects a secret still left at the example's placeholder.
16
+ *
17
+ * `key` names the setting as it is written in configuration, such as `auth.secret`, because that is what the reader
18
+ * has to go and change.
19
+ */
20
+ export function assertSecretIsNotPlaceholder(value, key) {
21
+ if (!isPlaceholderSecret(value)) {
22
+ return;
23
+ }
24
+ throw new Error(`${key} is still set to the placeholder from config.example.yml. Replace it with a unique value, for example one generated with: openssl rand -hex 32`);
25
+ }
26
+ //# sourceMappingURL=placeholder-secret.js.map