payload 4.0.0-internal.cd69eef → 4.0.0-internal.d1cc1d3

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 (279) hide show
  1. package/dist/admin/RichText.d.ts +1 -1
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/functions/index.d.ts +10 -8
  5. package/dist/admin/functions/index.d.ts.map +1 -1
  6. package/dist/admin/functions/index.js.map +1 -1
  7. package/dist/admin/types.d.ts +2 -2
  8. package/dist/admin/types.d.ts.map +1 -1
  9. package/dist/admin/types.js.map +1 -1
  10. package/dist/auth/endpoints/login.d.ts.map +1 -1
  11. package/dist/auth/endpoints/login.js +2 -11
  12. package/dist/auth/endpoints/login.js.map +1 -1
  13. package/dist/auth/loginWithCookie.d.ts +33 -0
  14. package/dist/auth/loginWithCookie.d.ts.map +1 -0
  15. package/dist/auth/loginWithCookie.js +34 -0
  16. package/dist/auth/loginWithCookie.js.map +1 -0
  17. package/dist/auth/serverFunctions/cookies.d.ts +47 -0
  18. package/dist/auth/serverFunctions/cookies.d.ts.map +1 -0
  19. package/dist/auth/serverFunctions/cookies.js +52 -0
  20. package/dist/auth/serverFunctions/cookies.js.map +1 -0
  21. package/dist/auth/serverFunctions/login.d.ts +29 -0
  22. package/dist/auth/serverFunctions/login.d.ts.map +1 -0
  23. package/dist/auth/serverFunctions/login.js +63 -0
  24. package/dist/auth/serverFunctions/login.js.map +1 -0
  25. package/dist/auth/serverFunctions/logout.d.ts +17 -0
  26. package/dist/auth/serverFunctions/logout.d.ts.map +1 -0
  27. package/dist/auth/serverFunctions/logout.js +58 -0
  28. package/dist/auth/serverFunctions/logout.js.map +1 -0
  29. package/dist/auth/serverFunctions/refresh.d.ts +17 -0
  30. package/dist/auth/serverFunctions/refresh.d.ts.map +1 -0
  31. package/dist/auth/serverFunctions/refresh.js +61 -0
  32. package/dist/auth/serverFunctions/refresh.js.map +1 -0
  33. package/dist/collections/config/client.d.ts +2 -3
  34. package/dist/collections/config/client.d.ts.map +1 -1
  35. package/dist/collections/config/client.js +5 -7
  36. package/dist/collections/config/client.js.map +1 -1
  37. package/dist/collections/config/defaults.d.ts.map +1 -1
  38. package/dist/collections/config/defaults.js +1 -0
  39. package/dist/collections/config/defaults.js.map +1 -1
  40. package/dist/collections/config/sanitize.d.ts +3 -8
  41. package/dist/collections/config/sanitize.d.ts.map +1 -1
  42. package/dist/collections/config/sanitize.js +2 -6
  43. package/dist/collections/config/sanitize.js.map +1 -1
  44. package/dist/collections/config/types.d.ts +1 -1
  45. package/dist/collections/config/types.d.ts.map +1 -1
  46. package/dist/collections/config/types.js.map +1 -1
  47. package/dist/collections/config/useAsTitle.spec.js +27 -27
  48. package/dist/collections/config/useAsTitle.spec.js.map +1 -1
  49. package/dist/collections/operations/create.d.ts.map +1 -1
  50. package/dist/collections/operations/create.js +10 -0
  51. package/dist/collections/operations/create.js.map +1 -1
  52. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  53. package/dist/collections/operations/restoreVersion.js +7 -4
  54. package/dist/collections/operations/restoreVersion.js.map +1 -1
  55. package/dist/collections/operations/updateByID.js +1 -0
  56. package/dist/collections/operations/updateByID.js.map +1 -1
  57. package/dist/config/build.js +1 -1
  58. package/dist/config/build.js.map +1 -1
  59. package/dist/config/defaults.d.ts.map +1 -1
  60. package/dist/config/defaults.js +5 -2
  61. package/dist/config/defaults.js.map +1 -1
  62. package/dist/config/orderable/index.d.ts +1 -1
  63. package/dist/config/orderable/index.d.ts.map +1 -1
  64. package/dist/config/orderable/index.js +2 -2
  65. package/dist/config/orderable/index.js.map +1 -1
  66. package/dist/config/sanitize.d.ts +1 -1
  67. package/dist/config/sanitize.d.ts.map +1 -1
  68. package/dist/config/sanitize.js +33 -40
  69. package/dist/config/sanitize.js.map +1 -1
  70. package/dist/config/types.d.ts +1 -1
  71. package/dist/config/types.js.map +1 -1
  72. package/dist/database/createDatabaseAdapter.d.ts +1 -1
  73. package/dist/database/createDatabaseAdapter.d.ts.map +1 -1
  74. package/dist/database/createDatabaseAdapter.js +0 -2
  75. package/dist/database/createDatabaseAdapter.js.map +1 -1
  76. package/dist/database/types.d.ts +6 -0
  77. package/dist/database/types.d.ts.map +1 -1
  78. package/dist/database/types.js.map +1 -1
  79. package/dist/exports/auth.d.ts +5 -0
  80. package/dist/exports/auth.d.ts.map +1 -0
  81. package/dist/exports/auth.js +6 -0
  82. package/dist/exports/auth.js.map +1 -0
  83. package/dist/exports/internal.d.ts +2 -0
  84. package/dist/exports/internal.d.ts.map +1 -1
  85. package/dist/exports/internal.js +3 -1
  86. package/dist/exports/internal.js.map +1 -1
  87. package/dist/fields/baseFields/slug/duplicateContext.d.ts +11 -0
  88. package/dist/fields/baseFields/slug/duplicateContext.d.ts.map +1 -0
  89. package/dist/fields/baseFields/slug/duplicateContext.js +21 -0
  90. package/dist/fields/baseFields/slug/duplicateContext.js.map +1 -0
  91. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts +22 -0
  92. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts.map +1 -0
  93. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js +63 -0
  94. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js.map +1 -0
  95. package/dist/fields/baseFields/slug/generateSlug.d.ts +13 -8
  96. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  97. package/dist/fields/baseFields/slug/generateSlug.js +98 -45
  98. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  99. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts +18 -0
  100. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts.map +1 -0
  101. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js +20 -0
  102. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js.map +1 -0
  103. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts +22 -0
  104. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts.map +1 -0
  105. package/dist/fields/baseFields/slug/getSlugFallbackValue.js +23 -0
  106. package/dist/fields/baseFields/slug/getSlugFallbackValue.js.map +1 -0
  107. package/dist/fields/baseFields/slug/hasValue.d.ts +3 -0
  108. package/dist/fields/baseFields/slug/hasValue.d.ts.map +1 -0
  109. package/dist/fields/baseFields/slug/hasValue.js +3 -0
  110. package/dist/fields/baseFields/slug/hasValue.js.map +1 -0
  111. package/dist/fields/config/reservedFieldNames.spec.js +18 -18
  112. package/dist/fields/config/reservedFieldNames.spec.js.map +1 -1
  113. package/dist/fields/config/sanitize.d.ts +3 -9
  114. package/dist/fields/config/sanitize.d.ts.map +1 -1
  115. package/dist/fields/config/sanitize.js +33 -34
  116. package/dist/fields/config/sanitize.js.map +1 -1
  117. package/dist/fields/config/sanitize.spec.js +128 -105
  118. package/dist/fields/config/sanitize.spec.js.map +1 -1
  119. package/dist/fields/config/types.d.ts +4 -3
  120. package/dist/fields/config/types.d.ts.map +1 -1
  121. package/dist/fields/config/types.js.map +1 -1
  122. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  123. package/dist/fields/hooks/beforeValidate/promise.js +5 -3
  124. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  125. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts +10 -0
  126. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts.map +1 -0
  127. package/dist/fields/hooks/beforeValidate/stripNullRows.js +18 -0
  128. package/dist/fields/hooks/beforeValidate/stripNullRows.js.map +1 -0
  129. package/dist/fields/validations.d.ts.map +1 -1
  130. package/dist/fields/validations.js +7 -8
  131. package/dist/fields/validations.js.map +1 -1
  132. package/dist/fields/validations.spec.js +61 -37
  133. package/dist/fields/validations.spec.js.map +1 -1
  134. package/dist/globals/config/sanitize.d.ts +2 -7
  135. package/dist/globals/config/sanitize.d.ts.map +1 -1
  136. package/dist/globals/config/sanitize.js +2 -6
  137. package/dist/globals/config/sanitize.js.map +1 -1
  138. package/dist/globals/config/sanitize.spec.js +6 -6
  139. package/dist/globals/config/sanitize.spec.js.map +1 -1
  140. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  141. package/dist/globals/operations/countGlobalVersions.js +1 -0
  142. package/dist/globals/operations/countGlobalVersions.js.map +1 -1
  143. package/dist/index.bundled.d.ts +247 -178
  144. package/dist/index.d.ts +49 -17
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +3 -0
  147. package/dist/index.js.map +1 -1
  148. package/dist/query-presets/constraints.js +1 -1
  149. package/dist/query-presets/constraints.js.map +1 -1
  150. package/dist/queues/config/collection.d.ts.map +1 -1
  151. package/dist/queues/config/collection.js +37 -43
  152. package/dist/queues/config/collection.js.map +1 -1
  153. package/dist/queues/config/global.d.ts +5 -6
  154. package/dist/queues/config/global.d.ts.map +1 -1
  155. package/dist/queues/config/global.js +1 -1
  156. package/dist/queues/config/global.js.map +1 -1
  157. package/dist/queues/config/types/index.d.ts +29 -24
  158. package/dist/queues/config/types/index.d.ts.map +1 -1
  159. package/dist/queues/config/types/index.js.map +1 -1
  160. package/dist/queues/config/types/taskTypes.d.ts +4 -7
  161. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  162. package/dist/queues/config/types/taskTypes.js.map +1 -1
  163. package/dist/queues/config/types/workflowJSONTypes.d.ts +10 -9
  164. package/dist/queues/config/types/workflowJSONTypes.d.ts.map +1 -1
  165. package/dist/queues/config/types/workflowJSONTypes.js.map +1 -1
  166. package/dist/queues/config/types/workflowTypes.d.ts +11 -58
  167. package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
  168. package/dist/queues/config/types/workflowTypes.js.map +1 -1
  169. package/dist/queues/endpoints/handleSchedules.js +1 -1
  170. package/dist/queues/endpoints/handleSchedules.js.map +1 -1
  171. package/dist/queues/errors/handleTaskError.js +4 -4
  172. package/dist/queues/errors/handleTaskError.js.map +1 -1
  173. package/dist/queues/errors/handleWorkflowError.js +1 -1
  174. package/dist/queues/errors/handleWorkflowError.js.map +1 -1
  175. package/dist/queues/errors/index.d.ts +6 -0
  176. package/dist/queues/errors/index.d.ts.map +1 -1
  177. package/dist/queues/errors/index.js +5 -0
  178. package/dist/queues/errors/index.js.map +1 -1
  179. package/dist/queues/localAPI.d.ts +4 -4
  180. package/dist/queues/localAPI.d.ts.map +1 -1
  181. package/dist/queues/localAPI.js +63 -66
  182. package/dist/queues/localAPI.js.map +1 -1
  183. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts +4 -4
  184. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts.map +1 -1
  185. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js.map +1 -1
  186. package/dist/queues/operations/handleSchedules/index.d.ts +1 -1
  187. package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
  188. package/dist/queues/operations/handleSchedules/index.js +1 -1
  189. package/dist/queues/operations/handleSchedules/index.js.map +1 -1
  190. package/dist/queues/operations/runJobs/heartbeat.d.ts +13 -0
  191. package/dist/queues/operations/runJobs/heartbeat.d.ts.map +1 -0
  192. package/dist/queues/operations/runJobs/heartbeat.js +66 -0
  193. package/dist/queues/operations/runJobs/heartbeat.js.map +1 -0
  194. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  195. package/dist/queues/operations/runJobs/index.js +133 -84
  196. package/dist/queues/operations/runJobs/index.js.map +1 -1
  197. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  198. package/dist/queues/operations/runJobs/runJSONJob/index.js +6 -3
  199. package/dist/queues/operations/runJobs/runJSONJob/index.js.map +1 -1
  200. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -5
  201. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  202. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts +2 -1
  203. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
  204. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +39 -8
  205. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  206. package/dist/queues/operations/runJobs/runJob/importHandlerPath.js.map +1 -1
  207. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  208. package/dist/queues/operations/runJobs/runJob/index.js +4 -4
  209. package/dist/queues/operations/runJobs/runJob/index.js.map +1 -1
  210. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  211. package/dist/queues/utilities/updateJob.js +3 -0
  212. package/dist/queues/utilities/updateJob.js.map +1 -1
  213. package/dist/types/index.d.ts +2 -2
  214. package/dist/types/index.d.ts.map +1 -1
  215. package/dist/types/index.js.map +1 -1
  216. package/dist/uploads/checkFileRestrictions.d.ts +1 -1
  217. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  218. package/dist/uploads/checkFileRestrictions.js +15 -1
  219. package/dist/uploads/checkFileRestrictions.js.map +1 -1
  220. package/dist/uploads/endpoints/uploadInstructions.d.ts +12 -0
  221. package/dist/uploads/endpoints/uploadInstructions.d.ts.map +1 -1
  222. package/dist/uploads/endpoints/uploadInstructions.js +66 -20
  223. package/dist/uploads/endpoints/uploadInstructions.js.map +1 -1
  224. package/dist/uploads/generateFileData.js +4 -1
  225. package/dist/uploads/generateFileData.js.map +1 -1
  226. package/dist/uploads/getFileFromUploadInstructions.d.ts +8 -0
  227. package/dist/uploads/getFileFromUploadInstructions.d.ts.map +1 -0
  228. package/dist/uploads/getFileFromUploadInstructions.js +62 -0
  229. package/dist/uploads/getFileFromUploadInstructions.js.map +1 -0
  230. package/dist/uploads/getImageSize.d.ts +12 -1
  231. package/dist/uploads/getImageSize.d.ts.map +1 -1
  232. package/dist/uploads/getImageSize.js +20 -18
  233. package/dist/uploads/getImageSize.js.map +1 -1
  234. package/dist/uploads/getImageSize.spec.js +298 -0
  235. package/dist/uploads/getImageSize.spec.js.map +1 -0
  236. package/dist/uploads/probeImageSize.d.ts +39 -0
  237. package/dist/uploads/probeImageSize.d.ts.map +1 -0
  238. package/dist/uploads/probeImageSize.js +374 -0
  239. package/dist/uploads/probeImageSize.js.map +1 -0
  240. package/dist/uploads/probeImageSize.spec.js +366 -0
  241. package/dist/uploads/probeImageSize.spec.js.map +1 -0
  242. package/dist/uploads/stagedUpload.d.ts +27 -0
  243. package/dist/uploads/stagedUpload.d.ts.map +1 -0
  244. package/dist/uploads/stagedUpload.js +197 -0
  245. package/dist/uploads/stagedUpload.js.map +1 -0
  246. package/dist/uploads/types.d.ts +41 -13
  247. package/dist/uploads/types.d.ts.map +1 -1
  248. package/dist/uploads/types.js.map +1 -1
  249. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  250. package/dist/utilities/addDataAndFileToRequest.js +12 -46
  251. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  252. package/dist/utilities/configToJSONSchema.spec.js +33 -33
  253. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  254. package/dist/utilities/fieldValueExists.d.ts +29 -0
  255. package/dist/utilities/fieldValueExists.d.ts.map +1 -0
  256. package/dist/utilities/fieldValueExists.js +27 -0
  257. package/dist/utilities/fieldValueExists.js.map +1 -0
  258. package/dist/utilities/getUniqueFieldValue.d.ts +27 -0
  259. package/dist/utilities/getUniqueFieldValue.d.ts.map +1 -0
  260. package/dist/utilities/getUniqueFieldValue.js +26 -0
  261. package/dist/utilities/getUniqueFieldValue.js.map +1 -0
  262. package/dist/versions/deleteScheduledPublishJobs.js +2 -2
  263. package/dist/versions/deleteScheduledPublishJobs.js.map +1 -1
  264. package/dist/versions/payloadPackageList.d.ts.map +1 -1
  265. package/dist/versions/payloadPackageList.js +0 -1
  266. package/dist/versions/payloadPackageList.js.map +1 -1
  267. package/package.json +8 -3
  268. package/dist/database/defaultUpdateJobs.d.ts +0 -3
  269. package/dist/database/defaultUpdateJobs.d.ts.map +0 -1
  270. package/dist/database/defaultUpdateJobs.js +0 -41
  271. package/dist/database/defaultUpdateJobs.js.map +0 -1
  272. package/dist/fields/baseFields/slug/countVersions.d.ts +0 -13
  273. package/dist/fields/baseFields/slug/countVersions.d.ts.map +0 -1
  274. package/dist/fields/baseFields/slug/countVersions.js +0 -27
  275. package/dist/fields/baseFields/slug/countVersions.js.map +0 -1
  276. package/dist/uploads/tempFile.d.ts +0 -7
  277. package/dist/uploads/tempFile.d.ts.map +0 -1
  278. package/dist/uploads/tempFile.js +0 -39
  279. package/dist/uploads/tempFile.js.map +0 -1
@@ -10,10 +10,6 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
10
10
  if (jobsConfig.workflows?.length) {
11
11
  jobsConfig.workflows.forEach((workflow)=>{
12
12
  workflowSlugs.add(workflow.slug);
13
- // Validate concurrency config requires enableConcurrencyControl flag
14
- if (workflow.concurrency && !jobsConfig.enableConcurrencyControl) {
15
- throw new Error(`Workflow "${workflow.slug}" uses concurrency controls but "jobs.enableConcurrencyControl" is not enabled. ` + `Set "jobs.enableConcurrencyControl: true" in your Payload config to use concurrency controls. ` + `Note: This adds a new indexed field to the jobs collection schema and may require a database migration.`);
16
- }
17
13
  });
18
14
  }
19
15
  if (jobsConfig.tasks?.length) {
@@ -21,10 +17,6 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
21
17
  if (workflowSlugs.has(task.slug)) {
22
18
  throw new Error(`Task slug "${task.slug}" is already used by a workflow. No tasks are allowed to have the same slug as a workflow.`);
23
19
  }
24
- // Validate concurrency config requires enableConcurrencyControl flag
25
- if (task.concurrency && !jobsConfig.enableConcurrencyControl) {
26
- throw new Error(`Task "${task.slug}" uses concurrency controls but "jobs.enableConcurrencyControl" is not enabled. ` + `Set "jobs.enableConcurrencyControl: true" in your Payload config to use concurrency controls. ` + `Note: This adds a new indexed field to the jobs collection schema and may require a database migration.`);
27
- }
28
20
  taskSlugs.add(task.slug);
29
21
  });
30
22
  }
@@ -52,11 +44,10 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
52
44
  type: 'text',
53
45
  required: true
54
46
  },
55
- /**
56
- * @todo make required in 4.0
57
- */ {
47
+ {
58
48
  name: 'input',
59
- type: 'json'
49
+ type: 'json',
50
+ required: true
60
51
  },
61
52
  {
62
53
  name: 'output',
@@ -78,10 +69,8 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
78
69
  condition: (_, data)=>data.state === 'failed'
79
70
  },
80
71
  required: true
81
- }
82
- ];
83
- if (jobsConfig.addParentToTaskLog) {
84
- logFields.push({
72
+ },
73
+ {
85
74
  name: 'parent',
86
75
  type: 'group',
87
76
  fields: [
@@ -97,8 +86,8 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
97
86
  type: 'text'
98
87
  }
99
88
  ]
100
- });
101
- }
89
+ }
90
+ ];
102
91
  const jobsCollection = {
103
92
  slug: jobsCollectionSlug,
104
93
  admin: {
@@ -122,6 +111,12 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
122
111
  type: 'json',
123
112
  virtual: true
124
113
  },
114
+ {
115
+ // The meta field can be used to store arbitrary data about the job. The scheduling system
116
+ // uses `scheduled: true` to indicate that it queued the job.
117
+ name: 'meta',
118
+ type: 'json'
119
+ },
125
120
  {
126
121
  type: 'tabs',
127
122
  tabs: [
@@ -214,27 +209,34 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
214
209
  index: true
215
210
  },
216
211
  {
217
- name: 'processing',
218
- type: 'checkbox',
212
+ name: 'processingUntil',
213
+ type: 'date',
219
214
  admin: {
215
+ date: {
216
+ pickerAppearance: 'dayAndTime'
217
+ },
220
218
  position: 'sidebar'
221
219
  },
222
- defaultValue: false,
223
220
  index: true
224
221
  },
225
- // Only add concurrencyKey field if concurrency control is enabled
226
- ...jobsConfig.enableConcurrencyControl ? [
227
- {
228
- name: 'concurrencyKey',
229
- type: 'text',
230
- admin: {
231
- description: 'Used for concurrency control. Jobs with the same key are subject to exclusive/supersedes rules.',
232
- position: 'sidebar',
233
- readOnly: true
234
- },
235
- index: true
222
+ {
223
+ name: 'processingToken',
224
+ type: 'text',
225
+ admin: {
226
+ hidden: true,
227
+ readOnly: true
236
228
  }
237
- ] : []
229
+ },
230
+ {
231
+ name: 'concurrencyKey',
232
+ type: 'text',
233
+ admin: {
234
+ description: 'Used for concurrency control. Jobs with the same key are subject to exclusive/supersedes rules.',
235
+ position: 'sidebar',
236
+ readOnly: true
237
+ },
238
+ index: true
239
+ }
238
240
  ],
239
241
  hooks: {
240
242
  afterRead: [
@@ -252,7 +254,8 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
252
254
  */ beforeChange: [
253
255
  ({ data, originalDoc })=>{
254
256
  if (originalDoc?.error?.cancelled) {
255
- data.processing = false;
257
+ data.processingToken = null;
258
+ data.processingUntil = null;
256
259
  data.hasError = true;
257
260
  delete data.completedAt;
258
261
  delete data.waitUntil;
@@ -264,15 +267,6 @@ export const getDefaultJobsCollection = (jobsConfig)=>{
264
267
  lockDocuments: false,
265
268
  versions: false
266
269
  };
267
- if (jobsConfig.stats) {
268
- // TODO: In 4.0, this should be added by default.
269
- // The meta field can be used to store arbitrary data about the job. The scheduling system uses this to store
270
- // `scheduled: true` to indicate that the job was queued by the scheduling system.
271
- jobsCollection.fields.push({
272
- name: 'meta',
273
- type: 'json'
274
- });
275
- }
276
270
  return jobsCollection;
277
271
  };
278
272
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/queues/config/collection.ts"],"sourcesContent":["import type { CollectionConfig } from '../../collections/config/types.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { Job } from '../../index.js'\n\nimport { handleSchedulesJobsEndpoint } from '../endpoints/handleSchedules.js'\nimport { runJobsEndpoint } from '../endpoints/run.js'\nimport { getJobTaskStatus } from '../utilities/getJobTaskStatus.js'\n\nexport const jobsCollectionSlug = 'payload-jobs'\n\nexport const getDefaultJobsCollection: (jobsConfig: SanitizedConfig['jobs']) => CollectionConfig = (\n jobsConfig,\n) => {\n const workflowSlugs: Set<string> = new Set()\n const taskSlugs: Set<string> = new Set(['inline'])\n\n if (jobsConfig.workflows?.length) {\n jobsConfig.workflows.forEach((workflow) => {\n workflowSlugs.add(workflow.slug)\n\n // Validate concurrency config requires enableConcurrencyControl flag\n if (workflow.concurrency && !jobsConfig.enableConcurrencyControl) {\n throw new Error(\n `Workflow \"${workflow.slug}\" uses concurrency controls but \"jobs.enableConcurrencyControl\" is not enabled. ` +\n `Set \"jobs.enableConcurrencyControl: true\" in your Payload config to use concurrency controls. ` +\n `Note: This adds a new indexed field to the jobs collection schema and may require a database migration.`,\n )\n }\n })\n }\n\n if (jobsConfig.tasks?.length) {\n jobsConfig.tasks.forEach((task) => {\n if (workflowSlugs.has(task.slug)) {\n throw new Error(\n `Task slug \"${task.slug}\" is already used by a workflow. No tasks are allowed to have the same slug as a workflow.`,\n )\n }\n\n // Validate concurrency config requires enableConcurrencyControl flag\n if (task.concurrency && !jobsConfig.enableConcurrencyControl) {\n throw new Error(\n `Task \"${task.slug}\" uses concurrency controls but \"jobs.enableConcurrencyControl\" is not enabled. ` +\n `Set \"jobs.enableConcurrencyControl: true\" in your Payload config to use concurrency controls. ` +\n `Note: This adds a new indexed field to the jobs collection schema and may require a database migration.`,\n )\n }\n\n taskSlugs.add(task.slug)\n })\n }\n\n const logFields: Field[] = [\n {\n name: 'executedAt',\n type: 'date',\n required: true,\n },\n {\n name: 'completedAt',\n type: 'date',\n required: true,\n },\n {\n name: 'taskSlug',\n type: 'select',\n options: [...taskSlugs],\n required: true,\n },\n {\n name: 'taskID',\n type: 'text',\n required: true,\n },\n /**\n * @todo make required in 4.0\n */\n {\n name: 'input',\n type: 'json',\n },\n {\n name: 'output',\n type: 'json',\n },\n {\n name: 'state',\n type: 'radio',\n options: ['failed', 'succeeded'],\n required: true,\n },\n {\n name: 'error',\n type: 'json',\n admin: {\n condition: (_, data) => data.state === 'failed',\n },\n required: true,\n },\n ]\n\n if (jobsConfig.addParentToTaskLog) {\n logFields.push({\n name: 'parent',\n type: 'group',\n fields: [\n {\n name: 'taskSlug',\n type: 'select',\n options: [...taskSlugs],\n },\n {\n name: 'taskID',\n type: 'text',\n },\n ],\n })\n }\n\n const jobsCollection: CollectionConfig = {\n slug: jobsCollectionSlug,\n admin: {\n group: 'System',\n hidden: true,\n },\n endpoints: [runJobsEndpoint, handleSchedulesJobsEndpoint],\n fields: [\n {\n name: 'input',\n type: 'json',\n admin: {\n description: 'Input data provided to the job',\n },\n },\n {\n name: 'taskStatus',\n type: 'json',\n virtual: true,\n },\n {\n type: 'tabs',\n tabs: [\n {\n fields: [\n {\n name: 'completedAt',\n type: 'date',\n index: true,\n },\n {\n name: 'totalTried',\n type: 'number',\n defaultValue: 0,\n index: true,\n },\n {\n name: 'hasError',\n type: 'checkbox',\n admin: {\n description: 'If hasError is true this job will not be retried',\n },\n defaultValue: false,\n index: true,\n },\n {\n name: 'error',\n type: 'json',\n admin: {\n condition: (data) => data.hasError,\n description: 'If hasError is true, this is the error that caused it',\n },\n },\n {\n name: 'log',\n type: 'array',\n admin: {\n description: 'Task execution log',\n },\n fields: logFields,\n },\n ],\n label: 'Status',\n },\n ],\n },\n // only include the workflowSlugs field if workflows exist\n ...((workflowSlugs.size > 0\n ? [\n {\n name: 'workflowSlug',\n type: 'select',\n admin: {\n position: 'sidebar',\n },\n index: true,\n options: [...workflowSlugs],\n },\n ]\n : []) as Field[]),\n {\n name: 'taskSlug',\n type: 'select',\n admin: {\n position: 'sidebar',\n },\n index: true,\n options: [...taskSlugs],\n required: false,\n },\n {\n name: 'queue',\n type: 'text',\n admin: {\n position: 'sidebar',\n },\n defaultValue: 'default',\n index: true,\n },\n {\n name: 'waitUntil',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n },\n index: true,\n },\n {\n name: 'processing',\n type: 'checkbox',\n admin: {\n position: 'sidebar',\n },\n defaultValue: false,\n index: true,\n },\n // Only add concurrencyKey field if concurrency control is enabled\n ...(jobsConfig.enableConcurrencyControl\n ? [\n {\n name: 'concurrencyKey',\n type: 'text',\n admin: {\n description:\n 'Used for concurrency control. Jobs with the same key are subject to exclusive/supersedes rules.',\n position: 'sidebar',\n readOnly: true,\n },\n index: true,\n } as Field,\n ]\n : []),\n ],\n hooks: {\n afterRead: [\n ({ doc, req }) => {\n // This hook is used to add the virtual `tasks` field to the document, that is computed from the `log` field\n\n return jobAfterRead({ config: req.payload.config, doc })\n },\n ],\n /**\n * If another update comes in after a job as already been cancelled, we need to make sure that update doesn't\n * change the state of the job.\n */\n beforeChange: [\n ({ data, originalDoc }) => {\n if (originalDoc?.error?.cancelled) {\n data.processing = false\n data.hasError = true\n delete data.completedAt\n delete data.waitUntil\n }\n return data\n },\n ],\n },\n lockDocuments: false,\n versions: false,\n }\n\n if (jobsConfig.stats) {\n // TODO: In 4.0, this should be added by default.\n // The meta field can be used to store arbitrary data about the job. The scheduling system uses this to store\n // `scheduled: true` to indicate that the job was queued by the scheduling system.\n jobsCollection.fields.push({\n name: 'meta',\n type: 'json',\n })\n }\n return jobsCollection\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function jobAfterRead({ config, doc }: { config: SanitizedConfig; doc: Job }): Job {\n doc.taskStatus = getJobTaskStatus({\n jobLog: doc.log || [],\n })\n doc.input = doc.input || {}\n return doc\n}\n"],"names":["handleSchedulesJobsEndpoint","runJobsEndpoint","getJobTaskStatus","jobsCollectionSlug","getDefaultJobsCollection","jobsConfig","workflowSlugs","Set","taskSlugs","workflows","length","forEach","workflow","add","slug","concurrency","enableConcurrencyControl","Error","tasks","task","has","logFields","name","type","required","options","admin","condition","_","data","state","addParentToTaskLog","push","fields","jobsCollection","group","hidden","endpoints","description","virtual","tabs","index","defaultValue","hasError","label","size","position","date","pickerAppearance","readOnly","hooks","afterRead","doc","req","jobAfterRead","config","payload","beforeChange","originalDoc","error","cancelled","processing","completedAt","waitUntil","lockDocuments","versions","stats","taskStatus","jobLog","log","input"],"mappings":"AAKA,SA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AG;wBAClBhC,KAAKc,QAAQ,GAAG;wBAChB,OAAOd,KAAKiC,WAAW;wBACvB,OAAOjC,KAAKkC,SAAS;oBACvB;oBACA,OAAOlC;gBACT;aACD;QACH;QACAmC,eAAe;QACfC,UAAU;IACZ;IAEA,IAAI5D,WAAW6D,KAAK,EAAE;QACpB,iDAAiD;QACjD,6GAA6G;QAC7G,kFAAkF;QAClFhC,eAAeD,MAAM,CAACD,IAAI,CAAC;YACzBV,MAAM;YACNC,MAAM;QACR;IACF;IACA,OAAOW;AACT,EAAC;AAED,6DAA6D;AAC7D,OAAO,SAASoB,aAAa,EAAEC,MAAM,EAAEH,GAAG,EAAyC;IACjFA,IAAIe,UAAU,GAAGjE,iBAAiB;QAChCkE,QAAQhB,IAAIiB,GAAG,IAAI,EAAE;IACvB;IACAjB,IAAIkB,KAAK,GAAGlB,IAAIkB,KAAK,IAAI,CAAC;IAC1B,OAAOlB;AACT"}
1
+ {"version":3,"sources":["../../../src/queues/config/collection.ts"],"sourcesContent":["import type { CollectionConfig } from '../../collections/config/types.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { Job } from '../../index.js'\n\nimport { handleSchedulesJobsEndpoint } from '../endpoints/handleSchedules.js'\nimport { runJobsEndpoint } from '../endpoints/run.js'\nimport { getJobTaskStatus } from '../utilities/getJobTaskStatus.js'\n\nexport const jobsCollectionSlug = 'payload-jobs'\n\nexport const getDefaultJobsCollection: (jobsConfig: SanitizedConfig['jobs']) => CollectionConfig = (\n jobsConfig,\n) => {\n const workflowSlugs: Set<string> = new Set()\n const taskSlugs: Set<string> = new Set(['inline'])\n\n if (jobsConfig.workflows?.length) {\n jobsConfig.workflows.forEach((workflow) => {\n workflowSlugs.add(workflow.slug)\n })\n }\n\n if (jobsConfig.tasks?.length) {\n jobsConfig.tasks.forEach((task) => {\n if (workflowSlugs.has(task.slug)) {\n throw new Error(\n `Task slug \"${task.slug}\" is already used by a workflow. No tasks are allowed to have the same slug as a workflow.`,\n )\n }\n\n taskSlugs.add(task.slug)\n })\n }\n\n const logFields: Field[] = [\n {\n name: 'executedAt',\n type: 'date',\n required: true,\n },\n {\n name: 'completedAt',\n type: 'date',\n required: true,\n },\n {\n name: 'taskSlug',\n type: 'select',\n options: [...taskSlugs],\n required: true,\n },\n {\n name: 'taskID',\n type: 'text',\n required: true,\n },\n {\n name: 'input',\n type: 'json',\n required: true,\n },\n {\n name: 'output',\n type: 'json',\n },\n {\n name: 'state',\n type: 'radio',\n options: ['failed', 'succeeded'],\n required: true,\n },\n {\n name: 'error',\n type: 'json',\n admin: {\n condition: (_, data) => data.state === 'failed',\n },\n required: true,\n },\n {\n name: 'parent',\n type: 'group',\n fields: [\n {\n name: 'taskSlug',\n type: 'select',\n options: [...taskSlugs],\n },\n {\n name: 'taskID',\n type: 'text',\n },\n ],\n },\n ]\n\n const jobsCollection: CollectionConfig = {\n slug: jobsCollectionSlug,\n admin: {\n group: 'System',\n hidden: true,\n },\n endpoints: [runJobsEndpoint, handleSchedulesJobsEndpoint],\n fields: [\n {\n name: 'input',\n type: 'json',\n admin: {\n description: 'Input data provided to the job',\n },\n },\n {\n name: 'taskStatus',\n type: 'json',\n virtual: true,\n },\n {\n // The meta field can be used to store arbitrary data about the job. The scheduling system\n // uses `scheduled: true` to indicate that it queued the job.\n name: 'meta',\n type: 'json',\n },\n {\n type: 'tabs',\n tabs: [\n {\n fields: [\n {\n name: 'completedAt',\n type: 'date',\n index: true,\n },\n {\n name: 'totalTried',\n type: 'number',\n defaultValue: 0,\n index: true,\n },\n {\n name: 'hasError',\n type: 'checkbox',\n admin: {\n description: 'If hasError is true this job will not be retried',\n },\n defaultValue: false,\n index: true,\n },\n {\n name: 'error',\n type: 'json',\n admin: {\n condition: (data) => data.hasError,\n description: 'If hasError is true, this is the error that caused it',\n },\n },\n {\n name: 'log',\n type: 'array',\n admin: {\n description: 'Task execution log',\n },\n fields: logFields,\n },\n ],\n label: 'Status',\n },\n ],\n },\n // only include the workflowSlugs field if workflows exist\n ...((workflowSlugs.size > 0\n ? [\n {\n name: 'workflowSlug',\n type: 'select',\n admin: {\n position: 'sidebar',\n },\n index: true,\n options: [...workflowSlugs],\n },\n ]\n : []) as Field[]),\n {\n name: 'taskSlug',\n type: 'select',\n admin: {\n position: 'sidebar',\n },\n index: true,\n options: [...taskSlugs],\n required: false,\n },\n {\n name: 'queue',\n type: 'text',\n admin: {\n position: 'sidebar',\n },\n defaultValue: 'default',\n index: true,\n },\n {\n name: 'waitUntil',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n },\n index: true,\n },\n {\n name: 'processingUntil',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n position: 'sidebar',\n },\n index: true,\n },\n {\n name: 'processingToken',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n },\n {\n name: 'concurrencyKey',\n type: 'text',\n admin: {\n description:\n 'Used for concurrency control. Jobs with the same key are subject to exclusive/supersedes rules.',\n position: 'sidebar',\n readOnly: true,\n },\n index: true,\n },\n ],\n hooks: {\n afterRead: [\n ({ doc, req }) => {\n // This hook is used to add the virtual `tasks` field to the document, that is computed from the `log` field\n\n return jobAfterRead({ config: req.payload.config, doc })\n },\n ],\n /**\n * If another update comes in after a job as already been cancelled, we need to make sure that update doesn't\n * change the state of the job.\n */\n beforeChange: [\n ({ data, originalDoc }) => {\n if (originalDoc?.error?.cancelled) {\n data.processingToken = null\n data.processingUntil = null\n data.hasError = true\n delete data.completedAt\n delete data.waitUntil\n }\n return data\n },\n ],\n },\n lockDocuments: false,\n versions: false,\n }\n\n return jobsCollection\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function jobAfterRead({ config, doc }: { config: SanitizedConfig; doc: Job }): Job {\n doc.taskStatus = getJobTaskStatus({\n jobLog: doc.log || [],\n })\n doc.input = doc.input || {}\n return doc\n}\n"],"names":["handleSchedulesJobsEndpoint","runJobsEndpoint","getJobTaskStatus","jobsCollectionSlug","getDefaultJobsCollection","jobsConfig","workflowSlugs","Set","taskSlugs","workflows","length","forEach","workflow","add","slug","tasks","task","has","Error","logFields","name","type","required","options","admin","condition","_","data","state","fields","jobsCollection","group","hidden","endpoints","description","virtual","tabs","index","defaultValue","hasError","label","size","position","date","pickerAppearance","readOnly","hooks","afterRead","doc","req","jobAfterRead","config","payload","beforeChange","originalDoc","error","cancelled","processingToken","processingUntil","completedAt","waitUntil","lockDocuments","versions","taskStatus","jobLog","log","input"],"mappings":"AAKA,SAASA,2BAA2B,QAAQ,kCAAiC;AAC7E,SAASC,eAAe,QAAQ,sBAAqB;AACrD,SAASC,gBAAgB,QAAQ,mCAAkC;AAEnE,OAAO,MAAMC,qBAAqB,eAAc;AAEhD,OAAO,MAAMC,2BAAsF,CACjGC;IAEA,MAAMC,gBAA6B,IAAIC;IACvC,MAAMC,YAAyB,IAAID,IAAI;QAAC;KAAS;IAEjD,IAAIF,WAAWI,SAAS,EAAEC,QAAQ;QAChCL,WAAWI,SAAS,CAACE,OAAO,CAAC,CAACC;YAC5BN,cAAcO,GAAG,CAACD,SAASE,IAAI;QACjC;IACF;IAEA,IAAIT,WAAWU,KAAK,EAAEL,QAAQ;QAC5BL,WAAWU,KAAK,CAACJ,OAAO,CAAC,CAACK;YACxB,IAAIV,cAAcW,GAAG,CAACD,KAAKF,IAAI,GAAG;gBAChC,MAAM,IAAII,MACR,CAAC,WAAW,EAAEF,KAAKF,IAAI,CAAC,0FAA0F,CAAC;YAEvH;YAEAN,UAAUK,GAAG,CAACG,KAAKF,IAAI;QACzB;IACF;IAEA,MAAMK,YAAqB;QACzB;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNE,SAAS;mBAAIf;aAAU;YACvBc,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;YACNE,SAAS;gBAAC;gBAAU;aAAY;YAChCD,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNG,OAAO;gBACLC,WAAW,CAACC,GAAGC,OAASA,KAAKC,KAAK,KAAK;YACzC;YACAN,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNQ,QAAQ;gBACN;oBACET,MAAM;oBACNC,MAAM;oBACNE,SAAS;2BAAIf;qBAAU;gBACzB;gBACA;oBACEY,MAAM;oBACNC,MAAM;gBACR;aACD;QACH;KACD;IAED,MAAMS,iBAAmC;QACvChB,MAAMX;QACNqB,OAAO;YACLO,OAAO;YACPC,QAAQ;QACV;QACAC,WAAW;YAAChC;YAAiBD;SAA4B;QACzD6B,QAAQ;YACN;gBACET,MAAM;gBACNC,MAAM;gBACNG,OAAO;oBACLU,aAAa;gBACf;YACF;YACA;gBACEd,MAAM;gBACNC,MAAM;gBACNc,SAAS;YACX;YACA;gBACE,0FAA0F;gBAC1F,6DAA6D;gBAC7Df,MAAM;gBACNC,MAAM;YACR;YACA;gBACEA,MAAM;gBACNe,MAAM;oBACJ;wBACEP,QAAQ;4BACN;gCACET,MAAM;gCACNC,MAAM;gCACNgB,OAAO;4BACT;4BACA;gCACEjB,MAAM;gCACNC,MAAM;gCACNiB,cAAc;gCACdD,OAAO;4BACT;4BACA;gCACEjB,MAAM;gCACNC,MAAM;gCACNG,OAAO;oCACLU,aAAa;gCACf;gCACAI,cAAc;gCACdD,OAAO;4BACT;4BACA;gCACEjB,MAAM;gCACNC,MAAM;gCACNG,OAAO;oCACLC,WAAW,CAACE,OAASA,KAAKY,QAAQ;oCAClCL,aAAa;gCACf;4BACF;4BACA;gCACEd,MAAM;gCACNC,MAAM;gCACNG,OAAO;oCACLU,aAAa;gCACf;gCACAL,QAAQV;4BACV;yBACD;wBACDqB,OAAO;oB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wBAChB,OAAOZ,KAAKgC,WAAW;wBACvB,OAAOhC,KAAKiC,SAAS;oBACvB;oBACA,OAAOjC;gBACT;aACD;QACH;QACAkC,eAAe;QACfC,UAAU;IACZ;IAEA,OAAOhC;AACT,EAAC;AAED,6DAA6D;AAC7D,OAAO,SAASoB,aAAa,EAAEC,MAAM,EAAEH,GAAG,EAAyC;IACjFA,IAAIe,UAAU,GAAG7D,iBAAiB;QAChC8D,QAAQhB,IAAIiB,GAAG,IAAI,EAAE;IACvB;IACAjB,IAAIkB,KAAK,GAAGlB,IAAIkB,KAAK,IAAI,CAAC;IAC1B,OAAOlB;AACT"}
@@ -1,7 +1,6 @@
1
- import type { Config } from '../../config/types.js';
2
1
  import type { GlobalConfig } from '../../globals/config/types.js';
3
- import type { TaskType } from './types/taskTypes.js';
4
- import type { WorkflowTypes } from './types/workflowTypes.js';
2
+ import type { TaskSlug } from './types/taskTypes.js';
3
+ import type { WorkflowSlug } from './types/workflowTypes.js';
5
4
  export declare const jobStatsGlobalSlug = "payload-jobs-stats";
6
5
  /**
7
6
  * Type for data stored in the payload-jobs-stats global.
@@ -12,12 +11,12 @@ export type JobStats = {
12
11
  queues?: {
13
12
  [queueSlug: string]: {
14
13
  tasks?: {
15
- [taskSlug: TaskType]: {
14
+ [taskSlug: TaskSlug]: {
16
15
  lastScheduledRun: string;
17
16
  };
18
17
  };
19
18
  workflows?: {
20
- [workflowSlug: WorkflowTypes]: {
19
+ [workflowSlug: WorkflowSlug]: {
21
20
  lastScheduledRun: string;
22
21
  };
23
22
  };
@@ -29,5 +28,5 @@ export type JobStats = {
29
28
  /**
30
29
  * Global config for job statistics.
31
30
  */
32
- export declare const getJobStatsGlobal: (config: Config) => GlobalConfig;
31
+ export declare const getJobStatsGlobal: () => GlobalConfig;
33
32
  //# sourceMappingURL=global.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/queues/config/global.ts"],"names":[],"mappings":"AAAA,OAAO,K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ACnB,KAAK,CAAC,EAAE;wBACN,CAAC,QAAQ,EAAE,QAAQ,GAAG;4BACpB,gBAAgB,EAAE,MAAM,CAAA;yBACzB,CAAA;qBACF,CAAA;oBACD,SAAS,CAAC,EAAE;wBACV,CAAC,YAAY,EAAE,YAAY,GAAG;4BAC5B,gBAAgB,EAAE,MAAM,CAAA;yBACzB,CAAA;qBACF,CAAA;iBACF,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,YAerC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  export const jobStatsGlobalSlug = 'payload-jobs-stats';
2
2
  /**
3
3
  * Global config for job statistics.
4
- */ export const getJobStatsGlobal = (config)=>{
4
+ */ export const getJobStatsGlobal = ()=>{
5
5
  return {
6
6
  slug: jobStatsGlobalSlug,
7
7
  admin: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/queues/config/global.ts"],"sourcesContent":["import type { Config } from '../../config/types.js'\nimport type { GlobalConfig } from '../../globals/config/types.js'\nimport type { TaskType } from './types/taskTypes.js'\nimport type { WorkflowTypes } from './types/workflowTypes.js'\n\nexport const jobStatsGlobalSlug = 'payload-jobs-stats'\n\n/**\n * Type for data stored in the payload-jobs-stats global.\n */\nexport type JobStats = {\n stats?: {\n scheduledRuns?: {\n queues?: {\n [queueSlug: string]: {\n tasks?: {\n [taskSlug: TaskType]: {\n lastScheduledRun: string\n }\n }\n workflows?: {\n [workflowSlug: WorkflowTypes]: {\n lastScheduledRun: string\n }\n }\n }\n }\n }\n }\n}\n\n/**\n * Global config for job statistics.\n */\nexport const getJobStatsGlobal: (config: Config) => GlobalConfig = (config) => {\n return {\n slug: jobStatsGlobalSlug,\n admin: {\n group: 'System',\n hidden: true,\n },\n fields: [\n {\n name: 'stats',\n type: 'json',\n },\n ],\n versions: false,\n }\n}\n"],"names":["jobStatsGlobalSlug","getJobStatsGlobal","config","slug","admin","group","hidden","fields","name","type","versions"],"mappings":"AAKA,OAAO,MAAMA,qBAAqB,qBAAoB;AA0BtD;;CAEC,GACD,OAAO,MAAMC,oBAAsD,CAACC;IAClE,OAAO;QACLC,MAAMH;QACNI,OAAO;YACLC,OAAO;YACPC,QAAQ;QACV;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;YACR;SACD;QACDC,UAAU;IACZ;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/queues/config/global.ts"],"sourcesContent":["import type { GlobalConfig } from '../../globals/config/types.js'\nimport type { TaskSlug } from './types/taskTypes.js'\nimport type { WorkflowSlug } from './types/workflowTypes.js'\n\nexport const jobStatsGlobalSlug = 'payload-jobs-stats'\n\n/**\n * Type for data stored in the payload-jobs-stats global.\n */\nexport type JobStats = {\n stats?: {\n scheduledRuns?: {\n queues?: {\n [queueSlug: string]: {\n tasks?: {\n [taskSlug: TaskSlug]: {\n lastScheduledRun: string\n }\n }\n workflows?: {\n [workflowSlug: WorkflowSlug]: {\n lastScheduledRun: string\n }\n }\n }\n }\n }\n }\n}\n\n/**\n * Global config for job statistics.\n */\nexport const getJobStatsGlobal: () => GlobalConfig = () => {\n return {\n slug: jobStatsGlobalSlug,\n admin: {\n group: 'System',\n hidden: true,\n },\n fields: [\n {\n name: 'stats',\n type: 'json',\n },\n ],\n versions: false,\n }\n}\n"],"names":["jobStatsGlobalSlug","getJobStatsGlobal","slug","admin","group","hidden","fields","name","type","versions"],"mappings":"AAIA,OAAO,MAAMA,qBAAqB,qBAAoB;AA0BtD;;CAEC,GACD,OAAO,MAAMC,oBAAwC;IACnD,OAAO;QACLC,MAAMF;QACNG,OAAO;YACLC,OAAO;YACPC,QAAQ;QACV;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;YACR;SACD;QACDC,UAAU;IACZ;AACF,EAAC"}
@@ -75,6 +75,28 @@ export type CancelJobAccessArgs = {
75
75
  };
76
76
  export type CancelJobAccess = (args: CancelJobAccessArgs) => MaybePromise<boolean>;
77
77
  export type QueueJobAccess = (args: QueueJobAccessArgs) => MaybePromise<boolean>;
78
+ export type ProcessingLeaseConfig = {
79
+ /**
80
+ * How long a job remains claimed without a successful lease renewal.
81
+ * This is not a maximum job runtime; active jobs renew their lease automatically.
82
+ *
83
+ * @default 1200000 (20 minutes)
84
+ */
85
+ duration?: number;
86
+ /**
87
+ * Minimum time that must remain on a lease before a worker **starts** an update. This gives the
88
+ * update time to finish before another worker can claim the job.
89
+ *
90
+ * Set this to `0` if your database adapter applies the ownership check and update atomically.
91
+ * If the database update itself is not atomic, increase this value, as another worker
92
+ * may claim the job before the update finishes.
93
+ *
94
+ * It must be less than `duration`.
95
+ *
96
+ * @default 30000 (30 seconds)
97
+ */
98
+ safetyBuffer?: number;
99
+ };
78
100
  export type SanitizedJobsConfig = {
79
101
  /**
80
102
  * If set to `true`, the job system is enabled and a payload-jobs collection exists.
@@ -82,16 +104,17 @@ export type SanitizedJobsConfig = {
82
104
  */
83
105
  enabled?: boolean;
84
106
  /**
85
- * If set to `true`, at least one task or workflow has scheduling enabled.
107
+ * If set to `true`, at least one task or workflow uses concurrency controls.
86
108
  * This property is automatically set during sanitization.
87
109
  */
88
- scheduling?: boolean;
110
+ hasConcurrency?: boolean;
111
+ processingLease: Required<ProcessingLeaseConfig>;
89
112
  /**
90
- * If set to `true`, a payload-job-stats global exists.
113
+ * If set to `true`, at least one task or workflow has scheduling enabled.
91
114
  * This property is automatically set during sanitization.
92
115
  */
93
- stats?: boolean;
94
- } & JobsConfig;
116
+ scheduling?: boolean;
117
+ } & Omit<JobsConfig, 'processingLease'>;
95
118
  export type JobsConfig = {
96
119
  /**
97
120
  * Specify access control to determine who can interact with jobs.
@@ -110,13 +133,6 @@ export type JobsConfig = {
110
133
  */
111
134
  run?: RunJobAccess;
112
135
  };
113
- /** Adds information about the parent job to the task log. This is useful for debugging and tracking the flow of tasks.
114
- *
115
- * In 4.0, this will default to `true`.
116
- *
117
- * @default false
118
- */
119
- addParentToTaskLog?: boolean;
120
136
  /**
121
137
  * Allows you to configure cron jobs that automatically run queued jobs
122
138
  * at specified intervals. Note that this does not _queue_ new jobs - only
@@ -129,18 +145,6 @@ export type JobsConfig = {
129
145
  * Determine whether or not to delete a job after it has successfully completed.
130
146
  */
131
147
  deleteJobOnComplete?: boolean;
132
- /**
133
- * Enable concurrency controls for workflows and tasks.
134
- * When enabled, adds a `concurrencyKey` field to the jobs collection schema.
135
- * This allows workflows and tasks to use the `concurrency` option to prevent race conditions.
136
- *
137
- * **Important:** Enabling this may require a database migration depending on your database adapter,
138
- * as it adds a new indexed field to the jobs collection schema.
139
- *
140
- * @default false
141
- * @todo In 4.0, this will default to `true`.
142
- */
143
- enableConcurrencyControl?: boolean;
144
148
  /**
145
149
  * Override any settings on the default Jobs collection. Accepts the default collection and allows you to return
146
150
  * a new collection.
@@ -148,6 +152,7 @@ export type JobsConfig = {
148
152
  jobsCollectionOverrides?: (args: {
149
153
  defaultJobsCollection: CollectionConfig;
150
154
  }) => CollectionConfig;
155
+ processingLease?: ProcessingLeaseConfig;
151
156
  /**
152
157
  * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.
153
158
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queues/config/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,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AAE,OAAO,CAAA;CAChB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,SAAS,CAAA;CAClB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,GAAG,CAAC,EAAE,KAAK,CAAA;IACX;;OAEG;IACH,MAAM,EAAE,SAAS,CAAA;CAClB,CACJ,KACE,YAAY,CAAC,IAAI,CAAC,CAAA;AAEvB,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE;QACN;;;;WAIG;QACH,aAAa,CAAC,EAAE,eAAe,CAAA;QAC/B;;;;;;;;;WASG;QACH,cAAc,CAAC,EAAE,gBAAgB,CAAA;KAClC,CAAA;IACD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queues/config/types/index.ts"],"sourcesContent":["import type { CollectionConfig, Job } from '../../../index.js'\nimport type { MaybePromise, Payload, PayloadRequest, Sort } from '../../../types/index.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobsArgs } from '../../operations/runJobs/index.js'\nimport type { JobStats } from '../global.js'\nimport type { TaskConfig } from './taskTypes.js'\nimport type { WorkflowConfig } from './workflowTypes.js'\n\nexport type AutorunCronConfig = {\n /**\n * If you want to autoRUn jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The cron schedule for the job.\n * @default '* * * * *' (every minute).\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron?: string\n /**\n * By default, the autorun will attempt to schedule jobs for tasks and workflows that have a `schedule` property, given\n * the queue name is the same.\n *\n * Set this to `true` to disable the scheduling of jobs automatically.\n *\n * @default false\n */\n disableScheduling?: boolean\n /**\n * The limit for the job. This can be overridden by the user. Defaults to 10.\n */\n limit?: number\n /**\n * The queue name for the job.\n *\n * @default 'default'\n */\n queue?: string\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n}\n\nexport type RunJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type RunJobAccess = (args: RunJobAccessArgs) => MaybePromise<boolean>\n\nexport type QueueJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type CancelJobAccessArgs = {\n req: PayloadRequest\n}\nexport type CancelJobAccess = (args: CancelJobAccessArgs) => MaybePromise<boolean>\nexport type QueueJobAccess = (args: QueueJobAccessArgs) => MaybePromise<boolean>\n\nexport type SanitizedJobsConfig = {\n /**\n * If set to `true`, the job system is enabled and a payload-jobs collection exists.\n * This property is automatically set during sanitization.\n */\n enabled?: boolean\n /**\n * If set to `true`, at least one task or workflow has scheduling enabled.\n * This property is automatically set during sanitization.\n */\n scheduling?: boolean\n /**\n * If set to `true`, a payload-job-stats global exists.\n * This property is automatically set during sanitization.\n */\n stats?: boolean\n} & JobsConfig\nexport type JobsConfig = {\n /**\n * Specify access control to determine who can interact with jobs.\n */\n access?: {\n /**\n * By default, all logged-in users can cancel jobs.\n */\n cancel?: CancelJobAccess\n /**\n * By default, all logged-in users can queue jobs.\n */\n queue?: QueueJobAccess\n /**\n * By default, all logged-in users can run jobs.\n */\n run?: RunJobAccess\n }\n /** Adds information about the parent job to the task log. This is useful for debugging and tracking the flow of tasks.\n *\n * In 4.0, this will default to `true`.\n *\n * @default false\n */\n addParentToTaskLog?: boolean\n /**\n * Allows you to configure cron jobs that automatically run queued jobs\n * at specified intervals. Note that this does not _queue_ new jobs - only\n * _runs_ jobs that are already in the specified queue.\n *\n * @remark this property should not be used on serverless platforms like Vercel\n */\n autoRun?: ((payload: Payload) => MaybePromise<AutorunCronConfig[]>) | AutorunCronConfig[]\n /**\n * Determine whether or not to delete a job after it has successfully completed.\n */\n deleteJobOnComplete?: boolean\n /**\n * Enable concurrency controls for workflows and tasks.\n * When enabled, adds a `concurrencyKey` field to the jobs collection schema.\n * This allows workflows and tasks to use the `concurrency` option to prevent race conditions.\n *\n * **Important:** Enabling this may require a database migration depending on your database adapter,\n * as it adds a new indexed field to the jobs collection schema.\n *\n * @default false\n * @todo In 4.0, this will default to `true`.\n */\n enableConcurrencyControl?: boolean\n /**\n * Override any settings on the default Jobs collection. Accepts the default collection and allows you to return\n * a new collection.\n */\n jobsCollectionOverrides?: (args: { defaultJobsCollection: CollectionConfig }) => CollectionConfig\n /**\n * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n *\n * @default all jobs for all queues will be executed in FIFO order.\n */\n processingOrder?:\n | ((args: RunJobsArgs) => Promise<Sort> | Sort)\n | {\n default?: Sort\n queues: {\n [queue: string]: Sort\n }\n }\n | Sort\n /**\n * A function that will be executed before Payload picks up jobs which are configured by the `jobs.autorun` function.\n * If this function returns true, jobs will be queried and picked up. If it returns false, jobs will not be run.\n * @default undefined - if this function is not defined, jobs will be run - as if () => true was passed.\n * @param payload\n * @returns boolean\n */\n shouldAutoRun?: (payload: Payload) => MaybePromise<boolean>\n /**\n * Define all possible tasks here\n */\n tasks?: TaskConfig<any>[]\n /**\n * Define all the workflows here. Workflows orchestrate the flow of multiple tasks.\n */\n workflows?: WorkflowConfig<any>[]\n}\n\nexport type Queueable = {\n scheduleConfig: ScheduleConfig\n taskConfig?: TaskConfig\n // If not set, queue it immediately\n waitUntil?: Date\n workflowConfig?: WorkflowConfig\n}\n\nexport type BeforeScheduleFn = (args: {\n defaultBeforeSchedule: BeforeScheduleFn\n /**\n * payload-job-stats global data\n */\n jobStats: JobStats\n queueable: Queueable\n req: PayloadRequest\n}) => MaybePromise<{\n input?: object\n shouldSchedule: boolean\n waitUntil?: Date\n}>\n\nexport type AfterScheduleFn = (\n args: {\n defaultAfterSchedule: AfterScheduleFn\n /**\n * payload-job-stats global data. If the global does not exist, it will be null.\n */\n jobStats: JobStats | null\n queueable: Queueable\n req: PayloadRequest\n } & (\n | {\n error: Error\n job?: never\n status: 'error'\n }\n | {\n error?: never\n job: Job\n status: 'success'\n }\n | {\n error?: never\n job?: never\n /**\n * If the beforeSchedule hook returned `shouldSchedule: false`, this will be called with status `skipped`.\n */\n status: 'skipped'\n }\n ),\n) => MaybePromise<void>\n\nexport type ScheduleConfig = {\n /**\n * The cron for scheduling the job.\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron: string\n hooks?: {\n /**\n * Functions that will be executed after the job has been successfully scheduled.\n *\n * @default By default, global update?? Unless global update should happen before\n */\n afterSchedule?: AfterScheduleFn\n /**\n * Functions that will be executed before the job is scheduled.\n * You can use this to control whether or not the job should be scheduled, or what input\n * data should be passed to the job.\n *\n * @default By default, this has one function that returns { shouldSchedule: true } if the following conditions are met:\n * - There currently is no job of the same type in the specified queue that is currently running\n * - There currently is no job of the same type in the specified queue that is scheduled to run in the future\n * - There currently is no job of the same type in the specified queue that failed previously but can be retried\n */\n beforeSchedule?: BeforeScheduleFn\n }\n /**\n * Queue to which the scheduled job will be added.\n */\n queue: string\n}\n"],"names":[],"mappings":"AAiPA,WA4CC"}
1
+ {"version":3,"sources":["../../../../src/queues/config/types/index.ts"],"sourcesContent":["import type { CollectionConfig, Job } from '../../../index.js'\nimport type { MaybePromise, Payload, PayloadRequest, Sort } from '../../../types/index.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobsArgs } from '../../operations/runJobs/index.js'\nimport type { JobStats } from '../global.js'\nimport type { TaskConfig } from './taskTypes.js'\nimport type { WorkflowConfig } from './workflowTypes.js'\n\nexport type AutorunCronConfig = {\n /**\n * If you want to autoRUn jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The cron schedule for the job.\n * @default '* * * * *' (every minute).\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron?: string\n /**\n * By default, the autorun will attempt to schedule jobs for tasks and workflows that have a `schedule` property, given\n * the queue name is the same.\n *\n * Set this to `true` to disable the scheduling of jobs automatically.\n *\n * @default false\n */\n disableScheduling?: boolean\n /**\n * The limit for the job. This can be overridden by the user. Defaults to 10.\n */\n limit?: number\n /**\n * The queue name for the job.\n *\n * @default 'default'\n */\n queue?: string\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n}\n\nexport type RunJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type RunJobAccess = (args: RunJobAccessArgs) => MaybePromise<boolean>\n\nexport type QueueJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type CancelJobAccessArgs = {\n req: PayloadRequest\n}\nexport type CancelJobAccess = (args: CancelJobAccessArgs) => MaybePromise<boolean>\nexport type QueueJobAccess = (args: QueueJobAccessArgs) => MaybePromise<boolean>\n\nexport type ProcessingLeaseConfig = {\n /**\n * How long a job remains claimed without a successful lease renewal.\n * This is not a maximum job runtime; active jobs renew their lease automatically.\n *\n * @default 1200000 (20 minutes)\n */\n duration?: number\n /**\n * Minimum time that must remain on a lease before a worker **starts** an update. This gives the\n * update time to finish before another worker can claim the job.\n *\n * Set this to `0` if your database adapter applies the ownership check and update atomically.\n * If the database update itself is not atomic, increase this value, as another worker\n * may claim the job before the update finishes.\n *\n * It must be less than `duration`.\n *\n * @default 30000 (30 seconds)\n */\n safetyBuffer?: number\n}\n\nexport type SanitizedJobsConfig = {\n /**\n * If set to `true`, the job system is enabled and a payload-jobs collection exists.\n * This property is automatically set during sanitization.\n */\n enabled?: boolean\n /**\n * If set to `true`, at least one task or workflow uses concurrency controls.\n * This property is automatically set during sanitization.\n */\n hasConcurrency?: boolean\n processingLease: Required<ProcessingLeaseConfig>\n /**\n * If set to `true`, at least one task or workflow has scheduling enabled.\n * This property is automatically set during sanitization.\n */\n scheduling?: boolean\n} & Omit<JobsConfig, 'processingLease'>\nexport type JobsConfig = {\n /**\n * Specify access control to determine who can interact with jobs.\n */\n access?: {\n /**\n * By default, all logged-in users can cancel jobs.\n */\n cancel?: CancelJobAccess\n /**\n * By default, all logged-in users can queue jobs.\n */\n queue?: QueueJobAccess\n /**\n * By default, all logged-in users can run jobs.\n */\n run?: RunJobAccess\n }\n /**\n * Allows you to configure cron jobs that automatically run queued jobs\n * at specified intervals. Note that this does not _queue_ new jobs - only\n * _runs_ jobs that are already in the specified queue.\n *\n * @remark this property should not be used on serverless platforms like Vercel\n */\n autoRun?: ((payload: Payload) => MaybePromise<AutorunCronConfig[]>) | AutorunCronConfig[]\n /**\n * Determine whether or not to delete a job after it has successfully completed.\n */\n deleteJobOnComplete?: boolean\n /**\n * Override any settings on the default Jobs collection. Accepts the default collection and allows you to return\n * a new collection.\n */\n jobsCollectionOverrides?: (args: { defaultJobsCollection: CollectionConfig }) => CollectionConfig\n processingLease?: ProcessingLeaseConfig\n /**\n * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n *\n * @default all jobs for all queues will be executed in FIFO order.\n */\n processingOrder?:\n | ((args: RunJobsArgs) => Promise<Sort> | Sort)\n | {\n default?: Sort\n queues: {\n [queue: string]: Sort\n }\n }\n | Sort\n /**\n * A function that will be executed before Payload picks up jobs which are configured by the `jobs.autorun` function.\n * If this function returns true, jobs will be queried and picked up. If it returns false, jobs will not be run.\n * @default undefined - if this function is not defined, jobs will be run - as if () => true was passed.\n * @param payload\n * @returns boolean\n */\n shouldAutoRun?: (payload: Payload) => MaybePromise<boolean>\n /**\n * Define all possible tasks here\n */\n tasks?: TaskConfig<any>[]\n /**\n * Define all the workflows here. Workflows orchestrate the flow of multiple tasks.\n */\n workflows?: WorkflowConfig<any>[]\n}\n\nexport type Queueable = {\n scheduleConfig: ScheduleConfig\n taskConfig?: TaskConfig\n // If not set, queue it immediately\n waitUntil?: Date\n workflowConfig?: WorkflowConfig\n}\n\nexport type BeforeScheduleFn = (args: {\n defaultBeforeSchedule: BeforeScheduleFn\n /**\n * payload-job-stats global data\n */\n jobStats: JobStats\n queueable: Queueable\n req: PayloadRequest\n}) => MaybePromise<{\n input?: object\n shouldSchedule: boolean\n waitUntil?: Date\n}>\n\nexport type AfterScheduleFn = (\n args: {\n defaultAfterSchedule: AfterScheduleFn\n /**\n * payload-job-stats global data. If the global does not exist, it will be null.\n */\n jobStats: JobStats | null\n queueable: Queueable\n req: PayloadRequest\n } & (\n | {\n error: Error\n job?: never\n status: 'error'\n }\n | {\n error?: never\n job: Job\n status: 'success'\n }\n | {\n error?: never\n job?: never\n /**\n * If the beforeSchedule hook returned `shouldSchedule: false`, this will be called with status `skipped`.\n */\n status: 'skipped'\n }\n ),\n) => MaybePromise<void>\n\nexport type ScheduleConfig = {\n /**\n * The cron for scheduling the job.\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron: string\n hooks?: {\n /**\n * Functions that will be executed after the job has been successfully scheduled.\n *\n * @default By default, global update?? Unless global update should happen before\n */\n afterSchedule?: AfterScheduleFn\n /**\n * Functions that will be executed before the job is scheduled.\n * You can use this to control whether or not the job should be scheduled, or what input\n * data should be passed to the job.\n *\n * @default By default, this has one function that returns { shouldSchedule: true } if the following conditions are met:\n * - There currently is no job of the same type in the specified queue that is currently running\n * - There currently is no job of the same type in the specified queue that is scheduled to run in the future\n * - There currently is no job of the same type in the specified queue that failed previously but can be retried\n */\n beforeSchedule?: BeforeScheduleFn\n }\n /**\n * Queue to which the scheduled job will be added.\n */\n queue: string\n}\n"],"names":[],"mappings":"AAuPA,WA4CC"}
@@ -21,15 +21,12 @@ export type TaskHandlerArgs<TTaskSlugOrInputOutput extends keyof TypedJobs['task
21
21
  /**
22
22
  * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus
23
23
  */
24
- export type TaskHandlerArgsNoInput<TWorkflowInput extends false | object = false> = {
25
- job: Job<TWorkflowInput>;
24
+ export type TaskHandlerArgsNoInput<TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object> = {
25
+ job: Job<TWorkflowSlugOrInput>;
26
26
  req: PayloadRequest;
27
27
  };
28
28
  export type TaskHandler<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput, TWorkflowSlug extends keyof TypedJobs['workflows'] = string> = (args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>) => MaybePromise<TaskHandlerResult<TTaskSlugOrInputOutput>>;
29
- /**
30
- * @todo rename to TaskSlug in 4.0, similar to CollectionSlug
31
- */
32
- export type TaskType = StringKeyOf<TypedJobs['tasks']>;
29
+ export type TaskSlug = StringKeyOf<TypedJobs['tasks']>;
33
30
  export type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input'];
34
31
  export type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output'];
35
32
  export type TaskHandlerResults = {
@@ -140,7 +137,7 @@ export type RetryConfig = {
140
137
  */
141
138
  shouldRestore?: boolean | ShouldRestoreFn;
142
139
  };
143
- export type TaskConfig<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType> = {
140
+ export type TaskConfig<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskSlug> = {
144
141
  /**
145
142
  * Job concurrency controls for preventing race conditions.
146
143
  *
@@ -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ACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAA;IACrD;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;IAC3B;;OAEG;IACH,IAAI,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,sBAAsB,GAAG,MAAM,CAAA;CAChG,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type {\n Field,\n Job,\n MaybePromise,\n PayloadRequest,\n StringKeyOf,\n TypedJobs,\n} from '../../../index.js'\nimport type { ScheduleConfig } from './index.js'\nimport type { ConcurrencyConfig, SingleTaskStatus } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> = {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n}\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n /**\n * Use this function to run a sub-task from within another task.\n */\n inlineTask: RunInlineTaskFunction\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: Job<TWorkflowSlug>\n req: PayloadRequest\n tasks: RunTaskFunctions\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<TWorkflowInput extends false | object = false> = {\n job: Job<TWorkflowInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => MaybePromise<TaskHandlerResult<TTaskSlugOrInputOutput>>\n\n/**\n * @todo rename to TaskSlug in 4.0, similar to CollectionSlug\n */\nexport type TaskType = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: {\n inlineTask: RunInlineTaskFunction\n input: TTaskInput\n job: Job<any>\n req: PayloadRequest\n tasks: RunTaskFunctions\n }) => MaybePromise<{\n output: TTaskOutput\n }>\n },\n) => Promise<TTaskOutput>\n\nexport type TaskCallbackArgs = {\n /**\n * Input data passed to the task\n */\n input?: object\n job: Job\n req: PayloadRequest\n taskStatus: null | SingleTaskStatus<string>\n}\n\nexport type ShouldRestoreFn = (\n args: { taskStatus: SingleTaskStatus<string> } & Omit<TaskCallbackArgs, 'taskStatus'>,\n) => MaybePromise<boolean>\nexport type TaskCallbackFn = (args: TaskCallbackArgs) => MaybePromise<void>\n\nexport type RetryConfig = {\n /**\n * This controls how many times the task should be retried if it fails.\n *\n * @default undefined - attempts are either inherited from the workflow retry config or set to 0.\n */\n attempts?: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n /**\n * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.\n *\n * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.\n *\n * If this is set to true, the task will only be re-run if it previously failed.\n *\n * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,\n * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.\n *\n * @default true - the task output will be restored if the task previously succeeded.\n */\n shouldRestore?: boolean | ShouldRestoreFn\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType,\n> = {\n /**\n * Job concurrency controls for preventing race conditions.\n *\n * Can be an object with full options, or a shorthand function that just returns the key\n * (in which case exclusive defaults to true).\n */\n concurrency?: ConcurrencyConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput\n ? TTaskSlugOrInputOutput['input']\n : object\n >\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: TaskCallbackFn\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: TaskCallbackFn\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Allows automatically scheduling this task to run regularly at a specified interval.\n */\n schedule?: ScheduleConfig[]\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AAgMA,WAiEC"}
1
+ {"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type {\n Field,\n Job,\n MaybePromise,\n PayloadRequest,\n StringKeyOf,\n TypedJobs,\n} from '../../../index.js'\nimport type { ScheduleConfig } from './index.js'\nimport type { ConcurrencyConfig, SingleTaskStatus } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> = {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n}\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n /**\n * Use this function to run a sub-task from within another task.\n */\n inlineTask: RunInlineTaskFunction\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: Job<TWorkflowSlug>\n req: PayloadRequest\n tasks: RunTaskFunctions\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<\n TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object,\n> = {\n job: Job<TWorkflowSlugOrInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => MaybePromise<TaskHandlerResult<TTaskSlugOrInputOutput>>\n\nexport type TaskSlug = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: {\n inlineTask: RunInlineTaskFunction\n input: TTaskInput\n job: Job<any>\n req: PayloadRequest\n tasks: RunTaskFunctions\n }) => MaybePromise<{\n output: TTaskOutput\n }>\n },\n) => Promise<TTaskOutput>\n\nexport type TaskCallbackArgs = {\n /**\n * Input data passed to the task\n */\n input?: object\n job: Job\n req: PayloadRequest\n taskStatus: null | SingleTaskStatus<string>\n}\n\nexport type ShouldRestoreFn = (\n args: { taskStatus: SingleTaskStatus<string> } & Omit<TaskCallbackArgs, 'taskStatus'>,\n) => MaybePromise<boolean>\nexport type TaskCallbackFn = (args: TaskCallbackArgs) => MaybePromise<void>\n\nexport type RetryConfig = {\n /**\n * This controls how many times the task should be retried if it fails.\n *\n * @default undefined - attempts are either inherited from the workflow retry config or set to 0.\n */\n attempts?: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n /**\n * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.\n *\n * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.\n *\n * If this is set to true, the task will only be re-run if it previously failed.\n *\n * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,\n * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.\n *\n * @default true - the task output will be restored if the task previously succeeded.\n */\n shouldRestore?: boolean | ShouldRestoreFn\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskSlug,\n> = {\n /**\n * Job concurrency controls for preventing race conditions.\n *\n * Can be an object with full options, or a shorthand function that just returns the key\n * (in which case exclusive defaults to true).\n */\n concurrency?: ConcurrencyConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput\n ? TTaskSlugOrInputOutput['input']\n : object\n >\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: TaskCallbackFn\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: TaskCallbackFn\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Allows automatically scheduling this task to run regularly at a specified interval.\n */\n schedule?: ScheduleConfig[]\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AA+LA,WAiEC"}
@@ -1,12 +1,13 @@
1
- import type { Job, TaskHandlerResult, TypedJobs } from '../../../index.js';
2
- import type { RetryConfig, TaskHandlerArgsNoInput } from './taskTypes.js';
3
- export type WorkflowStep<TTaskSlug extends keyof TypedJobs['tasks'], TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false> = {
1
+ import type { Job, TypedJobs } from '../../../index.js';
2
+ import type { MaybePromise } from '../../../types/index.js';
3
+ import type { RetryConfig, TaskHandlerArgsNoInput, TaskHandlerResult, TaskInputOutput } from './taskTypes.js';
4
+ export type WorkflowStep<TTaskSlug extends keyof TypedJobs['tasks'], TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object> = {
4
5
  /**
5
6
  * If this step is completed, the workflow will be marked as completed
6
7
  */
7
8
  completesJob?: boolean;
8
9
  condition?: (args: {
9
- job: Job<TWorkflowSlug>;
10
+ job: Job<TWorkflowSlugOrInput>;
10
11
  }) => boolean;
11
12
  /**
12
13
  * Each task needs to have a unique ID to track its status
@@ -19,16 +20,16 @@ export type WorkflowStep<TTaskSlug extends keyof TypedJobs['tasks'], TWorkflowSl
19
20
  */
20
21
  retries?: number | RetryConfig;
21
22
  } & ({
22
- inlineTask?: (args: TWorkflowSlug extends keyof TypedJobs['workflows'] ? TaskHandlerArgsNoInput<TypedJobs['workflows'][TWorkflowSlug]['input']> : TaskHandlerArgsNoInput) => Promise<TaskHandlerResult<TTaskSlug>> | TaskHandlerResult<TTaskSlug>;
23
+ inlineTask: (args: TaskHandlerArgsNoInput<TWorkflowSlugOrInput>) => MaybePromise<TaskHandlerResult<TaskInputOutput>>;
23
24
  } | {
24
25
  input: (args: {
25
- job: Job<TWorkflowSlug>;
26
+ job: Job<TWorkflowSlugOrInput>;
26
27
  }) => TypedJobs['tasks'][TTaskSlug]['input'];
27
28
  task: TTaskSlug;
28
29
  });
29
- type AllWorkflowSteps<TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false> = {
30
- [TTaskSlug in keyof TypedJobs['tasks']]: WorkflowStep<TTaskSlug, TWorkflowSlug>;
30
+ type AllWorkflowSteps<TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object> = {
31
+ [TTaskSlug in keyof TypedJobs['tasks']]: WorkflowStep<TTaskSlug, TWorkflowSlugOrInput>;
31
32
  }[keyof TypedJobs['tasks']];
32
- export type WorkflowJSON<TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false> = Array<AllWorkflowSteps<TWorkflowSlug>>;
33
+ export type WorkflowJSON<TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object> = Array<AllWorkflowSteps<TWorkflowSlugOrInput>>;
33
34
  export {};
34
35
  //# sourceMappingURL=workflowJSONTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflowJSONTypes.d.ts","sourceRoot":"","sources":["../../../../src/queues/config/types/workflowJSONTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEzE,MAAM,MAAM,YAAY,CACtB,SAAS,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,EAC1C,aAAa,SAAS,KAAK,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,KAAK,IAChE;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,CAAC,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M,YAAY,CACtB,oBAAoB,SAAS,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,MAAM,IACzE,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queues/config/types/workflowJSONTypes.ts"],"sourcesContent":["import type { Job, TaskHandlerResult, TypedJobs } from '../../../index.js'\nimport type { RetryConfig, TaskHandlerArgsNoInput } from './taskTypes.js'\n\nexport type WorkflowStep<\n TTaskSlug extends keyof TypedJobs['tasks'],\n TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false,\n> = {\n /**\n * If this step is completed, the workflow will be marked as completed\n */\n completesJob?: boolean\n condition?: (args: { job: Job<TWorkflowSlug> }) => boolean\n /**\n * Each task needs to have a unique ID to track its status\n */\n id: string\n /**\n * Specify the number of times that this workflow should be retried if it fails for any reason.\n *\n * @default By default, workflows are not retried and `retries` is `0`.\n */\n retries?: number | RetryConfig\n} & (\n | {\n inlineTask?: (\n args: TWorkflowSlug extends keyof TypedJobs['workflows']\n ? TaskHandlerArgsNoInput<TypedJobs['workflows'][TWorkflowSlug]['input']>\n : TaskHandlerArgsNoInput,\n ) => Promise<TaskHandlerResult<TTaskSlug>> | TaskHandlerResult<TTaskSlug>\n }\n | {\n input: (args: { job: Job<TWorkflowSlug> }) => TypedJobs['tasks'][TTaskSlug]['input']\n task: TTaskSlug\n }\n)\n\ntype AllWorkflowSteps<TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false> = {\n [TTaskSlug in keyof TypedJobs['tasks']]: WorkflowStep<TTaskSlug, TWorkflowSlug>\n}[keyof TypedJobs['tasks']]\n\nexport type WorkflowJSON<TWorkflowSlug extends false | keyof TypedJobs['workflows'] = false> =\n Array<AllWorkflowSteps<TWorkflowSlug>>\n"],"names":[],"mappings":"AAwCA,WACwC"}
1
+ {"version":3,"sources":["../../../../src/queues/config/types/workflowJSONTypes.ts"],"sourcesContent":["import type { Job, TypedJobs } from '../../../index.js'\nimport type { MaybePromise } from '../../../types/index.js'\nimport type {\n RetryConfig,\n TaskHandlerArgsNoInput,\n TaskHandlerResult,\n TaskInputOutput,\n} from './taskTypes.js'\n\nexport type WorkflowStep<\n TTaskSlug extends keyof TypedJobs['tasks'],\n TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object,\n> = {\n /**\n * If this step is completed, the workflow will be marked as completed\n */\n completesJob?: boolean\n condition?: (args: { job: Job<TWorkflowSlugOrInput> }) => boolean\n /**\n * Each task needs to have a unique ID to track its status\n */\n id: string\n /**\n * Specify the number of times that this workflow should be retried if it fails for any reason.\n *\n * @default By default, workflows are not retried and `retries` is `0`.\n */\n retries?: number | RetryConfig\n} & (\n | {\n inlineTask: (\n args: TaskHandlerArgsNoInput<TWorkflowSlugOrInput>,\n ) => MaybePromise<TaskHandlerResult<TaskInputOutput>>\n }\n | {\n input: (args: { job: Job<TWorkflowSlugOrInput> }) => TypedJobs['tasks'][TTaskSlug]['input']\n task: TTaskSlug\n }\n)\n\ntype AllWorkflowSteps<TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object> =\n {\n [TTaskSlug in keyof TypedJobs['tasks']]: WorkflowStep<TTaskSlug, TWorkflowSlugOrInput>\n }[keyof TypedJobs['tasks']]\n\nexport type WorkflowJSON<\n TWorkflowSlugOrInput extends keyof TypedJobs['workflows'] | object = object,\n> = Array<AllWorkflowSteps<TWorkflowSlugOrInput>>\n"],"names":[],"mappings":"AA6CA,WAEiD"}