dymo-api 1.2.30 → 1.2.32
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/dymo-api.cjs +51 -21
- package/dist/cjs/lib/resilience/fallback.cjs +427 -0
- package/dist/cjs/lib/resilience/index.cjs +135 -0
- package/dist/esm/dymo-api.js +51 -21
- package/dist/esm/lib/resilience/fallback.js +423 -0
- package/dist/esm/lib/resilience/index.js +131 -0
- package/dist/types/dymo-api.d.ts +23 -18
- package/dist/types/lib/resilience/fallback.d.ts +26 -0
- package/dist/types/lib/resilience/index.d.ts +13 -0
- package/dist/types/lib/types/interfaces.d.ts +15 -0
- package/package.json +2 -2
package/dist/types/dymo-api.d.ts
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
*
|
|
@@ -281,4 +286,4 @@ declare class DymoAPI {
|
|
|
281
286
|
isValidPwd(data: Interfaces.IsValidPwdData): Promise<Interfaces.PasswordValidationResult>;
|
|
282
287
|
}
|
|
283
288
|
export default DymoAPI;
|
|
284
|
-
export type { EmailValidatorRules, NegativeEmailRules, DataEmailValidationAnalysis, IPValidatorRules, NegativeIPRules, DataIPValidationAnalysis, PhoneValidatorRules, NegativePhoneRules, DataPhoneValidationAnalysis, WafRules, SensitiveInfoRules } from "./lib/types/interfaces";
|
|
289
|
+
export type { EmailValidatorRules, NegativeEmailRules, DataEmailValidationAnalysis, IPValidatorRules, NegativeIPRules, DataIPValidationAnalysis, PhoneValidatorRules, NegativePhoneRules, DataPhoneValidationAnalysis, WafRules, SensitiveInfoRules, ResilienceConfig } from "./lib/types/interfaces";
|
|
@@ -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.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"description": "Flow system for Dymo API.",
|
|
5
5
|
"main": "dist/cjs/dymo-api.js",
|
|
6
6
|
"module": "dist/esm/dymo-api.js",
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
"tabWidth": 4,
|
|
86
86
|
"useTabs": false
|
|
87
87
|
}
|
|
88
|
-
}
|
|
88
|
+
}
|