@seshuk/payload-plugin-openapi 0.2.1 → 1.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 (377) hide show
  1. package/README.md +67 -25
  2. package/dist/_tooling/telemetry.js +168 -0
  3. package/dist/_tooling/telemetry.js.map +1 -0
  4. package/dist/cli/generateSpec.d.ts +2 -0
  5. package/dist/cli/generateSpec.js +40 -0
  6. package/dist/cli/generateSpec.js.map +1 -0
  7. package/dist/index.d.ts +8 -9
  8. package/dist/index.js +76 -65
  9. package/dist/index.js.map +1 -0
  10. package/dist/{endpoints → server/endpoints}/interactiveAuth.d.ts +2 -2
  11. package/dist/server/endpoints/interactiveAuth.js +25 -0
  12. package/dist/server/endpoints/interactiveAuth.js.map +1 -0
  13. package/dist/server/endpoints/spec.d.ts +5 -0
  14. package/dist/server/endpoints/spec.js +39 -0
  15. package/dist/server/endpoints/spec.js.map +1 -0
  16. package/dist/server/options/resolveOptions.d.ts +4 -0
  17. package/dist/server/options/resolveOptions.js +65 -0
  18. package/dist/server/options/resolveOptions.js.map +1 -0
  19. package/dist/server/spec/build.d.ts +14 -0
  20. package/dist/server/spec/build.js +40 -0
  21. package/dist/server/spec/build.js.map +1 -0
  22. package/dist/server/spec/buildDocument.d.ts +16 -0
  23. package/dist/server/spec/buildDocument.js +287 -0
  24. package/dist/server/spec/buildDocument.js.map +1 -0
  25. package/dist/server/spec/components.d.ts +61 -0
  26. package/dist/server/spec/components.js +265 -0
  27. package/dist/server/spec/components.js.map +1 -0
  28. package/dist/{spec → server/spec}/downconvert.d.ts +2 -1
  29. package/dist/server/spec/downconvert.js +69 -0
  30. package/dist/server/spec/downconvert.js.map +1 -0
  31. package/dist/server/spec/entitySchemas.d.ts +16 -0
  32. package/dist/server/spec/entitySchemas.js +207 -0
  33. package/dist/server/spec/entitySchemas.js.map +1 -0
  34. package/dist/{spec → server/spec}/fields.d.ts +2 -1
  35. package/dist/server/spec/fields.js +47 -0
  36. package/dist/server/spec/fields.js.map +1 -0
  37. package/dist/server/spec/filters.d.ts +12 -0
  38. package/dist/server/spec/filters.js +91 -0
  39. package/dist/server/spec/filters.js.map +1 -0
  40. package/dist/server/spec/hierarchy.d.ts +11 -0
  41. package/dist/server/spec/hierarchy.js +38 -0
  42. package/dist/server/spec/hierarchy.js.map +1 -0
  43. package/dist/{spec → server/spec}/names.d.ts +2 -2
  44. package/dist/server/spec/names.js +43 -0
  45. package/dist/server/spec/names.js.map +1 -0
  46. package/dist/server/spec/params.d.ts +57 -0
  47. package/dist/server/spec/params.js +394 -0
  48. package/dist/server/spec/params.js.map +1 -0
  49. package/dist/server/spec/paths/auth.d.ts +10 -0
  50. package/dist/server/spec/paths/auth.js +190 -0
  51. package/dist/server/spec/paths/auth.js.map +1 -0
  52. package/dist/server/spec/paths/collections.d.ts +11 -0
  53. package/dist/server/spec/paths/collections.js +314 -0
  54. package/dist/server/spec/paths/collections.js.map +1 -0
  55. package/dist/server/spec/paths/custom.d.ts +10 -0
  56. package/dist/server/spec/paths/custom.js +42 -0
  57. package/dist/server/spec/paths/custom.js.map +1 -0
  58. package/dist/server/spec/paths/globals.d.ts +11 -0
  59. package/dist/server/spec/paths/globals.js +87 -0
  60. package/dist/server/spec/paths/globals.js.map +1 -0
  61. package/dist/server/spec/paths/jobs.d.ts +9 -0
  62. package/dist/server/spec/paths/jobs.js +98 -0
  63. package/dist/server/spec/paths/jobs.js.map +1 -0
  64. package/dist/server/spec/paths/system.d.ts +8 -0
  65. package/dist/server/spec/paths/system.js +137 -0
  66. package/dist/server/spec/paths/system.js.map +1 -0
  67. package/dist/server/spec/paths/versions.d.ts +22 -0
  68. package/dist/server/spec/paths/versions.js +185 -0
  69. package/dist/server/spec/paths/versions.js.map +1 -0
  70. package/dist/server/spec/security.d.ts +33 -0
  71. package/dist/server/spec/security.js +97 -0
  72. package/dist/server/spec/security.js.map +1 -0
  73. package/dist/server/spec/tags.d.ts +34 -0
  74. package/dist/server/spec/tags.js +83 -0
  75. package/dist/server/spec/tags.js.map +1 -0
  76. package/dist/server/telemetry.d.ts +31 -0
  77. package/dist/server/telemetry.js +33 -0
  78. package/dist/server/telemetry.js.map +1 -0
  79. package/dist/server/ui/createUiPlugin.d.ts +16 -0
  80. package/dist/server/ui/createUiPlugin.js +33 -0
  81. package/dist/server/ui/createUiPlugin.js.map +1 -0
  82. package/dist/{ui → server/ui}/html.d.ts +5 -3
  83. package/dist/server/ui/html.js +11 -0
  84. package/dist/server/ui/html.js.map +1 -0
  85. package/dist/server/ui/scalar.d.ts +4 -0
  86. package/dist/server/ui/scalar.js +17 -0
  87. package/dist/server/ui/scalar.js.map +1 -0
  88. package/dist/server/ui/swagger.d.ts +4 -0
  89. package/dist/server/ui/swagger.js +18 -0
  90. package/dist/server/ui/swagger.js.map +1 -0
  91. package/dist/shared/constants.d.ts +4 -0
  92. package/dist/shared/constants.js +6 -0
  93. package/dist/shared/constants.js.map +1 -0
  94. package/dist/shared/translations/index.d.ts +5 -0
  95. package/dist/{translations → shared/translations}/index.js +49 -47
  96. package/dist/shared/translations/index.js.map +1 -0
  97. package/dist/shared/translations/locales/ar.d.ts +3 -0
  98. package/dist/shared/translations/locales/ar.js +99 -0
  99. package/dist/shared/translations/locales/ar.js.map +1 -0
  100. package/dist/shared/translations/locales/az.d.ts +3 -0
  101. package/dist/shared/translations/locales/az.js +99 -0
  102. package/dist/shared/translations/locales/az.js.map +1 -0
  103. package/dist/shared/translations/locales/bg.d.ts +3 -0
  104. package/dist/shared/translations/locales/bg.js +99 -0
  105. package/dist/shared/translations/locales/bg.js.map +1 -0
  106. package/dist/shared/translations/locales/bnBd.d.ts +3 -0
  107. package/dist/shared/translations/locales/bnBd.js +99 -0
  108. package/dist/shared/translations/locales/bnBd.js.map +1 -0
  109. package/dist/shared/translations/locales/bnIn.d.ts +3 -0
  110. package/dist/shared/translations/locales/bnIn.js +99 -0
  111. package/dist/shared/translations/locales/bnIn.js.map +1 -0
  112. package/dist/shared/translations/locales/ca.d.ts +3 -0
  113. package/dist/shared/translations/locales/ca.js +99 -0
  114. package/dist/shared/translations/locales/ca.js.map +1 -0
  115. package/dist/shared/translations/locales/cs.d.ts +3 -0
  116. package/dist/shared/translations/locales/cs.js +99 -0
  117. package/dist/shared/translations/locales/cs.js.map +1 -0
  118. package/dist/shared/translations/locales/da.d.ts +3 -0
  119. package/dist/shared/translations/locales/da.js +99 -0
  120. package/dist/shared/translations/locales/da.js.map +1 -0
  121. package/dist/shared/translations/locales/de.d.ts +3 -0
  122. package/dist/shared/translations/locales/de.js +99 -0
  123. package/dist/shared/translations/locales/de.js.map +1 -0
  124. package/dist/shared/translations/locales/en.d.ts +3 -0
  125. package/dist/shared/translations/locales/en.js +99 -0
  126. package/dist/shared/translations/locales/en.js.map +1 -0
  127. package/dist/shared/translations/locales/es.d.ts +3 -0
  128. package/dist/shared/translations/locales/es.js +99 -0
  129. package/dist/shared/translations/locales/es.js.map +1 -0
  130. package/dist/shared/translations/locales/et.d.ts +3 -0
  131. package/dist/shared/translations/locales/et.js +99 -0
  132. package/dist/shared/translations/locales/et.js.map +1 -0
  133. package/dist/shared/translations/locales/fa.d.ts +3 -0
  134. package/dist/shared/translations/locales/fa.js +99 -0
  135. package/dist/shared/translations/locales/fa.js.map +1 -0
  136. package/dist/shared/translations/locales/fr.d.ts +3 -0
  137. package/dist/shared/translations/locales/fr.js +99 -0
  138. package/dist/shared/translations/locales/fr.js.map +1 -0
  139. package/dist/shared/translations/locales/he.d.ts +3 -0
  140. package/dist/shared/translations/locales/he.js +99 -0
  141. package/dist/shared/translations/locales/he.js.map +1 -0
  142. package/dist/shared/translations/locales/hr.d.ts +3 -0
  143. package/dist/shared/translations/locales/hr.js +99 -0
  144. package/dist/shared/translations/locales/hr.js.map +1 -0
  145. package/dist/shared/translations/locales/hu.d.ts +3 -0
  146. package/dist/shared/translations/locales/hu.js +99 -0
  147. package/dist/shared/translations/locales/hu.js.map +1 -0
  148. package/dist/shared/translations/locales/hy.d.ts +3 -0
  149. package/dist/shared/translations/locales/hy.js +99 -0
  150. package/dist/shared/translations/locales/hy.js.map +1 -0
  151. package/dist/shared/translations/locales/id.d.ts +3 -0
  152. package/dist/shared/translations/locales/id.js +99 -0
  153. package/dist/shared/translations/locales/id.js.map +1 -0
  154. package/dist/shared/translations/locales/is.d.ts +3 -0
  155. package/dist/shared/translations/locales/is.js +99 -0
  156. package/dist/shared/translations/locales/is.js.map +1 -0
  157. package/dist/shared/translations/locales/it.d.ts +3 -0
  158. package/dist/shared/translations/locales/it.js +99 -0
  159. package/dist/shared/translations/locales/it.js.map +1 -0
  160. package/dist/shared/translations/locales/ja.d.ts +3 -0
  161. package/dist/shared/translations/locales/ja.js +99 -0
  162. package/dist/shared/translations/locales/ja.js.map +1 -0
  163. package/dist/shared/translations/locales/ko.d.ts +3 -0
  164. package/dist/shared/translations/locales/ko.js +99 -0
  165. package/dist/shared/translations/locales/ko.js.map +1 -0
  166. package/dist/shared/translations/locales/lt.d.ts +3 -0
  167. package/dist/shared/translations/locales/lt.js +99 -0
  168. package/dist/shared/translations/locales/lt.js.map +1 -0
  169. package/dist/shared/translations/locales/lv.d.ts +3 -0
  170. package/dist/shared/translations/locales/lv.js +99 -0
  171. package/dist/shared/translations/locales/lv.js.map +1 -0
  172. package/dist/shared/translations/locales/my.d.ts +3 -0
  173. package/dist/shared/translations/locales/my.js +99 -0
  174. package/dist/shared/translations/locales/my.js.map +1 -0
  175. package/dist/shared/translations/locales/nb.d.ts +3 -0
  176. package/dist/shared/translations/locales/nb.js +99 -0
  177. package/dist/shared/translations/locales/nb.js.map +1 -0
  178. package/dist/shared/translations/locales/nl.d.ts +3 -0
  179. package/dist/shared/translations/locales/nl.js +99 -0
  180. package/dist/shared/translations/locales/nl.js.map +1 -0
  181. package/dist/shared/translations/locales/pl.d.ts +3 -0
  182. package/dist/shared/translations/locales/pl.js +99 -0
  183. package/dist/shared/translations/locales/pl.js.map +1 -0
  184. package/dist/shared/translations/locales/pt.d.ts +3 -0
  185. package/dist/shared/translations/locales/pt.js +99 -0
  186. package/dist/shared/translations/locales/pt.js.map +1 -0
  187. package/dist/shared/translations/locales/ro.d.ts +3 -0
  188. package/dist/shared/translations/locales/ro.js +99 -0
  189. package/dist/shared/translations/locales/ro.js.map +1 -0
  190. package/dist/shared/translations/locales/rs.d.ts +3 -0
  191. package/dist/shared/translations/locales/rs.js +99 -0
  192. package/dist/shared/translations/locales/rs.js.map +1 -0
  193. package/dist/shared/translations/locales/rsLatin.d.ts +3 -0
  194. package/dist/shared/translations/locales/rsLatin.js +99 -0
  195. package/dist/shared/translations/locales/rsLatin.js.map +1 -0
  196. package/dist/shared/translations/locales/ru.d.ts +3 -0
  197. package/dist/shared/translations/locales/ru.js +99 -0
  198. package/dist/shared/translations/locales/ru.js.map +1 -0
  199. package/dist/shared/translations/locales/sk.d.ts +3 -0
  200. package/dist/shared/translations/locales/sk.js +99 -0
  201. package/dist/shared/translations/locales/sk.js.map +1 -0
  202. package/dist/shared/translations/locales/sl.d.ts +3 -0
  203. package/dist/shared/translations/locales/sl.js +99 -0
  204. package/dist/shared/translations/locales/sl.js.map +1 -0
  205. package/dist/shared/translations/locales/sv.d.ts +3 -0
  206. package/dist/shared/translations/locales/sv.js +99 -0
  207. package/dist/shared/translations/locales/sv.js.map +1 -0
  208. package/dist/shared/translations/locales/ta.d.ts +3 -0
  209. package/dist/shared/translations/locales/ta.js +99 -0
  210. package/dist/shared/translations/locales/ta.js.map +1 -0
  211. package/dist/shared/translations/locales/th.d.ts +3 -0
  212. package/dist/shared/translations/locales/th.js +99 -0
  213. package/dist/shared/translations/locales/th.js.map +1 -0
  214. package/dist/shared/translations/locales/tr.d.ts +3 -0
  215. package/dist/shared/translations/locales/tr.js +99 -0
  216. package/dist/shared/translations/locales/tr.js.map +1 -0
  217. package/dist/shared/translations/locales/uk.d.ts +3 -0
  218. package/dist/shared/translations/locales/uk.js +99 -0
  219. package/dist/shared/translations/locales/uk.js.map +1 -0
  220. package/dist/shared/translations/locales/vi.d.ts +3 -0
  221. package/dist/shared/translations/locales/vi.js +99 -0
  222. package/dist/shared/translations/locales/vi.js.map +1 -0
  223. package/dist/shared/translations/locales/zh.d.ts +3 -0
  224. package/dist/shared/translations/locales/zh.js +99 -0
  225. package/dist/shared/translations/locales/zh.js.map +1 -0
  226. package/dist/shared/translations/locales/zhTw.d.ts +3 -0
  227. package/dist/shared/translations/locales/zhTw.js +99 -0
  228. package/dist/shared/translations/locales/zhTw.js.map +1 -0
  229. package/dist/shared/translations/types.d.ts +106 -0
  230. package/dist/shared/translations/types.js +1 -0
  231. package/dist/shared/types/index.d.ts +397 -0
  232. package/dist/shared/types/index.js +1 -0
  233. package/dist/{utils.d.ts → shared/utils.d.ts} +1 -0
  234. package/dist/shared/utils.js +13 -0
  235. package/dist/shared/utils.js.map +1 -0
  236. package/package.json +67 -56
  237. package/dist/bin/generateSpec.d.ts +0 -25
  238. package/dist/bin/generateSpec.js +0 -61
  239. package/dist/constants.d.ts +0 -1
  240. package/dist/constants.js +0 -2
  241. package/dist/endpoints/interactiveAuth.js +0 -27
  242. package/dist/endpoints/spec.d.ts +0 -5
  243. package/dist/endpoints/spec.js +0 -39
  244. package/dist/options.d.ts +0 -2
  245. package/dist/options.js +0 -45
  246. package/dist/spec/build.d.ts +0 -14
  247. package/dist/spec/build.js +0 -36
  248. package/dist/spec/buildDocument.d.ts +0 -15
  249. package/dist/spec/buildDocument.js +0 -268
  250. package/dist/spec/components.d.ts +0 -44
  251. package/dist/spec/components.js +0 -265
  252. package/dist/spec/downconvert.js +0 -74
  253. package/dist/spec/entitySchemas.d.ts +0 -15
  254. package/dist/spec/entitySchemas.js +0 -250
  255. package/dist/spec/fields.js +0 -44
  256. package/dist/spec/filters.d.ts +0 -11
  257. package/dist/spec/filters.js +0 -83
  258. package/dist/spec/names.js +0 -37
  259. package/dist/spec/params.d.ts +0 -55
  260. package/dist/spec/params.js +0 -436
  261. package/dist/spec/paths/auth.d.ts +0 -9
  262. package/dist/spec/paths/auth.js +0 -274
  263. package/dist/spec/paths/collections.d.ts +0 -9
  264. package/dist/spec/paths/collections.js +0 -278
  265. package/dist/spec/paths/custom.d.ts +0 -9
  266. package/dist/spec/paths/custom.js +0 -41
  267. package/dist/spec/paths/globals.d.ts +0 -9
  268. package/dist/spec/paths/globals.js +0 -78
  269. package/dist/spec/paths/jobs.d.ts +0 -7
  270. package/dist/spec/paths/jobs.js +0 -130
  271. package/dist/spec/paths/versions.d.ts +0 -19
  272. package/dist/spec/paths/versions.js +0 -252
  273. package/dist/spec/security.d.ts +0 -19
  274. package/dist/spec/security.js +0 -96
  275. package/dist/spec/tags.d.ts +0 -27
  276. package/dist/spec/tags.js +0 -79
  277. package/dist/translations/index.d.ts +0 -6
  278. package/dist/translations/locales/ar.d.ts +0 -2
  279. package/dist/translations/locales/ar.js +0 -81
  280. package/dist/translations/locales/az.d.ts +0 -2
  281. package/dist/translations/locales/az.js +0 -81
  282. package/dist/translations/locales/bg.d.ts +0 -2
  283. package/dist/translations/locales/bg.js +0 -81
  284. package/dist/translations/locales/bnBd.d.ts +0 -2
  285. package/dist/translations/locales/bnBd.js +0 -81
  286. package/dist/translations/locales/bnIn.d.ts +0 -2
  287. package/dist/translations/locales/bnIn.js +0 -81
  288. package/dist/translations/locales/ca.d.ts +0 -2
  289. package/dist/translations/locales/ca.js +0 -81
  290. package/dist/translations/locales/cs.d.ts +0 -2
  291. package/dist/translations/locales/cs.js +0 -81
  292. package/dist/translations/locales/da.d.ts +0 -2
  293. package/dist/translations/locales/da.js +0 -81
  294. package/dist/translations/locales/de.d.ts +0 -2
  295. package/dist/translations/locales/de.js +0 -81
  296. package/dist/translations/locales/en.d.ts +0 -2
  297. package/dist/translations/locales/en.js +0 -81
  298. package/dist/translations/locales/es.d.ts +0 -2
  299. package/dist/translations/locales/es.js +0 -81
  300. package/dist/translations/locales/et.d.ts +0 -2
  301. package/dist/translations/locales/et.js +0 -81
  302. package/dist/translations/locales/fa.d.ts +0 -2
  303. package/dist/translations/locales/fa.js +0 -81
  304. package/dist/translations/locales/fr.d.ts +0 -2
  305. package/dist/translations/locales/fr.js +0 -81
  306. package/dist/translations/locales/he.d.ts +0 -2
  307. package/dist/translations/locales/he.js +0 -81
  308. package/dist/translations/locales/hr.d.ts +0 -2
  309. package/dist/translations/locales/hr.js +0 -81
  310. package/dist/translations/locales/hu.d.ts +0 -2
  311. package/dist/translations/locales/hu.js +0 -81
  312. package/dist/translations/locales/hy.d.ts +0 -2
  313. package/dist/translations/locales/hy.js +0 -81
  314. package/dist/translations/locales/id.d.ts +0 -2
  315. package/dist/translations/locales/id.js +0 -81
  316. package/dist/translations/locales/is.d.ts +0 -2
  317. package/dist/translations/locales/is.js +0 -81
  318. package/dist/translations/locales/it.d.ts +0 -2
  319. package/dist/translations/locales/it.js +0 -81
  320. package/dist/translations/locales/ja.d.ts +0 -2
  321. package/dist/translations/locales/ja.js +0 -81
  322. package/dist/translations/locales/ko.d.ts +0 -2
  323. package/dist/translations/locales/ko.js +0 -81
  324. package/dist/translations/locales/lt.d.ts +0 -2
  325. package/dist/translations/locales/lt.js +0 -81
  326. package/dist/translations/locales/lv.d.ts +0 -2
  327. package/dist/translations/locales/lv.js +0 -81
  328. package/dist/translations/locales/my.d.ts +0 -2
  329. package/dist/translations/locales/my.js +0 -81
  330. package/dist/translations/locales/nb.d.ts +0 -2
  331. package/dist/translations/locales/nb.js +0 -81
  332. package/dist/translations/locales/nl.d.ts +0 -2
  333. package/dist/translations/locales/nl.js +0 -81
  334. package/dist/translations/locales/pl.d.ts +0 -2
  335. package/dist/translations/locales/pl.js +0 -81
  336. package/dist/translations/locales/pt.d.ts +0 -2
  337. package/dist/translations/locales/pt.js +0 -81
  338. package/dist/translations/locales/ro.d.ts +0 -2
  339. package/dist/translations/locales/ro.js +0 -81
  340. package/dist/translations/locales/rs.d.ts +0 -2
  341. package/dist/translations/locales/rs.js +0 -81
  342. package/dist/translations/locales/rsLatin.d.ts +0 -2
  343. package/dist/translations/locales/rsLatin.js +0 -81
  344. package/dist/translations/locales/ru.d.ts +0 -2
  345. package/dist/translations/locales/ru.js +0 -81
  346. package/dist/translations/locales/sk.d.ts +0 -2
  347. package/dist/translations/locales/sk.js +0 -81
  348. package/dist/translations/locales/sl.d.ts +0 -2
  349. package/dist/translations/locales/sl.js +0 -81
  350. package/dist/translations/locales/sv.d.ts +0 -2
  351. package/dist/translations/locales/sv.js +0 -81
  352. package/dist/translations/locales/ta.d.ts +0 -2
  353. package/dist/translations/locales/ta.js +0 -81
  354. package/dist/translations/locales/th.d.ts +0 -2
  355. package/dist/translations/locales/th.js +0 -81
  356. package/dist/translations/locales/tr.d.ts +0 -2
  357. package/dist/translations/locales/tr.js +0 -81
  358. package/dist/translations/locales/uk.d.ts +0 -2
  359. package/dist/translations/locales/uk.js +0 -81
  360. package/dist/translations/locales/vi.d.ts +0 -2
  361. package/dist/translations/locales/vi.js +0 -81
  362. package/dist/translations/locales/zh.d.ts +0 -2
  363. package/dist/translations/locales/zh.js +0 -81
  364. package/dist/translations/locales/zhTw.d.ts +0 -2
  365. package/dist/translations/locales/zhTw.js +0 -81
  366. package/dist/translations/types.d.ts +0 -87
  367. package/dist/translations/types.js +0 -1
  368. package/dist/types.d.ts +0 -192
  369. package/dist/types.js +0 -1
  370. package/dist/ui/createUiPlugin.d.ts +0 -14
  371. package/dist/ui/createUiPlugin.js +0 -28
  372. package/dist/ui/html.js +0 -8
  373. package/dist/ui/scalar.d.ts +0 -1
  374. package/dist/ui/scalar.js +0 -12
  375. package/dist/ui/swagger.d.ts +0 -1
  376. package/dist/ui/swagger.js +0 -12
  377. package/dist/utils.js +0 -13
@@ -1,274 +0,0 @@
1
- import { makeT } from "../../translations/index.js";
2
- import { ERRORS, errorResponses, jsonBody, jsonResponse, messageResponse } from "../components.js";
3
- import { refTo, schemaName } from "../names.js";
4
- import { authTagName } from "../tags.js";
5
- const identifierBody = (auth, extra = {})=>{
6
- const email = {
7
- type: 'string',
8
- format: 'email'
9
- };
10
- const username = {
11
- type: 'string'
12
- };
13
- const extraRequired = Object.keys(extra);
14
- const loginWithUsername = auth?.loginWithUsername;
15
- const base = {
16
- type: 'object',
17
- additionalProperties: false
18
- };
19
- if (!loginWithUsername) return {
20
- ...base,
21
- properties: {
22
- email,
23
- ...extra
24
- },
25
- required: [
26
- 'email',
27
- ...extraRequired
28
- ]
29
- };
30
- if ('object' == typeof loginWithUsername && loginWithUsername.allowEmailLogin) return {
31
- ...base,
32
- properties: {
33
- email,
34
- username,
35
- ...extra
36
- },
37
- ...extraRequired.length > 0 ? {
38
- required: extraRequired
39
- } : {},
40
- anyOf: [
41
- {
42
- required: [
43
- 'email'
44
- ]
45
- },
46
- {
47
- required: [
48
- 'username'
49
- ]
50
- }
51
- ]
52
- };
53
- return {
54
- ...base,
55
- properties: {
56
- username,
57
- ...extra
58
- },
59
- required: [
60
- 'username',
61
- ...extraRequired
62
- ]
63
- };
64
- };
65
- const buildAuthPaths = ({ collection, ctx, includeAdmin, nestedTags })=>{
66
- const auth = collection.auth;
67
- if (!auth || auth.disableLocalStrategy) return {};
68
- const t = makeT(ctx.i18n);
69
- const name = schemaName(collection.slug);
70
- const base = `${ctx.apiRoute}/${collection.slug}`;
71
- const tag = [
72
- nestedTags ? authTagName(name) : name
73
- ];
74
- const userRef = {
75
- $ref: refTo(name)
76
- };
77
- const op = (operationId, codes, extra)=>({
78
- tags: tag,
79
- operationId,
80
- ...extra,
81
- responses: {
82
- ...extra.responses,
83
- ...errorResponses(codes, t)
84
- }
85
- });
86
- const paths = {
87
- [`${base}/login`]: {
88
- post: op(`login${name}`, ERRORS.login, {
89
- requestBody: jsonBody(identifierBody(auth, {
90
- password: {
91
- type: 'string'
92
- }
93
- })),
94
- responses: {
95
- 200: jsonResponse(t('authLogin'), {
96
- type: 'object',
97
- properties: {
98
- message: {
99
- type: 'string'
100
- },
101
- user: userRef,
102
- token: {
103
- type: 'string'
104
- },
105
- exp: {
106
- type: 'integer'
107
- }
108
- }
109
- })
110
- }
111
- })
112
- },
113
- [`${base}/logout`]: {
114
- post: op(`logout${name}`, ERRORS.session, {
115
- responses: messageResponse(t('authLogout'))
116
- })
117
- },
118
- [`${base}/me`]: {
119
- get: op(`me${name}`, ERRORS.session, {
120
- responses: {
121
- 200: jsonResponse(t('authMe'), {
122
- type: 'object',
123
- properties: {
124
- user: userRef,
125
- collection: {
126
- type: 'string'
127
- },
128
- token: {
129
- type: 'string'
130
- },
131
- exp: {
132
- type: 'integer'
133
- }
134
- }
135
- })
136
- }
137
- })
138
- },
139
- [`${base}/refresh-token`]: {
140
- post: op(`refreshToken${name}`, ERRORS.session, {
141
- responses: {
142
- 200: jsonResponse(t('authRefreshToken'), {
143
- type: 'object',
144
- properties: {
145
- message: {
146
- type: 'string'
147
- },
148
- refreshedToken: {
149
- type: 'string'
150
- },
151
- exp: {
152
- type: 'integer'
153
- },
154
- user: userRef
155
- }
156
- })
157
- }
158
- })
159
- },
160
- [`${base}/forgot-password`]: {
161
- post: op(`forgotPassword${name}`, ERRORS.authAction, {
162
- requestBody: jsonBody(identifierBody(auth)),
163
- responses: messageResponse(t('authForgotPassword'))
164
- })
165
- },
166
- [`${base}/reset-password`]: {
167
- post: op(`resetPassword${name}`, ERRORS.authAction, {
168
- requestBody: jsonBody({
169
- type: 'object',
170
- additionalProperties: false,
171
- properties: {
172
- token: {
173
- type: 'string'
174
- },
175
- password: {
176
- type: 'string'
177
- }
178
- },
179
- required: [
180
- 'token',
181
- 'password'
182
- ]
183
- }),
184
- responses: {
185
- 200: jsonResponse(t('authResetPassword'), {
186
- type: 'object',
187
- properties: {
188
- message: {
189
- type: 'string'
190
- },
191
- token: {
192
- type: 'string'
193
- },
194
- user: userRef
195
- }
196
- })
197
- }
198
- })
199
- }
200
- };
201
- if (includeAdmin) {
202
- paths[`${base}/first-register`] = {
203
- post: op(`firstRegister${name}`, ERRORS.create, {
204
- requestBody: jsonBody({
205
- $ref: refTo(`${name}Create`)
206
- }),
207
- responses: {
208
- 200: jsonResponse(t('authFirstRegister'), {
209
- type: 'object',
210
- properties: {
211
- message: {
212
- type: 'string'
213
- },
214
- user: userRef,
215
- token: {
216
- type: 'string'
217
- },
218
- exp: {
219
- type: 'integer'
220
- }
221
- }
222
- })
223
- }
224
- })
225
- };
226
- paths[`${base}/init`] = {
227
- get: op(`init${name}`, ERRORS.session, {
228
- responses: {
229
- 200: jsonResponse(t('authInit'), {
230
- type: 'object',
231
- properties: {
232
- initialized: {
233
- type: 'boolean'
234
- }
235
- }
236
- })
237
- }
238
- })
239
- };
240
- paths[`${base}/access`] = {
241
- get: op(`access${name}`, ERRORS.session, {
242
- responses: {
243
- 200: jsonResponse(t('authAccess'), {
244
- type: 'object',
245
- additionalProperties: true
246
- })
247
- }
248
- })
249
- };
250
- }
251
- paths[`${base}/unlock`] = {
252
- post: op(`unlock${name}`, ERRORS.authAction, {
253
- requestBody: jsonBody(identifierBody(auth)),
254
- responses: messageResponse(t('authUnlock'))
255
- })
256
- };
257
- if (auth.verify) paths[`${base}/verify/{id}`] = {
258
- post: op(`verify${name}`, ERRORS.authAction, {
259
- parameters: [
260
- {
261
- name: 'id',
262
- in: 'path',
263
- required: true,
264
- schema: {
265
- type: 'string'
266
- }
267
- }
268
- ],
269
- responses: messageResponse(t('authVerify'))
270
- })
271
- };
272
- return paths;
273
- };
274
- export { buildAuthPaths };
@@ -1,9 +0,0 @@
1
- import type { SanitizedCollectionConfig } from 'payload';
2
- import type { PathsObject } from '@scalar/openapi-types/3.2';
3
- import type { BuildContext } from '../../types.js';
4
- import type { EntitySecurity } from '../security.js';
5
- export declare const buildCollectionPaths: ({ collection, ctx, security, }: {
6
- collection: SanitizedCollectionConfig;
7
- ctx: BuildContext;
8
- security?: EntitySecurity;
9
- }) => PathsObject;
@@ -1,278 +0,0 @@
1
- import { makeT } from "../../translations/index.js";
2
- import { ERRORS, errorResponses, jsonOk, jsonResponse, uploadRequestBody } from "../components.js";
3
- import { createSchemaName, listSchemaName, refTo, schemaName, updateSchemaName } from "../names.js";
4
- import { buildListParams, buildParamSchemas, commonReadParams, writeParams } from "../params.js";
5
- const buildCollectionPaths = ({ collection, ctx, security = {} })=>{
6
- const t = makeT(ctx.i18n);
7
- const name = schemaName(collection.slug);
8
- const base = `${ctx.apiRoute}/${collection.slug}`;
9
- const docRef = {
10
- $ref: refTo(name)
11
- };
12
- const listRef = {
13
- $ref: refTo(listSchemaName(name))
14
- };
15
- const createRef = {
16
- $ref: refTo(createSchemaName(name))
17
- };
18
- const updateRef = {
19
- $ref: refTo(updateSchemaName(name))
20
- };
21
- const idType = 'number' === ctx.defaultIDType ? 'integer' : 'string';
22
- const { read: secRead, create: secCreate, update: secUpdate, delete: secDelete } = security;
23
- const allowBulk = true !== collection.disableBulkEdit;
24
- const allowDuplicate = true !== collection.disableDuplicate;
25
- const paramSchemas = buildParamSchemas({
26
- fields: collection.fields,
27
- ctx
28
- });
29
- const refs = {
30
- select: true,
31
- populate: Boolean(paramSchemas.populate),
32
- joins: Boolean(paramSchemas.joins)
33
- };
34
- const isUpload = Boolean(collection.upload);
35
- const fileRequiredOnCreate = 'object' == typeof collection.upload ? false !== collection.upload.filesRequiredOnCreate : true;
36
- const requestBody = (ref, fileRequired)=>isUpload ? uploadRequestBody({
37
- bodyRef: ref,
38
- fileRequired,
39
- t
40
- }) : {
41
- content: {
42
- 'application/json': {
43
- schema: ref
44
- }
45
- }
46
- };
47
- const mutationSchema = {
48
- type: 'object',
49
- properties: {
50
- message: {
51
- type: 'string'
52
- },
53
- doc: docRef
54
- }
55
- };
56
- const listResponse = {
57
- ...jsonOk(t('collectionList'), listRef),
58
- ...errorResponses(ERRORS.list, t)
59
- };
60
- const findByIdResponse = {
61
- ...jsonOk(t('collectionDoc'), docRef),
62
- ...errorResponses(ERRORS.read, t)
63
- };
64
- const createResponse = {
65
- 201: jsonResponse(t('collectionCreated'), mutationSchema),
66
- ...errorResponses(ERRORS.create, t)
67
- };
68
- const updateResponse = {
69
- ...jsonOk(t('collectionUpdated'), mutationSchema),
70
- ...errorResponses(ERRORS.update, t)
71
- };
72
- const deleteResponse = {
73
- ...jsonOk(t('collectionDeleted'), mutationSchema),
74
- ...errorResponses(ERRORS["delete"], t)
75
- };
76
- const bulkSchema = {
77
- type: 'object',
78
- properties: {
79
- message: {
80
- type: 'string'
81
- },
82
- docs: {
83
- type: 'array',
84
- items: docRef
85
- },
86
- errors: {
87
- type: 'array',
88
- items: {
89
- type: 'object',
90
- properties: {
91
- message: {
92
- type: 'string'
93
- },
94
- id: {
95
- type: idType
96
- }
97
- }
98
- }
99
- }
100
- }
101
- };
102
- const bulkUpdateResponse = {
103
- ...jsonOk(t('collectionBulkUpdate'), bulkSchema),
104
- ...errorResponses(ERRORS.update, t)
105
- };
106
- const bulkDeleteResponse = {
107
- ...jsonOk(t('collectionBulkDelete'), bulkSchema),
108
- ...errorResponses(ERRORS["delete"], t)
109
- };
110
- const countResponse = {
111
- ...jsonOk(t('collectionCount'), {
112
- type: 'object',
113
- properties: {
114
- totalDocs: {
115
- type: 'integer'
116
- }
117
- }
118
- }),
119
- ...errorResponses(ERRORS.list, t)
120
- };
121
- const listParams = buildListParams({
122
- base: name,
123
- fields: collection.fields,
124
- ctx,
125
- refs
126
- });
127
- const bulkParams = listParams.filter((p)=>'where' === p.name);
128
- const bulkUpdateParams = listParams.filter((p)=>[
129
- 'limit',
130
- 'sort',
131
- 'where'
132
- ].includes(p.name));
133
- const write = (operation)=>writeParams({
134
- base: name,
135
- entity: collection,
136
- ctx,
137
- refs,
138
- operation
139
- });
140
- const deleteParams = write('delete');
141
- const bulkOps = allowBulk ? {
142
- patch: {
143
- tags: [
144
- name
145
- ],
146
- operationId: `update${name}`,
147
- parameters: [
148
- ...bulkUpdateParams,
149
- ...write('update')
150
- ],
151
- requestBody: requestBody(updateRef, false),
152
- responses: bulkUpdateResponse,
153
- security: secUpdate
154
- },
155
- delete: {
156
- tags: [
157
- name
158
- ],
159
- operationId: `delete${name}`,
160
- parameters: [
161
- ...bulkParams,
162
- ...deleteParams
163
- ],
164
- responses: bulkDeleteResponse,
165
- security: secDelete
166
- }
167
- } : {};
168
- const paths = {
169
- [base]: {
170
- get: {
171
- tags: [
172
- name
173
- ],
174
- operationId: `find${name}`,
175
- parameters: buildListParams({
176
- base: name,
177
- fields: collection.fields,
178
- ctx,
179
- refs
180
- }),
181
- responses: listResponse,
182
- security: secRead
183
- },
184
- post: {
185
- tags: [
186
- name
187
- ],
188
- operationId: `create${name}`,
189
- parameters: write('create'),
190
- requestBody: requestBody(createRef, fileRequiredOnCreate),
191
- responses: createResponse,
192
- security: secCreate
193
- },
194
- ...bulkOps
195
- },
196
- [`${base}/count`]: {
197
- get: {
198
- tags: [
199
- name
200
- ],
201
- operationId: `count${name}`,
202
- parameters: bulkParams,
203
- responses: countResponse,
204
- security: secRead
205
- }
206
- },
207
- [`${base}/{id}`]: {
208
- parameters: [
209
- {
210
- name: 'id',
211
- in: 'path',
212
- required: true,
213
- schema: {
214
- type: idType
215
- }
216
- }
217
- ],
218
- get: {
219
- tags: [
220
- name
221
- ],
222
- operationId: `find${name}ById`,
223
- parameters: commonReadParams({
224
- base: name,
225
- ctx,
226
- refs
227
- }),
228
- responses: findByIdResponse,
229
- security: secRead
230
- },
231
- patch: {
232
- tags: [
233
- name
234
- ],
235
- operationId: `update${name}ById`,
236
- parameters: write('updateByID'),
237
- requestBody: requestBody(updateRef, false),
238
- responses: updateResponse,
239
- security: secUpdate
240
- },
241
- delete: {
242
- tags: [
243
- name
244
- ],
245
- operationId: `delete${name}ById`,
246
- parameters: deleteParams,
247
- responses: deleteResponse,
248
- security: secDelete
249
- }
250
- }
251
- };
252
- if (allowDuplicate) paths[`${base}/{id}/duplicate`] = {
253
- parameters: [
254
- {
255
- name: 'id',
256
- in: 'path',
257
- required: true,
258
- schema: {
259
- type: idType
260
- }
261
- }
262
- ],
263
- post: {
264
- tags: [
265
- name
266
- ],
267
- operationId: `duplicate${name}`,
268
- parameters: write('duplicate'),
269
- responses: {
270
- ...jsonOk(t('collectionDuplicated'), mutationSchema),
271
- ...errorResponses(ERRORS.create, t)
272
- },
273
- security: secCreate
274
- }
275
- };
276
- return paths;
277
- };
278
- export { buildCollectionPaths };
@@ -1,9 +0,0 @@
1
- import type { SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload';
2
- import type { PathsObject } from '@scalar/openapi-types/3.2';
3
- import type { BuildContext } from '../../types.js';
4
- export declare const buildCustomEndpointPaths: ({ config, collections, globals, ctx, }: {
5
- config: SanitizedConfig;
6
- collections: SanitizedCollectionConfig[];
7
- globals: SanitizedGlobalConfig[];
8
- ctx: BuildContext;
9
- }) => PathsObject;
@@ -1,41 +0,0 @@
1
- const getOpenapiMeta = (endpoint)=>{
2
- const meta = endpoint.custom?.openapi;
3
- return meta && 'object' == typeof meta ? meta : void 0;
4
- };
5
- const normalizePath = (prefix, path)=>{
6
- const joined = `${prefix}${path.startsWith('/') ? path : `/${path}`}`;
7
- return joined.replace(/:([A-Za-z0-9_]+)/g, '{$1}');
8
- };
9
- const collect = ({ endpoints, prefix, out })=>{
10
- if (!endpoints) return;
11
- for (const endpoint of endpoints){
12
- const meta = getOpenapiMeta(endpoint);
13
- if (!meta) continue;
14
- const path = normalizePath(prefix, endpoint.path);
15
- const method = endpoint.method.toLowerCase();
16
- out[path] = {
17
- ...out[path],
18
- [method]: meta
19
- };
20
- }
21
- };
22
- const buildCustomEndpointPaths = ({ config, collections, globals, ctx })=>{
23
- const out = {};
24
- collect({
25
- endpoints: config.endpoints,
26
- prefix: '',
27
- out
28
- });
29
- for (const collection of collections)collect({
30
- endpoints: collection.endpoints,
31
- prefix: `${ctx.apiRoute}/${collection.slug}`,
32
- out
33
- });
34
- for (const global of globals)collect({
35
- endpoints: global.endpoints,
36
- prefix: `${ctx.apiRoute}/globals/${global.slug}`,
37
- out
38
- });
39
- return out;
40
- };
41
- export { buildCustomEndpointPaths };
@@ -1,9 +0,0 @@
1
- import type { SanitizedGlobalConfig } from 'payload';
2
- import type { PathsObject } from '@scalar/openapi-types/3.2';
3
- import type { BuildContext } from '../../types.js';
4
- import type { EntitySecurity } from '../security.js';
5
- export declare const buildGlobalPaths: ({ global, ctx, security, }: {
6
- global: SanitizedGlobalConfig;
7
- ctx: BuildContext;
8
- security?: EntitySecurity;
9
- }) => PathsObject;
@@ -1,78 +0,0 @@
1
- import { makeT } from "../../translations/index.js";
2
- import { ERRORS, errorResponses, jsonOk } from "../components.js";
3
- import { globalSchemaName, refTo, updateSchemaName } from "../names.js";
4
- import { buildParamSchemas, commonReadParams, writeParams } from "../params.js";
5
- const buildGlobalPaths = ({ global, ctx, security = {} })=>{
6
- const t = makeT(ctx.i18n);
7
- const name = globalSchemaName(global.slug);
8
- const docRef = {
9
- $ref: refTo(name)
10
- };
11
- const updateRef = {
12
- $ref: refTo(updateSchemaName(name))
13
- };
14
- const { read: secRead, update: secUpdate } = security;
15
- const paramSchemas = buildParamSchemas({
16
- fields: global.fields,
17
- ctx
18
- });
19
- const refs = {
20
- select: true,
21
- populate: Boolean(paramSchemas.populate),
22
- joins: Boolean(paramSchemas.joins)
23
- };
24
- return {
25
- [`${ctx.apiRoute}/globals/${global.slug}`]: {
26
- get: {
27
- tags: [
28
- name
29
- ],
30
- operationId: `find${name}`,
31
- parameters: commonReadParams({
32
- base: name,
33
- ctx,
34
- refs
35
- }),
36
- responses: {
37
- ...jsonOk(t('globalDoc'), docRef),
38
- ...errorResponses(ERRORS.globalRead, t)
39
- },
40
- security: secRead
41
- },
42
- post: {
43
- tags: [
44
- name
45
- ],
46
- operationId: `update${name}`,
47
- parameters: writeParams({
48
- base: name,
49
- entity: global,
50
- ctx,
51
- refs,
52
- operation: 'globalUpdate'
53
- }),
54
- requestBody: {
55
- content: {
56
- 'application/json': {
57
- schema: updateRef
58
- }
59
- }
60
- },
61
- responses: {
62
- ...jsonOk(t('globalDoc'), {
63
- type: 'object',
64
- properties: {
65
- message: {
66
- type: 'string'
67
- },
68
- result: docRef
69
- }
70
- }),
71
- ...errorResponses(ERRORS.globalUpdate, t)
72
- },
73
- security: secUpdate
74
- }
75
- }
76
- };
77
- };
78
- export { buildGlobalPaths };