@dereekb/model 13.4.0 → 13.4.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.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@dereekb/model",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.4.0",
5
+ "@dereekb/util": "13.4.1",
6
6
  "arktype": "^2.2.0",
7
7
  "make-error": "^1.3.0"
8
8
  },
@@ -1,4 +1,24 @@
1
+ import { type Maybe } from '@dereekb/util';
1
2
  import { type type, type Type } from 'arktype';
3
+ /**
4
+ * A value that can be set to a value of `T`, or cleared by setting to `null` or `undefined`.
5
+ *
6
+ * Structurally equivalent to {@link Maybe}, but semantically distinct:
7
+ * - `Maybe<T>` — the value might not exist (absence is passive)
8
+ * - `Clearable<T>` — `null` actively signals "clear/reset this field", while `undefined` means "leave unchanged"
9
+ *
10
+ * Used in API update params where `null` tells the server to delete/reset a field.
11
+ * See {@link clearable} for the ArkType schema equivalent.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * interface UpdateUserParams {
16
+ * name?: string; // required when present
17
+ * phone?: Clearable<string>; // can be set, or cleared with null
18
+ * }
19
+ * ```
20
+ */
21
+ export type Clearable<T> = Maybe<T>;
2
22
  /**
3
23
  * Creates an ArkType schema that accepts the given ArkType definition OR null/undefined.
4
24
  * Used for fields where null acts as a "clear/reset" signal for the model.