vercel 51.5.1 → 51.7.0

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 (53) hide show
  1. package/dist/chunks/{add-CSYGALLC.js → add-HLIPDOM3.js} +5 -5
  2. package/dist/chunks/{chunk-7V43C2HB.js → chunk-5QNVUXGF.js} +5 -5
  3. package/dist/chunks/{chunk-TY6AGA4P.js → chunk-6GTUL6VG.js} +3 -3
  4. package/dist/chunks/{chunk-GZF6VMKA.js → chunk-BO7LOGQA.js} +4 -4
  5. package/dist/chunks/{chunk-TX6K3Z5E.js → chunk-BXSWMI6W.js} +1 -1
  6. package/dist/chunks/{chunk-LR5Y63NG.js → chunk-HYAMHBSF.js} +1 -1
  7. package/dist/chunks/{chunk-T7LHO6SF.js → chunk-IDDYXD6T.js} +2 -2
  8. package/dist/chunks/{chunk-JHVQUIP6.js → chunk-IS75MWZN.js} +57 -29
  9. package/dist/chunks/{chunk-5I2ESU2C.js → chunk-L7AFYPER.js} +1 -1
  10. package/dist/chunks/{chunk-K3HUUZM5.js → chunk-LGSOFQRC.js} +1 -1
  11. package/dist/chunks/{chunk-QO2ED7OU.js → chunk-LKIVGPRE.js} +5 -2
  12. package/dist/chunks/{chunk-P445TBWL.js → chunk-LOUKPRIS.js} +316 -152
  13. package/dist/chunks/{chunk-7IM2OOGY.js → chunk-QLO5NXAS.js} +1 -1
  14. package/dist/chunks/{chunk-3VIDEX7A.js → chunk-QO6J4DC7.js} +1 -1
  15. package/dist/chunks/{chunk-NJ7GOUCE.js → chunk-QZ3UQIL3.js} +108 -60
  16. package/dist/chunks/{chunk-KAKD6QXJ.js → chunk-T74PTRRA.js} +4 -4
  17. package/dist/chunks/{chunk-EQIXUYBY.js → chunk-V766LKN6.js} +1 -1
  18. package/dist/chunks/chunk-VNDSVCGB.js +2321 -0
  19. package/dist/chunks/{chunk-CXTJ4RY4.js → chunk-WKRF7JKF.js} +1 -1
  20. package/dist/chunks/{chunk-CGTXAXZ4.js → chunk-XKHLPA6V.js} +3 -1
  21. package/dist/chunks/{chunk-KNZNWP2U.js → chunk-YDCXNOCS.js} +3 -3
  22. package/dist/chunks/{chunk-SVYO7LZ5.js → chunk-YKYISUXV.js} +2 -2
  23. package/dist/chunks/{compile-vercel-config-OLTGIW27.js → compile-vercel-config-U4OJGTLE.js} +2 -2
  24. package/dist/chunks/{delete-XAYXXDEB.js → delete-H2OF5N72.js} +3 -3
  25. package/dist/chunks/{disable-PNN5ZWF4.js → disable-Z4ENND33.js} +3 -3
  26. package/dist/chunks/{discard-QUK6T2AQ.js → discard-UQGHXIL4.js} +3 -3
  27. package/dist/chunks/{edit-D2OHUFQ6.js → edit-UFYK3Z3T.js} +4 -4
  28. package/dist/chunks/{enable-SJV7HD2Y.js → enable-2MEB4O5O.js} +3 -3
  29. package/dist/chunks/{export-SN3F75NH.js → export-T5VEXLYZ.js} +3 -3
  30. package/dist/chunks/{inspect-C2ZW7BZA.js → inspect-7CDEJF2U.js} +4 -4
  31. package/dist/chunks/{list-2DKITLDE.js → list-LTDGGY5C.js} +3 -3
  32. package/dist/chunks/{list-EUXU6BVD.js → list-MKMRMDWW.js} +4 -4
  33. package/dist/chunks/{ls-7R3DRCUY.js → ls-GRDKWPVP.js} +5 -5
  34. package/dist/chunks/{publish-HNGKZNDH.js → publish-SMAXMKKV.js} +3 -3
  35. package/dist/chunks/{query-G4SY7VMM.js → query-WGX6PLTN.js} +3 -3
  36. package/dist/chunks/{reorder-Q2LYGVZK.js → reorder-SQ52RGDY.js} +3 -3
  37. package/dist/chunks/{restore-YJUUQLZG.js → restore-P6RHBBEG.js} +3 -3
  38. package/dist/chunks/{rm-XEV4FF6H.js → rm-EDOGYDVM.js} +5 -5
  39. package/dist/chunks/{rule-inspect-JNZMBVJF.js → rule-inspect-GW54LGXF.js} +5 -5
  40. package/dist/chunks/{rules-5PJVEET5.js → rules-MCUCN322.js} +7 -7
  41. package/dist/chunks/{schema-OU7FKPQZ.js → schema-CZ7B2GTS.js} +3 -3
  42. package/dist/chunks/{update-6LXBPVBH.js → update-QHI4MJ6N.js} +5 -5
  43. package/dist/commands/build/index.js +62 -30
  44. package/dist/commands/deploy/index.js +11 -11
  45. package/dist/commands/dev/index.js +75 -44
  46. package/dist/commands/env/index.js +6 -6
  47. package/dist/commands/link/index.js +7 -7
  48. package/dist/commands/list/index.js +4 -4
  49. package/dist/commands-bulk.js +1786 -2567
  50. package/dist/index.js +31 -11
  51. package/dist/version.mjs +1 -1
  52. package/package.json +18 -18
  53. package/dist/chunks/chunk-4T7RWBT7.js +0 -310
