@digitraffic/common 2026.2.5-4 → 2026.2.17-1

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.
@@ -14,11 +14,9 @@ const baseHeaders = {
14
14
  "Accept-Encoding": "gzip",
15
15
  Accept: "*/*",
16
16
  };
17
+ // Step name can only contain letters, numbers, hyphens, underscores, periods, and spaces
17
18
  function sanitizeStepName(url) {
18
- return url
19
- .replace(/auth=.*/, "")
20
- .replace(/\//g, " ")
21
- .replace(/[?&=]/g, " ");
19
+ return url.replace(/auth=.*/, "").replace(/[^a-zA-Z0-9\-_. ]/g, " ");
22
20
  }
23
21
  export class UrlChecker {
24
22
  requestOptions;
@@ -56,7 +54,6 @@ export class UrlChecker {
56
54
  path: url,
57
55
  },
58
56
  };
59
- // The step name can only contain letters, numbers, hyphens, underscores, periods, and spaces
60
57
  await synthetics.executeHttpStep(`Verify ${statusCode} for ${sanitizeStepName(url)}`, requestOptions, callback);
61
58
  }
62
59
  expect200(url, ...callbacks) {
@@ -12,3 +12,20 @@ import { z } from "zod";
12
12
  */
13
13
  export declare function zStringToNumber(message?: string): z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
14
14
  export declare function zStringToDate(message?: string): z.ZodPipe<z.ZodString, z.ZodTransform<Date | undefined, string>>;
15
+ /**
16
+ * Transforms an empty string to undefined. Useful for optional query parameters
17
+ * that may arrive as empty strings.
18
+ */
19
+ export declare const zEmptyStringToUndefined: z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>;
20
+ /**
21
+ * Optional string query parameter. Empty strings are treated as undefined.
22
+ */
23
+ export declare function zOptionalString(): z.ZodUnion<[z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>, z.ZodOptional<z.ZodString>]>;
24
+ /**
25
+ * Optional number query parameter parsed from a string. Empty strings are treated as undefined.
26
+ */
27
+ export declare function zOptionalNumber(message?: string): z.ZodUnion<[z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>]>;
28
+ /**
29
+ * Optional date query parameter parsed from a string. Empty strings are treated as undefined.
30
+ */
31
+ export declare function zOptionalDate(message?: string): z.ZodUnion<[z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<Date | undefined, string>>>]>;
@@ -26,4 +26,27 @@ export function zStringToDate(message) {
26
26
  message: message ? message : "Invalid date format",
27
27
  });
28
28
  }
29
+ /**
30
+ * Transforms an empty string to undefined. Useful for optional query parameters
31
+ * that may arrive as empty strings.
32
+ */
33
+ export const zEmptyStringToUndefined = z.literal("").transform(() => undefined);
34
+ /**
35
+ * Optional string query parameter. Empty strings are treated as undefined.
36
+ */
37
+ export function zOptionalString() {
38
+ return zEmptyStringToUndefined.or(z.string().optional());
39
+ }
40
+ /**
41
+ * Optional number query parameter parsed from a string. Empty strings are treated as undefined.
42
+ */
43
+ export function zOptionalNumber(message) {
44
+ return zEmptyStringToUndefined.or(zStringToNumber(message).optional());
45
+ }
46
+ /**
47
+ * Optional date query parameter parsed from a string. Empty strings are treated as undefined.
48
+ */
49
+ export function zOptionalDate(message) {
50
+ return zEmptyStringToUndefined.or(zStringToDate(message).optional());
51
+ }
29
52
  //# sourceMappingURL=zod-utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.2.5-4",
3
+ "version": "2026.2.17-1",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {