shelving 1.188.2 → 1.188.3
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 +1 -1
- package/schema/ColorSchema.d.ts +1 -1
- package/schema/ColorSchema.js +1 -0
- package/schema/CurrencyCodeSchema.d.ts +1 -1
- package/schema/CurrencyCodeSchema.js +1 -0
- package/schema/EmailSchema.d.ts +1 -1
- package/schema/EmailSchema.js +1 -0
- package/schema/PhoneSchema.d.ts +1 -1
- package/schema/PhoneSchema.js +1 -0
- package/schema/SlugSchema.d.ts +1 -1
- package/schema/SlugSchema.js +1 -0
- package/schema/StringSchema.d.ts +3 -3
- package/schema/StringSchema.js +4 -4
- package/schema/URISchema.d.ts +1 -1
- package/schema/URISchema.js +1 -1
- package/schema/URLSchema.d.ts +1 -1
- package/schema/URLSchema.js +1 -1
- package/schema/UUIDSchema.d.ts +1 -1
- package/schema/UUIDSchema.js +1 -0
package/package.json
CHANGED
package/schema/ColorSchema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
|
|
2
2
|
/** Options for a `ColorSchema` */
|
|
3
|
-
export interface ColorSchemaOptions extends Omit<StringSchemaOptions, "type" | "min" | "max" | "match" | "
|
|
3
|
+
export interface ColorSchemaOptions extends Omit<StringSchemaOptions, "type" | "min" | "max" | "match" | "rows"> {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Define a valid color hex string, e.g `#00CCFF`
|
package/schema/ColorSchema.js
CHANGED
|
@@ -3,7 +3,7 @@ import { type CurrencyCode } from "../util/currency.js";
|
|
|
3
3
|
import type { StringSchemaOptions } from "./StringSchema.js";
|
|
4
4
|
import { StringSchema } from "./StringSchema.js";
|
|
5
5
|
/** Options for a `CurrencyCodeSchema` */
|
|
6
|
-
export interface CurrencyCodeSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "
|
|
6
|
+
export interface CurrencyCodeSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "rows"> {
|
|
7
7
|
currencies?: ImmutableArray<CurrencyCode>;
|
|
8
8
|
}
|
|
9
9
|
/**
|
package/schema/EmailSchema.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { StringSchema } from "./StringSchema.js";
|
|
|
18
18
|
* - TLD is a segment of 2-63 characters, possibly in `xn--` international format.
|
|
19
19
|
*/
|
|
20
20
|
export declare class EmailSchema extends StringSchema {
|
|
21
|
-
constructor({ one, title, ...options }: Omit<StringSchemaOptions, "type" | "min" | "max" | "match" | "
|
|
21
|
+
constructor({ one, title, ...options }: Omit<StringSchemaOptions, "type" | "min" | "max" | "match" | "rows">);
|
|
22
22
|
sanitize(str: string): string;
|
|
23
23
|
}
|
|
24
24
|
/** Valid email, e.g. `test@test.com` */
|
package/schema/EmailSchema.js
CHANGED
package/schema/PhoneSchema.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StringSchemaOptions } from "./StringSchema.js";
|
|
2
2
|
import { StringSchema } from "./StringSchema.js";
|
|
3
3
|
/** Options for a `PhoneSchema` */
|
|
4
|
-
export interface PhoneSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "
|
|
4
|
+
export interface PhoneSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "rows"> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Type of `StringSchema` that defines a valid phone number.
|
package/schema/PhoneSchema.js
CHANGED
|
@@ -15,6 +15,7 @@ export class PhoneSchema extends StringSchema {
|
|
|
15
15
|
min: 1,
|
|
16
16
|
// Valid phone number is 16 digits or fewer (15 numerals with a leading `+` plus).
|
|
17
17
|
max: 16,
|
|
18
|
+
rows: 1,
|
|
18
19
|
// Valid phone number is max 16 digits made up of:
|
|
19
20
|
// - Country code (`+` plus character and 1-3 digits, e.g. `+44` or `+1`).
|
|
20
21
|
// - Subscriber number (5-12 digits — the Solomon Islands have five-digit phone numbers apparently).
|
package/schema/SlugSchema.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
|
|
|
7
7
|
* - Maximum slug length is 64 characters.
|
|
8
8
|
*/
|
|
9
9
|
export declare class SlugSchema extends StringSchema {
|
|
10
|
-
constructor(options: Omit<StringSchemaOptions, "min" | "max" | "
|
|
10
|
+
constructor(options: Omit<StringSchemaOptions, "min" | "max" | "rows">);
|
|
11
11
|
sanitize(str: string): string;
|
|
12
12
|
}
|
|
13
13
|
/** Valid slug, e.g. `this-is-a-slug` */
|
package/schema/SlugSchema.js
CHANGED
package/schema/StringSchema.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface StringSchemaOptions extends SchemaOptions {
|
|
|
7
7
|
readonly value?: string | undefined;
|
|
8
8
|
readonly min?: number | undefined;
|
|
9
9
|
readonly max?: number | undefined;
|
|
10
|
-
readonly
|
|
10
|
+
readonly rows?: number | undefined;
|
|
11
11
|
readonly match?: RegExp | undefined;
|
|
12
12
|
readonly case?: "upper" | "lower" | undefined;
|
|
13
13
|
readonly input?: StringInputType | undefined;
|
|
@@ -32,10 +32,10 @@ export declare class StringSchema extends Schema<string> {
|
|
|
32
32
|
readonly input: StringInputType;
|
|
33
33
|
readonly min: number;
|
|
34
34
|
readonly max: number;
|
|
35
|
-
readonly
|
|
35
|
+
readonly rows: number;
|
|
36
36
|
readonly match: RegExp | undefined;
|
|
37
37
|
readonly case: "upper" | "lower" | undefined;
|
|
38
|
-
constructor({ one, min, max, value,
|
|
38
|
+
constructor({ one, min, max, value, rows, match, case: _case, input, ...options }: StringSchemaOptions);
|
|
39
39
|
validate(value?: unknown): string;
|
|
40
40
|
/** Sanitize the string by removing unwanted characters. */
|
|
41
41
|
sanitize(str: string): string;
|
package/schema/StringSchema.js
CHANGED
|
@@ -20,14 +20,14 @@ export class StringSchema extends Schema {
|
|
|
20
20
|
input;
|
|
21
21
|
min;
|
|
22
22
|
max;
|
|
23
|
-
|
|
23
|
+
rows;
|
|
24
24
|
match;
|
|
25
25
|
case;
|
|
26
|
-
constructor({ one = "string", min = 0, max = Number.POSITIVE_INFINITY, value = "",
|
|
26
|
+
constructor({ one = "string", min = 0, max = Number.POSITIVE_INFINITY, value = "", rows = 1, match, case: _case, input = "text", ...options }) {
|
|
27
27
|
super({ one, value, ...options });
|
|
28
28
|
this.min = min;
|
|
29
29
|
this.max = max;
|
|
30
|
-
this.
|
|
30
|
+
this.rows = rows;
|
|
31
31
|
this.match = match;
|
|
32
32
|
this.case = _case;
|
|
33
33
|
this.input = input;
|
|
@@ -47,7 +47,7 @@ export class StringSchema extends Schema {
|
|
|
47
47
|
}
|
|
48
48
|
/** Sanitize the string by removing unwanted characters. */
|
|
49
49
|
sanitize(str) {
|
|
50
|
-
const sane = this.
|
|
50
|
+
const sane = this.rows > 1 ? sanitizeMultilineText(str) : sanitizeText(str);
|
|
51
51
|
if (this.case === "upper")
|
|
52
52
|
return sane.toUpperCase();
|
|
53
53
|
if (this.case === "lower")
|
package/schema/URISchema.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type URISchemes, type URIString } from "../util/uri.js";
|
|
|
2
2
|
import type { StringSchemaOptions } from "./StringSchema.js";
|
|
3
3
|
import { StringSchema } from "./StringSchema.js";
|
|
4
4
|
/** Allowed options for `URISchema` */
|
|
5
|
-
export interface URISchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "
|
|
5
|
+
export interface URISchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "rows"> {
|
|
6
6
|
readonly schemes?: URISchemes | undefined;
|
|
7
7
|
}
|
|
8
8
|
/**
|
package/schema/URISchema.js
CHANGED
package/schema/URLSchema.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type URLString } from "../util/url.js";
|
|
|
3
3
|
import type { StringSchemaOptions } from "./StringSchema.js";
|
|
4
4
|
import { StringSchema } from "./StringSchema.js";
|
|
5
5
|
/** Allowed options for `URLSchema` */
|
|
6
|
-
export interface URLSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "
|
|
6
|
+
export interface URLSchemaOptions extends Omit<StringSchemaOptions, "input" | "min" | "max" | "rows"> {
|
|
7
7
|
readonly base?: URL | URLString | undefined;
|
|
8
8
|
readonly schemes?: URISchemes | undefined;
|
|
9
9
|
}
|
package/schema/URLSchema.js
CHANGED
package/schema/UUIDSchema.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
|
|
|
5
5
|
* - Falsy values are converted to empty string.
|
|
6
6
|
*/
|
|
7
7
|
export declare class UUIDSchema extends StringSchema {
|
|
8
|
-
constructor({ one, title, ...rest }?: Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "
|
|
8
|
+
constructor({ one, title, ...rest }?: Omit<StringSchemaOptions, "input" | "min" | "max" | "match" | "rows">);
|
|
9
9
|
sanitize(str: string): string;
|
|
10
10
|
}
|
|
11
11
|
/** Any valid UUID (versions 1-5) */
|