@@ -10,27 +10,27 @@ import {
10
10
  isLambda,
11
11
  staticFiles,
12
12
  writeBuildResult
13
- } from "../../chunks/chunk-QO2ED7OU.js";
13
+ } from "../../chunks/chunk-LKIVGPRE.js";
14
14
  import {
15
15
  require_semver
16
16
  } from "../../chunks/chunk-IB5L4LKZ.js";
17
17
  import {
18
18
  pullCommandLogic
19
- } from "../../chunks/chunk-GZF6VMKA.js";
19
+ } from "../../chunks/chunk-BO7LOGQA.js";
20
20
  import {
21
21
  pickOverrides,
22
22
  readProjectSettings
23
- } from "../../chunks/chunk-5I2ESU2C.js";
23
+ } from "../../chunks/chunk-L7AFYPER.js";
24
24
  import {
25
25
  ua_default
26
26
  } from "../../chunks/chunk-4PQA6H63.js";
27
- import "../../chunks/chunk-LR5Y63NG.js";
28
- import "../../chunks/chunk-TY6AGA4P.js";
29
- import "../../chunks/chunk-JHVQUIP6.js";
30
- import "../../chunks/chunk-K3HUUZM5.js";
27
+ import "../../chunks/chunk-HYAMHBSF.js";
28
+ import "../../chunks/chunk-6GTUL6VG.js";
29
+ import "../../chunks/chunk-IS75MWZN.js";
30
+ import "../../chunks/chunk-LGSOFQRC.js";
31
31
  import {
32
32
  buildCommand
33
- } from "../../chunks/chunk-3VIDEX7A.js";
33
+ } from "../../chunks/chunk-QO6J4DC7.js";
34
34
  import {
35
35
  AGENT_REASON,
36
36
  AGENT_STATUS
@@ -58,13 +58,13 @@ import {
58
58
  require_minimatch,
59
59
  resolveProjectCwd,
60
60
  validateConfig
61
- } from "../../chunks/chunk-P445TBWL.js";
61
+ } from "../../chunks/chunk-LOUKPRIS.js";
62
62
  import {
63
63
  TelemetryClient
64
64
  } from "../../chunks/chunk-U3WLEFHU.js";
65
65
  import {
66
66
  outputAgentError
67
- } from "../../chunks/chunk-CGTXAXZ4.js";
67
+ } from "../../chunks/chunk-XKHLPA6V.js";
68
68
  import {
69
69
  stamp_default
70
70
  } from "../../chunks/chunk-CO5D46AG.js";
@@ -124,8 +124,13 @@ import {
124
124
  Span,
125
125
  validateNpmrc,
126
126
  glob,
127
- getWorkerTopics,
127
+ getInternalServiceCronPath,
128
+ getInternalServiceFunctionPath,
129
+ getServiceQueueTopicConfigs,
128
130
  isBackendBuilder,
131
+ isQueueTriggeredService,
132
+ isScheduleTriggeredService,
133
+ sanitizeConsumerName,
129
134
  downloadFile
130
135
  } from "@vercel/build-utils";
131
136
 
@@ -934,7 +939,8 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
934
939
  const diagnostics = {};
935
940
  const packageManifests = [];
936
941
  const hasDetectedServices = detectedServices !== void 0 && detectedServices.length > 0;
937
- const hasWorkerServices = hasDetectedServices && detectedServices.some((s) => s.type === "worker");
942
+ const hasQueueServices = hasDetectedServices && detectedServices.some(isQueueTriggeredService);
943
+ const synthesizedServiceCrons = [];
938
944
  const serviceByBuilder = /* @__PURE__ */ new Map();
939
945
  if (hasDetectedServices) {
940
946
  for (const service of detectedServices) {
@@ -997,7 +1003,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
997
1003
  if (service) {
998
1004
  buildConfig = {
999
1005
  ...build.config,
1000
- ...hasWorkerServices ? { hasWorkerServices: true } : void 0,
1006
+ ...hasQueueServices ? { hasWorkerServices: true } : void 0,
1001
1007
  // Override project-level settings with service-specific ones.
1002
1008
  // The project-level framework is "services" which must NOT be
1003
1009
  // propagated to individual builders.
@@ -1053,6 +1059,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1053
1059
  service: {
1054
1060
  name: service.name,
1055
1061
  type: service.type,
1062
+ trigger: service.trigger,
1056
1063
  routePrefix: typeof serviceRoutePrefix === "string" ? serviceRoutePrefix : void 0,
1057
1064
  workspace: typeof serviceWorkspace === "string" ? serviceWorkspace : void 0,
1058
1065
  schedule: service.schedule
@@ -1192,14 +1199,26 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1192
1199
  allServices: detectedServices
1193
1200
  });
1194
1201
  }
1195
- if (service?.type === "worker" && "output" in buildResult) {
1196
- attachWorkerServiceTrigger(buildResult.output, service);
1202
+ if (service && isQueueTriggeredService(service) && "output" in buildResult) {
1203
+ attachQueueServiceTrigger(buildResult.output, service);
1197
1204
  }
1198
- if (service?.type === "cron" && !("crons" in buildResult && buildResult.crons?.length)) {
1199
- throw new NowBuildError2({
1200
- code: "CRON_SERVICE_NO_CRONS",
1201
- message: `Cron service "${service.name}" did not produce any cron entries. The builder "${builderPkg.name}" may not support cron services.`
1202
- });
1205
+ if (service && isScheduleTriggeredService(service) && !("crons" in buildResult && buildResult.crons?.length)) {
1206
+ if (typeof service.runtime === "string" && typeof service.schedule === "string" && service.schedule !== "<dynamic>") {
1207
+ const cronEntrypoint = service.entrypoint || service.builder.src || "index";
1208
+ synthesizedServiceCrons.push({
1209
+ path: getInternalServiceCronPath(
1210
+ service.name,
1211
+ cronEntrypoint,
1212
+ service.handlerFunction || "cron"
1213
+ ),
1214
+ schedule: service.schedule
1215
+ });
1216
+ } else {
1217
+ throw new NowBuildError2({
1218
+ code: "CRON_SERVICE_NO_CRONS",
1219
+ message: `Scheduled service "${service.name}" did not produce any cron entries. The builder "${builderPkg.name}" may not support scheduled services.`
1220
+ });
1221
+ }
1203
1222
  }
1204
1223
  let mergedBuildResult = buildResult;
1205
1224
  if ("buildOutputPath" in buildResult) {
@@ -1396,7 +1415,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1396
1415
  });
1397
1416
  const mergedImages = mergeImages(localConfig.images, buildResults.values());
1398
1417
  const mergedCrons = mergeCrons(
1399
- localConfig.crons || [],
1418
+ [...localConfig.crons || [], ...synthesizedServiceCrons],
1400
1419
  buildResults.values()
1401
1420
  );
1402
1421
  const mergedWildcard = mergeWildcard(buildResults.values());
@@ -1767,27 +1786,40 @@ function getServicesMergeEntrypoint(service, buildSrc) {
1767
1786
  const sortKey = String(1e4 - normalized.length).padStart(5, "0");
1768
1787
  return `svc:${sortKey}:${normalized}:${service.name}:${buildSrc}`;
1769
1788
  }
1770
- function attachWorkerServiceTrigger(buildOutput, service) {
1771
- const topics = getWorkerTopics(service);
1772
- const consumer = service.consumer || "default";
1773
- for (const topic of topics) {
1789
+ function attachQueueServiceTrigger(buildOutput, service) {
1790
+ const topics = getServiceQueueTopicConfigs(service);
1791
+ const consumer = sanitizeConsumerName(
1792
+ getInternalServiceFunctionPath(service.name)
1793
+ );
1794
+ if (service.builder.use !== "@vercel/python" && topics.length > 1) {
1795
+ throw new Error(
1796
+ `Worker service "${service.name}" has ${topics.length} topics, but multiple topics are only supported for Python workers.`
1797
+ );
1798
+ }
1799
+ for (const topicConfig of topics) {
1774
1800
  const trigger = {
1775
- type: "queue/v1beta",
1776
- topic,
1801
+ type: "queue/v2beta",
1802
+ topic: topicConfig.topic,
1777
1803
  consumer
1778
1804
  };
1805
+ if (topicConfig.retryAfterSeconds !== void 0) {
1806
+ trigger.retryAfterSeconds = topicConfig.retryAfterSeconds;
1807
+ }
1808
+ if (topicConfig.initialDelaySeconds !== void 0) {
1809
+ trigger.initialDelaySeconds = topicConfig.initialDelaySeconds;
1810
+ }
1779
1811
  if (isLambda(buildOutput)) {
1780
- appendWorkerTrigger(buildOutput, trigger);
1812
+ appendQueueTrigger(buildOutput, trigger);
1781
1813
  } else {
1782
1814
  for (const output of Object.values(buildOutput)) {
1783
1815
  if (isLambda(output)) {
1784
- appendWorkerTrigger(output, trigger);
1816
+ appendQueueTrigger(output, trigger);
1785
1817
  }
1786
1818
  }
1787
1819
  }
1788
1820
  }
1789
1821
  }
1790
- function appendWorkerTrigger(lambda, trigger) {
1822
+ function appendQueueTrigger(lambda, trigger) {
1791
1823
  const existingTriggers = Array.isArray(lambda.experimentalTriggers) ? lambda.experimentalTriggers : [];
1792
1824
  const alreadyConfigured = existingTriggers.some(
1793
1825
  (existing) => existing.type === trigger.type && existing.topic === trigger.topic && existing.consumer === trigger.consumer
@@ -14,10 +14,10 @@ import {
14
14
  purchaseDomainIfAvailable,
15
15
  require_cjs,
16
16
  setupDomain
17
- } from "../../chunks/chunk-7V43C2HB.js";
17
+ } from "../../chunks/chunk-5QNVUXGF.js";
18
18
  import {
19
19
  readLocalConfig
20
- } from "../../chunks/chunk-KAKD6QXJ.js";
20
+ } from "../../chunks/chunk-T74PTRRA.js";
21
21
  import {
22
22
  highlight
23
23
  } from "../../chunks/chunk-V5P25P7F.js";
@@ -29,7 +29,7 @@ import {
29
29
  getDeployment,
30
30
  mapCertError
31
31
  } from "../../chunks/chunk-N45K6NXC.js";
32
- import "../../chunks/chunk-EQIXUYBY.js";
32
+ import "../../chunks/chunk-V766LKN6.js";
33
33
  import {
34
34
  validateJsonOutput
35
35
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -42,7 +42,7 @@ import {
42
42
  deprecatedArchiveSplitTgz,
43
43
  getCommandAliases,
44
44
  initSubcommand
45
- } from "../../chunks/chunk-NJ7GOUCE.js";
45
+ } from "../../chunks/chunk-QZ3UQIL3.js";
46
46
  import "../../chunks/chunk-CRZM5WM2.js";
47
47
  import "../../chunks/chunk-BHDZCUTT.js";
48
48
  import "../../chunks/chunk-BJQTGP42.js";
@@ -52,17 +52,17 @@ import "../../chunks/chunk-DVQ4SIWF.js";
52
52
  import "../../chunks/chunk-VGWGLBUC.js";
53
53
  import {
54
54
  pickOverrides
55
- } from "../../chunks/chunk-5I2ESU2C.js";
55
+ } from "../../chunks/chunk-L7AFYPER.js";
56
56
  import "../../chunks/chunk-4PQA6H63.js";
57
57
  import {
58
58
  ensureLink
59
- } from "../../chunks/chunk-TY6AGA4P.js";
59
+ } from "../../chunks/chunk-6GTUL6VG.js";
60
60
  import {
61
61
  validatePaths,
62
62
  validateRootDirectory
63
- } from "../../chunks/chunk-JHVQUIP6.js";
64
- import "../../chunks/chunk-K3HUUZM5.js";
65
- import "../../chunks/chunk-3VIDEX7A.js";
63
+ } from "../../chunks/chunk-IS75MWZN.js";
64
+ import "../../chunks/chunk-LGSOFQRC.js";
65
+ import "../../chunks/chunk-QO6J4DC7.js";
66
66
  import {
67
67
  AGENT_STATUS
68
68
  } from "../../chunks/chunk-E3NE4SKN.js";
@@ -78,13 +78,13 @@ import {
78
78
  parseTarget,
79
79
  require_dist as require_dist2,
80
80
  require_lib
81
- } from "../../chunks/chunk-P445TBWL.js";
81
+ } from "../../chunks/chunk-LOUKPRIS.js";
82
82
  import {
83
83
  TelemetryClient
84
84
  } from "../../chunks/chunk-U3WLEFHU.js";
85
85
  import {
86
86
  outputAgentError
87
- } from "../../chunks/chunk-CGTXAXZ4.js";
87
+ } from "../../chunks/chunk-XKHLPA6V.js";
88
88
  import {
89
89
  require_ms,
90
90
  stamp_default
@@ -9,7 +9,7 @@ import {
9
9
  } from "../../chunks/chunk-2HSQ7YUK.js";
10
10
  import {
11
11
  getUpdateCommand
12
- } from "../../chunks/chunk-CXTJ4RY4.js";
12
+ } from "../../chunks/chunk-WKRF7JKF.js";
13
13
  import {
14
14
  highlight
15
15
  } from "../../chunks/chunk-V5P25P7F.js";
@@ -25,20 +25,20 @@ import {
25
25
  require_mime_types,
26
26
  require_npa,
27
27
  staticFiles
28
- } from "../../chunks/chunk-QO2ED7OU.js";
28
+ } from "../../chunks/chunk-LKIVGPRE.js";
29
29
  import "../../chunks/chunk-IB5L4LKZ.js";
30
30
  import {
31
31
  pickOverrides
32
- } from "../../chunks/chunk-5I2ESU2C.js";
33
- import "../../chunks/chunk-LR5Y63NG.js";
32
+ } from "../../chunks/chunk-L7AFYPER.js";
33
+ import "../../chunks/chunk-HYAMHBSF.js";
34
34
  import {
35
35
  displayDetectedServices,
36
36
  readConfig,
37
37
  setupAndLink
38
- } from "../../chunks/chunk-JHVQUIP6.js";
38
+ } from "../../chunks/chunk-IS75MWZN.js";
39
39
  import {
40
40
  getLocalPathConfig
41
- } from "../../chunks/chunk-K3HUUZM5.js";
41
+ } from "../../chunks/chunk-LGSOFQRC.js";
42
42
  import {
43
43
  help
44
44
  } from "../../chunks/chunk-LDXYSGPZ.js";
@@ -66,14 +66,14 @@ import {
66
66
  resolveProjectCwd,
67
67
  tryDetectServices,
68
68
  validateConfig
69
- } from "../../chunks/chunk-P445TBWL.js";
69
+ } from "../../chunks/chunk-LOUKPRIS.js";
70
70
  import {
71
71
  TelemetryClient
72
72
  } from "../../chunks/chunk-U3WLEFHU.js";
