@digitraffic/common 2026.2.17-3 → 2026.2.17-4

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.
@@ -21,6 +21,7 @@ export declare function zStringToNumber(message?: string): z.ZodPipe<z.ZodString
21
21
  */
22
22
  export declare function zStringToDate(message?: string): z.ZodPipe<z.ZodString, z.ZodTransform<Date | undefined, string>>;
23
23
  /**
24
- * Optional string. Empty strings are treated as undefined.
24
+ * A non-empty string. Empty strings produce a validation error.
25
+ * Chain with .optional() to also accept undefined.
25
26
  */
26
- export declare function zOptionalString(): z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
27
+ export declare function zNonEmptyString(message?: string): z.ZodString;
@@ -46,12 +46,12 @@ export function zStringToDate(message) {
46
46
  });
47
47
  }
48
48
  /**
49
- * Optional string. Empty strings are treated as undefined.
49
+ * A non-empty string. Empty strings produce a validation error.
50
+ * Chain with .optional() to also accept undefined.
50
51
  */
51
- export function zOptionalString() {
52
- return z
53
- .string()
54
- .optional()
55
- .transform((val) => (val === "" ? undefined : val));
52
+ export function zNonEmptyString(message) {
53
+ return z.string().refine((val) => val !== "", {
54
+ message: message ?? "String must not be empty",
55
+ });
56
56
  }
57
57
  //# sourceMappingURL=zod-utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.2.17-3",
3
+ "version": "2026.2.17-4",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {