@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,7 +0,0 @@
1
- import type { SanitizedConfig } from 'payload';
2
- import type { PathsObject } from '@scalar/openapi-types/3.2';
3
- import type { BuildContext } from '../../types.js';
4
- export declare const buildJobsPaths: ({ config, ctx }: {
5
- config: SanitizedConfig;
6
- ctx: BuildContext;
7
- }) => PathsObject;
@@ -1,130 +0,0 @@
1
- import { makeT } from "../../translations/index.js";
2
- import { errorResponses, jsonResponse } from "../components.js";
3
- const boolParam = (name, description)=>({
4
- name,
5
- in: 'query',
6
- description,
7
- schema: {
8
- type: 'boolean'
9
- }
10
- });
11
- const collectQueues = (jobs)=>{
12
- const queues = new Set([
13
- 'default'
14
- ]);
15
- const add = (q)=>{
16
- if ('string' == typeof q && q) queues.add(q);
17
- };
18
- const fromSchedules = (items)=>{
19
- if (!Array.isArray(items)) return;
20
- for (const item of items)for (const s of item.schedule ?? [])add(s.queue);
21
- };
22
- fromSchedules(jobs?.tasks);
23
- fromSchedules(jobs?.workflows);
24
- const autoRun = jobs?.autoRun;
25
- if (Array.isArray(autoRun)) for (const cron of autoRun)add(cron.queue);
26
- const processingOrder = jobs?.processingOrder;
27
- if (processingOrder?.queues) for (const name of Object.keys(processingOrder.queues))add(name);
28
- return [
29
- ...queues
30
- ].toSorted();
31
- };
32
- const queueParam = (queues, ctx)=>({
33
- name: 'queue',
34
- in: 'query',
35
- description: makeT(ctx.i18n)('jobsQueue', {
36
- queues: queues.map((q)=>`\`${q}\``).join(', ')
37
- }),
38
- schema: {
39
- type: 'string',
40
- enum: queues
41
- }
42
- });
43
- const buildJobsPaths = ({ config, ctx })=>{
44
- const jobs = config.jobs;
45
- const hasJobs = Boolean(jobs?.tasks?.length || jobs?.workflows?.length);
46
- if (!hasJobs) return {};
47
- const t = makeT(ctx.i18n);
48
- const queue = queueParam(collectQueues(jobs), ctx);
49
- const errors = errorResponses([
50
- '401',
51
- '403',
52
- '500'
53
- ], t);
54
- return {
55
- [`${ctx.apiRoute}/payload-jobs/run`]: {
56
- get: {
57
- tags: [
58
- 'Jobs'
59
- ],
60
- operationId: 'runJobs',
61
- summary: t('jobsRunSummary'),
62
- parameters: [
63
- queue,
64
- boolParam('allQueues', t('jobsRunAllQueues')),
65
- {
66
- name: 'limit',
67
- in: 'query',
68
- description: t('jobsLimit'),
69
- schema: {
70
- type: 'integer'
71
- }
72
- },
73
- boolParam('disableScheduling', t('jobsDisableScheduling')),
74
- boolParam('silent', t('jobsSilent'))
75
- ],
76
- responses: {
77
- 200: jsonResponse(t('jobsRunResult'), {
78
- type: 'object',
79
- properties: {
80
- message: {
81
- type: 'string'
82
- },
83
- noJobsRemaining: {
84
- type: 'boolean'
85
- },
86
- remainingJobsFromQueried: {
87
- type: 'integer'
88
- }
89
- }
90
- }),
91
- ...errors
92
- }
93
- }
94
- },
95
- [`${ctx.apiRoute}/payload-jobs/handle-schedules`]: {
96
- get: {
97
- tags: [
98
- 'Jobs'
99
- ],
100
- operationId: 'handleJobSchedules',
101
- summary: t('jobsSchedulesSummary'),
102
- parameters: [
103
- queue,
104
- boolParam('allQueues', t('jobsSchedulesAllQueues'))
105
- ],
106
- responses: {
107
- 200: jsonResponse(t('jobsSchedulesResult'), {
108
- type: 'object',
109
- properties: {
110
- message: {
111
- type: 'string'
112
- },
113
- queued: {
114
- type: 'integer'
115
- },
116
- errored: {
117
- type: 'integer'
118
- },
119
- skipped: {
120
- type: 'integer'
121
- }
122
- }
123
- }),
124
- ...errors
125
- }
126
- }
127
- }
128
- };
129
- };
130
- export { buildJobsPaths };
@@ -1,19 +0,0 @@
1
- import type { PathsObject, SchemaObject } from '@scalar/openapi-types/3.2';
2
- import type { BuildContext, Entity, IDType } from '../../types.js';
3
- export interface VersionSchemas {
4
- version: SchemaObject;
5
- versionList: SchemaObject;
6
- }
7
- export declare const versionComponentSchemas: ({ docBase, base, idType, }: {
8
- docBase: string;
9
- base: string;
10
- idType: IDType;
11
- }) => VersionSchemas;
12
- export declare const buildVersionPaths: ({ entity, pathBase, ctx, schemaBase, nestedTags, global, }: {
13
- entity: Entity;
14
- pathBase: string;
15
- ctx: BuildContext;
16
- schemaBase?: string;
17
- nestedTags: boolean;
18
- global?: boolean;
19
- }) => PathsObject;
@@ -1,252 +0,0 @@
1
- import { makeT } from "../../translations/index.js";
2
- import { ERRORS, errorResponses, jsonResponse, nullableType } from "../components.js";
3
- import { refTo, schemaName } from "../names.js";
4
- import { buildParamSchemas, commonReadParams } from "../params.js";
5
- import { versionsTagName } from "../tags.js";
6
- const buildVersionSchema = (base, idType)=>{
7
- const id = {
8
- type: 'number' === idType ? 'integer' : 'string'
9
- };
10
- return {
11
- type: 'object',
12
- properties: {
13
- id,
14
- parent: id,
15
- version: {
16
- $ref: refTo(base)
17
- },
18
- createdAt: {
19
- type: 'string',
20
- format: 'date-time'
21
- },
22
- updatedAt: {
23
- type: 'string',
24
- format: 'date-time'
25
- },
26
- latest: {
27
- type: 'boolean'
28
- },
29
- autosave: {
30
- type: 'boolean'
31
- },
32
- snapshot: {
33
- type: 'boolean'
34
- },
35
- publishedLocale: {
36
- type: 'string'
37
- }
38
- },
39
- required: [
40
- 'id',
41
- 'parent',
42
- 'version',
43
- 'createdAt',
44
- 'updatedAt'
45
- ]
46
- };
47
- };
48
- const buildVersionListSchema = (base)=>({
49
- type: 'object',
50
- properties: {
51
- docs: {
52
- type: 'array',
53
- items: {
54
- $ref: refTo(`${base}Version`)
55
- }
56
- },
57
- totalDocs: {
58
- type: 'integer'
59
- },
60
- limit: {
61
- type: 'integer'
62
- },
63
- totalPages: {
64
- type: 'integer'
65
- },
66
- page: {
67
- type: 'integer'
68
- },
69
- pagingCounter: {
70
- type: 'integer'
71
- },
72
- hasPrevPage: {
73
- type: 'boolean'
74
- },
75
- hasNextPage: {
76
- type: 'boolean'
77
- },
78
- prevPage: nullableType('integer'),
79
- nextPage: nullableType('integer')
80
- }
81
- });
82
- const versionComponentSchemas = ({ docBase, base, idType })=>({
83
- version: buildVersionSchema(docBase, idType),
84
- versionList: buildVersionListSchema(base)
85
- });
86
- const versionRef = (base)=>({
87
- $ref: refTo(`${base}Version`)
88
- });
89
- const versionListRef = (base)=>({
90
- $ref: refTo(`${base}VersionList`)
91
- });
92
- const listVersionParams = ({ base, ctx, refs })=>{
93
- const t = makeT(ctx.i18n);
94
- return [
95
- {
96
- name: 'page',
97
- in: 'query',
98
- schema: {
99
- type: 'integer'
100
- }
101
- },
102
- {
103
- name: 'limit',
104
- in: 'query',
105
- schema: {
106
- type: 'integer'
107
- }
108
- },
109
- {
110
- name: 'pagination',
111
- in: 'query',
112
- schema: {
113
- type: 'boolean'
114
- }
115
- },
116
- {
117
- name: 'sort',
118
- in: 'query',
119
- description: t('paramSortShort'),
120
- schema: {
121
- type: 'string'
122
- }
123
- },
124
- ...commonReadParams({
125
- base,
126
- ctx,
127
- refs
128
- }),
129
- {
130
- name: 'where',
131
- in: 'query',
132
- description: t('versionWhere'),
133
- content: {
134
- 'application/json': {
135
- schema: {
136
- type: 'object',
137
- additionalProperties: true
138
- }
139
- }
140
- }
141
- }
142
- ];
143
- };
144
- const buildVersionPaths = ({ entity, pathBase, ctx, schemaBase, nestedTags, global = false })=>{
145
- if (!entity.versions) return {};
146
- const t = makeT(ctx.i18n);
147
- const name = schemaBase ?? schemaName(entity.slug);
148
- const versionsTag = [
149
- nestedTags ? versionsTagName(name) : name
150
- ];
151
- const paramSchemas = buildParamSchemas({
152
- fields: entity.fields,
153
- ctx
154
- });
155
- const refs = {
156
- select: true,
157
- populate: Boolean(paramSchemas.populate),
158
- joins: Boolean(paramSchemas.joins)
159
- };
160
- const idParam = {
161
- name: 'id',
162
- in: 'path',
163
- required: true,
164
- schema: {
165
- type: 'number' === ctx.defaultIDType ? 'integer' : 'string'
166
- }
167
- };
168
- const message = {
169
- type: 'string'
170
- };
171
- const restoreResponse = global ? {
172
- type: 'object',
173
- properties: {
174
- message,
175
- doc: {
176
- $ref: refTo(name)
177
- }
178
- }
179
- } : {
180
- allOf: [
181
- {
182
- $ref: refTo(name)
183
- },
184
- {
185
- type: 'object',
186
- properties: {
187
- message
188
- }
189
- }
190
- ]
191
- };
192
- return {
193
- [`${pathBase}/versions`]: {
194
- get: {
195
- tags: versionsTag,
196
- operationId: `find${name}Versions`,
197
- parameters: listVersionParams({
198
- base: name,
199
- ctx,
200
- refs
201
- }),
202
- responses: {
203
- 200: jsonResponse(t('versionList'), versionListRef(name)),
204
- ...errorResponses(ERRORS.versionList, t)
205
- }
206
- }
207
- },
208
- [`${pathBase}/versions/{id}`]: {
209
- parameters: [
210
- idParam
211
- ],
212
- get: {
213
- tags: versionsTag,
214
- operationId: `find${name}VersionById`,
215
- parameters: commonReadParams({
216
- base: name,
217
- ctx,
218
- refs
219
- }),
220
- responses: {
221
- 200: jsonResponse(t('versionSingle'), versionRef(name)),
222
- ...errorResponses(ERRORS.versionRead, t)
223
- }
224
- },
225
- post: {
226
- tags: versionsTag,
227
- operationId: `restore${name}Version`,
228
- parameters: [
229
- {
230
- name: 'depth',
231
- in: 'query',
232
- schema: {
233
- type: 'integer'
234
- }
235
- },
236
- {
237
- name: 'draft',
238
- in: 'query',
239
- schema: {
240
- type: 'boolean'
241
- }
242
- }
243
- ],
244
- responses: {
245
- 200: jsonResponse(t('versionRestored'), restoreResponse),
246
- ...errorResponses(ERRORS.versionRestore, t)
247
- }
248
- }
249
- }
250
- };
251
- };
252
- export { buildVersionPaths, versionComponentSchemas };
@@ -1,19 +0,0 @@
1
- import type { Access } from 'payload';
2
- import type { PathsObject, SecurityRequirementObject } from '@scalar/openapi-types/3.2';
3
- import type { Entity, EntityKind, EntityOperation, OperationContext } from '../types.js';
4
- export type EntitySecurity = Partial<Record<EntityOperation, SecurityRequirementObject[] | undefined>>;
5
- export declare const evaluateAccess: (access: Access | undefined, opts?: {
6
- locale?: string;
7
- timeoutMs?: number;
8
- }) => Promise<boolean>;
9
- export declare const resolveEntitySecurity: ({ entity, operations, locale, }: {
10
- entity: Entity;
11
- operations: EntityOperation[];
12
- locale?: string;
13
- }) => Promise<EntitySecurity>;
14
- export declare const applySecurityWhen: ({ paths, slug, kind, securityWhen, }: {
15
- paths: PathsObject;
16
- slug: string;
17
- kind: EntityKind;
18
- securityWhen?: (ctx: OperationContext) => boolean | undefined;
19
- }) => PathsObject;
@@ -1,96 +0,0 @@
1
- import { SECURITY_SCHEME_NAME } from "./components.js";
2
- const HTTP_METHODS = [
3
- 'get',
4
- 'post',
5
- 'patch',
6
- 'put',
7
- 'delete'
8
- ];
9
- const securedRequirement = ()=>[
10
- {
11
- [SECURITY_SCHEME_NAME]: []
12
- }
13
- ];
14
- const withTimeout = async (promise, timeoutMs)=>{
15
- let timer;
16
- const guard = new Promise((resolve)=>{
17
- timer = setTimeout(()=>resolve(false), timeoutMs);
18
- });
19
- try {
20
- return await Promise.race([
21
- promise.then((value)=>true === value, ()=>false),
22
- guard
23
- ]);
24
- } finally{
25
- if (timer) clearTimeout(timer);
26
- }
27
- };
28
- const evaluateAccess = async (access, opts = {})=>{
29
- if (!access) return false;
30
- const { locale, timeoutMs = 250 } = opts;
31
- const payloadTrap = new Proxy({}, {
32
- get () {
33
- throw new Error('req.payload accessed during build');
34
- }
35
- });
36
- const req = {
37
- user: null,
38
- headers: new Headers(),
39
- context: {},
40
- locale,
41
- payload: payloadTrap
42
- };
43
- try {
44
- const result = access({
45
- req
46
- });
47
- if (result && 'function' == typeof result.then) return await withTimeout(result, timeoutMs);
48
- return true === result;
49
- } catch {
50
- return false;
51
- }
52
- };
53
- const readSecurityOverride = (entity)=>{
54
- const meta = entity.custom?.openapi?.security;
55
- if ('boolean' == typeof meta) return meta;
56
- if (meta && 'object' == typeof meta) return meta;
57
- };
58
- const overrideFor = (override, op)=>{
59
- if (void 0 === override) return;
60
- if ('boolean' == typeof override) return override;
61
- return override[op];
62
- };
63
- const resolveEntitySecurity = async ({ entity, operations, locale })=>{
64
- const override = readSecurityOverride(entity);
65
- const access = entity.access;
66
- const out = {};
67
- for (const op of operations){
68
- const declared = overrideFor(override, op);
69
- const isPublic = declared ?? await evaluateAccess(access?.[op], {
70
- locale
71
- });
72
- out[op] = isPublic ? void 0 : securedRequirement();
73
- }
74
- return out;
75
- };
76
- const applySecurityWhen = ({ paths, slug, kind, securityWhen })=>{
77
- if (!securityWhen) return paths;
78
- for (const [path, item] of Object.entries(paths)){
79
- if (!item) continue;
80
- const ops = item;
81
- for (const method of HTTP_METHODS){
82
- const op = ops[method];
83
- if (!op) continue;
84
- const decision = securityWhen({
85
- method,
86
- path,
87
- slug,
88
- kind
89
- });
90
- if (true === decision) delete op.security;
91
- else if (false === decision) op.security = securedRequirement();
92
- }
93
- }
94
- return paths;
95
- };
96
- export { applySecurityWhen, evaluateAccess, resolveEntitySecurity };
@@ -1,27 +0,0 @@
1
- import type { TagObject } from '@scalar/openapi-types/3.2';
2
- import type { Translate } from '../translations/types.js';
3
- export declare const NAV_COLLECTIONS = "Collections";
4
- export declare const NAV_GLOBALS = "Globals";
5
- export declare const NAV_SYSTEM = "System";
6
- export declare const entityTagName: (base: string) => string;
7
- export declare const authTagName: (base: string) => string;
8
- export declare const versionsTagName: (base: string) => string;
9
- export interface CollectionTagInfo {
10
- base: string;
11
- hasAuth: boolean;
12
- hasVersions: boolean;
13
- description?: string;
14
- }
15
- export interface GlobalTagInfo {
16
- base: string;
17
- hasVersions: boolean;
18
- description?: string;
19
- }
20
- export interface TagHierarchyInput {
21
- collections: CollectionTagInfo[];
22
- globals: GlobalTagInfo[];
23
- hasJobs: boolean;
24
- t: Translate;
25
- nested: boolean;
26
- }
27
- export declare const buildTagHierarchy: ({ collections, globals, hasJobs, t, nested }: TagHierarchyInput) => TagObject[];
package/dist/spec/tags.js DELETED
@@ -1,79 +0,0 @@
1
- const NAV_COLLECTIONS = 'Collections';
2
- const NAV_GLOBALS = 'Globals';
3
- const NAV_SYSTEM = 'System';
4
- const entityTagName = (base)=>base;
5
- const authTagName = (base)=>`${base} Auth`;
6
- const versionsTagName = (base)=>`${base} Versions`;
7
- const buildTagHierarchy = ({ collections, globals, hasJobs, t, nested })=>{
8
- if (!nested) return [
9
- ...collections.map((c)=>({
10
- name: entityTagName(c.base),
11
- description: c.description
12
- })),
13
- ...globals.map((g)=>({
14
- name: entityTagName(g.base),
15
- description: g.description
16
- }))
17
- ];
18
- const tags = [];
19
- if (collections.length > 0) {
20
- tags.push({
21
- name: NAV_COLLECTIONS,
22
- summary: t('tagCollections'),
23
- description: t('tagCollectionsDesc'),
24
- kind: 'nav'
25
- });
26
- for (const c of collections){
27
- tags.push({
28
- name: entityTagName(c.base),
29
- parent: NAV_COLLECTIONS,
30
- description: c.description
31
- });
32
- if (c.hasAuth) tags.push({
33
- name: authTagName(c.base),
34
- parent: c.base,
35
- summary: t('tagAuth')
36
- });
37
- if (c.hasVersions) tags.push({
38
- name: versionsTagName(c.base),
39
- parent: c.base,
40
- summary: t('tagVersions')
41
- });
42
- }
43
- }
44
- if (globals.length > 0) {
45
- tags.push({
46
- name: NAV_GLOBALS,
47
- summary: t('tagGlobals'),
48
- description: t('tagGlobalsDesc'),
49
- kind: 'nav'
50
- });
51
- for (const g of globals){
52
- tags.push({
53
- name: entityTagName(g.base),
54
- parent: NAV_GLOBALS,
55
- description: g.description
56
- });
57
- if (g.hasVersions) tags.push({
58
- name: versionsTagName(g.base),
59
- parent: g.base,
60
- summary: t('tagVersions')
61
- });
62
- }
63
- }
64
- if (hasJobs) {
65
- tags.push({
66
- name: NAV_SYSTEM,
67
- summary: t('tagSystem'),
68
- description: t('tagSystemDesc'),
69
- kind: 'nav'
70
- });
71
- tags.push({
72
- name: 'Jobs',
73
- parent: NAV_SYSTEM,
74
- summary: t('tagJobs')
75
- });
76
- }
77
- return tags;
78
- };
79
- export { NAV_COLLECTIONS, NAV_GLOBALS, NAV_SYSTEM, authTagName, buildTagHierarchy, entityTagName, versionsTagName };
@@ -1,6 +0,0 @@
1
- import type { AcceptedLanguages, I18n } from '@payloadcms/translations';
2
- import type { PluginDefaultTranslationsObject, Translate } from './types.js';
3
- export declare const makeT: (i18n: Pick<I18n, "t">) => Translate;
4
- export declare const translations: {
5
- [key in AcceptedLanguages]?: PluginDefaultTranslationsObject;
6
- };
@@ -1,2 +0,0 @@
1
- import type { PluginDefaultTranslationsObject } from '../types.js';
2
- export declare const ar: PluginDefaultTranslationsObject;