payload-plugin-newsletter 0.25.5 → 0.25.7
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/CHANGELOG.md +16 -0
- package/dist/{broadcast-VMCYSZRY.js → broadcast-KSKQRQB6.js} +1 -1
- package/dist/{chunk-XVMYJQRQ.js → chunk-KZDNTLVF.js} +13 -1
- package/dist/collections.cjs +23 -2
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +23 -2
- package/dist/collections.js.map +1 -1
- package/dist/server.js +17 -8
- package/package.json +1 -1
package/dist/collections.js
CHANGED
|
@@ -207,6 +207,7 @@ var init_broadcast2 = __esm({
|
|
|
207
207
|
}
|
|
208
208
|
async get(id) {
|
|
209
209
|
try {
|
|
210
|
+
console.log("[BroadcastApiProvider] Getting broadcast with ID:", id);
|
|
210
211
|
const response = await fetch(`${this.apiUrl}/api/v1/broadcasts/${id}`, {
|
|
211
212
|
method: "GET",
|
|
212
213
|
headers: {
|
|
@@ -281,7 +282,18 @@ var init_broadcast2 = __esm({
|
|
|
281
282
|
}
|
|
282
283
|
throw new Error(`Broadcast API error: ${response.status} - ${errorText}`);
|
|
283
284
|
}
|
|
284
|
-
const
|
|
285
|
+
const responseText = await response.text();
|
|
286
|
+
console.log("[BroadcastApiProvider] Success response body:", responseText);
|
|
287
|
+
let result;
|
|
288
|
+
try {
|
|
289
|
+
result = JSON.parse(responseText);
|
|
290
|
+
} catch {
|
|
291
|
+
throw new Error(`Failed to parse response as JSON: ${responseText}`);
|
|
292
|
+
}
|
|
293
|
+
console.log("[BroadcastApiProvider] Parsed result:", result);
|
|
294
|
+
if (!result.id) {
|
|
295
|
+
throw new Error(`Response missing expected 'id' field: ${JSON.stringify(result)}`);
|
|
296
|
+
}
|
|
285
297
|
return this.get(result.id.toString());
|
|
286
298
|
} catch (error) {
|
|
287
299
|
if (error instanceof BroadcastProviderError) throw error;
|
|
@@ -2337,7 +2349,16 @@ var createBroadcastsCollection = (pluginConfig) => {
|
|
|
2337
2349
|
providerData: providerBroadcast.providerData
|
|
2338
2350
|
};
|
|
2339
2351
|
} catch (error) {
|
|
2340
|
-
req.payload.logger.error("Failed to create broadcast in provider during initial creation:"
|
|
2352
|
+
req.payload.logger.error("Failed to create broadcast in provider during initial creation:");
|
|
2353
|
+
if (error instanceof Error) {
|
|
2354
|
+
req.payload.logger.error("Error details:", {
|
|
2355
|
+
message: error.message,
|
|
2356
|
+
stack: error.stack,
|
|
2357
|
+
name: error.name
|
|
2358
|
+
});
|
|
2359
|
+
} else {
|
|
2360
|
+
req.payload.logger.error("Raw error:", error);
|
|
2361
|
+
}
|
|
2341
2362
|
return doc;
|
|
2342
2363
|
}
|
|
2343
2364
|
}
|