@vigneshreddy/cms-sdk 1.0.16 → 1.0.17

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/README.md CHANGED
@@ -89,7 +89,7 @@ If you can’t reliably send the `clickId` at the moment you want to record a le
89
89
  ```ts
90
90
  import { CMS } from "@vigneshreddy/cms-sdk";
91
91
 
92
- const cms = new CMS({ apiKey: "sk_live_xxx" });
92
+ const cms = new CMS({ apiKey: "xxx" });
93
93
 
94
94
  // Step 1: store the clickId <-> customerExternalId association
95
95
  await cms.trackLead({
@@ -192,10 +192,7 @@ The SDK provides specific error classes for different failure scenarios. Catch a
192
192
  ```ts
193
193
  import {
194
194
  CMS,
195
- CMSAPIError,
196
- UnauthorizedError,
197
- RateLimitError,
198
- ValidationError
195
+ CMSAPIError
199
196
  } from "@vigneshreddy/cms-sdk";
200
197
 
201
198
  const cms = new CMS({ apiKey: process.env.CMS_API_KEY });
@@ -206,16 +203,15 @@ try {
206
203
  eventName: "signup_started",
207
204
  customerExternalId: "user_42",
208
205
  });
209
- } catch (error) {
210
- if (error instanceof UnauthorizedError) {
211
- console.error("Invalid API key - check your credentials");
212
- } else if (error instanceof RateLimitError) {
213
- console.error("Rate limited - wait before retrying");
214
- } else if (error instanceof CMSAPIError) {
215
- console.error(`CMS API error [${error.statusCode}]:`, error.message);
216
- console.debug("Type:", error.type);
206
+ } ccatch (error) {
207
+ if (error instanceof CMSAPIError) {
208
+ console.error("CMS API error", {
209
+ statusCode: error.statusCode,
210
+ type: error.type,
211
+ message: error.message,
212
+ });
217
213
  } else {
218
- console.error("Unexpected error:", error);
214
+ console.error("Unexpected error", error);
219
215
  }
220
216
  }
221
217
  ```
@@ -4,8 +4,7 @@
4
4
  */
5
5
  import { z } from "zod";
6
6
  export declare const CMSConfigSchema: z.ZodObject<{
7
- apiKey: z.ZodEffects<z.ZodString, string, string>;
8
- baseUrl: z.ZodOptional<z.ZodString>;
7
+ apiKey: z.ZodOptional<z.ZodString>;
9
8
  timeout: z.ZodOptional<z.ZodNumber>;
10
9
  maxRetries: z.ZodOptional<z.ZodNumber>;
11
10
  retryDelayMs: z.ZodOptional<z.ZodNumber>;
@@ -13,18 +12,16 @@ export declare const CMSConfigSchema: z.ZodObject<{
13
12
  retryOnStatuses: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
14
13
  retryOnNetworkError: z.ZodOptional<z.ZodBoolean>;
15
14
  }, "strip", z.ZodTypeAny, {
16
- apiKey: string;
15
+ apiKey?: string | undefined;
17
16
  timeout?: number | undefined;
18
- baseUrl?: string | undefined;
19
17
  maxRetries?: number | undefined;
20
18
  retryDelayMs?: number | undefined;
21
19
  retryMaxDelayMs?: number | undefined;
22
20
  retryOnStatuses?: number[] | undefined;
23
21
  retryOnNetworkError?: boolean | undefined;
24
22
  }, {
25
- apiKey: string;
23
+ apiKey?: string | undefined;
26
24
  timeout?: number | undefined;
27
- baseUrl?: string | undefined;
28
25
  maxRetries?: number | undefined;
29
26
  retryDelayMs?: number | undefined;
30
27
  retryMaxDelayMs?: number | undefined;
@@ -15,11 +15,6 @@ const constants_1 = require("../constants/constants");
15
15
  exports.CMSConfigSchema = zod_1.z.object({
16
16
  apiKey: zod_1.z
17
17
  .string()
18
- .min(1, constants_1.ERROR_MESSAGES.API_KEY_REQUIRED)
19
- .refine((key) => constants_1.VALIDATION_CONSTRAINTS.API_KEY.PATTERN.test(key), constants_1.ERROR_MESSAGES.API_KEY_INVALID_FORMAT),
20
- baseUrl: zod_1.z
21
- .string()
22
- .url(constants_1.ERROR_MESSAGES.BASE_URL_INVALID)
23
18
  .optional(),
24
19
  timeout: zod_1.z
25
20
  .number()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vigneshreddy/cms-sdk",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Official TypeScript SDK for CutMeShort CMS API",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",