73
73
  import {
74
74
  buildCommandWithYes,
75
75
  outputActionRequired
76
- } from "../../chunks/chunk-CGTXAXZ4.js";
76
+ } from "../../chunks/chunk-XKHLPA6V.js";
77
77
  import {
78
78
  require_ms
79
79
  } from "../../chunks/chunk-CO5D46AG.js";
@@ -16792,6 +16792,7 @@ var import_frameworks2 = __toESM(require_frameworks(), 1);
16792
16792
  import {
16793
16793
  cloneEnv as cloneEnv2,
16794
16794
  getNodeBinPaths as getNodeBinPaths2,
16795
+ isQueueTriggeredService as isQueueTriggeredService3,
16795
16796
  FileFsRef as FileFsRef2,
16796
16797
  spawnCommand as spawnCommand2,
16797
16798
  shouldUseExperimentalBackends
@@ -17695,6 +17696,8 @@ function getNextCronDelay(expression, now = /* @__PURE__ */ new Date()) {
17695
17696
 
17696
17697
  // src/util/dev/services-orchestrator.ts
17697
17698
  import {
17699
+ isQueueTriggeredService,
17700
+ isScheduleTriggeredService,
17698
17701
  cloneEnv,
17699
17702
  getNodeBinPaths,
17700
17703
  spawnCommand,
@@ -17770,13 +17773,16 @@ function createServiceLogger(serviceName, colorIndex, maxNameLength) {
17770
17773
  return { stdout, stderr, cleanup };
17771
17774
  }
17772
17775
  function getServiceRoutePrefixes(service) {
17773
- if (service.type === "worker") {
17776
+ if (isQueueTriggeredService(service)) {
17774
17777
  return [(0, import_fs_detectors2.getInternalServiceWorkerPathPrefix)(service.name)];
17775
17778
  }
17776
- if (service.type === "cron") {
17779
+ if (isScheduleTriggeredService(service)) {
17777
17780
  return [(0, import_fs_detectors2.getInternalServiceCronPathPrefix)(service.name)];
17778
17781
  }
17779
- return [service.routePrefix || "/"];
17782
+ if (service.type === "web") {
17783
+ return [service.routePrefix || "/"];
17784
+ }
17785
+ return [];
17780
17786
  }
17781
17787
  var ServicesOrchestrator = class {
17782
17788
  constructor(options) {
@@ -17793,7 +17799,7 @@ var ServicesOrchestrator = class {
17793
17799
  this.pythonServiceCount = options.services.filter(
17794
17800
  (s) => s.runtime === "python"
17795
17801
  ).length;
17796
- this.hasWorkerServices = options.services.some((s) => s.type === "worker");
17802
+ this.hasQueueServices = options.services.some(isQueueTriggeredService);
17797
17803
  }
17798
17804
  async startAll() {
17799
17805
  output_manager_default.debug(`Starting ${this.services.length} services`);
@@ -17917,10 +17923,13 @@ var ServicesOrchestrator = class {
17917
17923
  serviceUrlEnvVars
17918
17924
  );
17919
17925
  env.VERCEL_SERVICE_TYPE = service.type;
17920
- if (this.hasWorkerServices && service.runtime === "python" && env.VERCEL_HAS_WORKER_SERVICES === void 0) {
17926
+ if (service.trigger) {
17927
+ env.VERCEL_SERVICE_TRIGGER = service.trigger;
17928
+ }
17929
+ if (this.hasQueueServices && service.runtime === "python" && env.VERCEL_HAS_WORKER_SERVICES === void 0) {
17921
17930
  env.VERCEL_HAS_WORKER_SERVICES = "1";
17922
17931
  }
17923
- if (this.hasWorkerServices) {
17932
+ if (this.hasQueueServices) {
17924
17933
  env.VERCEL_QUEUE_BASE_URL = `${this.proxyOrigin}/_svc/_queues`;
17925
17934
  env.VERCEL_QUEUE_TOKEN = "vc-dev-token";
17926
17935
  }
@@ -17988,6 +17997,7 @@ var ServicesOrchestrator = class {
17988
17997
  service: {
17989
17998
  name: service.name,
17990
17999
  type: service.type,
18000
+ trigger: service.trigger,
17991
18001
  routePrefix: service.routePrefix,
17992
18002
  subdomain: service.subdomain,
17993
18003
  workspace: service.workspace,
@@ -18190,11 +18200,22 @@ var ServicesOrchestrator = class {
18190
18200
  }
18191
18201
  startCronSchedulers() {
18192
18202
  for (const [name, managed] of this.managedServices) {
18193
- if (!managed.crons?.length)
18203
+ const service = this.services.find((candidate) => candidate.name === name);
18204
+ const crons = managed.crons && managed.crons.length > 0 ? managed.crons : service && isScheduleTriggeredService(service) && service.schedule && service.schedule !== "<dynamic>" ? [
18205
+ {
18206
+ path: (0, import_fs_detectors2.getInternalServiceCronPath)(
18207
+ name,
18208
+ service.entrypoint || service.builder.src || "index",
18209
+ service.handlerFunction || "cron"
18210
+ ),
18211
+ schedule: service.schedule
18212
+ }
18213
+ ] : [];
18214
+ if (crons.length === 0)
18194
18215
  continue;
18195
- for (const cron of managed.crons) {
18216
+ for (const cron of crons) {
18196
18217
  output_manager_default.debug(
18197
- `Scheduling cron service ${import_chalk.default.bold(name)} (${import_chalk.default.cyan(cron.schedule)})`
18218
+ `Scheduling job service ${import_chalk.default.bold(name)} (${import_chalk.default.cyan(cron.schedule)})`
18198
18219
  );
18199
18220
  this.scheduleCronTrigger(name, cron.path, cron.schedule, managed);
18200
18221
  }
@@ -18212,7 +18233,7 @@ var ServicesOrchestrator = class {
18212
18233
  if (this.stopping)
18213
18234
  return;
18214
18235
  output_manager_default.debug(
18215
- `Triggering cron service ${import_chalk.default.bold(serviceName)} (schedule: ${import_chalk.default.cyan(schedule)})`
18236
+ `Triggering scheduled job ${import_chalk.default.bold(serviceName)} (schedule: ${import_chalk.default.cyan(schedule)})`
18216
18237
  );
18217
18238
  try {
18218
18239
  const url3 = `http://${managed.host}:${managed.port}${cronPath}`;
@@ -18235,7 +18256,10 @@ var ServicesOrchestrator = class {
18235
18256
  var import_ms3 = __toESM(require_ms(), 1);
18236
18257
  var import_node_fetch = __toESM(require_lib2(), 1);
18237
18258
  import { randomBytes } from "crypto";
18238
- import { getWorkerTopics } from "@vercel/build-utils";
18259
+ import {
18260
+ getServiceQueueTopicConfigs,
18261
+ isQueueTriggeredService as isQueueTriggeredService2
18262
+ } from "@vercel/build-utils";
18239
18263
  var DEFAULT_RETRY_AFTER = (0, import_ms3.default)("1m");
18240
18264
  var DEFAULT_MAX_DELIVERIES = 32;
18241
18265
  var DEFAULT_INITIAL_DELAY = 0;
@@ -18253,10 +18277,11 @@ var QueueBroker = class {
18253
18277
  this.consumerGroups = [];
18254
18278
  this.deliveryState = /* @__PURE__ */ new Map();
18255
18279
  for (const service of services) {
18256
- if (service.type !== "worker")
18280
+ if (!isQueueTriggeredService2(service))
18257
18281
  continue;
18258
- const topicPatterns = getWorkerTopics(service);
18259
- for (const topicPattern of topicPatterns) {
18282
+ const topicConfigs = getServiceQueueTopicConfigs(service);
18283
+ for (const topicConfig of topicConfigs) {
18284
+ const topicPattern = topicConfig.topic;
18260
18285
  const id = `${service.name}::${topicPattern}`;
18261
18286
  const group = {
18262
18287
  id,
@@ -18264,9 +18289,9 @@ var QueueBroker = class {
18264
18289
  topicPattern,
18265
18290
  topicRegex: topicPatternToRegex(topicPattern),
18266
18291
  serviceOriginFn: () => this.getServiceOrigin(service.name),
18267
- retryAfterMs: DEFAULT_RETRY_AFTER,
18292
+ retryAfterMs: topicConfig.retryAfterSeconds !== void 0 ? topicConfig.retryAfterSeconds * 1e3 : DEFAULT_RETRY_AFTER,
18268
18293
  maxDeliveries: DEFAULT_MAX_DELIVERIES,
18269
- initialDelayMs: DEFAULT_INITIAL_DELAY
18294
+ initialDelayMs: topicConfig.initialDelaySeconds !== void 0 ? topicConfig.initialDelaySeconds * 1e3 : DEFAULT_INITIAL_DELAY
18270
18295
  };
18271
18296
  this.consumerGroups.push(group);
18272
18297
  this.deliveryState.set(group.id, /* @__PURE__ */ new Map());
@@ -18459,27 +18484,33 @@ var QueueBroker = class {
18459
18484
  state.receiptHandle = receiptHandle;
18460
18485
  state.deliveryCount++;
18461
18486
  state.leaseExpiresAt = Date.now() + DEFAULT_VISIBILITY_TIMEOUT;
18462
- const cloudEvent = JSON.stringify({
18463
- type: "com.vercel.queue.v1beta",
18464
- specversion: "1.0",
18465
- source: "vc-dev",
18466
- id: message2.messageId,
18467
- time: (/* @__PURE__ */ new Date()).toISOString(),
18468
- datacontenttype: "application/json",
18469
- data: {
18470
- queueName: message2.queueName,
18471
- consumerGroup: group.name,
18472
- messageId: message2.messageId
18473
- }
18474
- });
18487
+ const now = (/* @__PURE__ */ new Date()).toISOString();
18488
+ const expiresAt = new Date(
18489
+ new Date(message2.createdAt).getTime() + message2.retentionMs
18490
+ ).toISOString();
18475
18491
  output_manager_default.debug(
18476
- `queues: dispatching CloudEvent to worker "${group.name}" at ${upstream}`
18492
+ `queues: dispatching v2beta callback to worker "${group.name}" at ${upstream}`
18477
18493
  );
18478
18494
  try {
18479
18495
  const response = await (0, import_node_fetch.default)(`${upstream}/`, {
18480
18496
  method: "POST",
18481
- headers: { "Content-Type": "application/cloudevents+json" },
18482
- body: cloudEvent
18497
+ headers: {
18498
+ "content-type": message2.contentType,
18499
+ "ce-type": "com.vercel.queue.v2beta",
18500
+ "ce-specversion": "1.0",
18501
+ "ce-source": `/topic/${message2.queueName}/consumer/${group.name}`,
18502
+ "ce-id": message2.messageId,
18503
+ "ce-time": now,
18504
+ "ce-vqsmessageid": message2.messageId,
18505
+ "ce-vqsqueuename": message2.queueName,
18506
+ "ce-vqsconsumergroup": group.name,
18507
+ "ce-vqsreceipthandle": receiptHandle,
18508
+ "ce-vqsdeliverycount": String(state.deliveryCount),
18509
+ "ce-vqscreatedat": message2.createdAt,
18510
+ "ce-vqsexpiresat": expiresAt,
18511
+ "ce-vqsregion": "dev1"
18512
+ },
18513
+ body: message2.payload
18483
18514
  });
18484
18515
  if (!response.ok) {
18485
18516
  output_manager_default.debug(
@@ -19827,7 +19858,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
19827
19858
  return void 0;
19828
19859
  }
19829
19860
  async _getVercelConfig() {
19830
- const { compileVercelConfig } = await import("../../chunks/compile-vercel-config-OLTGIW27.js");
19861
+ const { compileVercelConfig } = await import("../../chunks/compile-vercel-config-U4OJGTLE.js");
19831
19862
  await compileVercelConfig(this.cwd);
19832
19863
  const configPath = getLocalPathConfig(this.cwd);
19833
19864
  const [
@@ -20115,10 +20146,10 @@ Please ensure that ${cmd(err.path)} is properly installed`;
20115
20146
  });
20116
20147
  devCommandPromise = this.orchestrator.startAll();
20117
20148
  this.devProcessOrigin = void 0;
20118
- const workerServices = (this.services || []).filter(
20119
- (s) => s.type === "worker"
20149
+ const queueServices = (this.services || []).filter(
20150
+ isQueueTriggeredService3
20120
20151
  );
20121
- if (workerServices.length > 0) {
20152
+ if (queueServices.length > 0) {
20122
20153
  this.queueBroker = new QueueBroker(
20123
20154
  this.services || [],
20124
20155
  (name) => this.orchestrator.getServiceOrigin(name)
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  formatEnvironment,
21
21
  validateLsArgs
22
- } from "../../chunks/chunk-TX6K3Z5E.js";
22
+ } from "../../chunks/chunk-BXSWMI6W.js";
23
23
  import {
24
24
  validateJsonOutput
25
25
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "../../chunks/chunk-YPQSDAEW.js";
29
29
  import {
30
30
  getCommandAliases
31
- } from "../../chunks/chunk-NJ7GOUCE.js";
31
+ } from "../../chunks/chunk-QZ3UQIL3.js";
32
32
  import "../../chunks/chunk-CRZM5WM2.js";
33
33
  import "../../chunks/chunk-BHDZCUTT.js";
34
34
  import "../../chunks/chunk-BJQTGP42.js";
@@ -38,10 +38,10 @@ import "../../chunks/chunk-DVQ4SIWF.js";
38
38
  import "../../chunks/chunk-VGWGLBUC.js";
39
39
  import {
40
40
  require_execa
41
- } from "../../chunks/chunk-LR5Y63NG.js";
41
+ } from "../../chunks/chunk-HYAMHBSF.js";
42
42
  import {
43
43
  autoInstallVercelPlugin
44
- } from "../../chunks/chunk-3VIDEX7A.js";
44
+ } from "../../chunks/chunk-QO6J4DC7.js";
45
45
  import "../../chunks/chunk-E3NE4SKN.js";
46
46
  import {
47
47
  help
@@ -66,7 +66,7 @@ import {
66
66
  require_frameworks,
67
67
  runSubcommand,
68
68
  updateSubcommand
69
- } from "../../chunks/chunk-P445TBWL.js";
69
+ } from "../../chunks/chunk-LOUKPRIS.js";
70
70
  import {
71
71
  TelemetryClient,
72
72
  require_dist as require_dist2
@@ -81,7 +81,7 @@ import {
81
81
  getPreservedArgsForEnvUpdate,
82
82
  outputActionRequired,
83
83
  outputAgentError
84
- } from "../../chunks/chunk-CGTXAXZ4.js";
84
+ } from "../../chunks/chunk-XKHLPA6V.js";
85
85
  import {
86
86
  require_ms,
87
87
  stamp_default
@@ -11,7 +11,7 @@ import {
11
11
  addSubcommand7 as addSubcommand,
12
12
  getCommandAliases,
13
13
  linkCommand
14
- } from "../../chunks/chunk-NJ7GOUCE.js";
14
+ } from "../../chunks/chunk-QZ3UQIL3.js";
15
15
  import "../../chunks/chunk-CRZM5WM2.js";
16
16
  import "../../chunks/chunk-BHDZCUTT.js";
17
17
  import "../../chunks/chunk-BJQTGP42.js";
@@ -21,12 +21,12 @@ import "../../chunks/chunk-DVQ4SIWF.js";
21
21
  import "../../chunks/chunk-VGWGLBUC.js";
22
22
  import {
23
23
  ensureLink
24
- } from "../../chunks/chunk-TY6AGA4P.js";
25
- import "../../chunks/chunk-JHVQUIP6.js";
26
- import "../../chunks/chunk-K3HUUZM5.js";
24
+ } from "../../chunks/chunk-6GTUL6VG.js";
25
+ import "../../chunks/chunk-IS75MWZN.js";
26
+ import "../../chunks/chunk-LGSOFQRC.js";
27
27
  import {
28
28
  autoInstallVercelPlugin
29
- } from "../../chunks/chunk-3VIDEX7A.js";
29
+ } from "../../chunks/chunk-QO6J4DC7.js";
30
30
  import "../../chunks/chunk-E3NE4SKN.js";
31
31
  import {
32
32
  help
@@ -36,11 +36,11 @@ import {
36
36
  addRepoLink,
37
37
  ensureRepoLink,
38
38
  getTeams
39
- } from "../../chunks/chunk-P445TBWL.js";
39
+ } from "../../chunks/chunk-LOUKPRIS.js";
40
40
  import {
41
41
  TelemetryClient
42
42
  } from "../../chunks/chunk-U3WLEFHU.js";
43
- import "../../chunks/chunk-CGTXAXZ4.js";
43
+ import "../../chunks/chunk-XKHLPA6V.js";
44
44
  import "../../chunks/chunk-CO5D46AG.js";
45
45
  import {
46
46
  getFlagsSpecification,
@@ -19,11 +19,11 @@ import {
19
19
  } from "../../chunks/chunk-N45K6NXC.js";
20
20
  import {
21
21
  getScope
22
- } from "../../chunks/chunk-EQIXUYBY.js";
22
+ } from "../../chunks/chunk-V766LKN6.js";
23
23
  import {
24
24
  formatEnvironment,
25
25
  validateLsArgs
26
- } from "../../chunks/chunk-TX6K3Z5E.js";
26
+ } from "../../chunks/chunk-BXSWMI6W.js";
27
27
  import {
28
28
  validateJsonOutput
29
29
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -41,11 +41,11 @@ import {
41
41
  getLinkedProject,
42
42
  getProjectByNameOrId,
43
43
  parseTarget
44
- } from "../../chunks/chunk-P445TBWL.js";
44
+ } from "../../chunks/chunk-LOUKPRIS.js";
45
45
  import {
46
46
  TelemetryClient
47
47
  } from "../../chunks/chunk-U3WLEFHU.js";
48
- import "../../chunks/chunk-CGTXAXZ4.js";
48
+ import "../../chunks/chunk-XKHLPA6V.js";
49
49
  import {
50
50
  elapsed,
51
51
  require_ms