dymo-api 1.2.30 → 1.2.31

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.
@@ -6,30 +6,35 @@ declare class DymoAPI {
6
6
  private rules;
7
7
  private baseUrl;
8
8
  private axiosClient;
9
+ private resilienceManager;
9
10
  /**
10
- * @param {Object} options - Options to create the DymoAPI instance.
11
- * @param {string} [options.rootApiKey] - The root API key.
12
- * @param {string} [options.apiKey] - The API key.
13
- * @param {string} [options.baseUrl] - Whether to use a local server instead of the cloud server.
14
- * @param {Object} [options.serverEmailConfig] - The server email config.
15
- * @description
16
- * This is the main class to interact with the Dymo API. It should be
17
- * instantiated with the root API key and the API key. The root API key is
18
- * used to fetch the tokens and the API key is used to authenticate the
19
- * requests.
20
- * @example
21
- * const dymoApi = new DymoAPI({
22
- * rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
23
- * apiKey: "dm_4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
24
- * });
25
- */
26
- constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig, rules }?: {
11
+ * @param {Object} options - Options to create the DymoAPI instance.
12
+ * @param {string} [options.rootApiKey] - The root API key.
13
+ * @param {string} [options.apiKey] - The API key.
14
+ * @param {string} [options.baseUrl] - Whether to use a local server instead of the cloud server.
15
+ * @param {Object} [options.serverEmailConfig] - The server email config.
16
+ * @param {Object} [options.rules] - The rules.
17
+ * @param {Object} [options.resilience] - The resilience config.
18
+ * @description
19
+ * This is the main class to interact with the Dymo API. It should be
20
+ * instantiated with the root API key and the API key. The root API key is
21
+ * used to fetch the tokens and the API key is used to authenticate the
22
+ * requests. Requests are retried once by default with exponential backoff.
23
+ * @example
24
+ * const dymoApi = new DymoAPI({
25
+ * rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
26
+ * apiKey: "dm_4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
27
+ * });
28
+ */
29
+ constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig, rules, resilience }?: {
27
30
  rootApiKey?: string | null;
28
31
  apiKey?: string | null;
29
32
  baseUrl?: string;
30
33
  serverEmailConfig?: Interfaces.ServerEmailConfig;
31
34
  rules?: Interfaces.Rules;
35
+ resilience?: Interfaces.ResilienceConfig;
32
36
  });
37
+ private getEmailPlugins;
33
38
  /**
34
39
  * Validates the given data against the configured validation settings.
35
40
  *
@@ -0,0 +1,26 @@
1
+ export declare class FallbackDataGenerator {
2
+ static generateFallbackData<T>(method: string, inputData?: any): T;
3
+ private static validateURL;
4
+ private static validateEmail;
5
+ private static validateDomain;
6
+ private static validateCreditCard;
7
+ private static validateIP;
8
+ private static validatePhone;
9
+ private static validateWallet;
10
+ private static validateIBAN;
11
+ private static extractDomain;
12
+ private static generateDataValidationAnalysis;
13
+ private static generateEmailValidatorResponse;
14
+ private static generateEmailDataAnalysis;
15
+ private static generateIPValidatorResponse;
16
+ private static generateIPDataAnalysis;
17
+ private static generatePhoneValidatorResponse;
18
+ private static generatePhoneDataAnalysis;
19
+ private static generateHTTPRequest;
20
+ private static generateEmailStatus;
21
+ private static generateSRNSummary;
22
+ private static generateExtractWithTextly;
23
+ private static generatePrayerTimes;
24
+ private static generateSatinizedInputAnalysis;
25
+ private static generatePasswordValidationResult;
26
+ }
@@ -0,0 +1,13 @@
1
+ import { ResilienceConfig } from "../types/interfaces";
2
+ import { AxiosInstance, AxiosRequestConfig } from "axios";
3
+ export declare class ResilienceManager {
4
+ private config;
5
+ private clientId;
6
+ private rateLimitManager;
7
+ constructor(config?: ResilienceConfig, clientId?: string);
8
+ executeWithResilience<T>(axiosClient: AxiosInstance, requestConfig: AxiosRequestConfig, fallbackData?: T): Promise<T>;
9
+ private shouldRetry;
10
+ private sleep;
11
+ getConfig(): Required<ResilienceConfig>;
12
+ getClientId(): string;
13
+ }
@@ -162,6 +162,21 @@ export interface ExtractWithTextly {
162
162
  [key: string]: JsonSchemaProperty;
163
163
  };
164
164
  }
165
+ export interface RateLimitInfo {
166
+ limit?: number;
167
+ remaining?: number;
168
+ resetTime?: string;
169
+ retryAfter?: number;
170
+ lastUpdated?: number;
171
+ }
172
+ export interface RateLimitTracker {
173
+ [clientId: string]: RateLimitInfo;
174
+ }
175
+ export interface ResilienceConfig {
176
+ fallbackEnabled?: boolean;
177
+ retryAttempts?: number;
178
+ retryDelay?: number;
179
+ }
165
180
  export * from "./rules";
166
181
  export * from "./primitives";
167
182
  export * from "./data-verifier";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.2.30",
3
+ "version": "1.2.31",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",