@vigneshreddy/cms-sdk 1.0.13 → 1.0.15

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.
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toPathString = exports.serializeDataIfNeeded = exports.replaceWithSerializableTypeIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
4
+ const base_1 = require("./base");
5
+ exports.DUMMY_BASE_URL = 'https://example.com';
6
+ /**
7
+ *
8
+ * @throws {RequiredError}
9
+ */
10
+ const assertParamExists = function (functionName, paramName, paramValue) {
11
+ if (paramValue === null || paramValue === undefined) {
12
+ throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
13
+ }
14
+ };
15
+ exports.assertParamExists = assertParamExists;
16
+ const setApiKeyToObject = async function (object, keyParamName, configuration) {
17
+ if (configuration && configuration.apiKey) {
18
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
19
+ ? await configuration.apiKey(keyParamName)
20
+ : await configuration.apiKey;
21
+ object[keyParamName] = localVarApiKeyValue;
22
+ }
23
+ };
24
+ exports.setApiKeyToObject = setApiKeyToObject;
25
+ const setBasicAuthToObject = function (object, configuration) {
26
+ if (configuration && (configuration.username || configuration.password)) {
27
+ object["auth"] = { username: configuration.username, password: configuration.password };
28
+ }
29
+ };
30
+ exports.setBasicAuthToObject = setBasicAuthToObject;
31
+ const setBearerAuthToObject = async function (object, configuration) {
32
+ if (configuration && configuration.accessToken) {
33
+ const accessToken = typeof configuration.accessToken === 'function'
34
+ ? await configuration.accessToken()
35
+ : await configuration.accessToken;
36
+ object["Authorization"] = "Bearer " + accessToken;
37
+ }
38
+ };
39
+ exports.setBearerAuthToObject = setBearerAuthToObject;
40
+ const setOAuthToObject = async function (object, name, scopes, configuration) {
41
+ if (configuration && configuration.accessToken) {
42
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
43
+ ? await configuration.accessToken(name, scopes)
44
+ : await configuration.accessToken;
45
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
46
+ }
47
+ };
48
+ exports.setOAuthToObject = setOAuthToObject;
49
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
50
+ if (parameter == null)
51
+ return;
52
+ if (typeof parameter === "object") {
53
+ if (Array.isArray(parameter) || parameter instanceof Set) {
54
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
55
+ }
56
+ else {
57
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
58
+ }
59
+ }
60
+ else {
61
+ if (urlSearchParams.has(key)) {
62
+ urlSearchParams.append(key, parameter);
63
+ }
64
+ else {
65
+ urlSearchParams.set(key, parameter);
66
+ }
67
+ }
68
+ }
69
+ const setSearchParams = function (url, ...objects) {
70
+ const searchParams = new URLSearchParams(url.search);
71
+ setFlattenedQueryParams(searchParams, objects);
72
+ url.search = searchParams.toString();
73
+ };
74
+ exports.setSearchParams = setSearchParams;
75
+ /**
76
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
77
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
78
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
79
+ */
80
+ // @ts-ignore
81
+ const replaceWithSerializableTypeIfNeeded = function (key, value) {
82
+ if (value instanceof Set) {
83
+ return Array.from(value);
84
+ }
85
+ else {
86
+ return value;
87
+ }
88
+ };
89
+ exports.replaceWithSerializableTypeIfNeeded = replaceWithSerializableTypeIfNeeded;
90
+ const serializeDataIfNeeded = function (value, requestOptions, configuration) {
91
+ const nonString = typeof value !== 'string';
92
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
93
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
94
+ : nonString;
95
+ return needsSerialization
96
+ ? JSON.stringify(value !== undefined ? value : {}, exports.replaceWithSerializableTypeIfNeeded)
97
+ : (value || "");
98
+ };
99
+ exports.serializeDataIfNeeded = serializeDataIfNeeded;
100
+ const toPathString = function (url) {
101
+ return url.pathname + url.search + url.hash;
102
+ };
103
+ exports.toPathString = toPathString;
@@ -0,0 +1,87 @@
1
+ interface AWSv4Configuration {
2
+ options?: {
3
+ region?: string;
4
+ service?: string;
5
+ };
6
+ credentials?: {
7
+ accessKeyId?: string;
8
+ secretAccessKey?: string;
9
+ sessionToken?: string;
10
+ };
11
+ }
12
+ export interface ConfigurationParameters {
13
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
14
+ username?: string;
15
+ password?: string;
16
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
17
+ awsv4?: AWSv4Configuration;
18
+ basePath?: string;
19
+ serverIndex?: number;
20
+ baseOptions?: any;
21
+ formDataCtor?: new () => any;
22
+ }
23
+ export declare class Configuration {
24
+ /**
25
+ * parameter for apiKey security
26
+ * @param name security name
27
+ */
28
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
29
+ /**
30
+ * parameter for basic security
31
+ */
32
+ username?: string;
33
+ /**
34
+ * parameter for basic security
35
+ */
36
+ password?: string;
37
+ /**
38
+ * parameter for oauth2 security
39
+ * @param name security name
40
+ * @param scopes oauth2 scope
41
+ */
42
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
43
+ /**
44
+ * parameter for aws4 signature security
45
+ * @param {Object} AWS4Signature - AWS4 Signature security
46
+ * @param {string} options.region - aws region
47
+ * @param {string} options.service - name of the service.
48
+ * @param {string} credentials.accessKeyId - aws access key id
49
+ * @param {string} credentials.secretAccessKey - aws access key
50
+ * @param {string} credentials.sessionToken - aws session token
51
+ * @memberof Configuration
52
+ */
53
+ awsv4?: AWSv4Configuration;
54
+ /**
55
+ * override base path
56
+ */
57
+ basePath?: string;
58
+ /**
59
+ * override server index
60
+ */
61
+ serverIndex?: number;
62
+ /**
63
+ * base options for axios calls
64
+ */
65
+ baseOptions?: any;
66
+ /**
67
+ * The FormData constructor that will be used to create multipart form data
68
+ * requests. You can inject this here so that execution environments that
69
+ * do not support the FormData class can still run the generated client.
70
+ *
71
+ * @type {new () => FormData}
72
+ */
73
+ formDataCtor?: new () => any;
74
+ constructor(param?: ConfigurationParameters);
75
+ /**
76
+ * Check if the given MIME is a JSON MIME.
77
+ * JSON MIME examples:
78
+ * application/json
79
+ * application/json; charset=UTF8
80
+ * APPLICATION/JSON
81
+ * application/vnd.company+json
82
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
83
+ * @return True if the given MIME is JSON, false otherwise.
84
+ */
85
+ isJsonMime(mime: string): boolean;
86
+ }
87
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Configuration = void 0;
4
+ class Configuration {
5
+ constructor(param = {}) {
6
+ var _a;
7
+ this.apiKey = param.apiKey;
8
+ this.username = param.username;
9
+ this.password = param.password;
10
+ this.accessToken = param.accessToken;
11
+ this.awsv4 = param.awsv4;
12
+ this.basePath = param.basePath;
13
+ this.serverIndex = param.serverIndex;
14
+ this.baseOptions = {
15
+ ...param.baseOptions,
16
+ headers: {
17
+ ...(_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers,
18
+ },
19
+ };
20
+ this.formDataCtor = param.formDataCtor;
21
+ }
22
+ /**
23
+ * Check if the given MIME is a JSON MIME.
24
+ * JSON MIME examples:
25
+ * application/json
26
+ * application/json; charset=UTF8
27
+ * APPLICATION/JSON
28
+ * application/vnd.company+json
29
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
30
+ * @return True if the given MIME is JSON, false otherwise.
31
+ */
32
+ isJsonMime(mime) {
33
+ const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
34
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
35
+ }
36
+ }
37
+ exports.Configuration = Configuration;
@@ -0,0 +1,4 @@
1
+ export * from "./api";
2
+ export * from "./base";
3
+ export * from "./common";
4
+ export * from "./configuration";
@@ -0,0 +1,20 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api"), exports);
18
+ __exportStar(require("./base"), exports);
19
+ __exportStar(require("./common"), exports);
20
+ __exportStar(require("./configuration"), exports);
@@ -1,2 +1,7 @@
1
1
  export { CMS } from "./client";
2
+ export type { CMSConfig, RequestOptions, LeadPayload, SalePayload } from "./client";
2
3
  export { CMSAPIError } from "./errors";
4
+ export { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, BadGatewayError, ServiceUnavailableError, GatewayTimeoutError, createSpecificError, } from "./errors/specific";
5
+ export { validateLeadPayload, validateSalePayload, validateCMSConfig, sanitizeForLogging } from "./validations/validation";
6
+ export type { LeadPayloadInput, SalePayloadInput, CMSConfigInput } from "./validations/validation";
7
+ export { SDK_VERSION, API_CONFIG, RETRY_CONFIG, VALIDATION_CONSTRAINTS, ERROR_MESSAGES, HTTP_HEADERS, SENSITIVE_FIELDS, } from "./constants/constants";
package/dist/src/index.js CHANGED
@@ -1,7 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CMSAPIError = exports.CMS = void 0;
3
+ exports.SENSITIVE_FIELDS = exports.HTTP_HEADERS = exports.ERROR_MESSAGES = exports.VALIDATION_CONSTRAINTS = exports.RETRY_CONFIG = exports.API_CONFIG = exports.SDK_VERSION = exports.sanitizeForLogging = exports.validateCMSConfig = exports.validateSalePayload = exports.validateLeadPayload = exports.createSpecificError = exports.GatewayTimeoutError = exports.ServiceUnavailableError = exports.BadGatewayError = exports.InternalServerError = exports.RateLimitError = exports.UnprocessableEntityError = exports.ConflictError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.BadRequestError = exports.CMSAPIError = exports.CMS = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "CMS", { enumerable: true, get: function () { return client_1.CMS; } });
6
6
  var errors_1 = require("./errors");
