@automate.ax/codec 0.4.0 → 0.5.0

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/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type Encodable = null | undefined | void | boolean | number | bigint | st
14
14
  */
15
15
  export declare function isEncodable(value: unknown): value is Encodable;
16
16
  /** Zod schema for values accepted by the codec encoder. */
17
- export declare const encodableSchema: z.ZodCustom<Encodable, Encodable>;
17
+ export declare const encodableSchema: z.ZodOptional<z.ZodCustom<Encodable, Encodable>>;
18
18
  /**
19
19
  * Serializes a value after checking it against the codec's supported input
20
20
  * surface.
package/dist/index.js CHANGED
@@ -74,9 +74,11 @@ export function isEncodable(value) {
74
74
  return visit(value);
75
75
  }
76
76
  /** Zod schema for values accepted by the codec encoder. */
77
- export const encodableSchema = z.custom(isEncodable, {
77
+ export const encodableSchema = z
78
+ .custom(isEncodable, {
78
79
  message: "Value is not encodable",
79
- });
80
+ })
81
+ .optional();
80
82
  /**
81
83
  * Serializes a value after checking it against the codec's supported input
82
84
  * surface.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/codec",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Msgpack-based encoding helpers for Automate.ax runtime data.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -129,9 +129,11 @@ export function isEncodable(value: unknown): value is Encodable {
129
129
  }
130
130
 
131
131
  /** Zod schema for values accepted by the codec encoder. */
132
- export const encodableSchema = z.custom<Encodable>(isEncodable, {
133
- message: "Value is not encodable",
134
- })
132
+ export const encodableSchema = z
133
+ .custom<Encodable>(isEncodable, {
134
+ message: "Value is not encodable",
135
+ })
136
+ .optional()
135
137
 
136
138
  /**
137
139
  * Serializes a value after checking it against the codec's supported input