@upyo/core 0.5.0-dev.180 → 0.5.0-dev.184
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/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/receipt.cjs +4 -4
- package/dist/receipt.d.cts +1 -1
- package/dist/receipt.d.ts +1 -1
- package/dist/receipt.js +4 -4
- package/package.json +9 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
const require_abort_signal = require('./abort-signal.cjs');
|
|
1
2
|
const require_address = require('./address.cjs');
|
|
2
3
|
const require_attachment = require('./attachment.cjs');
|
|
3
|
-
const require_abort_signal = require('./abort-signal.cjs');
|
|
4
4
|
const require_message = require('./message.cjs');
|
|
5
5
|
const require_priority = require('./priority.cjs');
|
|
6
6
|
const require_receipt = require('./receipt.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CombinedSignal, combineSignals } from "./abort-signal.cjs";
|
|
1
2
|
import { Address, EmailAddress, formatAddress, isEmailAddress, parseAddress } from "./address.cjs";
|
|
2
3
|
import { Attachment, isAttachment } from "./attachment.cjs";
|
|
3
|
-
import { CombinedSignal, combineSignals } from "./abort-signal.cjs";
|
|
4
4
|
import { Priority, comparePriority } from "./priority.cjs";
|
|
5
5
|
import { ImmutableHeaders, Message, MessageConstructor, MessageContent, createMessage } from "./message.cjs";
|
|
6
6
|
import { CreateFailedReceiptOptions, CreateReceiptErrorOptions, Receipt, ReceiptError, ReceiptErrorCategory, ReceiptErrorClassification, classifyHttpStatus, classifyReceiptError, createFailedReceipt, createReceiptError, parseRetryAfter } from "./receipt.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CombinedSignal, combineSignals } from "./abort-signal.js";
|
|
1
2
|
import { Address, EmailAddress, formatAddress, isEmailAddress, parseAddress } from "./address.js";
|
|
2
3
|
import { Attachment, isAttachment } from "./attachment.js";
|
|
3
|
-
import { CombinedSignal, combineSignals } from "./abort-signal.js";
|
|
4
4
|
import { Priority, comparePriority } from "./priority.js";
|
|
5
5
|
import { ImmutableHeaders, Message, MessageConstructor, MessageContent, createMessage } from "./message.js";
|
|
6
6
|
import { CreateFailedReceiptOptions, CreateReceiptErrorOptions, Receipt, ReceiptError, ReceiptErrorCategory, ReceiptErrorClassification, classifyHttpStatus, classifyReceiptError, createFailedReceipt, createReceiptError, parseRetryAfter } from "./receipt.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { combineSignals } from "./abort-signal.js";
|
|
1
2
|
import { formatAddress, isEmailAddress, parseAddress } from "./address.js";
|
|
2
3
|
import { isAttachment } from "./attachment.js";
|
|
3
|
-
import { combineSignals } from "./abort-signal.js";
|
|
4
4
|
import { createMessage } from "./message.js";
|
|
5
5
|
import { comparePriority } from "./priority.js";
|
|
6
6
|
import { classifyHttpStatus, classifyReceiptError, createFailedReceipt, createReceiptError, parseRetryAfter } from "./receipt.js";
|
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.
|
|
136
|
-
const errorMessages = typeof error === "string" ? [error] : Array.isArray(error)
|
|
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({
|
package/dist/receipt.d.cts
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
|
|
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
|
|
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.
|
|
135
|
-
const errorMessages = typeof error === "string" ? [error] : Array.isArray(error)
|
|
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.
|
|
3
|
+
"version": "0.5.0-dev.184",
|
|
4
4
|
"description": "Simple email sending library for Node.js, Deno, Bun, and edge functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -49,6 +49,14 @@
|
|
|
49
49
|
"import": "./dist/index.js",
|
|
50
50
|
"require": "./dist/index.cjs"
|
|
51
51
|
},
|
|
52
|
+
"./abort-signal": {
|
|
53
|
+
"types": {
|
|
54
|
+
"import": "./dist/abort-signal.d.ts",
|
|
55
|
+
"require": "./dist/abort-signal.d.cts"
|
|
56
|
+
},
|
|
57
|
+
"import": "./dist/abort-signal.js",
|
|
58
|
+
"require": "./dist/abort-signal.cjs"
|
|
59
|
+
},
|
|
52
60
|
"./address": {
|
|
53
61
|
"types": {
|
|
54
62
|
"import": "./dist/address.d.ts",
|