dymo-api 1.2.5 → 1.2.6
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/cjs/branches/private/functions/extractWithTextly/index.cjs +33 -0
- package/dist/cjs/branches/private/functions/getRandom/index.cjs +37 -0
- package/dist/cjs/branches/private/functions/isValidData/index.cjs +33 -0
- package/dist/cjs/branches/private/functions/isValidEmail/index.cjs +73 -0
- package/dist/cjs/branches/private/functions/sendEmail/index.cjs +88 -0
- package/dist/cjs/branches/private/index.cjs +21 -0
- package/dist/cjs/branches/public/functions/getPrayerTimes/index.cjs +31 -0
- package/dist/cjs/branches/public/functions/isValidPwd/index.cjs +65 -0
- package/dist/cjs/branches/public/functions/satinize/index.cjs +26 -0
- package/dist/cjs/branches/public/index.cjs +19 -0
- package/dist/cjs/config/index.cjs +0 -21
- package/dist/cjs/dymo-api.cjs +46 -15
- package/dist/cjs/lib/types/interfaces.cjs +0 -1
- package/dist/cjs/lib/types/well-known-bots.cjs +739 -0
- package/dist/cjs/utils/basics.cjs +18 -0
- package/dist/esm/branches/private/functions/extractWithTextly/index.js +29 -0
- package/dist/esm/branches/private/functions/getRandom/index.js +33 -0
- package/dist/esm/branches/private/functions/isValidData/index.js +29 -0
- package/dist/esm/branches/private/functions/isValidEmail/index.js +69 -0
- package/dist/esm/branches/private/functions/sendEmail/index.js +81 -0
- package/dist/esm/branches/private/index.js +5 -0
- package/dist/esm/branches/public/functions/getPrayerTimes/index.js +27 -0
- package/dist/esm/branches/{public.js → public/functions/isValidPwd/index.js} +28 -30
- package/dist/esm/branches/public/functions/satinize/index.js +22 -0
- package/dist/esm/branches/public/index.js +3 -0
- package/dist/esm/config/index.js +0 -15
- package/dist/esm/dymo-api.js +43 -15
- package/dist/esm/lib/types/interfaces.js +0 -1
- package/dist/esm/lib/types/well-known-bots.js +736 -0
- package/dist/esm/utils/basics.js +10 -0
- package/dist/types/branches/private/functions/extractWithTextly/index.d.ts +16 -0
- package/dist/types/branches/private/functions/getRandom/index.d.ts +16 -0
- package/dist/types/branches/private/functions/isValidData/index.d.ts +15 -0
- package/dist/types/branches/private/functions/isValidEmail/index.d.ts +20 -0
- package/dist/types/branches/private/functions/sendEmail/index.d.ts +18 -0
- package/dist/types/branches/private/index.d.ts +5 -0
- package/dist/types/branches/public/functions/getPrayerTimes/index.d.ts +17 -0
- package/dist/types/branches/public/functions/isValidPwd/index.d.ts +28 -0
- package/dist/types/branches/public/functions/satinize/index.d.ts +12 -0
- package/dist/types/branches/public/index.d.ts +3 -0
- package/dist/types/config/index.d.ts +0 -4
- package/dist/types/dymo-api.d.ts +18 -2
- package/dist/types/lib/types/interfaces.d.ts +0 -3
- package/dist/types/lib/types/rules.d.ts +10 -0
- package/dist/types/lib/types/well-known-bots.d.ts +4 -0
- package/dist/types/utils/basics.d.ts +2 -0
- package/package.json +13 -5
- package/dist/cjs/branches/private.cjs +0 -284
- package/dist/cjs/branches/public.cjs +0 -102
- package/dist/esm/branches/private.js +0 -240
- package/dist/types/branches/private.d.ts +0 -76
- package/dist/types/branches/public.d.ts +0 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import config from "../config/index.js";
|
|
2
|
+
export const customError = (code, message) => {
|
|
3
|
+
return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
4
|
+
};
|
|
5
|
+
export const validBaseURL = (baseUrl) => {
|
|
6
|
+
if (/^(https:\/\/api\.tpeoficial\.com$|http:\/\/(localhost:\d+|dymoapi:\d+))$/.test(baseUrl))
|
|
7
|
+
return baseUrl;
|
|
8
|
+
else
|
|
9
|
+
throw new Error("[Dymo API] Invalid URL. It must be https://api.tpeoficial.com or start with http://localhost or http://dymoapi followed by a port.");
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts structured data from a given string using a secure endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @param token - A string or null representing the authentication token. Must not be null.
|
|
7
|
+
* @param data - An object adhering to the ExtractWithTextly interface, containing 'data' and 'format' fields.
|
|
8
|
+
* The 'data' field is the string from which structured data should be extracted.
|
|
9
|
+
* The 'format' field is an object defining the structure of the data to be extracted.
|
|
10
|
+
*
|
|
11
|
+
* @returns A promise that resolves to the response data containing the extracted structured data.
|
|
12
|
+
*
|
|
13
|
+
* @throws Will throw an error if the token is null, if 'data' or 'format' are not defined,
|
|
14
|
+
* or if an error occurs during the request to the extraction endpoint.
|
|
15
|
+
*/
|
|
16
|
+
export declare const extractWithTextly: (axiosClient: AxiosInstance, data: Interfaces.ExtractWithTextly) => Promise<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a random number within a specified range using a secure endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @param token - A string or null representing the authentication token. Must not be null.
|
|
7
|
+
* @param data - An object adhering to the SRNG interface, containing 'min' and 'max' fields,
|
|
8
|
+
* which define the inclusive range within which the random number should be generated.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves to the response data containing the random number.
|
|
11
|
+
*
|
|
12
|
+
* @throws Will throw an error if the token is null, if 'min' or 'max' are not defined,
|
|
13
|
+
* if 'min' is not less than 'max', if 'min' or 'max' are out of the allowed range,
|
|
14
|
+
* or if an error occurs during the request to the random number generator endpoint.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getRandom: (axiosClient: AxiosInstance, data: Interfaces.SRNG) => Promise<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Validates the provided data using a secure verification endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @param token - A string or null representing the authentication token. Must not be null.
|
|
7
|
+
* @param data - An object adhering to the Validator interface, containing at least one of the following fields:
|
|
8
|
+
* url, email, phone, domain, creditCard, ip, wallet or user agent.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves to the response data from the verification endpoint.
|
|
11
|
+
*
|
|
12
|
+
* @throws Will throw an error if the token is null, if none of the required fields are present in the data,
|
|
13
|
+
* or if an error occurs during the verification request.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isValidData: (axiosClient: AxiosInstance, data: Interfaces.Validator) => Promise<any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Validates an email using a secure verification endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @param {string | null} token - Authentication token (required).
|
|
7
|
+
* @param {Interfaces.EmailValidator} email - Email to validate.
|
|
8
|
+
* @param {Interfaces.EmailValidatorRules} [rules] - Deny rules. Defaults to ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"].
|
|
9
|
+
*
|
|
10
|
+
* Deny rules (some are premium ⚠️):
|
|
11
|
+
* - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
|
|
12
|
+
* "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
|
|
15
|
+
* @throws Error if token is null, rules are empty, or request fails.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const valid = await isValidEmail(apiToken, "user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
19
|
+
*/
|
|
20
|
+
export declare const isValidEmail: (axiosClient: AxiosInstance, email: Interfaces.EmailValidator, rules: Interfaces.EmailValidatorRules) => Promise<any>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Sends an email using a secure sending endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @param token - A string or null representing the authentication token. Must not be null.
|
|
7
|
+
* @param data - An object adhering to the SendEmail interface, containing the following fields:
|
|
8
|
+
* 'from', 'to', 'subject', 'html' or 'react', and optionally 'attachments', 'options', 'priority', 'waitToResponse', and 'composeTailwindClasses'.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves to the response data from the sending endpoint.
|
|
11
|
+
*
|
|
12
|
+
* @throws Will throw an error if the token is null, if any of the required fields are missing,
|
|
13
|
+
* if the 'react' field is not a valid React element, if the 'attachments' field exceeds the maximum allowed size of 40 MB,
|
|
14
|
+
* or if an error occurs during the sending request.
|
|
15
|
+
*/
|
|
16
|
+
export declare const sendEmail: (axiosClient: AxiosInstance, data: Interfaces.SendEmail & {
|
|
17
|
+
serverEmailConfig: Interfaces.ServerEmailConfig | undefined;
|
|
18
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the prayer times for the given location.
|
|
5
|
+
*
|
|
6
|
+
* This method requires a latitude and longitude to be provided in the
|
|
7
|
+
* data object. If either of these are not provided, it will throw an error.
|
|
8
|
+
*
|
|
9
|
+
* @param {Interfaces.PrayerTimesData} data - The data to be sent.
|
|
10
|
+
* @param {number} data.lat - The latitude of the location.
|
|
11
|
+
* @param {number} data.lon - The longitude of the location.
|
|
12
|
+
* @returns {Promise<any>} A promise that resolves to the response from the server.
|
|
13
|
+
* @throws Will throw an error if there is an issue with the prayer times retrieval process.
|
|
14
|
+
*
|
|
15
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/prayertimes)
|
|
16
|
+
*/
|
|
17
|
+
export declare const getPrayerTimes: (axiosClient: AxiosInstance, data: Interfaces.PrayerTimesData) => Promise<any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import * as Interfaces from "../../../../lib/types/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Validates a password based on the given parameters.
|
|
5
|
+
*
|
|
6
|
+
* This method requires the password to be provided in the data object.
|
|
7
|
+
* If the password is not provided, it will throw an error. The method
|
|
8
|
+
* will validate the password against the following rules:
|
|
9
|
+
* - The password must be at least 8 characters long.
|
|
10
|
+
* - The password must be at most 32 characters long.
|
|
11
|
+
* - The password must contain at least one uppercase letter.
|
|
12
|
+
* - The password must contain at least one lowercase letter.
|
|
13
|
+
* - The password must contain at least one number.
|
|
14
|
+
* - The password must contain at least one special character.
|
|
15
|
+
* - The password must not contain any of the given banned words.
|
|
16
|
+
*
|
|
17
|
+
* @param {Interfaces.IsValidPwdData} data - The data to be sent.
|
|
18
|
+
* @param {string} [data.email] - Optional email associated with the password.
|
|
19
|
+
* @param {string} data.password - The password to be validated.
|
|
20
|
+
* @param {string | string[]} [data.bannedWords] - The list of banned words that the password must not contain.
|
|
21
|
+
* @param {number} [data.min] - Minimum length of the password. Defaults to 8 if not provided.
|
|
22
|
+
* @param {number} [data.max] - Maximum length of the password. Defaults to 32 if not provided.
|
|
23
|
+
* @returns {Promise<Interfaces.PasswordValidationResult>} A promise that resolves to the response from the server.
|
|
24
|
+
* @throws Will throw an error if there is an issue with the password validation process.
|
|
25
|
+
*
|
|
26
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/password-validator)
|
|
27
|
+
*/
|
|
28
|
+
export declare const isValidPwd: (axiosClient: AxiosInstance, data: Interfaces.IsValidPwdData) => Promise<any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes the input, replacing any special characters with their HTML entities.
|
|
4
|
+
*
|
|
5
|
+
* @param {Interfaces.InputSatinizerData} data - The data to be sent.
|
|
6
|
+
* @param {string} data.input - The input to be sanitized.
|
|
7
|
+
* @returns {Promise<any>} A promise that resolves to the response from the server.
|
|
8
|
+
* @throws Will throw an error if there is an issue with the sanitization process.
|
|
9
|
+
*
|
|
10
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
11
|
+
*/
|
|
12
|
+
export declare const satinize: (axiosClient: AxiosInstance, input: string) => Promise<any>;
|
package/dist/types/dymo-api.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare class DymoAPI {
|
|
|
5
5
|
private serverEmailConfig?;
|
|
6
6
|
private rules;
|
|
7
7
|
private baseUrl;
|
|
8
|
+
private axiosClient;
|
|
8
9
|
/**
|
|
9
10
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
10
11
|
* @param {string} [options.rootApiKey] - The root API key.
|
|
@@ -19,7 +20,7 @@ declare class DymoAPI {
|
|
|
19
20
|
* @example
|
|
20
21
|
* const dymoApi = new DymoAPI({
|
|
21
22
|
* rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
|
|
22
|
-
* apiKey: "
|
|
23
|
+
* apiKey: "dm_4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
23
24
|
* });
|
|
24
25
|
*/
|
|
25
26
|
constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig, rules }?: {
|
|
@@ -147,6 +148,7 @@ declare class DymoAPI {
|
|
|
147
148
|
* Satinizes the input, replacing any special characters with their HTML
|
|
148
149
|
* entities.
|
|
149
150
|
*
|
|
151
|
+
* @deprecated Use `satinize` instead. This feature will be removed soon.
|
|
150
152
|
* @param {Object} data - The data to be sent.
|
|
151
153
|
* @param {string} data.input - The input to be satinized.
|
|
152
154
|
* @returns {Promise<Interfaces.SatinizedInputAnalysis>} A promise that resolves to the response from the server.
|
|
@@ -154,7 +156,21 @@ declare class DymoAPI {
|
|
|
154
156
|
*
|
|
155
157
|
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
156
158
|
*/
|
|
157
|
-
satinizer(data:
|
|
159
|
+
satinizer(data: {
|
|
160
|
+
input: string;
|
|
161
|
+
}): Promise<Interfaces.SatinizedInputAnalysis>;
|
|
162
|
+
/**
|
|
163
|
+
* Satinizes the input, replacing any special characters with their HTML
|
|
164
|
+
* entities.
|
|
165
|
+
*
|
|
166
|
+
* @param {Object} data - The data to be sent.
|
|
167
|
+
* @param {string} data.input - The input to be satinized.
|
|
168
|
+
* @returns {Promise<Interfaces.SatinizedInputAnalysis>} A promise that resolves to the response from the server.
|
|
169
|
+
* @throws Will throw an error if there is an issue with the satinization process.
|
|
170
|
+
*
|
|
171
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
172
|
+
*/
|
|
173
|
+
satinize(input: string): Promise<Interfaces.SatinizedInputAnalysis>;
|
|
158
174
|
/**
|
|
159
175
|
* Validates a password based on the given parameters.
|
|
160
176
|
*
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import * as WellKnownBots from "./well-known-bots";
|
|
1
2
|
import { NegativeEmailRules, NegativeSensitiveInfoRules } from "./data-verifier";
|
|
3
|
+
type Mode = "LIVE" | "DRY_RUN";
|
|
4
|
+
export interface BotRules {
|
|
5
|
+
mode?: Mode;
|
|
6
|
+
allow?: WellKnownBots.WellKnownBotOrCategory[];
|
|
7
|
+
}
|
|
2
8
|
export interface EmailValidatorRules {
|
|
9
|
+
mode?: Mode;
|
|
3
10
|
deny: NegativeEmailRules[];
|
|
4
11
|
}
|
|
5
12
|
export interface SensitiveInfoRules {
|
|
13
|
+
mode?: Mode;
|
|
6
14
|
deny: NegativeSensitiveInfoRules[];
|
|
7
15
|
}
|
|
8
16
|
export interface Rules {
|
|
17
|
+
bot?: BotRules;
|
|
9
18
|
email?: EmailValidatorRules;
|
|
10
19
|
sensitiveInfo?: SensitiveInfoRules;
|
|
11
20
|
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type WellKnownBot = "A6CORP_CRAWLER" | "ABOUNDEX_CRAWLER" | "ACAPBOT" | "ACOON_CRAWLER" | "ADBEAT_CRAWLER" | "ADDSEARCH_CRAWLER" | "ADDTHIS_CRAWLER" | "ADMANTX_CRAWLER" | "ADSCANNER_CRAWLER" | "ADSTXTCRAWLER" | "ADVBOT_CRAWLER" | "AHREFS_CRAWLER" | "AI_SEARCH_BOT" | "AI2_CRAWLER" | "AI2_CRAWLER_DOLMA" | "AIHIT_CRAWLER" | "ALEXANDRIA_CRAWLER" | "ALPHASEOBOT_CRAWLER" | "AMAZON_ALEXA_CRAWLER" | "AMAZON_CLOUDFRONT" | "AMAZON_CRAWLER" | "ANDERSPINK_CRAWLER" | "ANTHROPIC_CRAWLER" | "ANTIBOT" | "APERCITE_CRAWLER" | "APPLE_CRAWLER" | "APPLE_FEEDFETCHER" | "ARA_CRAWLER" | "ARATURKA_CRAWLER" | "ARCHIVEORG_ARCHIVER" | "AROCOM_CRAWLER" | "ASK_CRAWLER" | "ASPIEGEL_CRAWLER" | "AUDISTO_CRAWLER" | "AVIRA_CRAWLER" | "AWARIO_CRAWLER" | "AWARIO_CRAWLER_RSS" | "AWARIO_CRAWLER_SMART" | "AWESOMECRAWLER" | "AZURE_APP_INSIGHTS" | "B2BBOT" | "BACKLINKTEST_CRAWLER" | "BAIDU_CLOUD_WATCH" | "BAIDU_CRAWLER" | "BAZQUX_FEEDFETCHER" | "BETABOT" | "BETTERUPTIME_MONITOR" | "BIDSWITCH_CRAWLER" | "BIGDATACORP_CRAWLER" | "BIGLOTRON" | "BING_ADS" | "BING_CRAWLER" | "BING_OFFICE_STORE" | "BING_PREVIEW" | "BINLAR" | "BITLY_CRAWLER" | "BITSIGHT_CRAWLER" | "BLACKBOARD_CRAWLER" | "BLOGMURA_CRAWLER" | "BLOGTRAFFIC_FEEDFETCHER" | "BLP_BBOT" | "BNF_CRAWLER" | "BOMBORA_CRAWLER" | "BOTIFY_CRAWLER" | "BOXCAR_CRAWLER" | "BRAINOBOT" | "BRANDONMEDIA_CRAWLER" | "BRANDVERITY_CRAWLER" | "BRANDWATCH_CRAWLER" | "BRIGHTEDGE_CRAWLER" | "BUBLUP_CRAWLER" | "BUILTWITH_CRAWLER" | "BUZZSTREAM_CRAWLER" | "BYTEDANCE_CRAWLER" | "CAPSULINK_CRAWLER" | "CAREERX_CRAWLER" | "CENTURYBOT" | "CHANGEDETECTION_CRAWLER" | "CHECKMARKNETWORK_CRAWLER" | "CHLOOE_CRAWLER" | "CINCRAWDATA_CRAWLER" | "CISPA_CRAWLER" | "CITESEERX_CRAWLER" | "CLICKAGY_CRAWLER" | "CLIQZ_CRAWLER" | "CLOUDFLARE_ARCHIVER" | "CLOUDSYSTEMNETWORKS_CRAWLER" | "COCCOC_CRAWLER" | "COCOLYZE_CRAWLER" | "CODA_SERVER_FETCHER" | "CODEWISE_CRAWLER" | "COGNITIVESEO_CRAWLER" | "COHERE_CRAWLER" | "COMMONCRAWL_CRAWLER" | "COMPANYBOOK_CRAWLER" | "CONDUCTOR_CRAWLER" | "CONTENT_CRAWLER_SPIDER" | "CONTEXTAD_CRAWLER" | "CONTXBOT" | "CONVERA_CRAWLER" | "COOKIEBOT_CRAWLER" | "CREATIVECOMMONS_CRAWLER" | "CRITEO_CRAWLER" | "CRYSTALSEMANTICS_CRAWLER" | "CUREBOT_CRAWLER" | "CURL" | "CUTBOT_CRAWLER" | "CXENSE_CRAWLER" | "CYBERPATROL_CRAWLER" | "DAREBOOST_CRAWLER" | "DATADOG_MONITOR_SYNTHETICS" | "DATAFEEDWATCH_CRAWLER" | "DATAFORSEO_CRAWLER" | "DATAGNION_CRAWLER" | "DATANYZE_CRAWLER" | "DATAPROVIDER_CRAWLER" | "DATENBUTLER_CRAWLER" | "DAUM_CRAWLER" | "DCRAWL" | "DEADLINKCHECKER" | "DEEPNOC_CRAWLER" | "DEUSU_CRAWLER" | "DIFFBOT_CRAWLER" | "DIGG_CRAWLER" | "DIGINCORE_CRAWLER" | "DIGITALDRAGON_CRAWLER" | "DISCORD_CRAWLER" | "DISCOVERYENGINE_CRAWLER" | "DISQUS_CRAWLER" | "DNYZ_CRAWLER" | "DOMAINCRAWLER_CRAWLER" | "DOMAINREANIMATOR_CRAWLER" | "DOMAINSBOT_CRAWLER" | "DOMAINSPROJECT_CRAWLER" | "DOMAINSTATS_CRAWLER" | "DOMAINTOOLS_CRAWLER" | "DOTNETDOTCOM_CRAWLER" | "DRAGONMETRICS_CRAWLER" | "DRIFTNET_CRAWLER" | "DUBBOT_CRAWLER" | "DUCKDUCKGO_CRAWLER" | "DUCKDUCKGO_CRAWLER_FAVICONS" | "DUEDIL_CRAWLER" | "DYNATRACE_MONITOR" | "EC2LINKFINDER" | "EDISTER_CRAWLER" | "ELISABOT" | "EMBEDLY_CRAWLER" | "ENTIREWEB_CRAWLER" | "EPFL_CRAWLER" | "EPICTIONS_CRAWLER" | "ERIGHT_CRAWLER" | "EUROPARCHIVE_CRAWLER" | "EVENTURES_CRAWLER" | "EVENTURES_CRAWLER_BATCH" | "EVERYONESOCIAL_CRAWLER" | "EXENSA_CRAWLER" | "EXPERIBOT_CRAWLER" | "EXTLINKS_CRAWLER" | "EYEOTA_CRAWLER" | "EZID_CRAWLER" | "FACEBOOK_CRAWLER" | "FACEBOOK_SHARE_CRAWLER" | "FAST_CRAWLER" | "FAST_CRAWLER_ENTERPRISE" | "FEDORAPLANET_CRAWLER" | "FEEDAFEVER_CRAWLER" | "FEEDBIN_CRAWLER" | "FEEDLY_FEEDFETCHER" | "FEEDSPOT_FEEDFETCHER" | "FEMTOSEARCH_CRAWLER" | "FINDTHATFILE_CRAWLER" | "FLAMINGOSEARCH_CRAWLER" | "FLIPBOARD_PROXY" | "FLUFFY" | "FR_CRAWLER" | "FREEWEBMONITORING_MONITOR" | "FRESHRSS_FEEDFETCHER" | "FRESHWORKS_MONITOR" | "FRIENDLYCRAWLER" | "FUELBOT" | "FYREBOT" | "G00G1E_CRAWLER" | "G2READER_CRAWLER" | "G2WEBSERVICES_CRAWLER" | "GARLIK_CRAWLER" | "GEEDO_CRAWLER" | "GEEDO_CRAWLER_PRODUCTS" | "GENIEO_CRAWLER" | "GIGABLAST_CRAWLER" | "GIGABLAST_CRAWLER_OSS" | "GINGER_CRAWLER" | "GLUTENFREEPLEASURE_CRAWLER" | "GNAM_GNAM_SPIDER" | "GNOWIT_CRAWLER" | "GO_HTTP" | "GOO_CRAWLER" | "GOOGLE_ADSBOT" | "GOOGLE_ADSBOT_MOBILE" | "GOOGLE_ADSENSE" | "GOOGLE_ADSENSE_GOOGLEBOT" | "GOOGLE_ADWORDS" | "GOOGLE_APPENGINE" | "GOOGLE_CERTIFICATES_BRIDGE" | "GOOGLE_CRAWLER" | "GOOGLE_CRAWLER_CLOUDVERTEX" | "GOOGLE_CRAWLER_IMAGE" | "GOOGLE_CRAWLER_MOBILE" | "GOOGLE_CRAWLER_NEWS" | "GOOGLE_CRAWLER_OTHER" | "GOOGLE_CRAWLER_SAFETY" | "GOOGLE_CRAWLER_STORE" | "GOOGLE_CRAWLER_VIDEO" | "GOOGLE_FAVICON" | "GOOGLE_FEEDFETCHER" | "GOOGLE_INSPECTION_TOOL" | "GOOGLE_LIGHTHOUSE" | "GOOGLE_PHYSICAL_WEB" | "GOOGLE_PREVIEW" | "GOOGLE_PUSH_NOTIFICATIONS" | "GOOGLE_READ_ALOUD" | "GOOGLE_SITE_VERIFICATION" | "GOOGLE_STRUCTURED_DATA_TESTING_TOOL" | "GOOGLE_WEB_SNIPPET" | "GOOGLE_XRAWLER" | "GOWIKI_CRAWLER" | "GRAPESHOT_CRAWLER" | "GROB_CRAWLER" | "GROUPHIGH_CRAWLER" | "GROUPME_CRAWLER" | "GRUB" | "GSLFBOT" | "GWENE_CRAWLER" | "HAOSOU_CRAWLER" | "HATENA_CRAWLER" | "HEADLESS_CHROME" | "HEADLINE_CRAWLER" | "HOYER_CRAWLER" | "HTTP_GET" | "HTTRACK" | "HUBSPOT_CRAWLER" | "HYDROZEN_MONITOR" | "HYPEFACTORS_CRAWLER" | "HYPESTAT_CRAWLER" | "HYSCORE_CRAWLER" | "IA_ARCHIVER" | "IASK_CRAWLER" | "IDEASANDCODE_CRAWLER" | "IFRAMELY_PREVIEW" | "IMAGESIFT_CRAWLER" | "IMESSAGE_PREVIEW" | "IMG2DATASET" | "INDEED_CRAWLER" | "INETDEX_CRAWLER" | "INFEGY_CRAWLER" | "INFOO_CRAWLER" | "INOREADER_AGGREGATOR" | "INTEGRALADS_CRAWLER" | "INTEGROMEDB_CRAWLER" | "INTELIUM_CRAWLER" | "INTERNETARCHIVE_CRAWLER_OSS" | "IONOS_CRAWLER" | "IP_WEB_CRAWLER" | "IPIP_CRAWLER" | "IRC_ARCHIVEBOT" | "ISKANIE_CRAWLER" | "ISS_CRAWLER" | "IT2MEDIA_CRAWLER" | "ITINFLUENTIALS_CRAWLER" | "JAMIEMBROWN_CRAWLER" | "JAVA_APACHE_HTTPCLIENT" | "JAVA_ASYNCHTTPCLIENT" | "JAVA_CRAWLER4J" | "JAVA_HTTPUNIT" | "JAVA_JERSEY" | "JAVA_JETTY" | "JAVA_OKHTTP" | "JAVA_SNACKTORY" | "JAVASCRIPT_AXIOS" | "JAVASCRIPT_NODE_FETCH" | "JAVASCRIPT_PHANTOM" | "JETSLIDE_CRAWLER" | "JOBBOERSE_CRAWLER" | "JOOBLE_CRAWLER" | "JUSPROG_CRAWLER" | "JYXO_CRAWLER" | "K7COMPUTING_CRAWLER" | "KEMVI_CRAWLER" | "KOMODIA_CRAWLER" | "KOSMIO_CRAWLER" | "KUMA_MONITOR" | "L9EXPLORE" | "LANDAUMEDIA_CRAWLER" | "LASERLIKE_CRAWLER" | "LAW_UNIMI_CRAWLER" | "LB_SPIDER" | "LEADCRUNCH_CRAWLER" | "LEIKI_CRAWLER" | "LEIPZIG_FINDLINKS" | "LEIPZIG_LCC" | "LEMMY_CRAWLER" | "LIGHTSPEEDSYSTEMS_CRAWLER" | "LINE_CRAWLER" | "LINGUEE_CRAWLER" | "LINKAPEDIA_CRAWLER" | "LINKARCHIVER" | "LINKDEX_CRAWLER" | "LINKEDIN_CRAWLER" | "LINKFLUENCE_CRAWLER" | "LINKIS_CRAWLER" | "LIPPERHEY_CRAWLER" | "LIVELAP_CRAWLER" | "LOGLY_CRAWLER" | "LOOP_CRAWLER" | "LSSBOT" | "LSSBOT_ROCKET" | "LTX71_CRAWLER" | "LUMINATOR_CRAWLER" | "MACOCU_CRAWLER" | "MAILRU_CRAWLER" | "MAJESTIC_CRAWLER" | "MAPPYDATA_CRAWLER" | "MARGINALIA_CRAWLER" | "MASTODON_CRAWLER" | "MAUIBOT" | "MEDIATOOLKIT_CRAWLER" | "MEGAINDEX_CRAWLER" | "MELTWATER_CRAWLER" | "META_CRAWLER" | "META_CRAWLER_USER" | "METADATALABS_CRAWLER" | "METAJOB_CRAWLER" | "METAURI_CRAWLER" | "METRICSTOOLS_CRAWLER" | "MICROSOFT_PREVIEW" | "MICROSOFT_RESEARCH_CRAWLER" | "MIGNIFY_CRAWLER" | "MIGNIFY_IMRBOT" | "MINIFLUX_FEEDFETCHER" | "MIXNODE_CACHE" | "MOAT_CRAWLER" | "MOJEEK_CRAWLER" | "MONITORBACKLINKS_CRAWLER" | "MONSIDO_CRAWLER" | "MOODLE_CRAWLER" | "MOREOVER_CRAWLER" | "MOZ_CRAWLER" | "MOZ_SITE_AUDIT" | "MSN_CRAWLER" | "MUCKRACK_CRAWLER" | "MULTIVIEWBOT" | "NAGIOS_CHECK_HTTP" | "NAVER_CRAWLER" | "NAVER_CRAWLER_RSS" | "NEEVA_CRAWLER" | "NERDBYNATURE_CRAWLER" | "NERDYBOT_CRAWLER" | "NETCRAFT_CRAWLER" | "NETESTATE_CRAWLER" | "NETICLE_CRAWLER" | "NETSYSTEMSRESEARCH_CRAWLER" | "NETVIBES_CRAWLER" | "NEWSBLUR_AGGREGATOR" | "NEWSHARECOUNTS_CRAWLER" | "NEWSPAPER" | "NEXTCLOUD_CRAWLER" | "NICECRAWLER_ARCHIVE" | "NICT_CRAWLER" | "NIKI_BOT" | "NING_CRAWLER" | "NINJABOT" | "NIXSTATS_CRAWLER" | "NMAP" | "NTENT_CRAWLER" | "NUTCH" | "NUZZEL_CRAWLER" | "OCARINABOT" | "OKRU_CRAWLER" | "OMGILI_CRAWLER" | "OPENAI_CRAWLER" | "OPENAI_CRAWLER_SEARCH" | "OPENAI_CRAWLER_USER" | "OPENGRAPHCHECK_CRAWLER" | "OPENHOSE_CRAWLER" | "OPENINDEX_CRAWLER" | "ORANGE_CRAWLER" | "ORANGE_FTGROUP_CRAWLER" | "OUTBRAIN_LINK_CHECKER" | "OUTCLICKS_CRAWLER" | "PAGE_TO_RSS" | "PAGEPEEKER_CRAWLER" | "PAGETHING_CRAWLER" | "PALOALTONETWORKS_CRAWLER" | "PANSCIENT_CRAWLER" | "PAPERLI_CRAWLER" | "PERL_LIBWWW" | "PERL_PCORE" | "PERPLEXITY_CRAWLER" | "PETALSEARCH_CRAWLER" | "PHP_CURLCLASS" | "PHP_PHPCRAWL" | "PHP_SIMPLE_SCRAPER" | "PHP_SIMPLEPIE" | "PHXBOT" | "PICSEARCH_CRAWLER" | "PINGDOM_CRAWLER" | "PINTREST_CRAWLER" | "PIPL_CRAWLER" | "POCKET_CRAWLER" | "POSTMAN" | "POSTRANK_CRAWLER" | "PRCY_CRAWLER" | "PRIMAL_CRAWLER" | "PRIVACORE_CRAWLER" | "PRIVACYAWARE_CRAWLER" | "PROFOUND_CRAWLER" | "PROXIMIC_CRAWLER" | "PULSEPOINT_CRAWLER" | "PURE_CRAWLER" | "PYTHON_AIOHTTP" | "PYTHON_BITBOT" | "PYTHON_HTTPX" | "PYTHON_OPENGRAPH" | "PYTHON_REQUESTS" | "PYTHON_SCRAPY" | "PYTHON_URLLIB" | "QWANT_CRAWLER" | "RANKACTIVE_CRAWLER" | "REDDIT_CRAWLER" | "REFIND_CRAWLER" | "RETREVO_PAGE_ANALYZER" | "RIDDER_CRAWLER" | "RIVVA_CRAWLER" | "RSSBOT_FEEDFETCHER" | "RSSING_CRAWLER" | "RSSMICRO_FEEDFETCHER" | "RUBY_METAINSPECTOR" | "RYTE_CRAWLER" | "SAFEDNS_CRAWLER" | "SCAN_INTERFAX_CRAWLER" | "SCHMORP_CRAWLER" | "SCOUTJET_CRAWLER" | "SCREAMINGFROG_CRAWLER" | "SCRIBD_CRAWLER" | "SCRITCH_CRAWLER" | "SEARCHATLAS_CRAWLER" | "SEEKBOT_CRAWLER" | "SEEKPORT_CRAWLER" | "SEEWITHKIDS_CRAWLER" | "SEMANTICAUDIENCE_CRAWLER" | "SEMANTICSCHOLAR_CRAWLER" | "SEMPITECH_CRAWLER" | "SEMRUSH_CRAWLER" | "SENTIONE_CRAWLER" | "SENTRY_CRAWLER" | "SENUTO_CRAWLER" | "SEOBILITY_CRAWLER" | "SEOKICKS_CRAWLER" | "SEOLIZER_CRAWLER" | "SEOPROFILER_CRAWLER" | "SEOSCANNERS_CRAWLER" | "SEOSTAR_CRAWLER" | "SEOZOOM_CRAWLER" | "SERENDEPUTY_CRAWLER" | "SERPSTATBOT_CRAWLER" | "SEZNAM_CRAWLER" | "SIMILARTECH_CRAWLER" | "SIMPLE_CRAWLER" | "SISTRIX_007AC9_CRAWLER" | "SISTRIX_CRAWLER" | "SITEBOT_CRAWLER" | "SITECHECKER_CRAWLER" | "SITEEXPLORER_CRAWLER" | "SITEIMPROVE_CRAWLER" | "SKYPE_PREVIEW" | "SLACK_CRAWLER" | "SLACK_IMAGE_PROXY" | "SNAP_PREVIEW" | "SOCIALRANK_CRAWLER" | "SOFTBYTELABS_CRAWLER" | "SOGOU_CRAWLER" | "STARTME_CRAWLER" | "STEAM_PREVIEW" | "STORYGIZE_CRAWLER" | "STRACT_CRAWLER" | "STRIPE_WEBHOOK" | "STUTTGART_CRAWLER" | "SUMMALY_CRAWLER" | "SUMMIFY_CRAWLER" | "SUPERFEEDR_CRAWLER" | "SURLY_CRAWLER" | "SWIMGBOT" | "SYNAPSE_CRAWLER" | "SYSOMOS_CRAWLER" | "T3VERSIONS_CRAWLER" | "TABOOLA_CRAWLER" | "TAGOO_CRAWLER" | "TANGIBLEE_CRAWLER" | "TELEGRAM_CRAWLER" | "TESTOMATO_CRAWLER" | "THEOLDREADER_CRAWLER" | "THINKLAB_CRAWLER" | "TIGER_CRAWLER" | "TIKTOK_CRAWLER" | "TIMPI_CRAWLER" | "TINEYE_CRAWLER" | "TISCALI_CRAWLER" | "TOMBASCRAPER_CRAWLER" | "TOPLIST_CRAWLER" | "TORUS_CRAWLER" | "TOUTIAO_CRAWLER" | "TRAACKR_CRAWLER" | "TRACEMYFILE_CRAWLER" | "TRENDICTION_CRAWLER" | "TRENDSMAP_CRAWLER" | "TROVE_CRAWLER" | "TROVIT_CRAWLER" | "TTRSS_FEEDFETCHER" | "TURNITIN_CRAWLER" | "TWEETEDTIMES_CRAWLER" | "TWEETMEMEBOT" | "TWENGA_CRAWLER" | "TWINGLY_CRAWLER" | "TWITTER_CRAWLER" | "TWOIP_CRAWLER" | "TWOIP_CRAWLER_CMS" | "TWURLY_CRAWLER" | "UBERMETRICS_CRAWLER" | "UBT_CRAWLER" | "UPFLOW_CRAWLER" | "UPTIME_MONITOR" | "UPTIMEBOT_MONITOR" | "UPTIMEROBOT_MONITOR" | "URLCLASSIFICATION_CRAWLER" | "USINE_NOUVELLE_CRAWLER" | "UTEXAS_CRAWLER" | "UTORRENT_CRAWLER" | "VEBIDOO_CRAWLER" | "VELEN_CRAWLER" | "VEOOZ_CRAWLER" | "VERCEL_CRAWLER" | "VERCEL_MONITOR_PREVIEW" | "VERISIGN_IPS_AGENT" | "VIBER_CRAWLER" | "VIGIL_CRAWLER" | "VIPNYTT_CRAWLER" | "VIRUSTOTAL_CRAWLER" | "VKROBOT_CRAWLER" | "VKSHARE_CRAWLER" | "VUHUV_CRAWLER" | "W3C_VALIDATOR_CSS" | "W3C_VALIDATOR_FEED" | "W3C_VALIDATOR_HTML" | "W3C_VALIDATOR_HTML_NU" | "W3C_VALIDATOR_I18N" | "W3C_VALIDATOR_LINKS" | "W3C_VALIDATOR_MOBILE" | "W3C_VALIDATOR_UNIFIED" | "WAREBAY_CRAWLER" | "WEBARCHIVE_CRAWLER" | "WEBCEO_CRAWLER" | "WEBCOMPANY_CRAWLER" | "WEBDATASTATS_CRAWLER" | "WEBEAVER_CRAWLER" | "WEBMEUP_CRAWLER" | "WEBMON" | "WEBPAGETEST_CRAWLER" | "WEBZIO_CRAWLER" | "WEBZIO_CRAWLER_AI" | "WELLKNOWN_CRAWLER" | "WESEE_CRAWLER" | "WGET" | "WHATSAPP_CRAWLER" | "WOCODI_CRAWLER" | "WOORANK_CRAWLER" | "WOORANK_CRAWLER_REVIEW" | "WORDPRESS_CRAWLER" | "WORDPRESS_CRAWLER_RSS" | "WORDUP_CRAWLER" | "WORIO_CRAWLER" | "WOTBOX_CRAWLER" | "XENU_CRAWLER" | "XOVIBOT_CRAWLER" | "YACY_CRAWLER" | "YAHOO_CRAWLER" | "YAHOO_CRAWLER_JAPAN" | "YAHOO_PREVIEW" | "YAMANALAB_CRAWLER" | "YANDEX_CRAWLER" | "YANDEX_CRAWLER_JAVASCRIPT" | "YANGA_CRAWLER" | "YELLOWBP_CRAWLER" | "YISOU_CRAWLER" | "YOOZ_CRAWLER" | "YOU_CRAWLER" | "ZABBIX_MONITOR" | "ZGRAB" | "ZOOMINFO_CRAWLER" | "ZUM_CRAWLER" | "ZUPERLIST_CRAWLER";
|
|
2
|
+
export type BotCategory = "CATEGORY:ACADEMIC" | "CATEGORY:ADVERTISING" | "CATEGORY:AI" | "CATEGORY:AMAZON" | "CATEGORY:APPLE" | "CATEGORY:ARCHIVE" | "CATEGORY:FEEDFETCHER" | "CATEGORY:GOOGLE" | "CATEGORY:META" | "CATEGORY:MICROSOFT" | "CATEGORY:MONITOR" | "CATEGORY:OPTIMIZER" | "CATEGORY:PREVIEW" | "CATEGORY:PROGRAMMATIC" | "CATEGORY:SEARCH_ENGINE" | "CATEGORY:SLACK" | "CATEGORY:SOCIAL" | "CATEGORY:TOOL" | "CATEGORY:UNKNOWN" | "CATEGORY:VERCEL" | "CATEGORY:WEBHOOK" | "CATEGORY:YAHOO" | "CATEGORY:CYBERSECURITY";
|
|
3
|
+
export declare const categories: Record<BotCategory, readonly WellKnownBot[]>;
|
|
4
|
+
export type WellKnownBotOrCategory = WellKnownBot | BotCategory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dymo-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.06",
|
|
4
4
|
"description": "Flow system for Dymo API.",
|
|
5
5
|
"main": "dist/cjs/dymo-api.js",
|
|
6
6
|
"module": "dist/esm/dymo-api.js",
|
|
@@ -23,11 +23,14 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"
|
|
26
|
+
"clean": "rimraf dist",
|
|
27
|
+
"build:cjs": "tsc -p tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json",
|
|
28
|
+
"build:esm": "tsc -p tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
|
|
29
|
+
"build": "npm run clean && npm run build:cjs && npm run build:esm && node ./scripts/rename.js",
|
|
27
30
|
"start": "ts-node src/dymo-api.ts",
|
|
28
|
-
"prepublishOnly": "npm run
|
|
29
|
-
"test": "jest --max-old-space-size=4096",
|
|
30
|
-
"test:watch": "jest --watch --max-old-space-size=4096"
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"test": "jest --runInBand --max-old-space-size=4096",
|
|
33
|
+
"test:watch": "jest --runInBand --watch --max-old-space-size=4096"
|
|
31
34
|
},
|
|
32
35
|
"repository": {
|
|
33
36
|
"url": "https://github.com/TPEOficial/dymo-api-node"
|
|
@@ -64,6 +67,11 @@
|
|
|
64
67
|
"rimraf": "^6.0.1",
|
|
65
68
|
"ts-jest": "^29.4.4",
|
|
66
69
|
"ts-node": "^10.9.2",
|
|
70
|
+
"tsc-alias": "^1.8.16",
|
|
67
71
|
"typescript": "^5.5.4"
|
|
72
|
+
},
|
|
73
|
+
"prettier": {
|
|
74
|
+
"tabWidth": 4,
|
|
75
|
+
"useTabs": false
|
|
68
76
|
}
|
|
69
77
|
}
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.extractWithTextly = exports.getRandom = exports.sendEmail = exports.isValidEmail = exports.isValidData = void 0;
|
|
40
|
-
const path_1 = __importDefault(require("path"));
|
|
41
|
-
const react_1 = __importDefault(require("react"));
|
|
42
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
43
|
-
const tw_to_css_1 = require("tw-to-css");
|
|
44
|
-
const render_1 = require("@react-email/render");
|
|
45
|
-
const config_1 = __importStar(require("../config/index.cjs"));
|
|
46
|
-
const customError = (code, message) => {
|
|
47
|
-
return Object.assign(new Error(), { code, message: `[${config_1.default.lib.name}] ${message}` });
|
|
48
|
-
};
|
|
49
|
-
const convertTailwindToInlineCss = (htmlContent) => {
|
|
50
|
-
return htmlContent.replace(/class="([^"]+)"( style="([^"]+)")?/g, (match, classList, _, existingStyle) => {
|
|
51
|
-
const compiledStyles = (0, tw_to_css_1.twi)(classList, { minify: true, merge: true });
|
|
52
|
-
return match.replace(/class="[^"]+"/, "").replace(/ style="[^"]+"/, "").concat(` style="${existingStyle ? `${existingStyle.trim().slice(0, -1)}; ${compiledStyles}` : compiledStyles}"`);
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Validates the provided data using a secure verification endpoint.
|
|
57
|
-
*
|
|
58
|
-
* @param token - A string or null representing the authentication token. Must not be null.
|
|
59
|
-
* @param data - An object adhering to the Validator interface, containing at least one of the following fields:
|
|
60
|
-
* url, email, phone, domain, creditCard, ip, wallet or user agent.
|
|
61
|
-
*
|
|
62
|
-
* @returns A promise that resolves to the response data from the verification endpoint.
|
|
63
|
-
*
|
|
64
|
-
* @throws Will throw an error if the token is null, if none of the required fields are present in the data,
|
|
65
|
-
* or if an error occurs during the verification request.
|
|
66
|
-
*/
|
|
67
|
-
const isValidData = async (token, data) => {
|
|
68
|
-
if (token === null)
|
|
69
|
-
throw customError(3000, "Invalid private token.");
|
|
70
|
-
if (!Object.keys(data).some((key) => ["url", "email", "phone", "domain", "creditCard", "ip", "wallet", "userAgent"].includes(key) && data.hasOwnProperty(key)))
|
|
71
|
-
throw customError(1500, "You must provide at least one parameter.");
|
|
72
|
-
try {
|
|
73
|
-
const response = await config_1.axiosApiUrl.post("/private/secure/verify", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
74
|
-
return response.data;
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
const statusCode = error.response?.status || 500;
|
|
78
|
-
const errorMessage = error.response?.data?.message || error.message;
|
|
79
|
-
const errorDetails = JSON.stringify(error.response?.data || {});
|
|
80
|
-
throw customError(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports.isValidData = isValidData;
|
|
84
|
-
/**
|
|
85
|
-
* Validates an email using a secure verification endpoint.
|
|
86
|
-
*
|
|
87
|
-
* @param {string | null} token - Authentication token (required).
|
|
88
|
-
* @param {Interfaces.EmailValidator} email - Email to validate.
|
|
89
|
-
* @param {Interfaces.EmailValidatorRules} [rules] - Deny rules. Defaults to ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"].
|
|
90
|
-
*
|
|
91
|
-
* Deny rules (some are premium ⚠️):
|
|
92
|
-
* - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
|
|
93
|
-
* "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
|
|
94
|
-
*
|
|
95
|
-
* @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
|
|
96
|
-
* @throws Error if token is null, rules are empty, or request fails.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* const valid = await isValidEmail(apiToken, "user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
100
|
-
*/
|
|
101
|
-
const isValidEmail = async (token, email, rules) => {
|
|
102
|
-
if (token === null)
|
|
103
|
-
throw customError(3000, "Invalid private token.");
|
|
104
|
-
if (rules.deny.length === 0)
|
|
105
|
-
throw customError(1500, "You must provide at least one deny rule.");
|
|
106
|
-
try {
|
|
107
|
-
const responseEmail = (await config_1.axiosApiUrl.post("/private/secure/verify", {
|
|
108
|
-
email,
|
|
109
|
-
plugins: [
|
|
110
|
-
rules.deny.includes("NO_MX_RECORDS") ? "mxRecords" : undefined,
|
|
111
|
-
rules.deny.includes("NO_REACHABLE") ? "reachability" : undefined,
|
|
112
|
-
rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined
|
|
113
|
-
]
|
|
114
|
-
}, { headers: { "Content-Type": "application/json", "Authorization": token } })).data.email;
|
|
115
|
-
let reasons = [];
|
|
116
|
-
if (rules.deny.includes("INVALID") && !responseEmail.valid)
|
|
117
|
-
reasons.push("INVALID");
|
|
118
|
-
if (rules.deny.includes("FRAUD") && responseEmail.fraud)
|
|
119
|
-
reasons.push("FRAUD");
|
|
120
|
-
if (rules.deny.includes("PROXIED_EMAIL") && responseEmail.proxiedEmail)
|
|
121
|
-
reasons.push("PROXIED_EMAIL");
|
|
122
|
-
if (rules.deny.includes("FREE_SUBDOMAIN") && responseEmail.freeSubdomain)
|
|
123
|
-
reasons.push("FREE_SUBDOMAIN");
|
|
124
|
-
if (rules.deny.includes("PERSONAL_EMAIL") && !responseEmail.corporate)
|
|
125
|
-
reasons.push("PERSONAL_EMAIL");
|
|
126
|
-
if (rules.deny.includes("CORPORATE_EMAIL") && responseEmail.corporate)
|
|
127
|
-
reasons.push("CORPORATE_EMAIL");
|
|
128
|
-
if (rules.deny.includes("NO_MX_RECORDS") && responseEmail.plugins.mxRecords.length === 0)
|
|
129
|
-
reasons.push("NO_MX_RECORDS");
|
|
130
|
-
if (rules.deny.includes("NO_REPLY_EMAIL") && responseEmail.noReply)
|
|
131
|
-
reasons.push("NO_REPLY_EMAIL");
|
|
132
|
-
if (rules.deny.includes("ROLE_ACCOUNT") && responseEmail.plugins.roleAccount)
|
|
133
|
-
reasons.push("ROLE_ACCOUNT");
|
|
134
|
-
if (rules.deny.includes("NO_REACHABLE") && !responseEmail.plugins.reachable)
|
|
135
|
-
reasons.push("NO_REACHABLE");
|
|
136
|
-
if (rules.deny.includes("HIGH_RISK_SCORE") && responseEmail.plugins.riskScore >= 80)
|
|
137
|
-
reasons.push("HIGH_RISK_SCORE");
|
|
138
|
-
return {
|
|
139
|
-
email: responseEmail.email,
|
|
140
|
-
allow: reasons.length === 0,
|
|
141
|
-
reasons,
|
|
142
|
-
response: responseEmail
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
const statusCode = error.response?.status || 500;
|
|
147
|
-
const errorMessage = error.response?.data?.message || error.message;
|
|
148
|
-
const errorDetails = JSON.stringify(error.response?.data || {});
|
|
149
|
-
throw customError(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
exports.isValidEmail = isValidEmail;
|
|
153
|
-
/**
|
|
154
|
-
* Sends an email using a secure sending endpoint.
|
|
155
|
-
*
|
|
156
|
-
* @param token - A string or null representing the authentication token. Must not be null.
|
|
157
|
-
* @param data - An object adhering to the SendEmail interface, containing the following fields:
|
|
158
|
-
* 'from', 'to', 'subject', 'html' or 'react', and optionally 'attachments', 'options', 'priority', 'waitToResponse', and 'composeTailwindClasses'.
|
|
159
|
-
*
|
|
160
|
-
* @returns A promise that resolves to the response data from the sending endpoint.
|
|
161
|
-
*
|
|
162
|
-
* @throws Will throw an error if the token is null, if any of the required fields are missing,
|
|
163
|
-
* if the 'react' field is not a valid React element, if the 'attachments' field exceeds the maximum allowed size of 40 MB,
|
|
164
|
-
* or if an error occurs during the sending request.
|
|
165
|
-
*/
|
|
166
|
-
const sendEmail = async (token, data) => {
|
|
167
|
-
if (token === null)
|
|
168
|
-
throw customError(3000, "Invalid private token.");
|
|
169
|
-
if (!data.from)
|
|
170
|
-
throw customError(1500, "You must provide an email address from which the following will be sent.");
|
|
171
|
-
if (!data.to)
|
|
172
|
-
throw customError(1500, "You must provide an email to be sent to.");
|
|
173
|
-
if (!data.subject)
|
|
174
|
-
throw customError(1500, "You must provide a subject for the email to be sent.");
|
|
175
|
-
if (!data.html && !data.react && !react_1.default.isValidElement(data.react))
|
|
176
|
-
throw customError(1500, "You must provide HTML or a React component.");
|
|
177
|
-
if (data.html && data.react)
|
|
178
|
-
throw customError(1500, "You must provide only HTML or a React component, not both.");
|
|
179
|
-
try {
|
|
180
|
-
if (data.react) {
|
|
181
|
-
//@ts-ignore
|
|
182
|
-
data.html = await (0, render_1.render)(data.react);
|
|
183
|
-
delete data.react;
|
|
184
|
-
}
|
|
185
|
-
if (data.options && data.options.composeTailwindClasses) {
|
|
186
|
-
data.html = convertTailwindToInlineCss(data.html);
|
|
187
|
-
delete data.options.composeTailwindClasses;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
throw customError(1500, `An error occurred while rendering your React component. Details: ${error}`);
|
|
192
|
-
}
|
|
193
|
-
try {
|
|
194
|
-
let totalSize = 0;
|
|
195
|
-
if (data.attachments && Array.isArray(data.attachments)) {
|
|
196
|
-
const processedAttachments = await Promise.all(data.attachments.map(async (attachment) => {
|
|
197
|
-
if ((attachment.path && attachment.content) || (!attachment.path && !attachment.content))
|
|
198
|
-
throw customError(1500, "You must provide either 'path' or 'content', not both.");
|
|
199
|
-
let contentBuffer;
|
|
200
|
-
if (attachment.path)
|
|
201
|
-
contentBuffer = await promises_1.default.readFile(path_1.default.resolve(attachment.path));
|
|
202
|
-
else if (attachment.content)
|
|
203
|
-
contentBuffer = attachment.content instanceof Buffer ? attachment.content : Buffer.from(attachment.content);
|
|
204
|
-
totalSize += Buffer.byteLength(contentBuffer);
|
|
205
|
-
if (totalSize > 40 * 1024 * 1024)
|
|
206
|
-
throw customError(1500, "Attachments exceed the maximum allowed size of 40 MB.");
|
|
207
|
-
return {
|
|
208
|
-
filename: attachment.filename || path_1.default.basename(attachment.path || ""),
|
|
209
|
-
content: contentBuffer,
|
|
210
|
-
cid: attachment.cid || attachment.filename
|
|
211
|
-
};
|
|
212
|
-
}));
|
|
213
|
-
data.attachments = processedAttachments;
|
|
214
|
-
}
|
|
215
|
-
const response = await config_1.axiosApiUrl.post("/private/sender/sendEmail", data, { headers: { "Authorization": token } });
|
|
216
|
-
return response.data;
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
throw customError(5000, error.response?.data?.message || error.message);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
exports.sendEmail = sendEmail;
|
|
223
|
-
/**
|
|
224
|
-
* Retrieves a random number within a specified range using a secure endpoint.
|
|
225
|
-
*
|
|
226
|
-
* @param token - A string or null representing the authentication token. Must not be null.
|
|
227
|
-
* @param data - An object adhering to the SRNG interface, containing 'min' and 'max' fields,
|
|
228
|
-
* which define the inclusive range within which the random number should be generated.
|
|
229
|
-
*
|
|
230
|
-
* @returns A promise that resolves to the response data containing the random number.
|
|
231
|
-
*
|
|
232
|
-
* @throws Will throw an error if the token is null, if 'min' or 'max' are not defined,
|
|
233
|
-
* if 'min' is not less than 'max', if 'min' or 'max' are out of the allowed range,
|
|
234
|
-
* or if an error occurs during the request to the random number generator endpoint.
|
|
235
|
-
*/
|
|
236
|
-
const getRandom = async (token, data) => {
|
|
237
|
-
if (token === null)
|
|
238
|
-
throw customError(3000, "Invalid private token.");
|
|
239
|
-
if (!data.min || !data.max)
|
|
240
|
-
throw customError(1500, "Both 'min' and 'max' parameters must be defined.");
|
|
241
|
-
if (data.min >= data.max)
|
|
242
|
-
throw customError(1500, "'min' must be less than 'max'.");
|
|
243
|
-
if (data.min < -1000000000 || data.min > 1000000000)
|
|
244
|
-
throw customError(1500, "'min' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
245
|
-
if (data.max < -1000000000 || data.max > 1000000000)
|
|
246
|
-
throw customError(1500, "'max' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
247
|
-
try {
|
|
248
|
-
const response = await config_1.axiosApiUrl.post("/private/srng", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
249
|
-
return response.data;
|
|
250
|
-
}
|
|
251
|
-
catch (error) {
|
|
252
|
-
throw customError(5000, error.response?.data?.message || error.message);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
exports.getRandom = getRandom;
|
|
256
|
-
/**
|
|
257
|
-
* Extracts structured data from a given string using a secure endpoint.
|
|
258
|
-
*
|
|
259
|
-
* @param token - A string or null representing the authentication token. Must not be null.
|
|
260
|
-
* @param data - An object adhering to the ExtractWithTextly interface, containing 'data' and 'format' fields.
|
|
261
|
-
* The 'data' field is the string from which structured data should be extracted.
|
|
262
|
-
* The 'format' field is an object defining the structure of the data to be extracted.
|
|
263
|
-
*
|
|
264
|
-
* @returns A promise that resolves to the response data containing the extracted structured data.
|
|
265
|
-
*
|
|
266
|
-
* @throws Will throw an error if the token is null, if 'data' or 'format' are not defined,
|
|
267
|
-
* or if an error occurs during the request to the extraction endpoint.
|
|
268
|
-
*/
|
|
269
|
-
const extractWithTextly = async (token, data) => {
|
|
270
|
-
if (token === null)
|
|
271
|
-
throw customError(3000, "Invalid private token.");
|
|
272
|
-
if (!data.data)
|
|
273
|
-
throw customError(1500, "No data provided.");
|
|
274
|
-
if (!data.format)
|
|
275
|
-
throw customError(1500, "No format provided.");
|
|
276
|
-
try {
|
|
277
|
-
const response = await config_1.axiosApiUrl.post("/private/textly/extract", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
278
|
-
return response.data;
|
|
279
|
-
}
|
|
280
|
-
catch (error) {
|
|
281
|
-
throw customError(5000, error.response?.data?.message || error.message);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
exports.extractWithTextly = extractWithTextly;
|