@upyo/core 0.5.0-dev.178 → 0.5.0-dev.182

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/dist/receipt.cjs CHANGED
@@ -58,12 +58,12 @@ function classifyReceiptError(error) {
58
58
  retryable: true,
59
59
  code: "network"
60
60
  };
61
- if (text.includes("authentication") || text.includes("authenticate") || /\bauth\b/.test(text) || text.includes("unauthorized") || text.includes("forbidden") || text.includes("invalid api key") || text.includes("invalid token") || text.includes("401") || text.includes("403")) return {
61
+ if (text.includes("authentication") || text.includes("authenticate") || text.includes("authorization") || text.includes("authorize") || /\bauth\b/.test(text) || text.includes("unauthorized") || text.includes("not authorized") || text.includes("forbidden") || text.includes("invalid api key") || text.includes("invalid token") || text.includes("401") || text.includes("403")) return {
62
62
  category: "auth",
63
63
  retryable: false,
64
64
  code: "auth"
65
65
  };
66
- if (text.includes("rate limit") || text.includes("too many requests") || text.includes("quota") || text.includes("throttle") || text.includes("429")) return {
66
+ if (text.includes("rate limit") || text.includes("rate-limit") || text.includes("too many requests") || text.includes("quota") || text.includes("throttle") || text.includes("429")) return {
67
67
  category: "rate-limit",
68
68
  retryable: true,
69
69
  code: "rate-limit"
@@ -132,8 +132,8 @@ function createReceiptError(message, options = {}) {
132
132
  * @since 0.5.0
133
133
  */
134
134
  function createFailedReceipt(error, options = {}) {
135
- const errors = options.errors ?? (typeof error === "string" ? [createReceiptError(error, options)] : Array.isArray(error) ? error.every((item) => typeof item === "string") ? error.map((message) => createReceiptError(message, options)) : error : [error]);
136
- const errorMessages = typeof error === "string" ? [error] : Array.isArray(error) && error.every((item) => typeof item === "string") ? error : errors.map((receiptError) => receiptError.message);
135
+ const errors = options.errors ?? (typeof error === "string" ? [createReceiptError(error, options)] : Array.isArray(error) ? error.map((item) => typeof item === "string" ? createReceiptError(item, options) : item) : [error]);
136
+ const errorMessages = typeof error === "string" ? [error] : Array.isArray(error) ? error.map((item) => typeof item === "string" ? item : item.message) : errors.map((receiptError) => receiptError.message);
137
137
  const retryable = options.retryable ?? errors.some((receiptError) => receiptError.retryable);
138
138
  const provider = options.provider ?? errors[0]?.provider;
139
139
  return omitUndefined({
@@ -173,7 +173,7 @@ declare function createReceiptError<TProviderId extends string = string>(message
173
173
  * @returns A failed receipt.
174
174
  * @since 0.5.0
175
175
  */
176
- declare function createFailedReceipt<TProviderId extends string = string>(error: string | readonly string[] | ReceiptError<TProviderId> | readonly ReceiptError<TProviderId>[], options?: CreateFailedReceiptOptions<TProviderId>): Receipt<TProviderId> & {
176
+ declare function createFailedReceipt<TProviderId extends string = string>(error: string | readonly (string | ReceiptError<TProviderId>)[] | ReceiptError<TProviderId>, options?: CreateFailedReceiptOptions<TProviderId>): Receipt<TProviderId> & {
177
177
  readonly successful: false;
178
178
  };
179
179
  /**
package/dist/receipt.d.ts CHANGED
@@ -173,7 +173,7 @@ declare function createReceiptError<TProviderId extends string = string>(message
173
173
  * @returns A failed receipt.
174
174
  * @since 0.5.0
175
175
  */
176
- declare function createFailedReceipt<TProviderId extends string = string>(error: string | readonly string[] | ReceiptError<TProviderId> | readonly ReceiptError<TProviderId>[], options?: CreateFailedReceiptOptions<TProviderId>): Receipt<TProviderId> & {
176
+ declare function createFailedReceipt<TProviderId extends string = string>(error: string | readonly (string | ReceiptError<TProviderId>)[] | ReceiptError<TProviderId>, options?: CreateFailedReceiptOptions<TProviderId>): Receipt<TProviderId> & {
177
177
  readonly successful: false;
178
178
  };
179
179
  /**
package/dist/receipt.js CHANGED
@@ -57,12 +57,12 @@ function classifyReceiptError(error) {
57
57
  retryable: true,
58
58
  code: "network"
59
59
  };
60
- if (text.includes("authentication") || text.includes("authenticate") || /\bauth\b/.test(text) || text.includes("unauthorized") || text.includes("forbidden") || text.includes("invalid api key") || text.includes("invalid token") || text.includes("401") || text.includes("403")) return {
60
+ if (text.includes("authentication") || text.includes("authenticate") || text.includes("authorization") || text.includes("authorize") || /\bauth\b/.test(text) || text.includes("unauthorized") || text.includes("not authorized") || text.includes("forbidden") || text.includes("invalid api key") || text.includes("invalid token") || text.includes("401") || text.includes("403")) return {
61
61
  category: "auth",
62
62
  retryable: false,
63
63
  code: "auth"
64
64
  };
65
- if (text.includes("rate limit") || text.includes("too many requests") || text.includes("quota") || text.includes("throttle") || text.includes("429")) return {
65
+ if (text.includes("rate limit") || text.includes("rate-limit") || text.includes("too many requests") || text.includes("quota") || text.includes("throttle") || text.includes("429")) return {
66
66
  category: "rate-limit",
67
67
  retryable: true,
68
68
  code: "rate-limit"
@@ -131,8 +131,8 @@ function createReceiptError(message, options = {}) {
131
131
  * @since 0.5.0
132
132
  */
133
133
  function createFailedReceipt(error, options = {}) {
134
- const errors = options.errors ?? (typeof error === "string" ? [createReceiptError(error, options)] : Array.isArray(error) ? error.every((item) => typeof item === "string") ? error.map((message) => createReceiptError(message, options)) : error : [error]);
135
- const errorMessages = typeof error === "string" ? [error] : Array.isArray(error) && error.every((item) => typeof item === "string") ? error : errors.map((receiptError) => receiptError.message);
134
+ const errors = options.errors ?? (typeof error === "string" ? [createReceiptError(error, options)] : Array.isArray(error) ? error.map((item) => typeof item === "string" ? createReceiptError(item, options) : item) : [error]);
135
+ const errorMessages = typeof error === "string" ? [error] : Array.isArray(error) ? error.map((item) => typeof item === "string" ? item : item.message) : errors.map((receiptError) => receiptError.message);
136
136
  const retryable = options.retryable ?? errors.some((receiptError) => receiptError.retryable);
137
137
  const provider = options.provider ?? errors[0]?.provider;
138
138
  return omitUndefined({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/core",
3
- "version": "0.5.0-dev.178",
3
+ "version": "0.5.0-dev.182",
4
4
  "description": "Simple email sending library for Node.js, Deno, Bun, and edge functions",
5
5
  "keywords": [
6
6
  "email",