@vercel/queue 0.0.0-alpha.20 → 0.0.0-alpha.22

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.
package/README.md CHANGED
@@ -192,7 +192,6 @@ Configure which topics and consumers your API route handles:
192
192
  "type": "queue/v1beta",
193
193
  "topic": "my-topic",
194
194
  "consumer": "my-consumer",
195
- "maxAttempts": 3,
196
195
  "retryAfterSeconds": 60,
197
196
  "initialDelaySeconds": 0
198
197
  },
@@ -205,7 +204,6 @@ Configure which topics and consumers your API route handles:
205
204
  "type": "queue/v1beta",
206
205
  "topic": "order-events",
207
206
  "consumer": "analytics",
208
- "maxAttempts": 5,
209
207
  "retryAfterSeconds": 300
210
208
  }
211
209
  ]
@@ -60,17 +60,37 @@ function readVercelConfig(configPath = "./vercel.json") {
60
60
 
61
61
  if (hasQueueTrigger) {
62
62
  // Convert file path to API route
63
+ // Examples:
63
64
  // app/api/vm/queue/route.ts -> /api/vm/queue
65
+ // src/app/api/queue/route.ts -> /api/queue
64
66
  // pages/api/queue.ts -> /api/queue
67
+ // src/pages/api/queue.ts -> /api/queue
68
+ // app/queue/route.ts -> /queue
69
+ // src/app/webhooks/route.ts -> /webhooks
65
70
  let apiPath = functionPath;
66
71
 
67
- if (apiPath.startsWith("app/api/")) {
68
- apiPath = apiPath.replace("app/api/", "/api/");
72
+ // Handle src/ prefix
73
+ if (apiPath.startsWith("src/")) {
74
+ apiPath = apiPath.replace("src/", "");
75
+ }
76
+
77
+ // Convert Next.js file paths to HTTP routes
78
+ if (apiPath.startsWith("app/")) {
79
+ // App Router: app/api/queue/route.ts -> /api/queue
80
+ // App Router: app/queue/route.ts -> /queue
81
+ apiPath = apiPath.replace("app/", "/");
69
82
  } else if (apiPath.startsWith("pages/api/")) {
83
+ // Pages Router: pages/api/queue.ts -> /api/queue
70
84
  apiPath = apiPath.replace("pages/api/", "/api/");
85
+ } else if (apiPath.startsWith("pages/")) {
86
+ // Pages Router: pages/queue.ts -> /queue
87
+ apiPath = apiPath.replace("pages/", "/");
88
+ } else {
89
+ // Fallback: assume it's a root-level route
90
+ apiPath = "/" + apiPath;
71
91
  }
72
92
 
73
- // Remove file extensions and /route suffix
93
+ // Remove file extensions and Next.js-specific suffixes
74
94
  apiPath = apiPath.replace(
75
95
  /\/(route|index)\.(ts|js|tsx|jsx)$/,
76
96
  "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/queue",
3
- "version": "0.0.0-alpha.20",
3
+ "version": "0.0.0-alpha.22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },