@joeygrable94/utm-src-pub-validators 0.0.6 → 0.0.7
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.cts +140 -0
- package/dist/index.d.ts +140 -0
- package/package.json +10 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
declare const LIMIT_MIN_LABEL = 1;
|
|
4
|
+
declare const LIMIT_MAX_LABEL = 255;
|
|
5
|
+
declare const LIMIT_MIN_VALUE = 1;
|
|
6
|
+
declare const LIMIT_MAX_VALUE = 255;
|
|
7
|
+
declare const LIMIT_MAX_DESCRIPTION = 1024;
|
|
8
|
+
declare const LIMIT_MIN_USERNAME = 3;
|
|
9
|
+
declare const LIMIT_MAX_USERNAME = 255;
|
|
10
|
+
declare const LIMIT_MIN_EMAIL = 5;
|
|
11
|
+
declare const LIMIT_MAX_EMAIL = 255;
|
|
12
|
+
declare const LIMIT_MIN_PASSWORD = 8;
|
|
13
|
+
declare const LIMIT_MAX_PASSWORD = 255;
|
|
14
|
+
declare const LIMIT_MAX_PROVIDER = 255;
|
|
15
|
+
declare const LIMIT_MIN_NAME = 2;
|
|
16
|
+
declare const LIMIT_MAX_NAME = 255;
|
|
17
|
+
declare const LIMIT_MIN_PRODUCT_ID = 2;
|
|
18
|
+
declare const LIMIT_MAX_PRODUCT_ID = 64;
|
|
19
|
+
declare const LIMIT_MIN_PRICE_ID = 2;
|
|
20
|
+
declare const LIMIT_MAX_PRICE_ID = 64;
|
|
21
|
+
declare const LIMIT_MIN_UNIT_AMOUNT = 0;
|
|
22
|
+
declare const LIMIT_MIN_UNIT_TERM_IN_MONTHS = 1;
|
|
23
|
+
declare const LIMIT_MAX_UNIT_TERM_IN_MONTHS = 12;
|
|
24
|
+
declare const LIMIT_MIN_DESTINATION = 10;
|
|
25
|
+
declare const LIMIT_MAX_DESTINATION = 2048;
|
|
26
|
+
declare const LIMIT_MIN_DOMAIN = 10;
|
|
27
|
+
declare const LIMIT_MAX_DOMAIN = 253;
|
|
28
|
+
declare const LIMIT_MIN_PATH = 1;
|
|
29
|
+
declare const LIMIT_MAX_PATH = 2038;
|
|
30
|
+
declare const LIMIT_MIN_QUERY = 1;
|
|
31
|
+
declare const LIMIT_MAX_QUERY = 2038;
|
|
32
|
+
declare const LIMIT_MIN_FRAGMENT = 1;
|
|
33
|
+
declare const LIMIT_MAX_FRAGMENT = 2038;
|
|
34
|
+
declare const LIMIT_MIN_UTM_SOURCE = 1;
|
|
35
|
+
declare const LIMIT_MAX_UTM_SOURCE = 2026;
|
|
36
|
+
declare const LIMIT_MIN_UTM_MEDIUM = 1;
|
|
37
|
+
declare const LIMIT_MAX_UTM_MEDIUM = 2026;
|
|
38
|
+
declare const LIMIT_MIN_UTM_CAMPAIGN = 1;
|
|
39
|
+
declare const LIMIT_MAX_UTM_CAMPAIGN = 2024;
|
|
40
|
+
declare const LIMIT_MIN_UTM_CREATIVE_FORMAT = 1;
|
|
41
|
+
declare const LIMIT_MAX_UTM_CREATIVE_FORMAT = 2017;
|
|
42
|
+
declare const LIMIT_MIN_UTM_CONTENT = 1;
|
|
43
|
+
declare const LIMIT_MAX_UTM_CONTENT = 2025;
|
|
44
|
+
declare const LIMIT_MIN_UTM_TERM = 1;
|
|
45
|
+
declare const LIMIT_MAX_UTM_TERM = 2028;
|
|
46
|
+
declare const LIMIT_MIN_UTM_ID = 1;
|
|
47
|
+
declare const LIMIT_MAX_UTM_ID = 2030;
|
|
48
|
+
|
|
49
|
+
declare const REGEX_VALUE: RegExp;
|
|
50
|
+
declare const ERROR_MESSAGE_REGEX_VALUE = "can only contain letters, numbers, and the special characters: - _ .";
|
|
51
|
+
declare const REGEX_DOMAIN: RegExp;
|
|
52
|
+
declare const ERROR_MESSAGE_REGEX_DOMAIN = "please provide a valid domain name";
|
|
53
|
+
|
|
54
|
+
type ValidateAndCleanSuccess<T> = {
|
|
55
|
+
data: Partial<T>;
|
|
56
|
+
error: null;
|
|
57
|
+
errors: null;
|
|
58
|
+
};
|
|
59
|
+
type ValidateAndCleanFailure = {
|
|
60
|
+
data: null;
|
|
61
|
+
error: string | null;
|
|
62
|
+
errors: Record<string, string> | null;
|
|
63
|
+
};
|
|
64
|
+
type ValidateAndCleanResult<T> = ValidateAndCleanSuccess<T> | ValidateAndCleanFailure;
|
|
65
|
+
declare function validateAndClean<T>(schema: v.BaseSchema<T, Partial<T>, v.BaseIssue<T>>, input: unknown): ValidateAndCleanResult<T>;
|
|
66
|
+
declare function isValidationSuccess<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanSuccess<T>;
|
|
67
|
+
declare function isValidationFailure<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanFailure;
|
|
68
|
+
|
|
69
|
+
declare const IsValidReferenceId: v.ObjectSchema<{
|
|
70
|
+
readonly id: v.NumberSchema<"please provide a valid id number">;
|
|
71
|
+
}, undefined>;
|
|
72
|
+
declare const IsValidCost: v.SchemaWithPipe<readonly [v.NumberSchema<"please enter a cost value">, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, "your campaign cost exceeds our $1 million dollar limit, please contact us for enterprise solutions">]>;
|
|
73
|
+
declare const IsValidOrUndefinedCost: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please enter a cost value">, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, "your campaign cost exceeds our $1 million dollar limit, please contact us for enterprise solutions">]>, undefined>;
|
|
74
|
+
declare const IsValidLabel: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a label">, v.TrimAction, v.MinLengthAction<string, 1, "the label is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the label is too long, it must be 255 characters or less">]>;
|
|
75
|
+
declare const IsValidOrUndefinedLabel: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a label">, v.TrimAction, v.MinLengthAction<string, 1, "the label is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the label is too long, it must be 255 characters or less">]>, undefined>;
|
|
76
|
+
declare const IsValidValue: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a value">, v.TrimAction, v.MinLengthAction<string, 1, "the value is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the value is too long, it must be 255 characters or less">, v.RegexAction<string, "the value can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
77
|
+
declare const IsValidOrUndefinedValue: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a value">, v.TrimAction, v.MinLengthAction<string, 1, "the value is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the value is too long, it must be 255 characters or less">, v.RegexAction<string, "the value can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
78
|
+
declare const IsValidDescription: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"the description must be a string">, v.TrimAction, v.MaxLengthAction<string, 1024, "the description is too long, it must be 1024 characters or less">]>, undefined>;
|
|
79
|
+
declare const IsValidOrUndefinedDescription: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"the description must be a string">, v.TrimAction, v.MaxLengthAction<string, 1024, "the description is too long, it must be 1024 characters or less">]>, undefined>, undefined>;
|
|
80
|
+
declare const IsValidIsActive: v.BooleanSchema<"isActive must be a boolean">;
|
|
81
|
+
declare const IsValidOrUndefinedIsActive: v.UndefinedableSchema<v.BooleanSchema<"isActive must be a boolean">, undefined>;
|
|
82
|
+
declare const IsValidName: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a name">, v.TrimAction, v.MinLengthAction<string, 2, "the name is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 255, "the name is too long, it must be 255 characters or less">]>;
|
|
83
|
+
declare const IsValidOrUndefinedName: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a name">, v.TrimAction, v.MinLengthAction<string, 2, "the name is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 255, "the name is too long, it must be 255 characters or less">]>, undefined>;
|
|
84
|
+
|
|
85
|
+
declare const IsValidApplyValueTo: v.PicklistSchema<["source", "medium", "campaign", "content", "creative", "term", "id"], undefined>;
|
|
86
|
+
declare const IsValidOrUndefinedApplyValueTo: v.NullableSchema<v.PicklistSchema<["source", "medium", "campaign", "content", "creative", "term", "id"], undefined>, undefined>;
|
|
87
|
+
declare const IsValidApplyValueAs: v.PicklistSchema<["prefix", "suffix"], undefined>;
|
|
88
|
+
declare const IsValidOrUndefinedApplyValueAs: v.NullableSchema<v.PicklistSchema<["prefix", "suffix"], undefined>, undefined>;
|
|
89
|
+
|
|
90
|
+
declare const IsValidProductId: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a product_id">, v.TrimAction, v.MinLengthAction<string, 2, "the product_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the product_id is too long, it must be 64 characters or less">]>;
|
|
91
|
+
declare const IsValidOrUndefinedProductId: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a product_id">, v.TrimAction, v.MinLengthAction<string, 2, "the product_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the product_id is too long, it must be 64 characters or less">]>, undefined>;
|
|
92
|
+
declare const IsValidPriceId: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a price_id">, v.TrimAction, v.MinLengthAction<string, 2, "the price_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the price_id is too long, it must be 64 characters or less">]>;
|
|
93
|
+
declare const IsValidOrUndefinedPriceId: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a price_id">, v.TrimAction, v.MinLengthAction<string, 2, "the price_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the price_id is too long, it must be 64 characters or less">]>, undefined>;
|
|
94
|
+
declare const IsValidUnitAmount: v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_amount">, v.MinValueAction<number, 0, "the unit_amount must be a decimal greater than or equal to 0">]>;
|
|
95
|
+
declare const IsValidOrUndefinedUnitAmount: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_amount">, v.MinValueAction<number, 0, "the unit_amount must be a decimal greater than or equal to 0">]>, undefined>;
|
|
96
|
+
declare const IsValidUnitTermInMonths: v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_term_in_months">, v.MinValueAction<number, 1, "the unit_term_in_months must be an integer greater than or equal to 1">, v.MaxValueAction<number, 12, "the unit_term_in_months must be an integer less than or equal to 12">]>;
|
|
97
|
+
declare const IsValidOrUndefinedUnitTermInMonths: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_term_in_months">, v.MinValueAction<number, 1, "the unit_term_in_months must be an integer greater than or equal to 1">, v.MaxValueAction<number, 12, "the unit_term_in_months must be an integer less than or equal to 12">]>, undefined>;
|
|
98
|
+
|
|
99
|
+
declare const IsValidUrlDestination: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url destination">, v.TrimAction, v.MinLengthAction<string, 10, "the url destination is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 2048, "the url destination is too long, it must be 2048 characters or less">, v.UrlAction<string, "please provide a valid url">]>;
|
|
100
|
+
declare const IsValidOrUndefinedUrlDestination: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url destination">, v.TrimAction, v.MinLengthAction<string, 10, "the url destination is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 2048, "the url destination is too long, it must be 2048 characters or less">, v.UrlAction<string, "please provide a valid url">]>, undefined>;
|
|
101
|
+
declare const IsValidUrlProtocol: v.PicklistSchema<["http", "https"], "please provide a valid url protocol">;
|
|
102
|
+
declare const IsValidOrUndefinedUrlProtocol: v.NullableSchema<v.PicklistSchema<["http", "https"], "please provide a valid url protocol">, undefined>;
|
|
103
|
+
declare const IsValidUrlDomain: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a domain">, v.TrimAction, v.MinLengthAction<string, 10, "the domain is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 253, "the domain is too long, it must be 253 characters or less">, v.RegexAction<string, "please provide a valid domain name">]>;
|
|
104
|
+
declare const IsValidOrUndefinedUrlDomain: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a domain">, v.TrimAction, v.MinLengthAction<string, 10, "the domain is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 253, "the domain is too long, it must be 253 characters or less">, v.RegexAction<string, "please provide a valid domain name">]>, undefined>;
|
|
105
|
+
declare const IsValidUrlPath: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url path">, v.TrimAction, v.MinLengthAction<string, 1, "the url path is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url path is too long, it must be 2038 characters or less">]>;
|
|
106
|
+
declare const IsValidOrUndefinedUrlPath: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url path">, v.TrimAction, v.MinLengthAction<string, 1, "the url path is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url path is too long, it must be 2038 characters or less">]>, undefined>;
|
|
107
|
+
declare const IsValidUrlQuery: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url query">, v.TrimAction, v.MinLengthAction<string, 1, "the url query is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url query is too long, it must be 2038 characters or less">]>;
|
|
108
|
+
declare const IsValidOrUndefinedUrlQuery: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url query">, v.TrimAction, v.MinLengthAction<string, 1, "the url query is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url query is too long, it must be 2038 characters or less">]>, undefined>;
|
|
109
|
+
declare const IsValidUrlFragment: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url hash/fragment">, v.TrimAction, v.MinLengthAction<string, 1, "the url hash/fragment is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url hash/fragment is too long, it must be 2038 characters or less">]>;
|
|
110
|
+
declare const IsValidOrUndefinedUrlFragment: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url hash/fragment">, v.TrimAction, v.MinLengthAction<string, 1, "the url hash/fragment is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url hash/fragment is too long, it must be 2038 characters or less">]>, undefined>;
|
|
111
|
+
|
|
112
|
+
declare const IsValidUsername: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a username">, v.TrimAction, v.MinLengthAction<string, 3, "your username is too short, it must be at least 3 characters">, v.MaxLengthAction<string, 255, "your username is too long, it must be 255 characters or less">, v.RegexAction<string, "your username can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
113
|
+
declare const IsValidOrUndefinedUsername: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a username">, v.TrimAction, v.MinLengthAction<string, 3, "your username is too short, it must be at least 3 characters">, v.MaxLengthAction<string, 255, "your username is too long, it must be 255 characters or less">, v.RegexAction<string, "your username can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
114
|
+
declare const IsValidEmail: v.SchemaWithPipe<readonly [v.StringSchema<"please provide an email">, v.TrimAction, v.MinLengthAction<string, 5, "your email is too short, it must be at least 5 characters">, v.MaxLengthAction<string, 255, "your email is too long, it must be 255 characters or less">, v.EmailAction<string, "please provide a valid email address">]>;
|
|
115
|
+
declare const IsValidOrUndefinedEmail: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide an email">, v.TrimAction, v.MinLengthAction<string, 5, "your email is too short, it must be at least 5 characters">, v.MaxLengthAction<string, 255, "your email is too long, it must be 255 characters or less">, v.EmailAction<string, "please provide a valid email address">]>, undefined>;
|
|
116
|
+
declare const IsValidPassword: v.SchemaWithPipe<readonly [v.StringSchema<"a password is required">, v.TrimAction, v.MinLengthAction<string, 8, "your password is too short, it must be at least 8 characters">, v.MaxLengthAction<string, 255, "your password is too long, it must be 255 characters or less">]>;
|
|
117
|
+
declare const IsValidOrUndefinedPassword: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"a password is required">, v.TrimAction, v.MinLengthAction<string, 8, "your password is too short, it must be at least 8 characters">, v.MaxLengthAction<string, 255, "your password is too long, it must be 255 characters or less">]>, undefined>;
|
|
118
|
+
declare const IsValidProvider: v.SchemaWithPipe<readonly [v.StringSchema<"please enter a provider">, v.TrimAction, v.MaxLengthAction<string, 255, "the provider string is too long, it must be 255 characters or less">]>;
|
|
119
|
+
declare const IsValidOrUndefinedProvider: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please enter a provider">, v.TrimAction, v.MaxLengthAction<string, 255, "the provider string is too long, it must be 255 characters or less">]>, undefined>;
|
|
120
|
+
declare const IsValidConfirmed: v.BooleanSchema<undefined>;
|
|
121
|
+
declare const IsValidOrUndefinedConfirmed: v.UndefinedableSchema<v.BooleanSchema<undefined>, undefined>;
|
|
122
|
+
declare const IsValidBlocked: v.BooleanSchema<undefined>;
|
|
123
|
+
declare const IsValidOrUndefinedBlocked: v.UndefinedableSchema<v.BooleanSchema<undefined>, undefined>;
|
|
124
|
+
|
|
125
|
+
declare const IsValidUrlUtmSource: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_source is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_source is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_source can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
126
|
+
declare const IsValidOrUndefinedUrlUtmSource: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_source is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_source is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_source can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
127
|
+
declare const IsValidUrlUtmMedium: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_medium is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_medium is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_medium can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
128
|
+
declare const IsValidOrUndefinedUrlUtmMedium: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_medium is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_medium is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_medium can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
129
|
+
declare const IsValidUrlUtmCampaign: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_campaign is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2024, "the utm_campaign is too long, it must be 2024 characters or less">, v.RegexAction<string, "utm_campaign can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
130
|
+
declare const IsValidOrUndefinedUrlUtmCampaign: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_campaign is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2024, "the utm_campaign is too long, it must be 2024 characters or less">, v.RegexAction<string, "utm_campaign can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
131
|
+
declare const IsValidUrlUtmCreativeFormat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_creative_format is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2017, "the utm_creative_format is too long, it must be 2017 characters or less">, v.RegexAction<string, "utm_creative_format can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
132
|
+
declare const IsValidOrUndefinedUrlUtmCreativeFormat: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_creative_format is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2017, "the utm_creative_format is too long, it must be 2017 characters or less">, v.RegexAction<string, "utm_creative_format can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
133
|
+
declare const IsValidUrlUtmContent: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_content is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2025, "the utm_content is too long, it must be 2025 characters or less">, v.RegexAction<string, "utm_content can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
134
|
+
declare const IsValidOrUndefinedUrlUtmContent: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_content is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2025, "the utm_content is too long, it must be 2025 characters or less">, v.RegexAction<string, "utm_content can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
135
|
+
declare const IsValidUrlUtmTerm: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_term is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2028, "the utm_term is too long, it must be 2028 characters or less">, v.RegexAction<string, "utm_term can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
136
|
+
declare const IsValidOrUndefinedUrlUtmTerm: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_term is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2028, "the utm_term is too long, it must be 2028 characters or less">, v.RegexAction<string, "utm_term can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
137
|
+
declare const IsValidUrlUtmId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_id is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2030, "the utm_id is too long, it must be 2030 characters or less">, v.RegexAction<string, "utm_id can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
138
|
+
declare const IsValidOrUndefinedUrlUtmId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_id is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2030, "the utm_id is too long, it must be 2030 characters or less">, v.RegexAction<string, "utm_id can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
139
|
+
|
|
140
|
+
export { ERROR_MESSAGE_REGEX_DOMAIN, ERROR_MESSAGE_REGEX_VALUE, IsValidApplyValueAs, IsValidApplyValueTo, IsValidBlocked, IsValidConfirmed, IsValidCost, IsValidDescription, IsValidEmail, IsValidIsActive, IsValidLabel, IsValidName, IsValidOrUndefinedApplyValueAs, IsValidOrUndefinedApplyValueTo, IsValidOrUndefinedBlocked, IsValidOrUndefinedConfirmed, IsValidOrUndefinedCost, IsValidOrUndefinedDescription, IsValidOrUndefinedEmail, IsValidOrUndefinedIsActive, IsValidOrUndefinedLabel, IsValidOrUndefinedName, IsValidOrUndefinedPassword, IsValidOrUndefinedPriceId, IsValidOrUndefinedProductId, IsValidOrUndefinedProvider, IsValidOrUndefinedUnitAmount, IsValidOrUndefinedUnitTermInMonths, IsValidOrUndefinedUrlDestination, IsValidOrUndefinedUrlDomain, IsValidOrUndefinedUrlFragment, IsValidOrUndefinedUrlPath, IsValidOrUndefinedUrlProtocol, IsValidOrUndefinedUrlQuery, IsValidOrUndefinedUrlUtmCampaign, IsValidOrUndefinedUrlUtmContent, IsValidOrUndefinedUrlUtmCreativeFormat, IsValidOrUndefinedUrlUtmId, IsValidOrUndefinedUrlUtmMedium, IsValidOrUndefinedUrlUtmSource, IsValidOrUndefinedUrlUtmTerm, IsValidOrUndefinedUsername, IsValidOrUndefinedValue, IsValidPassword, IsValidPriceId, IsValidProductId, IsValidProvider, IsValidReferenceId, IsValidUnitAmount, IsValidUnitTermInMonths, IsValidUrlDestination, IsValidUrlDomain, IsValidUrlFragment, IsValidUrlPath, IsValidUrlProtocol, IsValidUrlQuery, IsValidUrlUtmCampaign, IsValidUrlUtmContent, IsValidUrlUtmCreativeFormat, IsValidUrlUtmId, IsValidUrlUtmMedium, IsValidUrlUtmSource, IsValidUrlUtmTerm, IsValidUsername, IsValidValue, LIMIT_MAX_DESCRIPTION, LIMIT_MAX_DESTINATION, LIMIT_MAX_DOMAIN, LIMIT_MAX_EMAIL, LIMIT_MAX_FRAGMENT, LIMIT_MAX_LABEL, LIMIT_MAX_NAME, LIMIT_MAX_PASSWORD, LIMIT_MAX_PATH, LIMIT_MAX_PRICE_ID, LIMIT_MAX_PRODUCT_ID, LIMIT_MAX_PROVIDER, LIMIT_MAX_QUERY, LIMIT_MAX_UNIT_TERM_IN_MONTHS, LIMIT_MAX_USERNAME, LIMIT_MAX_UTM_CAMPAIGN, LIMIT_MAX_UTM_CONTENT, LIMIT_MAX_UTM_CREATIVE_FORMAT, LIMIT_MAX_UTM_ID, LIMIT_MAX_UTM_MEDIUM, LIMIT_MAX_UTM_SOURCE, LIMIT_MAX_UTM_TERM, LIMIT_MAX_VALUE, LIMIT_MIN_DESTINATION, LIMIT_MIN_DOMAIN, LIMIT_MIN_EMAIL, LIMIT_MIN_FRAGMENT, LIMIT_MIN_LABEL, LIMIT_MIN_NAME, LIMIT_MIN_PASSWORD, LIMIT_MIN_PATH, LIMIT_MIN_PRICE_ID, LIMIT_MIN_PRODUCT_ID, LIMIT_MIN_QUERY, LIMIT_MIN_UNIT_AMOUNT, LIMIT_MIN_UNIT_TERM_IN_MONTHS, LIMIT_MIN_USERNAME, LIMIT_MIN_UTM_CAMPAIGN, LIMIT_MIN_UTM_CONTENT, LIMIT_MIN_UTM_CREATIVE_FORMAT, LIMIT_MIN_UTM_ID, LIMIT_MIN_UTM_MEDIUM, LIMIT_MIN_UTM_SOURCE, LIMIT_MIN_UTM_TERM, LIMIT_MIN_VALUE, REGEX_DOMAIN, REGEX_VALUE, isValidationFailure, isValidationSuccess, validateAndClean };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
declare const LIMIT_MIN_LABEL = 1;
|
|
4
|
+
declare const LIMIT_MAX_LABEL = 255;
|
|
5
|
+
declare const LIMIT_MIN_VALUE = 1;
|
|
6
|
+
declare const LIMIT_MAX_VALUE = 255;
|
|
7
|
+
declare const LIMIT_MAX_DESCRIPTION = 1024;
|
|
8
|
+
declare const LIMIT_MIN_USERNAME = 3;
|
|
9
|
+
declare const LIMIT_MAX_USERNAME = 255;
|
|
10
|
+
declare const LIMIT_MIN_EMAIL = 5;
|
|
11
|
+
declare const LIMIT_MAX_EMAIL = 255;
|
|
12
|
+
declare const LIMIT_MIN_PASSWORD = 8;
|
|
13
|
+
declare const LIMIT_MAX_PASSWORD = 255;
|
|
14
|
+
declare const LIMIT_MAX_PROVIDER = 255;
|
|
15
|
+
declare const LIMIT_MIN_NAME = 2;
|
|
16
|
+
declare const LIMIT_MAX_NAME = 255;
|
|
17
|
+
declare const LIMIT_MIN_PRODUCT_ID = 2;
|
|
18
|
+
declare const LIMIT_MAX_PRODUCT_ID = 64;
|
|
19
|
+
declare const LIMIT_MIN_PRICE_ID = 2;
|
|
20
|
+
declare const LIMIT_MAX_PRICE_ID = 64;
|
|
21
|
+
declare const LIMIT_MIN_UNIT_AMOUNT = 0;
|
|
22
|
+
declare const LIMIT_MIN_UNIT_TERM_IN_MONTHS = 1;
|
|
23
|
+
declare const LIMIT_MAX_UNIT_TERM_IN_MONTHS = 12;
|
|
24
|
+
declare const LIMIT_MIN_DESTINATION = 10;
|
|
25
|
+
declare const LIMIT_MAX_DESTINATION = 2048;
|
|
26
|
+
declare const LIMIT_MIN_DOMAIN = 10;
|
|
27
|
+
declare const LIMIT_MAX_DOMAIN = 253;
|
|
28
|
+
declare const LIMIT_MIN_PATH = 1;
|
|
29
|
+
declare const LIMIT_MAX_PATH = 2038;
|
|
30
|
+
declare const LIMIT_MIN_QUERY = 1;
|
|
31
|
+
declare const LIMIT_MAX_QUERY = 2038;
|
|
32
|
+
declare const LIMIT_MIN_FRAGMENT = 1;
|
|
33
|
+
declare const LIMIT_MAX_FRAGMENT = 2038;
|
|
34
|
+
declare const LIMIT_MIN_UTM_SOURCE = 1;
|
|
35
|
+
declare const LIMIT_MAX_UTM_SOURCE = 2026;
|
|
36
|
+
declare const LIMIT_MIN_UTM_MEDIUM = 1;
|
|
37
|
+
declare const LIMIT_MAX_UTM_MEDIUM = 2026;
|
|
38
|
+
declare const LIMIT_MIN_UTM_CAMPAIGN = 1;
|
|
39
|
+
declare const LIMIT_MAX_UTM_CAMPAIGN = 2024;
|
|
40
|
+
declare const LIMIT_MIN_UTM_CREATIVE_FORMAT = 1;
|
|
41
|
+
declare const LIMIT_MAX_UTM_CREATIVE_FORMAT = 2017;
|
|
42
|
+
declare const LIMIT_MIN_UTM_CONTENT = 1;
|
|
43
|
+
declare const LIMIT_MAX_UTM_CONTENT = 2025;
|
|
44
|
+
declare const LIMIT_MIN_UTM_TERM = 1;
|
|
45
|
+
declare const LIMIT_MAX_UTM_TERM = 2028;
|
|
46
|
+
declare const LIMIT_MIN_UTM_ID = 1;
|
|
47
|
+
declare const LIMIT_MAX_UTM_ID = 2030;
|
|
48
|
+
|
|
49
|
+
declare const REGEX_VALUE: RegExp;
|
|
50
|
+
declare const ERROR_MESSAGE_REGEX_VALUE = "can only contain letters, numbers, and the special characters: - _ .";
|
|
51
|
+
declare const REGEX_DOMAIN: RegExp;
|
|
52
|
+
declare const ERROR_MESSAGE_REGEX_DOMAIN = "please provide a valid domain name";
|
|
53
|
+
|
|
54
|
+
type ValidateAndCleanSuccess<T> = {
|
|
55
|
+
data: Partial<T>;
|
|
56
|
+
error: null;
|
|
57
|
+
errors: null;
|
|
58
|
+
};
|
|
59
|
+
type ValidateAndCleanFailure = {
|
|
60
|
+
data: null;
|
|
61
|
+
error: string | null;
|
|
62
|
+
errors: Record<string, string> | null;
|
|
63
|
+
};
|
|
64
|
+
type ValidateAndCleanResult<T> = ValidateAndCleanSuccess<T> | ValidateAndCleanFailure;
|
|
65
|
+
declare function validateAndClean<T>(schema: v.BaseSchema<T, Partial<T>, v.BaseIssue<T>>, input: unknown): ValidateAndCleanResult<T>;
|
|
66
|
+
declare function isValidationSuccess<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanSuccess<T>;
|
|
67
|
+
declare function isValidationFailure<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanFailure;
|
|
68
|
+
|
|
69
|
+
declare const IsValidReferenceId: v.ObjectSchema<{
|
|
70
|
+
readonly id: v.NumberSchema<"please provide a valid id number">;
|
|
71
|
+
}, undefined>;
|
|
72
|
+
declare const IsValidCost: v.SchemaWithPipe<readonly [v.NumberSchema<"please enter a cost value">, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, "your campaign cost exceeds our $1 million dollar limit, please contact us for enterprise solutions">]>;
|
|
73
|
+
declare const IsValidOrUndefinedCost: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please enter a cost value">, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, "your campaign cost exceeds our $1 million dollar limit, please contact us for enterprise solutions">]>, undefined>;
|
|
74
|
+
declare const IsValidLabel: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a label">, v.TrimAction, v.MinLengthAction<string, 1, "the label is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the label is too long, it must be 255 characters or less">]>;
|
|
75
|
+
declare const IsValidOrUndefinedLabel: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a label">, v.TrimAction, v.MinLengthAction<string, 1, "the label is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the label is too long, it must be 255 characters or less">]>, undefined>;
|
|
76
|
+
declare const IsValidValue: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a value">, v.TrimAction, v.MinLengthAction<string, 1, "the value is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the value is too long, it must be 255 characters or less">, v.RegexAction<string, "the value can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
77
|
+
declare const IsValidOrUndefinedValue: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a value">, v.TrimAction, v.MinLengthAction<string, 1, "the value is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 255, "the value is too long, it must be 255 characters or less">, v.RegexAction<string, "the value can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
78
|
+
declare const IsValidDescription: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"the description must be a string">, v.TrimAction, v.MaxLengthAction<string, 1024, "the description is too long, it must be 1024 characters or less">]>, undefined>;
|
|
79
|
+
declare const IsValidOrUndefinedDescription: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"the description must be a string">, v.TrimAction, v.MaxLengthAction<string, 1024, "the description is too long, it must be 1024 characters or less">]>, undefined>, undefined>;
|
|
80
|
+
declare const IsValidIsActive: v.BooleanSchema<"isActive must be a boolean">;
|
|
81
|
+
declare const IsValidOrUndefinedIsActive: v.UndefinedableSchema<v.BooleanSchema<"isActive must be a boolean">, undefined>;
|
|
82
|
+
declare const IsValidName: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a name">, v.TrimAction, v.MinLengthAction<string, 2, "the name is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 255, "the name is too long, it must be 255 characters or less">]>;
|
|
83
|
+
declare const IsValidOrUndefinedName: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a name">, v.TrimAction, v.MinLengthAction<string, 2, "the name is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 255, "the name is too long, it must be 255 characters or less">]>, undefined>;
|
|
84
|
+
|
|
85
|
+
declare const IsValidApplyValueTo: v.PicklistSchema<["source", "medium", "campaign", "content", "creative", "term", "id"], undefined>;
|
|
86
|
+
declare const IsValidOrUndefinedApplyValueTo: v.NullableSchema<v.PicklistSchema<["source", "medium", "campaign", "content", "creative", "term", "id"], undefined>, undefined>;
|
|
87
|
+
declare const IsValidApplyValueAs: v.PicklistSchema<["prefix", "suffix"], undefined>;
|
|
88
|
+
declare const IsValidOrUndefinedApplyValueAs: v.NullableSchema<v.PicklistSchema<["prefix", "suffix"], undefined>, undefined>;
|
|
89
|
+
|
|
90
|
+
declare const IsValidProductId: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a product_id">, v.TrimAction, v.MinLengthAction<string, 2, "the product_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the product_id is too long, it must be 64 characters or less">]>;
|
|
91
|
+
declare const IsValidOrUndefinedProductId: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a product_id">, v.TrimAction, v.MinLengthAction<string, 2, "the product_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the product_id is too long, it must be 64 characters or less">]>, undefined>;
|
|
92
|
+
declare const IsValidPriceId: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a price_id">, v.TrimAction, v.MinLengthAction<string, 2, "the price_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the price_id is too long, it must be 64 characters or less">]>;
|
|
93
|
+
declare const IsValidOrUndefinedPriceId: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a price_id">, v.TrimAction, v.MinLengthAction<string, 2, "the price_id is too short, it must be at least 2 characters">, v.MaxLengthAction<string, 64, "the price_id is too long, it must be 64 characters or less">]>, undefined>;
|
|
94
|
+
declare const IsValidUnitAmount: v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_amount">, v.MinValueAction<number, 0, "the unit_amount must be a decimal greater than or equal to 0">]>;
|
|
95
|
+
declare const IsValidOrUndefinedUnitAmount: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_amount">, v.MinValueAction<number, 0, "the unit_amount must be a decimal greater than or equal to 0">]>, undefined>;
|
|
96
|
+
declare const IsValidUnitTermInMonths: v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_term_in_months">, v.MinValueAction<number, 1, "the unit_term_in_months must be an integer greater than or equal to 1">, v.MaxValueAction<number, 12, "the unit_term_in_months must be an integer less than or equal to 12">]>;
|
|
97
|
+
declare const IsValidOrUndefinedUnitTermInMonths: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<"please provide a unit_term_in_months">, v.MinValueAction<number, 1, "the unit_term_in_months must be an integer greater than or equal to 1">, v.MaxValueAction<number, 12, "the unit_term_in_months must be an integer less than or equal to 12">]>, undefined>;
|
|
98
|
+
|
|
99
|
+
declare const IsValidUrlDestination: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url destination">, v.TrimAction, v.MinLengthAction<string, 10, "the url destination is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 2048, "the url destination is too long, it must be 2048 characters or less">, v.UrlAction<string, "please provide a valid url">]>;
|
|
100
|
+
declare const IsValidOrUndefinedUrlDestination: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url destination">, v.TrimAction, v.MinLengthAction<string, 10, "the url destination is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 2048, "the url destination is too long, it must be 2048 characters or less">, v.UrlAction<string, "please provide a valid url">]>, undefined>;
|
|
101
|
+
declare const IsValidUrlProtocol: v.PicklistSchema<["http", "https"], "please provide a valid url protocol">;
|
|
102
|
+
declare const IsValidOrUndefinedUrlProtocol: v.NullableSchema<v.PicklistSchema<["http", "https"], "please provide a valid url protocol">, undefined>;
|
|
103
|
+
declare const IsValidUrlDomain: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a domain">, v.TrimAction, v.MinLengthAction<string, 10, "the domain is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 253, "the domain is too long, it must be 253 characters or less">, v.RegexAction<string, "please provide a valid domain name">]>;
|
|
104
|
+
declare const IsValidOrUndefinedUrlDomain: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a domain">, v.TrimAction, v.MinLengthAction<string, 10, "the domain is too short, it must be at least 10 characters">, v.MaxLengthAction<string, 253, "the domain is too long, it must be 253 characters or less">, v.RegexAction<string, "please provide a valid domain name">]>, undefined>;
|
|
105
|
+
declare const IsValidUrlPath: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url path">, v.TrimAction, v.MinLengthAction<string, 1, "the url path is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url path is too long, it must be 2038 characters or less">]>;
|
|
106
|
+
declare const IsValidOrUndefinedUrlPath: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url path">, v.TrimAction, v.MinLengthAction<string, 1, "the url path is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url path is too long, it must be 2038 characters or less">]>, undefined>;
|
|
107
|
+
declare const IsValidUrlQuery: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url query">, v.TrimAction, v.MinLengthAction<string, 1, "the url query is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url query is too long, it must be 2038 characters or less">]>;
|
|
108
|
+
declare const IsValidOrUndefinedUrlQuery: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url query">, v.TrimAction, v.MinLengthAction<string, 1, "the url query is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url query is too long, it must be 2038 characters or less">]>, undefined>;
|
|
109
|
+
declare const IsValidUrlFragment: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url hash/fragment">, v.TrimAction, v.MinLengthAction<string, 1, "the url hash/fragment is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url hash/fragment is too long, it must be 2038 characters or less">]>;
|
|
110
|
+
declare const IsValidOrUndefinedUrlFragment: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a url hash/fragment">, v.TrimAction, v.MinLengthAction<string, 1, "the url hash/fragment is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2038, "the url hash/fragment is too long, it must be 2038 characters or less">]>, undefined>;
|
|
111
|
+
|
|
112
|
+
declare const IsValidUsername: v.SchemaWithPipe<readonly [v.StringSchema<"please provide a username">, v.TrimAction, v.MinLengthAction<string, 3, "your username is too short, it must be at least 3 characters">, v.MaxLengthAction<string, 255, "your username is too long, it must be 255 characters or less">, v.RegexAction<string, "your username can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
113
|
+
declare const IsValidOrUndefinedUsername: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide a username">, v.TrimAction, v.MinLengthAction<string, 3, "your username is too short, it must be at least 3 characters">, v.MaxLengthAction<string, 255, "your username is too long, it must be 255 characters or less">, v.RegexAction<string, "your username can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
114
|
+
declare const IsValidEmail: v.SchemaWithPipe<readonly [v.StringSchema<"please provide an email">, v.TrimAction, v.MinLengthAction<string, 5, "your email is too short, it must be at least 5 characters">, v.MaxLengthAction<string, 255, "your email is too long, it must be 255 characters or less">, v.EmailAction<string, "please provide a valid email address">]>;
|
|
115
|
+
declare const IsValidOrUndefinedEmail: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please provide an email">, v.TrimAction, v.MinLengthAction<string, 5, "your email is too short, it must be at least 5 characters">, v.MaxLengthAction<string, 255, "your email is too long, it must be 255 characters or less">, v.EmailAction<string, "please provide a valid email address">]>, undefined>;
|
|
116
|
+
declare const IsValidPassword: v.SchemaWithPipe<readonly [v.StringSchema<"a password is required">, v.TrimAction, v.MinLengthAction<string, 8, "your password is too short, it must be at least 8 characters">, v.MaxLengthAction<string, 255, "your password is too long, it must be 255 characters or less">]>;
|
|
117
|
+
declare const IsValidOrUndefinedPassword: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"a password is required">, v.TrimAction, v.MinLengthAction<string, 8, "your password is too short, it must be at least 8 characters">, v.MaxLengthAction<string, 255, "your password is too long, it must be 255 characters or less">]>, undefined>;
|
|
118
|
+
declare const IsValidProvider: v.SchemaWithPipe<readonly [v.StringSchema<"please enter a provider">, v.TrimAction, v.MaxLengthAction<string, 255, "the provider string is too long, it must be 255 characters or less">]>;
|
|
119
|
+
declare const IsValidOrUndefinedProvider: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<"please enter a provider">, v.TrimAction, v.MaxLengthAction<string, 255, "the provider string is too long, it must be 255 characters or less">]>, undefined>;
|
|
120
|
+
declare const IsValidConfirmed: v.BooleanSchema<undefined>;
|
|
121
|
+
declare const IsValidOrUndefinedConfirmed: v.UndefinedableSchema<v.BooleanSchema<undefined>, undefined>;
|
|
122
|
+
declare const IsValidBlocked: v.BooleanSchema<undefined>;
|
|
123
|
+
declare const IsValidOrUndefinedBlocked: v.UndefinedableSchema<v.BooleanSchema<undefined>, undefined>;
|
|
124
|
+
|
|
125
|
+
declare const IsValidUrlUtmSource: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_source is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_source is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_source can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
126
|
+
declare const IsValidOrUndefinedUrlUtmSource: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_source is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_source is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_source can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
127
|
+
declare const IsValidUrlUtmMedium: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_medium is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_medium is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_medium can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
128
|
+
declare const IsValidOrUndefinedUrlUtmMedium: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_medium is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2026, "the utm_medium is too long, it must be 2026 characters or less">, v.RegexAction<string, "utm_medium can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
129
|
+
declare const IsValidUrlUtmCampaign: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_campaign is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2024, "the utm_campaign is too long, it must be 2024 characters or less">, v.RegexAction<string, "utm_campaign can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
130
|
+
declare const IsValidOrUndefinedUrlUtmCampaign: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_campaign is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2024, "the utm_campaign is too long, it must be 2024 characters or less">, v.RegexAction<string, "utm_campaign can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
131
|
+
declare const IsValidUrlUtmCreativeFormat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_creative_format is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2017, "the utm_creative_format is too long, it must be 2017 characters or less">, v.RegexAction<string, "utm_creative_format can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
132
|
+
declare const IsValidOrUndefinedUrlUtmCreativeFormat: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_creative_format is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2017, "the utm_creative_format is too long, it must be 2017 characters or less">, v.RegexAction<string, "utm_creative_format can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
133
|
+
declare const IsValidUrlUtmContent: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_content is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2025, "the utm_content is too long, it must be 2025 characters or less">, v.RegexAction<string, "utm_content can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
134
|
+
declare const IsValidOrUndefinedUrlUtmContent: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_content is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2025, "the utm_content is too long, it must be 2025 characters or less">, v.RegexAction<string, "utm_content can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
135
|
+
declare const IsValidUrlUtmTerm: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_term is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2028, "the utm_term is too long, it must be 2028 characters or less">, v.RegexAction<string, "utm_term can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
136
|
+
declare const IsValidOrUndefinedUrlUtmTerm: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_term is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2028, "the utm_term is too long, it must be 2028 characters or less">, v.RegexAction<string, "utm_term can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
137
|
+
declare const IsValidUrlUtmId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_id is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2030, "the utm_id is too long, it must be 2030 characters or less">, v.RegexAction<string, "utm_id can only contain letters, numbers, and the special characters: - _ .">]>;
|
|
138
|
+
declare const IsValidOrUndefinedUrlUtmId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "the utm_id is too short, it must be at least 1 characters">, v.MaxLengthAction<string, 2030, "the utm_id is too long, it must be 2030 characters or less">, v.RegexAction<string, "utm_id can only contain letters, numbers, and the special characters: - _ .">]>, undefined>;
|
|
139
|
+
|
|
140
|
+
export { ERROR_MESSAGE_REGEX_DOMAIN, ERROR_MESSAGE_REGEX_VALUE, IsValidApplyValueAs, IsValidApplyValueTo, IsValidBlocked, IsValidConfirmed, IsValidCost, IsValidDescription, IsValidEmail, IsValidIsActive, IsValidLabel, IsValidName, IsValidOrUndefinedApplyValueAs, IsValidOrUndefinedApplyValueTo, IsValidOrUndefinedBlocked, IsValidOrUndefinedConfirmed, IsValidOrUndefinedCost, IsValidOrUndefinedDescription, IsValidOrUndefinedEmail, IsValidOrUndefinedIsActive, IsValidOrUndefinedLabel, IsValidOrUndefinedName, IsValidOrUndefinedPassword, IsValidOrUndefinedPriceId, IsValidOrUndefinedProductId, IsValidOrUndefinedProvider, IsValidOrUndefinedUnitAmount, IsValidOrUndefinedUnitTermInMonths, IsValidOrUndefinedUrlDestination, IsValidOrUndefinedUrlDomain, IsValidOrUndefinedUrlFragment, IsValidOrUndefinedUrlPath, IsValidOrUndefinedUrlProtocol, IsValidOrUndefinedUrlQuery, IsValidOrUndefinedUrlUtmCampaign, IsValidOrUndefinedUrlUtmContent, IsValidOrUndefinedUrlUtmCreativeFormat, IsValidOrUndefinedUrlUtmId, IsValidOrUndefinedUrlUtmMedium, IsValidOrUndefinedUrlUtmSource, IsValidOrUndefinedUrlUtmTerm, IsValidOrUndefinedUsername, IsValidOrUndefinedValue, IsValidPassword, IsValidPriceId, IsValidProductId, IsValidProvider, IsValidReferenceId, IsValidUnitAmount, IsValidUnitTermInMonths, IsValidUrlDestination, IsValidUrlDomain, IsValidUrlFragment, IsValidUrlPath, IsValidUrlProtocol, IsValidUrlQuery, IsValidUrlUtmCampaign, IsValidUrlUtmContent, IsValidUrlUtmCreativeFormat, IsValidUrlUtmId, IsValidUrlUtmMedium, IsValidUrlUtmSource, IsValidUrlUtmTerm, IsValidUsername, IsValidValue, LIMIT_MAX_DESCRIPTION, LIMIT_MAX_DESTINATION, LIMIT_MAX_DOMAIN, LIMIT_MAX_EMAIL, LIMIT_MAX_FRAGMENT, LIMIT_MAX_LABEL, LIMIT_MAX_NAME, LIMIT_MAX_PASSWORD, LIMIT_MAX_PATH, LIMIT_MAX_PRICE_ID, LIMIT_MAX_PRODUCT_ID, LIMIT_MAX_PROVIDER, LIMIT_MAX_QUERY, LIMIT_MAX_UNIT_TERM_IN_MONTHS, LIMIT_MAX_USERNAME, LIMIT_MAX_UTM_CAMPAIGN, LIMIT_MAX_UTM_CONTENT, LIMIT_MAX_UTM_CREATIVE_FORMAT, LIMIT_MAX_UTM_ID, LIMIT_MAX_UTM_MEDIUM, LIMIT_MAX_UTM_SOURCE, LIMIT_MAX_UTM_TERM, LIMIT_MAX_VALUE, LIMIT_MIN_DESTINATION, LIMIT_MIN_DOMAIN, LIMIT_MIN_EMAIL, LIMIT_MIN_FRAGMENT, LIMIT_MIN_LABEL, LIMIT_MIN_NAME, LIMIT_MIN_PASSWORD, LIMIT_MIN_PATH, LIMIT_MIN_PRICE_ID, LIMIT_MIN_PRODUCT_ID, LIMIT_MIN_QUERY, LIMIT_MIN_UNIT_AMOUNT, LIMIT_MIN_UNIT_TERM_IN_MONTHS, LIMIT_MIN_USERNAME, LIMIT_MIN_UTM_CAMPAIGN, LIMIT_MIN_UTM_CONTENT, LIMIT_MIN_UTM_CREATIVE_FORMAT, LIMIT_MIN_UTM_ID, LIMIT_MIN_UTM_MEDIUM, LIMIT_MIN_UTM_SOURCE, LIMIT_MIN_UTM_TERM, LIMIT_MIN_VALUE, REGEX_DOMAIN, REGEX_VALUE, isValidationFailure, isValidationSuccess, validateAndClean };
|
package/package.json
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joeygrable94/utm-src-pub-validators",
|
|
3
3
|
"description": "Schema Validator for UTM.Src.Pub types",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"author": "Joey Grable <joey@getcommunity.com> (https://joeygrable.com)",
|
|
6
6
|
"contributors": [],
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
11
18
|
"peerDependencies": {
|
|
12
19
|
"valibot": "^1.1.0"
|
|
13
20
|
},
|
|
21
|
+
"prettier": "@joeygrable94/config-prettier/package.js",
|
|
14
22
|
"keywords": [],
|
|
15
23
|
"license": "ISC",
|
|
16
24
|
"private": false,
|
|
@@ -20,6 +28,7 @@
|
|
|
20
28
|
"repository": "joeygrable94/utm-src-pub-validators.git",
|
|
21
29
|
"type": "module",
|
|
22
30
|
"devDependencies": {
|
|
31
|
+
"@joeygrable94/config-prettier": "^0.0.2",
|
|
23
32
|
"tsup": "^8.5.0"
|
|
24
33
|
},
|
|
25
34
|
"scripts": {
|