@lovable.dev/email-js 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -253,4 +253,7 @@ run) instead of being acked, and a render failure or retryable send failure
253
253
  returns 500 so the delivery is retried — the payload's `run_id` doubles as
254
254
  the send idempotency key, so retries cannot double-send. Permanent send
255
255
  rejections (for example an expired run) also return 400 rather than burning
256
- retries on a deterministic failure.
256
+ retries on a deterministic failure. The 400 for an unknown action type carries
257
+ `{ "error": "unsupported_action_type", "action_type": "<type>", "supported_action_types": [...] }`,
258
+ the keys of your `emails` map, so the caller can tell a missing template from
259
+ any other rejection.
package/dist/index.cjs CHANGED
@@ -201,7 +201,11 @@ function createHandler(options, emails, rejectReason) {
201
201
  if (event.version !== "1") return Response.json({ error: `Unsupported payload version: ${event.version}` }, { status: 400 });
202
202
  const actionType = event.data.action_type;
203
203
  const definition = Object.prototype.hasOwnProperty.call(emails, actionType) ? emails[actionType] : void 0;
204
- if (!definition) return Response.json({ error: `Unknown auth email action type: ${actionType}` }, { status: 400 });
204
+ if (!definition) return Response.json({
205
+ error: "unsupported_action_type",
206
+ action_type: actionType,
207
+ supported_action_types: Object.keys(emails)
208
+ }, { status: 400 });
205
209
  const reason = rejectReason(event.data);
206
210
  if (reason) return Response.json({ error: reason }, { status: 400 });
207
211
  try {
package/dist/index.js CHANGED
@@ -200,7 +200,11 @@ function createHandler(options, emails, rejectReason) {
200
200
  if (event.version !== "1") return Response.json({ error: `Unsupported payload version: ${event.version}` }, { status: 400 });
201
201
  const actionType = event.data.action_type;
202
202
  const definition = Object.prototype.hasOwnProperty.call(emails, actionType) ? emails[actionType] : void 0;
203
- if (!definition) return Response.json({ error: `Unknown auth email action type: ${actionType}` }, { status: 400 });
203
+ if (!definition) return Response.json({
204
+ error: "unsupported_action_type",
205
+ action_type: actionType,
206
+ supported_action_types: Object.keys(emails)
207
+ }, { status: 400 });
204
208
  const reason = rejectReason(event.data);
205
209
  if (reason) return Response.json({ error: reason }, { status: 400 });
206
210
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/email-js",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Lovable Email JS",
5
5
  "repository": {
6
6
  "type": "git",