payload 4.0.0-internal.2fddfc0 → 4.0.0-internal.3aa3d85

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 (262) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +11 -0
  3. package/dist/admin/RichText.d.ts +1 -21
  4. package/dist/admin/RichText.d.ts.map +1 -1
  5. package/dist/admin/RichText.js.map +1 -1
  6. package/dist/admin/forms/Field.d.ts +2 -2
  7. package/dist/admin/forms/Field.d.ts.map +1 -1
  8. package/dist/admin/forms/Field.js.map +1 -1
  9. package/dist/admin/forms/Form.d.ts +0 -29
  10. package/dist/admin/forms/Form.d.ts.map +1 -1
  11. package/dist/admin/forms/Form.js.map +1 -1
  12. package/dist/admin/functions/index.d.ts +1 -1
  13. package/dist/admin/functions/index.js.map +1 -1
  14. package/dist/admin/types.d.ts +1 -0
  15. package/dist/admin/types.d.ts.map +1 -1
  16. package/dist/admin/types.js.map +1 -1
  17. package/dist/auth/operations/auth.d.ts +2 -2
  18. package/dist/auth/operations/auth.d.ts.map +1 -1
  19. package/dist/auth/operations/auth.js.map +1 -1
  20. package/dist/auth/operations/login.d.ts +2 -1
  21. package/dist/auth/operations/login.d.ts.map +1 -1
  22. package/dist/auth/operations/login.js.map +1 -1
  23. package/dist/auth/operations/me.js.map +1 -1
  24. package/dist/auth/operations/refresh.d.ts.map +1 -1
  25. package/dist/auth/operations/refresh.js +9 -3
  26. package/dist/auth/operations/refresh.js.map +1 -1
  27. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  28. package/dist/auth/operations/resetPassword.js.map +1 -1
  29. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  30. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  31. package/dist/auth/sendVerificationEmail.js +1 -1
  32. package/dist/auth/sendVerificationEmail.js.map +1 -1
  33. package/dist/auth/sessions.d.ts +4 -5
  34. package/dist/auth/sessions.d.ts.map +1 -1
  35. package/dist/auth/sessions.js +5 -3
  36. package/dist/auth/sessions.js.map +1 -1
  37. package/dist/auth/strategies/apiKey.js.map +1 -1
  38. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  39. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  40. package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
  41. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  42. package/dist/auth/types.d.ts +28 -21
  43. package/dist/auth/types.d.ts.map +1 -1
  44. package/dist/auth/types.js.map +1 -1
  45. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  46. package/dist/bin/generateImportMap/iterateCollections.js +10 -0
  47. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  48. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  49. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +11 -3
  50. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  51. package/dist/collections/config/client.d.ts +1 -1
  52. package/dist/collections/config/client.d.ts.map +1 -1
  53. package/dist/collections/config/client.js +1 -0
  54. package/dist/collections/config/client.js.map +1 -1
  55. package/dist/collections/config/defaults.d.ts +0 -4
  56. package/dist/collections/config/defaults.d.ts.map +1 -1
  57. package/dist/collections/config/defaults.js +0 -15
  58. package/dist/collections/config/defaults.js.map +1 -1
  59. package/dist/collections/config/types.d.ts +6 -0
  60. package/dist/collections/config/types.d.ts.map +1 -1
  61. package/dist/collections/config/types.js.map +1 -1
  62. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  63. package/dist/collections/operations/findDistinct.js +1 -0
  64. package/dist/collections/operations/findDistinct.js.map +1 -1
  65. package/dist/collections/operations/local/count.d.ts +3 -3
  66. package/dist/collections/operations/local/count.d.ts.map +1 -1
  67. package/dist/collections/operations/local/count.js.map +1 -1
  68. package/dist/collections/operations/local/countVersions.d.ts +3 -3
  69. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  70. package/dist/collections/operations/local/countVersions.js.map +1 -1
  71. package/dist/collections/operations/local/create.d.ts +3 -3
  72. package/dist/collections/operations/local/create.d.ts.map +1 -1
  73. package/dist/collections/operations/local/create.js.map +1 -1
  74. package/dist/collections/operations/local/delete.d.ts +3 -3
  75. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  76. package/dist/collections/operations/local/delete.js.map +1 -1
  77. package/dist/collections/operations/local/duplicate.d.ts +3 -3
  78. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  79. package/dist/collections/operations/local/duplicate.js.map +1 -1
  80. package/dist/collections/operations/local/find.d.ts +3 -3
  81. package/dist/collections/operations/local/find.d.ts.map +1 -1
  82. package/dist/collections/operations/local/find.js.map +1 -1
  83. package/dist/collections/operations/local/findByID.d.ts +3 -3
  84. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  85. package/dist/collections/operations/local/findByID.js.map +1 -1
  86. package/dist/collections/operations/local/findDistinct.d.ts +2 -2
  87. package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
  88. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  89. package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
  90. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  91. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  92. package/dist/collections/operations/local/findVersions.d.ts +3 -3
  93. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  94. package/dist/collections/operations/local/findVersions.js.map +1 -1
  95. package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
  96. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  97. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  98. package/dist/collections/operations/local/update.d.ts +3 -3
  99. package/dist/collections/operations/local/update.d.ts.map +1 -1
  100. package/dist/collections/operations/local/update.js.map +1 -1
  101. package/dist/collections/operations/utilities/types.d.ts +0 -9
  102. package/dist/collections/operations/utilities/types.d.ts.map +1 -1
  103. package/dist/collections/operations/utilities/types.js.map +1 -1
  104. package/dist/config/client.d.ts +2 -2
  105. package/dist/config/client.d.ts.map +1 -1
  106. package/dist/config/client.js.map +1 -1
  107. package/dist/config/defaults.d.ts +0 -4
  108. package/dist/config/defaults.d.ts.map +1 -1
  109. package/dist/config/defaults.js +0 -78
  110. package/dist/config/defaults.js.map +1 -1
  111. package/dist/config/definePlugin.d.ts +10 -10
  112. package/dist/config/definePlugin.d.ts.map +1 -1
  113. package/dist/config/definePlugin.js +7 -11
  114. package/dist/config/definePlugin.js.map +1 -1
  115. package/dist/config/sanitize.d.ts.map +1 -1
  116. package/dist/config/sanitize.js +137 -13
  117. package/dist/config/sanitize.js.map +1 -1
  118. package/dist/config/types.d.ts +35 -3
  119. package/dist/config/types.d.ts.map +1 -1
  120. package/dist/config/types.js.map +1 -1
  121. package/dist/exports/internal.d.ts +1 -0
  122. package/dist/exports/internal.d.ts.map +1 -1
  123. package/dist/exports/internal.js +1 -0
  124. package/dist/exports/internal.js.map +1 -1
  125. package/dist/exports/shared.d.ts +3 -2
  126. package/dist/exports/shared.d.ts.map +1 -1
  127. package/dist/exports/shared.js +2 -1
  128. package/dist/exports/shared.js.map +1 -1
  129. package/dist/fields/baseFields/slug/countVersions.d.ts.map +1 -1
  130. package/dist/fields/baseFields/slug/countVersions.js +6 -8
  131. package/dist/fields/baseFields/slug/countVersions.js.map +1 -1
  132. package/dist/fields/baseFields/slug/generateSlug.d.ts +14 -7
  133. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  134. package/dist/fields/baseFields/slug/generateSlug.js +53 -73
  135. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  136. package/dist/fields/baseFields/slug/types.d.ts +14 -0
  137. package/dist/fields/baseFields/slug/types.d.ts.map +1 -0
  138. package/dist/fields/baseFields/slug/types.js +6 -0
  139. package/dist/fields/baseFields/slug/types.js.map +1 -0
  140. package/dist/fields/config/client.d.ts +1 -1
  141. package/dist/fields/config/client.d.ts.map +1 -1
  142. package/dist/fields/config/client.js +2 -1
  143. package/dist/fields/config/client.js.map +1 -1
  144. package/dist/fields/config/sanitize.d.ts.map +1 -1
  145. package/dist/fields/config/sanitize.js +39 -0
  146. package/dist/fields/config/sanitize.js.map +1 -1
  147. package/dist/fields/config/types.d.ts +44 -8
  148. package/dist/fields/config/types.d.ts.map +1 -1
  149. package/dist/fields/config/types.js.map +1 -1
  150. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  151. package/dist/fields/hooks/afterRead/promise.js +11 -1
  152. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  153. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  154. package/dist/fields/hooks/beforeValidate/promise.js +10 -1
  155. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  156. package/dist/fields/setDefaultBeforeDuplicate.js +1 -0
  157. package/dist/fields/setDefaultBeforeDuplicate.js.map +1 -1
  158. package/dist/fields/sortableFieldTypes.d.ts.map +1 -1
  159. package/dist/fields/sortableFieldTypes.js +1 -0
  160. package/dist/fields/sortableFieldTypes.js.map +1 -1
  161. package/dist/fields/validations.d.ts +4 -1
  162. package/dist/fields/validations.d.ts.map +1 -1
  163. package/dist/fields/validations.js +7 -0
  164. package/dist/fields/validations.js.map +1 -1
  165. package/dist/globals/operations/local/countVersions.d.ts +3 -3
  166. package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
  167. package/dist/globals/operations/local/countVersions.js.map +1 -1
  168. package/dist/globals/operations/local/findOne.d.ts +3 -3
  169. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  170. package/dist/globals/operations/local/findOne.js.map +1 -1
  171. package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
  172. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  173. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  174. package/dist/globals/operations/local/findVersions.d.ts +3 -3
  175. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  176. package/dist/globals/operations/local/findVersions.js.map +1 -1
  177. package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
  178. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  179. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  180. package/dist/globals/operations/local/update.d.ts +3 -3
  181. package/dist/globals/operations/local/update.d.ts.map +1 -1
  182. package/dist/globals/operations/local/update.js.map +1 -1
  183. package/dist/index.bundled.d.ts +365 -300
  184. package/dist/index.d.ts +59 -15
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +1 -2
  187. package/dist/index.js.map +1 -1
  188. package/dist/preferences/keys.d.ts +4 -0
  189. package/dist/preferences/keys.d.ts.map +1 -1
  190. package/dist/preferences/keys.js +4 -1
  191. package/dist/preferences/keys.js.map +1 -1
  192. package/dist/preferences/types.d.ts +15 -0
  193. package/dist/preferences/types.d.ts.map +1 -1
  194. package/dist/preferences/types.js +3 -1
  195. package/dist/preferences/types.js.map +1 -1
  196. package/dist/types/index.d.ts +8 -3
  197. package/dist/types/index.d.ts.map +1 -1
  198. package/dist/types/index.js.map +1 -1
  199. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  200. package/dist/uploads/fetchAPI-multipart/processMultipart.js +1 -14
  201. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  202. package/dist/uploads/matchMimeType.d.ts +8 -0
  203. package/dist/uploads/matchMimeType.d.ts.map +1 -0
  204. package/dist/uploads/matchMimeType.js +19 -0
  205. package/dist/uploads/matchMimeType.js.map +1 -0
  206. package/dist/uploads/matchMimeType.spec.js +66 -0
  207. package/dist/uploads/matchMimeType.spec.js.map +1 -0
  208. package/dist/uploads/types.d.ts +21 -0
  209. package/dist/uploads/types.d.ts.map +1 -1
  210. package/dist/uploads/types.js.map +1 -1
  211. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  212. package/dist/utilities/addDataAndFileToRequest.js +6 -0
  213. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  214. package/dist/utilities/configToJSONSchema.d.ts +13 -4
  215. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  216. package/dist/utilities/configToJSONSchema.js +139 -61
  217. package/dist/utilities/configToJSONSchema.js.map +1 -1
  218. package/dist/utilities/configToJSONSchema.spec.js +319 -0
  219. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  220. package/dist/utilities/createLocalReq.d.ts +2 -2
  221. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  222. package/dist/utilities/createLocalReq.js.map +1 -1
  223. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  224. package/dist/utilities/createPayloadRequest.js +1 -0
  225. package/dist/utilities/createPayloadRequest.js.map +1 -1
  226. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  227. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +2 -0
  228. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  229. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
  230. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  231. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +19 -2
  232. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  233. package/dist/utilities/isURLAllowed.d.ts.map +1 -1
  234. package/dist/utilities/isURLAllowed.js +9 -3
  235. package/dist/utilities/isURLAllowed.js.map +1 -1
  236. package/dist/utilities/isURLAllowed.spec.js +78 -0
  237. package/dist/utilities/isURLAllowed.spec.js.map +1 -0
  238. package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
  239. package/dist/utilities/telemetry/conf/envPaths.js +40 -31
  240. package/dist/utilities/telemetry/conf/envPaths.js.map +1 -1
  241. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  242. package/dist/utilities/telemetry/events/adminInit.js +2 -3
  243. package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
  244. package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
  245. package/dist/utilities/telemetry/events/serverInit.js +2 -3
  246. package/dist/utilities/telemetry/events/serverInit.js.map +1 -1
  247. package/dist/utilities/telemetry/index.d.ts +14 -3
  248. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  249. package/dist/utilities/telemetry/index.js +6 -1
  250. package/dist/utilities/telemetry/index.js.map +1 -1
  251. package/dist/utilities/telemetry/index.spec.js +43 -0
  252. package/dist/utilities/telemetry/index.spec.js.map +1 -0
  253. package/dist/versions/schedule/job.js.map +1 -1
  254. package/package.json +3 -3
  255. package/dist/fields/baseFields/slug/index.d.ts +0 -89
  256. package/dist/fields/baseFields/slug/index.d.ts.map +0 -1
  257. package/dist/fields/baseFields/slug/index.js +0 -81
  258. package/dist/fields/baseFields/slug/index.js.map +0 -1
  259. package/dist/utilities/isRSCEnabled.d.ts +0 -12
  260. package/dist/utilities/isRSCEnabled.d.ts.map +0 -1
  261. package/dist/utilities/isRSCEnabled.js +0 -14
  262. package/dist/utilities/isRSCEnabled.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utilities/telemetry/conf/envPaths.ts"],"sourcesContent":["// @ts-strict-ignore\n/**\n * Taken from https://github.com/sindresorhus/env-paths/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport os from 'node:os'\nimport path from 'node:path'\nimport process from 'node:process'\n\nexport function envPaths(name: string, { suffix = 'nodejs' } = {}) {\n if (typeof name !== 'string') {\n throw new TypeError(`Expected a string, got ${typeof name}`)\n }\n\n if (suffix) {\n // Add suffix to prevent possible conflict with native apps\n name += `-${suffix}`\n }\n\n const homedir = os.homedir()\n const tmpdir = os.tmpdir()\n const { env } = process\n\n if (process.platform === 'darwin') {\n const library = path.join(homedir, 'Library')\n return {\n cache: path.join(library, 'Caches', name),\n config: path.join(library, 'Preferences', name),\n data: path.join(library, 'Application Support', name),\n log: path.join(library, 'Logs', name),\n temp: path.join(tmpdir, name),\n }\n }\n\n if (process.platform === 'win32') {\n const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming')\n const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local')\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n cache: path.join(localAppData, name, 'Cache'),\n config: path.join(appData, name, 'Config'),\n data: path.join(localAppData, name, 'Data'),\n log: path.join(localAppData, name, 'Log'),\n temp: path.join(tmpdir, name),\n }\n }\n\n // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\n const username = path.basename(homedir)\n return {\n cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),\n config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),\n data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),\n temp: path.join(tmpdir, username, name),\n }\n}\n"],"names":["os","path","process","envPaths","name","suffix","TypeError","homedir","tmpdir","env","platform","library","join","cache","config","data","log","temp","appData","APPDATA","localAppData","LOCALAPPDATA","username","basename","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_STATE_HOME"],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;;;;;;CAYC,GAED,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,OAAOC,aAAa,eAAc;AAElC,OAAO,SAASC,SAASC,IAAY,EAAE,EAAEC,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC/D,IAAI,OAAOD,SAAS,UAAU;QAC5B,MAAM,IAAIE,UAAU,CAAC,uBAAuB,EAAE,OAAOF,MAAM;IAC7D;IAEA,IAAIC,QAAQ;QACV,2DAA2D;QAC3DD,QAAQ,CAAC,CAAC,EAAEC,QAAQ;IACtB;IAEA,MAAME,UAAUP,GAAGO,OAAO;IAC1B,MAAMC,SAASR,GAAGQ,MAAM;IACxB,MAAM,EAAEC,GAAG,EAAE,GAAGP;IAEhB,IAAIA,QAAQQ,QAAQ,KAAK,UAAU;QACjC,MAAMC,UAAUV,KAAKW,IAAI,CAACL,SAAS;QACnC,OAAO;YACLM,OAAOZ,KAAKW,IAAI,CAACD,SAAS,UAAUP;YACpCU,QAAQb,KAAKW,IAAI,CAACD,SAAS,eAAeP;YAC1CW,MAAMd,KAAKW,IAAI,CAACD,SAAS,uBAAuBP;YAChDY,KAAKf,KAAKW,IAAI,CAACD,SAAS,QAAQP;YAChCa,MAAMhB,KAAKW,IAAI,CAACJ,QAAQJ;QAC1B;IACF;IAEA,IAAIF,QAAQQ,QAAQ,KAAK,SAAS;QAChC,MAAMQ,UAAUT,IAAIU,OAAO,IAAIlB,KAAKW,IAAI,CAACL,SAAS,WAAW;QAC7D,MAAMa,eAAeX,IAAIY,YAAY,IAAIpB,KAAKW,IAAI,CAACL,SAAS,WAAW;QACvE,OAAO;YACL,mFAAmF;YACnFM,OAAOZ,KAAKW,IAAI,CAACQ,cAAchB,MAAM;YACrCU,QAAQb,KAAKW,IAAI,CAACM,SAASd,MAAM;YACjCW,MAAMd,KAAKW,IAAI,CAACQ,cAAchB,MAAM;YACpCY,KAAKf,KAAKW,IAAI,CAACQ,cAAchB,MAAM;YACnCa,MAAMhB,KAAKW,IAAI,CAACJ,QAAQJ;QAC1B;IACF;IAEA,+EAA+E;IAC/E,MAAMkB,WAAWrB,KAAKsB,QAAQ,CAAChB;IAC/B,OAAO;QACLM,OAAOZ,KAAKW,IAAI,CAACH,IAAIe,cAAc,IAAIvB,KAAKW,IAAI,CAACL,SAAS,WAAWH;QACrEU,QAAQb,KAAKW,IAAI,CAACH,IAAIgB,eAAe,IAAIxB,KAAKW,IAAI,CAACL,SAAS,YAAYH;QACxEW,MAAMd,KAAKW,IAAI,CAACH,IAAIiB,aAAa,IAAIzB,KAAKW,IAAI,CAACL,SAAS,UAAU,UAAUH;QAC5E,8DAA8D;QAC9DY,KAAKf,KAAKW,IAAI,CAACH,IAAIkB,cAAc,IAAI1B,KAAKW,IAAI,CAACL,SAAS,UAAU,UAAUH;QAC5Ea,MAAMhB,KAAKW,IAAI,CAACJ,QAAQc,UAAUlB;IACpC;AACF"}
1
+ {"version":3,"sources":["../../../../src/utilities/telemetry/conf/envPaths.ts"],"sourcesContent":["// @ts-strict-ignore\n/**\n * Taken from https://github.com/sindresorhus/env-paths/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport os from 'node:os'\nimport path from 'node:path'\nimport process from 'node:process'\n\nconst homedir = os.homedir()\nconst tmpdir = os.tmpdir()\nconst { env } = process\n\nconst macos = (name: string) => {\n const library = path.join(homedir, 'Library')\n\n return {\n cache: path.join(library, 'Caches', name),\n config: path.join(library, 'Preferences', name),\n data: path.join(library, 'Application Support', name),\n log: path.join(library, 'Logs', name),\n temp: path.join(tmpdir, name),\n }\n}\n\nconst windows = (name: string) => {\n const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming')\n const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local')\n\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n cache: path.join(localAppData, name, 'Cache'),\n config: path.join(appData, name, 'Config'),\n data: path.join(localAppData, name, 'Data'),\n log: path.join(localAppData, name, 'Log'),\n temp: path.join(tmpdir, name),\n }\n}\n\n// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\nconst linux = (name: string) => {\n const username = path.basename(homedir)\n\n return {\n cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),\n config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),\n data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),\n temp: path.join(tmpdir, username, name),\n }\n}\n\nexport function envPaths(name: string, { suffix = 'nodejs' } = {}) {\n if (typeof name !== 'string') {\n throw new TypeError(`Expected a string, got ${typeof name}`)\n }\n\n if (suffix) {\n // Add suffix to prevent possible conflict with native apps\n name += `-${suffix}`\n }\n\n if (process.platform === 'darwin') {\n return macos(name)\n }\n\n if (process.platform === 'win32') {\n return windows(name)\n }\n\n return linux(name)\n}\n"],"names":["os","path","process","homedir","tmpdir","env","macos","name","library","join","cache","config","data","log","temp","windows","appData","APPDATA","localAppData","LOCALAPPDATA","linux","username","basename","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_STATE_HOME","envPaths","suffix","TypeError","platform"],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;;;;;;CAYC,GAED,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,OAAOC,aAAa,eAAc;AAElC,MAAMC,UAAUH,GAAGG,OAAO;AAC1B,MAAMC,SAASJ,GAAGI,MAAM;AACxB,MAAM,EAAEC,GAAG,EAAE,GAAGH;AAEhB,MAAMI,QAAQ,CAACC;IACb,MAAMC,UAAUP,KAAKQ,IAAI,CAACN,SAAS;IAEnC,OAAO;QACLO,OAAOT,KAAKQ,IAAI,CAACD,SAAS,UAAUD;QACpCI,QAAQV,KAAKQ,IAAI,CAACD,SAAS,eAAeD;QAC1CK,MAAMX,KAAKQ,IAAI,CAACD,SAAS,uBAAuBD;QAChDM,KAAKZ,KAAKQ,IAAI,CAACD,SAAS,QAAQD;QAChCO,MAAMb,KAAKQ,IAAI,CAACL,QAAQG;IAC1B;AACF;AAEA,MAAMQ,UAAU,CAACR;IACf,MAAMS,UAAUX,IAAIY,OAAO,IAAIhB,KAAKQ,IAAI,CAACN,SAAS,WAAW;IAC7D,MAAMe,eAAeb,IAAIc,YAAY,IAAIlB,KAAKQ,IAAI,CAACN,SAAS,WAAW;IAEvE,OAAO;QACL,mFAAmF;QACnFO,OAAOT,KAAKQ,IAAI,CAACS,cAAcX,MAAM;QACrCI,QAAQV,KAAKQ,I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../../src/utilities/telemetry/events/adminInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAK7D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,YAAY,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC7B,CAAA;AACD,eAAO,MAAM,SAAS,GAAI,4BAA4B,IAAI,KAAG,IAuB5D,CAAA"}
1
+ {"version":3,"file":"adminInit.d.ts","sourceRoot":"","sources":["../../../../src/utilities/telemetry/events/adminInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAK7D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,YAAY,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC7B,CAAA;AACD,eAAO,MAAM,SAAS,GAAI,4BAA4B,IAAI,KAAG,IAsB5D,CAAA"}
@@ -1,4 +1,4 @@
1
- import { sendEvent } from '../index.js';
1
+ import { sendTelemetryEvent } from '../index.js';
2
2
  import { oneWayHash } from '../oneWayHash.js';
3
3
  export const adminInit = ({ headers, payload, user })=>{
4
4
  const host = headers.get('host');
@@ -10,8 +10,7 @@ export const adminInit = ({ headers, payload, user })=>{
10
10
  if (user?.id) {
11
11
  userID = oneWayHash(String(user.id), payload.secret);
12
12
  }
13
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
14
- sendEvent({
13
+ void sendTelemetryEvent({
15
14
  event: {
16
15
  type: 'admin-init',
17
16
  domainID: domainID,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utilities/telemetry/events/adminInit.ts"],"sourcesContent":["import type { Payload } from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\n\nimport { sendEvent } from '../index.js'\nimport { oneWayHash } from '../oneWayHash.js'\n\nexport type AdminInitEvent = {\n domainID?: string\n type: 'admin-init'\n userID?: string\n}\n\ntype Args = {\n headers: Request['headers']\n payload: Payload\n user: PayloadRequest['user']\n}\nexport const adminInit = ({ headers, payload, user }: Args): void => {\n const host = headers.get('host')\n\n let domainID: string\n let userID: string\n\n if (host) {\n domainID = oneWayHash(host, payload.secret)\n }\n\n if (user?.id) {\n userID = oneWayHash(String(user.id), payload.secret)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n sendEvent({\n event: {\n type: 'admin-init',\n domainID: domainID!,\n userID: userID!,\n },\n payload,\n })\n}\n"],"names":["sendEvent","oneWayHash","adminInit","headers","payload","user","host","get","domainID","userID","secret","id","String","event","type"],"mappings":"AAGA,SAASA,SAAS,QAAQ,cAAa;AACvC,SAASC,UAAU,QAAQ,mBAAkB;AAa7C,OAAO,MAAMC,YAAY,CAAC,EAAEC,OAAO,EAAEC,OAAO,EAAEC,IAAI,EAAQ;IACxD,MAAMC,OAAOH,QAAQI,GAAG,CAAC;IAEzB,IAAIC;IACJ,IAAIC;IAEJ,IAAIH,MAAM;QACRE,WAAWP,WAAWK,MAAMF,QAAQM,MAAM;IAC5C;IAEA,IAAIL,MAAMM,IAAI;QACZF,SAASR,WAAWW,OAAOP,KAAKM,EAAE,GAAGP,QAAQM,MAAM;IACrD;IAEA,mEAAmE;IACnEV,UAAU;QACRa,OAAO;YACLC,MAAM;YACNN,UAAUA;YACVC,QAAQA;QACV;QACAL;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/utilities/telemetry/events/adminInit.ts"],"sourcesContent":["import type { Payload } from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\n\nimport { sendTelemetryEvent } from '../index.js'\nimport { oneWayHash } from '../oneWayHash.js'\n\nexport type AdminInitEvent = {\n domainID?: string\n type: 'admin-init'\n userID?: string\n}\n\ntype Args = {\n headers: Request['headers']\n payload: Payload\n user: PayloadRequest['user']\n}\nexport const adminInit = ({ headers, payload, user }: Args): void => {\n const host = headers.get('host')\n\n let domainID: string\n let userID: string\n\n if (host) {\n domainID = oneWayHash(host, payload.secret)\n }\n\n if (user?.id) {\n userID = oneWayHash(String(user.id), payload.secret)\n }\n\n void sendTelemetryEvent({\n event: {\n type: 'admin-init',\n domainID: domainID!,\n userID: userID!,\n },\n payload,\n })\n}\n"],"names":["sendTelemetryEvent","oneWayHash","adminInit","headers","payload","user","host","get","domainID","userID","secret","id","String","event","type"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,cAAa;AAChD,SAASC,UAAU,QAAQ,mBAAkB;AAa7C,OAAO,MAAMC,YAAY,CAAC,EAAEC,OAAO,EAAEC,OAAO,EAAEC,IAAI,EAAQ;IACxD,MAAMC,OAAOH,QAAQI,GAAG,CAAC;IAEzB,IAAIC;IACJ,IAAIC;IAEJ,IAAIH,MAAM;QACRE,WAAWP,WAAWK,MAAMF,QAAQM,MAAM;IAC5C;IAEA,IAAIL,MAAMM,IAAI;QACZF,SAASR,WAAWW,OAAOP,KAAKM,EAAE,GAAGP,QAAQM,MAAM;IACrD;IAEA,KAAKV,mBAAmB;QACtBa,OAAO;YACLC,MAAM;YACNN,UAAUA;YACVC,QAAQA;QACV;QACAL;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"serverInit.d.ts","sourceRoot":"","sources":["../../../../src/utilities/telemetry/events/serverInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAIhD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,OAAO,KAAG,IAQ7C,CAAA"}
1
+ {"version":3,"file":"serverInit.d.ts","sourceRoot":"","sources":["../../../../src/utilities/telemetry/events/serverInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAIhD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,OAAO,KAAG,IAO7C,CAAA"}
@@ -1,7 +1,6 @@
1
- import { sendEvent } from '../index.js';
1
+ import { sendTelemetryEvent } from '../index.js';
2
2
  export const serverInit = (payload)=>{
3
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
4
- sendEvent({
3
+ void sendTelemetryEvent({
5
4
  event: {
6
5
  type: 'server-init'
7
6
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utilities/telemetry/events/serverInit.ts"],"sourcesContent":["import type { Payload } from '../../../index.js'\n\nimport { sendEvent } from '../index.js'\n\nexport type ServerInitEvent = {\n type: 'server-init'\n}\n\nexport const serverInit = (payload: Payload): void => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n sendEvent({\n event: {\n type: 'server-init',\n },\n payload,\n })\n}\n"],"names":["sendEvent","serverInit","payload","event","type"],"mappings":"AAEA,SAASA,SAAS,QAAQ,cAAa;AAMvC,OAAO,MAAMC,aAAa,CAACC;IACzB,mEAAmE;IACnEF,UAAU;QACRG,OAAO;YACLC,MAAM;QACR;QACAF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/utilities/telemetry/events/serverInit.ts"],"sourcesContent":["import type { Payload } from '../../../index.js'\n\nimport { sendTelemetryEvent } from '../index.js'\n\nexport type ServerInitEvent = {\n type: 'server-init'\n}\n\nexport const serverInit = (payload: Payload): void => {\n void sendTelemetryEvent({\n event: {\n type: 'server-init',\n },\n payload,\n })\n}\n"],"names":["sendTelemetryEvent","serverInit","payload","event","type"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ,cAAa;AAMhD,OAAO,MAAMC,aAAa,CAACC;IACzB,KAAKF,mBAAmB;QACtBG,OAAO;YACLC,MAAM;QACR;QACAF;IACF;AACF,EAAC"}
@@ -13,6 +13,8 @@ export type BaseEvent = {
13
13
  nodeEnv: string;
14
14
  nodeVersion: string;
15
15
  payloadVersion: string;
16
+ /** Slugs of installed first-party (`@payloadcms/`) plugins. */
17
+ plugins: string[];
16
18
  projectID: string;
17
19
  projectIDSource: 'cwd' | 'git' | 'packageJSON' | 'serverURL';
18
20
  uploadAdapters: string[];
@@ -22,12 +24,21 @@ type PackageJSON = {
22
24
  name: string;
23
25
  };
24
26
  type TelemetryEvent = AdminInitEvent | ServerInitEvent;
25
- type Args = {
26
- event: TelemetryEvent;
27
+ type Args<TEvent extends {
28
+ type: string;
29
+ } = TelemetryEvent> = {
30
+ event: TEvent;
27
31
  payload: Payload;
28
32
  };
29
- export declare const sendEvent: ({ event, payload }: Args) => Promise<void>;
33
+ export declare const sendTelemetryEvent: <TEvent extends {
34
+ type: string;
35
+ }>({ event, payload, }: Args<TEvent>) => Promise<void>;
30
36
  export declare const getPayloadVersion: (packageJSON: PackageJSON) => string;
37
+ /**
38
+ * Slugs of installed first-party (`@payloadcms/`) plugins. Custom plugin slugs
39
+ * are author-defined and can leak project details, so they are never collected.
40
+ */
41
+ export declare const getInstalledPluginSlugs: (payload: Payload) => string[];
31
42
  export declare const getLocalizationInfo: (payload: Payload) => Pick<BaseEvent, "locales" | "localizationDefaultLocale" | "localizationEnabled">;
32
43
  export {};
33
44
  //# sourceMappingURL=index.d.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MAAM,CAAA;CAAE,GAAG,cAAc,IAAI;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAID,eAAO,MAAM,kBAAkB,GAAU,MAAM,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,qBAGvE,IAAI,CAAC,MAAM,CAAC,KAAG,OAAO,CAAC,IAAI,CA4C7B,CAAA;AAiFD,eAAO,MAAM,iBAAiB,GAAI,aAAa,WAAW,KAAG,MAE5D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,OAAO,KAAG,MAAM,EAGiC,CAAA;AAElG,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,KACf,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,2BAA2B,GAAG,qBAAqB,CAcjF,CAAA"}
@@ -8,7 +8,7 @@ import { findUp } from '../findUp.js';
8
8
  import { Conf } from './conf/index.js';
9
9
  import { oneWayHash } from './oneWayHash.js';
10
10
  let baseEvent = null;
11
- export const sendEvent = async ({ event, payload })=>{
11
+ export const sendTelemetryEvent = async ({ event, payload })=>{
12
12
  try {
13
13
  if (payload.config.telemetry !== false) {
14
14
  const { packageJSON, packageJSONPath } = await getPackageJSON();
@@ -27,6 +27,7 @@ export const sendEvent = async ({ event, payload })=>{
27
27
  ...getLocalizationInfo(payload),
28
28
  dbAdapter: payload.db.name,
29
29
  emailAdapter: payload.email?.name || null,
30
+ plugins: getInstalledPluginSlugs(payload),
30
31
  uploadAdapters: payload.config.upload.adapters
31
32
  };
32
33
  }
@@ -135,6 +136,10 @@ const getPackageJSONID = (payload, packageJSON)=>{
135
136
  export const getPayloadVersion = (packageJSON)=>{
136
137
  return packageJSON?.dependencies?.payload ?? '';
137
138
  };
139
+ /**
140
+ * Slugs of installed first-party (`@payloadcms/`) plugins. Custom plugin slugs
141
+ * are author-defined and can leak project details, so they are never collected.
142
+ */ export const getInstalledPluginSlugs = (payload)=>(payload.config.plugins ?? []).map((plugin)=>plugin.slug).filter((slug)=>typeof slug === 'string' && slug.startsWith('@payloadcms/'));
138
143
  export const getLocalizationInfo = (payload)=>{
139
144
  if (!payload.config.localization) {
140
145
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utilities/telemetry/index.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport ciInfo from 'ci-info'\nimport { randomBytes } from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\n\nimport type { Payload } from '../../types/index.js'\nimport type { AdminInitEvent } from './events/adminInit.js'\nimport type { ServerInitEvent } from './events/serverInit.js'\n\nimport { findUp } from '../findUp.js'\nimport { Conf } from './conf/index.js'\nimport { oneWayHash } from './oneWayHash.js'\n\nexport type BaseEvent = {\n ciName: null | string\n dbAdapter: string\n emailAdapter: null | string\n envID: string\n isCI: boolean\n locales: string[]\n localizationDefaultLocale: null | string\n localizationEnabled: boolean\n nodeEnv: string\n nodeVersion: string\n payloadVersion: string\n projectID: string\n projectIDSource: 'cwd' | 'git' | 'packageJSON' | 'serverURL'\n uploadAdapters: string[]\n}\n\ntype PackageJSON = {\n dependencies: Record<string, string | undefined>\n name: string\n}\n\ntype TelemetryEvent = AdminInitEvent | ServerInitEvent\n\ntype Args = {\n event: TelemetryEvent\n payload: Payload\n}\n\nlet baseEvent: BaseEvent | null = null\n\nexport const sendEvent = async ({ event, payload }: Args): Promise<void> => {\n try {\n if (payload.config.telemetry !== false) {\n const { packageJSON, packageJSONPath } = await getPackageJSON()\n\n // Only generate the base event once\n if (!baseEvent) {\n const { projectID, source: projectIDSource } = getProjectID(payload, packageJSON!)\n baseEvent = {\n ciName: ciInfo.isCI ? ciInfo.name : null,\n envID: getEnvID(),\n isCI: ciInfo.isCI,\n nodeEnv: process.env.NODE_ENV || 'development',\n nodeVersion: process.version,\n payloadVersion: getPayloadVersion(packageJSON!),\n projectID,\n projectIDSource,\n ...getLocalizationInfo(payload),\n dbAdapter: payload.db.name,\n emailAdapter: payload.email?.name || null,\n uploadAdapters: payload.config.upload.adapters,\n }\n }\n\n if (process.env.PAYLOAD_TELEMETRY_DEBUG) {\n payload.logger.info({\n event: { ...baseEvent, ...event, packageJSONPath },\n msg: 'Telemetry Event',\n })\n return\n }\n\n await fetch('https://telemetry.payloadcms.com/events', {\n body: JSON.stringify({ ...baseEvent, ...event }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'post',\n })\n }\n } catch (_) {\n // Eat any errors in sending telemetry event\n }\n}\n\n/**\n * This is a quasi-persistent identifier used to dedupe recurring events. It's\n * generated from random data and completely anonymous.\n */\nconst getEnvID = (): string => {\n const conf = new Conf()\n const ENV_ID = 'envID'\n\n const val = conf.get(ENV_ID)\n if (val) {\n return val as string\n }\n\n const generated = randomBytes(32).toString('hex')\n conf.set(ENV_ID, generated)\n return generated\n}\n\nconst getProjectID = (\n payload: Payload,\n packageJSON: PackageJSON,\n): { projectID: string; source: BaseEvent['projectIDSource'] } => {\n const gitID = getGitID(payload)\n if (gitID) {\n return { projectID: oneWayHash(gitID, payload.secret), source: 'git' }\n }\n\n const packageJSONID = getPackageJSONID(payload, packageJSON)\n if (packageJSONID) {\n return { projectID: oneWayHash(packageJSONID, payload.secret), source: 'packageJSON' }\n }\n\n const serverURL = payload.config.serverURL\n if (serverURL) {\n return { projectID: oneWayHash(serverURL, payload.secret), source: 'serverURL' }\n }\n\n const cwd = process.cwd()\n return { projectID: oneWayHash(cwd, payload.secret), source: 'cwd' }\n}\n\nconst getGitID = (payload: Payload) => {\n try {\n const originBuffer = execSync('git config --local --get remote.origin.url', {\n stdio: 'pipe',\n timeout: 1000,\n })\n\n return oneWayHash(String(originBuffer).trim(), payload.secret)\n } catch (_) {\n return null\n }\n}\n\nconst getPackageJSON = async (): Promise<{\n packageJSON?: PackageJSON\n packageJSONPath: string\n}> => {\n let packageJSONPath = path.resolve(process.cwd(), 'package.json')\n\n if (!fs.existsSync(packageJSONPath)) {\n // Old logic\n const filename = fileURLToPath(import.meta.url)\n const dirname = path.dirname(filename)\n packageJSONPath = (await findUp({\n dir: dirname,\n fileNames: ['package.json'],\n }))!\n }\n\n const jsonContentString = await fs.promises.readFile(packageJSONPath, 'utf-8')\n const jsonContent: PackageJSON = JSON.parse(jsonContentString)\n return { packageJSON: jsonContent, packageJSONPath }\n}\n\nconst getPackageJSONID = (payload: Payload, packageJSON: PackageJSON): string => {\n return oneWayHash(packageJSON.name, payload.secret)\n}\n\nexport const getPayloadVersion = (packageJSON: PackageJSON): string => {\n return packageJSON?.dependencies?.payload ?? ''\n}\n\nexport const getLocalizationInfo = (\n payload: Payload,\n): Pick<BaseEvent, 'locales' | 'localizationDefaultLocale' | 'localizationEnabled'> => {\n if (!payload.config.localization) {\n return {\n locales: [],\n localizationDefaultLocale: null,\n localizationEnabled: false,\n }\n }\n\n return {\n locales: payload.config.localization.localeCodes,\n localizationDefaultLocale: payload.config.localization.defaultLocale,\n localizationEnabled: true,\n }\n}\n"],"names":["execSync","ciInfo","randomBytes","fs","path","fileURLToPath","findUp","Conf","oneWayHash","baseEvent","sendEvent","event","payload","config","telemetry","packageJSON","packageJSONPath","getPackageJSON","projectID","source","projectIDSource","getProjectID","ciName","isCI","name","envID","getEnvID","nodeEnv","process","env","NODE_ENV","nodeVersion","version","payloadVersion","getPayloadVersion","getLocalizationInfo","dbAdapter","db","emailAdapter","email","uploadAdapters","upload","adapters","PAYLOAD_TELEMETRY_DEBUG","logger","info","msg","fetch","body","JSON","stringify","headers","method","_","conf","ENV_ID","val","get","generated","toString","set","gitID","getGitID","secret","packageJSONID","getPackageJSONID","serverURL","cwd","originBuffer","stdio","timeout","String","trim","resolve","existsSync","filename","url","dirname","dir","fileNames","jsonContentString","promises","readFile","jsonContent","parse","dependencies","localization","locales","localizationDefaultLocale","localizationEnabled","localeCodes","defaultLocale"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,OAAOC,YAAY,UAAS;AAC5B,SAASC,WAAW,QAAQ,SAAQ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rB,IAAID,kBAAkBZ,KAAKqE,OAAO,CAAC7C,QAAQuC,GAAG,IAAI;IAElD,IAAI,CAAChE,GAAGuE,UAAU,CAAC1D,kBAAkB;QACnC,YAAY;QACZ,MAAM2D,WAAWtE,cAAc,YAAYuE,GAAG;QAC9C,MAAMC,UAAUzE,KAAKyE,OAAO,CAACF;QAC7B3D,kBAAmB,MAAMV,OAAO;YAC9BwE,KAAKD;YACLE,WAAW;gBAAC;aAAe;QAC7B;IACF;IAEA,MAAMC,oBAAoB,MAAM7E,GAAG8E,QAAQ,CAACC,QAAQ,CAAClE,iBAAiB;IACtE,MAAMmE,cAA2BlC,KAAKmC,KAAK,CAACJ;IAC5C,OAAO;QAAEjE,aAAaoE;QAAanE;IAAgB;AACrD;AAEA,MAAMiD,mBAAmB,CAACrD,SAAkBG;IAC1C,OAAOP,WAAWO,YAAYS,IAAI,EAAEZ,QAAQmD,MAAM;AACpD;AAEA,OAAO,MAAM7B,oBAAoB,CAACnB;IAChC,OAAOA,aAAasE,cAAczE,WAAW;AAC/C,EAAC;AAED,OAAO,MAAMuB,sBAAsB,CACjCvB;IAEA,IAAI,CAACA,QAAQC,MAAM,CAACyE,YAAY,EAAE;QAChC,OAAO;YACLC,SAAS,EAAE;YACXC,2BAA2B;YAC3BC,qBAAqB;QACvB;IACF;IAEA,OAAO;QACLF,SAAS3E,QAAQC,MAAM,CAACyE,YAAY,CAACI,WAAW;QAChDF,2BAA2B5E,QAAQC,MAAM,CAACyE,YAAY,CAACK,aAAa;QACpEF,qBAAqB;IACvB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/utilities/telemetry/index.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport ciInfo from 'ci-info'\nimport { randomBytes } from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\n\nimport type { Payload } from '../../types/index.js'\nimport type { AdminInitEvent } from './events/adminInit.js'\nimport type { ServerInitEvent } from './events/serverInit.js'\n\nimport { findUp } from '../findUp.js'\nimport { Conf } from './conf/index.js'\nimport { oneWayHash } from './oneWayHash.js'\n\nexport type BaseEvent = {\n ciName: null | string\n dbAdapter: string\n emailAdapter: null | string\n envID: string\n isCI: boolean\n locales: string[]\n localizationDefaultLocale: null | string\n localizationEnabled: boolean\n nodeEnv: string\n nodeVersion: string\n payloadVersion: string\n /** Slugs of installed first-party (`@payloadcms/`) plugins. */\n plugins: string[]\n projectID: string\n projectIDSource: 'cwd' | 'git' | 'packageJSON' | 'serverURL'\n uploadAdapters: string[]\n}\n\ntype PackageJSON = {\n dependencies: Record<string, string | undefined>\n name: string\n}\n\ntype TelemetryEvent = AdminInitEvent | ServerInitEvent\n\ntype Args<TEvent extends { type: string } = TelemetryEvent> = {\n event: TEvent\n payload: Payload\n}\n\nlet baseEvent: BaseEvent | null = null\n\nexport const sendTelemetryEvent = async <TEvent extends { type: string }>({\n event,\n payload,\n}: Args<TEvent>): Promise<void> => {\n try {\n if (payload.config.telemetry !== false) {\n const { packageJSON, packageJSONPath } = await getPackageJSON()\n\n // Only generate the base event once\n if (!baseEvent) {\n const { projectID, source: projectIDSource } = getProjectID(payload, packageJSON!)\n baseEvent = {\n ciName: ciInfo.isCI ? ciInfo.name : null,\n envID: getEnvID(),\n isCI: ciInfo.isCI,\n nodeEnv: process.env.NODE_ENV || 'development',\n nodeVersion: process.version,\n payloadVersion: getPayloadVersion(packageJSON!),\n projectID,\n projectIDSource,\n ...getLocalizationInfo(payload),\n dbAdapter: payload.db.name,\n emailAdapter: payload.email?.name || null,\n plugins: getInstalledPluginSlugs(payload),\n uploadAdapters: payload.config.upload.adapters,\n }\n }\n\n if (process.env.PAYLOAD_TELEMETRY_DEBUG) {\n payload.logger.info({\n event: { ...baseEvent, ...event, packageJSONPath },\n msg: 'Telemetry Event',\n })\n return\n }\n\n await fetch('https://telemetry.payloadcms.com/events', {\n body: JSON.stringify({ ...baseEvent, ...event }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'post',\n })\n }\n } catch (_) {\n // Eat any errors in sending telemetry event\n }\n}\n\n/**\n * This is a quasi-persistent identifier used to dedupe recurring events. It's\n * generated from random data and completely anonymous.\n */\nconst getEnvID = (): string => {\n const conf = new Conf()\n const ENV_ID = 'envID'\n\n const val = conf.get(ENV_ID)\n if (val) {\n return val as string\n }\n\n const generated = randomBytes(32).toString('hex')\n conf.set(ENV_ID, generated)\n return generated\n}\n\nconst getProjectID = (\n payload: Payload,\n packageJSON: PackageJSON,\n): { projectID: string; source: BaseEvent['projectIDSource'] } => {\n const gitID = getGitID(payload)\n if (gitID) {\n return { projectID: oneWayHash(gitID, payload.secret), source: 'git' }\n }\n\n const packageJSONID = getPackageJSONID(payload, packageJSON)\n if (packageJSONID) {\n return { projectID: oneWayHash(packageJSONID, payload.secret), source: 'packageJSON' }\n }\n\n const serverURL = payload.config.serverURL\n if (serverURL) {\n return { projectID: oneWayHash(serverURL, payload.secret), source: 'serverURL' }\n }\n\n const cwd = process.cwd()\n return { projectID: oneWayHash(cwd, payload.secret), source: 'cwd' }\n}\n\nconst getGitID = (payload: Payload) => {\n try {\n const originBuffer = execSync('git config --local --get remote.origin.url', {\n stdio: 'pipe',\n timeout: 1000,\n })\n\n return oneWayHash(String(originBuffer).trim(), payload.secret)\n } catch (_) {\n return null\n }\n}\n\nconst getPackageJSON = async (): Promise<{\n packageJSON?: PackageJSON\n packageJSONPath: string\n}> => {\n let packageJSONPath = path.resolve(process.cwd(), 'package.json')\n\n if (!fs.existsSync(packageJSONPath)) {\n // Old logic\n const filename = fileURLToPath(import.meta.url)\n const dirname = path.dirname(filename)\n packageJSONPath = (await findUp({\n dir: dirname,\n fileNames: ['package.json'],\n }))!\n }\n\n const jsonContentString = await fs.promises.readFile(packageJSONPath, 'utf-8')\n const jsonContent: PackageJSON = JSON.parse(jsonContentString)\n return { packageJSON: jsonContent, packageJSONPath }\n}\n\nconst getPackageJSONID = (payload: Payload, packageJSON: PackageJSON): string => {\n return oneWayHash(packageJSON.name, payload.secret)\n}\n\nexport const getPayloadVersion = (packageJSON: PackageJSON): string => {\n return packageJSON?.dependencies?.payload ?? ''\n}\n\n/**\n * Slugs of installed first-party (`@payloadcms/`) plugins. Custom plugin slugs\n * are author-defined and can leak project details, so they are never collected.\n */\nexport const getInstalledPluginSlugs = (payload: Payload): string[] =>\n (payload.config.plugins ?? [])\n .map((plugin) => plugin.slug)\n .filter((slug): slug is string => typeof slug === 'string' && slug.startsWith('@payloadcms/'))\n\nexport const getLocalizationInfo = (\n payload: Payload,\n): Pick<BaseEvent, 'locales' | 'localizationDefaultLocale' | 'localizationEnabled'> => {\n if (!payload.config.localization) {\n return {\n locales: [],\n localizationDefaultLocale: null,\n localizationEnabled: false,\n }\n }\n\n return {\n locales: payload.config.localization.localeCodes,\n localizationDefaultLocale: payload.config.localization.defaultLocale,\n localizationEnabled: true,\n }\n}\n"],"names":["execSync","ciInfo","randomBytes","fs","path","fileURLToPath","findUp","Conf","oneWayHash","baseEvent","sendTelemetryEvent","event","payload","config","telemetry","packageJSON","packageJSONPath","getPackageJSON","projectID","source","projectIDSource","getProjectID","ciName","isCI","name","envID","getEnvID","nodeEnv","process","env","NODE_ENV","nodeVersion","version","payloadVersion","getPayloadVersion","getLocalizationInfo","dbAdapter","db","emailAdapter","email","plugins","getInstalledPluginSlugs","uploadAdapters","upload","adapters","PAYLOAD_TELEMETRY_DEBUG","logger","info","msg","fetch","body","JSON","stringify","headers","method","_","conf","ENV_ID","val","get","generated","toString","set","gitID","getGitID","secret","packageJSONID","getPackageJSONID","serverURL","cwd","originBuffer","stdio","timeout","String","trim","resolve","existsSync","filename","url","dirname","dir","fileNames","jsonContentString","promises","readFile","jsonContent","parse","dependencies","map","plugin","slug","filter","startsWith","localization","locales","localizationDefaultLocale","localizationEnabled","localeCodes","defaultLocale"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,OAAOC,YAAY,UAAS;AAC5B,SAASC,WAAW,QAAQ,SAAQ;AACpC,OAAOC,QAAQ,KAAI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
+ import { describe, expect, it } from 'vitest';
2
+ import { definePlugin } from '../../config/definePlugin.js';
3
+ import { getInstalledPluginSlugs } from './index.js';
4
+ // `getInstalledPluginSlugs` is what populates `baseEvent.plugins` - the list of
5
+ // installed plugin slugs sent with every telemetry event.
6
+ const payloadWithPlugins = (plugins)=>({
7
+ config: {
8
+ plugins
9
+ }
10
+ });
11
+ describe('telemetry installed plugins', ()=>{
12
+ it('should send only first-party slugs, ignoring custom and slug-less plugins', ()=>{
13
+ const seoPlugin = definePlugin({
14
+ slug: '@payloadcms/plugin-seo',
15
+ plugin: ({ config })=>config
16
+ })();
17
+ const stripePlugin = definePlugin({
18
+ slug: '@payloadcms/plugin-stripe',
19
+ plugin: ({ config })=>config
20
+ })();
21
+ // A user's own plugin — its slug is author-defined and must not be sent.
22
+ const customPlugin = definePlugin({
23
+ slug: 'acme-internal-billing',
24
+ plugin: ({ config })=>config
25
+ })();
26
+ const legacyPlugin = (config)=>config;
27
+ const slugs = getInstalledPluginSlugs(payloadWithPlugins([
28
+ seoPlugin,
29
+ stripePlugin,
30
+ customPlugin,
31
+ legacyPlugin
32
+ ]));
33
+ expect(slugs).toEqual([
34
+ '@payloadcms/plugin-seo',
35
+ '@payloadcms/plugin-stripe'
36
+ ]);
37
+ });
38
+ it('should send an empty array when no first-party plugins are installed', ()=>{
39
+ expect(getInstalledPluginSlugs(payloadWithPlugins([]))).toEqual([]);
40
+ });
41
+ });
42
+
43
+ //# sourceMappingURL=index.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utilities/telemetry/index.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport type { Plugin } from '../../config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nimport { definePlugin } from '../../config/definePlugin.js'\nimport { getInstalledPluginSlugs } from './index.js'\n\n// `getInstalledPluginSlugs` is what populates `baseEvent.plugins` - the list of\n// installed plugin slugs sent with every telemetry event.\nconst payloadWithPlugins = (plugins: Plugin[]): Payload =>\n ({ config: { plugins } }) as unknown as Payload\n\ndescribe('telemetry installed plugins', () => {\n it('should send only first-party slugs, ignoring custom and slug-less plugins', () => {\n const seoPlugin = definePlugin({\n slug: '@payloadcms/plugin-seo',\n plugin: ({ config }) => config,\n })()\n const stripePlugin = definePlugin({\n slug: '@payloadcms/plugin-stripe',\n plugin: ({ config }) => config,\n })()\n // A user's own plugin — its slug is author-defined and must not be sent.\n const customPlugin = definePlugin({\n slug: 'acme-internal-billing',\n plugin: ({ config }) => config,\n })()\n const legacyPlugin: Plugin = (config) => config\n\n const slugs = getInstalledPluginSlugs(\n payloadWithPlugins([seoPlugin, stripePlugin, customPlugin, legacyPlugin]),\n )\n\n expect(slugs).toEqual(['@payloadcms/plugin-seo', '@payloadcms/plugin-stripe'])\n })\n\n it('should send an empty array when no first-party plugins are installed', () => {\n expect(getInstalledPluginSlugs(payloadWithPlugins([]))).toEqual([])\n })\n})\n"],"names":["describe","expect","it","definePlugin","getInstalledPluginSlugs","payloadWithPlugins","plugins","config","seoPlugin","slug","plugin","stripePlugin","customPlugin","legacyPlugin","slugs","toEqual"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAK7C,SAASC,YAAY,QAAQ,+BAA8B;AAC3D,SAASC,uBAAuB,QAAQ,aAAY;AAEpD,gFAAgF;AAChF,0DAA0D;AAC1D,MAAMC,qBAAqB,CAACC,UACzB,CAAA;QAAEC,QAAQ;YAAED;QAAQ;IAAE,CAAA;AAEzBN,SAAS,+BAA+B;IACtCE,GAAG,6EAA6E;QAC9E,MAAMM,YAAYL,aAAa;YAC7BM,MAAM;YACNC,QAAQ,CAAC,EAAEH,MAAM,EAAE,GAAKA;QAC1B;QACA,MAAMI,eAAeR,aAAa;YAChCM,MAAM;YACNC,QAAQ,CAAC,EAAEH,MAAM,EAAE,GAAKA;QAC1B;QACA,yEAAyE;QACzE,MAAMK,eAAeT,aAAa;YAChCM,MAAM;YACNC,QAAQ,CAAC,EAAEH,MAAM,EAAE,GAAKA;QAC1B;QACA,MAAMM,eAAuB,CAACN,SAAWA;QAEzC,MAAMO,QAAQV,wBACZC,mBAAmB;YAACG;YAAWG;YAAcC;YAAcC;SAAa;QAG1EZ,OAAOa,OAAOC,OAAO,CAAC;YAAC;YAA0B;SAA4B;IAC/E;IAEAb,GAAG,wEAAwE;QACzED,OAAOG,wBAAwBC,mBAAmB,EAAE,IAAIU,OAAO,CAAC,EAAE;IACpE;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/versions/schedule/job.ts"],"sourcesContent":["import type { Field } from '../../fields/config/types.js'\nimport type { TypedUser } from '../../index.js'\nimport type { TaskConfig } from '../../queues/config/types/taskTypes.js'\nimport type { SchedulePublishTaskInput } from './types.js'\n\ntype Args = {\n adminUserSlug: string\n collections: string[]\n globals: string[]\n}\n\nexport const getSchedulePublishTask = ({\n adminUserSlug,\n collections,\n globals,\n}: Args): TaskConfig<{ input: SchedulePublishTaskInput; output: object }> => {\n return {\n slug: 'schedulePublish',\n handler: async ({ input, req }) => {\n const _status = input?.type === 'publish' || !input?.type ? 'published' : 'draft'\n\n const userID = input.user\n\n let user: null | TypedUser = null\n\n if (userID) {\n user = (await req.payload.findByID({\n id: userID,\n collection: adminUserSlug,\n depth: 0,\n })) as TypedUser\n\n user.collection = adminUserSlug\n }\n\n if (input.doc) {\n await req.payload.update({\n id: input.doc.value,\n collection: input.doc.relationTo,\n data: {\n _status,\n },\n depth: 0,\n locale: input.locale,\n overrideAccess: user === null,\n user,\n })\n }\n\n if (input.global) {\n await req.payload.updateGlobal({\n slug: input.global,\n data: {\n _status,\n },\n depth: 0,\n locale: input.locale,\n overrideAccess: user === null,\n user,\n })\n }\n\n return {\n output: {},\n }\n },\n inputSchema: [\n {\n name: 'type',\n type: 'radio',\n defaultValue: 'publish',\n options: ['publish', 'unpublish'],\n },\n {\n name: 'locale',\n type: 'text',\n },\n ...(collections.length > 0\n ? [\n {\n name: 'doc',\n type: 'relationship',\n relationTo: collections,\n } satisfies Field,\n ]\n : []),\n {\n name: 'global',\n type: 'select',\n options: globals,\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: adminUserSlug,\n },\n ],\n }\n}\n"],"names":["getSchedulePublishTask","adminUserSlug","collections","globals","slug","handler","input","req","_status","type","userID","user","payload","findByID","id","collection","depth","doc","update","value","relationTo","data","locale","overrideAccess","global","updateGlobal","output","inputSchema","name","defaultValue","options","length"],"mappings":"AAWA,OAAO,MAAMA,yBAAyB,CAAC,EACrCC,aAAa,EACbC,WAAW,EACXC,OAAO,EACF;IACL,OAAO;QACLC,MAAM;QACNC,SAAS,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;YAC5B,MAAMC,UAAUF,OAAOG,SAAS,aAAa,CAACH,OAAOG,OAAO,cAAc;YAE1E,MAAMC,SAASJ,MAAMK,IAAI;YAEzB,IAAIA,OAAyB;YAE7B,IAAID,QAAQ;gBACVC,OAAQ,MAAMJ,IAAIK,OAAO,CAACC,QAAQ,CAAC;oBACjCC,IAAIJ;oBACJK,YAAYd;oBACZe,OAAO;gBACT;gBAEAL,KAAKI,UAAU,GAAGd;YACpB;YAEA,IAAIK,MAAMW,GAAG,EAAE;gBACb,MAAMV,IAAIK,OAAO,CAACM,MAAM,CAAC;oBACvBJ,IAAIR,MAAMW,GAAG,CAACE,KAAK;oBACnBJ,YAAYT,MAAMW,GAAG,CAACG,UAAU;oBAChCC,MAAM;wBACJb;oBACF;oBACAQ,OAAO;oBACPM,QAAQhB,MAAMgB,MAAM;oBACpBC,gBAAgBZ,SAAS;oBACzBA;gBACF;YACF;YAEA,IAAIL,MAAMkB,MAAM,EAAE;gBAChB,MAAMjB,IAAIK,OAAO,CAACa,YAAY,CAAC;oBAC7BrB,MAAME,MAAMkB,MAAM;oBAClBH,MAAM;wBACJb;oBACF;oBACAQ,OAAO;oBACPM,QAAQhB,MAAMgB,MAAM;oBACpBC,gBAAgBZ,SAAS;oBACzBA;gBACF;YACF;YAEA,OAAO;gBACLe,QAAQ,CAAC;YACX;QACF;QACAC,aAAa;YACX;gBACEC,MAAM;gBACNnB,MAAM;gBACNoB,cAAc;gBACdC,SAAS;oBAAC;oBAAW;iBAAY;YACnC;YACA;gBACEF,MAAM;gBACNnB,MAAM;YACR;eACIP,YAAY6B,MAAM,GAAG,IACrB;gBACE;oBACEH,MAAM;oBACNnB,MAAM;oBACNW,YAAYlB;gBACd;aACD,GACD,EAAE;YACN;gBACE0B,MAAM;gBACNnB,MAAM;gBACNqB,SAAS3B;YACX;YACA;gBACEyB,MAAM;gBACNnB,MAAM;gBACNW,YAAYnB;YACd;SACD;IACH;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/versions/schedule/job.ts"],"sourcesContent":["import type { Field } from '../../fields/config/types.js'\nimport type { User } from '../../index.js'\nimport type { TaskConfig } from '../../queues/config/types/taskTypes.js'\nimport type { SchedulePublishTaskInput } from './types.js'\n\ntype Args = {\n adminUserSlug: string\n collections: string[]\n globals: string[]\n}\n\nexport const getSchedulePublishTask = ({\n adminUserSlug,\n collections,\n globals,\n}: Args): TaskConfig<{ input: SchedulePublishTaskInput; output: object }> => {\n return {\n slug: 'schedulePublish',\n handler: async ({ input, req }) => {\n const _status = input?.type === 'publish' || !input?.type ? 'published' : 'draft'\n\n const userID = input.user\n\n let user: null | User = null\n\n if (userID) {\n user = (await req.payload.findByID({\n id: userID,\n collection: adminUserSlug,\n depth: 0,\n })) as User\n\n user.collection = adminUserSlug\n }\n\n if (input.doc) {\n await req.payload.update({\n id: input.doc.value,\n collection: input.doc.relationTo,\n data: {\n _status,\n },\n depth: 0,\n locale: input.locale,\n overrideAccess: user === null,\n user,\n })\n }\n\n if (input.global) {\n await req.payload.updateGlobal({\n slug: input.global,\n data: {\n _status,\n },\n depth: 0,\n locale: input.locale,\n overrideAccess: user === null,\n user,\n })\n }\n\n return {\n output: {},\n }\n },\n inputSchema: [\n {\n name: 'type',\n type: 'radio',\n defaultValue: 'publish',\n options: ['publish', 'unpublish'],\n },\n {\n name: 'locale',\n type: 'text',\n },\n ...(collections.length > 0\n ? [\n {\n name: 'doc',\n type: 'relationship',\n relationTo: collections,\n } satisfies Field,\n ]\n : []),\n {\n name: 'global',\n type: 'select',\n options: globals,\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: adminUserSlug,\n },\n ],\n }\n}\n"],"names":["getSchedulePublishTask","adminUserSlug","collections","globals","slug","handler","input","req","_status","type","userID","user","payload","findByID","id","collection","depth","doc","update","value","relationTo","data","locale","overrideAccess","global","updateGlobal","output","inputSchema","name","defaultValue","options","length"],"mappings":"AAWA,OAAO,MAAMA,yBAAyB,CAAC,EACrCC,aAAa,EACbC,WAAW,EACXC,OAAO,EACF;IACL,OAAO;QACLC,MAAM;QACNC,SAAS,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;YAC5B,MAAMC,UAAUF,OAAOG,SAAS,aAAa,CAACH,OAAOG,OAAO,cAAc;YAE1E,MAAMC,SAASJ,MAAMK,IAAI;YAEzB,IAAIA,OAAoB;YAExB,IAAID,QAAQ;gBACVC,OAAQ,MAAMJ,IAAIK,OAAO,CAACC,QAAQ,CAAC;oBACjCC,IAAIJ;oBACJK,YAAYd;oBACZe,OAAO;gBACT;gBAEAL,KAAKI,UAAU,GAAGd;YACpB;YAEA,IAAIK,MAAMW,GAAG,EAAE;gBACb,MAAMV,IAAIK,OAAO,CAACM,MAAM,CAAC;oBACvBJ,IAAIR,MAAMW,GAAG,CAACE,KAAK;oBACnBJ,YAAYT,MAAMW,GAAG,CAACG,UAAU;oBAChCC,MAAM;wBACJb;oBACF;oBACAQ,OAAO;oBACPM,QAAQhB,MAAMgB,MAAM;oBACpBC,gBAAgBZ,SAAS;oBACzBA;gBACF;YACF;YAEA,IAAIL,MAAMkB,MAAM,EAAE;gBAChB,MAAMjB,IAAIK,OAAO,CAACa,YAAY,CAAC;oBAC7BrB,MAAME,MAAMkB,MAAM;oBAClBH,MAAM;wBACJb;oBACF;oBACAQ,OAAO;oBACPM,QAAQhB,MAAMgB,MAAM;oBACpBC,gBAAgBZ,SAAS;oBACzBA;gBACF;YACF;YAEA,OAAO;gBACLe,QAAQ,CAAC;YACX;QACF;QACAC,aAAa;YACX;gBACEC,MAAM;gBACNnB,MAAM;gBACNoB,cAAc;gBACdC,SAAS;oBAAC;oBAAW;iBAAY;YACnC;YACA;gBACEF,MAAM;gBACNnB,MAAM;YACR;eACIP,YAAY6B,MAAM,GAAG,IACrB;gBACE;oBACEH,MAAM;oBACNnB,MAAM;oBACNW,YAAYlB;gBACd;aACD,GACD,EAAE;YACN;gBACE0B,MAAM;gBACNnB,MAAM;gBACNqB,SAAS3B;YACX;YACA;gBACEyB,MAAM;gBACNnB,MAAM;gBACNW,YAAYnB;YACd;SACD;IACH;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "4.0.0-internal.2fddfc0",
3
+ "version": "4.0.0-internal.3aa3d85",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -115,10 +115,10 @@
115
115
  "sanitize-filename": "1.6.4",
116
116
  "ts-essentials": "10.0.3",
117
117
  "tsx": "4.22.4",
118
- "undici": "7.25.0",
118
+ "undici": "7.28.0",
119
119
  "uuid": "14.0.0",
120
120
  "ws": "^8.16.0",
121
- "@payloadcms/translations": "4.0.0-internal.2fddfc0"
121
+ "@payloadcms/translations": "4.0.0-internal.3aa3d85"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
@@ -1,89 +0,0 @@
1
- import type { TextFieldClientProps } from '../../../admin/types.js';
2
- import type { TypeWithID } from '../../../collections/config/types.js';
3
- import type { FieldAdmin, RowField, TextField } from '../../../fields/config/types.js';
4
- import type { PayloadRequest } from '../../../types/index.js';
5
- export type Slugify<T extends TypeWithID = any> = (args: {
6
- data: T;
7
- req: PayloadRequest;
8
- valueToSlugify?: any;
9
- }) => Promise<string | undefined> | string | undefined;
10
- export type SlugFieldArgs = {
11
- /**
12
- * Override for the `generateSlug` checkbox field name.
13
- * @default 'generateSlug'
14
- */
15
- checkboxName?: string;
16
- /**
17
- * Disables the unique index on the field.
18
- * This is useful if instead, you want to add a compound unique index to the collection `indexes` config,
19
- * for example with the multi tenant plugin, where the slug is only unique per tenant, not globally.
20
- * @default false
21
- */
22
- disableUnique?: boolean;
23
- /**
24
- * @deprecated use `useAsSlug` instead.
25
- */
26
- fieldToUse?: string;
27
- /**
28
- * Enable localization for the slug field.
29
- */
30
- localized?: TextField['localized'];
31
- /**
32
- * Override for the `slug` field name.
33
- * @default 'slug'
34
- */
35
- name?: string;
36
- /**
37
- * A function used to override the slug field(s) at a granular level.
38
- * Passes the row field to you to manipulate beyond the exposed options.
39
- * @example
40
- * ```ts
41
- * slugField({
42
- * overrides: (field) => {
43
- * field.fields[1].label = 'Custom Slug Label'
44
- * return field
45
- * }
46
- * })
47
- * ```
48
- */
49
- overrides?: (field: RowField) => RowField;
50
- position?: FieldAdmin['position'];
51
- /**
52
- * Whether or not the `slug` field is required.
53
- * @default true
54
- */
55
- required?: TextField['required'];
56
- /**
57
- * Provide your own slugify function to override the default.
58
- */
59
- slugify?: Slugify;
60
- /**
61
- * The name of the top-level field to generate the slug from, when applicable.
62
- * @default 'title'
63
- */
64
- useAsSlug?: string;
65
- };
66
- export type SlugField = (args?: SlugFieldArgs) => RowField;
67
- export type SlugFieldClientPropsOnly = Pick<SlugFieldArgs, 'useAsSlug'>;
68
- /**
69
- * These are the props that the `SlugField` client component accepts.
70
- * The `SlugField` server component is responsible for passing down the `slugify` function.
71
- */
72
- export type SlugFieldClientProps = SlugFieldClientPropsOnly & TextFieldClientProps;
73
- /**
74
- * A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.
75
- * The `slug` field auto-generates its value based on another field, e.g. "My Title" → "my-title".
76
- *
77
- * The slug should continue to be generated through:
78
- * 1. The `create` operation, unless the user has modified the slug manually
79
- * 2. The `update` operation, if:
80
- * a. Autosave is _not_ enabled and there is no slug
81
- * b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually
82
- *
83
- * The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.
84
- * This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.
85
- *
86
- * @experimental This field is experimental and may change or be removed in the future. Use at your own risk.
87
- */
88
- export declare const slugField: SlugField;
89
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/baseFields/slug/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,UAAU,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IACvD,IAAI,EAAE,CAAC,CAAA;IACP,GAAG,EAAE,cAAc,CAAA;IACnB,cAAc,CAAC,EAAE,GAAG,CAAA;CACrB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,QAAQ,CAAA;IACzC,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,EAAE,aAAa,KAAK,QAAQ,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACvE;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG,oBAAoB,CAAA;AAElF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,EAAE,SAoEvB,CAAA"}
@@ -1,81 +0,0 @@
1
- import { generateSlug } from './generateSlug.js';
2
- /**
3
- * A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.
4
- * The `slug` field auto-generates its value based on another field, e.g. "My Title" → "my-title".
5
- *
6
- * The slug should continue to be generated through:
7
- * 1. The `create` operation, unless the user has modified the slug manually
8
- * 2. The `update` operation, if:
9
- * a. Autosave is _not_ enabled and there is no slug
10
- * b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually
11
- *
12
- * The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.
13
- * This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.
14
- *
15
- * @experimental This field is experimental and may change or be removed in the future. Use at your own risk.
16
- */ export const slugField = ({ name: slugFieldName = 'slug', checkboxName = 'generateSlug', disableUnique = false, fieldToUse, localized, overrides, position = 'sidebar', required = true, slugify, useAsSlug: useAsSlugFromArgs = 'title' } = {})=>{
17
- const useAsSlug = fieldToUse || useAsSlugFromArgs;
18
- const baseField = {
19
- type: 'row',
20
- admin: {
21
- position
22
- },
23
- fields: [
24
- {
25
- name: checkboxName,
26
- type: 'checkbox',
27
- admin: {
28
- description: 'When enabled, the slug will auto-generate from the title field on save and autosave.',
29
- disabled: {
30
- bulkEdit: true,
31
- column: true,
32
- filter: true,
33
- groupBy: true
34
- },
35
- hidden: true
36
- },
37
- defaultValue: true,
38
- hooks: {
39
- beforeChange: [
40
- generateSlug({
41
- slugFieldName,
42
- slugify,
43
- useAsSlug
44
- })
45
- ]
46
- },
47
- localized
48
- },
49
- {
50
- name: slugFieldName,
51
- type: 'text',
52
- admin: {
53
- components: {
54
- Field: {
55
- clientProps: {
56
- useAsSlug
57
- },
58
- path: '@payloadcms/ui#SlugField'
59
- }
60
- },
61
- width: '100%'
62
- },
63
- custom: {
64
- /**
65
- * This is needed so we can access it from the `slugifyHandler` server function.
66
- */ slugify
67
- },
68
- index: true,
69
- localized,
70
- required,
71
- unique: !disableUnique
72
- }
73
- ]
74
- };
75
- if (typeof overrides === 'function') {
76
- return overrides(baseField);
77
- }
78
- return baseField;
79
- };
80
-
81
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/fields/baseFields/slug/index.ts"],"sourcesContent":["import type { TextFieldClientProps } from '../../../admin/types.js'\nimport type { TypeWithID } from '../../../collections/config/types.js'\nimport type { FieldAdmin, RowField, TextField } from '../../../fields/config/types.js'\nimport type { PayloadRequest } from '../../../types/index.js'\n\nimport { generateSlug } from './generateSlug.js'\n\nexport type Slugify<T extends TypeWithID = any> = (args: {\n data: T\n req: PayloadRequest\n valueToSlugify?: any\n}) => Promise<string | undefined> | string | undefined\n\nexport type SlugFieldArgs = {\n /**\n * Override for the `generateSlug` checkbox field name.\n * @default 'generateSlug'\n */\n checkboxName?: string\n /**\n * Disables the unique index on the field.\n * This is useful if instead, you want to add a compound unique index to the collection `indexes` config,\n * for example with the multi tenant plugin, where the slug is only unique per tenant, not globally.\n * @default false\n */\n disableUnique?: boolean\n /**\n * @deprecated use `useAsSlug` instead.\n */\n fieldToUse?: string\n /**\n * Enable localization for the slug field.\n */\n localized?: TextField['localized']\n /**\n * Override for the `slug` field name.\n * @default 'slug'\n */\n name?: string\n /**\n * A function used to override the slug field(s) at a granular level.\n * Passes the row field to you to manipulate beyond the exposed options.\n * @example\n * ```ts\n * slugField({\n * overrides: (field) => {\n * field.fields[1].label = 'Custom Slug Label'\n * return field\n * }\n * })\n * ```\n */\n overrides?: (field: RowField) => RowField\n position?: FieldAdmin['position']\n /**\n * Whether or not the `slug` field is required.\n * @default true\n */\n required?: TextField['required']\n /**\n * Provide your own slugify function to override the default.\n */\n slugify?: Slugify\n /**\n * The name of the top-level field to generate the slug from, when applicable.\n * @default 'title'\n */\n useAsSlug?: string\n}\n\nexport type SlugField = (args?: SlugFieldArgs) => RowField\n\nexport type SlugFieldClientPropsOnly = Pick<SlugFieldArgs, 'useAsSlug'>\n/**\n * These are the props that the `SlugField` client component accepts.\n * The `SlugField` server component is responsible for passing down the `slugify` function.\n */\nexport type SlugFieldClientProps = SlugFieldClientPropsOnly & TextFieldClientProps\n\n/**\n * A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.\n * The `slug` field auto-generates its value based on another field, e.g. \"My Title\" → \"my-title\".\n *\n * The slug should continue to be generated through:\n * 1. The `create` operation, unless the user has modified the slug manually\n * 2. The `update` operation, if:\n * a. Autosave is _not_ enabled and there is no slug\n * b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually\n *\n * The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.\n * This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.\n *\n * @experimental This field is experimental and may change or be removed in the future. Use at your own risk.\n */\nexport const slugField: SlugField = ({\n name: slugFieldName = 'slug',\n checkboxName = 'generateSlug',\n disableUnique = false,\n fieldToUse,\n localized,\n overrides,\n position = 'sidebar',\n required = true,\n slugify,\n useAsSlug: useAsSlugFromArgs = 'title',\n} = {}) => {\n const useAsSlug = fieldToUse || useAsSlugFromArgs\n\n const baseField: RowField = {\n type: 'row',\n admin: {\n position,\n },\n fields: [\n {\n name: checkboxName,\n type: 'checkbox',\n admin: {\n description:\n 'When enabled, the slug will auto-generate from the title field on save and autosave.',\n disabled: { bulkEdit: true, column: true, filter: true, groupBy: true },\n hidden: true,\n },\n defaultValue: true,\n hooks: {\n beforeChange: [generateSlug({ slugFieldName, slugify, useAsSlug })],\n },\n localized,\n },\n {\n name: slugFieldName,\n type: 'text',\n admin: {\n components: {\n Field: {\n clientProps: {\n useAsSlug,\n } satisfies SlugFieldClientPropsOnly,\n path: '@payloadcms/ui#SlugField',\n },\n },\n width: '100%',\n },\n custom: {\n /**\n * This is needed so we can access it from the `slugifyHandler` server function.\n */\n slugify,\n },\n index: true,\n localized,\n required,\n unique: !disableUnique,\n },\n ],\n }\n\n if (typeof overrides === 'function') {\n return overrides(baseField)\n }\n\n return baseField\n}\n"],"names":["generateSlug","slugField","name","slugFieldName","checkboxName","disableUnique","fieldToUse","localized","overrides","position","required","slugify","useAsSlug","useAsSlugFromArgs","baseField","type","admin","fields","description","disabled","bulkEdit","column","filter","groupBy","hidden","defaultValue","hooks","beforeChange","components","Field","clientProps","path","width","custom","index","unique"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AA0EhD;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,YAAuB,CAAC,EACnCC,MAAMC,gBAAgB,MAAM,EAC5BC,eAAe,cAAc,EAC7BC,gBAAgB,KAAK,EACrBC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,WAAW,SAAS,EACpBC,WAAW,IAAI,EACfC,OAAO,EACPC,WAAWC,oBAAoB,OAAO,EACvC,GAAG,CAAC,CAAC;IACJ,MAAMD,YAAYN,cAAcO;IAEhC,MAAMC,YAAsB;QAC1BC,MAAM;QACNC,OAAO;YACLP;QACF;QACAQ,QAAQ;YACN;gBACEf,MAAME;gBACNW,MAAM;gBACNC,OAAO;oBACLE,aACE;oBACFC,UAAU;wBAAEC,UAAU;wBAAMC,QAAQ;wBAAMC,QAAQ;wBAAMC,SAAS;oBAAK;oBACtEC,QAAQ;gBACV;gBACAC,cAAc;gBACdC,OAAO;oBACLC,cAAc;wBAAC3B,aAAa;4BAAEG;4BAAeQ;4BAASC;wBAAU;qBAAG;gBACrE;gBACAL;YACF;YACA;gBACEL,MAAMC;gBACNY,MAAM;gBACNC,OAAO;oBACLY,YAAY;wBACVC,OAAO;4BACLC,aAAa;gCACXlB;4BACF;4BACAmB,MAAM;wBACR;oBACF;oBACAC,OAAO;gBACT;gBACAC,QAAQ;oBACN;;WAEC,GACDtB;gBACF;gBACAuB,OAAO;gBACP3B;gBACAG;gBACAyB,QAAQ,CAAC9B;YACX;SACD;IACH;IAEA,IAAI,OAAOG,cAAc,YAAY;QACnC,OAAOA,UAAUM;IACnB;IAEA,OAAOA;AACT,EAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Whether React Server Components are supported in the current environment.
3
- * Controlled by the `PAYLOAD_FRAMEWORK_RSC_ENABLED` environment variable.
4
- *
5
- * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=true` → RSC is available (set by Next.js `withPayload` and
6
- * TanStack Start's `payloadPlugin` via `@vitejs/plugin-rsc`)
7
- * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=false` → RSC is NOT available
8
- *
9
- * Defaults to `true` when the variable is not set.
10
- */
11
- export declare function isRSCEnabled(): boolean;
12
- //# sourceMappingURL=isRSCEnabled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRSCEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/isRSCEnabled.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Whether React Server Components are supported in the current environment.
3
- * Controlled by the `PAYLOAD_FRAMEWORK_RSC_ENABLED` environment variable.
4
- *
5
- * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=true` → RSC is available (set by Next.js `withPayload` and
6
- * TanStack Start's `payloadPlugin` via `@vitejs/plugin-rsc`)
7
- * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=false` → RSC is NOT available
8
- *
9
- * Defaults to `true` when the variable is not set.
10
- */ export function isRSCEnabled() {
11
- return process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED !== 'false';
12
- }
13
-
14
- //# sourceMappingURL=isRSCEnabled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/isRSCEnabled.ts"],"sourcesContent":["/**\n * Whether React Server Components are supported in the current environment.\n * Controlled by the `PAYLOAD_FRAMEWORK_RSC_ENABLED` environment variable.\n *\n * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=true` → RSC is available (set by Next.js `withPayload` and\n * TanStack Start's `payloadPlugin` via `@vitejs/plugin-rsc`)\n * - `PAYLOAD_FRAMEWORK_RSC_ENABLED=false` → RSC is NOT available\n *\n * Defaults to `true` when the variable is not set.\n */\nexport function isRSCEnabled(): boolean {\n return process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED !== 'false'\n}\n"],"names":["isRSCEnabled","process","env","PAYLOAD_FRAMEWORK_RSC_ENABLED"],"mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,SAASA;IACd,OAAOC,QAAQC,GAAG,CAACC,6BAA6B,KAAK;AACvD"}