@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,83 +0,0 @@
1
- const SYSTEM_COLLECTIONS = new Set([
2
- 'payload-jobs',
3
- 'payload-locked-documents',
4
- 'payload-preferences',
5
- 'payload-migrations',
6
- 'payload-folders',
7
- 'payload-kv',
8
- 'payload-query-presets'
9
- ]);
10
- const HTTP_METHODS = [
11
- 'get',
12
- 'post',
13
- 'patch',
14
- 'put',
15
- 'delete'
16
- ];
17
- const matchesEntity = (matcher, { slug, kind })=>{
18
- if ('string' == typeof matcher) return matcher === slug;
19
- if (matcher instanceof RegExp) return matcher.test(slug);
20
- return matcher.kind === kind && matcher.slug === slug;
21
- };
22
- const anyMatch = (matchers, entity)=>matchers.some((m)=>matchesEntity(m, entity));
23
- const isHiddenCollection = (collection)=>{
24
- if (true === collection.hidden) return true;
25
- const hidden = collection.admin?.hidden;
26
- if ('function' == typeof hidden) try {
27
- return true === hidden({
28
- user: null
29
- });
30
- } catch {
31
- return false;
32
- }
33
- return true === hidden;
34
- };
35
- const passesIncludeExclude = (entity, filters)=>{
36
- if (filters.include.length > 0 && !anyMatch(filters.include, entity)) return false;
37
- if (anyMatch(filters.exclude, entity)) return false;
38
- return true;
39
- };
40
- const shouldIncludeCollection = (collection, filters)=>{
41
- const { slug } = collection;
42
- if (SYSTEM_COLLECTIONS.has(slug) && !filters.includeSystem) return false;
43
- if (!filters.includeHidden && isHiddenCollection(collection)) return false;
44
- return passesIncludeExclude({
45
- slug,
46
- kind: 'collection'
47
- }, filters);
48
- };
49
- const shouldIncludeGlobal = (global, filters)=>passesIncludeExclude({
50
- slug: global.slug,
51
- kind: 'global'
52
- }, filters);
53
- const ruleMatchesMethod = (rule, method)=>{
54
- if (void 0 === rule.method) return true;
55
- return Array.isArray(rule.method) ? rule.method.includes(method) : rule.method === method;
56
- };
57
- const ruleMatchesSlug = (rule, slug)=>{
58
- if (void 0 === rule.slug) return true;
59
- return rule.slug instanceof RegExp ? rule.slug.test(slug) : rule.slug === slug;
60
- };
61
- const ruleMatches = (rule, { method, slug, kind, path })=>ruleMatchesMethod(rule, method) && ruleMatchesSlug(rule, slug) && (void 0 === rule.kind || rule.kind === kind) && (void 0 === rule.path || rule.path.test(path));
62
- const isOperationExcluded = (filters, op)=>{
63
- if (filters.excludeOperations.some((rule)=>ruleMatches(rule, op))) return true;
64
- return filters.excludeWhen?.(op) ?? false;
65
- };
66
- const filterOperations = ({ paths, slug, kind, filters })=>{
67
- if (0 === filters.excludeOperations.length && !filters.excludeWhen) return paths;
68
- for (const [path, item] of Object.entries(paths)){
69
- if (!item) continue;
70
- let remaining = 0;
71
- const ops = item;
72
- for (const method of HTTP_METHODS)if (ops[method]) if (isOperationExcluded(filters, {
73
- method,
74
- slug,
75
- kind,
76
- path
77
- })) delete ops[method];
78
- else remaining += 1;
79
- if (0 === remaining) delete paths[path];
80
- }
81
- return paths;
82
- };
83
- export { filterOperations, shouldIncludeCollection, shouldIncludeGlobal };
@@ -1,37 +0,0 @@
1
- import { upperFirst } from "../utils.js";
2
- const schemaName = (slug)=>upperFirst(slug.replace(/-([a-z])/g, (_, c)=>c.toUpperCase()));
3
- const blockSchemaName = (slug)=>{
4
- const stripped = slug.replace(/^block[-_]?/i, '').replace(/[-_]?block$/i, '');
5
- return `Block${schemaName(stripped || slug)}`;
6
- };
7
- const globalSchemaName = (slug)=>`Global${schemaName(slug)}`;
8
- const listSchemaName = (base)=>`${base}List`;
9
- const createSchemaName = (base)=>`${base}Create`;
10
- const updateSchemaName = (base)=>`${base}Update`;
11
- const querySchemaName = (base)=>`${base}QueryOperations`;
12
- const selectSchemaName = (base)=>`${base}Select`;
13
- const populateSchemaName = (base)=>`${base}Populate`;
14
- const joinsSchemaName = (base)=>`${base}Joins`;
15
- const refTo = (name)=>`#/components/schemas/${name}`;
16
- const REF = /^#\/(?:definitions|\$defs|components\/schemas)\/(.+)$/;
17
- const normalizeRef = (ref, blockSlugs)=>{
18
- const match = REF.exec(ref);
19
- if (!match) return ref;
20
- const captured = match[1];
21
- const pascal = schemaName(captured);
22
- const blockSlug = [
23
- ...blockSlugs
24
- ].find((s)=>s === captured || schemaName(s) === pascal);
25
- if (blockSlug) return `#/components/schemas/${blockSchemaName(blockSlug)}`;
26
- return `#/components/schemas/${pascal}`;
27
- };
28
- const rewriteRefs = (node, blockSlugs = new Set())=>{
29
- if (Array.isArray(node)) return node.map((item)=>rewriteRefs(item, blockSlugs));
30
- if (node && 'object' == typeof node) {
31
- const out = {};
32
- for (const [key, value] of Object.entries(node))out[key] = '$ref' === key && 'string' == typeof value ? normalizeRef(value, blockSlugs) : rewriteRefs(value, blockSlugs);
33
- return out;
34
- }
35
- return node;
36
- };
37
- export { blockSchemaName, createSchemaName, globalSchemaName, joinsSchemaName, listSchemaName, populateSchemaName, querySchemaName, refTo, rewriteRefs, schemaName, selectSchemaName, updateSchemaName };
@@ -1,55 +0,0 @@
1
- import type { Field } from 'payload';
2
- import type { ParameterObject, SchemaObject } from '@scalar/openapi-types/3.2';
3
- import type { BuildContext, Entity } from '../types.js';
4
- export declare const buildSelectSchema: ({ fields, ctx }: {
5
- fields: Field[];
6
- ctx: BuildContext;
7
- }) => SchemaObject;
8
- export declare const buildPopulateSchema: ({ fields, ctx, }: {
9
- fields: Field[];
10
- ctx: BuildContext;
11
- }) => SchemaObject | undefined;
12
- export declare const buildJoinsSchema: ({ fields, ctx }: {
13
- fields: Field[];
14
- ctx: BuildContext;
15
- }) => SchemaObject | undefined;
16
- export interface ParamSchemas {
17
- select: SchemaObject;
18
- populate?: SchemaObject;
19
- joins?: SchemaObject;
20
- }
21
- export declare const buildParamSchemas: ({ fields, ctx }: {
22
- fields: Field[];
23
- ctx: BuildContext;
24
- }) => ParamSchemas;
25
- export declare const collectionHasFilters: (fields: Field[]) => boolean;
26
- export declare const buildQueryOperationsSchema: ({ base, fields, ctx, }: {
27
- base: string;
28
- fields: Field[];
29
- ctx: BuildContext;
30
- }) => SchemaObject;
31
- export interface ReadParamRefs {
32
- select: boolean;
33
- populate: boolean;
34
- joins: boolean;
35
- }
36
- export declare const commonReadParams: ({ base, ctx, refs, }: {
37
- base: string;
38
- ctx: BuildContext;
39
- refs: ReadParamRefs;
40
- }) => ParameterObject[];
41
- export type WriteOperation = 'create' | 'update' | 'updateByID' | 'delete' | 'duplicate' | 'globalUpdate';
42
- export declare const writeParams: ({ base, entity, ctx, refs, operation, }: {
43
- base: string;
44
- entity: Entity;
45
- ctx: BuildContext;
46
- refs: ReadParamRefs;
47
- operation: WriteOperation;
48
- }) => ParameterObject[];
49
- export declare const whereParam: (base: string) => ParameterObject;
50
- export declare const buildListParams: ({ base, fields, ctx, refs, }: {
51
- base: string;
52
- fields: Field[];
53
- ctx: BuildContext;
54
- refs: ReadParamRefs;
55
- }) => ParameterObject[];
@@ -1,436 +0,0 @@
1
- import { makeT } from "../translations/index.js";
2
- import { exposableFields } from "./fields.js";
3
- import { joinsSchemaName, populateSchemaName, querySchemaName, refTo, selectSchemaName } from "./names.js";
4
- const fieldName = (field)=>'name' in field && 'string' == typeof field.name ? field.name : void 0;
5
- const relationTargets = (field)=>{
6
- if ('relationship' !== field.type && 'upload' !== field.type) return [];
7
- const relTo = field.relationTo;
8
- return Array.isArray(relTo) ? relTo : [
9
- relTo
10
- ];
11
- };
12
- const buildSelectSchema = ({ fields, ctx })=>{
13
- const properties = {};
14
- for (const field of exposableFields(fields)){
15
- const name = fieldName(field);
16
- if (name) properties[name] = {
17
- type: 'boolean'
18
- };
19
- }
20
- return {
21
- type: 'object',
22
- additionalProperties: false,
23
- description: makeT(ctx.i18n)('schemaSelect'),
24
- properties
25
- };
26
- };
27
- const buildPopulateSchema = ({ fields, ctx })=>{
28
- const targets = new Set();
29
- for (const field of exposableFields(fields))for (const target of relationTargets(field))targets.add(target);
30
- if (0 === targets.size) return;
31
- const properties = {};
32
- for (const target of targets)properties[target] = {
33
- type: 'object',
34
- additionalProperties: {
35
- type: 'boolean'
36
- }
37
- };
38
- return {
39
- type: 'object',
40
- additionalProperties: false,
41
- description: makeT(ctx.i18n)('schemaPopulate'),
42
- properties
43
- };
44
- };
45
- const buildJoinsSchema = ({ fields, ctx })=>{
46
- const joinControls = {
47
- type: 'object',
48
- additionalProperties: false,
49
- properties: {
50
- limit: {
51
- type: 'integer'
52
- },
53
- page: {
54
- type: 'integer'
55
- },
56
- sort: {
57
- type: 'string'
58
- },
59
- count: {
60
- type: 'boolean'
61
- },
62
- where: {
63
- type: 'object',
64
- additionalProperties: true
65
- }
66
- }
67
- };
68
- const properties = {};
69
- for (const field of exposableFields(fields)){
70
- if ('join' !== field.type) continue;
71
- const name = fieldName(field);
72
- if (name) properties[name] = joinControls;
73
- }
74
- if (0 === Object.keys(properties).length) return;
75
- return {
76
- type: 'object',
77
- additionalProperties: false,
78
- description: makeT(ctx.i18n)('schemaJoins'),
79
- properties
80
- };
81
- };
82
- const buildParamSchemas = ({ fields, ctx })=>({
83
- select: buildSelectSchema({
84
- fields,
85
- ctx
86
- }),
87
- populate: buildPopulateSchema({
88
- fields,
89
- ctx
90
- }),
91
- joins: buildJoinsSchema({
92
- fields,
93
- ctx
94
- })
95
- });
96
- const OPERATORS_BY_TYPE = {
97
- text: [
98
- 'equals',
99
- 'not_equals',
100
- 'like',
101
- 'contains',
102
- 'in',
103
- 'not_in',
104
- 'exists'
105
- ],
106
- textarea: [
107
- 'equals',
108
- 'not_equals',
109
- 'like',
110
- 'contains',
111
- 'in',
112
- 'not_in',
113
- 'exists'
114
- ],
115
- email: [
116
- 'equals',
117
- 'not_equals',
118
- 'like',
119
- 'contains',
120
- 'in',
121
- 'not_in',
122
- 'exists'
123
- ],
124
- code: [
125
- 'equals',
126
- 'not_equals',
127
- 'like',
128
- 'contains',
129
- 'exists'
130
- ],
131
- number: [
132
- 'equals',
133
- 'not_equals',
134
- 'greater_than',
135
- 'greater_than_equal',
136
- 'less_than',
137
- 'less_than_equal',
138
- 'in',
139
- 'not_in',
140
- 'exists'
141
- ],
142
- date: [
143
- 'equals',
144
- 'not_equals',
145
- 'greater_than',
146
- 'greater_than_equal',
147
- 'less_than',
148
- 'less_than_equal',
149
- 'exists'
150
- ],
151
- checkbox: [
152
- 'equals',
153
- 'not_equals',
154
- 'exists'
155
- ],
156
- radio: [
157
- 'equals',
158
- 'not_equals',
159
- 'in',
160
- 'not_in',
161
- 'exists'
162
- ],
163
- select: [
164
- 'equals',
165
- 'not_equals',
166
- 'in',
167
- 'not_in',
168
- 'exists'
169
- ],
170
- relationship: [
171
- 'equals',
172
- 'not_equals',
173
- 'in',
174
- 'not_in',
175
- 'exists'
176
- ],
177
- upload: [
178
- 'equals',
179
- 'not_equals',
180
- 'in',
181
- 'not_in',
182
- 'exists'
183
- ]
184
- };
185
- const fieldHasQueryOperators = (field)=>Boolean(OPERATORS_BY_TYPE[field.type]);
186
- const collectionHasFilters = (fields)=>exposableFields(fields).some((f)=>fieldName(f) && fieldHasQueryOperators(f));
187
- const buildQueryOperationsSchema = ({ base, fields, ctx })=>{
188
- const properties = {};
189
- for (const field of exposableFields(fields)){
190
- const name = fieldName(field);
191
- const operators = OPERATORS_BY_TYPE[field.type];
192
- if (name && operators) properties[name] = {
193
- type: 'object',
194
- additionalProperties: false,
195
- properties: Object.fromEntries(operators.map((op)=>[
196
- op,
197
- {}
198
- ]))
199
- };
200
- }
201
- const selfRef = {
202
- $ref: refTo(querySchemaName(base))
203
- };
204
- properties.and = {
205
- type: 'array',
206
- items: selfRef
207
- };
208
- properties.or = {
209
- type: 'array',
210
- items: selfRef
211
- };
212
- return {
213
- type: 'object',
214
- additionalProperties: false,
215
- description: makeT(ctx.i18n)('schemaWhere'),
216
- properties
217
- };
218
- };
219
- const objectParam = (name, ref)=>({
220
- name,
221
- in: 'query',
222
- content: {
223
- 'application/json': {
224
- schema: ref ? {
225
- $ref: ref
226
- } : {
227
- type: 'object',
228
- additionalProperties: true
229
- }
230
- }
231
- }
232
- });
233
- const localeParam = (ctx)=>({
234
- name: 'locale',
235
- in: 'query',
236
- description: makeT(ctx.i18n)('paramLocale'),
237
- schema: ctx.locales.length > 0 ? {
238
- type: 'string',
239
- enum: [
240
- ...ctx.locales,
241
- 'all'
242
- ]
243
- } : {
244
- type: 'string'
245
- }
246
- });
247
- const fallbackLocaleParam = (ctx)=>({
248
- name: 'fallback-locale',
249
- in: 'query',
250
- description: makeT(ctx.i18n)('paramFallbackLocale'),
251
- schema: ctx.locales.length > 0 ? {
252
- type: 'string',
253
- enum: [
254
- ...ctx.locales,
255
- 'none'
256
- ]
257
- } : {
258
- type: 'string'
259
- }
260
- });
261
- const commonReadParams = ({ base, ctx, refs })=>{
262
- const params = [
263
- {
264
- name: 'depth',
265
- in: 'query',
266
- description: makeT(ctx.i18n)('paramDepth'),
267
- schema: {
268
- type: 'integer'
269
- }
270
- },
271
- localeParam(ctx),
272
- fallbackLocaleParam(ctx),
273
- objectParam('select', refs.select ? refTo(selectSchemaName(base)) : void 0),
274
- {
275
- name: 'flattenLocales',
276
- in: 'query',
277
- description: makeT(ctx.i18n)('paramFlattenLocales'),
278
- schema: {
279
- type: 'boolean'
280
- }
281
- },
282
- {
283
- name: 'draft',
284
- in: 'query',
285
- description: makeT(ctx.i18n)('paramDraft'),
286
- schema: {
287
- type: 'boolean'
288
- }
289
- },
290
- {
291
- name: 'trash',
292
- in: 'query',
293
- description: makeT(ctx.i18n)('paramTrash'),
294
- schema: {
295
- type: 'boolean'
296
- }
297
- }
298
- ];
299
- if (refs.populate) params.push(objectParam('populate', refTo(populateSchemaName(base))));
300
- if (refs.joins) params.push(objectParam('joins', refTo(joinsSchemaName(base))));
301
- return params;
302
- };
303
- const SHARED = [
304
- 'depth',
305
- 'locale',
306
- 'fallback-locale',
307
- 'select',
308
- 'populate'
309
- ];
310
- const ALL_LOCALES = [
311
- 'publishAllLocales',
312
- 'unpublishAllLocales'
313
- ];
314
- const WRITE_PARAMS = {
315
- create: new Set([
316
- ...SHARED,
317
- 'draft',
318
- 'autosave',
319
- 'publishAllLocales'
320
- ]),
321
- update: new Set([
322
- ...SHARED,
323
- 'draft',
324
- 'trash',
325
- 'overrideLock',
326
- ...ALL_LOCALES
327
- ]),
328
- updateByID: new Set([
329
- ...SHARED,
330
- 'draft',
331
- 'trash',
332
- 'autosave',
333
- 'overrideLock',
334
- ...ALL_LOCALES
335
- ]),
336
- delete: new Set([
337
- ...SHARED,
338
- 'trash',
339
- 'overrideLock'
340
- ]),
341
- duplicate: new Set([
342
- ...SHARED,
343
- 'draft',
344
- 'selectedLocales[]'
345
- ]),
346
- globalUpdate: new Set([
347
- ...SHARED,
348
- 'draft',
349
- 'autosave',
350
- ...ALL_LOCALES
351
- ])
352
- };
353
- const entityWriteParams = (entity, ctx)=>{
354
- const t = makeT(ctx.i18n);
355
- const flag = (name, key)=>({
356
- name,
357
- in: 'query',
358
- description: t(key),
359
- schema: {
360
- type: 'boolean'
361
- }
362
- });
363
- const drafts = entity.versions ? entity.versions.drafts : false;
364
- const params = [];
365
- if (drafts && drafts.autosave) params.push(flag('autosave', 'paramAutosave'));
366
- if (drafts && drafts.localizeStatus) {
367
- params.push(flag('publishAllLocales', 'paramPublishAllLocales'));
368
- params.push(flag('unpublishAllLocales', 'paramUnpublishAllLocales'));
369
- }
370
- if (false !== entity.lockDocuments) params.push(flag('overrideLock', 'paramOverrideLock'));
371
- if (ctx.locales.length > 0) params.push({
372
- name: 'selectedLocales[]',
373
- in: 'query',
374
- description: t('paramSelectedLocales'),
375
- style: 'form',
376
- explode: true,
377
- schema: {
378
- type: 'array',
379
- items: {
380
- type: 'string',
381
- enum: ctx.locales
382
- }
383
- }
384
- });
385
- return params;
386
- };
387
- const writeParams = ({ base, entity, ctx, refs, operation })=>[
388
- ...commonReadParams({
389
- base,
390
- ctx,
391
- refs
392
- }),
393
- ...entityWriteParams(entity, ctx)
394
- ].filter((p)=>WRITE_PARAMS[operation].has(p.name));
395
- const whereParam = (base)=>objectParam('where', refTo(querySchemaName(base)));
396
- const buildListParams = ({ base, fields, ctx, refs })=>{
397
- const params = [
398
- {
399
- name: 'page',
400
- in: 'query',
401
- schema: {
402
- type: 'integer'
403
- }
404
- },
405
- {
406
- name: 'limit',
407
- in: 'query',
408
- schema: {
409
- type: 'integer'
410
- }
411
- },
412
- {
413
- name: 'pagination',
414
- in: 'query',
415
- schema: {
416
- type: 'boolean'
417
- }
418
- },
419
- {
420
- name: 'sort',
421
- in: 'query',
422
- description: makeT(ctx.i18n)('paramSort'),
423
- schema: {
424
- type: 'string'
425
- }
426
- },
427
- ...commonReadParams({
428
- base,
429
- ctx,
430
- refs
431
- })
432
- ];
433
- if (collectionHasFilters(fields)) params.push(whereParam(base));
434
- return params;
435
- };
436
- export { buildJoinsSchema, buildListParams, buildParamSchemas, buildPopulateSchema, buildQueryOperationsSchema, buildSelectSchema, collectionHasFilters, commonReadParams, whereParam, writeParams };
@@ -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
- export declare const buildAuthPaths: ({ collection, ctx, includeAdmin, nestedTags, }: {
5
- collection: SanitizedCollectionConfig;
6
- ctx: BuildContext;
7
- includeAdmin: boolean;
8
- nestedTags: boolean;
9
- }) => PathsObject;