UNPKG

1.51 kBTypeScriptView Raw
1import type { Arbitrary } from '../check/arbitrary/definition/Arbitrary.js';
2import type { WebAuthorityConstraints } from './webAuthority.js';
3import type { SizeForArbitrary } from './_internals/helpers/MaxLengthFromMinLength.js';
4/**
5 * Constraints to be applied on {@link webUrl}
6 * @remarks Since 1.14.0
7 * @public
8 */
9export interface WebUrlConstraints {
10 /**
11 * Enforce specific schemes, eg.: http, https
12 * @defaultValue ['http', 'https']
13 * @remarks Since 1.14.0
14 */
15 validSchemes?: string[];
16 /**
17 * Settings for {@link webAuthority}
18 * @defaultValue {}
19 * @remarks Since 1.14.0
20 */
21 authoritySettings?: WebAuthorityConstraints;
22 /**
23 * Enable query parameters in the generated url
24 * @defaultValue false
25 * @remarks Since 1.14.0
26 */
27 withQueryParameters?: boolean;
28 /**
29 * Enable fragments in the generated url
30 * @defaultValue false
31 * @remarks Since 1.14.0
32 */
33 withFragments?: boolean;
34 /**
35 * Define how large the generated values should be (at max)
36 * @remarks Since 2.22.0
37 */
38 size?: Exclude<SizeForArbitrary, 'max'>;
39}
40/**
41 * For web url
42 *
43 * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986} and
44 * {@link https://url.spec.whatwg.org/ | WHATWG URL Standard}
45 *
46 * @param constraints - Constraints to apply when building instances
47 *
48 * @remarks Since 1.14.0
49 * @public
50 */
51export declare function webUrl(constraints?: WebUrlConstraints): Arbitrary<string>;