7
7
  Object.defineProperty(exports, "CMSAPIError", { enumerable: true, get: function () { return errors_1.CMSAPIError; } });
8
+ var specific_1 = require("./errors/specific");
9
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return specific_1.BadRequestError; } });
10
+ Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return specific_1.UnauthorizedError; } });
11
+ Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return specific_1.ForbiddenError; } });
12
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return specific_1.NotFoundError; } });
13
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return specific_1.ConflictError; } });
14
+ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return specific_1.UnprocessableEntityError; } });
15
+ Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return specific_1.RateLimitError; } });
16
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return specific_1.InternalServerError; } });
17
+ Object.defineProperty(exports, "BadGatewayError", { enumerable: true, get: function () { return specific_1.BadGatewayError; } });
18
+ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return specific_1.ServiceUnavailableError; } });
19
+ Object.defineProperty(exports, "GatewayTimeoutError", { enumerable: true, get: function () { return specific_1.GatewayTimeoutError; } });
20
+ Object.defineProperty(exports, "createSpecificError", { enumerable: true, get: function () { return specific_1.createSpecificError; } });
21
+ var validation_1 = require("./validations/validation");
22
+ Object.defineProperty(exports, "validateLeadPayload", { enumerable: true, get: function () { return validation_1.validateLeadPayload; } });
23
+ Object.defineProperty(exports, "validateSalePayload", { enumerable: true, get: function () { return validation_1.validateSalePayload; } });
24
+ Object.defineProperty(exports, "validateCMSConfig", { enumerable: true, get: function () { return validation_1.validateCMSConfig; } });
25
+ Object.defineProperty(exports, "sanitizeForLogging", { enumerable: true, get: function () { return validation_1.sanitizeForLogging; } });
26
+ // Export constants for advanced configuration
27
+ var constants_1 = require("./constants/constants");
28
+ Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return constants_1.SDK_VERSION; } });
29
+ Object.defineProperty(exports, "API_CONFIG", { enumerable: true, get: function () { return constants_1.API_CONFIG; } });
30
+ Object.defineProperty(exports, "RETRY_CONFIG", { enumerable: true, get: function () { return constants_1.RETRY_CONFIG; } });
31
+ Object.defineProperty(exports, "VALIDATION_CONSTRAINTS", { enumerable: true, get: function () { return constants_1.VALIDATION_CONSTRAINTS; } });
32
+ Object.defineProperty(exports, "ERROR_MESSAGES", { enumerable: true, get: function () { return constants_1.ERROR_MESSAGES; } });
33
+ Object.defineProperty(exports, "HTTP_HEADERS", { enumerable: true, get: function () { return constants_1.HTTP_HEADERS; } });
34
+ Object.defineProperty(exports, "SENSITIVE_FIELDS", { enumerable: true, get: function () { return constants_1.SENSITIVE_FIELDS; } });
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Token bucket rate limiter for controlling request rate
3
+ * Prevents the SDK from sending too many requests too quickly
4
+ */
5
+ export interface RateLimiterOptions {
6
+ /** Maximum number of requests allowed per time window */
7
+ maxRequests: number;
8
+ /** Time window in milliseconds */
9
+ windowMs: number;
10
+ /** Called when rate limit is exceeded */
11
+ onLimitExceeded?: (remaining: number) => void;
12
+ }
13
+ export declare class RateLimiter {
14
+ private maxRequests;
15
+ private windowMs;
16
+ private tokens;
17
+ private lastRefillTime;
18
+ private onLimitExceeded?;
19
+ constructor(options: RateLimiterOptions);
20
+ /**
21
+ * Try to consume one token
22
+ * Returns true if request should be allowed, false if rate limited
23
+ */
24
+ tryConsume(): boolean;
25
+ /**
26
+ * Get current number of available tokens
27
+ */
28
+ getAvailableTokens(): number;
29
+ /**
30
+ * Get milliseconds until next token becomes available
31
+ */
32
+ getWaitTime(): number;
33
+ /**
34
+ * Reset the rate limiter
35
+ */
36
+ reset(): void;
37
+ /**
38
+ * Refill tokens based on elapsed time
39
+ */
40
+ private refill;
41
+ }
42
+ /**
43
+ * Pre-configured rate limiters for common scenarios
44
+ */
45
+ export declare const RATE_LIMITER_PRESETS: {
46
+ /**
47
+ * Conservative: 10 requests per second (good for test/demo)
48
+ */
49
+ readonly CONSERVATIVE: {
50
+ readonly maxRequests: 10;
51
+ readonly windowMs: 1000;
52
+ };
53
+ /**
54
+ * Standard: 100 requests per second (suitable for production)
55
+ */
56
+ readonly STANDARD: {
57
+ readonly maxRequests: 100;
58
+ readonly windowMs: 1000;
59
+ };
60
+ /**
61
+ * Aggressive: 1000 requests per second (for high-volume scenarios)
62
+ */
63
+ readonly AGGRESSIVE: {
64
+ readonly maxRequests: 1000;
65
+ readonly windowMs: 1000;
66
+ };
67
+ /**
68
+ * Unlimited: No rate limiting (use with caution)
69
+ */
70
+ readonly UNLIMITED: {
71
+ readonly maxRequests: number;
72
+ readonly windowMs: 1000;
73
+ };
74
+ };
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /**
3
+ * Token bucket rate limiter for controlling request rate
4
+ * Prevents the SDK from sending too many requests too quickly
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RATE_LIMITER_PRESETS = exports.RateLimiter = void 0;
8
+ class RateLimiter {
9
+ constructor(options) {
10
+ this.maxRequests = options.maxRequests;
11
+ this.windowMs = options.windowMs;
12
+ this.tokens = options.maxRequests;
13
+ this.lastRefillTime = Date.now();
14
+ this.onLimitExceeded = options.onLimitExceeded;
15
+ }
16
+ /**
17
+ * Try to consume one token
18
+ * Returns true if request should be allowed, false if rate limited
19
+ */
20
+ tryConsume() {
21
+ this.refill();
22
+ if (this.tokens > 0) {
23
+ this.tokens -= 1;
24
+ return true;
25
+ }
26
+ if (this.onLimitExceeded) {
27
+ this.onLimitExceeded(this.tokens);
28
+ }
29
+ return false;
30
+ }
31
+ /**
32
+ * Get current number of available tokens
33
+ */
34
+ getAvailableTokens() {
35
+ this.refill();
36
+ return this.tokens;
37
+ }
38
+ /**
39
+ * Get milliseconds until next token becomes available
40
+ */
41
+ getWaitTime() {
42
+ if (this.tokens > 0) {
43
+ return 0;
44
+ }
45
+ const timeSinceRefill = Date.now() - this.lastRefillTime;
46
+ const timePerToken = this.windowMs / this.maxRequests;
47
+ return Math.ceil(timePerToken - timeSinceRefill);
48
+ }
49
+ /**
50
+ * Reset the rate limiter
51
+ */
52
+ reset() {
53
+ this.tokens = this.maxRequests;
54
+ this.lastRefillTime = Date.now();
55
+ }
56
+ /**
57
+ * Refill tokens based on elapsed time
58
+ */
59
+ refill() {
60
+ const now = Date.now();
61
+ const timePassed = now - this.lastRefillTime;
62
+ if (timePassed >= this.windowMs) {
63
+ // Full reset if entire window has passed
64
+ this.tokens = this.maxRequests;
65
+ this.lastRefillTime = now;
66
+ }
67
+ else if (timePassed > 0) {
68
+ // Partial refill based on time passed
69
+ const refillRate = this.maxRequests / this.windowMs;
70
+ const tokensToAdd = (timePassed * refillRate);
71
+ this.tokens = Math.min(this.maxRequests, this.tokens + tokensToAdd);
72
+ this.lastRefillTime = now;
73
+ }
74
+ }
75
+ }
76
+ exports.RateLimiter = RateLimiter;
77
+ /**
78
+ * Pre-configured rate limiters for common scenarios
79
+ */
80
+ exports.RATE_LIMITER_PRESETS = {
81
+ /**
82
+ * Conservative: 10 requests per second (good for test/demo)
83
+ */
84
+ CONSERVATIVE: {
85
+ maxRequests: 10,
86
+ windowMs: 1000,
87
+ },
88
+ /**
89
+ * Standard: 100 requests per second (suitable for production)
90
+ */
91
+ STANDARD: {
92
+ maxRequests: 100,
93
+ windowMs: 1000,
94
+ },
95
+ /**
96
+ * Aggressive: 1000 requests per second (for high-volume scenarios)
97
+ */
98
+ AGGRESSIVE: {
99
+ maxRequests: 1000,
100
+ windowMs: 1000,
101
+ },
102
+ /**
103
+ * Unlimited: No rate limiting (use with caution)
104
+ */
105
+ UNLIMITED: {
106
+ maxRequests: Infinity,
107
+ windowMs: 1000,
108
+ },
109
+ };
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Input validation schemas using Zod
3
+ * Ensures all incoming data is sanitized and valid
4
+ */
5
+ import { z } from "zod";
6
+ export declare const CMSConfigSchema: z.ZodObject<{
7
+ apiKey: z.ZodEffects<z.ZodString, string, string>;
8
+ baseUrl: z.ZodOptional<z.ZodString>;
9
+ timeout: z.ZodOptional<z.ZodNumber>;
10
+ maxRetries: z.ZodOptional<z.ZodNumber>;
11
+ retryDelayMs: z.ZodOptional<z.ZodNumber>;
12
+ retryMaxDelayMs: z.ZodOptional<z.ZodNumber>;
13
+ retryOnStatuses: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
14
+ retryOnNetworkError: z.ZodOptional<z.ZodBoolean>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ apiKey: string;
17
+ timeout?: number | undefined;
18
+ baseUrl?: string | undefined;
19
+ maxRetries?: number | undefined;
20
+ retryDelayMs?: number | undefined;
21
+ retryMaxDelayMs?: number | undefined;
22
+ retryOnStatuses?: number[] | undefined;
23
+ retryOnNetworkError?: boolean | undefined;
24
+ }, {
25
+ apiKey: string;
26
+ timeout?: number | undefined;
27
+ baseUrl?: string | undefined;
28
+ maxRetries?: number | undefined;
29
+ retryDelayMs?: number | undefined;
30
+ retryMaxDelayMs?: number | undefined;
31
+ retryOnStatuses?: number[] | undefined;
32
+ retryOnNetworkError?: boolean | undefined;
33
+ }>;
34
+ export type CMSConfigInput = z.infer<typeof CMSConfigSchema>;
35
+ export declare const LeadPayloadSchema: z.ZodObject<{
36
+ clickId: z.ZodOptional<z.ZodString>;
37
+ eventName: z.ZodString;
38
+ customerExternalId: z.ZodString;
39
+ timestamp: z.ZodOptional<z.ZodString>;
40
+ customerId: z.ZodOptional<z.ZodString>;
41
+ customerName: z.ZodOptional<z.ZodString>;
42
+ customerEmail: z.ZodOptional<z.ZodString>;
43
+ customerAvatar: z.ZodOptional<z.ZodString>;
44
+ mode: z.ZodOptional<z.ZodEnum<["deferred"]>>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ eventName: string;
47
+ customerExternalId: string;
48
+ clickId?: string | undefined;
49
+ timestamp?: string | undefined;
50
+ customerId?: string | undefined;
51
+ customerName?: string | undefined;
52
+ customerEmail?: string | undefined;
53
+ customerAvatar?: string | undefined;
54
+ mode?: "deferred" | undefined;
55
+ }, {
56
+ eventName: string;
57
+ customerExternalId: string;
58
+ clickId?: string | undefined;
59
+ timestamp?: string | undefined;
60
+ customerId?: string | undefined;
61
+ customerName?: string | undefined;
62
+ customerEmail?: string | undefined;
63
+ customerAvatar?: string | undefined;
64
+ mode?: "deferred" | undefined;
65
+ }>;
66
+ export type LeadPayloadInput = z.infer<typeof LeadPayloadSchema>;
67
+ export declare const SalePayloadSchema: z.ZodObject<{
68
+ clickId: z.ZodOptional<z.ZodString>;
69
+ eventName: z.ZodOptional<z.ZodString>;
70
+ invoiceId: z.ZodString;
71
+ amount: z.ZodNumber;
72
+ currency: z.ZodOptional<z.ZodString>;
73
+ timestamp: z.ZodOptional<z.ZodString>;
74
+ customerId: z.ZodOptional<z.ZodString>;
75
+ customerExternalId: z.ZodOptional<z.ZodString>;
76
+ customerName: z.ZodOptional<z.ZodString>;
77
+ customerEmail: z.ZodOptional<z.ZodString>;
78
+ mode: z.ZodOptional<z.ZodEnum<["deferred"]>>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ invoiceId: string;
81
+ amount: number;
82
+ clickId?: string | undefined;
83
+ eventName?: string | undefined;
84
+ customerExternalId?: string | undefined;
85
+ timestamp?: string | undefined;
86
+ customerId?: string | undefined;
87
+ customerName?: string | undefined;
88
+ customerEmail?: string | undefined;
89
+ mode?: "deferred" | undefined;
90
+ currency?: string | undefined;
91
+ }, {
92
+ invoiceId: string;
93
+ amount: number;
94
+ clickId?: string | undefined;
95
+ eventName?: string | undefined;
96
+ customerExternalId?: string | undefined;
97
+ timestamp?: string | undefined;
98
+ customerId?: string | undefined;
99
+ customerName?: string | undefined;
100
+ customerEmail?: string | undefined;
101
+ mode?: "deferred" | undefined;
102
+ currency?: string | undefined;
103
+ }>;
104
+ export type SalePayloadInput = z.infer<typeof SalePayloadSchema>;
105
+ /**
106
+ * Validates input data and throws detailed error if invalid
107
+ */
108
+ export declare function validateLeadPayload(data: unknown): LeadPayloadInput;
109
+ export declare function validateSalePayload(data: unknown): SalePayloadInput;
110
+ export declare function validateCMSConfig(data: unknown): CMSConfigInput;
111
+ /**
112
+ * Sanitizes sensitive data for logging/errors
113
+ * Removes API keys, tokens, and other credentials
114
+ */
115
+ export declare function sanitizeForLogging(obj: any): any;
116
+ /**
117
+ * Redacts API key from error messages
118
+ */
119
+ export declare function redactApiKey(message: string, apiKey?: string): string;