shelving 1.84.1 → 1.84.2
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
package/schema/AllowSchema.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { Entry } from "../util/entry.js";
|
|
2
2
|
import { ImmutableRequiredMap, PossibleMap, PossibleStringMap } from "../util/map.js";
|
|
3
3
|
import { Schema, SchemaOptions } from "./Schema.js";
|
|
4
|
-
/** Options for an `AllowSchema` instance. */
|
|
5
|
-
declare type AllowSchemaOptions<K, T> = SchemaOptions & {
|
|
6
|
-
allow: PossibleMap<K, T>;
|
|
7
|
-
value?: K | null;
|
|
8
|
-
};
|
|
9
4
|
/** Define a valid value from an allowed set of values. */
|
|
10
5
|
export declare class AllowSchema<K, T> extends Schema<K> implements Iterable<Entry<K, T>> {
|
|
11
6
|
readonly value: K | null;
|
|
12
7
|
readonly allow: ImmutableRequiredMap<K, T>;
|
|
13
|
-
constructor({ allow, value, ...options }:
|
|
8
|
+
constructor({ allow, value, ...options }: SchemaOptions & {
|
|
9
|
+
allow: PossibleMap<K, T>;
|
|
10
|
+
value?: K | null;
|
|
11
|
+
});
|
|
14
12
|
validate(value?: unknown): K;
|
|
15
13
|
/** Iterate over the the allowed options in `[key, value]` format. */
|
|
16
14
|
[Symbol.iterator](): Iterator<Entry<K, T>>;
|
|
@@ -19,6 +17,7 @@ export declare class AllowSchema<K, T> extends Schema<K> implements Iterable<Ent
|
|
|
19
17
|
export declare class AllowStringSchema<K extends string, T> extends AllowSchema<K, T> {
|
|
20
18
|
constructor({ allow, ...options }: SchemaOptions & {
|
|
21
19
|
allow: PossibleStringMap<K, T>;
|
|
20
|
+
value?: K | null;
|
|
22
21
|
});
|
|
23
22
|
validator(value?: unknown): K;
|
|
24
23
|
}
|
|
@@ -26,4 +25,3 @@ export declare class AllowStringSchema<K extends string, T> extends AllowSchema<
|
|
|
26
25
|
export declare function ALLOW<K, T>(allow: PossibleMap<K, T>): AllowSchema<K, T>;
|
|
27
26
|
/** Valid string from an allowed set of values. */
|
|
28
27
|
export declare function ALLOW_STRING<K extends string, T>(allow: PossibleStringMap<K, T>): AllowSchema<K, T>;
|
|
29
|
-
export {};
|
package/schema/NumberSchema.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export declare class NumberSchema extends Schema<number> {
|
|
|
13
13
|
});
|
|
14
14
|
validate(unsafeValue?: unknown): number;
|
|
15
15
|
}
|
|
16
|
-
/** Valid number, e.g. `2048` or `0` zero. */
|
|
16
|
+
/** Valid number, e.g. `2048.12345` or `0` zero. */
|
|
17
17
|
export declare const NUMBER: NumberSchema;
|
|
18
|
-
/** Valid number, e.g.
|
|
18
|
+
/** Valid number, e.g. `2048.12345` or `0` zero, or `null` */
|
|
19
19
|
export declare const OPTIONAL_NUMBER: import("./OptionalSchema.js").OptionalSchema<number>;
|
|
20
|
+
/** Valid integer number, e.g. `2048` or `0` zero. */
|
|
21
|
+
export declare const INTEGER: NumberSchema;
|
|
22
|
+
/** Valid integer number, e.g. `2048` or `0` zero, or `null` */
|
|
23
|
+
export declare const OPTIONAL_INTEGER: import("./OptionalSchema.js").OptionalSchema<number>;
|
package/schema/NumberSchema.js
CHANGED
|
@@ -23,7 +23,11 @@ export class NumberSchema extends Schema {
|
|
|
23
23
|
return safeNumber;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
/** Valid number, e.g. `2048` or `0` zero. */
|
|
26
|
+
/** Valid number, e.g. `2048.12345` or `0` zero. */
|
|
27
27
|
export const NUMBER = new NumberSchema({});
|
|
28
|
-
/** Valid number, e.g.
|
|
28
|
+
/** Valid number, e.g. `2048.12345` or `0` zero, or `null` */
|
|
29
29
|
export const OPTIONAL_NUMBER = OPTIONAL(NUMBER);
|
|
30
|
+
/** Valid integer number, e.g. `2048` or `0` zero. */
|
|
31
|
+
export const INTEGER = new NumberSchema({ step: 1, min: Number.MIN_SAFE_INTEGER, max: Number.MIN_SAFE_INTEGER });
|
|
32
|
+
/** Valid integer number, e.g. `2048` or `0` zero, or `null` */
|
|
33
|
+
export const OPTIONAL_INTEGER = OPTIONAL(INTEGER);
|